删除 yes or no 枚举
This commit is contained in:
@@ -7,7 +7,7 @@ import com.czg.account.service.HandoverRecordService;
|
||||
import com.czg.account.vo.HandoverProductListVo;
|
||||
import com.czg.account.vo.HandoverTotalVo;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
@@ -103,7 +103,7 @@ public class HandoverRecordController {
|
||||
@OperationLog("收银机-交班/关班-网络打印机打印交班小票")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:networkPrint", name = "收银机-交班/关班-网络打印机打印交班小票")
|
||||
public CzgResult<Void> handover(@PathVariable Long id) {
|
||||
handoverRecordService.printHandoverReceipt(id, YesNoEnum.YES.value());
|
||||
handoverRecordService.printHandoverReceipt(id, SystemConstants.OneZero.ONE);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.product.param.ShopProductSkuParam;
|
||||
import com.czg.product.service.UProductService;
|
||||
import com.czg.product.vo.ShopGroupProductVo;
|
||||
@@ -63,7 +63,7 @@ public class UProductController {
|
||||
item.getProductList().forEach(prod -> {
|
||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getIsSaleTime(), item.getUseTime(), item.getSaleStartTime(), item.getSaleEndTime()));
|
||||
if (item.getUseTime() == YesNoEnum.YES.value()) {
|
||||
if (item.getUseTime() == SystemConstants.OneZero.ONE) {
|
||||
prod.setStartTime(item.getSaleStartTime());
|
||||
prod.setEndTime(item.getSaleEndTime());
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ public interface SystemConstants {
|
||||
* 是否:是
|
||||
* 状态:允许,开启
|
||||
*/
|
||||
public static final Integer ONE = 1;
|
||||
public static final int ONE = 1;
|
||||
/**
|
||||
* 是否:否
|
||||
* 状态:进制,关闭
|
||||
*/
|
||||
public static final Integer ZERO = 0;
|
||||
public static final int ZERO = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.czg.enums;
|
||||
|
||||
/**
|
||||
* 是否枚举
|
||||
* @author tankaikai
|
||||
* @since 2025-02-11 14:56
|
||||
*/
|
||||
public enum YesNoEnum {
|
||||
/**
|
||||
* 是(删除)
|
||||
*/
|
||||
YES(1),
|
||||
/**
|
||||
* 否(未删除)
|
||||
*/
|
||||
NO(0);
|
||||
|
||||
private int value;
|
||||
|
||||
YesNoEnum(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -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("登录账号无权限切换");
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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())) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -4,10 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.TimeQueryParam;
|
||||
import com.czg.account.entity.PictureClassify;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.market.dto.MkLimitTimeDiscountDTO;
|
||||
import com.czg.market.entity.MkLimitTimeDiscount;
|
||||
@@ -29,7 +26,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 限时折扣 服务层实现。
|
||||
|
||||
@@ -127,7 +127,7 @@ public class PpPackageServiceImpl extends ServiceImpl<PpPackageMapper, PpPackage
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean updateOnlineStatus(Long id, Integer onlineStatus) {
|
||||
if (!SystemConstants.OneZero.ZERO.equals(onlineStatus) && !SystemConstants.OneZero.ONE.equals(onlineStatus)) {
|
||||
if (SystemConstants.OneZero.ZERO != onlineStatus && SystemConstants.OneZero.ONE != onlineStatus) {
|
||||
throw new CzgException("参数错误");
|
||||
}
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
@@ -138,7 +138,7 @@ public class PpPackageServiceImpl extends ServiceImpl<PpPackageMapper, PpPackage
|
||||
throw new RuntimeException("无权限");
|
||||
}
|
||||
|
||||
if (SystemConstants.OneZero.ZERO.equals(onlineStatus)) {
|
||||
if (SystemConstants.OneZero.ZERO == onlineStatus) {
|
||||
cancelProgressingPackageOrder(StpKit.USER.getShopId(), id);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class PpPackageServiceImpl extends ServiceImpl<PpPackageMapper, PpPackage
|
||||
|
||||
// 如果没有开启操作,直接返回空数据
|
||||
ShopConfig shopConfig = shopConfigService.getById(shopId);
|
||||
if (SystemConstants.OneZero.ZERO.equals(shopConfig.getIsPackagePromotion())) {
|
||||
if (SystemConstants.OneZero.ZERO == shopConfig.getIsPackagePromotion()) {
|
||||
return new Page<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.config.RabbitPublisher;
|
||||
import com.czg.constant.MarketConstants;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.enums.OrderNoPrefixEnum;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.market.entity.GbWare;
|
||||
import com.czg.market.service.GbWareService;
|
||||
@@ -205,7 +205,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
record.setPayAmount(param.getPrice());
|
||||
record.setStatus("待支付");
|
||||
record.setOrderNo(CzgRandomUtils.randomNumber(OrderNoPrefixEnum.GBO, 12, false));
|
||||
record.setIsDel(YesNoEnum.YES.value());
|
||||
record.setIsDel(SystemConstants.OneZero.ONE);
|
||||
detailService.save(record);
|
||||
param.setRecordId(record.getId());
|
||||
CzgResult<Map<String, Object>> result = CzgResult.success();
|
||||
@@ -223,7 +223,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
@Override
|
||||
public boolean checkout(String verifyCode, Long shopId) {
|
||||
GbOrderDetail record = detailService.getOne(query()
|
||||
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value())
|
||||
.eq(GbOrderDetail::getIsDel, SystemConstants.OneZero.ZERO)
|
||||
.eq(GbOrderDetail::getVerifyCode, verifyCode)
|
||||
.eq(GbOrderDetail::getShopId, shopId));
|
||||
if (record == null) {
|
||||
@@ -252,7 +252,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
log.error("积分兑换商品发放失败,记录不存在");
|
||||
return;
|
||||
}
|
||||
record.setIsDel(YesNoEnum.NO.value());
|
||||
record.setIsDel(SystemConstants.OneZero.ZERO);
|
||||
record.setStatus("待成团");
|
||||
record.setPayOrderId(payOrderId);
|
||||
record.setPayTime(LocalDateTime.now());
|
||||
@@ -311,7 +311,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
detailService.update(upRecord, query()
|
||||
.eq(GbOrderDetail::getGroupOrderNo, order.getGroupOrderNo())
|
||||
.eq(GbOrderDetail::getShopId, order.getShopId())
|
||||
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value())
|
||||
.eq(GbOrderDetail::getIsDel, SystemConstants.OneZero.ZERO)
|
||||
.eq(GbOrderDetail::getStatus, "待成团")
|
||||
);
|
||||
//推送 拼团成功
|
||||
@@ -325,7 +325,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
@Override
|
||||
public boolean applyRefund(CommonRefundDTO param, Long userId) {
|
||||
GbOrderDetail record = detailService.getOne(query()
|
||||
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value())
|
||||
.eq(GbOrderDetail::getIsDel, SystemConstants.OneZero.ZERO)
|
||||
.eq(GbOrderDetail::getId, param.getRecordId())
|
||||
.eq(GbOrderDetail::getUserId, userId));
|
||||
AssertUtil.isNull(record, "记录不存在");
|
||||
@@ -352,7 +352,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
public boolean cancelRefund(CommonRefundDTO param, Long userId, Long shopId) {
|
||||
GbOrderDetail record = detailService.getOne(query()
|
||||
.eq(GbOrderDetail::getId, param.getRecordId())
|
||||
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value())
|
||||
.eq(GbOrderDetail::getIsDel, SystemConstants.OneZero.ZERO)
|
||||
.eq(GbOrderDetail::getUserId, userId));
|
||||
AssertUtil.isNull(record, "取消失败,订单不存在");
|
||||
if (!"退款中".equals(record.getStatus())) {
|
||||
@@ -387,7 +387,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
@Override
|
||||
public boolean agreeRefund(CommonRefundDTO param, Long shopId) {
|
||||
GbOrderDetail record = detailService.getOne(QueryWrapper.create()
|
||||
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value())
|
||||
.eq(GbOrderDetail::getIsDel, SystemConstants.OneZero.ZERO)
|
||||
.eq(GbOrderDetail::getId, param.getRecordId())
|
||||
.eq(GbOrderDetail::getShopId, shopId));
|
||||
AssertUtil.isNull(record, "退款失败,订单不存在");
|
||||
@@ -450,7 +450,7 @@ public class GbOrderServiceImpl extends ServiceImpl<GbOrderMapper, GbOrder> impl
|
||||
.eq(GbOrderDetail::getShopId, gbOrder.getShopId())
|
||||
.eq(GbOrderDetail::getGroupOrderNo, gbOrder.getGroupOrderNo())
|
||||
.ne(GbOrderDetail::getStatus, "已退款")
|
||||
.eq(GbOrderDetail::getIsDel, YesNoEnum.NO.value()));
|
||||
.eq(GbOrderDetail::getIsDel, SystemConstants.OneZero.ZERO));
|
||||
details.forEach(item -> FunUtils.safeRunVoid(() -> refundAmount(item, reason), "订单详情{}退款失败", item.getId()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.service.SyncNoticeService;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.enums.CrudEnum;
|
||||
import com.czg.enums.StatusEnum;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.ConsInfoDTO;
|
||||
import com.czg.product.dto.ProductBriefDTO;
|
||||
@@ -126,7 +126,7 @@ public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> i
|
||||
entity.setStockNumber(BigDecimal.ZERO);
|
||||
entity.setStatus(StatusEnum.ENABLED.value());
|
||||
//entity.setConWarning(BigDecimal.ZERO);
|
||||
entity.setIsStock(YesNoEnum.NO.value());
|
||||
entity.setIsStock(SystemConstants.OneZero.ZERO);
|
||||
entity.setShopId(shopId);
|
||||
super.save(entity);
|
||||
dto.setId(entity.getId());
|
||||
|
||||
@@ -8,7 +8,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.config.RabbitPublisher;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.product.dto.ProductStockSubtractDTO;
|
||||
import com.czg.product.entity.*;
|
||||
import com.czg.product.enums.InOutItemEnum;
|
||||
@@ -78,7 +78,7 @@ public class ProductRpcServiceImpl implements ProductRpcService {
|
||||
continue;
|
||||
}
|
||||
// 商品未开启库存
|
||||
if (product.getIsStock() == YesNoEnum.NO.value()) {
|
||||
if (product.getIsStock() == SystemConstants.OneZero.ZERO) {
|
||||
continue;
|
||||
}
|
||||
productMapper.updateProductStockNum(dto.getProductId(), dto.getShopId(), "sub", dto.getNum());
|
||||
@@ -245,11 +245,11 @@ public class ProductRpcServiceImpl implements ProductRpcService {
|
||||
Product product = productMapper.selectOneById(dto.getProductId());
|
||||
log.info(">>>>>>>>>>>>>>>>>:入参2:{}", product.getName());
|
||||
// 商品是否允许退款退货时归还库存
|
||||
if (product.getIsRefundStock() == YesNoEnum.NO.value()) {
|
||||
if (SystemConstants.OneZero.ZERO == product.getIsRefundStock()) {
|
||||
continue;
|
||||
}
|
||||
// 商品未开启库存
|
||||
if (product.getIsStock() == YesNoEnum.NO.value()) {
|
||||
if (SystemConstants.OneZero.ZERO == product.getIsStock()) {
|
||||
continue;
|
||||
}
|
||||
log.info(">>>>>>>>>>>>>>>>>:入参3:{}", product.getName());
|
||||
|
||||
@@ -8,8 +8,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.czg.constant.CacheConstant;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.enums.DeleteEnum;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.ProdConsRelationDTO;
|
||||
import com.czg.product.dto.ProdSkuDTO;
|
||||
@@ -104,12 +104,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
}
|
||||
if (StrUtil.isNotEmpty(param.getStatus())) {
|
||||
if (ProductSaleStatusEnum.SOLD_OUT.getValue().equals(param.getStatus())) {
|
||||
queryWrapper.eq(Product::getIsSoldStock, YesNoEnum.YES.value());
|
||||
queryWrapper.eq(Product::getIsSoldStock, SystemConstants.OneZero.ONE);
|
||||
} else if (ProductSaleStatusEnum.ON_SALE.getValue().equals(param.getStatus())) {
|
||||
queryWrapper.eq(Product::getIsSoldStock, YesNoEnum.NO.value());
|
||||
queryWrapper.eq(Product::getIsSale, YesNoEnum.YES.value());
|
||||
queryWrapper.eq(Product::getIsSoldStock, SystemConstants.OneZero.ZERO);
|
||||
queryWrapper.eq(Product::getIsSale, SystemConstants.OneZero.ONE);
|
||||
} else if (ProductSaleStatusEnum.OFF_SALE.getValue().equals(param.getStatus())) {
|
||||
queryWrapper.eq(Product::getIsSale, YesNoEnum.NO.value());
|
||||
queryWrapper.eq(Product::getIsSale, SystemConstants.OneZero.ZERO);
|
||||
}
|
||||
}
|
||||
if (param.getShopId() == null) {
|
||||
@@ -172,7 +172,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
@Override
|
||||
public List<ProductDTO> getProductList(ProductDTO param) {
|
||||
QueryWrapper queryWrapper = buildFullQueryWrapper(param);
|
||||
//queryWrapper.eq(Product::getIsSale, YesNoEnum.YES.value());
|
||||
//queryWrapper.eq(Product::getIsSale, SystemConstants.OneZero.ONE);
|
||||
List<ProductDTO> records = super.listAs(queryWrapper, ProductDTO.class);
|
||||
buildProductExtInfo(records);
|
||||
return records;
|
||||
@@ -274,15 +274,15 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
*/
|
||||
private 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,14 +349,14 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
prodSku.setShopId(entity.getShopId());
|
||||
prodSku.setProductId(entity.getId());
|
||||
prodSku.setRealSalesNumber(BigDecimal.ZERO);
|
||||
prodSku.setIsPauseSale(YesNoEnum.NO.value());
|
||||
prodSku.setIsGrounding(YesNoEnum.YES.value());
|
||||
prodSku.setIsPauseSale(SystemConstants.OneZero.ZERO);
|
||||
prodSku.setIsGrounding(SystemConstants.OneZero.ONE);
|
||||
prodSku.setIsDel(DeleteEnum.NORMAL.value());
|
||||
prodSkuList.add(prodSku);
|
||||
}
|
||||
prodSkuMapper.insertBatch(prodSkuList);
|
||||
}
|
||||
if (entity.getIsStock() == YesNoEnum.NO.value()) {
|
||||
if (entity.getIsStock() == SystemConstants.OneZero.ZERO) {
|
||||
return;
|
||||
}
|
||||
// 记录商品库存流水
|
||||
@@ -411,7 +411,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
if (!old.getCategoryId().equals(dto.getCategoryId())) {
|
||||
clearProductCache(entity.getCategoryId());
|
||||
}
|
||||
if (ObjUtil.defaultIfNull(dto.getIsStock(), old.getIsStock()) == YesNoEnum.NO.value()) {
|
||||
if (ObjUtil.defaultIfNull(dto.getIsStock(), old.getIsStock()) == SystemConstants.OneZero.ZERO) {
|
||||
redisService.del(StrUtil.format(CacheConstant.SHOP_PRODUCT_STOCK, shopId, dto.getId()));
|
||||
Boolean b = redisService.hasKey(StrUtil.format(CacheConstant.SHOP_PRODUCT_STOCK, shopId, dto.getId()));
|
||||
log.info("删除商品库存缓存:{}-{}", dto.getId(), b);
|
||||
@@ -430,8 +430,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
prodSku.setShopId(entity.getShopId());
|
||||
prodSku.setProductId(entity.getId());
|
||||
prodSku.setRealSalesNumber(BigDecimal.ZERO);
|
||||
prodSku.setIsPauseSale(YesNoEnum.NO.value());
|
||||
prodSku.setIsGrounding(YesNoEnum.YES.value());
|
||||
prodSku.setIsPauseSale(SystemConstants.OneZero.ZERO);
|
||||
prodSku.setIsGrounding(SystemConstants.OneZero.ONE);
|
||||
prodSku.setIsDel(DeleteEnum.NORMAL.value());
|
||||
prodSkuMapper.insert(prodSku);
|
||||
} else {
|
||||
@@ -450,7 +450,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
if (entity.getIsStock() == YesNoEnum.NO.value()) {
|
||||
if (entity.getIsStock() == SystemConstants.OneZero.ZERO) {
|
||||
return;
|
||||
}
|
||||
// 记录商品库存流水
|
||||
@@ -488,7 +488,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateProductStock(ProductModifyStockParam param) {
|
||||
Product entity = super.getById(param.getId());
|
||||
if (entity.getIsStock() == YesNoEnum.NO.value()) {
|
||||
if (entity.getIsStock() == SystemConstants.OneZero.ZERO) {
|
||||
throw new CzgException("该商品未开启库存管理,暂不支持修改库存");
|
||||
}
|
||||
if (!entity.getShopId().equals(param.getShopId())) {
|
||||
@@ -571,7 +571,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
prodSkuMapper.update(prodSku);
|
||||
long normalCount = prodSkuMapper.selectCountByQuery(QueryWrapper.create()
|
||||
.eq(ProdSku::getProductId, prodSku.getProductId())
|
||||
.eq(ProdSku::getIsGrounding, YesNoEnum.NO.value())
|
||||
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ZERO)
|
||||
.eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value())
|
||||
);
|
||||
if (normalCount == 0) {
|
||||
@@ -625,7 +625,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
prodSkuMapper.update(prodSku);
|
||||
long normalCount = prodSkuMapper.selectCountByQuery(QueryWrapper.create()
|
||||
.eq(ProdSku::getProductId, prodSku.getProductId())
|
||||
.eq(ProdSku::getIsPauseSale, YesNoEnum.NO.value())
|
||||
.eq(ProdSku::getIsPauseSale, SystemConstants.OneZero.ZERO)
|
||||
.eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value())
|
||||
);
|
||||
if (normalCount == 0) {
|
||||
@@ -685,7 +685,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
if (product == null) {
|
||||
throw new CzgException("商品不存在");
|
||||
}
|
||||
if (product.getIsStock() == YesNoEnum.NO.value()) {
|
||||
if (product.getIsStock() == SystemConstants.OneZero.ZERO) {
|
||||
throw new CzgException("商品未开启库存不支持报损操作");
|
||||
}
|
||||
// 商品现有库存数量
|
||||
@@ -761,7 +761,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
if (InOutItemEnum.ORDER_IN.value().equals(param.getInOutItem())) {
|
||||
param.setInOutType(InOutTypeEnum.OUT.value());
|
||||
param.setInOutItem(InOutItemEnum.ORDER_OUT.value());
|
||||
param.setIsGreaterZero(YesNoEnum.YES.value());
|
||||
param.setIsGreaterZero(SystemConstants.OneZero.ONE);
|
||||
}
|
||||
return PageUtil.convert(new PageInfo<>(productStockFlowMapper.getProductStockFlowList(param)));
|
||||
}
|
||||
@@ -777,7 +777,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
Map<Long, Integer> stock = list.stream().collect(Collectors.toMap(Product::getId, Product::getStockNumber));
|
||||
records.parallelStream().forEach(record -> {
|
||||
record.setStockNumber(stock.getOrDefault(record.getId(), 0));
|
||||
if (record.getIsStock() == YesNoEnum.YES.value()) {
|
||||
if (record.getIsStock() == SystemConstants.OneZero.ONE) {
|
||||
refreshRedisStock(record.getShopId(), record.getId(), record.getStockNumber());
|
||||
} else {
|
||||
redisService.del(StrUtil.format(CacheConstant.SHOP_PRODUCT_STOCK, record.getShopId(), record.getId()));
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.czg.service.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.enums.StatusEnum;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.ShopProdUnitDTO;
|
||||
import com.czg.product.entity.ShopProdUnit;
|
||||
@@ -40,7 +40,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
||||
q1.eq(ShopProdUnit::getShopId, 1L);
|
||||
}).or(q2 -> {
|
||||
q2.eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
||||
q2.eq(ShopProdUnit::getIsSystem, SystemConstants.OneZero.ONE);
|
||||
});
|
||||
});
|
||||
queryWrapper.orderBy(ShopProdUnit::getId, false);
|
||||
@@ -74,7 +74,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
||||
q1.eq(ShopProdUnit::getShopId, 1L);
|
||||
}).or(q2 -> {
|
||||
q2.eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
||||
q2.eq(ShopProdUnit::getIsSystem, SystemConstants.OneZero.ONE);
|
||||
});
|
||||
}));
|
||||
if (exists) {
|
||||
@@ -84,7 +84,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
// 单位类型 number-计数 weight-记重
|
||||
entity.setUnitType(UnitTypeEnum.NUMBER.value());
|
||||
// 单位来源 1-系统预设 0-商家创建
|
||||
entity.setIsSystem(YesNoEnum.NO.value());
|
||||
entity.setIsSystem(SystemConstants.OneZero.ZERO);
|
||||
entity.setStatus(StatusEnum.ENABLED.value());
|
||||
entity.setShopId(shopId);
|
||||
super.save(entity);
|
||||
@@ -102,7 +102,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
||||
q1.eq(ShopProdUnit::getShopId, 1L);
|
||||
}).or(q2 -> {
|
||||
q2.eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
||||
q2.eq(ShopProdUnit::getIsSystem, SystemConstants.OneZero.ONE);
|
||||
});
|
||||
})
|
||||
);
|
||||
@@ -148,7 +148,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
if (entity == null) {
|
||||
throw new CzgException("单位信息不存在");
|
||||
}
|
||||
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
||||
if (SystemConstants.OneZero.ONE == entity.getIsSystem()) {
|
||||
throw new CzgException("系统预设单位不可操作");
|
||||
}
|
||||
if (!shopId.equals(entity.getShopId())) {
|
||||
|
||||
@@ -7,9 +7,9 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.constant.CacheConstant;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.enums.DeleteEnum;
|
||||
import com.czg.enums.StatusEnum;
|
||||
import com.czg.enums.YesNoEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.ProdGroupRelationDTO;
|
||||
import com.czg.product.dto.ProdSkuDTO;
|
||||
@@ -66,7 +66,7 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
list.forEach(item -> {
|
||||
List<ProdSkuDTO> skuList = prodSkuMapper.selectListByQueryAs(query()
|
||||
.eq(ProdSku::getProductId, item.getId())
|
||||
.eq(ProdSku::getIsGrounding, YesNoEnum.YES.value())
|
||||
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ONE)
|
||||
.eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value()), ProdSkuDTO.class);
|
||||
item.setSkuList(skuList);
|
||||
});
|
||||
@@ -84,7 +84,7 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
productAllList.forEach(item -> {
|
||||
List<ProdSkuDTO> skuList = prodSkuMapper.selectListByQueryAs(query()
|
||||
.eq(ProdSku::getProductId, item.getId())
|
||||
.eq(ProdSku::getIsGrounding, YesNoEnum.YES.value())
|
||||
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ONE)
|
||||
.eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value()), ProdSkuDTO.class);
|
||||
item.setSkuList(skuList);
|
||||
});
|
||||
@@ -147,7 +147,7 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
query().eq(ProdSku::getProductId, param.getId())
|
||||
.eq(ProdSku::getShopId, shopId)
|
||||
.eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value())
|
||||
.eq(ProdSku::getIsGrounding, YesNoEnum.YES.value())
|
||||
.eq(ProdSku::getIsGrounding, SystemConstants.OneZero.ONE)
|
||||
.eq(ProdSku::getSpecInfo, specInfo)
|
||||
, ShopProductSkuInfoVo.class);
|
||||
// throw new CzgException("商品SKU不可售或不存在");
|
||||
@@ -189,7 +189,7 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
}
|
||||
productList.parallelStream().forEach(record -> {
|
||||
record.setStockNumber(productStock.getOrDefault(record.getId(), 0));
|
||||
if (record.getIsStock() == YesNoEnum.YES.value()) {
|
||||
if (record.getIsStock() == SystemConstants.OneZero.ONE) {
|
||||
refreshRedisStock(record.getShopId(), record.getId(), record.getStockNumber());
|
||||
} else {
|
||||
redisService.del(StrUtil.format(CacheConstant.SHOP_PRODUCT_STOCK, record.getShopId(), record.getId()));
|
||||
@@ -213,7 +213,7 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
@Override
|
||||
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, ",");
|
||||
@@ -230,9 +230,9 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
}
|
||||
}
|
||||
if(isSaleTime && inDays){
|
||||
return YesNoEnum.YES.value();
|
||||
return SystemConstants.OneZero.ONE;
|
||||
}
|
||||
return YesNoEnum.NO.value();
|
||||
return SystemConstants.OneZero.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,19 +249,19 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||
return prodIsSaleTime;
|
||||
}
|
||||
if (ObjUtil.isNull(startTime) || ObjUtil.isNull(endTime)) {
|
||||
return YesNoEnum.NO.value();
|
||||
return SystemConstants.OneZero.ZERO;
|
||||
}
|
||||
LocalTime now = LocalTime.now().withNano(0);
|
||||
if (startTime.isBefore(endTime)) {
|
||||
if (now.isAfter(startTime) && now.isBefore(endTime)) {
|
||||
return YesNoEnum.YES.value();
|
||||
return SystemConstants.OneZero.ONE;
|
||||
}
|
||||
} else {
|
||||
if (now.isAfter(startTime) || now.isBefore(endTime)) {
|
||||
return YesNoEnum.YES.value();
|
||||
return SystemConstants.OneZero.ONE;
|
||||
}
|
||||
}
|
||||
return YesNoEnum.NO.value();
|
||||
return SystemConstants.OneZero.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user