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

@@ -16,7 +16,8 @@ public enum RocketMqTagEnum {
DEPT_EVENT("dept_event","部门事件"),
STORE_DING_QUEUE("store_ding_queue", "微应用钉钉消息发送"),
ZXJP_CREATE_STORE("zxjp_create_store", "正新鸡排招商创建门店"),
PARTNER_LICENSE_SYNC_QUEUE("partner_license_sync_queue", "招商证照信息同步");
PARTNER_LICENSE_SYNC_QUEUE("partner_license_sync_queue", "招商证照信息同步"),
BUSINESS_SYNC("business_sync", "工商食安信息同步"),
;

View File

@@ -0,0 +1,23 @@
package com.cool.store.dto;
import com.cool.store.entity.LicenseTransactDO;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* @Author suzhuhong
* @Date 2025/8/13 15:49
* @Version 1.0
*/
@Data
public class BusinessDTO {
private String enterpriseId;
List<LicenseTransactDO> requests;
Map<Long, String> transactMap;
}

View File

@@ -0,0 +1,153 @@
package com.cool.store.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author suzhuhong
* @Date 2025/8/13 13:41
* @Version 1.0
*/
@Data
public class StoreMasterDTO {
@ApiModelProperty("门店名称(加盟签约)")
private String storeName;
@ApiModelProperty("门店名称(小程序点单)")
private String miniProgramOrderStoreName;
@ApiModelProperty("门店编码")
private String storeNum;
@ApiModelProperty("加盟品牌")
private Integer joinBrand;
@ApiModelProperty("加盟模式")
private Integer joinModel;
@ApiModelProperty("门店类型")
private Integer storeType;
@ApiModelProperty("经营模式")
private Integer manageModel;
@ApiModelProperty("签约类型")
private Integer signType;
@ApiModelProperty("门店状态")
private String storeStatus;
@ApiModelProperty("门店带宽")
private Integer storeBandwidth;
@ApiModelProperty("所属加盟集团")
private String bloc;
@ApiModelProperty("所属大区")
private Long branch;
@ApiModelProperty("加盟督导-人")
private String joinSupervision;
@ApiModelProperty("管理督导-组织")
private Long regionId;
@ApiModelProperty("省市区")
private String area;
@ApiModelProperty("门店地址")
private String storeAddress;
@ApiModelProperty("点位编码")
private String pointCode;
@ApiModelProperty("门店面积")
private Integer storeAcreage;
@ApiModelProperty("高德定位")
private String locationScreenshot;
@ApiModelProperty("定位地址")
private String locationAddress;
@ApiModelProperty("经度")
private String longitude;
@ApiModelProperty("纬度")
private String latitude;
@ApiModelProperty("月租金")
private BigDecimal monthlyRent;
@ApiModelProperty("收件人")
private String addresseeName;
@ApiModelProperty("手机号")
private String addresseeMobile;
@ApiModelProperty("收件省市区")
private String addresseeArea;
@ApiModelProperty("收件详细地址")
private String addresseeAddress;
@ApiModelProperty("报货物流仓库(编码)")
private String declareGoodsLogisticsWarehouse;
@ApiModelProperty("报货类型 0-按周报货 1-按月报货 2-自提 3-按2周/次投货 4-按3周/次投货")
private String declareGoodsType;
@ApiModelProperty("报送货日期 数组格式\"[{\"declareGoods\": \"\",\"deliverGoods\":\"\"}]\"")
private String declareGoodsDate;
@ApiModelProperty("营业时间")
private String businessHours;
@ApiModelProperty("门头照")
private String avatar;
@ApiModelProperty("门店内景照")
private String interiorPhotos;
private SignerInfo signerInfo;
private SettlerInfo settlerInfo;
@Data
static class SignerInfo {
@ApiModelProperty("签约人1姓名")
private String Signer1Name;
@ApiModelProperty("签约人1姓名")
private String Signer1Mobile;
@ApiModelProperty("签约人1姓名")
private String Signer1IdCard;
@ApiModelProperty("签约人1姓名")
private String Signer1IdCardPhoto;
@ApiModelProperty("签约人1姓名")
private String Signer1IdCardPhotoBack;
}
@Data
static class SettlerInfo{
@ApiModelProperty("结算人姓名")
private String settlerName;
@ApiModelProperty("结算人身份证号(加密)")
private String settlerIdCardNo;
@ApiModelProperty("结算人身份证正面路径")
private String settlerIdCardFront;
@ApiModelProperty("结算人身份证反面路径")
private String settlerIdCardReverse;
@ApiModelProperty("结算人手持身份证正面照片路径")
private String settlerInHandFrontPicture;
@ApiModelProperty("结算人手持身份证反面照片路径")
private String settlerInHandBackPicture;
@ApiModelProperty("结算人银行卡号(加密)")
private String settlerBankNumber;
@ApiModelProperty("结算人银行卡预留手机号")
private String settlerBankMobile;
@ApiModelProperty("结算开户银行")
private String settlerBankName;
@ApiModelProperty("结算开户银行支行")
private String settlerBankBranchName;
@ApiModelProperty("结算人银行卡照片路径")
private String settlerBankPhotoUrl;
@ApiModelProperty("门店POS收款银行卡反面路径")
private String settlerBankBackPhotoUrl;
}
}

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);