Kaynağa Gözat

工时管理--工时的修改接口开发

buzhanyi 6 ay önce
ebeveyn
işleme
40c8cd41b5
15 değiştirilmiş dosya ile 430 ekleme ve 137 silme
  1. 6 0
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/api/ProjectInfoApi.java
  2. 29 0
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/api/ProjectInfoServiceApi.java
  3. 77 44
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/controller/ProjectInfoController.java
  4. 20 6
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/entity/ProjectInfoEntity.java
  5. 7 5
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectPeriodEnum.java
  6. 2 0
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectStatusEnum.java
  7. 56 0
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectType.java
  8. 1 1
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/mapper/ProjectInfoMapper.java
  9. 2 2
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/mapper/UserInfoMapper.java
  10. 7 0
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/ProjectInfoService.java
  11. 17 11
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ManHourServiceImpl.java
  12. 146 62
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ProjectInfoServiceImpl.java
  13. 48 1
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/vo/ManHourInfoVo.java
  14. 6 1
      application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/vo/ProjectInfoVo.java
  15. 6 4
      common/common-flow/src/main/java/com/ankaibei/workFlow/common/flow/service/impl/FlowApiServiceImpl.java

+ 6 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/api/ProjectInfoApi.java

@@ -23,8 +23,14 @@ public interface ProjectInfoApi extends ApiMixin<ProjectInfoVo, Integer> {
 
     ResMsg addProject(ProjectInfoVo projectInfoVo);
 
+    ResMsg submitProjectBySave(ProjectInfoVo projectInfoVo);
+
+    ResMsg submitProjectBatch(List<ProjectInfoVo> projectInfoVos);
+
     ResMsg updateProject(ProjectInfoVo projectInfoVo);
 
+    ResMsg submitProjectByUpdate(ProjectInfoVo projectInfoVo);
+
     ResMsg findPrincipalProject(String userId);
 
     ResMsg findAccesoryInfo(ProjectInfoVo projectInfoVo);

+ 29 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/api/ProjectInfoServiceApi.java

@@ -1,13 +1,16 @@
 package com.ankaibei.workFlow.webadmin.ankaibei.api;
 
 import com.ankaibei.workFlow.webadmin.ankaibei.entity.ProjectInfoEntity;
+import com.ankaibei.workFlow.webadmin.ankaibei.enums.CodeEnum;
 import com.ankaibei.workFlow.webadmin.ankaibei.service.ProjectInfoService;
 import com.ankaibei.workFlow.webadmin.ankaibei.vo.ProjectInfoVo;
 import com.ankaibei.workFlow.webadmin.ankaibei.vo.ResMsg;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -45,12 +48,38 @@ public class ProjectInfoServiceApi implements ProjectInfoApi {
         return projectInfoService.addProject(projectInfoEntity);
     }
 
+    @Override
+    public ResMsg submitProjectBySave(ProjectInfoVo projectInfoVo) {
+        ProjectInfoEntity projectInfoEntity = this.copyProperties(projectInfoVo, ProjectInfoEntity.class);
+        return projectInfoService.submitProjectBySave(projectInfoEntity);
+    }
+
+    @Override
+    public ResMsg submitProjectBatch(List<ProjectInfoVo> projectInfoVos) {
+        if (projectInfoVos.size() == 0) {
+            return new ResMsg(CodeEnum.PARAM_IS_NULL);
+        }
+        ArrayList<ProjectInfoEntity> list = new ArrayList<>();
+        for (ProjectInfoVo vo : projectInfoVos) {
+            ProjectInfoEntity infoEntity = new ProjectInfoEntity();
+            BeanUtils.copyProperties(vo, infoEntity);
+            list.add(infoEntity);
+        }
+        return projectInfoService.submitProjectBatch(list);
+    }
+
     @Override
     public ResMsg updateProject(ProjectInfoVo projectInfoVo) {
         ProjectInfoEntity projectInfoEntity = this.copyProperties(projectInfoVo, ProjectInfoEntity.class);
         return projectInfoService.updateProject(projectInfoEntity);
     }
 
+    @Override
+    public ResMsg submitProjectByUpdate(ProjectInfoVo projectInfoVo) {
+        ProjectInfoEntity projectInfoEntity = this.copyProperties(projectInfoVo, ProjectInfoEntity.class);
+        return projectInfoService.submitProjectByUpdate(projectInfoEntity);
+    }
+
     @Override
     public ResMsg findPrincipalProject(String userId) {
 

+ 77 - 44
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/controller/ProjectInfoController.java

@@ -67,75 +67,87 @@ public class ProjectInfoController {
     }
 
     /**
-     * 查询项目详情
+     * 新建项目--保存
      *
      * @param projectInfoVo
      * @return ResMsg
      */
-    @RequestMapping("/findProjectParticulars")
-    public ResMsg findProjectParticulars(@RequestBody ProjectInfoVo projectInfoVo) {
+    @RequestMapping("/addProject")
+    public ResMsg addProject(@RequestBody ProjectInfoVo projectInfoVo) {
 
-        return projectInfoApi.findProjectParticulars(projectInfoVo);
+        return projectInfoApi.addProject(projectInfoVo);
     }
 
     /**
-     * 项目数量趋势图(当月)
+     * 新建项目--提交
      *
-     * @param
+     * @param projectInfoVo
      * @return ResMsg
      */
-    @RequestMapping("/findProjectNumber")
-    public ResMsg findProjectNumber() {
+    @RequestMapping("/submitProjectBySave")
+    public ResMsg submitProjectBySave(@RequestBody ProjectInfoVo projectInfoVo) {
 
-        return projectInfoApi.findProjectNumber();
+        return projectInfoApi.submitProjectBySave(projectInfoVo);
     }
 
     /**
-     * 项目对应所属公司的数量分布图(当月)
+     * 批量提交
      *
-     * @param
+     * @param projectInfoVos
      * @return ResMsg
      */
-    @RequestMapping("/substepOfProjectNum")
-    public ResMsg substepOfProjectNum() {
-        return projectInfoApi.substepOfProjectNum();
+    @RequestMapping("/submitProjectBatch")
+    public ResMsg submitProjectBatch(@RequestBody List<ProjectInfoVo> projectInfoVos) {
+        return projectInfoApi.submitProjectBatch(projectInfoVos);
     }
 
     /**
-     * 项目数量趋势图(上月)
+     * 查询项目详情
      *
-     * @param
+     * @param projectInfoVo
      * @return ResMsg
      */
-    @RequestMapping("/findLastMonthProjectNumber")
-    public ResMsg findLastMonthProjectNumber() {
+    @RequestMapping("/findProjectParticulars")
+    public ResMsg findProjectParticulars(@RequestBody ProjectInfoVo projectInfoVo) {
 
-        return projectInfoApi.findLastMonthProjectNumber();
+        return projectInfoApi.findProjectParticulars(projectInfoVo);
     }
 
     /**
-     * 项目对应所属公司的数量分布图(当月)
+     * 编辑项目--保存
      *
-     * @param
+     * @param projectInfoVo
      * @return ResMsg
      */
-    @RequestMapping("/substepOfProjectNumAtLastMonth")
-    public ResMsg substepOfProjectNumAtLastMonth() {
-        return projectInfoApi.substepOfProjectNumAtLastMonth();
+    @RequestMapping("/updateProject")
+    public ResMsg updateProject(@RequestBody ProjectInfoVo projectInfoVo) {
+        return projectInfoApi.updateProject(projectInfoVo);
     }
 
+
     /**
-     * 查询附件信息
+     * 编辑项目--提交
      *
      * @param projectInfoVo
      * @return ResMsg
      */
-    @RequestMapping("/findAccesoryInfo")
-    public ResMsg findAccesoryInfo(@RequestBody ProjectInfoVo projectInfoVo) {
+    @RequestMapping("/submitProjectByUpdate")
+    public ResMsg submitProjectByUpdate(@RequestBody ProjectInfoVo projectInfoVo) {
 
-        return projectInfoApi.findAccesoryInfo(projectInfoVo);
+        return projectInfoApi.submitProjectByUpdate(projectInfoVo);
     }
 
+    /**
+     * 删除项目
+     *
+     * @param projectInfoVos
+     * @return ResMsg
+     */
+    @RequestMapping("/deleteProject")
+    public ResMsg deleteProject(@RequestBody List<ProjectInfoVo> projectInfoVos) {
+
+        return projectInfoApi.deleteProjects(projectInfoVos);
+    }
 
     /**
      * 查询当前登录人负责的项目
@@ -148,44 +160,65 @@ public class ProjectInfoController {
         return projectInfoApi.findPrincipalProject(TokenData.takeFromRequest().getUserId());
     }
 
-
     /**
-     * 编辑项目
+     * 项目数量趋势图(当月)
      *
-     * @param projectInfoVo
+     * @param
      * @return ResMsg
      */
-    @RequestMapping("/updateProject")
-    public ResMsg updateProject(@RequestBody ProjectInfoVo projectInfoVo) {
+    @RequestMapping("/findProjectNumber")
+    public ResMsg findProjectNumber() {
 
-        return projectInfoApi.updateProject(projectInfoVo);
+        return projectInfoApi.findProjectNumber();
     }
 
     /**
-     * 删除项目
+     * 项目对应所属公司的数量分布图(当月)
      *
-     * @param projectInfoVos
+     * @param
      * @return ResMsg
      */
-    @RequestMapping("/deleteProject")
-    public ResMsg deleteProject(@RequestBody List<ProjectInfoVo> projectInfoVos) {
+    @RequestMapping("/substepOfProjectNum")
+    public ResMsg substepOfProjectNum() {
+        return projectInfoApi.substepOfProjectNum();
+    }
 
-        return projectInfoApi.deleteProjects(projectInfoVos);
+    /**
+     * 项目数量趋势图(上月)
+     *
+     * @param
+     * @return ResMsg
+     */
+    @RequestMapping("/findLastMonthProjectNumber")
+    public ResMsg findLastMonthProjectNumber() {
+
+        return projectInfoApi.findLastMonthProjectNumber();
     }
 
     /**
-     * 新建项目
+     * 项目对应所属公司的数量分布图(当月)
      *
-     * @param projectInfoVo
+     * @param
      * @return ResMsg
      */
-    @RequestMapping("/addProject")
-    public ResMsg addProject(@RequestBody ProjectInfoVo projectInfoVo) {
+    @RequestMapping("/substepOfProjectNumAtLastMonth")
+    public ResMsg substepOfProjectNumAtLastMonth() {
+        return projectInfoApi.substepOfProjectNumAtLastMonth();
+    }
 
+    /**
+     * 查询附件信息
+     *
+     * @param projectInfoVo
+     * @return ResMsg
+     */
+    @RequestMapping("/findAccesoryInfo")
+    public ResMsg findAccesoryInfo(@RequestBody ProjectInfoVo projectInfoVo) {
 
-        return projectInfoApi.addProject(projectInfoVo);
+        return projectInfoApi.findAccesoryInfo(projectInfoVo);
     }
 
+
     /**
      * 文件上传
      *

+ 20 - 6
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/entity/ProjectInfoEntity.java

@@ -26,6 +26,10 @@ public class ProjectInfoEntity {
      * 项目编码
      */
     private String projectCode;
+    /**
+     * 项目周期
+     */
+    private String projectPeriod;
     /**
      * 项目阶段
      */
@@ -50,7 +54,7 @@ public class ProjectInfoEntity {
     /**
      * 项目金额
      */
-    private String peojectMoney;
+    private String projectMoney;
     /**
      * 人员成本
      */
@@ -172,6 +176,16 @@ public class ProjectInfoEntity {
         this.projectCode = projectCode;
     }
 
+    @Basic
+    @Column(name = "project_period")
+    public String getProjectPeriod() {
+        return projectPeriod;
+    }
+
+    public void setProjectPeriod(String projectPeriod) {
+        this.projectPeriod = projectPeriod;
+    }
+
     @Basic
     @Column(name = "project_stage")
     public String getProjectStage() {
@@ -213,13 +227,13 @@ public class ProjectInfoEntity {
     }
 
     @Basic
-    @Column(name = "peoject_money")
-    public String getPeojectMoney() {
-        return peojectMoney;
+    @Column(name = "project_money")
+    public String getProjectMoney() {
+        return projectMoney;
     }
 
-    public void setPeojectMoney(String peojectMoney) {
-        this.peojectMoney = peojectMoney;
+    public void setProjectMoney(String projectMoney) {
+        this.projectMoney = projectMoney;
     }
 
     @Basic

+ 7 - 5
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectPeriodEnum.java

@@ -1,12 +1,14 @@
 package com.ankaibei.workFlow.webadmin.ankaibei.enums;
 
 /**
+ * 项目阶段
+ *
  * @ClassName: ProjectPeriodEnum
  * @author: LWQ
  * @date:2022/09/14
  * @Copyright: 2022
  */
-public enum ProjectPeriodEnum {
+public enum ProjectStageEnum {
 
     BUSINESS_RESEARCHB("1", "商机调研"),
     PRE_SALES("2", " 售前"),
@@ -28,7 +30,7 @@ public enum ProjectPeriodEnum {
     /**
      * 666666
      */
-    ProjectPeriodEnum(String code, String reason) {
+    ProjectStageEnum(String code, String reason) {
         this.code = code;
         this.reason = reason;
     }
@@ -47,9 +49,9 @@ public enum ProjectPeriodEnum {
      * @param code
      * @return
      */
-    public static ProjectPeriodEnum getEnumByCode(String code) {
-        ProjectPeriodEnum[] values = ProjectPeriodEnum.values();
-        for (ProjectPeriodEnum statusEnums : values) {
+    public static ProjectStageEnum getEnumByCode(String code) {
+        ProjectStageEnum[] values = ProjectStageEnum.values();
+        for (ProjectStageEnum statusEnums : values) {
             if (statusEnums.getCode().equals(code)) {
                 return statusEnums;
             }

+ 2 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectStatusEnum.java

@@ -1,6 +1,8 @@
 package com.ankaibei.workFlow.webadmin.ankaibei.enums;
 
 /**
+ * 项目状态
+ *
  * @ClassName: ProjectPeriodEnum
  * @author: LWQ
  * @date:2022/09/14

+ 56 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/ProjectType.java

@@ -0,0 +1,56 @@
+package com.ankaibei.workFlow.webadmin.ankaibei.enums;
+
+/**
+ * 项目任务状态枚举类
+ *
+ * @author buzhanyi
+ */
+
+public enum ProjectType {
+
+    TYPE_ONE("1", "分类1"),
+    TYPE_TWO("2", "分类2"),
+    TYPE_THREE("3", "分类3"),
+    TYPE_FOUR("4", "分类4");
+
+    /**
+     * 码
+     */
+    private final String code;
+    /**
+     * 分类值
+     */
+    private final String reason;
+
+    /**
+     * 666666
+     */
+    ProjectType(String code, String reason) {
+        this.code = code;
+        this.reason = reason;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    /**
+     * 通过枚举的code,查询对应的枚举项
+     *
+     * @param code
+     * @return
+     */
+    public static ProjectType getEnumByCode(String code) {
+        ProjectType[] values = ProjectType.values();
+        for (ProjectType statusEnums : values) {
+            if (statusEnums.getCode().equals(code)) {
+                return statusEnums;
+            }
+        }
+        return null;
+    }
+}

+ 1 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/mapper/ProjectInfoMapper.java

@@ -22,7 +22,7 @@ import java.util.Map;
 public interface ProjectInfoMapper extends JpaRepository<ProjectInfoEntity, Integer>, JpaSpecificationExecutor<ProjectInfoEntity> {
 
     @Query(value = "SELECT pro.project_id projectId,pro.project_name projectName,pro.project_stage projectStage," +
-            "pro.project_status projectStatus,pro.project_principal projectPrincipal,pro.create_date createDate," +
+            "pro.project_status projectStatus,pro.project_period projectPeriod,pro.project_principal projectPrincipal,pro.create_date createDate," +
             "pro.flow_task_status flowTaskStatus ,pro.process_instance_id processInstanceId, " +
             "pro.process_definition_id processDefinitionId FROM project_info pro " +
             "WHERE if( ?1 !='', pro.project_status=?1 , 1=1) and if( ?2 !='', pro.project_name like %?2% , 1=1) and pro.is_delete='1' order by pro.create_date desc",

+ 2 - 2
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/mapper/UserInfoMapper.java

@@ -17,8 +17,8 @@ import java.util.Map;
 public interface UserInfoMapper extends JpaRepository<UserInfoEntity, String>, JpaSpecificationExecutor<UserInfoEntity> {
 
 
-    @Query(value = "SELECT user.user_id userId,user.show_name userName FROM work_sys_user user WHERE deleted_flag =1 "
-           , nativeQuery = true)
+    @Query(value = "SELECT user.user_id userId,user.show_name userName FROM work_sys_user user WHERE deleted_flag =1 and user.user_id not in (1573942230794637312) "
+            , nativeQuery = true)
     List<Map<String, String>> getProUserAll();
 
     /**

+ 7 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/ProjectInfoService.java

@@ -5,6 +5,7 @@ import com.ankaibei.workFlow.webadmin.ankaibei.entity.ProjectInfoEntity;
 import com.ankaibei.workFlow.webadmin.ankaibei.vo.ProjectInfoVo;
 import com.ankaibei.workFlow.webadmin.ankaibei.vo.ResMsg;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -23,8 +24,14 @@ public interface ProjectInfoService {
 
     ResMsg addProject(ProjectInfoEntity projectInfoEntity);
 
+    ResMsg submitProjectBySave(ProjectInfoEntity projectInfoEntity);
+
+    ResMsg submitProjectBatch(ArrayList<ProjectInfoEntity> list);
+
     ResMsg updateProject(ProjectInfoEntity projectInfoEntity);
 
+    ResMsg submitProjectByUpdate(ProjectInfoEntity projectInfoEntity);
+
     ResMsg deleteProjects(List<ProjectInfoVo> projectInfoVos);
 
     ResMsg findPrincipalProject(String userId);

+ 17 - 11
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ManHourServiceImpl.java

@@ -134,7 +134,7 @@ public class ManHourServiceImpl implements ManHourService {
     @Override
     public ResMsg submitManHourBatch(List<ManHourInfoVo> manHourInfoVos) {
         //先判断ID是否为空:不为空就是批量提交的
-        if (!ObjectUtils.isEmpty(manHourInfoVos.get(0).getManId())) {
+        if (!ObjectUtils.isEmpty(manHourInfoVos)) {
             for (ManHourInfoVo vo : manHourInfoVos) {
                 Optional<ManHourInfoEntity> byId = manHourMapper.findById(vo.getManId());
                 ManHourInfoEntity infoEntity = byId.orElse(null) != null ? byId.orElse(null) : null;
@@ -158,16 +158,22 @@ public class ManHourServiceImpl implements ManHourService {
 
     @Override
     public ResMsg findManHourByID(Integer manId) {
-        Optional<ManHourInfoEntity> byId = manHourMapper.findById(manId);
-        ManHourInfoEntity infoEntity = byId.orElse(null) != null ? byId.orElse(null) : null;
-        Optional<UserInfoEntity> userInfoEntity = userInfoMapper.findById(infoEntity.getCreateUser());
-        infoEntity.setCreateUser(userInfoEntity.get().getShowName());
-        infoEntity.setProjectUser(userInfoEntity.get().getShowName());
-        Optional<ProjectInfoEntity> projectInfoEntity = projectInfoMapper.findById(Integer.valueOf(infoEntity.getProjectId()));
-        infoEntity.setProjectId(projectInfoEntity.get().getProjectName());
-        Optional<TaskInfoEntity> taskInfoEntity = taskInfoMapper.findById(Integer.valueOf(infoEntity.getTaskId()));
-        infoEntity.setTaskId(taskInfoEntity.get().getTargetTask());
-        return new ResMsg(CodeEnum.OK, infoEntity);
+        ManHourInfoEntity byId = manHourMapper.findById(manId).get();
+        //数据赋值给VO对象,返回VO对象
+        ManHourInfoVo vo = new ManHourInfoVo();
+        BeanUtils.copyProperties(byId, vo);
+        //获取关联数据的信息,给前端展示
+        Optional<UserInfoEntity> userInfoEntity = userInfoMapper.findById(byId.getCreateUser());
+        //创建用户和申请人
+        vo.setCreateUserName(userInfoEntity.get().getShowName());
+        vo.setProjectUserName(userInfoEntity.get().getShowName());
+        Optional<ProjectInfoEntity> projectInfoEntity = projectInfoMapper.findById(Integer.valueOf(byId.getProjectId()));
+        //项目名称
+        vo.setProjectName(projectInfoEntity.get().getProjectName());
+        Optional<TaskInfoEntity> taskInfoEntity = taskInfoMapper.findById(Integer.valueOf(byId.getTaskId()));
+        //任务名称
+        vo.setTargetTask(taskInfoEntity.get().getTargetTask());
+        return new ResMsg(CodeEnum.OK, vo);
     }
 
     @Override

+ 146 - 62
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ProjectInfoServiceImpl.java

@@ -1,10 +1,8 @@
 package com.ankaibei.workFlow.webadmin.ankaibei.service.impl;
 
-import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.ankaibei.workFlow.common.core.constant.ErrorCodeEnum;
 import com.ankaibei.workFlow.common.core.object.ResponseResult;
 import com.ankaibei.workFlow.common.core.object.TokenData;
 import com.ankaibei.workFlow.common.flow.constant.FlowConstant;
@@ -16,7 +14,7 @@ import com.ankaibei.workFlow.common.flow.vo.TaskInfoVo;
 import com.ankaibei.workFlow.webadmin.ankaibei.entity.*;
 import com.ankaibei.workFlow.webadmin.ankaibei.enums.CodeEnum;
 import com.ankaibei.workFlow.webadmin.ankaibei.enums.DataIsDeleteEnum;
-import com.ankaibei.workFlow.webadmin.ankaibei.enums.ProjectPeriodEnum;
+import com.ankaibei.workFlow.webadmin.ankaibei.enums.ProjectStageEnum;
 import com.ankaibei.workFlow.webadmin.ankaibei.enums.ProjectStatusEnum;
 import com.ankaibei.workFlow.webadmin.ankaibei.mapper.*;
 import com.ankaibei.workFlow.webadmin.ankaibei.service.ProjectInfoService;
@@ -70,27 +68,27 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
             UserInfoEntity userInfoEntity = userInfoMapper.findByUserIdEquals((map.get("projectPrincipal")));
             map1.put("projectPrincipal", userInfoEntity != null ? userInfoEntity.getShowName() : null);
             String projectStage = map.get("projectStage");
-            switch (ProjectPeriodEnum.getEnumByCode(projectStage)) {
+            switch (ProjectStageEnum.getEnumByCode(projectStage)) {
                 case BUSINESS_RESEARCHB:
-                    map1.put("projectStage", ProjectPeriodEnum.BUSINESS_RESEARCHB.getReason());
+                    map1.put("projectStage", ProjectStageEnum.BUSINESS_RESEARCHB.getReason());
                     break;
                 case PRE_SALES:
-                    map1.put("projectStage", ProjectPeriodEnum.PRE_SALES.getReason());
+                    map1.put("projectStage", ProjectStageEnum.PRE_SALES.getReason());
                     break;
                 case PROJECT_START:
-                    map1.put("projectStage", ProjectPeriodEnum.PROJECT_START.getReason());
+                    map1.put("projectStage", ProjectStageEnum.PROJECT_START.getReason());
                     break;
                 case DELIVERY:
-                    map1.put("projectStage", ProjectPeriodEnum.DELIVERY.getReason());
+                    map1.put("projectStage", ProjectStageEnum.DELIVERY.getReason());
                     break;
                 case CHECK_AND_ACCEPT:
-                    map1.put("projectStage", ProjectPeriodEnum.CHECK_AND_ACCEPT.getReason());
+                    map1.put("projectStage", ProjectStageEnum.CHECK_AND_ACCEPT.getReason());
                     break;
                 case POST_PROJECT_THE_RECEIVABLE:
-                    map1.put("projectStage", ProjectPeriodEnum.POST_PROJECT_THE_RECEIVABLE.getReason());
+                    map1.put("projectStage", ProjectStageEnum.POST_PROJECT_THE_RECEIVABLE.getReason());
                     break;
                 case CLOSE:
-                    map1.put("projectStage", ProjectPeriodEnum.CLOSE.getReason());
+                    map1.put("projectStage", ProjectStageEnum.CLOSE.getReason());
                     break;
                 default:
                     break;
@@ -132,7 +130,7 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
         Optional<UserInfoEntity> projectPrincipal = userInfoMapper.findById(projectInfoEntity1.getProjectPrincipal());
         UserInfoEntity userInfoEntity = projectPrincipal.orElse(null);
         projectInfoEntity1.setProjectPrincipal(userInfoEntity != null ? userInfoEntity.getShowName() : null);
-        projectInfoEntity1.setProjectStageStr(ProjectPeriodEnum.getEnumByCode(projectInfoEntity1.getProjectStage()).getReason());
+        projectInfoEntity1.setProjectStageStr(ProjectStageEnum.getEnumByCode(projectInfoEntity1.getProjectStage()).getReason());
         return new ResMsg(CodeEnum.OK, projectInfoEntity1);
     }
 
@@ -144,64 +142,99 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
                 return new ResMsg(CodeEnum.TNE_PROJECT_NAME_ALREADY_EXISTS);
             }
         }
-        projectInfoEntity.setProjectStage(ProjectPeriodEnum.BUSINESS_RESEARCHB.getCode());
+        //直接保存
+        projectInfoEntity.setProjectStage(ProjectStageEnum.BUSINESS_RESEARCHB.getCode());
         projectInfoEntity.setProjectStatus(ProjectStatusEnum.NORMAL.getCode());
+        projectInfoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
         projectInfoEntity.setCreateDate(new Date());
+        ProjectInfoEntity save = projectInfoMapper.save(projectInfoEntity);
+        return new ResMsg(CodeEnum.OK, save);
+    }
 
-        /**
-         *调用新增项目信息申请流程的启动
-         *获取流程开始节点之后的第一个任务节点的数据
-         *param processDefinitionKey 新建项目信息审批流程--流程标识。
-         */
-        String processDefinitionKey = "ProjectAddApplyFlow";
-        ResponseResult<FlowEntry> flowEntryResult = flowTaskStart.verifyAndGetFlowEntry(processDefinitionKey);
-        if (!flowEntryResult.isSuccess()) {
-            return ResMsg.newInstance(CodeEnum.FAIL, flowEntryResult);
+    /**
+     * 保存后提交
+     */
+    @Override
+    public ResMsg submitProjectBySave(ProjectInfoEntity projectInfoEntity) {
+        ResMsg resMsg = addProject(projectInfoEntity);
+        if (!"200".equals(resMsg.getCode())) {
+            return resMsg;
         }
-        FlowEntryPublish flowEntryPublish = flowEntryResult.getData().getMainFlowEntryPublish();
-        String initTaskInfo = flowEntryPublish.getInitTaskInfo();
-        com.ankaibei.workFlow.common.flow.vo.TaskInfoVo taskInfo = StrUtil.isBlank(initTaskInfo)
-                ? null : JSON.parseObject(initTaskInfo, TaskInfoVo.class);
-        if (ObjectUtils.isNotEmpty(taskInfo)) {
-            String loginName = TokenData.takeFromRequest().getLoginName();
-            taskInfo.setAssignedMe(StrUtil.equalsAny(
-                    taskInfo.getAssignee(), loginName, FlowConstant.START_USER_NAME_VAR));
+        ProjectInfoEntity data = (ProjectInfoEntity) resMsg.getData();
+        resMsg = projectFlowStart(data);
+        if (!"200".equals(resMsg.getCode())) {
+            return resMsg;
+        }
+        return new ResMsg(CodeEnum.OK);
+    }
+
+    /**
+     * 批量提交项目
+     *
+     * @param list
+     * @return
+     */
+    @Override
+    public ResMsg submitProjectBatch(ArrayList<ProjectInfoEntity> list) {
+        //直接提交
+        for (ProjectInfoEntity info : list) {
+            info = projectInfoMapper.getById(info.getProjectId());
+            ResMsg resMsg = projectFlowStart(info);
+            if (!"200".equals(resMsg.getCode())) {
+                return resMsg;
+            }
         }
-        //用户在表单页面配置的操作按钮
-        FlowTaskCommentDto flowTaskCommentDto = new FlowTaskCommentDto();
-        //提交后进行到第二个节点
-        flowTaskCommentDto.setApprovalType("agree");
-        HashMap<String, Object> stringObjectHashMap = new HashMap<>();
-        stringObjectHashMap.put("project_name", projectInfoEntity.getProjectName());
-        stringObjectHashMap.put("project_stage", projectInfoEntity.getProjectStage());
-        stringObjectHashMap.put("project_status", projectInfoEntity.getProjectStatus());
-        stringObjectHashMap.put("project_type", projectInfoEntity.getProjectType());
-        stringObjectHashMap.put("relevance_client", projectInfoEntity.getRelevanceClient());
-        stringObjectHashMap.put("peoject_money", projectInfoEntity.getPeojectMoney());
-        stringObjectHashMap.put("staff_cost", projectInfoEntity.getStaffCost());
-        stringObjectHashMap.put("project_cost", projectInfoEntity.getProjectCost());
-        stringObjectHashMap.put("total_cost", projectInfoEntity.getTotalCost());
-        stringObjectHashMap.put("linkman_phone", projectInfoEntity.getLinkmanPhone());
-        stringObjectHashMap.put("project_principal", projectInfoEntity.getProjectPrincipal());
-        stringObjectHashMap.put("project_node", projectInfoEntity.getProjectNode());
-        stringObjectHashMap.put("project_describe", projectInfoEntity.getProjectDescribe());
-        stringObjectHashMap.put("create_date", projectInfoEntity.getCreateDate());
-        ProjectInfoEntity save = projectInfoMapper.save(projectInfoEntity);
-        stringObjectHashMap.put("project_id", save.getProjectId());
-        JSONObject masterData = (JSONObject) JSONObject.toJSON(stringObjectHashMap);
-        Map<String, String> map = flowTaskStart.startAndTakeUserTaskSS(processDefinitionKey, flowTaskCommentDto, null, masterData, null, null).getData();
-        save.setProcessDefinitionId(map.get("processDefinitionId"));
-        save.setProcessInstanceId(map.get("processInstanceId"));
-        save.setFlowTaskStatus(FlowTaskStatus.SUBMITTED);
-        save.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
-        projectInfoMapper.save(save);
         return new ResMsg(CodeEnum.OK);
     }
 
+    /**
+     * 编辑项目后保存
+     *
+     * @param entity
+     * @return
+     */
     @Override
-    public ResMsg updateProject(ProjectInfoEntity projectInfoEntity) {
+    public ResMsg updateProject(ProjectInfoEntity entity) {
+        //获取原数据对象
+        ProjectInfoEntity byId = projectInfoMapper.getById(entity.getProjectId());
+        String flowStatus = byId.getFlowTaskStatus().toString();
+        //将修改的信息赋值给原数据对象
+        byId.setProjectName(entity.getProjectName());//项目名称
+        byId.setProjectPeriod(entity.getProjectPeriod());//项目周期
+        byId.setProjectType(entity.getProjectType());//项目类型
+        byId.setProjectStage(entity.getProjectStage());//项目阶段
+        byId.setProjectMoney(entity.getProjectMoney());//项目金额
+        byId.setStaffCost(entity.getStaffCost());//人员成本
+        byId.setProjectCost(entity.getProjectCost());//项目费用
+        byId.setTotalCost(entity.getTotalCost());//总成本
+        byId.setRelevanceClient(entity.getRelevanceClient());//关联客户
+        byId.setLinkmanPhone(entity.getLinkmanPhone());//客户电话
+        byId.setProjectPrincipal(entity.getProjectPrincipal());//项目负责人
+        byId.setProjectDescribe(entity.getProjectDescribe());//项目描述
+        byId.setProjectStatus(entity.getProjectStatus());//项目状态
+        if (FlowTaskStatus.REFUSED.equals(flowStatus)) {
+            // 更新流程状态和流程信息,以便建立下一个流程实例
+            byId.setFlowTaskStatus(FlowTaskStatus.DRAFT);//流程状态
+            byId.setProcessDefinitionId(null);//流程定义id
+            byId.setProcessInstanceId(null);//流程实例id
+        }
+        ProjectInfoEntity save = projectInfoMapper.save(byId);
+        return new ResMsg(CodeEnum.OK, save);
+    }
 
-        projectInfoMapper.updateProject(projectInfoEntity.getProjectStage(), projectInfoEntity.getProjectStatus(), projectInfoEntity.getProjectId());
+    @Override
+    public ResMsg submitProjectByUpdate(ProjectInfoEntity projectInfoEntity) {
+        //先更新数据
+        ResMsg resMsg = updateProject(projectInfoEntity);
+        ProjectInfoEntity save = (ProjectInfoEntity) resMsg.getData();
+        if (!"200".equals(resMsg.getCode())) {
+            return resMsg;
+        }
+        //再进行提交
+        ResMsg resMsg1 = projectFlowStart(save);
+        if (!"200".equals(resMsg1.getCode())) {
+            return resMsg1;
+        }
         return new ResMsg(CodeEnum.OK);
     }
 
@@ -407,8 +440,59 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
 
     @Override
     public ProjectInfoEntity getProjectInfoByCode(String projectCode) {
-            ProjectInfoEntity pro = projectInfoMapper.findProjectInfoByCode(projectCode);
-            return pro;
+        ProjectInfoEntity pro = projectInfoMapper.findProjectInfoByCode(projectCode);
+        return pro;
+    }
+
+    //提交项目--创建流程实例
+    public ResMsg projectFlowStart(ProjectInfoEntity projectInfoEntity) {
+        /**
+         *调用新增项目信息申请流程的启动
+         *获取流程开始节点之后的第一个任务节点的数据
+         *param processDefinitionKey 新建项目信息审批流程--流程标识。
+         */
+        String processDefinitionKey = "ProjectAddApplyFlow";
+        ResponseResult<FlowEntry> flowEntryResult = flowTaskStart.verifyAndGetFlowEntry(processDefinitionKey);
+        if (!flowEntryResult.isSuccess()) {
+            return ResMsg.newInstance(CodeEnum.FAIL, flowEntryResult);
+        }
+        FlowEntryPublish flowEntryPublish = flowEntryResult.getData().getMainFlowEntryPublish();
+        String initTaskInfo = flowEntryPublish.getInitTaskInfo();
+        com.ankaibei.workFlow.common.flow.vo.TaskInfoVo taskInfo = StrUtil.isBlank(initTaskInfo)
+                ? null : JSON.parseObject(initTaskInfo, TaskInfoVo.class);
+        if (ObjectUtils.isNotEmpty(taskInfo)) {
+            String loginName = TokenData.takeFromRequest().getLoginName();
+            taskInfo.setAssignedMe(StrUtil.equalsAny(
+                    taskInfo.getAssignee(), loginName, FlowConstant.START_USER_NAME_VAR));
+        }    //用户在表单页面配置的操作按钮
+        FlowTaskCommentDto flowTaskCommentDto = new FlowTaskCommentDto();
+        //提交后进行到第二个节点
+        flowTaskCommentDto.setApprovalType("agree");
+        HashMap<String, Object> stringObjectHashMap = new HashMap<>();
+        stringObjectHashMap.put("project_name", projectInfoEntity.getProjectName());
+        stringObjectHashMap.put("project_stage", projectInfoEntity.getProjectStage());
+        stringObjectHashMap.put("project_status", projectInfoEntity.getProjectStatus());
+        stringObjectHashMap.put("project_type", projectInfoEntity.getProjectType());
+        stringObjectHashMap.put("relevance_client", projectInfoEntity.getRelevanceClient());
+        stringObjectHashMap.put("project_money", projectInfoEntity.getProjectMoney());
+        stringObjectHashMap.put("staff_cost", projectInfoEntity.getStaffCost());
+        stringObjectHashMap.put("project_cost", projectInfoEntity.getProjectCost());
+        stringObjectHashMap.put("total_cost", projectInfoEntity.getTotalCost());
+        stringObjectHashMap.put("linkman_phone", projectInfoEntity.getLinkmanPhone());
+        stringObjectHashMap.put("project_principal", projectInfoEntity.getProjectPrincipal());
+        stringObjectHashMap.put("project_node", projectInfoEntity.getProjectNode());
+        stringObjectHashMap.put("project_describe", projectInfoEntity.getProjectDescribe());
+        stringObjectHashMap.put("create_date", projectInfoEntity.getCreateDate());
+        stringObjectHashMap.put("project_id", projectInfoEntity.getProjectId());
+        JSONObject masterData = (JSONObject) JSONObject.toJSON(stringObjectHashMap);
+        Map<String, String> map = flowTaskStart.startAndTakeUserTaskSS(processDefinitionKey, flowTaskCommentDto, null, masterData, null, null).getData();
+        projectInfoEntity.setProcessDefinitionId(map.get("processDefinitionId"));
+        projectInfoEntity.setProcessInstanceId(map.get("processInstanceId"));
+        projectInfoEntity.setFlowTaskStatus(FlowTaskStatus.SUBMITTED);
+        projectInfoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
+        projectInfoMapper.save(projectInfoEntity);
+
+        return new ResMsg(CodeEnum.OK);
     }
 
     /**

+ 48 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/vo/ManHourInfoVo.java

@@ -25,16 +25,28 @@ public class ManHourInfoVo extends BaseVo {
      * 项目成员
      */
     private String projectUser;
+    /**
+     * 项目成员
+     */
+    private String projectUserName;
 
     /**
      * 项目名称
      */
     private String projectId;
+    /**
+     * 项目名称
+     */
+    private String projectName;
 
     /**
-     * 任务名称
+     * 任务ID
      */
     private String taskId;
+    /**
+     * 任务名称
+     */
+    private String targetTask;
 
     /**
      * 开始日期
@@ -68,6 +80,10 @@ public class ManHourInfoVo extends BaseVo {
      * 创建用户
      */
     private String createUser;
+    /**
+     * 创建用户
+     */
+    private String createUserName;
     /**
      * 审批人
      */
@@ -230,4 +246,35 @@ public class ManHourInfoVo extends BaseVo {
         this.jobs = jobs;
     }
 
+    public String getProjectUserName() {
+        return projectUserName;
+    }
+
+    public void setProjectUserName(String projectUserName) {
+        this.projectUserName = projectUserName;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public String getTargetTask() {
+        return targetTask;
+    }
+
+    public void setTargetTask(String targetTask) {
+        this.targetTask = targetTask;
+    }
+
+    public String getCreateUserName() {
+        return createUserName;
+    }
+
+    public void setCreateUserName(String createUserName) {
+        this.createUserName = createUserName;
+    }
 }

+ 6 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/vo/ProjectInfoVo.java

@@ -17,11 +17,16 @@ import java.util.Date;
 public class ProjectInfoVo extends BaseVo {
     private Integer projectId;
     private String projectName;
+    private String projectCode;
+    /**
+     * 项目周期
+     */
+    private String projectPeriod;
     private String projectStage;
     private String projectStatus;
     private String projectType;
     private String relevanceClient;
-    private String peojectMoney;
+    private String projectMoney;
     private BigDecimal staffCost;
     private BigDecimal projectCost;
     private BigDecimal totalCost;

+ 6 - 4
common/common-flow/src/main/java/com/ankaibei/workFlow/common/flow/service/impl/FlowApiServiceImpl.java

@@ -565,11 +565,13 @@ public class FlowApiServiceImpl implements FlowApiService {
     public MyPageData<Task> getTaskListByUserName(
             String username, ListRuntimeTaskRequestVo listRuntimeTaskRequestVo) {
         TaskQuery query = taskService.createTaskQuery().active();
-        if (StrUtil.isNotBlank(listRuntimeTaskRequestVo.getProcessDefinitionName())) {
-            query.processDefinitionNameLike("%" + listRuntimeTaskRequestVo.getProcessDefinitionName() + "%");
+        String processDefinitionName = listRuntimeTaskRequestVo.getProcessDefinitionName();
+        if (StrUtil.isNotBlank(processDefinitionName)) {
+            query.processDefinitionNameLike("%" + processDefinitionName + "%");
         }
-        if (StrUtil.isNotBlank(listRuntimeTaskRequestVo.getTaskName())) {
-            query.taskNameLike("%" + listRuntimeTaskRequestVo.getTaskName() + "%");
+        String taskName = listRuntimeTaskRequestVo.getTaskName();
+        if (StrUtil.isNotBlank(taskName)) {
+            query.taskNameLike("%" + taskName + "%");
         }
 
         this.buildCandidateCondition(query, username);