清单修改 使用mq
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
package com.adc.da.mq;
|
||||
|
||||
import com.adc.da.slrs.sarLawsAttrInfo.service.ISarLawsAttrInfoService;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.service.ISarLawsStandInfoService;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.service.ISarStandAttrInfoService;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.sys.service.IDicTypeEOService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class SendQdUpdateMQService {
|
||||
|
||||
@Autowired
|
||||
private ISarStandAttrInfoService iSarStandAttrInfoService;
|
||||
|
||||
@Autowired
|
||||
private ISarStandardsInfoService sarStandardsInfoService;
|
||||
|
||||
@Autowired
|
||||
private ISarLawsStandInfoService lawsStandInfoService;
|
||||
|
||||
@Autowired
|
||||
private ISarLawsAttrInfoService lawsAttrInfoService;
|
||||
|
||||
|
||||
//查询数据字典
|
||||
@Autowired
|
||||
private IDicTypeEOService dicTypeEOService;
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SendQdUpdateMQService.class);
|
||||
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(value = "createQdUpdateMQ_SQ_GSAR_RELEASE", durable = "true"),
|
||||
exchange = @Exchange(value = "qd-update-exchange_SQ_GSAR_RELEASE", ignoreDeclarationExceptions = "true"),
|
||||
key = "qd-update-key_SQ_GSAR_RELEASE"))
|
||||
public void createMQ(Map<String,Object> bussMap, Message message, Channel channel) throws Exception{
|
||||
|
||||
//数据字典数据组装
|
||||
Map<String, Object> dicTypeEO = dicTypeEOService.getDicTypeListCode();
|
||||
Map<String,String> dict=new HashMap<>();
|
||||
List<Map<String, String>> arr = (List<Map<String, String>>) dicTypeEO.get("SYRZCLASS");
|
||||
arr.forEach(stringStringMap -> {
|
||||
dict.put(stringStringMap.get("label"),stringStringMap.get("value"));
|
||||
});
|
||||
|
||||
|
||||
//写修改逻辑
|
||||
Thread.sleep(5000);
|
||||
Hashtable<String,String> tool= (Hashtable<String, String>) bussMap.get("table");
|
||||
List<String> remove= (List<String>) bussMap.get("remove");
|
||||
List<String> add= (List<String>) bussMap.get("add");
|
||||
remove.forEach(s -> {
|
||||
QueryWrapper<SarStandardsInfo> wrapper=new QueryWrapper<>();
|
||||
wrapper.eq("ID",s);
|
||||
List<SarStandardsInfo> infos=sarStandardsInfoService.list(wrapper);
|
||||
if (null!=infos && infos.size()>0) {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(s);
|
||||
sarStandardsInfo.setIsRelateAccess("2");
|
||||
Map<String, Object> bussAttrInfoMap = iSarStandAttrInfoService.getBussAttrInfo(s);
|
||||
if (bussAttrInfoMap != null) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (tool.get(s).contains(",")) {
|
||||
for (String e : tool.get(s).split(",")) {
|
||||
stringBuilder.append(dict.get(e));
|
||||
}
|
||||
} else {
|
||||
stringBuilder.append(dict.get(s));
|
||||
}
|
||||
bussAttrInfoMap.replace("SYRZ", stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
QueryWrapper<SarLawsStandInfo> wrapper1=new QueryWrapper<>();
|
||||
wrapper.eq("ID",s);
|
||||
List<SarLawsStandInfo> infos1=lawsStandInfoService.list(wrapper1);
|
||||
if (null!=infos1 && infos1.size()>0) {
|
||||
SarLawsStandInfo sarLawsStandInfo = new SarLawsStandInfo();
|
||||
sarLawsStandInfo.setId(s);
|
||||
sarLawsStandInfo.setIsRelateAccess("2");
|
||||
Map<String, Object> bussAttrInfoMap = lawsAttrInfoService.getBussAttrInfo(s);
|
||||
if (bussAttrInfoMap != null) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (tool.get(s).contains(",")) {
|
||||
for (String e : tool.get(s).split(",")) {
|
||||
stringBuilder.append(dict.get(e));
|
||||
}
|
||||
} else {
|
||||
stringBuilder.append(dict.get(s));
|
||||
}
|
||||
bussAttrInfoMap.replace("SYRZ", stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add.forEach(s -> {
|
||||
QueryWrapper<SarStandardsInfo> wrapper=new QueryWrapper<>();
|
||||
wrapper.eq("ID",s);
|
||||
List<SarStandardsInfo> infos=sarStandardsInfoService.list(wrapper);
|
||||
if (null!=infos && infos.size()>0) {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(s);
|
||||
sarStandardsInfo.setIsRelateAccess("1");
|
||||
Map<String, Object> bussAttrInfoMap = iSarStandAttrInfoService.getBussAttrInfo(s);
|
||||
if (bussAttrInfoMap != null) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (tool.get(s).contains(",")) {
|
||||
for (String e : tool.get(s).split(",")) {
|
||||
stringBuilder.append(dict.get(e));
|
||||
}
|
||||
} else {
|
||||
stringBuilder.append(dict.get(s));
|
||||
}
|
||||
bussAttrInfoMap.replace("SYRZ", stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
QueryWrapper<SarLawsStandInfo> wrapper1=new QueryWrapper<>();
|
||||
wrapper.eq("ID",s);
|
||||
List<SarLawsStandInfo> infos1=lawsStandInfoService.list(wrapper1);
|
||||
if (null!=infos1 && infos1.size()>0) {
|
||||
SarLawsStandInfo sarLawsStandInfo = new SarLawsStandInfo();
|
||||
sarLawsStandInfo.setId(s);
|
||||
sarLawsStandInfo.setIsRelateAccess("1");
|
||||
Map<String, Object> bussAttrInfoMap = lawsAttrInfoService.getBussAttrInfo(s);
|
||||
if (bussAttrInfoMap != null) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (tool.get(s).contains(",")) {
|
||||
for (String e : tool.get(s).split(",")) {
|
||||
stringBuilder.append(dict.get(e));
|
||||
}
|
||||
} else {
|
||||
stringBuilder.append(dict.get(s));
|
||||
}
|
||||
bussAttrInfoMap.replace("SYRZ", stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user