From e682027be5d20eaf7eb78f471eaab18570da542d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E7=AB=B9=E7=BA=A2?= Date: Fri, 5 Sep 2025 16:23:29 +0800 Subject: [PATCH] feat:getStoreListByMobile --- .../impl/BuildInformationServiceImpl.java | 192 +++++++++--------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java index 8a41319c4..1daeb4fb5 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/BuildInformationServiceImpl.java @@ -75,6 +75,102 @@ public class BuildInformationServiceImpl implements BuildInformationService { private BigRegionDAO bigRegionDAO; + @Override + @Transactional(rollbackFor = Exception.class) + public Integer submitOrUpdate(BuildInformationRequest request) { + log.info("提交/修改建店资料开始,shopId:{}", JSONObject.toJSONString(request)); + String lockKey = redisConstantUtil.submitBuildKey(request.getShopId()); + String lockValue = UUID.randomUUID().toString(); + boolean acquired = false; + try { + acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS); + if (Boolean.TRUE.equals(acquired)) { + ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId()); +// if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){ +// log.info("FLAGSHIP_STORE:{},{},{},{},{},{},{}",request.getSettlerName(),request.getSettlerIdCardFront(), +// request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(), +// request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName()); +// //校验结算人非空 +// if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(), +// request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(), +// request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) { +// throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); +// } +// } + + BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(request.getShopId()); + BuildInformationDO buildInformationDO = request.toDO(); + OrderSysInfoDO orderSysInfoDO = getOrderSysInfoDO(request); + OrderSysInfoDO orderSysInfoDO1 = orderSysInfoDAO.selectByShopId(request.getShopId()); + if (Objects.nonNull(orderSysInfoDO1)) { + orderSysInfoDAO.updateByShopId(orderSysInfoDO); + } else { + orderSysInfoDAO.insertSelective(orderSysInfoDO); + } + LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId()); + QualificationsInfoDO qualificationsInfoDO = qualificationsInfoDAO.getByLineId(lineInfoDO.getId()); + if (request.getJuridicalIsSamePartner()) { + buildInformationDO.setJuridicalName(lineInfoDO.getUsername()); + buildInformationDO.setJuridicalIdCardNo(qualificationsInfoDO.getIdCardNo()); + buildInformationDO.setJuridicalIdCardFront(qualificationsInfoDO.getFrontOfIdCard()); + buildInformationDO.setJuridicalIdCardReverse(qualificationsInfoDO.getBackOfIdCard()); + } + if (request.getSettlerIsSamePartner()!=null&&request.getSettlerIsSamePartner()) { + buildInformationDO.setSettlerIdCardNo(qualificationsInfoDO.getIdCardNo()); + buildInformationDO.setSettlerName(lineInfoDO.getUsername()); + buildInformationDO.setSettlerIdCardFront(qualificationsInfoDO.getFrontOfIdCard()); + buildInformationDO.setSettlerIdCardReverse(qualificationsInfoDO.getBackOfIdCard()); + } + if (Objects.isNull(informationDO)) { + buildInformationDO.setCreateTime(new Date()); + buildInformationDO.setUpdateTime(new Date()); + shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151); + HashMap map = new HashMap<>(); + map.put("partnerUsername", lineInfoDO.getUsername()); + map.put("partnerMobile", lineInfoDO.getMobile()); + map.put("storeName", shopInfoDO.getShopName()); + List logisticsList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.LOGISTICS, shopInfoDO.getRegionId()); + List logistics = new ArrayList<>(); + if (Objects.nonNull(logisticsList)) { + logistics.addAll(logisticsList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList())); + } + commonService.sendQWMessage(logistics, + MessageEnum.MESSAGE_52, + map); + return buildInformationDAO.insertSelective(buildInformationDO); + } else { + buildInformationDO.setUpdateTime(new Date()); + List platformBuildDOS = platformBuildDAO.selectByShopId(request.getShopId()); + if (CollectionUtils.isNotEmpty(platformBuildDOS)){ + for (PlatformBuildDO platformBuildDO : platformBuildDOS){ + platformBuildDO.setSettlerName(buildInformationDO.getSettlerName()); + platformBuildDO.setSettlerIdCardFront(buildInformationDO.getSettlerIdCardFront()); + platformBuildDO.setSettlerIdCardReverse(buildInformationDO.getSettlerIdCardReverse()); + platformBuildDO.setSettlerInHandBackPicture(buildInformationDO.getSettlerInHandBackPicture()); + platformBuildDO.setSettlerInHandFrontPicture(buildInformationDO.getSettlerInHandFrontPicture()); + platformBuildDO.setSettlerIdCardNo(buildInformationDO.getSettlerIdCardNo()); + platformBuildDO.setSettlerBankPhotoUrl(buildInformationDO.getSettlerBankPhotoUrl()); + platformBuildDO.setSettlerBankNumber(buildInformationDO.getSettlerBankNumber()); + platformBuildDO.setSettlerBankMobile(buildInformationDO.getSettlerBankMobile()); + platformBuildDO.setSettlerBankName(buildInformationDO.getSettlerBankName()); + } + } + platformBuildDAO.batchUpdate(platformBuildDOS); + return buildInformationDAO.updateByShopIdSelective(buildInformationDO); + } + }else{ + throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION); + } + } finally { + if (Boolean.TRUE.equals(acquired)) { + String currentValue = redisUtilPool.getString(lockKey); + if (lockValue.equals(currentValue)) { + redisUtilPool.delKey(lockKey); + } + } + } + } + @Override public BuildInformationResponse getBuildInformation(Long shopId) { BuildInformationResponse response = new BuildInformationResponse(); @@ -194,102 +290,6 @@ public class BuildInformationServiceImpl implements BuildInformationService { response.setJuridicalIsSamePartner(informationDO.getJuridicalIsSamePartner()); } - @Override - @Transactional(rollbackFor = Exception.class) - public Integer submitOrUpdate(BuildInformationRequest request) { - log.info("提交/修改建店资料开始,shopId:{}", JSONObject.toJSONString(request)); - String lockKey = redisConstantUtil.submitBuildKey(request.getShopId()); - String lockValue = UUID.randomUUID().toString(); - boolean acquired = false; - try { - acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS); - if (Boolean.TRUE.equals(acquired)) { - ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId()); - if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){ - log.info("FLAGSHIP_STORE:{},{},{},{},{},{},{}",request.getSettlerName(),request.getSettlerIdCardFront(), - request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(), - request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName()); - //校验结算人非空 - if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(), - request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(), - request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) { - throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); - } - } - - BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(request.getShopId()); - BuildInformationDO buildInformationDO = request.toDO(); - OrderSysInfoDO orderSysInfoDO = getOrderSysInfoDO(request); - OrderSysInfoDO orderSysInfoDO1 = orderSysInfoDAO.selectByShopId(request.getShopId()); - if (Objects.nonNull(orderSysInfoDO1)) { - orderSysInfoDAO.updateByShopId(orderSysInfoDO); - } else { - orderSysInfoDAO.insertSelective(orderSysInfoDO); - } - LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId()); - QualificationsInfoDO qualificationsInfoDO = qualificationsInfoDAO.getByLineId(lineInfoDO.getId()); - if (request.getJuridicalIsSamePartner()) { - buildInformationDO.setJuridicalName(lineInfoDO.getUsername()); - buildInformationDO.setJuridicalIdCardNo(qualificationsInfoDO.getIdCardNo()); - buildInformationDO.setJuridicalIdCardFront(qualificationsInfoDO.getFrontOfIdCard()); - buildInformationDO.setJuridicalIdCardReverse(qualificationsInfoDO.getBackOfIdCard()); - } - if (request.getSettlerIsSamePartner()!=null&&request.getSettlerIsSamePartner()) { - buildInformationDO.setSettlerIdCardNo(qualificationsInfoDO.getIdCardNo()); - buildInformationDO.setSettlerName(lineInfoDO.getUsername()); - buildInformationDO.setSettlerIdCardFront(qualificationsInfoDO.getFrontOfIdCard()); - buildInformationDO.setSettlerIdCardReverse(qualificationsInfoDO.getBackOfIdCard()); - } - if (Objects.isNull(informationDO)) { - buildInformationDO.setCreateTime(new Date()); - buildInformationDO.setUpdateTime(new Date()); - shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151); - HashMap map = new HashMap<>(); - map.put("partnerUsername", lineInfoDO.getUsername()); - map.put("partnerMobile", lineInfoDO.getMobile()); - map.put("storeName", shopInfoDO.getShopName()); - List logisticsList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.LOGISTICS, shopInfoDO.getRegionId()); - List logistics = new ArrayList<>(); - if (Objects.nonNull(logisticsList)) { - logistics.addAll(logisticsList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList())); - } - commonService.sendQWMessage(logistics, - MessageEnum.MESSAGE_52, - map); - return buildInformationDAO.insertSelective(buildInformationDO); - } else { - buildInformationDO.setUpdateTime(new Date()); - List platformBuildDOS = platformBuildDAO.selectByShopId(request.getShopId()); - if (CollectionUtils.isNotEmpty(platformBuildDOS)){ - for (PlatformBuildDO platformBuildDO : platformBuildDOS){ - platformBuildDO.setSettlerName(buildInformationDO.getSettlerName()); - platformBuildDO.setSettlerIdCardFront(buildInformationDO.getSettlerIdCardFront()); - platformBuildDO.setSettlerIdCardReverse(buildInformationDO.getSettlerIdCardReverse()); - platformBuildDO.setSettlerInHandBackPicture(buildInformationDO.getSettlerInHandBackPicture()); - platformBuildDO.setSettlerInHandFrontPicture(buildInformationDO.getSettlerInHandFrontPicture()); - platformBuildDO.setSettlerIdCardNo(buildInformationDO.getSettlerIdCardNo()); - platformBuildDO.setSettlerBankPhotoUrl(buildInformationDO.getSettlerBankPhotoUrl()); - platformBuildDO.setSettlerBankNumber(buildInformationDO.getSettlerBankNumber()); - platformBuildDO.setSettlerBankMobile(buildInformationDO.getSettlerBankMobile()); - platformBuildDO.setSettlerBankName(buildInformationDO.getSettlerBankName()); - } - } - platformBuildDAO.batchUpdate(platformBuildDOS); - return buildInformationDAO.updateByShopIdSelective(buildInformationDO); - } - }else{ - throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION); - } - } finally { - if (Boolean.TRUE.equals(acquired)) { - String currentValue = redisUtilPool.getString(lockKey); - if (lockValue.equals(currentValue)) { - redisUtilPool.delKey(lockKey); - } - } - } - } - private static @NotNull OrderSysInfoDO getOrderSysInfoDO(BuildInformationRequest request) { OrderSysInfoDO orderSysInfoDO = new OrderSysInfoDO(); orderSysInfoDO.setShopId(request.getShopId());