多店铺需求

This commit is contained in:
Tankaikai
2025-04-09 16:11:20 +08:00
parent aa884dbab8
commit 80537e4bcd

View File

@@ -256,15 +256,24 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
String shopType = shopInfo.getShopType();
Long mainId = shopInfo.getMainId();
Integer isHeadShop = shopInfo.getIsHeadShop();
// 禁止加盟店/连锁店修改为单店
if (!shopType.equals(shopInfoEditDTO.getShopType())) {
shopInfoEditDTO.setShopType(shopType);
}
if (!isHeadShop.equals(shopInfoEditDTO.getIsHeadShop())) {
shopInfoEditDTO.setIsHeadShop(isHeadShop);
}
if (mainId != null && !mainId.equals(shopInfoEditDTO.getMainId())) {
shopInfoEditDTO.setMainId(mainId);
// 原来是单店,现在不是单店,那么就允许修改,否则不允许修改
if (ShopTypeEnum.ONLY.equals(shopType) && !ShopTypeEnum.ONLY.getValue().equals(shopInfoEditDTO.getShopType())) {
if (shopInfoEditDTO.getIsHeadShop() == null) {
throw new CzgException("加盟店/连锁店请选择是否主店");
}
if (shopInfoEditDTO.getIsHeadShop() == YesNoEnum.NO.value() && shopInfoEditDTO.getMainId() == null) {
throw new CzgException("请选择一个店铺做为主店");
}
if (shopInfoEditDTO.getIsHeadShop() == YesNoEnum.YES.value()) {
if (mainId != null) {
throw new CzgException("数据错误:当前店铺是非主店,不允许随意切换为主店");
}
}
if (isHeadShop == YesNoEnum.YES.value() && shopInfoEditDTO.getIsHeadShop() == YesNoEnum.NO.value()) {
throw new CzgException("数据错误:当前店铺是主店,不允许随意切换为非主店");
}
} else {
throw new CzgException("禁止连锁店/加盟店修改为单店");
}
if (shopInfoEditDTO.getActivateCode() != null) {
activateShop(shopInfo, shopInfoEditDTO.getActivateCode());