feat:addBranchShop
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<ShopInfoDO> 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);
|
||||
|
||||
Reference in New Issue
Block a user