|
@@ -3,6 +3,7 @@
|
|
|
*/
|
|
|
package com.jeeplus.modules.sg.managementcenter.activiti.web;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.net.URLDecoder;
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
@@ -20,6 +21,7 @@ import com.jeeplus.modules.sg.managementcenter.activiti.service.DiscloseService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.service.UploadImagesService;
|
|
|
import org.activiti.engine.*;
|
|
|
import org.activiti.engine.repository.ProcessDefinition;
|
|
|
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -33,6 +35,7 @@ import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 施工交底Controller
|
|
|
+ *
|
|
|
* @author
|
|
|
* @version 2019-11-08
|
|
|
*/
|
|
@@ -41,32 +44,32 @@ import java.util.Map;
|
|
|
|
|
|
public class DivideController extends BaseController {
|
|
|
|
|
|
- @Autowired
|
|
|
- private ConstructionService constructionService;
|
|
|
- @Autowired
|
|
|
- private ActProcessService actProcessService;
|
|
|
- @Autowired
|
|
|
- private ActTaskService actTaskService;
|
|
|
- @Autowired
|
|
|
- private DiscloseService discloseService;
|
|
|
- @Autowired
|
|
|
- private UploadImagesService uploadImagesService;
|
|
|
- @Autowired
|
|
|
- private TaskService taskService;
|
|
|
- @Autowired
|
|
|
- private RuntimeService runtimeService;
|
|
|
- @ModelAttribute
|
|
|
- public Construction get(@RequestParam(required=false) String id) {
|
|
|
- Construction entity = null;
|
|
|
- if (StringUtils.isNotBlank(id)){
|
|
|
- entity = constructionService.get(id);
|
|
|
- }
|
|
|
- if (entity == null){
|
|
|
- entity = new Construction();
|
|
|
- }
|
|
|
- return entity;
|
|
|
- }
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ConstructionService constructionService;
|
|
|
+ @Autowired
|
|
|
+ private ActProcessService actProcessService;
|
|
|
+ @Autowired
|
|
|
+ private ActTaskService actTaskService;
|
|
|
+ @Autowired
|
|
|
+ private DiscloseService discloseService;
|
|
|
+ @Autowired
|
|
|
+ private UploadImagesService uploadImagesService;
|
|
|
+ @Autowired
|
|
|
+ private TaskService taskService;
|
|
|
+ @Autowired
|
|
|
+ private RuntimeService runtimeService;
|
|
|
+
|
|
|
+ @ModelAttribute
|
|
|
+ public Construction get(@RequestParam(required = false) String id) {
|
|
|
+ Construction entity = null;
|
|
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
+ entity = constructionService.get(id);
|
|
|
+ }
|
|
|
+ if (entity == null) {
|
|
|
+ entity = new Construction();
|
|
|
+ }
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
// /**
|
|
@@ -79,136 +82,154 @@ public class DivideController extends BaseController {
|
|
|
// }*/
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 查看,增加,编辑请假申请表单页面
|
|
|
- */
|
|
|
- @RequestMapping(value = "form/{mode}")
|
|
|
- public String form(@PathVariable String mode, Construction construction, Model model) {
|
|
|
+ /**
|
|
|
+ * 查看,增加,编辑请假申请表单页面
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "form/{mode}")
|
|
|
+ public String form(@PathVariable String mode, Construction construction, Model model) {
|
|
|
|
|
|
- model.addAttribute("construction", construction);
|
|
|
- if("audit".equals(mode)){
|
|
|
- return "modules/sg/managementcenter/activiti/divideAudit";
|
|
|
- }else{//add
|
|
|
- //项目经理组织交底
|
|
|
- return "modules/sg/managementcenter/activiti/divideForm";
|
|
|
- }
|
|
|
+ model.addAttribute("construction", construction);
|
|
|
+ if ("audit".equals(mode)) {
|
|
|
+ return "modules/sg/managementcenter/activiti/divideAudit";
|
|
|
+ } else {//add
|
|
|
+ //项目经理组织交底
|
|
|
+ return "modules/sg/managementcenter/activiti/divideForm";
|
|
|
+ }
|
|
|
// return "modules/sg/managementcenter/activiti/constructionForm";
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存请假申请
|
|
|
- */
|
|
|
- @ResponseBody
|
|
|
- @RequestMapping(value = "save")
|
|
|
- public AjaxJson save(Disclose disclose, Model model) throws Exception{
|
|
|
- AjaxJson j = new AjaxJson();
|
|
|
- /**
|
|
|
- * 后台hibernate-validation插件校验
|
|
|
- */
|
|
|
- String errMsg = beanValidator(disclose);
|
|
|
- if (StringUtils.isNotBlank(errMsg)){
|
|
|
- j.setSuccess(false);
|
|
|
- j.setMsg(errMsg);
|
|
|
- return j;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 流程审批
|
|
|
- */
|
|
|
- if (StringUtils.isBlank(disclose.getId())){
|
|
|
- //新增或编辑表单保存
|
|
|
- discloseService.save(disclose);//保存
|
|
|
- // 启动流程
|
|
|
- ProcessDefinition p = actProcessService.getProcessDefinition(disclose.getAct().getProcDefId());
|
|
|
- String title = disclose.getCurrentUser().getName()+"在"+ DateUtils.getDateTime()+"发起"+p.getName();
|
|
|
- actTaskService.startProcess(p.getKey(), "xm_construction_clarificaiton", disclose.getId(), title);
|
|
|
- j.setMsg("发起流程审批成功!");
|
|
|
- j.getBody().put("targetUrl", "/act/task/process/");
|
|
|
- }else{
|
|
|
- //新增或编辑表单保存
|
|
|
- discloseService.save(disclose);//保存
|
|
|
- disclose.getAct().setComment(("yes".equals(disclose.getAct().getFlag())?"[重新申请] ":"[销毁申请] "));
|
|
|
- // 完成流程任务
|
|
|
- Map<String, Object> vars = Maps.newHashMap();
|
|
|
- vars.put("reapply", "yes".equals(disclose.getAct().getFlag())? true : false);
|
|
|
- actTaskService.complete(disclose.getAct().getTaskId(), disclose.getAct().getProcInsId(), disclose.getAct().getComment(), disclose.getContent(), vars);
|
|
|
- j.setMsg("提交成功!");
|
|
|
- j.getBody().put("targetUrl", "/act/task/todo/");
|
|
|
- }
|
|
|
- return j;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 导入交底结论
|
|
|
- */
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存请假申请
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "save")
|
|
|
+ public AjaxJson save(Disclose disclose, Model model) throws Exception {
|
|
|
+ AjaxJson j = new AjaxJson();
|
|
|
+ /**
|
|
|
+ * 后台hibernate-validation插件校验
|
|
|
+ */
|
|
|
+ String errMsg = beanValidator(disclose);
|
|
|
+ if (StringUtils.isNotBlank(errMsg)) {
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg(errMsg);
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 流程审批
|
|
|
+ */
|
|
|
+ if (StringUtils.isBlank(disclose.getId())) {
|
|
|
+ //新增或编辑表单保存
|
|
|
+ discloseService.save(disclose);//保存
|
|
|
+ // 启动流程
|
|
|
+ ProcessDefinition p = actProcessService.getProcessDefinition(disclose.getAct().getProcDefId());
|
|
|
+ String title = disclose.getCurrentUser().getName() + "在" + DateUtils.getDateTime() + "发起" + p.getName();
|
|
|
+ actTaskService.startProcess(p.getKey(), "xm_construction_clarificaiton", disclose.getId(), title);
|
|
|
+ j.setMsg("发起流程审批成功!");
|
|
|
+ j.getBody().put("targetUrl", "/act/task/process/");
|
|
|
+ } else {
|
|
|
+ //新增或编辑表单保存
|
|
|
+ discloseService.save(disclose);//保存
|
|
|
+ disclose.getAct().setComment(("yes".equals(disclose.getAct().getFlag()) ? "[重新申请] " : "[销毁申请] "));
|
|
|
+ // 完成流程任务
|
|
|
+ Map<String, Object> vars = Maps.newHashMap();
|
|
|
+ vars.put("reapply", "yes".equals(disclose.getAct().getFlag()) ? true : false);
|
|
|
+ actTaskService.complete(disclose.getAct().getTaskId(), disclose.getAct().getProcInsId(), disclose.getAct().getComment(), disclose.getContent(), vars);
|
|
|
+ j.setMsg("提交成功!");
|
|
|
+ j.getBody().put("targetUrl", "/act/task/todo/");
|
|
|
+ }
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 旧)导入交底结论,正在使用
|
|
|
+ * */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "importConclusion")
|
|
|
+ public AjaxJson importConclusion(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request, String procInsId,String projectName) {
|
|
|
+ AjaxJson j = new AjaxJson();
|
|
|
+ try {
|
|
|
+ int successNum = 0;
|
|
|
+ int failureNum = 0;
|
|
|
+ StringBuilder failureMsg = new StringBuilder();
|
|
|
+ ImportExcel ei = new ImportExcel(file, 1, 0);
|
|
|
+ int lastDataRowNum = ei.getLastDataRowNum();
|
|
|
+ Disclose disclose = new Disclose();
|
|
|
+ for (int i = 1; i < lastDataRowNum; i++) {
|
|
|
+ Row row = ei.getRow(i);
|
|
|
+ disclose.setProcInsId(procInsId);
|
|
|
+ projectName = URLDecoder.decode(projectName, "UTF-8");
|
|
|
+ String requireName = ei.getCellValue(row, 1).toString();
|
|
|
+ if (projectName.equals(requireName)) {
|
|
|
+ disclose.setRequireName(requireName);
|
|
|
+ disclose.setConId(requireName);
|
|
|
+ disclose.setProjectNumber(ei.getCellValue(row, 2).toString());
|
|
|
+ disclose.setProjectName(ei.getCellValue(row, 3).toString());
|
|
|
+ disclose.setProjectId(ei.getCellValue(row, 4).toString());
|
|
|
+ disclose.setChannel(ei.getCellValue(row, 5).toString());
|
|
|
+ disclose.setCapacity(ei.getCellValue(row, 6).toString());
|
|
|
+ disclose.setSceneSize(ei.getCellValue(row, 7).toString());
|
|
|
+ disclose.setCapacitySize(ei.getCellValue(row, 8).toString());
|
|
|
+ disclose.setHiddenDanger(ei.getCellValue(row, 9).toString());
|
|
|
+ disclose.setInfluenceConstruction(ei.getCellValue(row, 10).toString());
|
|
|
+ disclose.setProjectRepetition(ei.getCellValue(row, 11).toString());
|
|
|
+ disclose.setImplemented(ei.getCellValue(row, 12).toString());
|
|
|
+ disclose.setTransformer(ei.getCellValue(row, 13).toString());
|
|
|
+ disclose.setExplanationOfNecessity(ei.getCellValue(row, 14).toString());
|
|
|
+ disclose.setLineName(ei.getCellValue(row, 15).toString());
|
|
|
+ disclose.setQuantities(ei.getCellValue(row, 16).toString());
|
|
|
+ disclose.setRodNumber(ei.getCellValue(row, 17).toString());
|
|
|
+ disclose.setInconsistentDescription(ei.getCellValue(row, 18).toString());
|
|
|
+ disclose.setAdministrationType(ei.getCellValue(row, 19).toString());
|
|
|
+ disclose.setPrecondition(ei.getCellValue(row, 20).toString());
|
|
|
+ disclose.setPolicyHandlingInstructions(ei.getCellValue(row, 21).toString());
|
|
|
+ disclose.setPlacementMode(ei.getCellValue(row, 22).toString());
|
|
|
+ disclose.setProductionDate(ei.getCellValue(row, 23).toString());
|
|
|
+ disclose.setIntegrateModule(ei.getCellValue(row, 24).toString());
|
|
|
+ disclose.setNeedReplace(ei.getCellValue(row, 25).toString());
|
|
|
+ disclose.setOverallTransformation(ei.getCellValue(row, 26).toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ discloseService.newInsert(disclose);
|
|
|
+ successNum++;
|
|
|
+ } catch (Exception ex) {
|
|
|
+ failureNum++;
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ if (failureNum > 0) {
|
|
|
+ failureMsg.insert(0, ",失败 " + failureNum + " 记录。");
|
|
|
+ }
|
|
|
+ j.setMsg("已成功导入 " + successNum + " 记录" + failureMsg);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("导入失败!失败信息:" + e.getMessage());
|
|
|
+ }
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新导入交底结论(未使用)
|
|
|
+ */
|
|
|
// @RequiresPermissions("modules:sg:information:information:import")
|
|
|
- @ResponseBody
|
|
|
- @RequestMapping(value = "importConclusion")
|
|
|
- public AjaxJson importConclusion(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request, String procInsId,String projectName) {
|
|
|
- AjaxJson j = new AjaxJson();
|
|
|
- try {
|
|
|
- int successNum = 0;
|
|
|
- int failureNum = 0;
|
|
|
- StringBuilder failureMsg = new StringBuilder();
|
|
|
- ImportExcel ei = new ImportExcel(file, 1, 0);
|
|
|
- int lastDataRowNum = ei.getLastDataRowNum();
|
|
|
- Disclose disclose = new Disclose();
|
|
|
- for (int i = 1; i < lastDataRowNum; i++) {
|
|
|
- Row row = ei.getRow(i);
|
|
|
- disclose.setProcInsId(procInsId);
|
|
|
- projectName = URLDecoder.decode(projectName, "UTF-8");
|
|
|
- String requireName = ei.getCellValue(row, 1).toString();
|
|
|
- if (projectName.equals(requireName)) {
|
|
|
- disclose.setRequireName(requireName);
|
|
|
- disclose.setConId(requireName);
|
|
|
- disclose.setProjectNumber(ei.getCellValue(row, 2).toString());
|
|
|
- disclose.setProjectName(ei.getCellValue(row, 3).toString());
|
|
|
- disclose.setProjectId(ei.getCellValue(row, 4).toString());
|
|
|
- disclose.setChannel(ei.getCellValue(row, 5).toString());
|
|
|
- disclose.setCapacity(ei.getCellValue(row, 6).toString());
|
|
|
- disclose.setSceneSize(ei.getCellValue(row, 7).toString());
|
|
|
- disclose.setCapacitySize(ei.getCellValue(row, 8).toString());
|
|
|
- disclose.setHiddenDanger(ei.getCellValue(row, 9).toString());
|
|
|
- disclose.setInfluenceConstruction(ei.getCellValue(row, 10).toString());
|
|
|
- disclose.setProjectRepetition(ei.getCellValue(row, 11).toString());
|
|
|
- disclose.setImplemented(ei.getCellValue(row, 12).toString());
|
|
|
- disclose.setTransformer(ei.getCellValue(row, 13).toString());
|
|
|
- disclose.setExplanationOfNecessity(ei.getCellValue(row, 14).toString());
|
|
|
- disclose.setLineName(ei.getCellValue(row, 15).toString());
|
|
|
- disclose.setQuantities(ei.getCellValue(row, 16).toString());
|
|
|
- disclose.setRodNumber(ei.getCellValue(row, 17).toString());
|
|
|
- disclose.setInconsistentDescription(ei.getCellValue(row, 18).toString());
|
|
|
- disclose.setAdministrationType(ei.getCellValue(row, 19).toString());
|
|
|
- disclose.setPrecondition(ei.getCellValue(row, 20).toString());
|
|
|
- disclose.setPolicyHandlingInstructions(ei.getCellValue(row, 21).toString());
|
|
|
- disclose.setPlacementMode(ei.getCellValue(row, 22).toString());
|
|
|
- disclose.setProductionDate(ei.getCellValue(row, 23).toString());
|
|
|
- disclose.setIntegrateModule(ei.getCellValue(row, 24).toString());
|
|
|
- disclose.setNeedReplace(ei.getCellValue(row, 25).toString());
|
|
|
- disclose.setOverallTransformation(ei.getCellValue(row, 26).toString());
|
|
|
- }
|
|
|
- }
|
|
|
- try {
|
|
|
- discloseService.newInsert(disclose);
|
|
|
- successNum++;
|
|
|
- } catch (Exception ex) {
|
|
|
- failureNum++;
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- if (failureNum > 0) {
|
|
|
- failureMsg.insert(0, ",失败 " + failureNum + " 记录。");
|
|
|
- }
|
|
|
- j.setMsg("已成功导入 " + successNum + " 记录" + failureMsg);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- j.setSuccess(false);
|
|
|
- j.setMsg("导入失败!失败信息:" + e.getMessage());
|
|
|
- }
|
|
|
- return j;
|
|
|
- }
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "importConclusion1")
|
|
|
+ public AjaxJson importConclusion1(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request, String procInsId, String projectName) {
|
|
|
+ AjaxJson j = new AjaxJson();
|
|
|
+ ImportExcel ei = null;
|
|
|
+ try {
|
|
|
+ ei = new ImportExcel(file, 1, 0);
|
|
|
+ int lastDataRowNum = ei.getLastDataRowNum();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return j;
|
|
|
+ }
|
|
|
|
|
|
}
|