Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
2025-12-19 09:25:05 +08:00
31 changed files with 172 additions and 266 deletions

View File

@@ -11,9 +11,8 @@ 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;
@@ -108,7 +107,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
if (sysUser == null) {
throw new CzgException("登录账号不存在");
}
if ("WEB".equals(platType) && StatusEnum.DISABLE.value() == sysUser.getStatus()) {
if ("WEB".equals(platType) && SystemConstants.OneZero.ZERO == sysUser.getStatus()) {
throw new CzgException("账户未启用");
}
@@ -204,8 +203,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,7 @@ 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.enums.DeleteEnum;
import com.czg.enums.YesNoEnum;
import com.czg.constants.SystemConstants;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.PictureClassifyMapper;
@@ -37,10 +36,10 @@ 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());
queryWrapper.eq(PictureClassify::getIsDel, SystemConstants.OneZero.ZERO);
queryWrapper.orderBy(PictureClassify::getSort, true);
queryWrapper.orderBy(PictureClassify::getId, false);
return queryWrapper;
@@ -60,7 +59,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 +67,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 +83,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 +91,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);
}
@@ -101,7 +100,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
checkPictureClassify(id);
Long shopId = StpKit.USER.getShopId(0L);
UpdateChain.of(PictureClassify.class)
.set(PictureClassify::getIsDel, DeleteEnum.DELETED.value())
.set(PictureClassify::getIsDel, SystemConstants.OneZero.ONE)
.eq(PictureClassify::getShopId, shopId)
.eq(PictureClassify::getId, id)
.update();
@@ -113,7 +112,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

@@ -6,7 +6,7 @@ import com.czg.account.dto.PictureGalleryDTO;
import com.czg.account.entity.PictureGallery;
import com.czg.account.param.PictureGalleryParam;
import com.czg.account.service.PictureGalleryService;
import com.czg.enums.DeleteEnum;
import com.czg.constants.SystemConstants;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.PictureGalleryMapper;
@@ -41,7 +41,7 @@ public class PictureGalleryServiceImpl extends ServiceImpl<PictureGalleryMapper,
q1.eq(PictureGallery::getShopId, 1L);
});
});
queryWrapper.eq(PictureGallery::getIsDel, DeleteEnum.NORMAL.value());
queryWrapper.eq(PictureGallery::getIsDel, SystemConstants.OneZero.ZERO);
queryWrapper.orderBy(PictureGallery::getId, false);
return queryWrapper;
}
@@ -73,7 +73,7 @@ public class PictureGalleryServiceImpl extends ServiceImpl<PictureGalleryMapper,
throw new CzgException("公共图片不可操作");
}
UpdateChain.of(PictureGallery.class)
.set(PictureGallery::getIsDel, DeleteEnum.DELETED.value())
.set(PictureGallery::getIsDel, SystemConstants.OneZero.ONE)
.eq(PictureGallery::getShopId, shopId)
.eq(PictureGallery::getId, id)
.update();

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,8 @@ 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;
@@ -103,7 +102,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (shopInfo.getExpireTime() != null && (DateUtil.date().toLocalDateTime().isAfter(shopInfo.getExpireTime()))) {
throw new CzgException("店铺已过期,请联系商家");
}
if (StatusEnum.DISABLE.value() == shopInfo.getOnSale() || shopInfo.getStatus() != StatusEnum.ENABLED.value()) {
if (SystemConstants.OneZero.ZERO == shopInfo.getOnSale() || shopInfo.getStatus() !=SystemConstants.OneZero.ONE) {
throw new CzgException("店铺已停业,请联系商家");
}
@@ -161,7 +160,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");
}
@@ -169,10 +168,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);
}
}
@@ -233,7 +232,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);
@@ -272,15 +271,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 {

View File

@@ -10,12 +10,11 @@ import com.czg.account.dto.auth.WechatRawDataDTO;
import com.czg.account.entity.UserInfo;
import com.czg.account.service.UserAuthorizationService;
import com.czg.account.service.UserInfoService;
import com.czg.enums.StatusEnum;
import com.czg.constants.SystemConstants;
import com.czg.enums.UserAuthSourceEnum;
import com.czg.exception.CzgException;
import com.czg.sa.MyStpLogic;
import com.czg.sa.StpKit;
import com.czg.service.account.util.AcAccountUtil;
import com.czg.service.account.util.AlipayUtil;
import com.czg.service.account.util.WechatAuthUtil;
import com.czg.system.enums.SysParamCodeEnum;
@@ -25,7 +24,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
* @author Administrator
@@ -113,7 +111,7 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
userInfo.setAlipayOpenId(openId);
}
if (userInfo.getStatus() != null && StatusEnum.DISABLE.value() == userInfo.getStatus()) {
if (userInfo.getStatus() != null && SystemConstants.OneZero.ZERO == userInfo.getStatus()) {
throw new CzgException("账号已禁用");
}