|
@@ -3,7 +3,9 @@
|
|
|
*/
|
|
|
package com.jeeplus.modules.sg.managementcenter.activiti.web;
|
|
|
import com.jeeplus.modules.sys.entity.Office;
|
|
|
-import java.util.Date;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
import com.jeeplus.modules.act.entity.Act;
|
|
|
import com.jeeplus.modules.sys.entity.User;
|
|
|
import com.jeeplus.core.persistence.Page;
|
|
@@ -55,9 +57,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.ConstraintViolationException;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* 施工交底Controller
|
|
@@ -166,97 +165,103 @@ public class ConstructionController extends BaseController {
|
|
|
j.setMsg(errMsg);
|
|
|
return j;
|
|
|
}
|
|
|
- Project project = new Project();
|
|
|
/**
|
|
|
* 流程审批
|
|
|
*/
|
|
|
|
|
|
- if (StringUtils.isBlank(construction.getId())) {
|
|
|
- //新增或编辑表单保存
|
|
|
- for (int i = 0; i <2; i++) {
|
|
|
- Map<String, Object> vars = Maps.newHashMap();
|
|
|
- if (i == 0) {
|
|
|
- vars.put("company", true);
|
|
|
- vars.put("manager", false);
|
|
|
+ if (StringUtils.isBlank(construction.getId())) {
|
|
|
+ //用于记录未发起的流程原因
|
|
|
+ String info = "";
|
|
|
+ //用户修改发起流程后的项目状态
|
|
|
+ Project newProject = new Project();
|
|
|
+ //定义vars用于指派流程走向
|
|
|
+ Map<String, Object> vars = Maps.newHashMap();
|
|
|
+ //获取选择的项目信息id
|
|
|
+ String projectId = construction.getProjectId();
|
|
|
+ //项目施工单位字段定义
|
|
|
+ String constructionUnit = "";
|
|
|
+ //定义施工单位角色
|
|
|
+ String constructionUnitRole = "";
|
|
|
+ //定义项目经理角色
|
|
|
+ String projectManageRole = "";
|
|
|
+ //根据,分割得到选择项目的id数组
|
|
|
+ String[] proListId = projectId.split(",");
|
|
|
+ //根据数组查询得到项目信息
|
|
|
+ List<Project> listById = projectService.findListById(proListId);
|
|
|
+ //循环项目信息
|
|
|
+ for (Project each : listById) {
|
|
|
+ //从项目信息种获取施工单位字段
|
|
|
+ constructionUnit = each.getClarificaitonType();
|
|
|
+ //如果施工单位不为空,系统判读施工单位交底
|
|
|
+ if ("施工单位自行交底".equals(constructionUnit)) {
|
|
|
+ //施工单位交底
|
|
|
+ //获取施工单位角色
|
|
|
+ constructionUnitRole = each.getConstructionUnitRole();
|
|
|
+ //查询是否有此登录名用户
|
|
|
+ User user = constructionService.queryPerson(constructionUnitRole);
|
|
|
+ //如果查询不为空表示有用户,为空没有此用户
|
|
|
+ if (user != null) {
|
|
|
+ //有此用户-施工单位交底
|
|
|
+ vars.put("company", true);
|
|
|
+ vars.put("manager", false);
|
|
|
+ vars.put("processer", constructionUnitRole);
|
|
|
+ String id = each.getId();
|
|
|
+ construction.setApplyName(constructionUnitRole);
|
|
|
+ construction.setProjectId(id);
|
|
|
+ construction.setProjectName(each.getRequireName());
|
|
|
+ constructionService.newSave(construction);//保存
|
|
|
+ newProject.setStatus("1");
|
|
|
+ newProject.setProjectId(id);
|
|
|
+ projectService.updateStatus(newProject);
|
|
|
+ String procDefKey = construction.getAct().getProcDefKey();
|
|
|
+ // 启动流程
|
|
|
+ ProcessDefinition p = actProcessService.getProcessDefinition(construction.getAct().getProcDefId());
|
|
|
+ String title = construction.getCurrentUser().getName() + "在" + DateUtils.getDateTime() + "发起" + p.getName();
|
|
|
+ actTaskService.startProcessNew(p.getKey(), "xm_construction_clarificaiton", construction.getId(), title, vars);
|
|
|
+ } else {
|
|
|
+ //没有此用户
|
|
|
+ info += ("项目:"+each.getRequireName()+"没有此施工单位人员,请核实。");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
} else {
|
|
|
- vars.put("company", false);
|
|
|
- vars.put("manager", true);
|
|
|
+ //项目经理交底
|
|
|
+ //获取项目经理角色
|
|
|
+ projectManageRole = each.getProjectManageRole();
|
|
|
+ //查询是否有此登录名用户
|
|
|
+ User user = constructionService.queryPerson(projectManageRole);
|
|
|
+ //查询是否有此用户
|
|
|
+ if (user != null) {
|
|
|
+ //有此用户
|
|
|
+ vars.put("company", false);
|
|
|
+ vars.put("manager", true);
|
|
|
+ vars.put("processer", projectManageRole);
|
|
|
+ String id = each.getId();
|
|
|
+ construction.setApplyName(projectManageRole);
|
|
|
+ construction.setProjectId(id);
|
|
|
+ construction.setProjectName(each.getRequireName());
|
|
|
+ constructionService.newSave(construction);//保存
|
|
|
+ newProject.setStatus("1");
|
|
|
+ newProject.setProjectId(id);
|
|
|
+ projectService.updateStatus(newProject);
|
|
|
+ String procDefKey = construction.getAct().getProcDefKey();
|
|
|
+ // 启动流程
|
|
|
+ ProcessDefinition p = actProcessService.getProcessDefinition(construction.getAct().getProcDefId());
|
|
|
+ String title = construction.getCurrentUser().getName() + "在" + DateUtils.getDateTime() + "发起" + p.getName();
|
|
|
+ actTaskService.startProcessNew(p.getKey(), "xm_construction_clarificaiton", construction.getId(), title, vars);
|
|
|
+ } else {
|
|
|
+ //没有此用户
|
|
|
+ info += ("项目:"+each.getRequireName()+"没有此项目经理,请核实。");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
- construction.setApplyName(construction.getTuser().getName());
|
|
|
- constructionService.save(construction);//保存
|
|
|
- project.setStatus("1");
|
|
|
- project.setRequireName(construction.getProjectName());
|
|
|
- projectService.updateStatus(project);
|
|
|
- String procDefKey = construction.getAct().getProcDefKey();
|
|
|
- // 启动流程
|
|
|
- ProcessDefinition p = actProcessService.getProcessDefinition(construction.getAct().getProcDefId());
|
|
|
- vars.put("processer", UserUtils.get(construction.getTuser().getId()).getLoginName());
|
|
|
- String title = construction.getCurrentUser().getName() + "在" + DateUtils.getDateTime() + "发起" + p.getName();
|
|
|
- actTaskService.startProcessNew(p.getKey(), "xm_construction_clarificaiton", construction.getId(), title, vars);
|
|
|
}
|
|
|
- j.setMsg("发起流程审批成功!");
|
|
|
+ //新增或编辑表单保存
|
|
|
+ j.setMsg("发起流程审批成功!"+info);
|
|
|
j.getBody().put("targetUrl", "/act/task/process/");
|
|
|
}
|
|
|
return j;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导入图纸审核信息
|
|
|
- */
|
|
|
-// @RequiresPermissions("modules:sg:information:information:import")
|
|
|
- @ResponseBody
|
|
|
- @RequestMapping(value = "drawingReview")
|
|
|
- public AjaxJson drawingReview(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request, String id) {
|
|
|
- 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();
|
|
|
- Construction construction = new Construction();
|
|
|
- for (int i = 1; i < lastDataRowNum; i++) {
|
|
|
- Row row = ei.getRow(i);
|
|
|
- construction.setId(id);
|
|
|
- construction.setPowerLine(ei.getCellValue(row, 0 ).toString());
|
|
|
- construction.setBlackoutArea(ei.getCellValue(row, 1 ).toString());
|
|
|
- construction.setProjectType(ei.getCellValue(row, 2 ).toString());
|
|
|
- construction.setPowerFailure(ei.getCellValue(row, 3 ).toString());
|
|
|
- construction.setPreliminaryJudgment(ei.getCellValue(row, 4 ).toString());
|
|
|
- construction.setCivilEngineering(ei.getCellValue(row, 5 ).toString());
|
|
|
- construction.setBaseType(ei.getCellValue(row, 6 ).toString());
|
|
|
- construction.setPlanApproval(ei.getCellValue(row, 7 ).toString());
|
|
|
- construction.setTransformationType(ei.getCellValue(row, 8 ).toString());
|
|
|
- construction.setTransformationEquipment(ei.getCellValue(row, 9 ).toString());
|
|
|
- construction.setNewNamed(ei.getCellValue(row, 10).toString());
|
|
|
- construction.setPutInto(ei.getCellValue(row, 11).toString());
|
|
|
- construction.setElectricalConstruction(ei.getCellValue(row, 12).toString());
|
|
|
- construction.setTheAssignment(ei.getCellValue(row, 13).toString());
|
|
|
- construction.setAutomation(ei.getCellValue(row, 14).toString());
|
|
|
- construction.setRemote(ei.getCellValue(row, 15).toString());
|
|
|
- construction.setCommunicationMode(ei.getCellValue(row, 16).toString());
|
|
|
- construction.setInSitu(ei.getCellValue(row, 17).toString());
|
|
|
- construction.setNetworkCabinet(ei.getCellValue(row, 18).toString());
|
|
|
- construction.setStation(ei.getCellValue(row, 19).toString());
|
|
|
- }
|
|
|
- try {
|
|
|
- constructionService.newUpdate(construction);
|
|
|
- successNum++;
|
|
|
- } catch (ConstraintViolationException ex) {
|
|
|
- failureNum++;
|
|
|
- } catch (Exception ex) {
|
|
|
- failureNum++;
|
|
|
- }
|
|
|
- if (failureNum > 0) {
|
|
|
- failureMsg.insert(0, ",失败 " + failureNum + " 条票务代理记录。");
|
|
|
- }
|
|
|
- j.setMsg("已成功导入 " + successNum + " 条票务代理记录" + failureMsg);
|
|
|
- } catch (Exception e) {
|
|
|
- j.setSuccess(false);
|
|
|
- j.setMsg("导入票务代理失败!失败信息:" + e.getMessage());
|
|
|
- }
|
|
|
- return j;
|
|
|
- }
|
|
|
|
|
|
|
|
|
}
|