feat:getStoreListByMobile

This commit is contained in:
苏竹红
2025-09-05 16:23:29 +08:00
parent 910efd055d
commit e682027be5

View File

@@ -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<String, String> map = new HashMap<>();
map.put("partnerUsername", lineInfoDO.getUsername());
map.put("partnerMobile", lineInfoDO.getMobile());
map.put("storeName", shopInfoDO.getShopName());
List<EnterpriseUserDO> logisticsList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.LOGISTICS, shopInfoDO.getRegionId());
List<String> 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<PlatformBuildDO> 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<String, String> map = new HashMap<>();
map.put("partnerUsername", lineInfoDO.getUsername());
map.put("partnerMobile", lineInfoDO.getMobile());
map.put("storeName", shopInfoDO.getShopName());
List<EnterpriseUserDO> logisticsList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.LOGISTICS, shopInfoDO.getRegionId());
List<String> 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<PlatformBuildDO> 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());