ZhuDeKang пре 1 месец
родитељ
комит
aeea8e79fb

+ 1 - 1
ruoyi-admin/src/main/resources/application-test.yml

@@ -97,7 +97,7 @@ spring:
     # 数据库索引
     database: 6
     # 密码
-    password: 123456
+    password: ZjsthGw1125
     # 连接超时时间
     timeout: 20s
     lettuce:

+ 68 - 19
ruoyi-admin/src/test/java/com/ruoyi/JasyptTest.java

@@ -1,19 +1,11 @@
 package com.ruoyi;
 
-import com.ruoyi.common.core.domain.entity.SysDept;
-import com.ruoyi.common.core.domain.entity.SysRole;
-import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SM4Util;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.file.FileUtils;
-import com.ruoyi.interfaces.domain.MdModelInfo;
-import com.ruoyi.interfaces.domain.PtService;
-import com.ruoyi.interfaces.domain.SysMetaDatasource;
-import com.ruoyi.interfaces.mapper.MdModelInfoMapper;
-import com.ruoyi.interfaces.mapper.PtServiceMapper;
-import com.ruoyi.interfaces.mapper.SysMetaDatasourceMapper;
-import com.ruoyi.interfaces.service.ISysMetaDatasourceService;
-import com.ruoyi.interfaces.service.PtServiceService;
+import com.ruoyi.interfaces.domain.*;
+import com.ruoyi.interfaces.domain.job.JobTaskBatch;
+import com.ruoyi.interfaces.domain.vo.JobTaskVo;
+import com.ruoyi.interfaces.mapper.*;
 import com.ruoyi.interfaces.service.impl.MdModelInfoServiceImpl;
 import com.ruoyi.system.mapper.SysDeptMapper;
 import com.ruoyi.system.mapper.SysRoleMapper;
@@ -27,8 +19,9 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.io.IOException;
-import java.nio.charset.StandardCharsets;
+import java.util.Date;
 import java.util.List;
+import java.util.Random;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
@@ -54,13 +47,72 @@ public class JasyptTest {
     @Autowired
     private SysRoleMapper roleMapper;
 
+    @Autowired
+    private PtServiceLogMapper serviceLogMapper;
+
+    @Autowired
+    private SnailJobMapper snailJobMapper;
+
 
     @Test
     public void test() throws IOException {
-        String s = SecurityUtils.encryptPassword( "Gw#$1601");
+        Random random = new Random();
+
+
+        List<JobTaskBatch> jobTaskVos = snailJobMapper.selectJobTaskBatch();
+        Long dayLong = DateUtils.DAY_LONG;
+        Date stateDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, "2025-10-15");
+
+
+        for (long i = stateDate.getTime(); i < DateUtils.getNowDate().getTime(); i += dayLong) {
+            List<Job> jobs = snailJobMapper.selectJobList(new Job());
+
+            for (int j = 0; j < 100; j++) {
+                JobTaskBatch jobTaskVo = jobTaskVos.get(random.nextInt(jobTaskVos.size() - 1));
+                Job job = jobs.get(random.nextInt(jobs.size() - 1));
+
+                jobTaskVo.setJobId(job.getId());
+                jobTaskVo.setTaskBatchStatus(3);
+                jobTaskVo.setCreateDt(new Date(i + random.nextInt(Integer.parseInt(dayLong + ""))));
+                jobTaskVo.setExecutionAt(jobTaskVo.getCreateDt().getTime()+random.nextInt(500000)+50000);
+                jobTaskVo.setUpdateDt(new Date(jobTaskVo.getExecutionAt()+random.nextInt(500000)+50000));
+                //System.out.println(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,serviceLog.getTm()));
+                snailJobMapper.insertJobTaskBatch(jobTaskVo);
+            }
+        }
+
+       /* List<PtService> ptServices = ptServiceMapper.selectAll(new PtService());
+
+
+        Long dayLong = DateUtils.DAY_LONG;
+
+        Date stateDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, "2025-10-15");
+        for (long i = stateDate.getTime(); i < DateUtils.getNowDate().getTime(); i += dayLong) {
+            List<PtServiceLog> serviceLogs = serviceLogMapper.selectDbmsRandom();
+            for (int j = 0; j < 300; j++) {
+                PtService ptService = ptServices.get(random.nextInt(ptServices.size() - 1));
+                PtServiceLog serviceLog = serviceLogs.get(random.nextInt(199));
+                serviceLog.setSerId(serviceLog.getSerId());
+                serviceLog.setMdId(serviceLog.getMdId());
+                serviceLog.setUrl(ptService.getUrl());
+                serviceLog.setTm(new Date(i + random.nextInt(Integer.parseInt(dayLong + ""))));
+                //System.out.println(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,serviceLog.getTm()));
+                serviceLog.setLogId(null);
+                serviceLogMapper.insertPtServiceLog(serviceLog);
+            }
+        }*/
+
+
+
+
+
+
+
+
+/*        String s = SecurityUtils.encryptPassword( "Gw#$1601");
         System.out.println(s);
         boolean b = SecurityUtils.matchesPassword( "Gw#$1601", s);
-        System.out.println(b);
+        System.out.println(b);*/
 
 /*
         List<MdModelInfo> mdModelInfos = modelMapper.selectMdModelInfoList(new MdModelInfo());
@@ -137,9 +189,6 @@ public class JasyptTest {
         });*/
 
 
-
-
-
         //System.out.println(sm4Util.encrypt("Gw#$1601"));
 /*
 

+ 0 - 12
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/PtServiceLog.java

@@ -126,16 +126,4 @@ public class PtServiceLog extends BaseEntity {
     public PtServiceLog() {
     }
 
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                .append("logId", getLogId())
-                .append("serId", getSerId())
-                .append("mdId", getMdId())
-                .append("tm", getTm())
-                .append("senText", getSenText())
-                .append("returnText", getReturnText())
-                .append("execTm", getExecTm())
-                .toString();
-    }
 }

+ 74 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/job/JobTaskBatch.java

@@ -0,0 +1,74 @@
+package com.ruoyi.interfaces.domain.job;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class JobTaskBatch {
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 命名空间id
+     */
+    private String namespaceId;
+
+
+    /**
+     * 组名称
+     */
+    private String groupName;
+
+    /**
+     * 任务信息id
+     */
+    private Long jobId;
+
+    /**
+     * 工作流批次id
+     */
+    private Long workflowTaskBatchId;
+
+    /**
+     * 工作流节点id
+     */
+    private Long workflowNodeId;
+
+    /**
+     * 工作流父节点id
+     */
+    private Long parentWorkflowNodeId;
+
+    /**
+     * 任务批次状态
+     */
+    private Integer taskBatchStatus;
+
+    /**
+     * 任务执行时间
+     */
+    private Long executionAt;
+
+    /**
+     * 任务类型 3、JOB任务 4、WORKFLOW任务
+     */
+    private Integer systemTaskType;
+
+
+    /**
+     * 操作原因
+     */
+    private Integer operationReason;
+
+    /**
+     * 逻辑删除 1、删除
+     */
+    private Integer deleted;
+
+    private Date createDt;
+    private Date updateDt;
+}

+ 4 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/domain/vo/JobTaskVo.java

@@ -12,6 +12,10 @@ public class JobTaskVo {
 
     private Long id;
 
+    /**
+     * 空间id
+     */
+    private String namespaceId;
     /**
      * 组名称
      */

+ 3 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/PtServiceLogMapper.java

@@ -76,4 +76,7 @@ public interface PtServiceLogMapper
     List<PtServiceLogStatisVo> selectServiceLogStatis(PtServiceLogStatis serviceLogStatis);
 
     Long count();
+
+    List<PtServiceLog> selectDbmsRandom();
+
 }

+ 2 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/PtServiceMonitorMapper.java

@@ -3,6 +3,8 @@ package com.ruoyi.interfaces.mapper;
 import java.util.List;
 import java.util.Map;
 
+
+
 public interface PtServiceMonitorMapper {
 
     List<Map<String, Object>> viewNumByCity();

+ 7 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/SnailJobMapper.java

@@ -4,7 +4,9 @@ import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.interfaces.domain.Job;
 import com.ruoyi.interfaces.domain.JobLogVo;
+import com.ruoyi.interfaces.domain.job.JobTaskBatch;
 import com.ruoyi.interfaces.domain.vo.JobRequestVo;
+import com.ruoyi.interfaces.domain.vo.JobTaskVo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -17,4 +19,9 @@ public interface SnailJobMapper {
     List<JobLogVo> listOfJobLog(JobRequestVo jobRequestVo);
 
     Long listOfJobLogCount(JobRequestVo jobRequestVo);
+
+    List<JobTaskBatch> selectJobTaskBatch();
+
+    int insertJobTaskBatch(JobTaskBatch taskVo);
+
 }

+ 25 - 6
ruoyi-api-patform/src/main/resources/mapper/interfaces/PtServiceLogMapper.xml

@@ -80,12 +80,20 @@
             keyProperty="logId">
         insert into pt_service_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="serId != null">ser_id,</if>
-            <if test="mdId != null">md_id,</if>
-            <if test="tm != null">tm,</if>
-            <if test="senText != null">sen_text,</if>
-            <if test="returnText != null">return_text,</if>
-            <if test="execTm != null">exec_tm,</if>
+            <if test="serId != null">SER_ID,</if>
+            <if test="mdId != null">MD_ID,</if>
+            <if test="tm != null">TM,</if>
+            <if test="senText != null">SEN_TEXT,</if>
+            <if test="returnText != null">RETURN_TEXT,</if>
+            <if test="execTm != null">EXEC_TM,</if>
+            <if test="statusCode != null">STATUS_CODE,</if>
+            <if test="clientIp != null">CLIENT_IP,</if>
+            <if test="userId != null">USER_ID,</if>
+            <if test="geoCity != null">GEO_CITY,</if>
+            <if test="serviceName != null">SERVICE_NAME,</if>
+            <if test="url != null">URL,</if>
+            <if test="appId != null">APP_ID,</if>
+            <if test="appName != null">APP_NAME,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="serId != null">#{serId},</if>
@@ -94,6 +102,14 @@
             <if test="senText != null">#{senText},</if>
             <if test="returnText != null">#{returnText},</if>
             <if test="execTm != null">#{execTm},</if>
+            <if test="statusCode != null">#{statusCode},</if>
+            <if test="clientIp != null">#{clientIp},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="geoCity != null">#{geoCity},</if>
+            <if test="serviceName != null">#{serviceName},</if>
+            <if test="url != null">#{url},</if>
+            <if test="appId != null">#{appId},</if>
+            <if test="appName != null">#{appName},</if>
         </trim>
     </insert>
 
@@ -113,6 +129,9 @@
         select count(log_id)
         from pt_service_log
     </select>
+    <select id="selectDbmsRandom" resultType="com.ruoyi.interfaces.domain.PtServiceLog">
+        SELECT * FROM (SELECT * FROM PT_SERVICE_LOG ORDER BY DBMS_RANDOM.VALUE) WHERE ROWNUM &lt;= 200
+    </select>
 
     <delete id="deletePtServiceLogByLogId" parameterType="Long">
         delete

+ 39 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/SnailJobMapper.xml

@@ -63,6 +63,40 @@
                deleted
         from SNAIL_JOB.SJ_JOB
     </sql>
+    <insert id="insertJobTaskBatch">
+        insert into SJ_JOB_TASK_BATCH
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="namespaceId != null">NAMESPACE_ID,</if>
+            <if test="groupName != null">GROUP_NAME,</if>
+            <if test="jobId != null">JOB_ID,</if>
+            <if test="workflowNodeId != null">WORKFLOW_NODE_ID,</if>
+            <if test="parentWorkflowNodeId != null">PARENT_WORKFLOW_NODE_ID,</if>
+            <if test="workflowTaskBatchId != null">WORKFLOW_TASK_BATCH_ID,</if>
+            <if test="taskBatchStatus != null">TASK_BATCH_STATUS,</if>
+            <if test="operationReason != null">OPERATION_REASON,</if>
+            <if test="executionAt != null">EXECUTION_AT,</if>
+            <if test="systemTaskType != null">SYSTEM_TASK_TYPE,</if>
+            <if test="deleted != null">DELETED,</if>
+            <if test="createDt != null">CREATE_DT,</if>
+            <if test="updateDt != null">UPDATE_DT,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="namespaceId != null">#{namespaceId},</if>
+            <if test="groupName != null">#{groupName},</if>
+            <if test="jobId != null">#{jobId},</if>
+            <if test="workflowNodeId != null">#{workflowNodeId},</if>
+            <if test="parentWorkflowNodeId != null">#{parentWorkflowNodeId},</if>
+            <if test="workflowTaskBatchId != null">#{workflowTaskBatchId},</if>
+            <if test="taskBatchStatus != null">#{taskBatchStatus},</if>
+            <if test="operationReason != null">#{operationReason},</if>
+            <if test="executionAt != null">#{executionAt},</if>
+            <if test="systemTaskType != null">#{systemTaskType},</if>
+            <if test="deleted != null">#{deleted},</if>
+            <if test="createDt != null">#{createDt},</if>
+            <if test="updateDt != null">#{updateDt},</if>
+        </trim>
+    </insert>
+
     <select id="selectJobList" resultType="com.ruoyi.interfaces.domain.Job">
         <include refid="selectJobVo"></include>
         <where>
@@ -113,4 +147,9 @@
             </if>
         </where>
     </select>
+    <select id="selectJobTaskBatch" resultType="com.ruoyi.interfaces.domain.job.JobTaskBatch">
+        SELECT *
+        FROM (SELECT * FROM SJ_JOB_TASK_BATCH ORDER BY DBMS_RANDOM.VALUE)
+        WHERE ROWNUM &lt;= 200
+    </select>
 </mapper>

+ 11 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -19,7 +19,13 @@ import java.util.List;
  * @author ruoyi
  */
 public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
+    /**
+     * 毫秒
+     */
     static final long C0 = 1L;
+    /**
+     * 秒
+     */
     static final long C1 = C0 * 1000L;
     static final long C2 = C1 * 1000L;
     static final long C3 = C2 * 1000L;
@@ -27,6 +33,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     static final long C5 = C4 * 60L;
     static final long C6 = C5 * 24L;
 
+
+    public static Long HOUR_LONG = 1000l * 60 * 60;
+    public static Long DAY_LONG = 1000l * 60 * 60 * 24;
+
+
     public static String YYYY = "yyyy";
 
     public static String YYYY_MM = "yyyy-MM";