|
@@ -1,112 +1,112 @@
|
|
|
package com.sooka.sponest.event.test;
|
|
|
-//
|
|
|
-//import com.ruoyi.common.core.utils.DateUtils;
|
|
|
-//import com.ruoyi.common.core.utils.SpringUtils;
|
|
|
-//import com.ruoyi.common.core.utils.StringUtils;
|
|
|
-//import com.ruoyi.common.core.utils.uuid.IdUtils;
|
|
|
-//import com.ruoyi.common.redis.service.RedisService;
|
|
|
-//import com.sooka.sponest.event.centereventtdeptevent.domain.CentereventDeptEvent;
|
|
|
-//import com.sooka.sponest.event.centereventtdeptevent.service.ICentereventDeptEventService;
|
|
|
-//import com.sooka.sponest.event.centereventteventcatalogue.domain.CentereventTEventcatalogue;
|
|
|
-//import com.sooka.sponest.event.centereventteventcatalogue.service.ICentereventTEventcatalogueService;
|
|
|
-//import org.slf4j.Logger;
|
|
|
-//import org.slf4j.LoggerFactory;
|
|
|
-//import org.springframework.beans.BeanUtils;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.context.annotation.Configuration;
|
|
|
-//import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
-//
|
|
|
-//import java.security.SecureRandom;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @author lyq
|
|
|
-// * @date 2023年7月22日
|
|
|
-// */
|
|
|
-//@Configuration
|
|
|
-//@EnableScheduling
|
|
|
-//public class ScheduleTask {
|
|
|
-//
|
|
|
-// private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private ICentereventTEventcatalogueService centereventTEventcatalogueService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private ICentereventDeptEventService centereventDeptEventService;
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 定时任务 MQ-ES数据同步测试
|
|
|
-// */
|
|
|
-//// @Scheduled(fixedRate = 200)
|
|
|
-// private void mqtest() {
|
|
|
-// // 读取缓存
|
|
|
-// RedisService redis = SpringUtils.getBean(RedisService.class);
|
|
|
-// String mark = redis.getCacheObject("testmq:mark");
|
|
|
-// if (StringUtils.isBlank(mark)) {
|
|
|
-// mark = "mark";
|
|
|
-// redis.setCacheObject("testmq:mark", mark);
|
|
|
-// redis.setCacheObject("testmq:insert", 0);
|
|
|
-// redis.setCacheObject("testmq:update", 0);
|
|
|
-// redis.setCacheObject("testmq:max", 300);
|
|
|
-// }
|
|
|
-// Integer insertNo = redis.getCacheObject("testmq:insert");
|
|
|
-// Integer updateNo = redis.getCacheObject("testmq:update");
|
|
|
-// Integer max = redis.getCacheObject("testmq:max");
|
|
|
-// if (max < (insertNo + updateNo)) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// SecureRandom random = new SecureRandom();
|
|
|
-// int month = random.nextInt(2);
|
|
|
-// int day = random.nextInt(20) + 10;
|
|
|
-// String start = "";
|
|
|
-// String end = "";
|
|
|
-// if (0 == month) {
|
|
|
-// start = String.format("2023-06-%s", day);
|
|
|
-// end = String.format("2023-06-%s", day + 1);
|
|
|
-// } else {
|
|
|
-// start = String.format("2023-07-%s", day);
|
|
|
-// end = String.format("2023-07-%s", day + 1);
|
|
|
-// }
|
|
|
-// int limit = random.nextInt(1000) + 1;
|
|
|
-// CentereventTEventcatalogue eventcatalogue = centereventTEventcatalogueService.mqtest(start, end, limit);
|
|
|
-// if (null != eventcatalogue) {
|
|
|
-// // 新增、修改权限比重
|
|
|
-// int number = random.nextInt(100) + 1;
|
|
|
-// if (51 > number) {
|
|
|
-// redis.setCacheObject("testmq:insert", ++insertNo);
|
|
|
-// String uuid = IdUtils.fastSimpleUUID();
|
|
|
-// CentereventDeptEvent deptEvent = new CentereventDeptEvent();
|
|
|
-// deptEvent.setId(uuid);
|
|
|
-// deptEvent.setEventCode(uuid);
|
|
|
-// deptEvent.setDeptId(365L);
|
|
|
-// deptEvent.setDeptName("四平市");
|
|
|
-// deptEvent.setEventStatus("上报");
|
|
|
-// deptEvent.setEventStatusValue("forest_event_status_1");
|
|
|
-// deptEvent.setDeptHandleType("dept_handleType_2");
|
|
|
-// deptEvent.setCreateBy("1");
|
|
|
-// deptEvent.setCreateName(mark + "_insert_" + insertNo);
|
|
|
-// deptEvent.setCreateTime(DateUtils.getNowDate());
|
|
|
-// centereventDeptEventService.insertCentereventTDeptEvent(deptEvent);
|
|
|
-//
|
|
|
-// CentereventTEventcatalogue eventcataloguenew = new CentereventTEventcatalogue();
|
|
|
-// BeanUtils.copyProperties(eventcatalogue, eventcataloguenew);
|
|
|
-// eventcataloguenew.setId(deptEvent.getId());
|
|
|
-// eventcataloguenew.setEventCode(deptEvent.getEventCode());
|
|
|
-// eventcataloguenew.setReportSource("reporting_source_2");
|
|
|
-// eventcataloguenew.setEventStatus(deptEvent.getEventStatus());
|
|
|
-// eventcataloguenew.setEventStatusValue(deptEvent.getEventStatusValue());
|
|
|
-// eventcataloguenew.setCreateBy(deptEvent.getCreateBy());
|
|
|
-// eventcataloguenew.setCreateName(deptEvent.getCreateName());
|
|
|
-// eventcataloguenew.setCreateTime(deptEvent.getCreateTime());
|
|
|
-// centereventTEventcatalogueService.insertCentereventTEventcatalogue(eventcataloguenew);
|
|
|
-// } else {
|
|
|
-// redis.setCacheObject("testmq:update", ++updateNo);
|
|
|
-// eventcatalogue.setUpdateBy(1L);
|
|
|
-// eventcatalogue.setUpdateName(mark + "_update_" + updateNo);
|
|
|
-// eventcatalogue.setUpdateTime(DateUtils.getNowDate());
|
|
|
-// centereventTEventcatalogueService.updateCentereventTEventcatalogue(eventcatalogue);
|
|
|
-// }
|
|
|
-// logger.info("---新增{},修改{}---", insertNo, updateNo);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//}
|
|
|
+
|
|
|
+/*import com.ruoyi.common.core.utils.DateUtils;
|
|
|
+import com.ruoyi.common.core.utils.SpringUtils;
|
|
|
+import com.ruoyi.common.core.utils.StringUtils;
|
|
|
+import com.ruoyi.common.core.utils.uuid.IdUtils;
|
|
|
+import com.ruoyi.common.redis.service.RedisService;
|
|
|
+import com.sooka.sponest.event.centereventtdeptevent.domain.CentereventDeptEvent;
|
|
|
+import com.sooka.sponest.event.centereventtdeptevent.service.ICentereventDeptEventService;
|
|
|
+import com.sooka.sponest.event.centereventteventcatalogue.domain.CentereventTEventcatalogue;
|
|
|
+import com.sooka.sponest.event.centereventteventcatalogue.service.ICentereventTEventcatalogueService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;*/
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
+
|
|
|
+/*import java.security.SecureRandom;*/
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author lyq
|
|
|
+ * @date 2023年7月22日
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+@EnableScheduling
|
|
|
+public class ScheduleTask {
|
|
|
+
|
|
|
+ /*private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICentereventTEventcatalogueService centereventTEventcatalogueService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICentereventDeptEventService centereventDeptEventService;
|
|
|
+
|
|
|
+ *//**
|
|
|
+ * 定时任务 MQ-ES数据同步测试
|
|
|
+ *//*
|
|
|
+// @Scheduled(fixedRate = 200)
|
|
|
+ private void mqtest() {
|
|
|
+ // 读取缓存
|
|
|
+ RedisService redis = SpringUtils.getBean(RedisService.class);
|
|
|
+ String mark = redis.getCacheObject("testmq:mark");
|
|
|
+ if (StringUtils.isBlank(mark)) {
|
|
|
+ mark = "mark";
|
|
|
+ redis.setCacheObject("testmq:mark", mark);
|
|
|
+ redis.setCacheObject("testmq:insert", 0);
|
|
|
+ redis.setCacheObject("testmq:update", 0);
|
|
|
+ redis.setCacheObject("testmq:max", 300);
|
|
|
+ }
|
|
|
+ Integer insertNo = redis.getCacheObject("testmq:insert");
|
|
|
+ Integer updateNo = redis.getCacheObject("testmq:update");
|
|
|
+ Integer max = redis.getCacheObject("testmq:max");
|
|
|
+ if (max < (insertNo + updateNo)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SecureRandom random = new SecureRandom();
|
|
|
+ int month = random.nextInt(2);
|
|
|
+ int day = random.nextInt(20) + 10;
|
|
|
+ String start = "";
|
|
|
+ String end = "";
|
|
|
+ if (0 == month) {
|
|
|
+ start = String.format("2023-06-%s", day);
|
|
|
+ end = String.format("2023-06-%s", day + 1);
|
|
|
+ } else {
|
|
|
+ start = String.format("2023-07-%s", day);
|
|
|
+ end = String.format("2023-07-%s", day + 1);
|
|
|
+ }
|
|
|
+ int limit = random.nextInt(1000) + 1;
|
|
|
+ CentereventTEventcatalogue eventcatalogue = centereventTEventcatalogueService.mqtest(start, end, limit);
|
|
|
+ if (null != eventcatalogue) {
|
|
|
+ // 新增、修改权限比重
|
|
|
+ int number = random.nextInt(100) + 1;
|
|
|
+ if (51 > number) {
|
|
|
+ redis.setCacheObject("testmq:insert", ++insertNo);
|
|
|
+ String uuid = IdUtils.fastSimpleUUID();
|
|
|
+ CentereventDeptEvent deptEvent = new CentereventDeptEvent();
|
|
|
+ deptEvent.setId(uuid);
|
|
|
+ deptEvent.setEventCode(uuid);
|
|
|
+ deptEvent.setDeptId(365L);
|
|
|
+ deptEvent.setDeptName("四平市");
|
|
|
+ deptEvent.setEventStatus("上报");
|
|
|
+ deptEvent.setEventStatusValue("forest_event_status_1");
|
|
|
+ deptEvent.setDeptHandleType("dept_handleType_2");
|
|
|
+ deptEvent.setCreateBy("1");
|
|
|
+ deptEvent.setCreateName(mark + "_insert_" + insertNo);
|
|
|
+ deptEvent.setCreateTime(DateUtils.getNowDate());
|
|
|
+ centereventDeptEventService.insertCentereventTDeptEvent(deptEvent);
|
|
|
+
|
|
|
+ CentereventTEventcatalogue eventcataloguenew = new CentereventTEventcatalogue();
|
|
|
+ BeanUtils.copyProperties(eventcatalogue, eventcataloguenew);
|
|
|
+ eventcataloguenew.setId(deptEvent.getId());
|
|
|
+ eventcataloguenew.setEventCode(deptEvent.getEventCode());
|
|
|
+ eventcataloguenew.setReportSource("reporting_source_2");
|
|
|
+ eventcataloguenew.setEventStatus(deptEvent.getEventStatus());
|
|
|
+ eventcataloguenew.setEventStatusValue(deptEvent.getEventStatusValue());
|
|
|
+ eventcataloguenew.setCreateBy(deptEvent.getCreateBy());
|
|
|
+ eventcataloguenew.setCreateName(deptEvent.getCreateName());
|
|
|
+ eventcataloguenew.setCreateTime(deptEvent.getCreateTime());
|
|
|
+ centereventTEventcatalogueService.insertCentereventTEventcatalogue(eventcataloguenew);
|
|
|
+ } else {
|
|
|
+ redis.setCacheObject("testmq:update", ++updateNo);
|
|
|
+ eventcatalogue.setUpdateBy(1L);
|
|
|
+ eventcatalogue.setUpdateName(mark + "_update_" + updateNo);
|
|
|
+ eventcatalogue.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ centereventTEventcatalogueService.updateCentereventTEventcatalogue(eventcatalogue);
|
|
|
+ }
|
|
|
+ logger.info("---新增{},修改{}---", insertNo, updateNo);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+}
|