Commit aed695108726b6bf438ec78501d9960c017e1266
1 parent
45aab328
feat(adopt): 添加日志记录并优化消息处理逻辑
Showing
1 changed file
with
10 additions
and
5 deletions
tax-adopt/src/main/java/com/diligrp/tax/adopt/service/impl/AdoptMessageServiceImpl.java
| @@ -16,6 +16,7 @@ import com.diligrp.tax.central.utils.AdoptUtils; | @@ -16,6 +16,7 @@ import com.diligrp.tax.central.utils.AdoptUtils; | ||
| 16 | import com.diligrp.tax.central.utils.JsonUtils; | 16 | import com.diligrp.tax.central.utils.JsonUtils; |
| 17 | import com.fasterxml.jackson.core.type.TypeReference; | 17 | import com.fasterxml.jackson.core.type.TypeReference; |
| 18 | import lombok.AllArgsConstructor; | 18 | import lombok.AllArgsConstructor; |
| 19 | +import lombok.extern.slf4j.Slf4j; | ||
| 19 | import org.apache.commons.io.FilenameUtils; | 20 | import org.apache.commons.io.FilenameUtils; |
| 20 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; | 21 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| 21 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; | 22 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| @@ -37,6 +38,7 @@ import static com.diligrp.tax.central.queue.TaxAutoPush.NORMAL_ROUTING; | @@ -37,6 +38,7 @@ import static com.diligrp.tax.central.queue.TaxAutoPush.NORMAL_ROUTING; | ||
| 37 | */ | 38 | */ |
| 38 | @Service | 39 | @Service |
| 39 | @AllArgsConstructor | 40 | @AllArgsConstructor |
| 41 | +@Slf4j | ||
| 40 | public class AdoptMessageServiceImpl implements AdoptMessageService { | 42 | public class AdoptMessageServiceImpl implements AdoptMessageService { |
| 41 | 43 | ||
| 42 | private final ITaxPipelineBusinessKeywordService taxPipelineBusinessKeywordService; | 44 | private final ITaxPipelineBusinessKeywordService taxPipelineBusinessKeywordService; |
| @@ -49,12 +51,15 @@ public class AdoptMessageServiceImpl implements AdoptMessageService { | @@ -49,12 +51,15 @@ public class AdoptMessageServiceImpl implements AdoptMessageService { | ||
| 49 | List<PipelineBusinessKeyword> pipelineBusinessKeywords = taxPipelineBusinessKeywordService.queryByTenantAndPipelineAndBusiness(receiveMessageCO.getGroup(), | 51 | List<PipelineBusinessKeyword> pipelineBusinessKeywords = taxPipelineBusinessKeywordService.queryByTenantAndPipelineAndBusiness(receiveMessageCO.getGroup(), |
| 50 | receiveMessageCO.getEntity(), receiveMessageCO.getPipelineCode(), receiveMessageCO.getBusinessCode(), receiveMessageCO.getDocumentType()); | 52 | receiveMessageCO.getEntity(), receiveMessageCO.getPipelineCode(), receiveMessageCO.getBusinessCode(), receiveMessageCO.getDocumentType()); |
| 51 | if (CollectionUtils.isEmpty(pipelineBusinessKeywords)) { | 53 | if (CollectionUtils.isEmpty(pipelineBusinessKeywords)) { |
| 52 | - throw new TaxAgentServiceException("未找到配置信息"); | 54 | + log.info("当前group{},entity {},账套编码{},业务代码{},文档类型{} 无配置信息", |
| 55 | + receiveMessageCO.getGroup(), receiveMessageCO.getEntity(), receiveMessageCO.getPipelineCode(), | ||
| 56 | + receiveMessageCO.getBusinessCode(), receiveMessageCO.getDocumentType()); | ||
| 57 | + } else { | ||
| 58 | + Map<String, Object> msgBody = receiveMessageCO.getMsgBody(); | ||
| 59 | + String json = JsonUtils.toJsonString(msgBody); | ||
| 60 | + Map<String, Object> map = AdoptUtils.handleAdopt(pipelineBusinessKeywords, json); | ||
| 61 | + receiveMessageCO.setMsgBody(map); | ||
| 53 | } | 62 | } |
| 54 | - Map<String, Object> msgBody = receiveMessageCO.getMsgBody(); | ||
| 55 | - String json = JsonUtils.toJsonString(msgBody); | ||
| 56 | - Map<String, Object> map = AdoptUtils.handleAdopt(pipelineBusinessKeywords, json); | ||
| 57 | - receiveMessageCO.setMsgBody(map); | ||
| 58 | Optional<TenantPipeline> byTenantAndPipelineCode = taxTenantService.findByTenantAndPipelineCode(receiveMessageCO.getGroup(), receiveMessageCO.getEntity(), receiveMessageCO.getPipelineCode()); | 63 | Optional<TenantPipeline> byTenantAndPipelineCode = taxTenantService.findByTenantAndPipelineCode(receiveMessageCO.getGroup(), receiveMessageCO.getEntity(), receiveMessageCO.getPipelineCode()); |
| 59 | byTenantAndPipelineCode.ifPresent(tenantPipeline -> receiveMessageCO.setSystemType(tenantPipeline.getSystemType().code)); | 64 | byTenantAndPipelineCode.ifPresent(tenantPipeline -> receiveMessageCO.setSystemType(tenantPipeline.getSystemType().code)); |
| 60 | // 发送mq | 65 | // 发送mq |