Merge pull request '626相关方人员数据对接' (#21) from 626相关方人员数据对接 into pet

Reviewed-on: #21
liujun0703-新项目开发
guoyuepeng 2024-06-27 14:48:20 +08:00
commit abe20ba360
5 changed files with 94 additions and 14 deletions

View File

@ -32,6 +32,13 @@ import java.util.Map;
public class DockingAspect { public class DockingAspect {
@Autowired @Autowired
private DockSendMessageService sendMessageService; 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}") @Value("${baseimgpath}")
public String baseimgpath; public String baseimgpath;
@Pointcut("@annotation(com.zcloud.aspect.DockAnnotation)") @Pointcut("@annotation(com.zcloud.aspect.DockAnnotation)")
@ -104,9 +111,27 @@ public class DockingAspect {
tenCorpDto.setProducer_name("qa-prevention-czks"); tenCorpDto.setProducer_name("qa-prevention-czks");
// 有dockData // 有dockData
if (Tools.notEmpty(proceed.get("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"); proceed.remove("dockData");
sendMessageService.sendMessage(tenCorpDto);
} else { } else {
System.out.println("------------------------无dockData不发消息------------------------"); System.out.println("------------------------无dockData不发消息------------------------");
} }

View File

@ -2,6 +2,7 @@ package com.zcloud.dto;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.util.Warden;
import lombok.Data; import lombok.Data;
@Data @Data
@ -23,6 +24,10 @@ public class TenCorpDto {
// 消息体 // 消息体
private PageData data; private PageData data;
private String messageLogId;
private String CREATE_TIME;
public TenCorpDto() { public TenCorpDto() {
this.id = Warden.get32UUID(); this.id = Warden.get32UUID();
} }
@ -40,6 +45,9 @@ public class TenCorpDto {
info.put("MARK_NAME", this.mark_name); info.put("MARK_NAME", this.mark_name);
info.put("MESSAGE", this.message); info.put("MESSAGE", this.message);
info.put("TOPIC",this.topic); 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; return info;
} }
} }

View File

@ -26,6 +26,13 @@ public class DockSendMessageServiceImpl implements DockSendMessageService {
private String gwjDataTopic; private String gwjDataTopic;
@Value("${mq.gwj.file.topic}") @Value("${mq.gwj.file.topic}")
private String gwjFileTopic; 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 @Resource
private RocketMQTemplate rocketMQTemplate; private RocketMQTemplate rocketMQTemplate;
@ -40,14 +47,32 @@ public class DockSendMessageServiceImpl implements DockSendMessageService {
@Override @Override
public void sendMessage(TenCorpDto tenCorpDto) throws Exception { 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 { try {
PageData log = tenCorpDto.getPd(); PageData log = tenCorpDto.getPd();
log.put("MESSAGE_LOG_ID", Warden.get32UUID()); log.put("MESSAGE_LOG_ID", Warden.get32UUID());
log.put("CREATE_TIME", DateUtil.getTime()); log.put("CREATE_TIME", DateUtil.getTime());
mqMessageLogMapper.save(log); mqMessageLogMapper.save(log);
System.out.println("生产者:" + tenCorpDto.toString()); System.out.println("生产者:" + tenCorpDto.toString());
SendResult sendResult = rocketMQTemplate.syncSend(this.gwjDataTopic, tenCorpDto.toString()); SendResult sendResult = null;
if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) { // 曹煤炭 后期是 三家
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("产品入栈失败"); throw new RuntimeException("产品入栈失败");
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -2,12 +2,12 @@
datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver 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.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.username=dev
datasource.no1.password=Mysql@zcloud88888 datasource.no1.password=Zykj@dev123456
datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver 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.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.username=dev
datasource.no2.password=Mysql@zcloud88888 datasource.no2.password=Zykj@dev123456
#druid??? #druid???
@ -63,18 +63,18 @@ spring.main.banner-mode=off
preventionxgf.api.url=https://qgxgf.qhdsafety.com/qa-prevention-xgf/ preventionxgf.api.url=https://qgxgf.qhdsafety.com/qa-prevention-xgf/
qa-regulatory-gwj.api.url=https://qgjg.qhdsafety.com/qa-regulatory-gwj/ 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.port=22
smb.user=root smb.user=root
smb.password=SJSKAQHBGLXT@20220311 smb.password=Zcloud@zcloud88888
smb.basePath=/mnt/qask/file/ smb.basePath=/mnt/wwag/file/
#Mq\u914D\u7F6E #Mq\u914D\u7F6E
rocketmq.consumer.group2=edu-admin-edit rocketmq.consumer.group2=edu-admin-edit
rocketmq.consumer.group1=edu-admin-add rocketmq.consumer.group1=edu-admin-add
#rocketmq.name-server=10.0.140.141:9876 #rocketmq.name-server=10.0.140.141:9876
#rocketmq.name-server=192.168.0.70: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.group=libmiddle
rocketmq.producer.send-message-timeout=3000 rocketmq.producer.send-message-timeout=3000
rocketmq.producer.compress-message-body-threshold=4096 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/ corp.default.back-end-path=https://qgqy.qhdsafety.com/file/
http.file.url=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/
#<23>û<EFBFBD><C3BB><EFBFBD>ʶ #<23>û<EFBFBD><C3BB><EFBFBD>ʶ
# <20><><EFBFBD>ݿ<EFBFBD>ʯ # <20><><EFBFBD>ݿ<EFBFBD>ʯ

View File

@ -2,11 +2,11 @@ spring.application.name=qa-prevention-gwj
server.port=8091 server.port=8091
#?? #??
#spring.profiles.active=local spring.profiles.active=local
#<23><><EFBFBD><EFBFBD>31ʱʹ<CAB1><CAB9> #<23><><EFBFBD><EFBFBD>31ʱʹ<CAB1><CAB9>
#spring.profiles.active=dev #spring.profiles.active=dev
#?? #??
spring.profiles.active=master #spring.profiles.active=master