diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/SyncMainSysServerImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/SyncMainSysServerImpl.java index e2eab890e..89dff90dc 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/SyncMainSysServerImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/SyncMainSysServerImpl.java @@ -85,73 +85,8 @@ public class SyncMainSysServerImpl implements SyncMainSysServer { @Override @Async public void syncStore(Long shopId) { - StoreRequestBody requestBody = new StoreRequestBody(); - ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); - StoreDO storeDO = storeDao.getByStoreNum(shopInfo.getShopCode()); - if (Objects.nonNull(storeDO)) { - throw new ServiceException(ErrorCodeEnum.STORE_IS_EXIST); - } - LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId()); - PointInfoDO pointInfoDO = pointInfoDAO.getPointInfoById(shopInfo.getPointId()); - BuildInformationDO buildInformationDO = buildInformationDAO.selectOneByShopId(shopId); - SignFranchiseDO signFranchiseDO = signFranchiseMapper.selectByShopId(shopId); - - requestBody.setStore_name(shopInfo.getShopName()); - requestBody.setStore_num(shopInfo.getShopCode()); - requestBody.setProvince(shopInfo.getProvince()); - requestBody.setCity(shopInfo.getCity()); - requestBody.setCounty(shopInfo.getDistrict()); - requestBody.setLocation_address(shopInfo.getDetailAddress()); - requestBody.setStore_address(shopInfo.getDetailAddress()); - if (shopInfo.getManagerRegionId() == null) { - BigRegionDO byRegionId = bigRegionDAO.getByRegionId(shopInfo.getRegionId()); - if (byRegionId != null) { - requestBody.setStore_area(byRegionId.getStoreManageRegionId() == null - ? shopInfo.getRegionId().toString() : byRegionId.getStoreManageRegionId().toString()); - } else { - requestBody.setStore_area(shopInfo.getRegionId().toString()); - } - } else { - requestBody.setStore_area(shopInfo.getManagerRegionId().toString()); - } - //未开业 - requestBody.setStore_status("not_open"); - if (pointInfoDO != null) { - requestBody.setStore_acreage(pointInfoDO.getPointArea()); - requestBody.setLongitude_latitude(pointInfoDO.getLongitude() + "," + pointInfoDO.getLatitude()); - } - requestBody.setTelephone(buildInformationDO.getBusinessMobile()); - if (StringUtils.isNotBlank(buildInformationDO.getBusinessHours())) { - try { - String[] times = buildInformationDO.getBusinessHours().split("~"); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); - LocalTime startTime = LocalTime.parse(times[0], formatter); - LocalTime endTime = LocalTime.parse(times[1], formatter); - String startMillis = String.valueOf(startTime.toSecondOfDay() * 1000L); - String endMillis = String.valueOf(endTime.toSecondOfDay() * 1000L); - requestBody.setBusiness_hours(startMillis + "," + endMillis); - } catch (Exception e) { - log.info("时间转换异常:{},shopId:{},time:{}", e.getMessage(), shopId.toString(), buildInformationDO.getBusinessHours()); - } - } - Map configMapByActive = ExtendFieldTypeEnum.getConfigMapByActive(active); - Map extendField = new HashMap<>(); - extendField.put(configMapByActive.get(ONLINE_STORE_MANAGER_MOBILE.getMsg()).getKey(), ""); - extendField.put(configMapByActive.get(ONLINE_SIGNATORY_NAME_1.getMsg()).getKey(), signFranchiseDO.getPartnershipSignatoryFirst()); - extendField.put(configMapByActive.get(ONLINE_SIGNATORY_MOBILE_1.getMsg()).getKey(), lineInfoDO.getMobile()); - extendField.put(configMapByActive.get(ONLINE_SIGNATORY_NAME_2.getMsg()).getKey(), signFranchiseDO.getPartnershipSignatorySecond()); - extendField.put(configMapByActive.get(ONLINE_SIGNATORY_MOBILE_2.getMsg()).getKey(), signFranchiseDO.getPartnershipSignatorySecondMobile()); - extendField.put(configMapByActive.get(ONLINE_ORDER_NAME.getMsg()).getKey(), buildInformationDO.getCShopName()); - extendField.put(configMapByActive.get(ONLINE_JOIN_MODE.getMsg()).getKey(), JoinModeEnum.getByCode(shopInfo.getJoinMode())); - extendField.put(configMapByActive.get(ONLINE_STORE_TYPE.getMsg()).getKey(), StoreTypeEnum.getMessage(shopInfo.getStoreType())); - extendField.put(configMapByActive.get(ONLINE_BRAND.getMsg()).getKey(), FranchiseBrandEnum.getDescByCode(shopInfo.getFranchiseBrand())); - requestBody.setExtend_field(JSONObject.toJSONString(extendField)); - requestBody.setEid(eid); - requestBody.setPartnerName(lineInfoDO.getUsername()); - requestBody.setPartnerMobile(lineInfoDO.getMobile()); - requestBody.setPartnerRoleId(UserRoleEnum.FRANCHISEES.getCode()); - simpleMessageService.send(JSONObject.toJSONString(requestBody), RocketMqTagEnum.ZXJP_CREATE_STORE); - + log.info("开始同步门店 syncStore:{}", shopId); + addStore(shopId); } @@ -159,7 +94,7 @@ public class SyncMainSysServerImpl implements SyncMainSysServer { * 添加门店 * @param shopId */ - public void asdStore(Long shopId) { + public void addStore(Long shopId) { try { StoreMasterDTO storeMasterDTO = new StoreMasterDTO(); ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);