Browse Source

储备项目新-工作流测试

user5 2 years atrás
parent
commit
1c94ec367f

+ 36 - 0
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/entity/ReserveProcessEntity.java

@@ -0,0 +1,36 @@
+package com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity;
+
+import com.jeeplus.core.persistence.ActEntity;
+
+/**
+ * 储备流程实体类
+ * @author: 王强
+ * @create: 2022-08-02 14:38
+ **/
+public class ReserveProcessEntity extends ActEntity<ReserveProcessEntity> {
+    /**
+     * 储备项目编号
+     * */
+    private String projectReserveId;
+
+    /**
+     * 项目名称
+     * */
+    private String projectName;
+
+    public String getProjectReserveId() {
+        return projectReserveId;
+    }
+
+    public void setProjectReserveId(String projectReserveId) {
+        this.projectReserveId = projectReserveId;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+}

+ 10 - 0
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/entity/ReserveSummary.java

@@ -51,6 +51,16 @@ public class ReserveSummary extends DataEntity<ReserveSummary> {
     private String preliminaryConstructionUnitProjectManager;    //初定施工单位项目经理
     private String handConstructionSketches; //是否移交施工草图
 
+    private String openProcessStatus;       //开启流程状态 0-未开启 1-开启
+
+    public String getOpenProcessStatus() {
+        return openProcessStatus;
+    }
+
+    public void setOpenProcessStatus(String openProcessStatus) {
+        this.openProcessStatus = openProcessStatus;
+    }
+
     public String getProjectYear() {
         return projectYear;
     }

+ 14 - 3
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/mapper/ReserveProcessProjectMapper.java

@@ -30,6 +30,13 @@ public interface ReserveProcessProjectMapper extends BaseMapper<ReserveProcessPr
 
     /**
      * 根据项目储备id查询项目信息
+     * @param projectReserveId
+     * @return
+     */
+    ReserveProcessProject queryByProjectId(String projectReserveId);
+
+    /**
+     * 根据项目储备id查询项目信息
      * @param projectReserveId 项目储备id
      * @return
      * */
@@ -62,9 +69,6 @@ public interface ReserveProcessProjectMapper extends BaseMapper<ReserveProcessPr
      */
     List<ReserveProcessProject> exportFindList(ReserveProcessProject reserveManagement);
 
-
-
-
     /**
      * 方案交底结论信息查询
      * @param reserveManagement 查询条件
@@ -89,4 +93,11 @@ public interface ReserveProcessProjectMapper extends BaseMapper<ReserveProcessPr
      * 通过流程定义号查询储备项目基础信息
      * */
     ReserveProcessProject findByProcInsId(String procInsId);
+
+    /**
+     * 通过key获取相同key的最新版本号,通过key和版本号获取流程id
+     * @return 流程对应id
+     * @param key 流程定义表key标识
+     * */
+    String findDefId(String key);
 }

+ 14 - 0
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/mapper/xml/ReserveProcessProjectMapper.xml

@@ -469,10 +469,24 @@
     <select id="repeatList" resultType="java.lang.String">
         select gridNumber,cellNumber,projectReserveId,projectName,constructionNecessityAndContent from cg_reserve_process
     </select>
+    <select id="queryByProjectId"
+            resultType="com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.ReserveProcessProject">
+        select
+        <include refid="reserveManagementColumns"/>
+        from cg_reserve_process a
+        where a.projectReserveId = #{projectReserveId}
+    </select>
 
     <update id="delete">
         delete from
         cg_reserve_process
         where id = #{id}
     </update>
+
+    <select id="findDefId" resultType="java.lang.String">
+        select ID_
+        FROM act_re_procdef
+        where KEY_ = #{key}
+          and VERSION_ = (select MAX(VERSION_) FROM act_re_procdef where KEY_ = #{key})
+    </select>
 </mapper>

+ 4 - 2
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/mapper/xml/SummaryStatisticMapper.xml

@@ -84,7 +84,8 @@
 		initialImplementBatch,
 		preliminaryConstructionUnit,
 		preliminaryConstructionUnitProjectManager,
-		handConstructionSketches
+		handConstructionSketches,
+		openProcessStatus
         )
         values
             (
@@ -125,7 +126,8 @@
             #{initialImplementBatch},
             #{preliminaryConstructionUnit},
             #{preliminaryConstructionUnitProjectManager},
-            #{handConstructionSketches}
+            #{handConstructionSketches},
+            #{openProcessStatus}
             )
     </insert>
 

+ 25 - 0
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/service/ReserveProcessProjectService.java

@@ -27,6 +27,24 @@ public class ReserveProcessProjectService extends CrudService<ReserveProcessProj
     private ReserveProcessProjectMapper dao;
 
     /**
+     * 根据项目储备id查询项目信息
+     * @param reserveManagement
+     * @return
+     */
+    public ReserveProcessProject queryByProjectReserveId(ReserveProcessProject reserveManagement){
+        return dao.queryByProjectReserveId(reserveManagement);
+    }
+
+    /**
+     * 根据项目储备id查询项目信息
+     * @param projectReserveId
+     * @return
+     */
+    public ReserveProcessProject queryByProjectId(String projectReserveId){
+        return dao.queryByProjectId(projectReserveId);
+    }
+
+    /**
      * 查看数据库唯一性判断字段值
      * @return
      */
@@ -159,4 +177,11 @@ public class ReserveProcessProjectService extends CrudService<ReserveProcessProj
 
         }
     }
+
+    /**
+     * 通过key值查找对应的流程id
+     */
+    public String findDefId(String key) {
+        return dao.findDefId(key);
+    }
 }

+ 15 - 0
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/service/SummaryStatisticService.java

@@ -4,6 +4,7 @@ import com.jeeplus.core.persistence.Page;
 import com.jeeplus.core.service.CrudService;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.ReserveSummary;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.mapper.SummaryStatisticMapper;
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ReserveProcess;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -23,6 +24,15 @@ public class SummaryStatisticService extends CrudService<SummaryStatisticMapper,
     private SummaryStatisticMapper dao;
 
     /**
+     * 根据项目储备id查询项目信息
+     * @param reserveManagement
+     * @return
+     */
+    public ReserveSummary queryByProjectReserveId(ReserveSummary reserveManagement){
+        return dao.queryByProjectReserveId(reserveManagement);
+    }
+
+    /**
      * 查询已有的参数数据 并分类返回已存在数据和未存在数据
      * @param reserveManagement
      * @return
@@ -95,4 +105,9 @@ public class SummaryStatisticService extends CrudService<SummaryStatisticMapper,
             mapper.update(entity);
         }
     }
+
+    @Transactional(readOnly = false)
+    public void insert(ReserveSummary entity) {
+        mapper.insert(entity);
+    }
 }

+ 92 - 1
src/main/java/com/jeeplus/modules/cg/reservemanagementcenter/reserveManage/web/SummaryStatisticController.java

@@ -1,14 +1,28 @@
 package com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.web;
 
+import com.google.common.collect.Maps;
 import com.jeeplus.common.json.AjaxJson;
+import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.core.persistence.Page;
 import com.jeeplus.core.web.BaseController;
+import com.jeeplus.modules.act.service.ActProcessService;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.ReserveProcessEntity;
+import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.ReserveProcessProject;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.ReserveSummary;
+import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.service.ReserveProcessProjectService;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.service.SummaryStatisticService;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.utils.ReserveProcessProjectExportUtil;
 import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.utils.ReserveProcessProjectProUtil;
 import com.jeeplus.modules.sg.managementcenter.materialproject.util.ImportUtil;
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.PersonnelTurnover;
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ReserveProcess;
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.service.PersonnelTurnoverService;
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.service.ReserveProcessService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.activiti.engine.repository.ProcessDefinition;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -25,6 +39,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 /**
  * 储备项目交底信息汇总统计 controller
@@ -36,8 +51,23 @@ import java.util.Map;
 public class SummaryStatisticController extends BaseController {
 
     @Autowired
+    private PersonnelTurnoverService service;
+
+    @Autowired
     private SummaryStatisticService statisticService;
 
+    @Autowired
+    private ReserveProcessProjectService projectService;
+
+    @Autowired
+    private ActProcessService actProcessService;
+
+    @Autowired
+    private ActTaskService actTaskService;
+
+    @Autowired
+    private ReserveProcessService reserveProcessService;
+
 
     @ModelAttribute
     public ReserveSummary get(@RequestParam(required = false) String id) {
@@ -151,7 +181,7 @@ public class SummaryStatisticController extends BaseController {
     /**
      * 导入Excel数据
      */
-    @ResponseBody
+   /* @ResponseBody
     @RequiresPermissions("cg:reservemanagementcenter:summaryStatistics:import")
     @RequestMapping(value = "import")
     public AjaxJson importBasic(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
@@ -187,6 +217,58 @@ public class SummaryStatisticController extends BaseController {
         }
         return j;
     }
+*/
+
+    /**
+     * 导入Excel数据
+     */
+    @ResponseBody
+    @RequiresPermissions("cg:reservemanagementcenter:summaryStatistics:import")
+    @RequestMapping(value = "import")
+    public AjaxJson importBasic(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
+        AjaxJson j = new AjaxJson();
+        try {
+            ImportUtil importUtil = new ImportUtil(file, 0, 0);
+            //获取导入表格所有数据
+            List<ReserveSummary> reserveManagementList = ReserveProcessProjectProUtil.getSummaryUtil(importUtil);
+            //查询已有的参数数据 并分类返回已存在数据和未存在数据
+            Map map = statisticService.getExistProjectList(reserveManagementList);
+            //未存在数据
+            List<ReserveSummary> withoutList = (List<ReserveSummary>) map.get("without");
+            //已存在数据
+            List<ReserveSummary> existList = (List<ReserveSummary>) map.get("exist");
+
+            for (ReserveSummary s : withoutList){
+                s.preInsert();
+                s.setOpenProcessStatus("1");
+                System.out.println("ReserveSummary:" + s);
+                statisticService.insert(s);
+
+                ReserveProcess reserveProcess = new ReserveProcess();
+                reserveProcess.preInsert();
+                reserveProcess.setProjectReserveId(s.getProjectReserveId());
+
+                //发送流程,更改项目状态
+                Map<String, Object> vars = Maps.newHashMap();
+
+                ReserveProcessProject processProject = projectService.queryByProjectId(s.getProjectReserveId());
+
+                vars.put("manager", UserUtils.getByUserName(processProject.getDesigner()).getLoginName());
+                String procDefId = projectService.findDefId("test");
+                ProcessDefinition p = actProcessService.getProcessDefinition(procDefId);
+                String title = s.getCurrentUser().getName() + "在" + DateUtils.getDateTime() + "发起" + p.getName();
+                actTaskService.startProcess(p.getKey(), "cg_personnel_activiti", reserveProcess.getId(), title, vars);
+            }
+
+
+            int i = withoutList.size() + existList.size();
+            j.setMsg("已成功导入" + i + "条项目储备信息记录");
+        } catch (Exception e) {
+            j.setSuccess(false);
+            j.setMsg("导入项目规模信息失败!失败信息:" + e.getMessage());
+        }
+        return j;
+    }
 
 
     //导出excel
@@ -224,4 +306,13 @@ public class SummaryStatisticController extends BaseController {
         }
         return "modules/cg/reservemanagementcenter/reserveManage/summaryStatistics/reserveManagementModifyByzz";
     }
+
+    /**
+     * 设计单位审核
+     * */
+    @RequestMapping(value = "designUnit")
+    public String designUnit(ReserveProcess reserveProcess, Model model) {
+        model.addAttribute("reserveProcess", reserveProcess);
+        return "modules/sg/managementcenter/reserveManagement/designUnit";
+    }
 }

+ 1 - 1
src/main/webapp/webpage/modules/bpm/model/modelList.js

@@ -230,4 +230,4 @@ Date.prototype.format = function(format) {
       $('#actModelTable').bootstrapTable('refresh');
   }
 
-</script>
+</script>