feat:主数据同步

This commit is contained in:
苏竹红
2025-08-13 17:23:00 +08:00
parent 4a222b7a64
commit d52faf485b
4 changed files with 198 additions and 9 deletions

View File

@@ -239,6 +239,7 @@ public class XxlJobHandler {
}
Map<Long, LicenseTransactDO> transactDOMap = licenseTransactDOS.stream().collect(Collectors.toMap(LicenseTransactDO::getShopId, x -> x));
List<LicenseSyncInfoDTO> pushList = new ArrayList<>();
List<LicenseTransactDO> pushBusinessList = new ArrayList<>();
infoDOS.forEach(x -> {
LicenseTransactDO licenseTransactDO = transactDOMap.get(x.getShopId());
Integer currentStoreSyncCount = 0;
@@ -248,6 +249,7 @@ public class XxlJobHandler {
pushList.add(createLicenseSyncInfoDTO(x.getStoreId(), CommonConstants.ONE,
licenseTransactDO.getCreditUrl(), licenseTransactDO.getIssueTime(), licenseTransactDO.getValidity()));
currentStoreSyncCount++;
pushBusinessList.add(licenseTransactDO);
}
// 同步食品经营许可证
@@ -265,24 +267,34 @@ public class XxlJobHandler {
currentStoreSyncCount++;
}
// 发送消息
if (!pushList.isEmpty()) {
LicenseDTO licenseDTO = new LicenseDTO();
licenseDTO.setEnterpriseId(eid);
licenseDTO.setRequests(pushList);
log.info("licenseDTO:{}",JSONObject.toJSONString(licenseDTO));
simpleMessageService.send(JSONObject.toJSONString(licenseDTO), RocketMqTagEnum.PARTNER_LICENSE_SYNC_QUEUE);
}
if (currentStoreSyncCount == CommonConstants.TWO) {
updateSyncList.add(licenseTransactDO.getId());
}
}
});
// 发送消息
if (!pushList.isEmpty()) {
LicenseDTO licenseDTO = new LicenseDTO();
licenseDTO.setEnterpriseId(eid);
licenseDTO.setRequests(pushList);
log.info("licenseDTO:{}",JSONObject.toJSONString(licenseDTO));
simpleMessageService.send(JSONObject.toJSONString(licenseDTO), RocketMqTagEnum.PARTNER_LICENSE_SYNC_QUEUE);
}
//工商信息变更
if (!pushBusinessList.isEmpty()){
Map<Long, String> transactMap = infoDOS.stream().collect(Collectors.toMap(LicenseSyncDTO::getShopId, LicenseSyncDTO::getStoreId));
BusinessDTO businessDTO = new BusinessDTO();
businessDTO.setEnterpriseId(eid);
businessDTO.setTransactMap(transactMap);
businessDTO.setRequests(pushBusinessList);
simpleMessageService.send(JSONObject.toJSONString(businessDTO), RocketMqTagEnum.BUSINESS_SYNC);
}
hasNext = licenseTransactDOS.size() >= pageSize;
pageNum++;
}
log.info("licenseDTO:{}",JSONObject.toJSONString(updateSyncList));
if (CollectionUtils.isNotEmpty(updateSyncList)) {
applyLicenseMapper.updateSyncFlagByIds(updateSyncList);