Browse Source

工时管理的新增功能完成

buzhanyi 7 months ago
parent
commit
bd4547e6c2

+ 1 - 3
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/api/ManHourServiceApi.java

@@ -30,9 +30,7 @@ public class ManHourServiceApi implements ManHourInfoApi {
 
     @Override
     public ResMsg addManHour(ManHourInfoVo manHourInfoVo) {
-        ManHourInfoEntity manHourInfoEntity = this.copyProperties(manHourInfoVo, ManHourInfoEntity.class);
-        List<ManHourJobVo> jobs = manHourInfoVo.getJobs();
-        return manHourService.addManHour(manHourInfoEntity, jobs);
+        return manHourService.addManHour(manHourInfoVo);
     }
 
     @Override

+ 5 - 5
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/entity/ManHourInfoEntity.java

@@ -45,7 +45,7 @@ public class ManHourInfoEntity {
     /**
      * 工时日期
      */
-    private String manufactureDate;
+    private Date manufactureDate;
 
     /**
      * 总工时(小时)
@@ -94,21 +94,21 @@ public class ManHourInfoEntity {
 
     @Basic
     @Column(name = "task_id")
-    public String getTaskName() {
+    public String getTaskId() {
         return taskId;
     }
 
-    public void setTaskName(String taskId) {
+    public void setTaskId(String taskId) {
         this.taskId = taskId;
     }
 
     @Basic
     @Column(name = "manufacture_date")
-    public String getManufactureDate() {
+    public Date getManufactureDate() {
         return manufactureDate;
     }
 
-    public void setManufactureDate(String manufactureDate) {
+    public void setManufactureDate(Date manufactureDate) {
         this.manufactureDate = manufactureDate;
     }
 

+ 58 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/enums/DataIsDeleteEnum.java

@@ -0,0 +1,58 @@
+package com.ankaibei.workFlow.webadmin.ankaibei.enums;
+
+/**
+ * @ClassName: AgentCodeEnum
+ * @author:
+ * @date: 2019/10/01
+ * @Copyright: 2019
+ */
+public enum DataIsDeleteEnum {
+    /**
+     * 是否已删除: 1=正常,-1=已删除
+     */
+    NORMAL("1", "正常"),
+    IS_DELETE("-1", "已删除");
+
+
+    private final String code;
+    private final String reason;
+
+    DataIsDeleteEnum(final String statusCode, final String reasonPhrase) {
+        this.code = statusCode;
+        this.reason = reasonPhrase;
+    }
+
+    /**
+     * Convert a numerical status code into the corresponding Status
+     *
+     * @param statusCode the numerical status code
+     * @return the matching Status or null is no matching Status is defined
+     */
+    public static DataIsDeleteEnum fromCode(final String statusCode) {
+        for (DataIsDeleteEnum s : DataIsDeleteEnum.values()) {
+            if (s.code.equals(statusCode)) {
+                return s;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Get the associated status code
+     *
+     * @return the status code
+     */
+    public String getCode() {
+        return code;
+    }
+
+    /**
+     * Get the reason phrase
+     *
+     * @return the reason phrase
+     */
+    @Override
+    public String toString() {
+        return reason;
+    }
+}

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

@@ -21,7 +21,7 @@ import java.util.Map;
 public interface ManHourMapper extends JpaRepository<ManHourInfoEntity, Integer>, JpaSpecificationExecutor<ManHourInfoEntity> {
 
 
-    @Query(value = "SELECT man.man_id manId,man.project_user projrctUser,man.project_name projectName," +
+    @Query(value = "SELECT man.man_id manId,man.project_user projrctUser,man.project_id projectId," +
             "man.task_id taskId,man.manufacture_date manufactureDate, man.man_hour manHour,man.job_content jobContent,man.man_status manStatus," +
             "man.start_date startDate,man.end_date endDate,man.create_time createTime,man.flow_task_status flowTaskStatus, " +
             "man.process_instance_id processInstanceId ,man.process_definition_id processDefinitionId " +

+ 1 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/ManHourService.java

@@ -18,7 +18,7 @@ public interface ManHourService {
 
     ResMsg findManHourAll(Integer pageIndex, Integer pageSize, ManHourInfoEntity manHourInfoEntity);
 
-    ResMsg addManHour(ManHourInfoEntity manHourInfoEntity, List<ManHourJobVo> jobs);
+    ResMsg addManHour(ManHourInfoVo manHourInfoVo);
 
     ResMsg submitManHour(List<ManHourInfoVo> manHourInfoVos);
 

+ 12 - 6
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ManHourServiceImpl.java

@@ -13,6 +13,7 @@ import com.ankaibei.workFlow.common.flow.model.FlowEntryPublish;
 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.ManHourStatus;
 import com.ankaibei.workFlow.webadmin.ankaibei.mapper.*;
 import com.ankaibei.workFlow.webadmin.ankaibei.service.ManHourService;
@@ -87,15 +88,20 @@ public class ManHourServiceImpl implements ManHourService {
     }
 
     @Override
-    public ResMsg addManHour(ManHourInfoEntity manHourInfoEntity, List<ManHourJobVo> jobs) {
-        Optional<UserInfoEntity> byId1 = userInfoMapper.findById(manHourInfoEntity.getCreateUser());
-        //工时:添加后状态为1,未提交
+    public ResMsg addManHour(ManHourInfoVo manHourInfoVo) {
+        List<ManHourJobVo> jobs = manHourInfoVo.getJobs();
+        Optional<UserInfoEntity> byId1 = userInfoMapper.findById(manHourInfoVo.getCreateUser());
         String showName = byId1.orElse(null) != null ? byId1.orElse(null).getShowName() : null;
-        manHourInfoEntity.setProjectUser(showName);
-        manHourInfoEntity.setCreateUser(showName);
-        manHourInfoEntity.setManStatus(ManHourStatus.NO_ALLOCATION.getCode());
         for (ManHourJobVo job : jobs) {
+            ManHourInfoEntity manHourInfoEntity = new ManHourInfoEntity();
+            BeanUtils.copyProperties(manHourInfoVo, manHourInfoEntity);
+            //工时:添加后状态为1,未提交
+            manHourInfoEntity.setProjectUser(showName);
+            manHourInfoEntity.setCreateUser(byId1.get().getUserId());
+            manHourInfoEntity.setManStatus(ManHourStatus.NO_ALLOCATION.getCode());
             BeanUtils.copyProperties(job, manHourInfoEntity);
+            manHourInfoEntity.setCreateTime(new Date());
+            manHourInfoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
             manHourMapper.save(manHourInfoEntity);
         }
         return new ResMsg(CodeEnum.OK);

+ 2 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ProjectInfoServiceImpl.java

@@ -15,6 +15,7 @@ import com.ankaibei.workFlow.common.flow.model.FlowEntryPublish;
 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.ProjectStatusEnum;
 import com.ankaibei.workFlow.webadmin.ankaibei.mapper.*;
@@ -192,7 +193,7 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
         save.setProcessDefinitionId(map.get("processDefinitionId"));
         save.setProcessInstanceId(map.get("processInstanceId"));
         save.setFlowTaskStatus(FlowTaskStatus.SUBMITTED);
-        save.setIsDelete("1");
+        save.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
         projectInfoMapper.save(save);
         return new ResMsg(CodeEnum.OK);
     }

+ 2 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/TaskInfoServiceImpl.java

@@ -14,6 +14,7 @@ import com.ankaibei.workFlow.webadmin.ankaibei.entity.ProjectInfoEntity;
 import com.ankaibei.workFlow.webadmin.ankaibei.entity.TaskInfoEntity;
 import com.ankaibei.workFlow.webadmin.ankaibei.entity.UserInfoEntity;
 import com.ankaibei.workFlow.webadmin.ankaibei.enums.CodeEnum;
+import com.ankaibei.workFlow.webadmin.ankaibei.enums.DataIsDeleteEnum;
 import com.ankaibei.workFlow.webadmin.ankaibei.enums.TaskPriority;
 import com.ankaibei.workFlow.webadmin.ankaibei.enums.TaskStatus;
 import com.ankaibei.workFlow.webadmin.ankaibei.mapper.ProjectInfoMapper;
@@ -169,7 +170,7 @@ public class TaskInfoServiceImpl implements TaskInfoService {
         taskInfoEntity.setTaskParticipant(str.toString());
         taskInfoEntity.setTaskCreator(taskInfoEntity.getTaskCreator());
         taskInfoEntity.setCreateDate(new Date());
-        taskInfoEntity.setIsDelete("1");
+        taskInfoEntity.setIsDelete(DataIsDeleteEnum.NORMAL.getCode());
         TaskInfoEntity save = taskInfoMapper.save(taskInfoEntity);
 
         /**

+ 3 - 3
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/vo/ManHourJobVo.java

@@ -28,7 +28,7 @@ public class ManHourJobVo {
     /**
      * 工作时长(小时)
      */
-    private Integer manHour;
+    private BigDecimal manHour;
     /**
      * 工作内容
      */
@@ -43,11 +43,11 @@ public class ManHourJobVo {
         this.manufactureDate = manufactureDate;
     }
 
-    public Integer getManHour() {
+    public BigDecimal getManHour() {
         return manHour;
     }
 
-    public void setManHour(Integer manHour) {
+    public void setManHour(BigDecimal manHour) {
         this.manHour = manHour;
     }