コード例 #1
0
ファイル: TechReportingAction.java プロジェクト: wj1s/gp
 // 审核
 public String auditTechReport() {
   String id = ((String[]) formMap.get("id"))[0] + "";
   String workflowId = ((String[]) formMap.get("workflowId"))[0] + ""; // 存放workflowid
   String ifBackFlag = ((String[]) formMap.get("ifBackFlag"))[0] + "";
   String checkContent = ((String[]) formMap.get("checkContent"))[0] + "";
   if (ifBackFlag.equals("1")) {
     TechReptDef instance = techReptDefService.get(Long.parseLong(id));
     // 更新审核人
     List<ReptTechDtl> reptTechDtls = instance.getReptTechDtl();
     for (int i = 0; i < reptTechDtls.size(); i++) {
       ReptTechDtl rtd = reptTechDtls.get(i);
       rtd.setGovernor(getCurUser().getName());
     }
     techReptDefService.save(instance);
     if (checkContent == null) {
       checkContent = "批准审核";
     }
     workFlowService.endTaskInstance(
         Long.parseLong(workflowId), getCurUser().getName(), checkContent);
   } else {
     if (checkContent == null) {
       checkContent = "驳回审核";
     }
     workFlowService.endTaskInstance(Long.parseLong(workflowId), "驳回", getCurUser(), checkContent);
   }
   return "backToTop";
 }
コード例 #2
0
ファイル: TechReportingAction.java プロジェクト: wj1s/gp
 // 删除文件
 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;
 }
コード例 #3
0
ファイル: TechReportingAction.java プロジェクト: wj1s/gp
 // 上传文件
 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;
 }
コード例 #4
0
ファイル: TechReportingAction.java プロジェクト: wj1s/gp
 // 下载
 public String downLoadOne() throws Exception {
   String id = ((String[]) formMap.get("id"))[0] + ""; // 获取id
   String ifBackFlag = ((String[]) formMap.get("ifBackFlag"))[0] + ""; // 下载模版还是下载附件 -TECH附件 PATT模版
   ReptTechDtl rt = techReptDtlService.get(Long.parseLong(id)); // dtl
   String path = ""; // path
   String tempName = "";
   List dirList = paraDtlService.get(Dir.class); // 获取事故性质的list
   for (int i = 0; i < dirList.size(); i++) {
     Dir d = (Dir) dirList.get(i);
     if ((d.getParaCode().equalsIgnoreCase("PATT")) && (ifBackFlag.equals("PATT"))) {
       path = d.getCodeDesc() + rt.getReptPattern().getPatternName(); // 路径
       tempName = rt.getAttachName(); // 名
     }
     if ((d.getParaCode().equalsIgnoreCase("TECH")) && (ifBackFlag.equals("TECH"))) {
       path =
           d.getCodeDesc()
               + rt.getTechReptDef().getId()
               + rt.getTechReptDef().getName()
               + "\\"
               + rt.getSaveName(); // 附件路径
       tempName = rt.getUploadName(); // 名
     }
   }
   File file = new File(path);
   if (!file.exists()) {
     return null;
   }
   list = new ArrayList();
   list.add(tempName);
   list.add(file);
   return FILE;
 }