@Test public void testGetByStartDateEndDate() { Date startDate = DateUtil.createDate("2010-10-01"); Date endDate = DateUtil.createDate("2010-10-31"); List<Operation> list = operationService.get(startDate, endDate); assertEquals(5, list.size()); }
// 上传文件 public String upLoadOne() throws Exception { JSONObject jsonObject = new JSONObject(); String id = ((String[]) formMap.get("id"))[0] + ""; // 获取id String uploadName = ((String[]) formMap.get("uploadName"))[0] + ""; // 获取id ReptTechDtl rt = techReptDtlService.get(Long.parseLong(id)); // dtl try { String targetDirectory = getTechPath() + rt.getTechReptDef().getId() + rt.getTechReptDef().getName(); String temArr[] = uploadName.split("\\."); String fileName = UUID.randomUUID().toString(); // 读取 if (temArr.length != 0) { fileName = fileName + "." + temArr[temArr.length - 1]; } File target = new File(targetDirectory, fileName); FileUtils.copyFile(formFile, target); // 更新技办人 和上传名称和实际存放的名称 rt.setTekofficer(getCurUser().getName()); // rt.setUploadName(uploadName); rt.setSaveName(fileName); rt.setUpdDate(DateUtil.dateToDateByFormat(utilService.getSysTime(), DateUtil.FORMAT)); techReptDtlService.save(rt); } catch (Exception e) { e.printStackTrace(); jsonObject.put("result", false); json = jsonObject.toString(); return EASYFILE; } jsonObject.put("result", true); json = jsonObject.toString(); return EASYFILE; }
// 删除文件 public String delLoadOne() throws Exception { String id = ((String[]) formMap.get("id"))[0] + ""; // 获取id ReptTechDtl rt = techReptDtlService.get(Long.parseLong(id)); // dtl JSONObject jsonObject = new JSONObject(); try { if (deleteFile( rt.getTechReptDef().getId() + rt.getTechReptDef().getName(), rt.getSaveName())) { // 删除文件 rt.setTekofficer(getCurUser().getName()); // 更新技办人 和上传名称和实际存放的名称 rt.setUploadName(null); rt.setSaveName(null); rt.setUpdDate(DateUtil.dateToDateByFormat(utilService.getSysTime(), DateUtil.FORMAT)); techReptDtlService.save(rt); } else { jsonObject.put("result", false); json = jsonObject.toString(); return EASY; } } catch (Exception e) { jsonObject.put("result", false); json = jsonObject.toString(); return EASY; } jsonObject.put("result", true); json = jsonObject.toString(); return EASY; }
@Override public String load() { try { TechReptDef instance = new TechReptDef(); if (formMap.get("startDate") != null && !(((String[]) formMap.get("startDate"))[0]).equals("")) { instance.setStartDate( DateUtil.stringToDate(((String[]) formMap.get("startDate"))[0] + "", DateUtil.FORMAT)); } if (((formMap.get("endDate"))) != null && !(((String[]) formMap.get("endDate"))[0]).equals("")) { instance.setEndDate( DateUtil.stringToDate(((String[]) formMap.get("endDate"))[0] + "", DateUtil.FORMAT)); } // 更新人不能为空 instance.setReptFlag(true); // 列表中的一定是编辑过的 techReptDefService.findByInstance(instance, carrier); } catch (Exception e) { e.printStackTrace(); } return GRID; }
// 新建流程并提交 public void startWorkFlow(TechReptDef instance) { Person person = getCurUser(); // 任务描述 String discription = "上报时间:" + DateUtil.dateToString(instance.getUpdDate(), DateUtil.FORMAT) + ",报表名称:" + instance.getName(); workFlowService.startProcessInstance( ProcessEnum.REPT_TECH.getDataSource(), instance.getId() + "", discription, person, "提交审核", person.getDept(), FunModule.ACCD); }