Browse Source

修复sonarqube异味

lyq 1 year ago
parent
commit
1400051ea8

+ 2 - 1
src/main/java/com/sooka/sponest/event/centereventtdutysystem/controller/CentereventTDutySystemController.java

@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -147,7 +148,7 @@ public class CentereventTDutySystemController extends BaseController {
             // 提取电话号
             Set<String> phones = dutySystems.stream().map(CentereventTDutySystem::getTelphone).collect(Collectors.toSet());
             // 提取userId
-            Set<Long> userIds = dutySystems.stream().filter(userId -> null != userId).map(CentereventTDutySystem::getUserId).collect(Collectors.toSet());
+            Set<Long> userIds = dutySystems.stream().filter(Objects::nonNull).map(CentereventTDutySystem::getUserId).collect(Collectors.toSet());
             // 推送
             RemoteApiUtil.getInstance().sendMessageAndJg(phones, userIds, message, centereventTDutySystemVo.getEventCode(), centereventTDutySystemVo.getEventName());
         }

+ 0 - 29
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/AlarmEventController.java

@@ -135,35 +135,6 @@ public class AlarmEventController {
         return R.ok();
     }
 
-
-//    /**
-//     * 签收后图片异常补救接口
-//     *
-//     * @param busId  centerevent_t_log表id
-//     * @param path   centerevent_t_log表log_content[attachPath]
-//     * @param source PC/APP
-//     * @param url    url大华DH_1 + centerevent_t_log表log_content[fileName]?token=
-//     *               url大华DH_2 + centerevent_t_log表log_content[fileName]
-//     * @return
-//     */
-//    @GetMapping("/upload")
-//    public R upload(String busId, String path, String source, String url) {
-//        try {
-//            MultipartFile multipartFile = FilePrefixUtils.urlToMultipartFile(url, System.currentTimeMillis() + ".jpg");
-//            SysFile sysFile = eventRemoteService.upload(multipartFile).getData();
-//            CenterdataTAttach centerdataTAttach = new CenterdataTAttach();
-//            centerdataTAttach.setBusId(busId);
-//            centerdataTAttach.setFileName(path);
-//            centerdataTAttach.setAttachPath(sysFile.getUrl());
-//            centerdataTAttach.setBusSource(source);
-//            eventRemoteService.updateEventAttacHandle(centerdataTAttach);
-//            return R.ok();
-//        } catch (Exception e) {
-//            logger.error(e.getMessage());
-//        }
-//        return R.fail();
-//    }
-
     @PostMapping("/insertEventByReport")
     public R insertEventByReport(String start, String end, String source) {
         if (StringUtils.isBlank(start) || StringUtils.isBlank(end)) {

+ 1 - 25
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/CentereventTDownloadsController.java

@@ -39,30 +39,6 @@ public class CentereventTDownloadsController extends BaseController {
     @Autowired
     private ICentereventTEventcatalogueService centereventTEventcatalogueService;
 
-//    @Autowired
-//    private RemoteMessageService remoteMessageService;
-//
-//    @PostMapping("/testMessage")
-//    public AjaxResult testMessage() throws Exception {
-//        MessageVo vo=new MessageVo();
-//        vo.setType("1");
-//        vo.setEventCode("testcode");
-//        vo.setEventName("test名称");
-//        vo.setPhones(new String[]{"13756659676"});
-//        vo.setContent(new String []{"2023年8月10日 16:15:48 测试短信平台,请联系:演示,联系电话:18843065853"});
-////        vo.setSignName("态势感知平台网");
-//        remoteMessageService.sendTxMessage(vo);
-//        System.out.println("==============>");
-//        MessageVo vo1=new MessageVo();
-//        vo1.setType("2");
-//        vo1.setEventCode("testcode");
-//        vo1.setEventName("test名称");
-//        vo1.setPhones(new String[]{"13756659676"});
-//        vo1.setContent(new String []{"四平市伊通县河源镇后倒木屯东北茨牙水库2023-07-27 06:28:21钓鱼检测","/j/961"});
-//        remoteMessageService.sendTxMessage(vo1);
-//        return AjaxResult.success();
-//    }
-
     /**
      * 查询【请填写功能名称】列表
      */
@@ -83,7 +59,7 @@ public class CentereventTDownloadsController extends BaseController {
     }
 
     @PostMapping("/downloadsMonth")
-    public AjaxResult downloadsMonth(@RequestBody Map<String, Object> params) throws Exception {
+    public AjaxResult downloadsMonth(@RequestBody Map<String, Object> params) {
         Map<String, Object> param = new HashMap<>();
         param.put("monthValueStart", MapUtils.getString(params, "monthValueStart"));
         param.put("monthValueEnd", MapUtils.getString(params, "monthValueEnd"));

+ 1 - 7
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/CentereventTEventcatalogueController.java

@@ -39,8 +39,6 @@ import com.sooka.sponest.monitor.api.domain.CenterdataTAidevicedept;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -78,10 +76,6 @@ public class CentereventTEventcatalogueController extends BaseController {
     @Autowired
     private ICentereventTDownloadsService centereventTDownloadsService;
 
-    @Autowired
-    @Qualifier("asyncTaskExecutor")
-    private ThreadPoolTaskExecutor asyncTaskExecutor;
-
     /**
      * 查询事件目录列表
      */
@@ -299,7 +293,7 @@ public class CentereventTEventcatalogueController extends BaseController {
                     paramMap.put("busId", log.getId());
                     paramMap.put("token", RemoteApiUtil.getInstance().getToken());// 大华token
                     remoteDataService.updateAttach(paramMap);
-                }/*, asyncTaskExecutor*/);
+                });
                 future.get();
             }
         } catch (Exception e) {

+ 1 - 1
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/ICentereventTEventcatalogueService.java

@@ -86,5 +86,5 @@ public interface ICentereventTEventcatalogueService {
 
     CentereventTEventcatalogue mqtest(String start, String end, int limit);
 
-    void downloadsCommon(Map<String, Object> params) throws InterruptedException;
+    void downloadsCommon(Map<String, Object> params);
 }

+ 7 - 2
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/CentereventTEventcatalogueServiceImpl.java

@@ -685,7 +685,7 @@ public class CentereventTEventcatalogueServiceImpl extends BaseService implement
     }
 
     @Override
-    public void downloadsCommon(Map<String, Object> params) throws InterruptedException {
+    public void downloadsCommon(Map<String, Object> params) {
         List<CentereventTEventcatalogue> eventcatalogues = centereventTEventcatalogueMapper.getbeforedateDownload(params);
         for (CentereventTEventcatalogue eventcatalogue : eventcatalogues) {
             String busIndex = "bus_indx_other";// 其他
@@ -714,7 +714,12 @@ public class CentereventTEventcatalogueServiceImpl extends BaseService implement
                 centereventTDownloadsService.insertCentereventTDownloads(centereventTDownloads);
 //                TimeUnit.MINUTES.sleep(5);//延时5分钟在调取
                 logger.info("定时任务等待下载=====>{}", DateUtils.dateTimeNow());
-                Thread.sleep(300000);
+                try {
+                    Thread.sleep(300000);
+                } catch (InterruptedException e) {
+                    logger.error(e.getMessage());
+                    Thread.currentThread().interrupt();
+                }
             } else {
                 //失败
                 CentereventTDownloads centereventTDownloads = new CentereventTDownloads();

+ 1 - 1
src/main/java/com/sooka/sponest/event/centereventteventtypemapdept/controller/CentereventTEventtypemapdeptController.java

@@ -35,7 +35,7 @@ public class CentereventTEventtypemapdeptController extends BaseController {
     @Autowired
     private ICentereventTEventtypemapdeptService centereventTEventtypemapdeptService;
 
-    private final static Map<Long, String> deptTypeMap = new HashMap();
+    private static final Map<Long, String> deptTypeMap = new HashMap();
 
     static {
         deptTypeMap.put(367L, "sys_dept_type_16");// 市林业局

+ 0 - 35
src/main/java/com/sooka/sponest/event/config/AsyncTaskExecutorConfig.java

@@ -1,35 +0,0 @@
-package com.sooka.sponest.event.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-import java.util.concurrent.ThreadPoolExecutor;
-
-@Configuration
-public class AsyncTaskExecutorConfig {
-
-    // 阻塞队列
-    private static final int workQueue = 20;
-    // 线程空闲后的存活时长
-    private static final int keepAliveTime = 30;
-    // Cpu核数
-    private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
-    // 核心线程数量大小
-    private static final int corePoolSize = Math.max(2, Math.min(CPU_COUNT - 1, 4));
-    // 线程池最大容纳线程数
-    private static final int maxPoolSize = CPU_COUNT * 2 + 1;
-
-    @Bean("asyncTaskExecutor")
-    public ThreadPoolTaskExecutor asyncTaskExecutor() {
-        ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
-        threadPoolTaskExecutor.setThreadNamePrefix("asyncTaskExecutor-");//线程前缀
-        threadPoolTaskExecutor.setCorePoolSize(corePoolSize);//核心线程数
-        threadPoolTaskExecutor.setMaxPoolSize(maxPoolSize);//最大线程数
-        threadPoolTaskExecutor.setQueueCapacity(workQueue);//等待队列
-        threadPoolTaskExecutor.setKeepAliveSeconds(keepAliveTime);//线程池维护线程所允许的空闲时间,单位为秒
-        threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());// 线程池对拒绝任务(无线程可用)的处理策略
-        threadPoolTaskExecutor.initialize();
-        return threadPoolTaskExecutor;
-    }
-}

+ 38 - 50
src/main/java/com/sooka/sponest/event/emergency/inspectionrecord/service/impl/CentereventTEmergencyInspectionrecordServiceImpl.java

@@ -2,6 +2,7 @@ package com.sooka.sponest.event.emergency.inspectionrecord.service.impl;
 
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.datascope.annotation.DataScopeMutiDept;
 import com.ruoyi.common.datascope.base.service.BaseService;
@@ -33,6 +34,7 @@ import java.util.List;
  */
 @Service
 public class CentereventTEmergencyInspectionrecordServiceImpl extends BaseService implements ICentereventTEmergencyInspectionrecordService {
+
     @Autowired
     private CentereventTEmergencyInspectionrecordMapper centereventTEmergencyInspectionrecordMapper;
     @Autowired
@@ -110,49 +112,43 @@ public class CentereventTEmergencyInspectionrecordServiceImpl extends BaseServic
 
     @Override
     public CentereventTEmergencyInspectionrecord insertCentereventTEmergencyInspectionrecordMessage(List<CentereventTEmergencyInspectionrecordBdody> centereventTEmergencyInspectionrecordBdodyList) {
-
-        if (0 != centereventTEmergencyInspectionrecordBdodyList.size()) {
-            CentereventTEmergencyInspectionrecord centereventTEmergencyInspectionrecord = new CentereventTEmergencyInspectionrecord();
-            BeanUtils.copyProperties(centereventTEmergencyInspectionrecordBdodyList.get(0), centereventTEmergencyInspectionrecord);
-            centereventTEmergencyInspectionrecord.setCreateTime(DateUtils.getNowDate());
-            centereventTEmergencyInspectionrecord.setId(IdUtils.fastUUID());
-            centereventTEmergencyInspectionrecordBdodyList.forEach(centereventTEmergencyInspectionrecordBdody -> {
-                CentereventTEmergencyInspectionrecorddetail centereventTEmergencyInspectionrecorddetail = new CentereventTEmergencyInspectionrecorddetail();
-                centereventTEmergencyInspectionrecorddetail.setInspectionitemId(centereventTEmergencyInspectionrecordBdody.getId());
-                centereventTEmergencyInspectionrecorddetail.setInspectionitemName(centereventTEmergencyInspectionrecordBdody.getItemName());
-                centereventTEmergencyInspectionrecorddetail.setCreateTime(DateUtils.getNowDate());
-                centereventTEmergencyInspectionrecorddetail.setInspectionitemDesc(centereventTEmergencyInspectionrecordBdody.getContent());
-                centereventTEmergencyInspectionrecorddetail.setInspectionrecordId(centereventTEmergencyInspectionrecord.getId());
-                centereventTEmergencyInspectionrecorddetail.setCreateBy(centereventTEmergencyInspectionrecordBdody.getUserId());
-                centereventTEmergencyInspectionrecorddetail.setInspectionResult(String.valueOf((centereventTEmergencyInspectionrecordBdody.isInspectionitemCheck() ? 1 : 0)));
-                centereventTEmergencyInspectionrecorddetail.setId(IdUtils.fastUUID());
-                if (null != centereventTEmergencyInspectionrecordBdody.getAttachs()) {
-                    centereventTEmergencyInspectionrecordBdody.getAttachs().forEach(attachBean -> {
-                        CenterdataTAttach centerdataTAttach = new CenterdataTAttach();
-                        centerdataTAttach.setAttachPath(attachBean.getWebUrl());
-                        centerdataTAttach.setBusSource("APP");
-                        centerdataTAttach.setFileName(attachBean.getUrl());
-                        centerdataTAttach.setBusId(centereventTEmergencyInspectionrecorddetail.getId());
-                        remoteDataService.insertAttach(centerdataTAttach);
-
-                    });
-                    centereventTEmergencyInspectionrecorddetail.setDataStatus("1");
-                }
-                centereventTEmergencyInspectionrecorddetailMapper.insertCentereventTEmergencyInspectionrecorddetail(centereventTEmergencyInspectionrecorddetail);
-            });
-//      centereventTEmergencyInspectionrecord.setIsHavedanger(String.valueOf(num));
-            centereventTEmergencyInspectionrecord.setUserId(Long.parseLong(centereventTEmergencyInspectionrecordBdodyList.get(0).getUserId()));
-            centereventTEmergencyInspectionrecord.setUserName(centereventTEmergencyInspectionrecord.getUserName());
-            centereventTEmergencyInspectionrecord.setInspectionTime(DateUtils.getNowDate());
-            centereventTEmergencyInspectionrecord.setDataStatus("1");
-            centereventTEmergencyInspectionrecord.setEnterpriseId(centereventTEmergencyInspectionrecordBdodyList.get(0).getEnterpriseId());
-            centereventTEmergencyInspectionrecordMapper.insertCentereventTEmergencyInspectionrecord(centereventTEmergencyInspectionrecord);
-            return centereventTEmergencyInspectionrecord;
-        } else {
+        if (StringUtils.isEmpty(centereventTEmergencyInspectionrecordBdodyList)) {
             return new CentereventTEmergencyInspectionrecord();
         }
-
-
+        CentereventTEmergencyInspectionrecord centereventTEmergencyInspectionrecord = new CentereventTEmergencyInspectionrecord();
+        BeanUtils.copyProperties(centereventTEmergencyInspectionrecordBdodyList.get(0), centereventTEmergencyInspectionrecord);
+        centereventTEmergencyInspectionrecord.setCreateTime(DateUtils.getNowDate());
+        centereventTEmergencyInspectionrecord.setId(IdUtils.fastUUID());
+        centereventTEmergencyInspectionrecordBdodyList.forEach(centereventTEmergencyInspectionrecordBdody -> {
+            CentereventTEmergencyInspectionrecorddetail centereventTEmergencyInspectionrecorddetail = new CentereventTEmergencyInspectionrecorddetail();
+            centereventTEmergencyInspectionrecorddetail.setInspectionitemId(centereventTEmergencyInspectionrecordBdody.getId());
+            centereventTEmergencyInspectionrecorddetail.setInspectionitemName(centereventTEmergencyInspectionrecordBdody.getItemName());
+            centereventTEmergencyInspectionrecorddetail.setCreateTime(DateUtils.getNowDate());
+            centereventTEmergencyInspectionrecorddetail.setInspectionitemDesc(centereventTEmergencyInspectionrecordBdody.getContent());
+            centereventTEmergencyInspectionrecorddetail.setInspectionrecordId(centereventTEmergencyInspectionrecord.getId());
+            centereventTEmergencyInspectionrecorddetail.setCreateBy(centereventTEmergencyInspectionrecordBdody.getUserId());
+            centereventTEmergencyInspectionrecorddetail.setInspectionResult(String.valueOf((centereventTEmergencyInspectionrecordBdody.isInspectionitemCheck() ? 1 : 0)));
+            centereventTEmergencyInspectionrecorddetail.setId(IdUtils.fastUUID());
+            if (null != centereventTEmergencyInspectionrecordBdody.getAttachs()) {
+                centereventTEmergencyInspectionrecordBdody.getAttachs().forEach(attachBean -> {
+                    CenterdataTAttach centerdataTAttach = new CenterdataTAttach();
+                    centerdataTAttach.setAttachPath(attachBean.getWebUrl());
+                    centerdataTAttach.setBusSource("APP");
+                    centerdataTAttach.setFileName(attachBean.getUrl());
+                    centerdataTAttach.setBusId(centereventTEmergencyInspectionrecorddetail.getId());
+                    remoteDataService.insertAttach(centerdataTAttach);
+                });
+                centereventTEmergencyInspectionrecorddetail.setDataStatus("1");
+            }
+            centereventTEmergencyInspectionrecorddetailMapper.insertCentereventTEmergencyInspectionrecorddetail(centereventTEmergencyInspectionrecorddetail);
+        });
+        centereventTEmergencyInspectionrecord.setUserId(Long.parseLong(centereventTEmergencyInspectionrecordBdodyList.get(0).getUserId()));
+        centereventTEmergencyInspectionrecord.setUserName(centereventTEmergencyInspectionrecord.getUserName());
+        centereventTEmergencyInspectionrecord.setInspectionTime(DateUtils.getNowDate());
+        centereventTEmergencyInspectionrecord.setDataStatus("1");
+        centereventTEmergencyInspectionrecord.setEnterpriseId(centereventTEmergencyInspectionrecordBdodyList.get(0).getEnterpriseId());
+        centereventTEmergencyInspectionrecordMapper.insertCentereventTEmergencyInspectionrecord(centereventTEmergencyInspectionrecord);
+        return centereventTEmergencyInspectionrecord;
     }
 
     @Override
@@ -198,7 +194,6 @@ public class CentereventTEmergencyInspectionrecordServiceImpl extends BaseServic
                         }
                     }
                 }
-
                 centereventTEmergencyInspectionrecordBdodyList.add(centereventTEmergencyInspectionrecordBdody);
             });
         }
@@ -207,23 +202,17 @@ public class CentereventTEmergencyInspectionrecordServiceImpl extends BaseServic
 
     @Override
     public List<CentereventTEmergencyInspectionrecordBdody> selectCentereventTEmergencyInspectionrecordMessageList2(EmergencyInspectionrecordSelectBody emergencyInspectionrecordSelectBody) {
-
         setSookaDataBase(emergencyInspectionrecordSelectBody);
-
         List<CentereventTEmergencyInspectionrecordBdody> centereventTEmergencyInspectionrecordBdodyList = centereventTEmergencyInspectionrecordMapper.selectCentereventTEmergencyInspectionrecordMessageList(emergencyInspectionrecordSelectBody);
         centereventTEmergencyInspectionrecordBdodyList.forEach(centereventTEmergencyInspectionrecordBdody -> {
-
             R<List<CenterdataTAttach>> r = remoteDataService.urlAttch(centereventTEmergencyInspectionrecordBdody.getId());
-
             r.getData().forEach(centerdataTAttach -> {
                 AttachBean attachBean = new AttachBean();
                 attachBean.setWebUrl(centerdataTAttach.getAttachPath());
                 attachBean.setUrl(centerdataTAttach.getFileName());
                 centereventTEmergencyInspectionrecordBdody.getAttachs().add(attachBean);
             });
-
         });
-
         return centereventTEmergencyInspectionrecordBdodyList;
     }
 
@@ -232,7 +221,6 @@ public class CentereventTEmergencyInspectionrecordServiceImpl extends BaseServic
     public List selectEmergencyList(EmergencyInspectionrecordSelectBody emergencyInspectionrecordSelectBody) {
         emergencyInspectionrecordSelectBody.setId(SecurityUtils.getLoginUser().getSysUser().getDeptId().toString());
         setSookaDataBase(emergencyInspectionrecordSelectBody);
-        List list = centereventTEmergencyInspectionrecordMapper.selectEmergencyList(emergencyInspectionrecordSelectBody);
-        return list;
+        return centereventTEmergencyInspectionrecordMapper.selectEmergencyList(emergencyInspectionrecordSelectBody);
     }
 }

+ 111 - 111
src/main/java/com/sooka/sponest/event/test/ScheduleTask.java

@@ -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);
+//        }
+//    }
+//}

+ 1 - 8
src/main/java/com/sooka/sponest/event/urge/service/impl/EventDownServiceImpl.java

@@ -9,8 +9,6 @@ import org.apache.commons.collections4.MapUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.ApplicationArguments;
-import org.springframework.boot.ApplicationRunner;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.stereotype.Service;
 
@@ -25,7 +23,7 @@ import java.util.Observable;
  */
 @Service
 @EnableAsync
-public class EventDownServiceImpl implements EventDownService, ApplicationRunner {
+public class EventDownServiceImpl implements EventDownService {
 
     private final Logger logger = LoggerFactory.getLogger(EventDownServiceImpl.class);
 
@@ -33,11 +31,6 @@ public class EventDownServiceImpl implements EventDownService, ApplicationRunner
     private ICentereventTDownloadsService centereventTDownloadsService;
 
     @Override
-    public void run(ApplicationArguments args) throws Exception {
-
-    }
-
-    @Override
     public void toVoidDownLoad(Map<String, Object> maps) {
         logger.info("===========================>");
         try {