|
@@ -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);
|