Browse Source

对接修改

小车车 3 tháng trước cách đây
mục cha
commit
013ddf931a

+ 9 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/sop/vo/SopExecutionPlanPageReqVO.java

@@ -46,6 +46,15 @@ public class SopExecutionPlanPageReqVO extends PageParam {
     @Schema(description = "延长天数")
     private Integer nonWorkMoveDay;
 
+    @Schema(description = "最近执行日期")
+    private String lastExecutDate;
+
+    @Schema(description = "下次执行日期")
+    private String nextExecutDate;
+
+    @Schema(description = "生效时间")
+    private String effectiveTime;
+
     @Schema(description = "备注", example = "你猜")
     private String remark;
 

+ 9 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/sop/vo/SopExecutionPlanRespVO.java

@@ -58,6 +58,15 @@ public class SopExecutionPlanRespVO {
     @ExcelProperty("延长天数")
     private Integer nonWorkMoveDay;
 
+    @Schema(description = "最近执行日期")
+    private String lastExecutDate;
+
+    @Schema(description = "下次执行日期")
+    private String nextExecutDate;
+
+    @Schema(description = "生效时间")
+    private String effectiveTime;
+
     @Schema(description = "备注", example = "你猜")
     @ExcelProperty("备注")
     private String remark;

+ 14 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/sop/vo/SopExecutionPlanSaveReqVO.java

@@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
+import java.time.LocalDateTime;
+
 @Schema(description = "管理后台 - SOP计划执行新增/修改 Request VO")
 @Data
 public class SopExecutionPlanSaveReqVO {
@@ -52,7 +54,19 @@ public class SopExecutionPlanSaveReqVO {
     @Schema(description = "延长天数")
     private Integer nonWorkMoveDay;
 
+    @Schema(description = "最近执行日期")
+    private String lastExecutDate;
+
+    @Schema(description = "下次执行日期")
+    private String nextExecutDate;
+
+    @Schema(description = "生效时间")
+    private String effectiveTime;
+
     @Schema(description = "备注", example = "你猜")
     private String remark;
 
+    @Schema(description = "开始时间")
+    private LocalDateTime createTime;
+
 }

+ 6 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/sop/vo/SopPageReqVO.java

@@ -41,6 +41,12 @@ public class SopPageReqVO extends PageParam {
     @Schema(description = "权重序号")
     private Integer sopIndex;
 
+    @Schema(description = "启用通知(0不启用 1启用)")
+    private Integer enableNotifications;
+
+    @Schema(description = "启用执行计划(0不启用 1启用)")
+    private Integer enableExecutionPlan;
+
     @Schema(description = "备注", example = "你说的对")
     private String remark;
 

+ 6 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/sop/vo/SopRespVO.java

@@ -60,6 +60,12 @@ public class SopRespVO {
     @ExcelProperty("权重序号")
     private Integer sopIndex;
 
+    @Schema(description = "启用通知(0不启用 1启用)")
+    private Integer enableNotifications;
+
+    @Schema(description = "启用执行计划(0不启用 1启用)")
+    private Integer enableExecutionPlan;
+
     @Schema(description = "备注", example = "你说的对")
     @ExcelProperty("备注")
     private String remark;

+ 6 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/sop/vo/SopSaveReqVO.java

@@ -48,6 +48,12 @@ public class SopSaveReqVO {
     @Schema(description = "权重序号")
     private Integer sopIndex;
 
+    @Schema(description = "启用通知(0不启用 1启用)")
+    private Integer enableNotifications;
+
+    @Schema(description = "启用执行计划(0不启用 1启用)")
+    private Integer enableExecutionPlan;
+
     @Schema(description = "备注", example = "你说的对")
     private String remark;
 

+ 8 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/dataobject/sop/SopDO.java

@@ -70,6 +70,14 @@ public class SopDO extends BaseDO {
      * 权重序号
      */
     private Integer sopIndex;
+    /**
+     * 启用通知(0不启用 1启用)
+     */
+    private Integer enableNotifications;
+    /**
+     * 启用执行计划(0不启用 1启用)
+     */
+    private Integer enableExecutionPlan;
     /**
      * 备注
      */

+ 12 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/dataobject/sop/SopExecutionPlanDO.java

@@ -70,6 +70,18 @@ public class SopExecutionPlanDO extends BaseDO {
      * 延长天数
      */
     private Integer nonWorkMoveDay;
+    /**
+     * 最近执行日期
+     */
+    private String lastExecutDate;
+    /**
+     * 下次执行日期
+     */
+    private String nextExecutDate;
+    /**
+     * 生效时间
+     */
+    private String effectiveTime;
     /**
      * 备注
      */

+ 71 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopExecutionPlanServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.iscs.service.sop;
 
 
+import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.lang.Assert;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@@ -15,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -48,6 +50,7 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
         // 插入
         sopExecutionPlanMapper.insert(sopExecutionPlan);
 
+
         // 返回
         return sopExecutionPlan.getId();
     }
@@ -55,6 +58,19 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
     @Override
     public void updateSopExecutionPlan(SopExecutionPlanSaveReqVO updateReqVO) {
 
+        // 如果执行频率单位、执行频率、执行时间点修改,则重新设置开始时间
+        SopExecutionPlanDO byId = getById(updateReqVO.getId());
+        Assert.isFalse(byId == null, "该sop执行计划不存在,不可修改!");
+        if (!updateReqVO.getFrequencyUnit().equals(byId.getFrequencyUnit()) ||
+                !updateReqVO.getFrequency().equals(byId.getFrequency()) ||
+                !updateReqVO.getTimePoint().equals(byId.getTimePoint())) {
+            // 改动了计划的实质性内容,需要直接修改计划的开始时间
+            updateReqVO.setCreateTime(LocalDateTime.now());
+            // 获取新的书简周期
+            List<String> previewDateList = getPreviewDateList(updateReqVO.getEffectiveTime(), updateReqVO.getFrequencyUnit(), updateReqVO.getFrequency(), updateReqVO.getTimePoint());
+            updateReqVO.setNextExecutDate(previewDateList.isEmpty() ? "" : previewDateList.get(0));
+        }
+
         // 如果永不截至
         if (StringUtils.isBlank(updateReqVO.getEndType()) || "1".equals(updateReqVO.getEndType())) {
             updateReqVO.setEndValue("9999-12-31");
@@ -65,6 +81,58 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
         sopExecutionPlanMapper.updateById(updateObj);
     }
 
+    private List<String> getPreviewDateList(String effectiveTime, Integer frequencyUnit, Integer frequency, String timePoint) {
+        ArrayList<String> strings = new ArrayList<>();
+        // 年
+        if (frequencyUnit.equals(0)) {
+            // 处理年的数据
+            String yyyymmdd = StringUtils.isBlank(effectiveTime) ?  SuperDateUtils.getYYYYMMDD() : effectiveTime;
+            List<String> adjacentDatesYearDay = SuperDateUtils.getAdjacentDatesYearDay(
+                    yyyymmdd,
+                    null,
+                    frequency,
+                    Integer.parseInt(timePoint),
+                    10);
+            strings.addAll(adjacentDatesYearDay);
+        }
+        // 月
+        if (frequencyUnit.equals(1)) {
+            // 处理月的数据
+            String yyyymmdd = StringUtils.isBlank(effectiveTime) ?  SuperDateUtils.getYYYYMMDD() : effectiveTime;
+            List<String> adjacentDatesMonthDay = SuperDateUtils.getAdjacentDatesMonthDay(
+                    yyyymmdd,
+                    null,
+                    frequency,
+                    Integer.parseInt(timePoint),
+                    10);
+            strings.addAll(adjacentDatesMonthDay);
+        }
+        // 周
+        if (frequencyUnit.equals(2)) {
+            // 处理周的数据
+            String yyyymmdd = StringUtils.isBlank(effectiveTime) ?  SuperDateUtils.getYYYYMMDD() : effectiveTime;
+            List<String> adjacentDatesByWeekday = SuperDateUtils.getAdjacentDatesByWeekday(
+                    yyyymmdd,
+                    null,
+                    frequency,
+                    timePoint,
+                    10);
+            strings.addAll(adjacentDatesByWeekday);
+        }
+        // 天
+        if (frequencyUnit.equals(3)) {
+            // 处理天的数据
+            String yyyymmdd = StringUtils.isBlank(effectiveTime) ?  SuperDateUtils.getYYYYMMDD() : effectiveTime;
+            List<String> adjacentDatesByDay = SuperDateUtils.getAdjacentDatesByDay(
+                    yyyymmdd,
+                    null,
+                    frequency,
+                    10);
+            strings.addAll(adjacentDatesByDay);
+        }
+        return strings;
+    }
+
     @Override
     public void deleteSopExecutionPlan(Long id) {
         // 删除
@@ -175,6 +243,9 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
         return bean;
     }
 
+
+
+
     @Override
     public SopExecutionPlanRespVO selectSopExecutionPlanBySopId(Long sopId) {
         SopExecutionPlanDO sopExecutionPlanDO = getOne(Wrappers.<SopExecutionPlanDO>lambdaQuery()