|
|
|
@ -2,18 +2,16 @@ package com.docus.server.collect.report.noview;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.log.context.TrackHelper;
|
|
|
|
|
import com.docus.server.archivefile.pojo.entity.CollectsysDictionary;
|
|
|
|
|
import com.docus.server.archivefile.service.IAfCollectSysDictionary;
|
|
|
|
|
import com.docus.server.collect.web.common.DocusProperties;
|
|
|
|
|
import com.docus.server.collect.web.common.NoViewChNewbornProperties;
|
|
|
|
|
import com.docus.server.collect.web.common.NoViewProperties;
|
|
|
|
|
import com.docus.server.collect.web.common.dto.NoViewCollectionDto;
|
|
|
|
|
import com.docus.server.collect.web.common.dto.NoViewConfig;
|
|
|
|
|
import com.docus.server.collect.web.common.dto.ViewReportTwoDto;
|
|
|
|
|
import com.docus.server.collect.web.common.entity.TaskConfig;
|
|
|
|
|
import com.docus.server.collect.web.enums.DisposeModeEnum;
|
|
|
|
|
import com.docus.server.collect.web.enums.HospitalEnum;
|
|
|
|
|
import com.docus.server.collect.web.enums.RedisKeyEnum;
|
|
|
|
@ -40,6 +38,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class DefNoViewJobResultImpl
|
|
|
|
|
extends AbstractNoViewJobResultImpl<List<Map<String, Object>>> {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private NoViewProperties noViewProperties;
|
|
|
|
|
@Resource
|
|
|
|
@ -56,35 +55,34 @@ public class DefNoViewJobResultImpl
|
|
|
|
|
MqQueueUtils mqQueueUtils;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(List<Map<String, Object>> results, String dsKey) {
|
|
|
|
|
public void handle(List<Map<String, Object>> results, String param) {
|
|
|
|
|
super.handle(results, param);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
NoViewCollectionDto collectionDto = com.docus.core.util.json.JSON.fromJSON(param, NoViewCollectionDto.class);
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(List<Map<String, Object>> results, Map<String, Object> param) {
|
|
|
|
|
Map<String, Object> params = TrackHelper.getParams();
|
|
|
|
|
if (Func.isNull(params)) {
|
|
|
|
|
if (Func.isBlank(param)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
TaskConfig taskConfig = (TaskConfig) params.get("taskConfig");
|
|
|
|
|
|
|
|
|
|
List<ViewReportTwoDto> list = new ArrayList<>();
|
|
|
|
|
for (Map<String, Object> map : results) {
|
|
|
|
|
ViewReportTwoDto viewReportTwoDto = MapObjUtil.map2ObjectUnderlined(map, ViewReportTwoDto.class);
|
|
|
|
|
viewReportTwoDto.setIspriority(taskConfig.getPriority());
|
|
|
|
|
viewReportTwoDto.setIspriority(collectionDto.getPriority());
|
|
|
|
|
list.add(viewReportTwoDto);
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
GenerateQueue(list, taskConfig.getSyscodes());
|
|
|
|
|
GenerateQueue(list, collectionDto);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("发送队列信息失败,错误信息:" + ex.getMessage() + "." + JSON.toJSONString(dto));
|
|
|
|
|
log.error("发送队列信息失败,错误信息:" + ex.getMessage() + "." + JSON.toJSONString(collectionDto));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TrackHelper.clear();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GenerateQueue(List<ViewReportTwoDto> list, String syscodes) {
|
|
|
|
|
// List<NoViewConfig> configs = initNoviewConfig();
|
|
|
|
|
private void GenerateQueue(List<ViewReportTwoDto> list, NoViewCollectionDto collectionDto) {
|
|
|
|
|
String syscodes = collectionDto.getSyscodes();
|
|
|
|
|
List<NoViewConfig> configs = collectionDto.getNoviewconfig();
|
|
|
|
|
Map<String, Object> queuemerge = collectionDto.getQueuemerge();
|
|
|
|
|
List<CollectsysDictionary> collectsysDictionaries = afCollectSysDictionary.findAll();
|
|
|
|
|
if (!StringUtils.isEmpty(syscodes)) {
|
|
|
|
|
List<String> collectids = Arrays.asList(syscodes.split(","));
|
|
|
|
@ -104,7 +102,7 @@ public class DefNoViewJobResultImpl
|
|
|
|
|
k.setCollectorId(o.getSysCode());
|
|
|
|
|
if (docusProperties.getMode().equals(DisposeModeEnum.mq)) {
|
|
|
|
|
MqMessage mqMessage = new MqMessage();
|
|
|
|
|
String mqKey = String.format("topic_task_%s_queue", getQueueKey(o.getSysCode()));
|
|
|
|
|
String mqKey = String.format("topic_task_%s_queue", getQueueKey(o.getSysCode(), queuemerge));
|
|
|
|
|
mqQueueUtils.DeclareQueue(mqKey);
|
|
|
|
|
mqMessage.setMessageBody(JSON.toJSONString(k, SerializerFeature.WriteDateUseDateFormat, SerializerFeature.WriteMapNullValue));
|
|
|
|
|
amqpTemplate.convertAndSend("", mqKey, mqMessage);
|
|
|
|
@ -116,13 +114,11 @@ public class DefNoViewJobResultImpl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getQueueKey(String sysCode) {
|
|
|
|
|
TableJsonRead tableJsonRead = new TableJsonRead();
|
|
|
|
|
JSONObject read = tableJsonRead.Read("docus", "queuemerge", JSONObject.class);
|
|
|
|
|
if (read == null || read.size() <= 0) {
|
|
|
|
|
private static String getQueueKey(String sysCode, Map<String, Object> queuemerge) {
|
|
|
|
|
if (Func.isNull(queuemerge)) {
|
|
|
|
|
return sysCode;
|
|
|
|
|
}
|
|
|
|
|
for (Map.Entry<String, Object> merge : read.entrySet()) {
|
|
|
|
|
for (Map.Entry<String, Object> merge : queuemerge.entrySet()) {
|
|
|
|
|
if (Arrays.asList(String.valueOf(merge.getKey()).split(StrUtil.COMMA)).contains(sysCode)) {
|
|
|
|
|
if (StrUtil.isBlank(String.valueOf(merge.getValue())) || "null".equals(String.valueOf(merge.getValue()))) {
|
|
|
|
|
return sysCode;
|
|
|
|
|