public void init(GhZcqc z) { zcqc = z; if (z.getZcTime() != null) { titlegettime.setValue(ConvertUtil.convertDate(DateUtil.getDateString(z.getZcTime()))); } if (z.getZcPubtime() != null) { gettime.setValue(ConvertUtil.convertDate(DateUtil.getDateString(z.getZcPubtime()))); } if (z.getZcNum() != null || z.getZcQuasym() != null || z.getZcPubdept() != null || z.getZcIdentdept() != null) { certifino.setValue(z.getZcNum()); qualino.setValue(z.getZcQuasym()); certifidept.setValue(z.getZcPubdept()); identdept.setValue(z.getZcIdentdept()); } /** 初始化附件 */ fileList.clear(); List<Jxkh_DataFile> list = userDetailService.getFileByUser(zcqc.getZcId(), Jxkh_DataFile.TITLE); if (list != null && list.size() > 0) { for (Jxkh_DataFile f : list) { if (f != null) { String[] s = new String[4]; s[0] = f.getFilePath(); s[1] = f.getFileName(); s[2] = f.getUpTime(); s[3] = Jxkh_DataFile.TRAIN.toString(); fileList.add(s); } } } fileListbox.setModel(new ListModelList(fileList)); }
public void onClick$save() throws WrongValueException, ParseException, InterruptedException { // user = (WkTUser) Sessions.getCurrent().getAttribute("user"); if (certifino.getValue() != null || certifidept.getValue() != null || qualino.getValue() != null || identdept.getValue() != null) { zcqc.setZcNum(certifino.getValue()); zcqc.setZcPubdept(certifidept.getValue()); zcqc.setZcQuasym(qualino.getValue()); zcqc.setZcIdentdept(identdept.getValue()); if (titlegettime.getValue() != null && gettime.getValue() != null) { @SuppressWarnings("deprecation") Date start = ff.parse(titlegettime.getValue().toLocaleString().substring(0, 10)); @SuppressWarnings("deprecation") Date end = ff.parse(gettime.getValue().toLocaleString().substring(0, 10)); if (start.after(end)) { Messagebox.show("请正确设置时间,开始时间在结束时间之前!", "提示", Messagebox.OK, Messagebox.INFORMATION); } else { zcqc.setZcTime(DateUtil.getDateString(titlegettime.getValue())); zcqc.setZcPubtime(DateUtil.getDateString(gettime.getValue())); zcqkService.update(zcqc); Messagebox.show("保存成功!", "提示", Messagebox.OK, Messagebox.INFORMATION); } } else { if (titlegettime.getValue() != null) { zcqc.setZcTime(DateUtil.getDateString(titlegettime.getValue())); zcqkService.update(zcqc); Messagebox.show("保存成功!", "提示", Messagebox.OK, Messagebox.INFORMATION); } if (gettime.getValue() != null) { zcqc.setZcPubtime(DateUtil.getDateString(gettime.getValue())); zcqkService.update(zcqc); Messagebox.show("保存成功!", "提示", Messagebox.OK, Messagebox.INFORMATION); } if (titlegettime.getValue() == null && gettime.getValue() == null) { zcqkService.update(zcqc); Messagebox.show("保存成功!", "提示", Messagebox.OK, Messagebox.INFORMATION); } } /** 保存附件 */ // 先删除原来的附件 List<Jxkh_DataFile> list = userDetailService.getFileByUser(zcqc.getZcId(), Jxkh_DataFile.TITLE); if (list != null && list.size() > 0) { for (Jxkh_DataFile f : list) { if (f != null) zcqkService.delete(f); } } // 再保存新的附件 if (fileList.size() > 0) { for (String[] s : fileList) { if (s != null) { Jxkh_DataFile f = new Jxkh_DataFile(); f.setUserId(zcqc.getZcId()); f.setFilePath(s[0]); f.setFileName(s[1]); f.setUpTime(s[2]); f.setFileType(Jxkh_DataFile.TITLE); zcqkService.save(f); } } } this.detach(); Events.postEvent(Events.ON_CHANGE, this, null); } }