|
@@ -16,9 +16,13 @@ import com.jeeplus.modules.act.service.ActProcessService;
|
|
|
import com.jeeplus.modules.act.service.ActTaskService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.entity.Construction;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.entity.Disclose;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.activiti.entity.FindTask;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.activiti.entity.MyNeedList;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.service.DiscloseService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.service.UploadImagesService;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyImportUtils;
|
|
|
import org.activiti.engine.*;
|
|
|
import org.activiti.engine.repository.ProcessDefinition;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
@@ -28,10 +32,11 @@ import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+import springfox.documentation.schema.Entry;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 施工交底Controller
|
|
@@ -59,6 +64,7 @@ public class DivideController extends BaseController {
|
|
|
@Autowired
|
|
|
private RuntimeService runtimeService;
|
|
|
|
|
|
+
|
|
|
@ModelAttribute
|
|
|
public Construction get(@RequestParam(required = false) String id) {
|
|
|
Construction entity = null;
|
|
@@ -146,7 +152,7 @@ public class DivideController extends BaseController {
|
|
|
/**
|
|
|
* 旧)导入交底结论,正在使用
|
|
|
* */
|
|
|
- @ResponseBody
|
|
|
+ /*@ResponseBody
|
|
|
@RequestMapping(value = "importConclusion")
|
|
|
public AjaxJson importConclusion(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request, String procInsId,String projectName) {
|
|
|
AjaxJson j = new AjaxJson();
|
|
@@ -209,7 +215,7 @@ public class DivideController extends BaseController {
|
|
|
j.setMsg("导入失败!失败信息:" + e.getMessage());
|
|
|
}
|
|
|
return j;
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
|
@@ -219,16 +225,101 @@ public class DivideController extends BaseController {
|
|
|
// @RequiresPermissions("modules:sg:information:information:import")
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "importConclusion1")
|
|
|
- public AjaxJson importConclusion1(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request, String procInsId, String projectName) {
|
|
|
+ public AjaxJson importConclusion1(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
- ImportExcel ei = null;
|
|
|
+ int successNum = 0;
|
|
|
+ boolean flag = true;
|
|
|
+ String failureMsg = "";
|
|
|
+ //查询是当前经理负责的项目
|
|
|
+
|
|
|
+
|
|
|
+ //将当前经理负责的项目导入的交底结论循环
|
|
|
+ //做数据验证,验证成功的记录,不成功的抛出异常
|
|
|
+ //验证成功的list插入数据库
|
|
|
+ List<Disclose> discloseList = new ArrayList<>();
|
|
|
+ //获取当前登陆用户所有在《交底:项目经理组织交底》节点的流程
|
|
|
+
|
|
|
+ //读取文件记录在数组中
|
|
|
try {
|
|
|
- ei = new ImportExcel(file, 1, 0);
|
|
|
+ ImportExcel ei = new ImportExcel(file, 1, 0);
|
|
|
int lastDataRowNum = ei.getLastDataRowNum();
|
|
|
+ Disclose disclose;
|
|
|
+ //将所有项目信息存入list
|
|
|
+ for (int i = 1; i < lastDataRowNum; i++) {
|
|
|
+ disclose = new Disclose();
|
|
|
+ Row row = ei.getRow(i);
|
|
|
+ disclose.setRequireName(ei.getCellValue(row, 1).toString());
|
|
|
+ disclose.setConId(ei.getCellValue(row, 1).toString());
|
|
|
+ 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());
|
|
|
+ discloseList.add(disclose);
|
|
|
+ }
|
|
|
+ //记录所有符合情况的数据
|
|
|
+ Map<String,Object> stringListMap = MyImportUtils.errorTips(discloseList);
|
|
|
+ String fin = (String)stringListMap.get("fin");
|
|
|
+ //所有填写标准的数据
|
|
|
+ List<Disclose> discloseList1 = (List<Disclose>) stringListMap.get("newDiscloseList");
|
|
|
+ MyActiviUtils myActiviUtils = new MyActiviUtils();
|
|
|
+ //所有当前用户项目经理组织交底的流程信息
|
|
|
+ List<FindTask> activity = myActiviUtils.findActivity("交底:项目经理组织交底");
|
|
|
+
|
|
|
+ List<Disclose> taskList = new ArrayList<>();
|
|
|
+ for (FindTask f : activity) {
|
|
|
+ String projectName = f.getProjectName();
|
|
|
+ for (Disclose d: discloseList1) {
|
|
|
+ String requireName = d.getRequireName();
|
|
|
+ if (projectName.equals(requireName)) {
|
|
|
+ d.setProcInsId(f.getPrInsId());
|
|
|
+ d.setTaskId(f.getTaskId());
|
|
|
+ taskList.add(d);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (taskList.size() > 0) {
|
|
|
+ //存入数据库
|
|
|
+ int i = discloseService.newInsert(taskList);
|
|
|
+ for (Disclose d : taskList) {
|
|
|
+ Map<String, Object> vars = Maps.newHashMap();
|
|
|
+ String precondition = d.getPrecondition();
|
|
|
+ if (precondition != null && !"".equals(precondition)) {
|
|
|
+ vars.put("pass4", true);
|
|
|
+ vars.put("processer", "项目经理");
|
|
|
+ } else {
|
|
|
+ vars.put("pass4", true);
|
|
|
+ vars.put("processer", "项目经理");
|
|
|
+ }
|
|
|
+ actTaskService.complete(d.getTaskId(), d.getProcInsId(), "系统判断成功,请自行查看", vars);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ j.setMsg("已成功导入 " + taskList.size() + " 记录" + fin);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("导入失败!失败信息:" + e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
return j;
|
|
|
}
|
|
|
|