Browse Source

feat: 可靠性项目管理

NickOooo 6 days ago
parent
commit
7394049743

+ 23 - 0
nationrel-module-project-api/src/main/java/com/nationrel/modules/project/req/PmProjectEditReq.java

@@ -0,0 +1,23 @@
+package com.nationrel.modules.project.req;
+
+import lombok.Data;
+
+/**
+ * @Description TODO
+ * @Author nijun
+ * @Date 2024/11/20 18:00
+ * @Version 1.0
+ */
+@Data
+public class PmProjectEditReq {
+
+    private String projectId;
+
+    private String planStartTime;
+
+    private String planEndTime;
+
+    private Integer versionNo;
+
+    private String taskName;
+}

+ 23 - 0
nationrel-module-project-api/src/main/java/com/nationrel/modules/project/req/PmTaskEditReq.java

@@ -0,0 +1,23 @@
+package com.nationrel.modules.project.req;
+
+import lombok.Data;
+
+/**
+ * @Description TODO
+ * @Author nijun
+ * @Date 2024/11/20 18:00
+ * @Version 1.0
+ */
+@Data
+public class PmTaskEditReq {
+
+    private String taskId;
+
+    private String planStartTime;
+
+    private String planEndTime;
+
+    private Integer versionNo;
+
+    private String taskName;
+}

+ 23 - 0
nationrel-module-project-api/src/main/java/com/nationrel/modules/project/req/PmTgEditReq.java

@@ -0,0 +1,23 @@
+package com.nationrel.modules.project.req;
+
+import lombok.Data;
+
+/**
+ * @Description TODO
+ * @Author nijun
+ * @Date 2024/11/20 17:56
+ * @Version 1.0
+ */
+@Data
+public class PmTgEditReq {
+
+    private String tgId;
+
+    private String planStartTime;
+
+    private String planEndTime;
+
+    private Integer versionNo;
+
+    private String tgName;
+}

+ 8 - 15
nationrel-module-project-biz/src/main/java/com/nationrel/modules/project/controller/PmTaskInfoController.java

@@ -1,30 +1,23 @@
 package com.nationrel.modules.project.controller;
 
-import java.util.Arrays;
-
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.nationrel.modules.project.dto.PmTaskInfoDto;
 import com.nationrel.modules.project.jar.entity.PmTask;
-import com.nationrel.modules.project.jar.entity.PmTg;
-import com.nationrel.modules.project.jar.service.PmProjectService;
+import com.nationrel.modules.project.req.PmProjectEditReq;
+import com.nationrel.modules.project.req.PmTaskEditReq;
+import com.nationrel.modules.project.req.PmTgEditReq;
 import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.IPageExtField;
-import org.jeecg.common.api.PageExtField;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
 import com.nationrel.modules.project.entity.PmTaskInfo;
 import com.nationrel.modules.project.service.IPmTaskInfoService;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.config.i18n.MessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.jeecg.common.aspect.annotation.AutoLog;
@@ -113,15 +106,15 @@ public class PmTaskInfoController extends JeecgController<PmTaskInfo, IPmTaskInf
 	 @AutoLog(value = "编辑")
 	 @Operation(summary="编辑Tg")
 	 @RequestMapping(value = "/editTg", method = {RequestMethod.PUT,RequestMethod.POST})
-	 public Result<String> editTg(@RequestBody PmTg pmTg) {
-		 tgInfoService.updateTgInfo(pmTg);
+	 public Result<String> editTg(@RequestBody PmTgEditReq pmtgEditReq) {
+		 tgInfoService.updateTgInfo(pmtgEditReq);
 		 return Result.OK(MessageUtils.get("nationrel_edit_success"));
 	 }
 
 	 @AutoLog(value = "编辑")
 	 @Operation(summary="编辑Task")
 	 @RequestMapping(value = "/editTask", method = {RequestMethod.PUT,RequestMethod.POST})
-	 public Result<String> editTask(@RequestBody PmTask pmTask) {
+	 public Result<String> editTask(@RequestBody PmTaskEditReq pmTask) {
 		 tgInfoService.updateTaskInfo(pmTask);
 		 return Result.OK(MessageUtils.get("nationrel_edit_success"));
 	 }
@@ -129,8 +122,8 @@ public class PmTaskInfoController extends JeecgController<PmTaskInfo, IPmTaskInf
 	  @AutoLog(value = "编辑")
 	 @Operation(summary="编辑Task")
 	 @RequestMapping(value = "/editProject", method = {RequestMethod.PUT,RequestMethod.POST})
-	 public Result<String> editProject(@RequestBody PmTask pmTask) {
-		 tgInfoService.updateTaskInfo(pmTask);
+	 public Result<String> editProject(@RequestBody PmProjectEditReq pmProjectEditReq) throws Exception {
+		 tgInfoService.updateProjectInfo(pmProjectEditReq);
 		 return Result.OK(MessageUtils.get("nationrel_edit_success"));
 	 }
 

+ 2 - 1
nationrel-module-project-biz/src/main/java/com/nationrel/modules/project/controller/Rb0300112Controller.java

@@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.config.i18n.MessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -57,6 +58,6 @@ public class Rb0300112Controller {
         } catch (Exception e) {
             return Result.error(e.getMessage());
         }
-        return Result.ok();
+        return Result.ok(MessageUtils.get("nationrel_edit_success"));
     }
 }

+ 6 - 6
nationrel-module-project-biz/src/main/java/com/nationrel/modules/project/service/IPmTaskInfoService.java

@@ -5,9 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.nationrel.modules.project.dto.PmTaskInfoDto;
 import com.nationrel.modules.project.entity.PmTaskInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.nationrel.modules.project.jar.entity.PmProject;
-import com.nationrel.modules.project.jar.entity.PmTask;
-import com.nationrel.modules.project.jar.entity.PmTg;
+import com.nationrel.modules.project.req.PmProjectEditReq;
+import com.nationrel.modules.project.req.PmTaskEditReq;
+import com.nationrel.modules.project.req.PmTgEditReq;
 import org.apache.ibatis.annotations.Param;
 
 /**
@@ -20,9 +20,9 @@ public interface IPmTaskInfoService extends IService<PmTaskInfo> {
 
     IPage<PmTaskInfoDto> selectPmTaskInfoPage(Page page, @Param("projectId") String projectId);
 
-    void updateTgInfo(PmTg pmTg);
+    void updateTgInfo(PmTgEditReq pmtgEditReq);
 
-    void updateTaskInfo(PmTask pmTask);
+    void updateTaskInfo(PmTaskEditReq pmTask);
 
-    void updateProjectInfo(PmProject pmProject) throws Exception;
+    void updateProjectInfo(PmProjectEditReq pmProjectEditReq) throws Exception;
 }

+ 33 - 12
nationrel-module-project-biz/src/main/java/com/nationrel/modules/project/service/impl/PmTaskInfoServiceImpl.java

@@ -14,15 +14,18 @@ import com.nationrel.modules.project.jar.entity.TaskPageModel;
 import com.nationrel.modules.project.jar.mapper.PmProjectMapper;
 import com.nationrel.modules.project.jar.mapper.PmTaskMapper;
 import com.nationrel.modules.project.jar.mapper.PmTgMapper;
-import com.nationrel.modules.project.jar.rb_common.common.constant.PmMapKeySet;
 import com.nationrel.modules.project.jar.rb_common.common.constant.ReliaFlowConstants;
 import com.nationrel.modules.project.jar.service.PmPercentStatService;
 import com.nationrel.modules.project.jar.service.PmProjectService;
 import com.nationrel.modules.project.jar.service.Rb0300220InitService;
 import com.nationrel.modules.project.jar.util.DateUtils;
 import com.nationrel.modules.project.mapper.PmTaskInfoMapper;
+import com.nationrel.modules.project.req.PmProjectEditReq;
+import com.nationrel.modules.project.req.PmTaskEditReq;
+import com.nationrel.modules.project.req.PmTgEditReq;
 import com.nationrel.modules.project.service.IPmTaskInfoService;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.config.i18n.MessageUtils;
@@ -114,11 +117,19 @@ public class PmTaskInfoServiceImpl extends ServiceImpl<PmTaskInfoMapper, PmTaskI
     }
 
     @Override
-    public void updateTgInfo(PmTg pmTg) {
+    public void updateTgInfo(PmTgEditReq pmtgEditReq) {
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        PmTg dbPmTg = pmTgMapper.selectByPrimaryKey(pmTg.getTgId());
-        if (dbPmTg.getVersionNo().equals(pmTg.getVersionNo())) {
-            dbPmTg.setTgName(pmTg.getTgName());
+        PmTg dbPmTg = pmTgMapper.selectByPrimaryKey(pmtgEditReq.getTgId());
+        if (dbPmTg.getVersionNo().equals(pmtgEditReq.getVersionNo())) {
+            if (StringUtils.isNotEmpty(pmtgEditReq.getTgName())) {
+                dbPmTg.setTgName(pmtgEditReq.getTgName());
+            }
+            if (StringUtils.isNotEmpty(pmtgEditReq.getPlanStartTime())) {
+                dbPmTg.setPlanStartTime(DateUtils.convertDate(pmtgEditReq.getPlanStartTime()));
+            }
+            if (StringUtils.isNotEmpty(pmtgEditReq.getPlanEndTime())) {
+                dbPmTg.setPlanEndTime(DateUtils.convertDate(pmtgEditReq.getPlanEndTime()));
+            }
             dbPmTg.setUpdateTime(new Date());
             dbPmTg.setUpdateUserId(sysUser.getUsername());
             dbPmTg.setUpdatePgmId("1");
@@ -130,11 +141,19 @@ public class PmTaskInfoServiceImpl extends ServiceImpl<PmTaskInfoMapper, PmTaskI
     }
 
     @Override
-    public void updateTaskInfo(PmTask pmTask) {
+    public void updateTaskInfo(PmTaskEditReq pmTask) {
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         PmTask dbPmTask = pmTaskMapper.selectByPrimaryKey(pmTask.getTaskId());
         if (dbPmTask.getVersionNo().equals(pmTask.getVersionNo())) {
-            dbPmTask.setTaskName(pmTask.getTaskName());
+            if (StringUtils.isNotEmpty(pmTask.getTaskName())) {
+                dbPmTask.setTaskName(pmTask.getTaskName());
+            }
+            if (StringUtils.isNotEmpty(pmTask.getPlanStartTime())) {
+                dbPmTask.setPlanStartTime(DateUtils.convertDate(pmTask.getPlanStartTime()));
+            }
+            if (StringUtils.isNotEmpty(pmTask.getPlanEndTime())) {
+                dbPmTask.setPlanEndTime(DateUtils.convertDate(pmTask.getPlanEndTime()));
+            }
             dbPmTask.setUpdateTime(new Date());
             dbPmTask.setUpdateUserId(sysUser.getUsername());
             dbPmTask.setUpdatePgmId("1");
@@ -146,13 +165,15 @@ public class PmTaskInfoServiceImpl extends ServiceImpl<PmTaskInfoMapper, PmTaskI
     }
 
     @Override
-    public void updateProjectInfo(PmProject project) throws Exception {
+    public void updateProjectInfo(PmProjectEditReq pmProjectEditReq) throws Exception {
 
-        PmProject pmProject = pmProjectMapper.selectByPrimaryKey(project.getProjectId());
+        PmProject pmProject = pmProjectMapper.selectByPrimaryKey(pmProjectEditReq.getProjectId());
+        Date startTime = DateUtils.convertDate(pmProjectEditReq.getPlanStartTime());
+        Date endTime = DateUtils.convertDate(pmProjectEditReq.getPlanEndTime());
         // 时间有变动,时间整合性检查
-        if (DateUtils.isNotDateEquals(pmProject.getPlanStartTime(), project.getPlanStartTime()) ||
-                DateUtils.isNotDateEquals(pmProject.getPlanEndTime(), project.getPlanEndTime())) {
-            pmProjectService.checkContainTimeOfTG(project.getPlanStartTime(), project.getPlanEndTime(), project.getProjectId());
+        if (DateUtils.isNotDateEquals(pmProject.getPlanStartTime(), startTime) ||
+                DateUtils.isNotDateEquals(pmProject.getPlanEndTime(), endTime)) {
+            pmProjectService.checkContainTimeOfTG(startTime, endTime, pmProjectEditReq.getProjectId());
         }
     }