From 492f2999ee0ddcc5454105e8f24c55b41cf0c228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E7=AB=B9=E7=BA=A2?= Date: Wed, 22 Jan 2025 14:04:57 +0800 Subject: [PATCH] feat:addBranchShop --- .../com/cool/store/request/AddBranchShopRequest.java | 9 ++++++--- .../com/cool/store/service/impl/ShopServiceImpl.java | 9 +-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/coolstore-partner-model/src/main/java/com/cool/store/request/AddBranchShopRequest.java b/coolstore-partner-model/src/main/java/com/cool/store/request/AddBranchShopRequest.java index 89556b61d..ead6dbea7 100644 --- a/coolstore-partner-model/src/main/java/com/cool/store/request/AddBranchShopRequest.java +++ b/coolstore-partner-model/src/main/java/com/cool/store/request/AddBranchShopRequest.java @@ -1,10 +1,13 @@ package com.cool.store.request; +import com.cool.store.entity.LineInfoDO; import com.cool.store.entity.ShopInfoDO; import com.cool.store.enums.point.ShopStageEnum; import com.cool.store.enums.point.ShopStatusEnum; +import com.cool.store.utils.NumberConverter; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.apache.commons.lang3.StringUtils; import javax.validation.constraints.Max; import javax.validation.constraints.Min; @@ -42,10 +45,10 @@ public class AddBranchShopRequest { @ApiModelProperty("所属大区") private Long regionId; - public ShopInfoDO toDO(AddBranchShopRequest request, String partnerId) { + public ShopInfoDO toDO(AddBranchShopRequest request, LineInfoDO lineInfo) { ShopInfoDO shopInfoDO = new ShopInfoDO(); shopInfoDO.setLineId(request.getLineId()); - shopInfoDO.setShopName(request.getShopName()); + shopInfoDO.setShopName(StringUtils.isNotBlank(request.getShopName())?request.getShopName():"店铺" + NumberConverter.convertArabicToChinese(lineInfo.getWantShopNum()+1)); shopInfoDO.setRegionId(request.getRegionId()); shopInfoDO.setShopName(request.getShopName()); shopInfoDO.setWantShopAreaId(request.getWantShopAreaId()); @@ -56,7 +59,7 @@ public class AddBranchShopRequest { shopInfoDO.setCreateTime(new Date()); shopInfoDO.setShopStatus(ShopStatusEnum.ING.getCode()); shopInfoDO.setShopStage(ShopStageEnum.SHOP_STAGE_1.getShopStage()); - shopInfoDO.setPartnerId(partnerId); + shopInfoDO.setPartnerId(lineInfo.getPartnerId()); shopInfoDO.setFranchiseBrand(request.getFranchiseBrand()); return shopInfoDO; } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java index c1581ffa5..98d095650 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java @@ -261,18 +261,11 @@ public class ShopServiceImpl implements ShopService { if (lineInfo.getWorkflowSubStageStatus() < WorkflowSubStageStatusEnum.PAY_DEPOSIT_45.getCode()) { throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE); } - ShopInfoDO shopInfoDO = request.toDO(request, lineInfo.getPartnerId()); + ShopInfoDO shopInfoDO = request.toDO(request, lineInfo); List shopList = shopInfoDAO.getShopList(lineInfo.getId()); if (CollectionUtils.isNotEmpty(shopList)) { - if (StringUtils.isBlank(request.getShopName())) { - shopInfoDO.setShopName("店铺" + NumberConverter.convertArabicToChinese(lineInfo.getWantShopNum()+1)); - } lineInfo.setWantShopNum(lineInfo.getWantShopNum() + 1); lineInfoDAO.updateLineInfo(lineInfo); - }else { - if (StringUtils.isBlank(request.getShopName())) { - shopInfoDO.setShopName("店铺" + NumberConverter.convertArabicToChinese(lineInfo.getWantShopNum())); - } } shopInfoDO.setCreateUserId(userId); Long shopId = shopInfoDAO.addShopInfo(shopInfoDO);