Browse Source

feat: 可靠性项目管理

NickOooo 6 days ago
parent
commit
3bbc555342

+ 3 - 125
nationrel-module-project-api/src/main/java/com/nationrel/modules/project/jar/dto/input/Rb0300112EditInput.java

@@ -1,5 +1,6 @@
 package com.nationrel.modules.project.jar.dto.input;
 
+import lombok.Data;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 
@@ -12,6 +13,7 @@ import java.io.Serializable;
  * @Author andy
  * @CreateDate 2013-12-4
  */
+@Data
 @Component
 @Scope("prototype")
 public class Rb0300112EditInput implements Serializable {
@@ -66,129 +68,5 @@ public class Rb0300112EditInput implements Serializable {
      */
     private String objectName;
 
-    /**
-     * @return the projectId
-     */
-    public String getProjectId() {
-        return projectId;
-    }
-
-    /**
-     * @param projectId the projectId to set
-     */
-    public void setProjectId(String projectId) {
-        this.projectId = projectId;
-    }
-
-    /**
-     * @return the projectCode
-     */
-    public String getProjectCode() {
-        return projectCode;
-    }
-
-    /**
-     * @param projectCode the projectCode to set
-     */
-    public void setProjectCode(String projectCode) {
-        this.projectCode = projectCode;
-    }
-
-    /**
-     * @return the projectName
-     */
-    public String getProjectName() {
-        return projectName;
-    }
-
-    /**
-     * @param projectName the projectName to set
-     */
-    public void setProjectName(String projectName) {
-        this.projectName = projectName;
-    }
-
-    /**
-     * @return the projectType
-     */
-    public String getProjectType() {
-        return projectType;
-    }
-
-    /**
-     * @param projectType the projectType to set
-     */
-    public void setProjectType(String projectType) {
-        this.projectType = projectType;
-    }
-
-    /**
-     * @return the application
-     */
-    public String getApplication() {
-        return application;
-    }
-
-    /**
-     * @param application the application to set
-     */
-    public void setApplication(String application) {
-        this.application = application;
-    }
-
-    /**
-     * @return the planStartTime
-     */
-    public String getPlanStartTime() {
-        return planStartTime;
-    }
-
-    /**
-     * @param planStartTime the planStartTime to set
-     */
-    public void setPlanStartTime(String planStartTime) {
-        this.planStartTime = planStartTime;
-    }
-
-    /**
-     * @return the planEndTime
-     */
-    public String getPlanEndTime() {
-        return planEndTime;
-    }
-
-    /**
-     * @param planEndTime the planEndTime to set
-     */
-    public void setPlanEndTime(String planEndTime) {
-        this.planEndTime = planEndTime;
-    }
-
-    /**
-     * @return the description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * @param description the description to set
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * @return the objectName
-     */
-    public String getObjectName() {
-        return objectName;
-    }
-
-    /**
-     * @param objectName the objectName to set
-     */
-    public void setObjectName(String objectName) {
-        this.objectName = objectName;
-    }
+    private Integer versionNo;
 }

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

@@ -7,12 +7,12 @@ import com.nationrel.modules.project.jar.dto.output.Rb0300112InitOutput;
 import com.nationrel.modules.project.jar.service.Rb0300112EditService;
 import com.nationrel.modules.project.jar.service.Rb0300112InitService;
 import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.parameters.RequestBody;
 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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -57,6 +57,6 @@ public class Rb0300112Controller {
         } catch (Exception e) {
             return Result.error(e.getMessage());
         }
-        return Result.ok(output);
+        return Result.ok();
     }
 }

+ 37 - 10
nationrel-module-project-biz/src/main/java/com/nationrel/modules/project/jar/service/impl/Rb0300112EditServiceImpl.java

@@ -4,12 +4,15 @@ import com.nationrel.modules.project.jar.dto.input.Rb0300112EditInput;
 import com.nationrel.modules.project.jar.dto.output.Rb0300112EditOutput;
 import com.nationrel.modules.project.jar.entity.PmProject;
 import com.nationrel.modules.project.jar.rb_common.common.constant.Constants;
+import com.nationrel.modules.project.jar.rb_common.common.constant.MessageId;
 import com.nationrel.modules.project.jar.rb_common.common.constant.SessionKeys;
+import com.nationrel.modules.project.jar.rb_common.exception.OptimisticLockException;
 import com.nationrel.modules.project.jar.util.DateUtils;
 import com.nationrel.modules.project.jar.util.SessionUtil;
 import com.nationrel.modules.project.jar.mapper.PmProjectMapper;
 import com.nationrel.modules.project.jar.service.PmProjectService;
 import com.nationrel.modules.project.jar.service.Rb0300112EditService;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
@@ -51,28 +54,52 @@ public class Rb0300112EditServiceImpl implements Rb0300112EditService {
 
         // 设置项目对象的基本信息
         PmProject pmProject = pmProjectMapper.selectByPrimaryKey(projectId);
+        if (!ObjectUtils.isEmpty(pmProject) && !pmProject.getVersionNo().equals(input.getVersionNo())) {
+            throw new OptimisticLockException(MessageId.W009801);
+        }
         Date dtPlanStartTime = DateUtils.convertDate(input.getPlanStartTime());
         Date dtPlanEndTime = DateUtils.convertDate(input.getPlanEndTime());
 
         // 时间有变动,时间整合性检查
-        if (DateUtils.isNotDateEquals(pmProject.getPlanStartTime(), dtPlanStartTime) ||
-                DateUtils.isNotDateEquals(pmProject.getPlanEndTime(), dtPlanEndTime)) {
+        if ((ObjectUtils.isNotEmpty(dtPlanStartTime) && ObjectUtils.isNotEmpty(dtPlanEndTime)) && (DateUtils.isNotDateEquals(pmProject.getPlanStartTime(), dtPlanStartTime) ||
+                DateUtils.isNotDateEquals(pmProject.getPlanEndTime(), dtPlanEndTime))) {
             pmProjectService.checkContainTimeOfTG(dtPlanStartTime, dtPlanEndTime, projectId);
         }
 
         // 页面输入值再设定
-        pmProject.setProjectCode(input.getProjectCode());
-        pmProject.setProjectName(input.getProjectName());
-        pmProject.setObjectName(input.getObjectName());
-        pmProject.setProjectType(String.valueOf(input.getProjectType()));
-        pmProject.setProjectApp(String.valueOf(input.getApplication()));
-        pmProject.setPlanStartTime(dtPlanStartTime);
-        pmProject.setPlanEndTime(dtPlanEndTime);
-        pmProject.setDescription(input.getDescription().trim());
+        if (ObjectUtils.isNotEmpty(input.getProjectCode())) {
+            pmProject.setProjectCode(input.getProjectCode());
+        }
+        if (ObjectUtils.isNotEmpty(input.getProjectName())) {
+            pmProject.setProjectName(input.getProjectName());
+        }
+        if (ObjectUtils.isNotEmpty(input.getObjectName())) {
+            pmProject.setObjectName(input.getObjectName());
+        }
+        if (ObjectUtils.isNotEmpty(input.getProjectCode())) {
+            pmProject.setProjectCode(input.getProjectCode());
+        }
+        if (ObjectUtils.isNotEmpty(input.getProjectType())) {
+            pmProject.setProjectType(String.valueOf(input.getProjectType()));
+        }
+        if (ObjectUtils.isNotEmpty(input.getApplication())) {
+            pmProject.setProjectApp(String.valueOf(input.getApplication()));
+        }
+        if (ObjectUtils.isNotEmpty(dtPlanStartTime)) {
+            pmProject.setPlanStartTime(dtPlanStartTime);
+        }
+        if (ObjectUtils.isNotEmpty(dtPlanEndTime)) {
+            pmProject.setPlanEndTime(dtPlanEndTime);
+        }
+
+        if (ObjectUtils.isNotEmpty(input.getDescription())) {
+            pmProject.setDescription(input.getDescription().trim());
+        }
 
         // 设置系统信息到项目对象
         pmProject.setUpdatePgmId(StringUtils.EMPTY);
         pmProject.setUpdateUserId(sysUser.getUsername());
+        pmProject.setUpdateTime(new Date());
 
         // 保存项目对象到数据库
         pmProjectMapper.updateByPrimaryKey(pmProject);