Merge branch 'prod' into test
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.table.ShopTableAddDTO;
|
||||
import com.czg.account.dto.table.ShopTableBindDTO;
|
||||
import com.czg.account.dto.table.ShopTableClearDTO;
|
||||
import com.czg.account.dto.table.ShopTableDTO;
|
||||
import com.czg.account.dto.table.*;
|
||||
import com.czg.account.entity.ShopTable;
|
||||
import com.czg.account.service.ShopTableService;
|
||||
import com.czg.account.vo.ShopTableVO;
|
||||
@@ -15,6 +12,7 @@ import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.update.UpdateChain;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -93,6 +91,24 @@ public class ShopTableController {
|
||||
return CzgResult.success(shopTableService.updateInfo(StpKit.USER.getLoginIdAsLong(), shopTableDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量台桌配置
|
||||
* 权限标识: shopTable:edit
|
||||
* @return 是否成功
|
||||
*/
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> editBatch(@RequestBody @Validated ShopTableEditBatchDTO shopTableDTO) {
|
||||
UpdateChain<ShopTable> query = shopTableService.updateChain().eq(ShopTable::getShopId, StpKit.USER.getShopId());
|
||||
if (shopTableDTO.getClearTime() != null) {
|
||||
query.eq(ShopTable::getClearTime, shopTableDTO.getClearTime());
|
||||
}
|
||||
|
||||
if (shopTableDTO.getAutoClear() != null) {
|
||||
query.eq(ShopTable::getAutoClear, shopTableDTO.getAutoClear());
|
||||
}
|
||||
return CzgResult.success(query.update());
|
||||
}
|
||||
|
||||
/**
|
||||
* 台桌清台
|
||||
* 权限标识: shopTable:clear
|
||||
|
||||
@@ -36,7 +36,7 @@ public class UMemberPointsController {
|
||||
*/
|
||||
@GetMapping("pointsBasicSetting")
|
||||
public CzgResult<PointsBasicSettingDTO> getPointsBasicSetting() {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
PointsBasicSetting entity = pointsBasicSettingService.getById(shopId);
|
||||
PointsBasicSettingDTO data = BeanUtil.copyProperties(entity, PointsBasicSettingDTO.class);
|
||||
return CzgResult.success(data);
|
||||
|
||||
@@ -16,8 +16,8 @@ public class MybatisFlexConfig {
|
||||
|
||||
//设置 SQL 审计收集器
|
||||
AuditManager.setMessageCollector(auditMessage ->
|
||||
log.info("{},{}ms", auditMessage.getFullSql()
|
||||
, auditMessage.getElapsedTime())
|
||||
log.info("[sql] time: {}, size: {},\n sql:{}",
|
||||
auditMessage.getQueryTime(), auditMessage.getQueryCount(), auditMessage.getFullSql())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.lang.annotation.Target;
|
||||
* @author click33
|
||||
*
|
||||
*/
|
||||
@SaCheckPermission(type = "admin")
|
||||
//@SaCheckPermission(type = "user")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
@@ -25,7 +24,6 @@ public @interface SaAdminCheckPermission {
|
||||
* 需要校验的权限码
|
||||
* @return 需要校验的权限码
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckPermission.class)
|
||||
String [] value() default {};
|
||||
|
||||
String name() default "";
|
||||
@@ -34,7 +32,6 @@ public @interface SaAdminCheckPermission {
|
||||
* 验证模式:AND | OR,默认AND
|
||||
* @return 验证模式
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckPermission.class)
|
||||
SaMode mode() default SaMode.AND;
|
||||
|
||||
/**
|
||||
@@ -52,7 +49,6 @@ public @interface SaAdminCheckPermission {
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckPermission.class)
|
||||
String[] orRole() default {};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
*/
|
||||
//@SaCheckRole(type = "user")
|
||||
@SaCheckRole(type = "admin")
|
||||
//@SaCheckRole(type = "admin")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaAdminCheckRole {
|
||||
@@ -25,14 +25,12 @@ public @interface SaAdminCheckRole {
|
||||
* 需要校验的角色标识
|
||||
* @return 需要校验的角色标识
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckRole.class)
|
||||
String [] value() default {};
|
||||
|
||||
/**
|
||||
* 验证模式:AND | OR,默认AND
|
||||
* @return 验证模式
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckRole.class)
|
||||
SaMode mode() default SaMode.AND;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.czg.handler;
|
||||
|
||||
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.sa.StpKit;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.lang.reflect.Method;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
|
||||
/**
|
||||
* 员工权限校验
|
||||
* @author Administrator
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SaAdminCheckPermissionHandler implements SaAnnotationHandlerInterface<SaAdminCheckPermission> {
|
||||
|
||||
@Override
|
||||
public Class<SaAdminCheckPermission> getHandlerAnnotationClass() {
|
||||
return SaAdminCheckPermission.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkMethod(SaAdminCheckPermission annotation, Method method) {
|
||||
|
||||
// 2️⃣ 如果是管理员,直接放行
|
||||
if (StpKit.USER.isAdmin()) {
|
||||
log.debug("[SaAdminCheckPermissionHandler] 管理员免校验权限: userId={}", StpKit.USER.getLoginId());
|
||||
return;
|
||||
}
|
||||
|
||||
// 3️⃣ 非管理员执行权限校验
|
||||
String[] permissions = annotation.value();
|
||||
SaMode mode = annotation.mode();
|
||||
|
||||
if (permissions != null && permissions.length > 0) {
|
||||
if (mode == SaMode.AND) {
|
||||
StpKit.USER.checkPermissionAnd(permissions);
|
||||
} else {
|
||||
StpKit.USER.checkPermissionOr(permissions);
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("[SaAdminCheckPermissionHandler] 非管理员执行权限校验: userId={}", StpKit.USER.getLoginId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.czg.handler;
|
||||
|
||||
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.annotation.SaAdminCheckRole;
|
||||
import com.czg.annotation.SaStaffCheckPermission;
|
||||
import com.czg.sa.StpKit;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 员工权限校验
|
||||
* @author Administrator
|
||||
*/
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import org.springframework.stereotype.Component;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SaAdminCheckRoleHandler implements SaAnnotationHandlerInterface<SaAdminCheckRole> {
|
||||
|
||||
@Override
|
||||
public Class<SaAdminCheckRole> getHandlerAnnotationClass() {
|
||||
return SaAdminCheckRole.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkMethod(SaAdminCheckRole annotation, Method method) {
|
||||
|
||||
if (StpKit.USER.isAdmin()) {
|
||||
log.debug("[SaAdminCheckRoleHandler] 管理员免校验: userId={}", StpKit.USER.getLoginId());
|
||||
return;
|
||||
}
|
||||
|
||||
// 3️⃣ 非管理员,执行原本注解校验逻辑
|
||||
String[] roles = annotation.value();
|
||||
SaMode mode = annotation.mode();
|
||||
|
||||
if (roles != null && roles.length > 0) {
|
||||
if (mode == SaMode.AND) {
|
||||
StpKit.USER.checkRoleAnd(roles);
|
||||
} else {
|
||||
// 有一个角色即可
|
||||
StpKit.USER.checkRoleOr(roles);
|
||||
}
|
||||
} else {
|
||||
// 如果注解没有指定角色,默认使用注解上 type 的值
|
||||
// 你 @SaCheckRole(type = "admin") 默认角色
|
||||
String typeRole = "admin";
|
||||
StpKit.USER.checkRole(typeRole);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
package com.czg.account.dto.table;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 台桌配置 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopTableEditBatchDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 自动清台 0手动 1自动
|
||||
*/
|
||||
private Integer autoClear;
|
||||
|
||||
/**
|
||||
* 自动清台时间 单位分钟 默认10
|
||||
*/
|
||||
private Integer clearTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -126,6 +126,8 @@ public class ShopTable implements Serializable {
|
||||
*/
|
||||
private Integer useNum;
|
||||
|
||||
private Integer autoClear;
|
||||
|
||||
public boolean canUseByStatus() {
|
||||
return !ShopTableStatusEnum.UNBOUND.equalsVal(status)
|
||||
&& !ShopTableStatusEnum.SETTLED.equalsVal(status)
|
||||
|
||||
@@ -197,6 +197,7 @@ public class AShopUserServiceImpl implements AShopUserService {
|
||||
shopUserDTO.setNextExperience(config.getExperienceValue() - (shopUser.getExperience() == null ? 0 : shopUser.getExperience()));
|
||||
shopUserDTO.setNextExperience(shopUserDTO.getNextExperience() < 0 ? 0: shopUserDTO.getNextExperience());
|
||||
shopUserDTO.setNextMemberLevelName(config.getName());
|
||||
shopUserDTO.setDiscount(config.getDiscount());
|
||||
}
|
||||
return shopUserDTO;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class MemberPointsServiceImpl extends ServiceImpl<MemberPointsMapper, Mem
|
||||
@Override
|
||||
public OrderDeductionPointsDTO getMemberUsablePoints(Long shopUserId, BigDecimal orderAmount) {
|
||||
MemberPoints entity = initMemberPoints(shopUserId);
|
||||
Long shopId = entity.getSourceShopId();
|
||||
Long shopId = entity.getMainShopId();
|
||||
Integer accountPoints = entity.getAccountPoints();
|
||||
OrderDeductionPointsDTO dto = new OrderDeductionPointsDTO();
|
||||
dto.setAccountPoints(accountPoints);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.czg.service.account.service.impl;
|
||||
|
||||
import com.czg.account.dto.ShopConfigDTO;
|
||||
import com.czg.account.entity.ShopConfig;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.service.ShopConfigService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
@@ -20,6 +21,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺配置扩展
|
||||
@@ -59,31 +62,28 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
|
||||
shopIdList = new ArrayList<>();
|
||||
}
|
||||
// 防止报错
|
||||
shopIdList.add(-9999L);
|
||||
List<Long> extistList;
|
||||
if (!shopIdList.isEmpty()) {
|
||||
extistList = list(new QueryWrapper().in(ShopConfig::getId, shopIdList).select(ShopConfig::getId)).stream().map(ShopConfig::getId).toList();
|
||||
shopIdList.stream().filter(id -> !extistList.contains(id)).forEach(id -> {
|
||||
save(new ShopConfig().setId(id).setMainId(mainShopId).setIsEnableDiscount(0).setIsProductSuggest(0));
|
||||
});
|
||||
} else {
|
||||
extistList = new ArrayList<>();
|
||||
}
|
||||
Set<Long> childShopIdList = shopInfoMapper.selectListByQuery(new QueryWrapper().eq(ShopInfo::getMainId, mainShopId)
|
||||
.select(ShopInfo::getId)).stream().map(ShopInfo::getId).collect(Collectors.toSet());
|
||||
childShopIdList.add(mainShopId);
|
||||
List<Long> extistList = new ArrayList<>(list(new QueryWrapper().in(ShopConfig::getId, childShopIdList)).stream().map(ShopConfig::getId).toList());
|
||||
extistList.add(mainShopId);
|
||||
childShopIdList.stream().filter(id -> !extistList.contains(id)).forEach(id -> {
|
||||
save(new ShopConfig().setId(id).setMainId(id.equals(mainShopId) ? null : mainShopId).setIsEnableDiscount(0).setIsProductSuggest(0));
|
||||
});
|
||||
|
||||
if (isEnable == 0 && !onyUpValid) {
|
||||
List<Long> finalShopIdList = shopIdList;
|
||||
|
||||
updateChain().or(or -> {
|
||||
or.eq(ShopConfig::getId, mainShopId);
|
||||
}).or(or -> {
|
||||
or.in(ShopConfig::getId, finalShopIdList);
|
||||
or.in(ShopConfig::getId, childShopIdList);
|
||||
}).set(property, 0).update();
|
||||
}else {
|
||||
if ("all".equals(useShopType)) {
|
||||
List<Long> finalShopIdList1 = shopIdList;
|
||||
updateChain().or(or -> {
|
||||
or.eq(ShopConfig::getId, mainShopId);
|
||||
}).or(or -> {
|
||||
or.in(ShopConfig::getId, finalShopIdList1);
|
||||
or.in(ShopConfig::getId, childShopIdList);
|
||||
}).set(property, 1).update();
|
||||
}else {
|
||||
if (shopIdList.isEmpty()) {
|
||||
|
||||
@@ -20,7 +20,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 店铺员工 服务层实现。
|
||||
@@ -121,7 +123,7 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
|
||||
}
|
||||
|
||||
private void addPermission(ShopStaff shopStaff, List<Long> shopPermissionIds) {
|
||||
long count = shopPermissionService.queryChain().in(ShopPermission::getId, shopPermissionIds).count();
|
||||
long count = shopPermissionService.queryChain().in(ShopPermission::getId, new HashSet<>(shopPermissionIds)).count();
|
||||
if (count != shopPermissionIds.size()) {
|
||||
throw new ApiNotPrintException("存在不存在的权限");
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
updateById(sysUser);
|
||||
|
||||
// 绑定角色
|
||||
long roleCount = sysRoleMapper.selectCountByQuery(new QueryWrapper().eq(SysRole::getId, roleId).eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong()));
|
||||
long roleCount = sysRoleMapper.selectCountByQuery(new QueryWrapper().eq(SysRole::getId, roleId).eq(SysRole::getCreateUserId, StpKit.USER.isAdmin() ? null : StpKit.USER.getLoginIdAsLong()));
|
||||
if (roleCount == 0) {
|
||||
throw new CzgException("角色不存在");
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||
import com.czg.account.entity.ShopConfig;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopConfigService;
|
||||
@@ -13,21 +12,20 @@ import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.market.dto.MkConsumeCashbackDTO;
|
||||
import com.czg.market.dto.MkConsumeDiscountDTO;
|
||||
import com.czg.market.entity.*;
|
||||
import com.czg.market.entity.MkConsumeCashback;
|
||||
import com.czg.market.entity.MkConsumeCashbackRecord;
|
||||
import com.czg.market.entity.MkConsumeCashbackStep;
|
||||
import com.czg.market.service.MkConsumeCashbackRecordService;
|
||||
import com.czg.market.service.MkConsumeCashbackService;
|
||||
import com.czg.market.vo.MkConsumeCashbackVO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.service.market.enums.OrderStatusEnums;
|
||||
import com.czg.service.market.mapper.MkConsumeCashbackMapper;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.update.UpdateWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.service.MkConsumeCashbackService;
|
||||
import com.czg.service.market.mapper.MkConsumeCashbackMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@@ -61,6 +59,7 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
private OrderInfoService orderInfoService;
|
||||
@DubboReference
|
||||
private ShopConfigService shopConfigService;
|
||||
BigDecimal bili = BigDecimal.valueOf(100);
|
||||
@Resource
|
||||
private MkConsumeCashbackRecordService consumeCashbackRecordService;
|
||||
|
||||
@@ -125,9 +124,9 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getMainShopId, mainShopId).eq(ShopUser::getUserId, userId));
|
||||
if (StrUtil.isNotBlank(config.getApplicableUser()) && !"all".equals(config.getApplicableUser())) {
|
||||
if ("new".equals(config.getApplicableUser())) {
|
||||
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE));
|
||||
if (count > 0) {
|
||||
boolean exists = orderInfoService.exists(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()));
|
||||
if (exists) {
|
||||
return;
|
||||
}
|
||||
} else if ("vip".equals(config.getApplicableUser()) && shopUser.getIsVip() != 1) {
|
||||
@@ -147,7 +146,7 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
if (TableValueConstant.MkConsumeCashback.CashbackType.FIX.getCode().equals(config.getCashbackType())) {
|
||||
cashbackAmount = cashbackStep.getCashbackAmount();
|
||||
} else {
|
||||
cashbackAmount = amount.multiply(cashbackStep.getCashbackAmount().divide(BigDecimal.valueOf(100), RoundingMode.DOWN));
|
||||
cashbackAmount = amount.multiply(cashbackStep.getCashbackAmount().divide(bili, 2, RoundingMode.DOWN)).setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
if (cashbackAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return;
|
||||
@@ -166,4 +165,11 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
long count = 15L;
|
||||
if (count > 0) {
|
||||
System.out.println(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class MkDrainageConfigServiceImpl extends ServiceImpl<MkDrainageConfigMap
|
||||
|
||||
@Override
|
||||
public Boolean edit(Long shopId, MkDrainageConfigDTO config) {
|
||||
MkDrainageConfig info = getOne(new QueryWrapper().eq(MkDrainageConfig::getMainShopId, shopId));
|
||||
MkDrainageConfig info = getOne(new QueryWrapper().eq(MkDrainageConfig::getShopId, shopId));
|
||||
BeanUtil.copyProperties(config, info);
|
||||
if (config.getUseType() != null) {
|
||||
info.setUseType(JSONArray.toJSONString(config.getUseType()));
|
||||
|
||||
@@ -70,15 +70,15 @@ public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopCo
|
||||
throw new ApiNotPrintException("随机立减配置错误");
|
||||
}
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(shopId, userId);
|
||||
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE));
|
||||
AssertUtil.isTrue(count > 0, "新客立减仅限新用户使用");
|
||||
boolean exists = orderInfoService.exists(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()));
|
||||
AssertUtil.isTrue(exists, "新客立减仅限新用户使用");
|
||||
|
||||
|
||||
long recordCount = count(new QueryWrapper().eq(MkShopConsumeDiscountRecord::getShopId, shopId).eq(MkShopConsumeDiscountRecord::getShopUserId, shopUser.getId())
|
||||
boolean exists1 = exists(new QueryWrapper().eq(MkShopConsumeDiscountRecord::getShopId, shopId).eq(MkShopConsumeDiscountRecord::getShopUserId, shopUser.getId())
|
||||
.eq(MkShopConsumeDiscountRecord::getIsUse, 1));
|
||||
|
||||
AssertUtil.isTrue(recordCount > 0, "新客立减已使用");
|
||||
AssertUtil.isTrue(exists1, "新客立减已使用");
|
||||
|
||||
return consumeDiscountVO;
|
||||
}
|
||||
@@ -115,9 +115,9 @@ public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopCo
|
||||
}
|
||||
return discountRecord;
|
||||
}
|
||||
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE));
|
||||
if (count > 0) {
|
||||
boolean exists = orderInfoService.exists(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()));
|
||||
if (exists) {
|
||||
// throw new ApiNotPrintException("新客立减仅新用户可用");
|
||||
log.info("新客立减仅限新用户使用");
|
||||
return null;
|
||||
|
||||
@@ -449,7 +449,8 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
||||
|
||||
@Override
|
||||
public Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO) {
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, shopId).eq(ShopUser::getUserId, rewardCouponDTO.getUserId()));
|
||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getMainShopId, mainIdByShopId).eq(ShopUser::getUserId, rewardCouponDTO.getUserId()));
|
||||
MkShopCouponGiftDTO giftDTO = new MkShopCouponGiftDTO().setCouponId(rewardCouponDTO.getCouponId())
|
||||
.setShopId(shopId)
|
||||
.setSourceId(rewardCouponDTO.getUserId())
|
||||
|
||||
@@ -139,7 +139,7 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
shopRechargeDetailService.save(mkShopRechargeDetail);
|
||||
});
|
||||
}
|
||||
shopConfigService.editStatusByShopIdList(shopId, shopRechargeDTO.getIsEnable(), false, "is_account_ay",
|
||||
shopConfigService.editStatusByShopIdList(shopId, shopRechargeDTO.getIsEnable(), false, "is_account_pay",
|
||||
shopRechargeDTO.getUseType(), shopRechargeDTO.getShopIdList());
|
||||
|
||||
|
||||
|
||||
@@ -112,13 +112,13 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
||||
if (!"all".equals(coupon.getGetUserType())) {
|
||||
if ("new".equals(coupon.getGetUserType())) {
|
||||
isNotNewUser = false;
|
||||
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, userId)
|
||||
.eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getStatus, OrderStatusEnums.DONE));
|
||||
if (count > 0) {
|
||||
boolean exists = orderInfoService.exists(new QueryWrapper().eq(OrderInfo::getUserId, userId)
|
||||
.eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()));
|
||||
if (exists) {
|
||||
continue;
|
||||
}
|
||||
long count1 = recordService.count(new QueryWrapper().eq(MkShopCouponRecord::getCouponSyncId, coupon.getSyncId()));
|
||||
if (count1 > 0) {
|
||||
boolean exists1 = recordService.exists(new QueryWrapper().eq(MkShopCouponRecord::getCouponSyncId, coupon.getSyncId()));
|
||||
if (exists1) {
|
||||
continue;
|
||||
}
|
||||
} else if ("vip".equals(coupon.getGetUserType()) && shopUser.getIsVip() != 1) {
|
||||
|
||||
@@ -363,7 +363,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
param.getPointsDiscountAmount().compareTo(BigDecimal.ZERO) > 0);
|
||||
}
|
||||
// 积分校验
|
||||
PointsBasicSetting pointSetting = pointsBasicService.getById(shopId);
|
||||
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
PointsBasicSetting pointSetting = pointsBasicService.getById(mainShopId);
|
||||
boolean usePointsDeduction = param.getPointsNum() > 0 || param.getPointsDiscountAmount().compareTo(BigDecimal.ZERO) > 0;
|
||||
if (usePointsDeduction) {
|
||||
if (pointSetting == null || !pointSetting.getEnableDeduction().equals(1)) {
|
||||
|
||||
Reference in New Issue
Block a user