|
|
@@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.iscs.utils.SuperDateUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
@@ -33,9 +34,18 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
|
|
|
|
|
|
@Override
|
|
|
public Long createSopExecutionPlan(SopExecutionPlanSaveReqVO createReqVO) {
|
|
|
+ Assert.notNull(createReqVO.getSopId(), "sopid不可为空!");
|
|
|
+ // 检测如果这个sop已经有了,就不能再有
|
|
|
+ SopExecutionPlanDO sopExecutionPlanDO = getOne(Wrappers.<SopExecutionPlanDO>lambdaQuery()
|
|
|
+ .eq(SopExecutionPlanDO::getSopId, createReqVO.getSopId()));
|
|
|
+ Assert.isFalse(sopExecutionPlanDO != null, "该sop已存在计划!");
|
|
|
|
|
|
- // 插入
|
|
|
SopExecutionPlanDO sopExecutionPlan = BeanUtils.toBean(createReqVO, SopExecutionPlanDO.class);
|
|
|
+ // 如果永不截至
|
|
|
+ if (StringUtils.isBlank(createReqVO.getEndType()) || "1".equals(createReqVO.getEndType())) {
|
|
|
+ sopExecutionPlan.setEndValue("9999-12-31");
|
|
|
+ }
|
|
|
+ // 插入
|
|
|
sopExecutionPlanMapper.insert(sopExecutionPlan);
|
|
|
|
|
|
// 返回
|
|
|
@@ -44,6 +54,12 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
|
|
|
|
|
|
@Override
|
|
|
public void updateSopExecutionPlan(SopExecutionPlanSaveReqVO updateReqVO) {
|
|
|
+
|
|
|
+ // 如果永不截至
|
|
|
+ if (StringUtils.isBlank(updateReqVO.getEndType()) || "1".equals(updateReqVO.getEndType())) {
|
|
|
+ updateReqVO.setEndValue("9999-12-31");
|
|
|
+ }
|
|
|
+
|
|
|
// 更新
|
|
|
SopExecutionPlanDO updateObj = BeanUtils.toBean(updateReqVO, SopExecutionPlanDO.class);
|
|
|
sopExecutionPlanMapper.updateById(updateObj);
|