From 6b90c0f662cff9ae91ff14d43d1b46a28984f494 Mon Sep 17 00:00:00 2001 From: songwenxuan <1924103812@qq.com> Date: Wed, 26 Jun 2024 14:00:18 +0800 Subject: [PATCH] =?UTF-8?q?626=E7=9B=B8=E5=85=B3=E6=96=B9=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E6=95=B0=E6=8D=AE=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zcloud/aspect/DockingAspect.java | 29 +++++++++++++- src/main/java/com/zcloud/dto/TenCorpDto.java | 8 ++++ .../mq/impl/DockSendMessageServiceImpl.java | 29 +++++++++++++- .../resources/application-local.properties | 38 +++++++++++++++---- src/main/resources/application.properties | 4 +- 5 files changed, 94 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zcloud/aspect/DockingAspect.java b/src/main/java/com/zcloud/aspect/DockingAspect.java index 171a8ee9..5c520a6e 100644 --- a/src/main/java/com/zcloud/aspect/DockingAspect.java +++ b/src/main/java/com/zcloud/aspect/DockingAspect.java @@ -32,6 +32,13 @@ import java.util.Map; public class DockingAspect { @Autowired private DockSendMessageService sendMessageService; + @Value("${mq.csy.data.topic}") + private String csyDataDocking; + + @Value("${mq.cmt.data.topic}") + private String cmtDataDocking; + @Value("${mq.czks.data.topic}") + private String czksDataDocking; @Value("${baseimgpath}") public String baseimgpath; @Pointcut("@annotation(com.zcloud.aspect.DockAnnotation)") @@ -104,9 +111,27 @@ public class DockingAspect { tenCorpDto.setProducer_name("qa-prevention-czks"); // 有dockData if (Tools.notEmpty(proceed.get("dockData"))) { - sendData.put("dockData", proceed.get("dockData")); + String dockData = proceed.get("dockData"); + PageData dockDataMap = JSON.parseObject(dockData, PageData.class); + sendData.put("dockData",dockData); + // 操作企业 + if ("f8da1790b1034058ae2efefd69af3284".contains(dockDataMap.getString("operatingCorpId")) + || "016d19225e9d4ece863cce8a256a3e72".contains(dockDataMap.getString("operatingCorpId")) + || "1".equals(dockDataMap.getString("sendAllCorp")) + ){ + tenCorpDto.setTopic(czksDataDocking); + sendMessageService.sendMessage(tenCorpDto); + } + // todo先不给其他两家发送消息,上线前打开 + if ("8854edee3aa94be496cee676b6d4845a".equals(dockDataMap.getString("operatingCorpId")) || "1".equals(dockDataMap.getString("sendAllCorp"))){ + tenCorpDto.setTopic(csyDataDocking); + sendMessageService.sendMessage(tenCorpDto); + } + if ("6aa255d41602497fa0f934a822820df4".equals(dockDataMap.getString("operatingCorpId")) || "1".equals(dockDataMap.getString("sendAllCorp"))){ + tenCorpDto.setTopic(cmtDataDocking); + sendMessageService.sendMessage(tenCorpDto); + } proceed.remove("dockData"); - sendMessageService.sendMessage(tenCorpDto); } else { System.out.println("------------------------无dockData不发消息------------------------"); } diff --git a/src/main/java/com/zcloud/dto/TenCorpDto.java b/src/main/java/com/zcloud/dto/TenCorpDto.java index 011721d9..f9398c74 100644 --- a/src/main/java/com/zcloud/dto/TenCorpDto.java +++ b/src/main/java/com/zcloud/dto/TenCorpDto.java @@ -2,6 +2,7 @@ package com.zcloud.dto; import com.alibaba.fastjson.JSON; import com.zcloud.entity.PageData; +import com.zcloud.util.Warden; import lombok.Data; @Data @@ -23,6 +24,10 @@ public class TenCorpDto { // 消息体 private PageData data; + private String messageLogId; + + private String CREATE_TIME; + public TenCorpDto() { this.id = Warden.get32UUID(); } @@ -40,6 +45,9 @@ public class TenCorpDto { info.put("MARK_NAME", this.mark_name); info.put("MESSAGE", this.message); info.put("TOPIC",this.topic); + info.put("DATA", JSON.toJSONString(this.data)); + info.put("CREATE_TIME", this.CREATE_TIME); + info.put("MESSAGE_LOG_ID", this.messageLogId); return info; } } diff --git a/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java b/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java index ca474cd1..d4c56f41 100644 --- a/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java +++ b/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java @@ -26,6 +26,13 @@ public class DockSendMessageServiceImpl implements DockSendMessageService { private String gwjDataTopic; @Value("${mq.gwj.file.topic}") private String gwjFileTopic; + @Value("${mq.csy.data.topic}") + private String csyDataDocking; + + @Value("${mq.cmt.data.topic}") + private String cmtDataDocking; + @Value("${mq.czks.data.topic}") + private String czksDataDocking; @Resource private RocketMQTemplate rocketMQTemplate; @@ -40,14 +47,32 @@ public class DockSendMessageServiceImpl implements DockSendMessageService { @Override public void sendMessage(TenCorpDto tenCorpDto) throws Exception { + PageData productionPD = new PageData(); + productionPD.put("PRODUCTION_ID", Warden.get32UUID()); + productionPD.put("MESSAGE_LOG_ID", tenCorpDto.getMessageLogId() == null ? "" : tenCorpDto.getMessageLogId()); + productionPD.put("PRODUCTION_TYPE", "gwj-DockSendMessageServiceImpl.sendMessage(TenCorpDto tenCorpDto)"); + productionPD.put("PRODUCTION_TIME", DateUtil.getTime()); + productionPD.put("CREATE_TIME", tenCorpDto.getCREATE_TIME() == null ? "" : tenCorpDto.getCREATE_TIME()); + productionPD.put("MARK", tenCorpDto.getMark() == null ? "" : tenCorpDto.getMark()); + productionPD.put("DATA", tenCorpDto.getData() == null ? "" : tenCorpDto.getData().toString()); try { PageData log = tenCorpDto.getPd(); log.put("MESSAGE_LOG_ID", Warden.get32UUID()); log.put("CREATE_TIME", DateUtil.getTime()); mqMessageLogMapper.save(log); System.out.println("生产者:" + tenCorpDto.toString()); - SendResult sendResult = rocketMQTemplate.syncSend(this.gwjDataTopic, tenCorpDto.toString()); - if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) { + SendResult sendResult = null; + // 曹煤炭 后期是 三家 + if (tenCorpDto.getTopic().equals(czksDataDocking)) { + sendResult = rocketMQTemplate.syncSend(this.czksDataDocking, tenCorpDto.toString()); + } + if (tenCorpDto.getTopic().equals(cmtDataDocking)) { + sendResult = rocketMQTemplate.syncSend(this.cmtDataDocking, tenCorpDto.toString()); + } + if (tenCorpDto.getTopic().equals(csyDataDocking)) { + sendResult = rocketMQTemplate.syncSend(this.csyDataDocking, tenCorpDto.toString()); + } + if (sendResult != null && !sendResult.getSendStatus().equals(SendStatus.SEND_OK)) { throw new RuntimeException("产品入栈失败"); } } catch (Exception e) { diff --git a/src/main/resources/application-local.properties b/src/main/resources/application-local.properties index 023e9b32..04090df3 100644 --- a/src/main/resources/application-local.properties +++ b/src/main/resources/application-local.properties @@ -2,12 +2,12 @@ datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver datasource.no1.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 -datasource.no1.username=root -datasource.no1.password=Mysql@zcloud88888 +datasource.no1.username=dev +datasource.no1.password=Zykj@dev123456 datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver datasource.no2.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8 -datasource.no2.username=root -datasource.no2.password=Mysql@zcloud88888 +datasource.no2.username=dev +datasource.no2.password=Zykj@dev123456 #druid??? @@ -63,18 +63,18 @@ spring.main.banner-mode=off preventionxgf.api.url=https://qgxgf.qhdsafety.com/qa-prevention-xgf/ qa-regulatory-gwj.api.url=https://qgjg.qhdsafety.com/qa-regulatory-gwj/ #????? -smb.host=192.168.192.201 +smb.host=39.101.130.96 smb.port=22 smb.user=root -smb.password=SJSKAQHBGLXT@20220311 -smb.basePath=/mnt/qask/file/ +smb.password=Zcloud@zcloud88888 +smb.basePath=/mnt/wwag/file/ #Mq\u914D\u7F6E rocketmq.consumer.group2=edu-admin-edit rocketmq.consumer.group1=edu-admin-add #rocketmq.name-server=10.0.140.141:9876 #rocketmq.name-server=192.168.0.70:9876 -rocketmq.name-server=192.168.151.57:9876 +rocketmq.name-server=192.168.0.2:9876 rocketmq.producer.group=libmiddle rocketmq.producer.send-message-timeout=3000 rocketmq.producer.compress-message-body-threshold=4096 @@ -95,6 +95,28 @@ corp.default.pic-path=https://qgqy.qhdsafety.com/ corp.default.back-end-path=https://qgqy.qhdsafety.com/file/ http.file.url=https://qgqy.qhdsafety.com/file/ +mq.csy.data.topic=csy_docking +mq.csy.data.group=scheduled_tasks_csy_docking +mq.csy.file.topic=csy_dockingPicture +mq.csy.file.group=scheduled_tasks_csy_dockingPicture + +mq.cmt.data.topic=cmt_docking +mq.cmt.data.group=scheduled_tasks_cmt_docking +mq.cmt.file.topic=cmt_dockingPicture +mq.cmt.file.group=scheduled_tasks_cmt_dockingPicture + +mq.czks.data.topic=czks_docking +mq.czks.data.group=scheduled_tasks_czks_docking +mq.czks.file.topic=czks_dockingPicture +mq.czks.file.group=scheduled_tasks_czks_dockingPicture + +mq.gwj.data.topic=czks_docking +mq.gwj.file.topic=czks_dockingPicture +baseimgpath =http://192.168.192.201:8991/file/ + +heBeiQinAnFile=https://file.zcloudchina.com/YTHFile +biaoZhunShuJuKu=https://file.zcloudchina.com/ +dw.url=http://192.168.192.201:8888/qa-dingWei-gwj/ #�û���ʶ # ���ݿ�ʯ diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index dd259ac5..ea7feb10 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,11 +2,11 @@ spring.application.name=qa-prevention-gwj server.port=8091 #?? -#spring.profiles.active=local +spring.profiles.active=local #����31ʱʹ�� #spring.profiles.active=dev #?? -spring.profiles.active=master +#spring.profiles.active=master -- 2.42.0.windows.1