店铺删除逻辑新增判断(产品更改后所有店铺不允许删除)
This commit is contained in:
@@ -19,8 +19,4 @@ public class AddShopRequest {
|
|||||||
@ApiModelProperty("线索id")
|
@ApiModelProperty("线索id")
|
||||||
private Long lineId;
|
private Long lineId;
|
||||||
|
|
||||||
@NotBlank
|
|
||||||
@ApiModelProperty("店铺名称")
|
|
||||||
private String shopName;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.service.impl;
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.dao.*;
|
import com.cool.store.dao.*;
|
||||||
import com.cool.store.entity.*;
|
import com.cool.store.entity.*;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
@@ -94,6 +95,10 @@ public class ShopServiceImpl implements ShopService {
|
|||||||
@Override
|
@Override
|
||||||
public Integer deleteShop(DeleteShopRequest request) {
|
public Integer deleteShop(DeleteShopRequest request) {
|
||||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
||||||
|
if(Objects.nonNull(shopInfo)){
|
||||||
|
//进入选址不允许删除操作
|
||||||
|
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
|
||||||
|
}
|
||||||
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopInfo.getId(), ShopSubStageEnum.SHOP_STAGE_3);
|
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopInfo.getId(), ShopSubStageEnum.SHOP_STAGE_3);
|
||||||
if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
|
if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
|
||||||
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
|
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
|
||||||
@@ -117,10 +122,15 @@ public class ShopServiceImpl implements ShopService {
|
|||||||
if(Objects.isNull(lineInfo)){
|
if(Objects.isNull(lineInfo)){
|
||||||
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
|
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(request.getLineId());
|
||||||
|
LineInfoDO updateLine = new LineInfoDO();
|
||||||
|
updateLine.setId(request.getLineId());
|
||||||
|
updateLine.setWantShopNum(shopList.size() + CommonConstants.ONE);
|
||||||
|
lineInfoDAO.updateLineInfo(updateLine);
|
||||||
ShopInfoDO addShop = new ShopInfoDO();
|
ShopInfoDO addShop = new ShopInfoDO();
|
||||||
addShop.setLineId(request.getLineId());
|
addShop.setLineId(request.getLineId());
|
||||||
addShop.setPartnerId(lineInfo.getPartnerId());
|
addShop.setPartnerId(lineInfo.getPartnerId());
|
||||||
addShop.setShopName(request.getShopName());
|
addShop.setShopName("店铺"+ NumberConverter.convertArabicToChinese(updateLine.getWantShopNum()));
|
||||||
return shopInfoDAO.addShopInfo(addShop);
|
return shopInfoDAO.addShopInfo(addShop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.cool.store.controller.webb;
|
package com.cool.store.controller.webb;
|
||||||
|
|
||||||
import com.cool.store.context.PartnerUserHolder;
|
|
||||||
import com.cool.store.request.AddShopRequest;
|
import com.cool.store.request.AddShopRequest;
|
||||||
import com.cool.store.request.DeleteShopRequest;
|
import com.cool.store.request.DeleteShopRequest;
|
||||||
import com.cool.store.response.ResponseResult;
|
import com.cool.store.response.ResponseResult;
|
||||||
|
|||||||
Reference in New Issue
Block a user