Browse Source

对接修改

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

+ 2 - 2
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/controller/admin/sop/SopExecutionPlanController.java

@@ -66,8 +66,8 @@ public class SopExecutionPlanController {
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('iscs:sop-execution-plan:query')")
     public CommonResult<SopExecutionPlanRespVO> selectSopExecutionPlanById(@RequestParam("id") Long id) {
-        SopExecutionPlanDO sopExecutionPlan = sopExecutionPlanService.getSopExecutionPlan(id);
-        return success(BeanUtils.toBean(sopExecutionPlan, SopExecutionPlanRespVO.class));
+        SopExecutionPlanRespVO sopExecutionPlan = sopExecutionPlanService.getSopExecutionPlan(id);
+        return success(sopExecutionPlan);
     }
 
     @GetMapping("/getSopExecutionPlanPage")

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

@@ -29,15 +29,13 @@ public class SopExecutionPlanPageReqVO extends PageParam {
     private Integer timePoint;
 
     @Schema(description = "开始时间节点")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private String[] startTime;
+    private String startTime;
 
     @Schema(description = "持续时长(小时)")
     private String duration;
 
     @Schema(description = "计划终止时间")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private LocalDateTime[] endTime;
+    private String endTime;
 
     @Schema(description = "非工作日(0-照常执行 1-不执行 2-向前顺延 3-向后顺延 )")
     private Integer nonWorkDay;

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

@@ -46,7 +46,7 @@ public class SopExecutionPlanRespVO {
 
     @Schema(description = "计划终止时间")
     @ExcelProperty("计划终止时间")
-    private LocalDateTime endTime;
+    private String endTime;
 
     @Schema(description = "非工作日(0-照常执行 1-不执行 2-向前顺延 3-向后顺延 )")
     @ExcelProperty("非工作日(0-照常执行 1-不执行 2-向前顺延 3-向后顺延 )")

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

@@ -41,7 +41,7 @@ public class SopExecutionPlanSaveReqVO {
     private String duration;
 
     @Schema(description = "计划终止时间")
-    private LocalDateTime endTime;
+    private String endTime;
 
     @Schema(description = "非工作日(0-照常执行 1-不执行 2-向前顺延 3-向后顺延 )")
     private Integer nonWorkDay;

+ 0 - 2
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/mysql/sop/SopExecutionPlanMapper.java

@@ -22,9 +22,7 @@ public interface SopExecutionPlanMapper extends BaseMapperX<SopExecutionPlanDO>
                 .eqIfPresent(SopExecutionPlanDO::getFrequencyUnit, reqVO.getFrequencyUnit())
                 .eqIfPresent(SopExecutionPlanDO::getFrequency, reqVO.getFrequency())
                 .eqIfPresent(SopExecutionPlanDO::getTimePoint, reqVO.getTimePoint())
-                .betweenIfPresent(SopExecutionPlanDO::getStartTime, reqVO.getStartTime())
                 .eqIfPresent(SopExecutionPlanDO::getDuration, reqVO.getDuration())
-                .betweenIfPresent(SopExecutionPlanDO::getEndTime, reqVO.getEndTime())
                 .eqIfPresent(SopExecutionPlanDO::getNonWorkDay, reqVO.getNonWorkDay())
                 .eqIfPresent(SopExecutionPlanDO::getNonWorkMoveDay, reqVO.getNonWorkMoveDay())
                 .eqIfPresent(SopExecutionPlanDO::getRemark, reqVO.getRemark())

+ 2 - 1
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopExecutionPlanService.java

@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.iscs.service.sop;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanRespVO;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanSaveReqVO;
 import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopExecutionPlanDO;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -52,7 +53,7 @@ public interface SopExecutionPlanService extends IService<SopExecutionPlanDO> {
      * @param id 编号
      * @return SOP计划执行
      */
-    SopExecutionPlanDO getSopExecutionPlan(Long id);
+    SopExecutionPlanRespVO getSopExecutionPlan(Long id);
 
     /**
      * 获得SOP计划执行分页

+ 21 - 12
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopExecutionPlanServiceImpl.java

@@ -1,17 +1,22 @@
 package cn.iocoder.yudao.module.iscs.service.sop;
 
 
+import cn.hutool.core.date.DateUtil;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanPageReqVO;
+import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanRespVO;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanSaveReqVO;
 import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopExecutionPlanDO;
 import cn.iocoder.yudao.module.iscs.dal.mysql.sop.SopExecutionPlanMapper;
+import cn.iocoder.yudao.module.iscs.utils.SuperDateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
+import javax.xml.crypto.Data;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -28,16 +33,6 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
 
     @Override
     public Long createSopExecutionPlan(SopExecutionPlanSaveReqVO createReqVO) {
-        // 分类处理
-        if (createReqVO.getFrequencyUnit().equals(0)) {
-            // 处理年的数据
-
-
-
-        }
-
-
-
 
         // 插入
         SopExecutionPlanDO sopExecutionPlan = BeanUtils.toBean(createReqVO, SopExecutionPlanDO.class);
@@ -69,8 +64,22 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
 
 
     @Override
-    public SopExecutionPlanDO getSopExecutionPlan(Long id) {
-        return sopExecutionPlanMapper.selectById(id);
+    public SopExecutionPlanRespVO getSopExecutionPlan(Long id) {
+        SopExecutionPlanDO sopExecutionPlanDO = sopExecutionPlanMapper.selectById(id);
+        SopExecutionPlanRespVO bean = BeanUtils.toBean(sopExecutionPlanDO, SopExecutionPlanRespVO.class);
+        Date date = new Date();
+        // 分类处理
+        /*if (createReqVO.getFrequencyUnit().equals(0)) {
+            // 处理年的数据
+            String yyyymmdd = DateUtil.format(date, "yyyy-MM-dd");
+            List<String> adjacentDatesYearDay = SuperDateUtils.getAdjacentDatesYearDay(
+                    SuperDateUtils.getYYYYMMDD(),
+                    createReqVO.getEndTime(),
+                    createReqVO.getFrequency(),
+                    createReqVO.getTimePoint(),
+                    10);
+        }*/
+        return bean;
     }
 
     @Override

+ 8 - 1
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/workflow/WorkflowModeServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.iscs.service.workflow;
 
 import cn.hutool.core.lang.Assert;
+import cn.hutool.json.JSON;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
 import cn.iocoder.yudao.framework.common.util.io.FileDriveLetterUtils;
@@ -14,6 +15,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 import cn.iocoder.yudao.module.system.service.user.AdminUserService;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
 import org.apache.commons.lang3.StringUtils;
@@ -25,6 +27,7 @@ import javax.crypto.BadPaddingException;
 import javax.crypto.IllegalBlockSizeException;
 import javax.crypto.NoSuchPaddingException;
 import java.io.*;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -163,7 +166,11 @@ public class WorkflowModeServiceImpl extends ServiceImpl<WorkflowModeMapper, Wor
             modeExportVO.setStepList(stepExportVOS);
         }
         // 开始加密
-        String s = AES256Utils.AES256DECRYPT(modeExportVOS.toString());
+        // 使用 Jackson 库序列化
+        ObjectMapper objectMapper = new ObjectMapper();
+        String jsonStr = objectMapper.writeValueAsString(modeExportVOS); // List自动转为数组
+        byte[] dataBytes = jsonStr.getBytes(StandardCharsets.UTF_8); // 转为字节数组准备加密
+        String s = AES256Utils.AES256DECRYPT(dataBytes);
         // 时间戳
         long currentTimestamp = System.currentTimeMillis();
         // 确保目录存在

+ 3 - 2
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/utils/AES256Utils.java

@@ -5,6 +5,7 @@ import org.apache.commons.codec.binary.Hex;
 import javax.crypto.*;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
 import java.security.InvalidAlgorithmParameterException;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
@@ -20,7 +21,7 @@ public class AES256Utils {
     /**
      * 输入1-7获取包括当日的下一个周几的日期
      */
-    public static String AES256DECRYPT(String plaintext) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
+    public static String AES256DECRYPT(byte[] dataBytes) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
         // 1. 生成256位密钥(需确保JCE无限制政策已安装)
         /*KeyGenerator keyGen = KeyGenerator.getInstance("AES");
         keyGen.init(128, new SecureRandom()); // 使用安全随机数
@@ -39,7 +40,7 @@ public class AES256Utils {
 
         // 4. 加密过程
         cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
-        byte[] encrypted = cipher.doFinal(plaintext.getBytes());
+        byte[] encrypted = cipher.doFinal(dataBytes);
         byte[] data = new byte[16 + encrypted.length];
         System.arraycopy(ivBytes, 0, data, 0, 16);
         System.arraycopy(encrypted, 0, data, 16, encrypted.length);

+ 8 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/utils/SuperDateUtils.java

@@ -1,5 +1,7 @@
 package cn.iocoder.yudao.module.iscs.utils;
 
+import cn.hutool.core.date.DateUtil;
+
 import java.time.DayOfWeek;
 import java.time.LocalDate;
 import java.time.YearMonth;
@@ -34,6 +36,12 @@ public class SuperDateUtils {
         WEEKDAY_MAP.put("星期天", DayOfWeek.SUNDAY); // 部分地区使用
     }
 
+    public static String getYYYYMMDD() {
+        Date date = new Date();
+        String yyyymmdd = DateUtil.format(date, "yyyy-MM-dd");
+        return yyyymmdd;
+    }
+
 
     // ------------------------------------- 获取指定时间段内的所有日期 ---------------------------------------------------