删除 yes or no 枚举

This commit is contained in:
gong
2025-12-18 20:38:33 +08:00
parent 47f28d7bbb
commit 8ea7ef8c50
18 changed files with 99 additions and 130 deletions

View File

@@ -11,9 +11,9 @@ import com.czg.account.enums.HandoverAccountTypeEnum;
import com.czg.account.service.*;
import com.czg.account.vo.LoginVO;
import com.czg.config.RedisCst;
import com.czg.constants.SystemConstants;
import com.czg.enums.PlatformTypeEnum;
import com.czg.enums.StatusEnum;
import com.czg.enums.YesNoEnum;
import com.czg.exception.CzgException;
import com.czg.sa.MyStpLogic;
import com.czg.sa.StpKit;
@@ -204,8 +204,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
Long headId = StpKit.USER.getHeadId();
long shopId = StpKit.USER.getLoginIdAsLong();
ShopInfo currentInfo = shopInfoService.getById(shopId);
// if (headId != null && currentInfo.getIsHeadShop() != YesNoEnum.YES.value()) {
if (currentInfo.getIsHeadShop() != YesNoEnum.YES.value()) {
// if (headId != null && currentInfo.getIsHeadShop() != SystemConstants.OneZero.ONE) {
if (currentInfo.getIsHeadShop() != SystemConstants.OneZero.ONE) {
throw new CzgException("登录账号无权限切换");
}

View File

@@ -12,7 +12,7 @@ import com.czg.account.service.HandoverRecordService;
import com.czg.account.vo.HandoverCategoryListVo;
import com.czg.account.vo.HandoverProductListVo;
import com.czg.account.vo.HandoverTotalVo;
import com.czg.enums.YesNoEnum;
import com.czg.constants.SystemConstants;
import com.czg.order.service.OrderInfoRpcService;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.HandoverRecordMapper;
@@ -142,7 +142,7 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
@Override
public void printHandoverReceipt(Long handoverRecordId, Integer isPrint) {
if (isPrint == YesNoEnum.YES.value()) {
if (isPrint == SystemConstants.OneZero.ONE) {
orderInfoRpcService.sendHandoverReceiptPrintMsgToMq(handoverRecordId);
}
}

View File

@@ -9,7 +9,7 @@ import com.czg.account.entity.PadProductCategory;
import com.czg.account.entity.PadProductCategoryDetail;
import com.czg.account.entity.ShopProdCategory;
import com.czg.account.service.*;
import com.czg.enums.YesNoEnum;
import com.czg.constants.SystemConstants;
import com.czg.exception.CzgException;
import com.czg.product.entity.ProdSku;
import com.czg.product.entity.Product;
@@ -73,15 +73,15 @@ public class PadProdServiceImpl implements PadProdService {
*/
public Integer calcIsSaleTime(String days, LocalTime startTime, LocalTime endTime) {
if (StrUtil.isBlank(days) || ObjUtil.isNull(startTime) || ObjUtil.isNull(endTime)) {
return YesNoEnum.NO.value();
return SystemConstants.OneZero.ZERO;
}
String today = getWeekDayEnName();
List<String> dayList = StrUtil.split(days, ",");
LocalTime now = LocalTime.now().withNano(0);
if (CollUtil.contains(dayList, today) && now.isAfter(startTime) && now.isBefore(endTime)) {
return YesNoEnum.YES.value();
return SystemConstants.OneZero.ONE;
}
return YesNoEnum.NO.value();
return SystemConstants.OneZero.ZERO;
}
/**

View File

@@ -5,8 +5,8 @@ import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.PictureClassifyDTO;
import com.czg.account.entity.PictureClassify;
import com.czg.account.service.PictureClassifyService;
import com.czg.constants.SystemConstants;
import com.czg.enums.DeleteEnum;
import com.czg.enums.YesNoEnum;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.PictureClassifyMapper;
@@ -37,7 +37,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
q1.eq(PictureClassify::getShopId, 1L);
}).or(q2 -> {
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
q2.eq(PictureClassify::getIsSystem, SystemConstants.OneZero.ONE);
});
});
queryWrapper.eq(PictureClassify::getIsDel, DeleteEnum.NORMAL.value());
@@ -60,7 +60,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
q1.eq(PictureClassify::getShopId, 1L);
}).or(q2 -> {
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
q2.eq(PictureClassify::getIsSystem, SystemConstants.OneZero.ONE);
});
})
);
@@ -68,7 +68,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
throw new CzgException("图片分类已存在");
}
PictureClassify entity = BeanUtil.copyProperties(dto, PictureClassify.class);
entity.setIsSystem(YesNoEnum.NO.value());
entity.setIsSystem(SystemConstants.OneZero.ZERO);
entity.setShopId(shopId);
super.save(entity);
}
@@ -84,7 +84,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
q1.eq(PictureClassify::getShopId, 1L);
}).or(q2 -> {
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
q2.eq(PictureClassify::getIsSystem, SystemConstants.OneZero.ONE);
});
})
);
@@ -92,7 +92,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
throw new CzgException("图片分类已存在");
}
PictureClassify entity = BeanUtil.copyProperties(dto, PictureClassify.class);
entity.setIsSystem(YesNoEnum.NO.value());
entity.setIsSystem(SystemConstants.OneZero.ZERO);
super.updateById(entity);
}
@@ -113,7 +113,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
if (entity == null) {
throw new CzgException("图片分类不存在");
}
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
if (entity.getIsSystem() == SystemConstants.OneZero.ONE) {
throw new CzgException("系统预设分类不可操作");
}
if (!shopId.equals(entity.getShopId())) {

View File

@@ -9,7 +9,7 @@ import com.czg.account.enums.BranchDataSyncMethodEnum;
import com.czg.account.enums.ShopTypeEnum;
import com.czg.account.param.ShopBranchParam;
import com.czg.account.service.ShopBranchService;
import com.czg.enums.YesNoEnum;
import com.czg.constants.SystemConstants;
import com.czg.exception.CzgException;
import com.czg.product.service.ShopSyncService;
import com.czg.sa.StpKit;
@@ -65,7 +65,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
if (ShopTypeEnum.ONLY.getValue().equals(shopInfo.getShopType())) {
throw new CzgException("单店不支持设置数据同步方式");
}
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), 0) == YesNoEnum.NO.value()) {
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), SystemConstants.OneZero.ZERO) == SystemConstants.OneZero.ZERO) {
throw new CzgException("非主店不能设置数据同步方式");
}
boolean contains = BranchDataSyncMethodEnum.checkValue(dataSyncMethod);
@@ -90,7 +90,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
if (ShopTypeEnum.ONLY.getValue().equals(shopInfo.getShopType())) {
throw new CzgException("数据错误:主店铺类型为单店");
}
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), 0) == YesNoEnum.NO.value()) {
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), 0) == SystemConstants.OneZero.ZERO) {
throw new CzgException("数据错误:当前店铺不是主店");
}
ShopInfo branchShop = shopInfoMapper.selectOneByQuery(QueryWrapper.create().eq(ShopInfo::getMainId, shopInfo.getId()).eq(ShopInfo::getId, branchShopId));
@@ -101,9 +101,9 @@ public class ShopBranchServiceImpl implements ShopBranchService {
throw new CzgException("数据错误:分店店铺类型错误");
}
ShopConfig branchConfig = shopConfigMapper.selectOneById(branchShop.getId());
branchConfig.setIsEnableProdSync(YesNoEnum.YES.value());
branchConfig.setIsEnableConsSync(YesNoEnum.YES.value());
branchConfig.setIsEnableVipSync(YesNoEnum.YES.value());
branchConfig.setIsEnableProdSync(SystemConstants.OneZero.ONE);
branchConfig.setIsEnableConsSync(SystemConstants.OneZero.ONE);
branchConfig.setIsEnableVipSync(SystemConstants.OneZero.ONE);
shopConfigMapper.update(branchConfig);
long sysUserId = StpKit.USER.getLoginIdAsLong();
ThreadUtil.execAsync(() -> {
@@ -129,7 +129,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
if (ShopTypeEnum.ONLY.getValue().equals(shopInfo.getShopType())) {
throw new CzgException("数据错误:主店铺类型为单店");
}
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), 0) == YesNoEnum.NO.value()) {
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), 0) == SystemConstants.OneZero.ZERO) {
throw new CzgException("数据错误:当前店铺不是主店");
}
ShopInfo branchShop = shopInfoMapper.selectOneByQuery(QueryWrapper.create().eq(ShopInfo::getMainId, shopInfo.getId()).eq(ShopInfo::getId, branchShopId));
@@ -140,7 +140,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
throw new CzgException("数据错误:分店店铺类型错误");
}
ShopConfig branchConfig = shopConfigMapper.selectOneById(branchShop.getId());
branchConfig.setIsAllowAccountLogin(YesNoEnum.YES.value());
branchConfig.setIsAllowAccountLogin(SystemConstants.OneZero.ONE);
shopConfigMapper.update(branchConfig);
}
@@ -158,7 +158,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
if (ShopTypeEnum.ONLY.getValue().equals(shopInfo.getShopType())) {
throw new CzgException("数据错误:主店铺类型为单店");
}
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), 0) == YesNoEnum.NO.value()) {
if (ObjUtil.defaultIfNull(shopInfo.getIsHeadShop(), 0) == SystemConstants.OneZero.ZERO) {
throw new CzgException("数据错误:当前店铺不是主店");
}
ShopInfo branchShop = shopInfoMapper.selectOneByQuery(QueryWrapper.create().eq(ShopInfo::getMainId, shopInfo.getId()).eq(ShopInfo::getId, branchShopId));
@@ -169,7 +169,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
throw new CzgException("数据错误:分店店铺类型错误");
}
ShopConfig branchConfig = shopConfigMapper.selectOneById(branchShop.getId());
branchConfig.setIsAllowAccountLogin(YesNoEnum.NO.value());
branchConfig.setIsAllowAccountLogin(SystemConstants.OneZero.ZERO);
shopConfigMapper.update(branchConfig);
}
@@ -182,7 +182,7 @@ public class ShopBranchServiceImpl implements ShopBranchService {
if (shopConfig.getMainId() == null) {
return true;
}
if (shopConfig.getIsAllowAccountLogin() == YesNoEnum.YES.value()) {
if (shopConfig.getIsAllowAccountLogin() == SystemConstants.OneZero.ONE) {
return true;
}
return false;

View File

@@ -13,9 +13,9 @@ import com.czg.account.enums.ShopTypeEnum;
import com.czg.account.service.*;
import com.czg.config.RabbitPublisher;
import com.czg.config.RedisCst;
import com.czg.constants.SystemConstants;
import com.czg.constants.ShopSwitchTypeEnum;
import com.czg.enums.StatusEnum;
import com.czg.enums.YesNoEnum;
import com.czg.exception.CzgException;
import com.czg.resp.CzgResult;
import com.czg.sa.MyStpLogic;
@@ -168,7 +168,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
public Boolean add(ShopInfoAddDTO shopInfoAddDTO) {
// 如果店铺类型是单店,是否主店要设为否
if (ShopTypeEnum.ONLY.getValue().equals(shopInfoAddDTO.getShopType())) {
shopInfoAddDTO.setIsHeadShop(YesNoEnum.YES.value());
shopInfoAddDTO.setIsHeadShop(SystemConstants.OneZero.ONE);
if (shopInfoAddDTO.getMainId() != null) {
throw new CzgException("单店不允许设置主店ID");
}
@@ -176,10 +176,10 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (shopInfoAddDTO.getIsHeadShop() == null) {
throw new CzgException("加盟店/连锁店请选择是否主店");
}
if (shopInfoAddDTO.getIsHeadShop() == YesNoEnum.NO.value() && shopInfoAddDTO.getMainId() == null) {
if (shopInfoAddDTO.getIsHeadShop() == SystemConstants.OneZero.ZERO && shopInfoAddDTO.getMainId() == null) {
throw new CzgException("请选择一个店铺做为主店");
}
if (shopInfoAddDTO.getIsHeadShop() == YesNoEnum.YES.value()) {
if (shopInfoAddDTO.getIsHeadShop() == SystemConstants.OneZero.ONE) {
shopInfoAddDTO.setMainId(null);
}
}
@@ -240,7 +240,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
shopConfig.setIsMemberPrice(0);
shopConfig.setIsAccountPay(0);
shopConfig.setBranchDataSyncMethod(null);
if (dto.getIsHeadShop() == YesNoEnum.YES.value()) {
if (dto.getIsHeadShop() == SystemConstants.OneZero.ONE) {
shopConfig.setBranchDataSyncMethod(BranchDataSyncMethodEnum.AUTO.getValue());
}
shopConfigService.save(shopConfig);
@@ -279,15 +279,15 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (shopInfoEditDTO.getIsHeadShop() == null) {
throw new CzgException("加盟店/连锁店请选择是否主店");
}
if (shopInfoEditDTO.getIsHeadShop() == YesNoEnum.NO.value() && shopInfoEditDTO.getMainId() == null) {
if (shopInfoEditDTO.getIsHeadShop() == SystemConstants.OneZero.ZERO && shopInfoEditDTO.getMainId() == null) {
throw new CzgException("请选择一个店铺做为主店");
}
if (shopInfoEditDTO.getIsHeadShop() == YesNoEnum.YES.value()) {
if (shopInfoEditDTO.getIsHeadShop() == SystemConstants.OneZero.ONE) {
if (mainId != null) {
throw new CzgException("数据错误:当前店铺是非主店,不允许随意切换为主店");
}
}
if (isHeadShop == YesNoEnum.YES.value() && shopInfoEditDTO.getIsHeadShop() == YesNoEnum.NO.value()) {
if (isHeadShop == SystemConstants.OneZero.ONE && shopInfoEditDTO.getIsHeadShop() == SystemConstants.OneZero.ZERO) {
throw new CzgException("数据错误:当前店铺是主店,不允许随意切换为非主店");
}
} else {