门店编码重复校验
This commit is contained in:
@@ -342,4 +342,10 @@ public class ShopInfoDAO {
|
||||
public Integer getNumByShopCode(String shopCode){
|
||||
return shopInfoMapper.getNumByShopCode(shopCode);
|
||||
}
|
||||
|
||||
public List<ShopInfoDO> getShopListByShopCode(String shopCode){
|
||||
Example example = new Example(ShopInfoDO.class);
|
||||
example.createCriteria().andEqualTo("shopCode", shopCode);
|
||||
return shopInfoMapper.selectByExample(example);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,4 +134,10 @@ public interface ShopService {
|
||||
List<UserDTO> getSubStageHandle(Long shopId,Integer subStage);
|
||||
|
||||
ShopStageInfoVO getShopStageStatus(Long shopId, Integer subStage);
|
||||
/**
|
||||
* @Auther: wangshuo
|
||||
* @Date: 2025/8/4
|
||||
* @description: 校验门店编码重复
|
||||
*/
|
||||
Boolean checkShopCodeRepeat(String shopCode,Long shopId);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ import static com.cool.store.enums.point.ShopSubStageStatusEnum.*;
|
||||
@Service
|
||||
public class OrderSysInfoServiceImpl implements OrderSysInfoService {
|
||||
|
||||
@Resource
|
||||
private ShopService shopService;
|
||||
@Resource
|
||||
private HqtAPIService hqtAPIService;
|
||||
@Resource
|
||||
@@ -132,6 +134,10 @@ public class OrderSysInfoServiceImpl implements OrderSysInfoService {
|
||||
}
|
||||
}
|
||||
if (request.getType().equals(OrderSysTypeEnum.ORDER_SYS_TYPE_2.getType())) {
|
||||
//检验门店编码是否重复
|
||||
if(shopService.checkShopCodeRepeat(request.getShopCode(), request.getShopId())){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_CODE_EXIST);
|
||||
}
|
||||
shopInfoDAO.updateShopCode(request.getShopCode(), request.getShopId());
|
||||
orderSysInfoDO.setReceivingFirmName(request.getReceivingFirmName());
|
||||
orderSysInfoDO.setReceivingMsBankAccount(request.getReceivingMsBankAccount());
|
||||
|
||||
@@ -308,6 +308,10 @@ public class ShopServiceImpl implements ShopService {
|
||||
|
||||
@Override
|
||||
public Integer updateShopCode(UpdateShopCodeRequest request, String userId) {
|
||||
//检验门店编码是否重复
|
||||
if(this.checkShopCodeRepeat(request.getShopCode(), request.getShopId())){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_CODE_EXIST);
|
||||
}
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
if (Objects.isNull(shopInfo)) {
|
||||
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
|
||||
@@ -429,6 +433,10 @@ public class ShopServiceImpl implements ShopService {
|
||||
|
||||
@Override
|
||||
public Integer updateBranchShopDetail(BranchShopDetailRequest request, String userId) {
|
||||
//检验门店编码是否重复
|
||||
if(this.checkShopCodeRepeat(request.getShopCode(), request.getShopId())){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_CODE_EXIST);
|
||||
}
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
shopInfo.setUpdateUserId(userId);
|
||||
shopInfo.setUpdateTime(new Date());
|
||||
@@ -893,6 +901,22 @@ public class ShopServiceImpl implements ShopService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkShopCodeRepeat(String shopCode, Long shopId) {
|
||||
//false 未重复, true 重复
|
||||
List<ShopInfoDO> shopListByShopCode = shopInfoDAO.getShopListByShopCode(shopCode);
|
||||
if (CollectionUtils.isEmpty(shopListByShopCode)){
|
||||
return false;
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(shopListByShopCode)&&shopId ==null){
|
||||
return true;
|
||||
}
|
||||
if (shopListByShopCode.size() == 1 && shopListByShopCode.get(0).getId().equals(shopId)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取招商经理信息
|
||||
* @param
|
||||
|
||||
Reference in New Issue
Block a user