69 Commits

Author SHA1 Message Date
74e3b6526b pom 2025-09-17 11:17:56 +08:00
a962372583 Merge remote-tracking branch 'origin/test' into test 2025-09-17 11:16:22 +08:00
8e345b5737 预览模式问题 2025-09-17 11:15:42 +08:00
张松
ddf3bf7697 Merge remote-tracking branch 'origin/test' into test
# Conflicts:
#	cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkShopCouponRecordServiceImpl.java
2025-09-17 11:12:17 +08:00
张松
154401fafb 前端随机立减金额获取 2025-09-17 11:11:52 +08:00
3e81ea93b6 循环依赖问题 2025-09-17 11:09:52 +08:00
de08266971 订单 优惠券部分 重写 2025-09-17 10:54:47 +08:00
张松
b4fb2afd68 新客立减修改 2025-09-17 10:26:29 +08:00
张松
d620ccf564 忽略代码生成main文件 2025-09-16 14:35:06 +08:00
张松
caeee47520 充值记录 2025-09-16 14:34:45 +08:00
张松
696ffc49ae 超级会员相关 2025-09-16 14:05:30 +08:00
ec1e94fdaf MkShopCouponRecordService.receiveCoupon 发放券 统一方法 2025-09-16 11:07:32 +08:00
d006a2dce3 日期校验 2025-09-13 16:14:22 +08:00
5ef41403e0 领取时间 范围校验 2025-09-13 16:09:02 +08:00
dca94cc848 原记录表作废 2025-09-13 15:57:51 +08:00
77ac277856 领取 2025-09-13 15:35:20 +08:00
db50c78049 消费赠券 跳转 id 选中 2025-09-13 11:18:26 +08:00
212f27daa6 shop_id 2025-09-13 10:52:48 +08:00
c110695843 关联关系 type 2025-09-13 09:59:58 +08:00
02e5684c0f 取消关联 2025-09-13 09:30:41 +08:00
0794ac7569 新增字段 已发放数量 giftNum
已发放数量 问题
2025-09-12 17:56:11 +08:00
e6fe3e66c7 忽略 2025-09-12 17:22:51 +08:00
cedcec2cac 消费赠券 没有title 2025-09-12 17:18:58 +08:00
7d405f9455 shopId填充 2025-09-12 17:15:15 +08:00
536560322c 新增 ID校验 2025-09-12 17:09:30 +08:00
97fc5a65f4 新增 ID校验 2025-09-12 17:05:50 +08:00
1b111262ad 优惠券新增 Id回填 2025-09-12 15:38:32 +08:00
f2007bb881 循环依赖 2025-09-12 15:15:18 +08:00
3b53b460fd 消费赠券 优惠券 2025-09-12 15:10:43 +08:00
张松
2e69148249 超级会员相关 2025-09-12 15:07:30 +08:00
张松
55a36bc4da Merge remote-tracking branch 'origin/test' into test 2025-09-12 14:26:11 +08:00
张松
44d3a084c8 超级会员购买相关 2025-09-12 14:26:02 +08:00
f703028fa1 Merge remote-tracking branch 'origin/test' into test 2025-09-12 14:14:59 +08:00
d01f66d6a4 赠送券活动 关联表 2025-09-12 14:14:51 +08:00
张松
10817c01a0 超级会员购买相关 2025-09-12 13:46:40 +08:00
张松
6bf8ee2c0b 超级会员购买相关 2025-09-12 11:46:49 +08:00
张松
2d302f31a8 超级会员购买相关 2025-09-12 11:36:07 +08:00
张松
ccb76143cc 超级会员购买相关 2025-09-12 11:13:35 +08:00
f9aa237f98 权限 暂时 关闭 2025-09-12 10:56:13 +08:00
张松
449db66e2c 超级会员购买相关 2025-09-12 10:52:55 +08:00
张松
484d39819c 超级会员购买相关 2025-09-12 10:42:24 +08:00
张松
bd47a96228 超级会员购买相关 2025-09-12 10:36:50 +08:00
张松
5dd5e09770 超级会员购买相关 2025-09-12 09:57:22 +08:00
张松
f2b3a96303 超级会员购买相关 2025-09-12 09:55:26 +08:00
张松
8a980114cf Merge remote-tracking branch 'origin/test' into test 2025-09-12 09:54:46 +08:00
张松
3dbc5e8f55 超级会员购买相关 2025-09-12 09:54:38 +08:00
bb0ef6e778 修改表名为mk_shop_coupon 2025-09-12 09:51:09 +08:00
张松
a8c34e628a 超级会员购买相关 2025-09-12 09:42:36 +08:00
张松
31678fa6f1 超级会员相关 2025-09-12 09:21:18 +08:00
张松
2f88f54b0f 超级会员相关 2025-09-12 09:04:39 +08:00
张松
9c728249f7 超级会员相关 2025-09-11 18:15:39 +08:00
张松
8ad76d3844 超级会员相关 2025-09-11 18:09:43 +08:00
张松
daee376547 Merge remote-tracking branch 'origin/test' into test 2025-09-11 17:28:06 +08:00
张松
5776984a42 超级会员相关 2025-09-11 17:27:57 +08:00
6d5fd5a39a Merge remote-tracking branch 'origin/test' into test 2025-09-11 17:01:26 +08:00
855ee133fe only-仅本店 2025-09-11 17:01:09 +08:00
张松
f7da6eac1e 超级会员相关 2025-09-11 16:49:02 +08:00
d7b41d61e3 dubbo 优惠券 2025-09-11 16:47:45 +08:00
32f9746d30 Merge remote-tracking branch 'origin/test' into test 2025-09-11 16:39:49 +08:00
e6b88058b8 Merge branch 'prod' into test 2025-09-11 16:39:35 +08:00
张松
de5229051c 超级会员相关 2025-09-11 16:38:30 +08:00
张松
5a6a34d85b Merge remote-tracking branch 'origin/test' into test 2025-09-11 16:33:56 +08:00
张松
adae3380c3 超级会员相关 2025-09-11 16:33:48 +08:00
0f922d6978 test方法 移除 2025-09-11 16:28:15 +08:00
01bf1d6500 pom缺少 2025-09-11 16:23:57 +08:00
张松
cb00b99d00 Merge remote-tracking branch 'origin/dev' into test 2025-09-11 16:21:02 +08:00
35d257bc56 分享相关代码 注释掉
优惠券 管理端重写 使用的地方 注释
2025-09-11 16:10:38 +08:00
张松
37be357a4f 店铺会员相关 2025-09-11 15:55:32 +08:00
65ba0e18ce 原作废代码 删除 2025-09-11 13:44:28 +08:00
147 changed files with 7061 additions and 1837 deletions

1
.gitignore vendored
View File

@@ -60,3 +60,4 @@ build/
/cash-api/order-server/src/main/resources/application-zs.yml
/cash-api/product-server/src/main/resources/application-zs.yml
/cash-api/system-server/src/main/resources/application-zs.yml
/cash-service/code-generator/src/main/java/com/czg/Main.java

View File

@@ -1,86 +0,0 @@
package com.czg.controller.admin;
import com.czg.account.dto.ShopActivateDTO;
import com.czg.account.service.ShopActivateService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.config.RedisCst;
import com.czg.exception.CzgException;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.service.RedisService;
import com.czg.service.account.util.WechatAuthUtil;
import jakarta.annotation.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 店铺充值活动管理
*
* @author ww
* @description
*/
@RestController
@RequestMapping("/admin/activate")
public class ShopActivateController {
@Resource
private ShopActivateService shopActivateService;
@Resource
private RedisService redisService;
@Resource
private WechatAuthUtil wechatUtil;
/**
* 店铺充值活动列表
* 权限标识: activate:list
*/
@SaAdminCheckPermission(value = "activate:list", name = "店铺充值活动列表")
@GetMapping
public CzgResult<List<ShopActivateDTO>> detail(@RequestParam(required = false) Long shopId) {
return CzgResult.success(shopActivateService.getList(shopId));
}
/**
* 店铺充值活动新增
* 权限标识: activate:add
*/
@SaAdminCheckPermission(value = "activate:add", name = "店铺充值活动新增")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopActivateDTO activateDTO) {
activateDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(shopActivateService.add(activateDTO));
}
/**
* 店铺充值活动修改
* 权限标识: activate:edit
*/
@SaAdminCheckPermission(value = "activate:edit", name = "店铺充值活动修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopActivateDTO activateDTO) {
return CzgResult.success(shopActivateService.edit(activateDTO));
}
/**
* 获取会员码
* @param params shopId 必填
* env_version 存在即生成体验版
*/
@PostMapping("/getVipCode")
public CzgResult<Object> getVipCode(@RequestBody Map<String, Object> params) throws Exception {
if (CollectionUtils.isEmpty(params) || !params.containsKey("shopId")) {
throw new CzgException("参数错误");
}
String redisKey = RedisCst.SHOP_VIP_CODE + params.get("shopId");
if (redisService.hasKey(redisKey)) {
return CzgResult.success(redisService.get(redisKey));
}
return CzgResult.success(wechatUtil.getFetchQrCode(params));
}
}

View File

@@ -1,86 +0,0 @@
package com.czg.controller.admin;
import com.czg.account.dto.QueryReceiveDto;
import com.czg.account.dto.ShopCouponDTO;
import com.czg.account.service.ShopCouponService;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺优惠券
*
* @author ww
* @description
*/
@RestController
@RequestMapping("/admin/coupon")
public class ShopCouponController {
@Resource
private ShopCouponService couponService;
/**
* 店铺优惠券列表
* 权限标识: coupon:list
* 状态 0 未使用 1已使用 2已过期
*/
@SaAdminCheckPermission(value = "coupon:list", name = "优惠券列表")
@GetMapping
public CzgResult<List<ShopCouponDTO>> detail(@RequestParam(required = false) Integer type,
@RequestParam(required = false) Integer status) {
return CzgResult.success(couponService.getList(StpKit.USER.getShopId(), type, status));
}
/**
* 店铺优惠券新增
* 权限标识: coupon:add
*/
@SaAdminCheckPermission(value = "coupon:add", name = "优惠券添加")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopCouponDTO couponDTO) {
couponDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(couponService.add(couponDTO));
}
/**
* 店铺优惠券修改
* 权限标识: coupon:edit
*/
@SaAdminCheckPermission(value = "coupon:edit", name = "优惠券修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopCouponDTO couponDTO) {
couponDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(couponService.edit(couponDTO));
}
/**
* 店铺优惠券获取记录
* 权限标识: coupon:delete
*/
@SaAdminCheckPermission(value = "coupon:queryReceive", name = "优惠券领取记录")
@GetMapping("/queryReceive")
public CzgResult<Page<CouponReceiveVo>> queryReceive(@Validated QueryReceiveDto param) {
return CzgResult.success(couponService.queryReceive(param));
}
/**
* 生成订单后使用
* 通过用户Id 查找优惠券
*
* @param shopUserId 店铺用户Id
*/
@GetMapping("/findCoupon")
public CzgResult<List<UserCouponVo>> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type) {
return CzgResult.success(couponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type));
}
}

View File

@@ -1,54 +1,54 @@
package com.czg.controller.admin;
import com.czg.account.dto.ShopShareDTO;
import com.czg.account.service.ShopShareService;
import com.czg.account.vo.ShopShareRecordVO;
import com.czg.account.vo.ShopShareVO;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 小程序分享奖励管理
* @author Administrator
*/
@RestController
@RequestMapping("/admin/shopShare")
public class ShopShareController {
@Resource
private ShopShareService shopShareService;
/**
* 获取分享奖励配置
*/
@SaAdminCheckPermission(value = "shopShare:list", name = "分享好友信息")
@GetMapping
public CzgResult<ShopShareVO> get() {
return CzgResult.success(shopShareService.get(StpKit.USER.getShopId()));
}
/**
* 修改分享奖励配置
*/
@SaAdminCheckPermission(value = "shopShare:add", name = "分享好友信息添加")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopShareDTO shopShareDTO) {
return CzgResult.success(shopShareService.add(StpKit.USER.getShopId(), shopShareDTO));
}
/**
* 分享奖励记录
* @param key 邀请人/被邀请人手机号或昵称
* @param status 0 非新用户 1 未领取 2 已领取 3 已使用 不传递为全部
* @return 分页数据
*/
@SaAdminCheckPermission(value = "shopShare:record", name = "分享邀请记录")
@GetMapping("/record")
public CzgResult<Page<ShopShareRecordVO>> record(String key, Integer status) {
return CzgResult.success(shopShareService.recordPage(StpKit.USER.getShopId(), key, status));
}
}
//package com.czg.controller.admin;
//
//import com.czg.account.dto.ShopShareDTO;
//import com.czg.account.service.ShopShareService;
//import com.czg.account.vo.ShopShareRecordVO;
//import com.czg.account.vo.ShopShareVO;
//import com.czg.annotation.SaAdminCheckPermission;
//import com.czg.resp.CzgResult;
//import com.czg.sa.StpKit;
//import com.mybatisflex.core.paginate.Page;
//import jakarta.annotation.Resource;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
///**
// * 小程序分享奖励管理
// * @author Administrator
// */
//@RestController
//@RequestMapping("/admin/shopShare")
//public class ShopShareController {
// @Resource
// private ShopShareService shopShareService;
//
// /**
// * 获取分享奖励配置
// */
// @SaAdminCheckPermission(value = "shopShare:list", name = "分享好友信息")
// @GetMapping
// public CzgResult<ShopShareVO> get() {
// return CzgResult.success(shopShareService.get(StpKit.USER.getShopId()));
// }
//
// /**
// * 修改分享奖励配置
// */
// @SaAdminCheckPermission(value = "shopShare:add", name = "分享好友信息添加")
// @PostMapping
// public CzgResult<Boolean> add(@RequestBody @Validated ShopShareDTO shopShareDTO) {
// return CzgResult.success(shopShareService.add(StpKit.USER.getShopId(), shopShareDTO));
// }
//
// /**
// * 分享奖励记录
// * @param key 邀请人/被邀请人手机号或昵称
// * @param status 0 非新用户 1 未领取 2 已领取 3 已使用 不传递为全部
// * @return 分页数据
// */
// @SaAdminCheckPermission(value = "shopShare:record", name = "分享邀请记录")
// @GetMapping("/record")
// public CzgResult<Page<ShopShareRecordVO>> record(String key, Integer status) {
// return CzgResult.success(shopShareService.recordPage(StpKit.USER.getShopId(), key, status));
// }
//}

View File

@@ -1,33 +0,0 @@
package com.czg.controller.user;
import com.czg.account.dto.ShopActivateDTO;
import com.czg.account.service.ShopActivateService;
import com.czg.resp.CzgResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 用户店铺充值活动管理
*
* @author ww
*/
@RestController
@RequestMapping("/user/activate")
public class UserShopActivateController {
@Resource
private ShopActivateService shopActivateService;
/**
* 店铺充值活动列表
*/
@GetMapping
public CzgResult<List<ShopActivateDTO>> detail(@RequestParam(required = false) Long shopId) {
return CzgResult.success(shopActivateService.getList(shopId));
}
}

View File

@@ -1,51 +0,0 @@
package com.czg.controller.user;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.service.ShopCouponService;
import com.czg.account.vo.UserCouponVo;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.AssertUtil;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺优惠券
*
* @author ww
* @description
*/
@RestController
@RequestMapping("/user/coupon")
public class UserShopCouponController {
@Resource
private ShopCouponService couponService;
/**
* 通过用户Id 查找优惠券
*
* @param status 0 未使用 1已使用 2已过期
*/
@GetMapping("/findByUserId")
public CzgResult<Page<ShopActivateCouponRecord>> findByUserId(
@RequestParam(required = false) Integer status,
@RequestParam(required = false) Long shopId) {
return CzgResult.success(couponService.find(StpKit.USER.getLoginIdAsLong(), shopId, status));
}
/**
* 生成订单后使用
* 通过用户Id 查找优惠券
*
* @param shopUserId 店铺用户Id
*/
@GetMapping("/findCoupon")
public CzgResult<List<UserCouponVo>> findCoupon(@RequestHeader String shopId, @RequestParam Long shopUserId, @RequestParam(required = false) Integer type) {
AssertUtil.isBlank(shopId, "店铺Id不能为空");
return CzgResult.success(couponService.findCoupon(Long.parseLong(shopId), shopUserId, type));
}
}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.czg</groupId>
<artifactId>cash-api</artifactId>
<version>1.0.0</version>
</parent>
<name>营销相关API</name>
<description>营销相关API</description>
<artifactId>market-server</artifactId>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.czg</groupId>
<artifactId>cash-common-log</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.czg</groupId>
<artifactId>market-service</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,25 @@
package com.czg;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author ww
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableTransactionManagement
@MapperScan("com.czg.service.market.mapper")
@EnableDubbo
@Slf4j
public class MarketApplication {
public static void main(String[] args) {
SpringApplication.run(MarketApplication.class, args);
}
}

View File

@@ -0,0 +1,75 @@
package com.czg.controller.admin;
import com.czg.market.dto.MkShopConsumerCouponDTO;
import com.czg.market.service.MkShopConsumerCouponService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.validator.group.DefaultGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import com.mybatisflex.core.paginate.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 消费赠券
* @author ww
* @description
*/
@Slf4j
@RestController
@RequestMapping("/admin/consumerCoupon")
public class AConsumerCouponController {
@Resource
private MkShopConsumerCouponService mkShopConsumerCouponService;
/**
* 分页
*/
@GetMapping("/getConsumerCouponPage")
public CzgResult<Page<MkShopConsumerCouponDTO>> getConsumerCouponPage(MkShopConsumerCouponDTO param) {
Long shopId = StpKit.USER.getShopId(0L);
param.setShopId(shopId);
return CzgResult.success(mkShopConsumerCouponService.getConsumerCouponPage(param));
}
/**
* 详情
*/
@GetMapping("/getConsumerCouponById")
public CzgResult<MkShopConsumerCouponDTO> getConsumerCouponById(Long id) {
return CzgResult.success(mkShopConsumerCouponService.getConsumerCouponById(id));
}
/**
* 新增
*/
@PostMapping("/addConsumerCoupon")
public CzgResult<Void> addConsumerCoupon(@RequestBody MkShopConsumerCouponDTO param) {
Long shopId = StpKit.USER.getShopId(0L);
param.setShopId(shopId);
param.setLeftNum(param.getGiveNum());
mkShopConsumerCouponService.addConsumerCoupon(param);
return CzgResult.success();
}
/**
* 更新
*/
@PutMapping("/updateConsumerCouponById")
public CzgResult<Void> updateConsumerCouponById(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) MkShopConsumerCouponDTO param) {
mkShopConsumerCouponService.updateConsumerCouponById(param);
return CzgResult.success();
}
/**
* 删除
*/
@DeleteMapping("/deleteConsumerCoupon")
public CzgResult<Void> deleteConsumerCoupon(Long id) {
mkShopConsumerCouponService.deleteConsumerCoupon(id);
return CzgResult.success();
}
}

View File

@@ -0,0 +1,173 @@
package com.czg.controller.admin;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil;
import com.czg.log.annotation.OperationLog;
import com.czg.market.dto.MkCouponGiftDTO;
import com.czg.market.dto.MkShopCouponRecordDTO;
import com.czg.market.dto.ShopCouponDTO;
import com.czg.market.service.MkCouponGiftService;
import com.czg.market.service.MkShopCouponRecordService;
import com.czg.market.service.ShopCouponService;
import com.czg.product.service.ShopSyncService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.AssertUtil;
import com.czg.validator.group.DefaultGroup;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* 优惠券
*
* @author ww
*/
@Slf4j
@RestController
@RequestMapping("/admin/coupon")
public class ACouponController {
@Resource
private ShopCouponService shopCouponService;
@Resource
private MkCouponGiftService couponGiftService;
@Resource
private MkShopCouponRecordService couponRecordService;
@DubboReference
private ShopSyncService shopSyncService;
/**
* 分页
*/
@GetMapping("page")
// @OperationLog("优惠券列表-分页")
// @SaAdminCheckPermission("coupon:page")
public CzgResult<Page<ShopCouponDTO>> getCouponPage(ShopCouponDTO param) {
Long shopId = StpKit.USER.getShopId(0L);
param.setShopId(shopId);
Page<ShopCouponDTO> data = shopCouponService.getCouponPage(param);
return CzgResult.success(data);
}
/**
* 详情
*
* @param id 主键id
*/
@GetMapping("{id}")
// @OperationLog("优惠券-详情")
// @SaAdminCheckPermission("coupon:info")
public CzgResult<ShopCouponDTO> getCouponById(@PathVariable("id") Long id) {
AssertUtil.isNull(id, "{}不能为空", "id");
ShopCouponDTO data = shopCouponService.getCouponById(id);
return CzgResult.success(data);
}
/**
* 新增
*/
@PostMapping
@OperationLog("优惠券-新增")
// @SaAdminCheckPermission("coupon:add")
public CzgResult<Void> addCoupon(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopCouponDTO dto) {
Long shopId = StpKit.USER.getShopId(0L);
dto.setShopId(shopId);
dto.setLeftNum(dto.getGiveNum());
shopCouponService.addCoupon(dto);
asyncToBranchShop(dto.getId(), 1);
return CzgResult.success();
}
/**
* 修改
*/
@PutMapping
@OperationLog("优惠券-修改")
// @SaAdminCheckPermission("coupon:update")
public CzgResult<Void> updateCoupon(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopCouponDTO dto) {
Long shopId = StpKit.USER.getShopId(0L);
dto.setShopId(shopId);
shopCouponService.updateCouponById(dto);
couponGiftService.upCouponName(dto.getId(), dto.getTitle());
asyncToBranchShop(dto.getId(), 2);
return CzgResult.success();
}
/**
* 删除
*/
@DeleteMapping
@OperationLog("优惠券-删除")
// @SaAdminCheckPermission("prodGroup:delete")
public CzgResult<String> deleteCoupon(@RequestParam Long id, @RequestParam Integer type) {
AssertUtil.isNull(id, "{}不能为空", "id");
if (type != 1) {
List<MkCouponGiftDTO> gifts = couponGiftService.getCouponGiftBySourceId(id, 3);
if (CollUtil.isNotEmpty(gifts)) {
String collect = gifts.stream()
.map(MkCouponGiftDTO::getSourceName)
.filter(name -> name != null && !name.isEmpty())
.collect(Collectors.joining(","));
return CzgResult.success(collect);
}
}
shopCouponService.deleteCoupon(id);
couponGiftService.deleteCoupon(id);
asyncToBranchShop(id, 3);
return CzgResult.success();
}
/**
* 获取该券关联的功能列表
*
* @param couponId 如果syncId有值 则为syncId 否则为id
*/
@GetMapping("/gifts")
public CzgResult<Page<MkCouponGiftDTO>> getCouponGiftPage(@RequestParam Long couponId, @RequestParam(required = false) Integer type) {
Page<MkCouponGiftDTO> data = couponGiftService.getCouponGiftPage(couponId, type);
return CzgResult.success(data);
}
/**
* 优惠券列表/已领取详情
*
* @param search 用户Id/昵称/手机号
* @param param 用户的优惠券列表 使用该对象的UserId
*/
@GetMapping("/record")
public CzgResult<Page<MkShopCouponRecordDTO>> getRecord(@RequestParam(required = false) String search,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
MkShopCouponRecordDTO param) {
Page<MkShopCouponRecordDTO> data = couponRecordService.getRecord(search, param, startTime, endTime);
return CzgResult.success(data);
}
/**
* 删除用户优惠券
*
* @param id 优惠券记录Id
*/
@DeleteMapping("/deleteRecord")
public CzgResult<Void> cancelRecord(Long id) {
couponRecordService.deleteRecord(id);
return CzgResult.success();
}
private void asyncToBranchShop(Long id, Integer type) {
long shopId = StpKit.USER.getShopId(0L);
log.info("优惠券同步,优惠券id:{},类型:{}", id, type);
ThreadUtil.execAsync(() -> {
shopSyncService.syncCouponBySourceShop(shopId, id, type);
});
}
}

View File

@@ -0,0 +1,46 @@
package com.czg.controller.admin;
import com.czg.market.dto.MkConsumeDiscountDTO;
import com.czg.market.service.MkConsumeDiscountService;
import com.czg.market.vo.MkConsumeDiscountVO;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
/**
* 新客立减
* @author Administrator
*/
@RestController
@RequestMapping("/admin/consumeDiscount")
public class ConsumeDiscountController {
@Resource
private MkConsumeDiscountService consumeDiscountService;
/**
* 配置信息获取
* 权限标识: activate:list
*/
// @SaAdminCheckPermission(value = "member:detail", name = "会员配置列表")
@GetMapping
public CzgResult<MkConsumeDiscountVO> detail() {
return CzgResult.success(consumeDiscountService.detail(StpKit.USER.getShopId()));
}
/**
* 配置信息修改
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@PostMapping
public CzgResult<Boolean> edit(@Validated @RequestBody MkConsumeDiscountDTO consumeDiscountDTO) {
return CzgResult.success(consumeDiscountService.edit(StpKit.USER.getShopId(), consumeDiscountDTO));
}
}

View File

@@ -0,0 +1,107 @@
package com.czg.controller.admin;
import com.czg.exception.ApiNotPrintException;
import com.czg.market.dto.MemberConfigDTO;
import com.czg.market.dto.MemberLevelDTO;
import com.czg.market.entity.MemberLevelConfig;
import com.czg.market.service.MemberLevelConfigService;
import com.czg.market.service.TbMemberConfigService;
import com.czg.market.vo.MemberConfigVO;
import com.czg.market.vo.MemberLevelVO;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.validator.group.UpdateGroup;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import jakarta.validation.groups.Default;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
/**
* 会员配置管理
*/
@RestController
@RequestMapping("/admin/member")
public class MemberController {
@Resource
private TbMemberConfigService memberConfigService;
@Resource
private MemberLevelConfigService memberLevelConfigService;
/**
* 配置信息获取
* 权限标识: activate:list
*/
// @SaAdminCheckPermission(value = "member:detail", name = "会员配置列表")
@GetMapping
public CzgResult<MemberConfigVO> detail() {
return CzgResult.success(memberConfigService.detail(StpKit.USER.getShopId()));
}
/**
* 配置信息修改
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@PostMapping
public CzgResult<Boolean> edit(@Validated @RequestBody MemberConfigDTO memberDTO) {
return CzgResult.success(memberConfigService.edit(StpKit.USER.getShopId(), memberDTO));
}
/**
* 会员等级添加
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@PostMapping("/level")
public CzgResult<Boolean> addLevel(@Validated @RequestBody MemberLevelDTO levelDTO) throws ApiNotPrintException {
return CzgResult.success(memberConfigService.addLevel(StpKit.USER.getShopId(), levelDTO));
}
/**
* 会员等级修改
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@PutMapping("/level")
public CzgResult<Boolean> editLevel(@Validated({UpdateGroup.class, Default.class}) @RequestBody MemberLevelDTO levelDTO) throws ApiNotPrintException {
return CzgResult.success(memberConfigService.editLevel(StpKit.USER.getShopId(), levelDTO));
}
/**
* 会员等级删除
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@DeleteMapping("/level/{id}")
public CzgResult<Boolean> deleteLevel(@PathVariable Long id) {
return CzgResult.success(memberLevelConfigService.remove(new QueryWrapper().eq(MemberLevelConfig::getId, id).eq(MemberLevelConfig::getShopId, StpKit.USER.getShopId())));
}
/**
* 会员等级列表
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@GetMapping("/level/list")
public CzgResult<ArrayList<MemberLevelVO>> levelList() {
return CzgResult.success(memberConfigService.listLevel(StpKit.USER.getShopId()));
}
/**
* 会员等级详情
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@PutMapping("/level/detail")
public CzgResult<ArrayList<MemberLevelVO>> levelList(@RequestParam Integer id) {
return CzgResult.success(memberConfigService.listLevel(StpKit.USER.getShopId()));
}
}

View File

@@ -0,0 +1,66 @@
package com.czg.controller.admin;
import com.czg.market.dto.MkShopRechargeDTO;
import com.czg.market.entity.MkShopRechargeFlow;
import com.czg.market.service.MkRechargeFlowService;
import com.czg.market.service.MkShopRechargeService;
import com.czg.market.vo.MkShopRechargeVO;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 智慧充值
* @author Administrator
*/
@RestController
@RequestMapping("/admin/shopRecharge")
public class ShopRechargeController {
@Resource
private MkShopRechargeService shopRechargeService;
@Resource
private MkRechargeFlowService rechargeFlowService;
/**
* 配置信息获取
* 权限标识: activate:list
*/
// @SaAdminCheckPermission(value = "member:detail", name = "会员配置列表")
@GetMapping
public CzgResult<MkShopRechargeVO> detail() {
if (!StpKit.USER.isManager()) {
return CzgResult.failure("无权限操作");
}
return CzgResult.success(shopRechargeService.detail(StpKit.USER.getShopId()));
}
/**
* 配置信息修改
* @return 是否成功
*/
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
@PostMapping
public CzgResult<Boolean> edit(@Validated @RequestBody MkShopRechargeDTO shopRechargeDTO) {
if (!StpKit.USER.isManager()) {
return CzgResult.failure("无权限操作");
}
return CzgResult.success(shopRechargeService.edit(StpKit.USER.getShopId(), shopRechargeDTO));
}
/**
* 获取充值记录列表
* @param startTime 开始时间 闭区间
* @param endTime 结束时间 闭区间
* @param type 类型
*/
@GetMapping("/record")
public Page<MkShopRechargeFlow> getRecord(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String type) {
return rechargeFlowService.pageInfo(StpKit.USER.getShopId(), startTime, endTime, type);
}
}

View File

@@ -0,0 +1,40 @@
package com.czg.controller.user;
import com.czg.account.dto.shopuser.ShopUserAddDTO;
import com.czg.account.dto.shopuser.ShopUserDetailDTO;
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
import com.czg.account.entity.MemberPointsLog;
import com.czg.account.entity.ShopUser;
import com.czg.account.entity.ShopUserFlow;
import com.czg.account.service.MemberPointsLogService;
import com.czg.account.service.PointsExchangeRecordService;
import com.czg.account.service.ShopUserFlowService;
import com.czg.account.service.ShopUserService;
import com.czg.annotation.Debounce;
import com.czg.market.entity.MkShopConsumeDiscountRecord;
import com.czg.market.service.MkShopConsumeDiscountRecordService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 店铺会员相关
*
* @author Administrator
*/
@RestController
@RequestMapping("/user/consumeDiscount")
public class UShopConsumeDiscountController {
@Resource
private MkShopConsumeDiscountRecordService shopConsumeDiscountRecordService;
@GetMapping
public CzgResult<MkShopConsumeDiscountRecord> get(@RequestParam Long shopId) {
return CzgResult.success(shopConsumeDiscountRecordService.get(shopId));
}
}

View File

@@ -0,0 +1,45 @@
package com.czg.task;
import cn.hutool.core.date.DateUtil;
import com.czg.account.entity.ShopUser;
import com.czg.account.service.ShopUserService;
import com.czg.constant.TableValueConstant;
import com.czg.market.service.TbMemberConfigService;
import com.czg.order.entity.OrderInfo;
import com.czg.order.service.OrderInfoService;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 订单定时任务
*
* @author ww
* @description
*/
@Slf4j
@Component
public class MemberDeliverTask {
@Resource
private OrderInfoService orderInfoService;
@DubboReference
private ShopUserService shopUserService;
@Resource
private TbMemberConfigService memberConfigService;
/**
* order 过期
*/
// @Scheduled(cron = "0 0 1 * * ? ")
public void run() {
shopUserService.list(new QueryWrapper().eq(ShopUser::getIsVip, 1).lt(ShopUser::getNextDeliverTime, DateUtil.date().toLocalDateTime())).forEach(item -> {
memberConfigService.deliver(item.getShopId(), item.getUserId(), TableValueConstant.MemberExpFlow.Type.MEMBER_TASK, null, null, null);
});
}
}

View File

@@ -0,0 +1,56 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.1.31:3306/czg_cashier?useUnicode=true&characterEncoding=utf-8
username: root
password: Chaozg123.
data:
redis:
host: 192.168.1.31
port: 6379
password: Chaozg123.
timeout: 1000
database: 0
lettuce:
pool:
min-idle: 0
max-idle: 8
max-wait: -1ms
max-active: 16
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: product-server
qos-port: 22261
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-dev
protocol:
port: 10601
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: market-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@@ -0,0 +1,50 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1b572nblln4jho2.mysql.rds.aliyuncs.com:3306/czg_cashier?useUnicode=true&characterEncoding=utf-8
username: root
password: Czg666888
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 3
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: product-server
qos-port: 22263
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-prod
protocol:
port: 10603
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: market-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@@ -0,0 +1,50 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/czg_cashier?useUnicode=true&characterEncoding=utf-8
username: cashier
password: Cashier@1@
data:
redis:
host: 121.40.109.122
port: 6379
password: chaozg123
timeout: 1000
database: 2
cloud:
nacos:
discovery:
server-addr: 121.40.109.122:8848
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
rabbitmq:
host: 121.40.109.122
port: 5672
username: chaozg
password: chaozg123
dubbo:
application:
name: product-server
qos-port: 22262
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-test
protocol:
port: 10602
threads: 20
name: dubbo
serialization: hessian2
seata:
application-id: market-server
tx-service-group: group_seata
config:
type: nacos
nacos:
server-addr: 121.40.109.122:8848
namespace:
group: group_seata

View File

@@ -0,0 +1,34 @@
server:
port: 9500
spring:
application:
name: market-server
profiles:
active: dev
include: tools
wx:
ysk:
appId: wx212769170d2c6b2a
secrete: 8492a7e8d55bbb1b57f5c8276ea1add0
operationMsgTmpId: wFdoUG-dUT7bDRHq8bMJD9CF5TjyH9x_uJQgQByZqHg
warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0
logging:
config: classpath:logback.xml
# MyBatis-Flex
mybatis-flex:
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
pagehelper:
helper-dialect: mysql
support-methods-arguments: true
dubbo:
consumer:
check: false

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>market-server</contextName>
<property name="log.charset" value="utf-8" />
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
<!--写入文件格式-->
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!--按天生成日志-->
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/market/logback.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--生成日志文件名称-->
<fileNamePattern>logs/product/history/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<maxFileSize>20MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${p_file}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!--普通日志输出到控制台-->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="logFile"/>
</root>
</configuration>

View File

@@ -5,6 +5,7 @@ import com.czg.annotation.SaStaffCheckPermission;
import com.czg.entity.resp.CzgBaseResp;
import com.czg.order.entity.OrderInfo;
import com.czg.resp.CzgResult;
import com.czg.service.order.dto.VipMemberPayParamDTO;
import com.czg.service.order.dto.VipPayParamDTO;
import com.czg.service.order.dto.VipRefundDTO;
import com.czg.service.order.service.PayService;
@@ -69,6 +70,21 @@ public class VipPayController {
return payService.ltPayVip(ServletUtil.getClientIP(request), payParam);
}
/**
* 会员购买支付
* @param request
* @param payParam
* @return
*/
@PostMapping("/ltPayMember")
@Debounce(value = "#payParam.memberOrderId")
public CzgResult<Map<String, Object>> ltPayMember(HttpServletRequest request, @Validated @RequestBody VipMemberPayParamDTO payParam) {
AssertUtil.isNull(payParam.getShopUserId(), "购买失败 未指定店铺用户Id");
payParam.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
return payService.ltPayMember(ServletUtil.getClientIP(request), payParam);
}
/**
* 正扫
*/

View File

@@ -2,10 +2,13 @@ package com.czg.controller.user;
import com.czg.annotation.Debounce;
import com.czg.exception.CzgException;
import com.czg.market.dto.MemberOrderDTO;
import com.czg.order.dto.OrderCannelDTO;
import com.czg.order.dto.OrderInfoAddDTO;
import com.czg.order.dto.OrderInfoQueryDTO;
import com.czg.market.entity.MemberOrder;
import com.czg.order.entity.OrderInfo;
import com.czg.market.service.MemberOrderService;
import com.czg.order.service.OrderInfoService;
import com.czg.order.vo.HistoryOrderVo;
import com.czg.order.vo.OrderInfoVo;
@@ -35,6 +38,8 @@ public class UserOrderController {
@Resource
private OrderInfoService orderInfoService;
@Resource
private MemberOrderService memberOrderService;
/**
* 订单列表
*/
@@ -70,6 +75,21 @@ public class UserOrderController {
return CzgResult.success(orderInfoService.createOrder(addDto));
}
/**
* 会员购买
* @param orderDTO 充值信息
* @return
*/
@PostMapping("/createMemberOrder")
public CzgResult<MemberOrder> createMemberOrder(@Validated @RequestBody MemberOrderDTO orderDTO) {
orderDTO.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
orderDTO.setUserId(StpKit.USER.getLoginIdAsLong());
orderDTO.setShopId(StpKit.USER.getShopId());
orderDTO.setOrderType("miniapp");
return CzgResult.success(memberOrderService.createMemberOrder(orderDTO));
}
@PutMapping("/{id}")
public CzgResult<Void> upOrderIsDel(@PathVariable("id") Long id) {
//效验数据

View File

@@ -98,6 +98,11 @@ public class OrderDetailDTO implements Serializable {
*/
private BigDecimal couponNum;
/**
* 半价券抵扣数量
*/
private BigDecimal halfPriceCouponNum;
/**
* 退菜数量(不管价格)
*/

View File

@@ -97,6 +97,10 @@ admin-app APP管理端 APP+雪花ID
* 满减优惠券抵扣金额
*/
private BigDecimal fullCouponDiscountAmount;
/**
* 其它优惠券抵扣金额
*/
private BigDecimal otherCouponDiscountAmount;
/**
* 手动优惠金额

View File

@@ -1,71 +0,0 @@
package com.czg.account.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.czg.account.entity.ShopCoupon;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* 活动 实体类。
*
* @author ww
* @since 2025-02-20
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShopActivateDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@NotNull(message = "主键不能为空", groups = {UpdateGroup.class})
private Long id;
private Long shopId;
/**
* 充值金额
*/
@NotNull(message = "充值金额不能为空", groups = {InsertGroup.class, UpdateGroup.class})
private BigDecimal amount;
/**
* 赠送金额
*/
private BigDecimal giftAmount;
/**
* 赠送积分
*/
private Integer giftPoints;
/**
* 是否赠送优惠卷 0否 1是
*/
private Integer isGiftCoupon;
private List<ShopCoupon> couponList;
private String coupons;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@@ -1,146 +0,0 @@
package com.czg.account.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 优惠券 实体类。
*
* @author ww
* @since 2025-02-17
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShopCouponDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增
*/
private Long id;
/**
* 状态0-关闭 1 正常
*/
private Integer status;
/**
* 名称(无意义)
*/
private String title;
private Long shopId;
/**
* 已使用数量
*/
private Integer useNumber;
/**
* 发放数量
*/
private Integer number;
/**
* 剩余数量
*/
private Integer leftNumber;
/**
* 有效期类型,可选值为 fixed固定时间/custom自定义时间
*/
private String validityType;
/**
* 有效天数
*/
private Integer validDays;
/**
* 隔多少天生效
*/
private Integer daysToTakeEffect;
/**
* 有效开始时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime validStartTime;
/**
* 有效结束时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime validEndTime;
/**
* 周 数组["周一","周二"]
*/
private String userDays;
/**
* all-全时段 custom-指定时段
*/
private String useTimeType;
/**
* 可用开始时间
*/
private String useStartTime;
/**
* 可用结束时间
*/
private String useEndTime;
/**
* 1-满减 2-商品
*/
private Integer type;
/**
* 满多少金额
*/
private BigDecimal fullAmount;
/**
* 减多少金额
*/
private BigDecimal discountAmount;
/**
* 商品id
*/
private Long proId;
private String proName;
/**
* 描述
*/
private String description;
/**
* 发放人
*/
private String editor;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,99 @@
package com.czg.account.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员基础配置 实体类。
*
* @author zs
* @since 2025-09-10
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TbMemberConfigDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
private Long id;
/**
* 提交生日/姓名
*/
private Integer submitInfo;
/**
* 购买开通PAY 条件开通CONDITION
*/
private String openType;
/**
* 方案列表
*/
private String configList;
/**
* 条件开通条件项
*/
private String conditionInfo;
/**
* 购买开通金额
*/
private BigDecimal amount;
/**
* 参与会员价门店
*/
private String memberPriceShopIdList;
/**
* 是否享受会员价
*/
private Integer isMemberPrice;
/**
* 每消费一元经验值
*/
private Float costReward;
/**
* 每充值一元经验值
*/
private Float rechargeReward;
/**
* 店铺id
*/
private Long shopId;
/**
* 规则说明
*/
private String remark;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 修改时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,93 @@
package com.czg.account.dto;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员等级配置 实体类。
*
* @author zs
* @since 2025-09-10
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TbMemberLevelConfigDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
* 会员名称
*/
private String name;
/**
* 所需成长值
*/
private Long experienceValue;
/**
* 会员折扣
*/
private Float discunt;
/**
* logo
*/
private String logo;
/**
* 消费送积分消费n元送1积分, 0为禁用
*/
private Float costRewardPoints;
/**
* 周期奖励状态 0禁用 1启用
*/
private Integer isCycleReward;
/**
* 周期时间包含周 月 年 日
*/
private String cycleTime;
/**
* 赠送积分
*/
private String cycleRewardPoints;
/**
* 优惠券列表
*/
private String cycleRewardCouponList;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 修改时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@@ -1,148 +0,0 @@
package com.czg.account.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serial;
import java.time.LocalTime;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 优惠券 实体类。
*
* @author ww
* @since 2025-02-20
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_coupon")
public class ShopCoupon implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增
*/
@Id(keyType = KeyType.Auto)
private Long id;
private Long shopId;
/**
* 名称(无意义)
*/
private String title;
/**
* 1-满减 2-商品
*/
private Integer type;
/**
* 状态0-关闭 1 正常
*/
private Integer status;
/**
* 已使用数量
*/
private Integer useNumber;
/**
* 发放数量
*/
private Integer number;
/**
* 剩余数量
*/
private Integer leftNumber;
/**
* 有效期类型,可选值为 fixed固定时间/custom自定义时间
*/
private String validityType;
/**
* 有效天数
*/
private Integer validDays;
/**
* 隔多少天生效
*/
private Integer daysToTakeEffect;
/**
* 有效开始时间
*/
private LocalDateTime validStartTime;
/**
* 有效结束时间
*/
private LocalDateTime validEndTime;
/**
* 周 数组["周一","周二"]
*/
private String userDays;
/**
* all-全时段 custom-指定时段
*/
private String useTimeType;
/**
* 可用开始时间
*/
private LocalTime useStartTime;
/**
* 可用结束时间
*/
private LocalTime useEndTime;
/**
* 满多少金额
*/
private BigDecimal fullAmount;
/**
* 减多少金额
*/
private BigDecimal discountAmount;
/**
* 商品id
*/
private Long proId;
/**
* 描述
*/
private String description;
/**
* 发放人
*/
private String editor;
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
}

View File

@@ -129,4 +129,13 @@ public class ShopUser implements Serializable {
* 已经合并过来的用户信息jsonArray格式,[{"id":1,"shopId":2,...},{"id":1,"shopId":2,...}]
*/
private String mergedUsers;
private Long memberLevelId;
private Long experience;
private LocalDateTime startTime;
private LocalDateTime endTime;
private LocalDateTime deliverTime;
private LocalDateTime nextDeliverTime;
}

View File

@@ -1,25 +0,0 @@
package com.czg.account.service;
import com.czg.account.dto.QueryReceiveDto;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.mybatisflex.core.service.IService;
import java.util.List;
/**
* 活动商品赠送记录表 服务层。
*
* @author ww
* @since 2025-02-20
*/
public interface ShopActivateCouponRecordService extends IService<ShopActivateCouponRecord> {
List<CouponReceiveVo> queryReceive(QueryReceiveDto param);
List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status);
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type);
}

View File

@@ -1,35 +0,0 @@
package com.czg.account.service;
import com.czg.account.dto.ShopActivateDTO;
import com.czg.account.entity.ShopActivate;
import com.czg.account.entity.ShopUser;
import com.mybatisflex.core.service.IService;
import java.math.BigDecimal;
import java.util.List;
/**
* 活动 服务层。
*
* @author ww
* @since 2025-02-17
*/
public interface ShopActivateService extends IService<ShopActivate> {
List<ShopActivateDTO> getList(Long shopId);
Boolean add(ShopActivateDTO activateDTO);
Boolean edit(ShopActivateDTO activateDTO);
/**
* @param memAmount 充值金额
* @param activateId 参加活动Id
* @param relationId 关联Id
* 霸王餐时 订单id
* 充值奖励 的关联id 是tb_shop_user_flow的充值 记录id
* 支付/退款 tb_order_payment.id
*/
void giveActivate(ShopUser shopUser, BigDecimal memAmount, Long activateId, Long relationId);
}

View File

@@ -1,47 +0,0 @@
package com.czg.account.service;
import com.czg.account.dto.QueryReceiveDto;
import com.czg.account.dto.ShopCouponDTO;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.entity.ShopCoupon;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import java.util.List;
/**
* 优惠券 服务层。
*
* @author ww
* @since 2025-02-17
*/
public interface ShopCouponService extends IService<ShopCoupon> {
/**
* 优惠券列表
*
* @param shopId 店铺id
* @param type 1-满减 2-商品
* @param status 状态 0 未使用 1已使用 -1已过期
*/
List<ShopCouponDTO> getList(Long shopId, Integer type, Integer status);
Boolean add(ShopCouponDTO couponDTO);
Boolean edit(ShopCouponDTO couponDTO);
Page<CouponReceiveVo> queryReceive(QueryReceiveDto param);
Page<ShopActivateCouponRecord> find(Long userId,Long shopId, Integer status);
List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type);
Boolean use(List<Long> ids, Long shopUserId, Long orderId);
Boolean refund(Long orderId, Long shopUserId);
}

View File

@@ -1,23 +1,23 @@
package com.czg.account.service;
import com.czg.account.dto.ShopShareDTO;
import com.czg.account.vo.ShopShareRecordVO;
import com.czg.account.vo.ShopShareVO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.ShopShare;
/**
* 店铺分享 服务层。
*
* @author zs
* @since 2025-03-05
*/
public interface ShopShareService extends IService<ShopShare> {
ShopShareVO get(Long shopId);
Boolean add(Long shopId, ShopShareDTO shopShareDTO);
Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status);
}
//package com.czg.account.service;
//
//import com.czg.account.dto.ShopShareDTO;
//import com.czg.account.vo.ShopShareRecordVO;
//import com.czg.account.vo.ShopShareVO;
//import com.mybatisflex.core.paginate.Page;
//import com.mybatisflex.core.service.IService;
//import com.czg.account.entity.ShopShare;
//
///**
// * 店铺分享 服务层。
// *
// * @author zs
// * @since 2025-03-05
// */
//public interface ShopShareService extends IService<ShopShare> {
//
// ShopShareVO get(Long shopId);
//
// Boolean add(Long shopId, ShopShareDTO shopShareDTO);
//
// Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status);
//}

View File

@@ -0,0 +1,17 @@
package com.czg.market.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class CouponInfoDTO implements Serializable {
/**
* 券id
*/
private Long id;
/**
* 券数量
*/
private Integer num;
}

View File

@@ -0,0 +1,121 @@
package com.czg.market.dto;
import com.czg.market.entity.ShopCoupon;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@Data
public class MemberConfigDTO implements Serializable {
@Data
public static class ConfigCoupon {
@Min(value = 1, message = "数量不能小于1")
private Integer num;
private ShopCoupon coupon;
}
@Data
public static class ConfigCoupon2 {
@Min(value = 1, message = "数量不能小于1")
private Integer num;
private ShopCoupon coupon;
}
@Data
public static class ConfigList {
@NotBlank(message = "名称不为空")
private String name;
@NotNull(message = "价格不能为空")
@DecimalMin(value = "0.01", message = "价格不能小于0.01")
private BigDecimal price;
@Min(value = 0, message = "赠送成长值不能小于0")
private Integer reward;
@Valid
private List<ConfigCoupon> couponList;
@NotNull(message = "会员周期不为空")
@Min(value = 1, message = "会员周期不能小于1")
private Integer circleTime;
@NotBlank(message = "会员周期单位不为空")
private String circleUnit;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class condition {
private String code;
private String value;
}
/**
* id
*/
@NotNull(message = "id不能为空")
private Long id;
private Long isOpen;
/**
* 提交生日/姓名
*/
@NotNull(message = "提交生日/姓名不能为空")
private Integer isSubmitInfo;
/**
* 方案列表
*/
@Valid
private List<ConfigList> configList;
/**
* 条件开通条件项
*/
@Valid
private List<condition> conditionList;
/**
* 参与会员价门店
*/
private List<Long> memberPriceShopIdList;
/**
* 是否享受会员价
*/
@NotNull(message = "是否享受会员价不能为空")
private Integer isMemberPrice;
/**
* 每消费一元经验值
*/
@Min(value = 0, message = "消费增成长值最小为0")
private Float costReward;
/**
* 每充值一元经验值
*/
@Min(value = 0, message = "充值增成长值最小为0")
private Float rechargeReward;
/**
* 规则说明
*/
@NotBlank(message = "规则说明不能为空")
private String remark;
private String openType;
private String memberPriceShopType;
}

View File

@@ -0,0 +1,63 @@
package com.czg.market.dto;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员经验值流水表 实体类。
*
* @author zs
* @since 2025-09-12
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MemberExpFlowDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
/**
* 描述
*/
private String content;
/**
* 类型 + -
*/
private String type;
/**
* 来源类型 COST消费赠送 RECHARGE充值
*/
private String sourceType;
/**
* 赠送数量
*/
private Integer value;
/**
* 来源id
*/
private Long sourceId;
private Long userId;
private Long shopId;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,91 @@
package com.czg.market.dto;
import com.czg.market.entity.ShopCoupon;
import com.czg.validator.group.UpdateGroup;
import com.czg.validator.group.member.MemberLevelCycleRewardGroup;
import jakarta.validation.constraints.*;
import lombok.Data;
import java.util.List;
@Data
public class MemberLevelDTO {
/**
* ID
*/
@NotNull(message = "id不为空", groups = UpdateGroup.class)
private Long id;
/**
* 说明
*/
@Size(max = 200, message = "最大长度为200")
private String remark;
/**
* 会员名称
*/
@NotBlank(message = "会员名称不为空")
@Size(max = 30, message = "最大长度为30")
private String name;
/**
* 所需成长值
*/
@Min(value = 0, message = "成长值不能小于0")
@NotNull(message = "成长值不为空")
private Integer experienceValue;
/**
* 会员折扣
*/
@NotNull(message = "会员折扣不为空")
@Min(value = 0, message = "会员折扣不能小于0")
private Integer discount;
/**
* logo
*/
private String logo;
/**
* 消费送积分消费n元送1积分, 0为禁用
*/
@DecimalMin(value = "0.01", message = "消费送积分不能小于0.01")
private Float costRewardPoints;
/**
* 周期奖励状态 0禁用 1启用
*/
@NotNull(message = "周期奖励状态不为空")
private Integer isCycleReward;
/**
* 周期时间包含周 月 年 日
*/
@NotNull(message = "周期时间不为空", groups = MemberLevelCycleRewardGroup.class)
private Integer cycleTime;
@NotBlank(message = "周期单位不为空", groups = MemberLevelCycleRewardGroup.class)
private String cycleUnit;
/**
* 赠送积分
*/
@DecimalMin(value = "0.01", message = "赠送积分不能小于0.01")
private Float cycleRewardPoints;
/**
* 优惠券列表
*/
private List<ConfigCoupon> cycleRewardCouponList;
@NotNull(message = "是否启用消费送积分不为空")
private Integer isCostRewardPoints;
@Data
public static class ConfigCoupon {
@Min(value = 1, message = "数量不能小于1")
private Integer num;
private ShopCoupon coupon;
}
}

View File

@@ -0,0 +1,49 @@
package com.czg.market.dto;
import java.io.Serializable;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员充值订单 实体类。
*
* @author zs
* @since 2025-09-11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MemberOrderDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 店铺id
*/
@NotNull(message = "店铺id不能为空")
private Long shopId;
/**
* 名称
*/
@NotBlank(message = "方案名称不为空")
private String name;
/**
* 数量
*/
@NotNull(message = "数量不为空")
private Integer num;
private String platformType;
private Long userId;
private String orderType;
}

View File

@@ -0,0 +1,68 @@
package com.czg.market.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import java.util.List;
import com.czg.constant.TableValueConstant;
import com.czg.market.entity.MkConsumeDiscountRandom;
import com.czg.validator.group.UpdateGroup;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 新客立减 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MkConsumeDiscountDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@NotNull(message = "id不为空")
private Long id;
/**
* 是否开启
*/
@NotNull(message = "是否开启不为空")
private Integer isEnable;
/**
* 固定 FIXED 随机 RANDOM
*/
@NotEmpty(message = "减免类型不为空")
private String discountType;
/**
* 固定减免金额
*/
private BigDecimal discountAmount;
/**
* 随机减免规则
*/
private List<MkConsumeDiscountRandom> randomDiscountList;
/**
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
*/
private List<String> useTypeList;
}

View File

@@ -0,0 +1,58 @@
package com.czg.market.dto;
import java.io.Serializable;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* 券赠送关联表 实体类。
*
* @author ww
* @since 2025-09-12
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class MkCouponGiftDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 暂无意义
*/
private Long id;
/**
* 名称(来源名称)
*/
private String sourceName;
/**
* 来源Id
*/
private Long sourceId;
/**
* 1 会员开通赠券 2 会员周活动 3消费赠券
*/
private Integer type;
private String couponName;
/**
* 券ID 如果是子店铺 则使用主店铺的券ID
*/
private Long couponId;
/**
* 券数量
*/
private Integer num;
}

View File

@@ -0,0 +1,88 @@
package com.czg.market.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 充值流水表 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MkRechargeFlowDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
/**
* 门店id
*/
private Long shopId;
/**
* 主店id
*/
private Long masterShopId;
/**
* 用户手机号
*/
private String phone;
/**
* 用户名
*/
private String nickName;
/**
* 充值金额
*/
private BigDecimal amount;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 备注
*/
private String remark;
/**
* 用户id
*/
private Long userId;
/**
* 现金充值 recharge_cash
微信充值 recharge_wx
支付宝 recharge_alipay
充值奖励recharge_reward_amount
充值退款 recharge_refund
订单消费 order_cost
订单退款 order_refund
管理员充值 recharge_admin
管理员消费 admin_cost
*/
private String type;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
}

View File

@@ -1,26 +1,25 @@
package com.czg.account.dto;
package com.czg.market.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 活动赠送商品表 实体类
* 新客立减减免记录 实体类
*
* @author ww
* @since 2025-02-18
* @author zs
* @since 2025-09-17
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShopCouponProductDTO implements Serializable {
public class MkShopConsumeDiscountRecordDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -28,24 +27,29 @@ public class ShopCouponProductDTO implements Serializable {
private Long id;
/**
* 活动Id
* 消费立减id
*/
private Long couponId;
private Long consumeDiscountId;
/**
* 商品id
* 减免金额
*/
private Long productId;
private BigDecimal amount;
/**
* 数量
* 订单金额
*/
private Integer num;
private BigDecimal orderAmount;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
/**
* 门店id
*/
private Long shopId;
}

View File

@@ -0,0 +1,128 @@
package com.czg.market.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import java.util.List;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 消费赠券表 实体类。
*
* @author ww
* @since 2025-09-12
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MkShopConsumerCouponDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增主键
*/
@NotNull(message = "ID不能为空", groups = UpdateGroup.class)
private Long id;
/**
* 店铺ID
*/
private Long shopId;
/**
* 同步Id 预留
*/
// private Long syncId;
/**
* only-仅本店 all全部 /custom 指定
*/
// private String useShopType;
/**
* 可用门店
*/
// private String useShops;
/**
* 可使用类型dine堂食/pickup自取/deliv配送/express快递
*/
private String useType;
/**
* 总发放数量,-10086为不限量
*/
private Integer giveNum;
/**
* 已发放数量
*/
private Integer giftNum;
/**
* 每人领取限量,-10086为不限量
*/
private Integer getLimit;
/**
* 每人每日使用限量,-10086为不限量
*/
private Integer useLimit;
/**
* 状态0-禁用1-启用
*/
private Integer status;
/**
* 已使用数量
*/
private Integer useNum;
/**
* 剩余数量
*/
private Integer leftNum;
/**
* 使用门槛:满多少金额
*/
private BigDecimal fullAmount;
/**
* 券ID
*/
private Integer couponId;
/**
* 券数量
*/
private Integer couponNum;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 更新时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
List<MkCouponGiftDTO> couponGiftList;
}

View File

@@ -0,0 +1,50 @@
package com.czg.market.dto;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 发放优惠券实体
* @author ww
* @description
*/
@Data
public class MkShopCouponGiftDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 店铺id
*/
private Long shopId;
/**
* 店铺用户id
*/
private Long shopUserId;
/**
* 卷Id (校验是否可用)
*/
private Long couponId;
/**
* 来源活动id
*/
private Long sourceId;
/**
* 来源记录Id
*/
private Long sourceFlowId;
/**
* 来源描述
*/
private String source;
}

View File

@@ -0,0 +1,137 @@
package com.czg.market.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 优惠券发放记录表 实体类。
*
* @author ww
* @since 2025-09-13
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MkShopCouponRecordDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
/**
* 店铺id
*/
private Long shopId;
/**
* 店铺用户id
*/
private Long shopUserId;
/**
* 用户Id
*/
private Long userId;
/**
* 卷Id (校验是否可用)
*/
private Long couponId;
/**
* 卷描述 满10减2/商品卷
*/
private String name;
/**
* 优惠券类型1-满减券2-商品兑换券3-折扣券4-第二件半价券5-消费送券6-买一送一券7-固定价格券8-免配送费券
*/
private Integer type;
/**
* 满多少金额
*/
private BigDecimal fullAmount;
/**
* 减多少金额
*/
private BigDecimal discountAmount;
/**
* 折扣率 %
*/
private Integer discountRate;
/**
* 来源活动id
*/
private Long sourceId;
/**
* 来源记录Id
*/
private Long sourceFlowId;
/**
* 领取时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 使用时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime useTime;
/**
* 过期时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime useEndTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime useStartTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
private String couponJson;
/**
* 来源描述
*/
private String source;
/**
* 0未使用
* 1已使用
* 2已过期
*/
private Integer status;
/**
* 使用记录Id 订单Id
*/
private Long targetId;
/**
* 头像
*/
private String headImg;
/**
* 用户昵称
*/
private String nickName;
}

View File

@@ -0,0 +1,80 @@
package com.czg.market.dto;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import java.util.List;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 充值配置表 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MkShopRechargeDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@NotNull(message = "ID不能为空")
private Long id;
/**
* 可用分店id
*/
private List<Long> shopIdList;
/**
* all 全部可用 part部分门店可用
*/
@NotEmpty(message = "可用类型不能为空")
private String useType;
/**
* 是否自定义金额
*/
@NotNull(message = "是否自定义金额不能为空")
private Integer isCustom;
/**
* 充值并下单
*/
@NotNull(message = "充值并下单不能为空")
private Integer isOrder;
/**
* 充值说明
*/
@NotBlank(message = "充值说明不能为空")
@Size(max = 250, message = "最大长度为250")
private String remark;
/**
* 是否开启
*/
@NotNull(message = "是否开启不能为空")
private Integer isEnable;
/**
* 充值面额
*/
private List<MkShopRechargeDetailDTO> shopRechargeDetailList;
}

View File

@@ -0,0 +1,48 @@
package com.czg.market.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import java.io.Serial;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 充值面额详情 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MkShopRechargeDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 充值金额
*/
private BigDecimal amount;
/**
* 赠送金额
*/
private BigDecimal rewardAmount;
/**
* 赠送积分
*/
private Integer rewardPoints;
/**
* 赠送优惠券信息
*/
private List<CouponInfoDTO> couponInfoList;
}

View File

@@ -0,0 +1,291 @@
package com.czg.market.dto;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.annotation.JSONField;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Time;
import java.time.LocalDateTime;
/**
* 优惠券信息表 实体类。
*
* @author ww
* @since 2025-09-11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ShopCouponDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增主键
*/
@Null(message = "ID必须为空", groups = InsertGroup.class)
@NotNull(message = "ID不能为空", groups = UpdateGroup.class)
private Long id;
/**
* 店铺ID
*/
private Long shopId;
/**
* 同步Id
*/
private Long syncId;
/**
* 优惠券类型1-满减券2-商品兑换券3-折扣券4-第二件半价券5-消费送券6-买一送一券7-固定价格券8-免配送费券
*/
private Integer couponType;
/**
* 券名称
*/
@NotBlank(message = "券名称不能为空", groups = {InsertGroup.class, UpdateGroup.class})
private String title;
/**
* 可用门店类型only-仅本店all-所有门店custom-指定门店
*/
private String useShopType;
/**
* 可用门店
*/
private String useShops;
/**
* 可使用类型dine堂食/pickup自取/deliv配送/express快递
*/
private String useType;
/**
* 有效期类型fixed固定时间custom自定义时间
*/
@NotBlank(message = "有效期类型不能为空", groups = {InsertGroup.class, UpdateGroup.class})
private String validType;
/**
* 有效期(天)
*/
private Integer validDays;
/**
* 有效期开始时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime validStartTime;
/**
* 有效期结束时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime validEndTime;
/**
* 隔天生效
*/
private Integer daysToTakeEffect;
/**
* 可用周期,如:周一,周二,周三,周四,周五,周六,周七
*/
private String useDays;
/**
* 可用时间段类型all-全时段custom-指定时段
*/
@NotBlank(message = "可用时间段类型不能为空", groups = {InsertGroup.class, UpdateGroup.class})
private String useTimeType;
/**
* 可用开始时间
*/
private Time useStartTime;
/**
* 可用结束时间
*/
private Time useEndTime;
/**
* 发放设置:不可自行领取/no可领取/yes
*/
@NotBlank(message = "发放设置不能为空", groups = {InsertGroup.class, UpdateGroup.class})
private String getType;
/**
* 用户领取方式
*/
private String getMode;
/**
* 总发放数量,-10086为不限量
*/
private Integer giveNum;
/**
* 已发放数量
*/
private Integer giftNum;
/**
* 可领取用户:全部/all新用户一次/new仅会员/vip
*/
@NotBlank(message = "可领取用户不能为空", groups = {InsertGroup.class, UpdateGroup.class})
private String getUserType;
/**
* 每人领取限量,-10086为不限量
*/
private Integer getLimit;
/**
* 每人每日使用限量,-10086为不限量
*/
private Integer useLimit;
/**
* 与限时折扣同享0-否1-是
*/
private Integer discountShare;
/**
* 与会员价同享0-否1-是
*/
private Integer vipPriceShare;
/**
* 附加规则说明
*/
private String ruleDetails;
/**
* 状态0-禁用1-启用
*/
private Integer status;
/**
* 已使用数量
*/
private Integer useNum;
/**
* 剩余数量
*/
private Integer leftNum;
/**
* 指定门槛商品
*/
private String foods;
/**
* 使用门槛:满多少金额
*/
private BigDecimal fullAmount;
/**
* 使用门槛:减多少金额
*/
private BigDecimal discountAmount;
/**
* 折扣%
*/
private Integer discountRate;
/**
* 可抵扣最大金额 元
*/
private BigDecimal maxDiscountAmount;
/**
* 使用规则price_asc-价格低到高price_desc-高到低
*/
private String useRule;
/**
* 抵扣数量
*/
private Integer discountNum;
/**
* 与其它优惠共享0-否1-是
*/
private Integer otherCouponShare;
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
* 更新时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
/**
* 根据优惠券类型执行不同的校验规则
*/
@AssertTrue(message = "优惠券参数校验失败", groups = {InsertGroup.class, UpdateGroup.class})
public boolean validateByCouponType() {
// 确保优惠券类型不为空(虽然已有@NotNull注解但这里做双重保障
if (couponType == null) {
return false;
}
// 满减券(1)校验
if (couponType == 1) {
// 校验指定门槛商品不为空且不为空字符串
// if (foods == null || foods.trim().isEmpty()) {
// return false;
// }
// 校验满多少和减多少金额
return fullAmount != null && discountAmount != null
&& discountAmount.compareTo(BigDecimal.ZERO) > 0
&& fullAmount.compareTo(BigDecimal.ZERO) > 0
&& fullAmount.compareTo(discountAmount) > 0;
}
// 折扣券(3)校验
if (couponType == 3) {
// 校验折扣率、满多少可用和最大抵扣金额
return discountRate != null && discountRate > 0 && discountRate <= 100
&& fullAmount != null && fullAmount.compareTo(BigDecimal.ZERO) > 0
&& maxDiscountAmount != null && maxDiscountAmount.compareTo(BigDecimal.ZERO) > 0;
}
// 第二件半价券(4)、买一送一券(6)、商品兑换券(2)校验
if (couponType == 2 || couponType == 4 || couponType == 6) {
// 校验可用商品不为空且不为空字符串
if (StrUtil.isBlank(foods)) {
return false;
}
// 校验使用规则不为空
return useRule != null && !useRule.trim().isEmpty();
}
// 其他类型优惠券暂不做特殊校验返回true
return true;
}
}

View File

@@ -0,0 +1,73 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员经验值流水表 实体类。
*
* @author zs
* @since 2025-09-12
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_member_exp_flow")
public class MemberExpFlow implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 描述
*/
private String content;
/**
* 类型 + -
*/
private String type;
/**
* 来源类型 COST消费赠送 RECHARGE充值
*/
private String sourceType;
/**
* 赠送数量
*/
private Long value;
/**
* 来源id
*/
private Long sourceId;
private Long userId;
private Long shopId;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
private BigDecimal money;
}

View File

@@ -0,0 +1,107 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员等级配置 实体类。
*
* @author zs
* @since 2025-09-10
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_member_level_config")
public class MemberLevelConfig implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private String remark;
/**
* ID
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 会员名称
*/
private String name;
/**
* 所需成长值
*/
private Integer experienceValue;
/**
* 会员折扣
*/
private Integer discount;
/**
* logo
*/
private String logo;
/**
* 消费送积分消费n元送1积分, 0为禁用
*/
private Float costRewardPoints;
/**
* 周期奖励状态 0禁用 1启用
*/
private Integer isCycleReward;
/**
* 周期时间包含周 月 年 日
*/
private Integer cycleTime;
private String cycleUnit;
/**
* 赠送积分
*/
private Integer cycleRewardPoints;
/**
* 优惠券列表
*/
private String cycleRewardCouponList;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 修改时间
*/
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
private Integer isCostRewardPoints;
}

View File

@@ -0,0 +1,111 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员充值订单 实体类。
*
* @author zs
* @since 2025-09-11
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_member_order")
public class MemberOrder implements Serializable {
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 订单编号
*/
private String orderNo;
/**
* 店铺id
*/
private Long shopId;
/**
* 金额
*/
private BigDecimal amount;
private BigDecimal price;
/**
* 名称
*/
private String name;
/**
* 用户id
*/
private Long userId;
/**
* 实际支付金额
*/
private BigDecimal payAmount;
/**
* 成长值
*/
private Integer reward;
/**
* 会员周期
*/
private Integer circleTime;
/**
* 会员单位
*/
private String circleUnit;
/**
* 优惠券信息
*/
private String couponList;
/**
* 状态
*/
private String status;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 修改时间
*/
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 支付时间
*/
private LocalDateTime payTime;
/**
* 数量
*/
private Integer num;
}

View File

@@ -0,0 +1,82 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 新客立减 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("mk_consume_discount")
public class MkConsumeDiscount implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 是否开启
*/
private Integer isEnable;
/**
* 固定 FIXED 随机 RANDOM
*/
private String discountType;
/**
* 固定减免金额
*/
private BigDecimal discountAmount;
/**
* 随机减免规则
*/
private String randomDiscountList;
/**
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
*/
private String useTypeList;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 修改时间
*/
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,11 @@
package com.czg.market.entity;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class MkConsumeDiscountRandom {
private BigDecimal amount;
private BigDecimal probability;
}

View File

@@ -0,0 +1,66 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* 券赠送关联表 实体类。
*
* @author ww
* @since 2025-09-12
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Table("mk_coupon_gift")
public class MkCouponGift implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 暂无意义
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 名称(来源名称)
*/
private String sourceName;
/**
* 来源Id
*/
private Long sourceId;
/**
* 1 会员开通赠券 2 会员周活动 3消费赠券
*/
private Integer type;
private String couponName;
/**
* 券ID 如果是子店铺 则使用主店铺的券ID
*/
private Long couponId;
/**
* 券数量
*/
private Integer num;
}

View File

@@ -0,0 +1,63 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 新客立减减免记录 实体类。
*
* @author zs
* @since 2025-09-17
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("mk_shop_consume_discount_record")
public class MkShopConsumeDiscountRecord implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 消费立减id
*/
private Long consumeDiscountId;
/**
* 减免金额
*/
private BigDecimal amount;
/**
* 订单金额
*/
private BigDecimal orderAmount;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 门店id
*/
private Long shopId;
}

View File

@@ -0,0 +1,131 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 消费赠券表 实体类。
*
* @author ww
* @since 2025-09-12
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("mk_shop_consumer_coupon")
public class MkShopConsumerCoupon implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增主键
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 店铺ID
*/
private Long shopId;
/**
* 同步Id 预留
*/
// private Long syncId;
/**
* only-仅本店 all全部 /custom 指定
*/
// private String useShopType;
/**
* 可用门店
*/
// private String useShops;
/**
* 可使用类型dine堂食/pickup自取/deliv配送/express快递
*/
private String useType;
/**
* 总发放数量,-10086为不限量
*/
private Integer giveNum;
/**
* 已发放数量
*/
private Integer giftNum;
/**
* 每人领取限量,-10086为不限量
*/
private Integer getLimit;
/**
* 每人每日使用限量,-10086为不限量
*/
private Integer useLimit;
/**
* 状态0-禁用1-启用
*/
private Integer status;
/**
* 已使用数量
*/
private Integer useNum;
/**
* 剩余数量
*/
private Integer leftNum;
/**
* 使用门槛:满多少金额
*/
private BigDecimal fullAmount;
/**
* 券ID
*/
@Column(ignore = true)
private Integer couponId;
/**
* 券数量
*/
@Column(ignore = true)
private Integer couponNum;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 更新时间
*/
@Column(onUpdateValue = "now()")
private LocalDateTime updateTime;
}

View File

@@ -1,4 +1,4 @@
package com.czg.account.entity;
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
@@ -12,21 +12,24 @@ import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* 活动商品赠送记录表 实体类
* 优惠券发放记录表 实体类
*
* @author ww
* @since 2025-02-20
* @since 2025-09-13
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_activate_coupon_record")
public class ShopActivateCouponRecord implements Serializable {
@Table("mk_shop_coupon_record")
@Accessors(chain = true)
public class MkShopCouponRecord implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -35,10 +38,20 @@ public class ShopActivateCouponRecord implements Serializable {
private Long id;
/**
* 用户id shopUserId
* 店铺id
*/
private Long shopId;
/**
* 店铺用户id
*/
private Long shopUserId;
/**
* 用户Id
*/
private Long userId;
/**
* 卷Id (校验是否可用)
*/
@@ -50,15 +63,10 @@ public class ShopActivateCouponRecord implements Serializable {
private String name;
/**
* 1-满减 2-商品
* 优惠券类型1-满减2-商品兑换券3-折扣券4-第二件半价券 6-买一送一券7-固定价格券8-免配送费券
*/
private Integer type;
/**
* 商品id
*/
private Long proId;
/**
* 满多少金额
*/
@@ -70,49 +78,61 @@ public class ShopActivateCouponRecord implements Serializable {
private BigDecimal discountAmount;
/**
* 店铺id
* 折扣率 %
*/
private Long shopId;
@Column(ignore = true)
private String shopName;
private Integer discountRate;
/**
* 来源活动id
*/
private Long sourceActId;
private Long sourceId;
/**
* 来源记录Id
*/
private Long sourceFlowId;
/**
* 可用开始时间
* 领取时间
*/
private LocalDateTime useStartTime;
/**
* 可用结束时间
*/
private LocalDateTime useEndTime;
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 使用时间
*/
private LocalDateTime useTime;
/**
* 过期时间
*/
private LocalDateTime useEndTime;
private LocalDateTime useStartTime;
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
private String couponJson;
/**
* invited 邀请
* activate 活动
* 来源描述
*/
private String source;
/**
* 未使用 0
* 已使用 1
* 已过期 2
* 0未使用
* 1已使用
* 2已过期
*/
private Integer status;
/**
* 使用记录Id 订单Id
*/
private Long targetId;
/**
* 删除状态 0-正常 1-删除
*/
private Integer isDel;
}

View File

@@ -0,0 +1,86 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 充值配置表 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("mk_shop_recharge")
public class MkShopRecharge implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* ID
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 主店id
*/
private Long masterShopId;
/**
* 可用分店id
*/
private String shopIdList;
/**
* all 全部可用 part部分门店可用
*/
private String useType;
/**
* 是否自定义金额
*/
private Integer isCustom;
/**
* 充值并下单
*/
private Integer isOrder;
/**
* 充值说明
*/
private String remark;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 修改时间
*/
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 是否开启
*/
private Integer isEnable;
}

View File

@@ -0,0 +1,71 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 充值面额详情 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("mk_shop_recharge_detail")
public class MkShopRechargeDetail implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 充值金额
*/
private BigDecimal amount;
/**
* 赠送金额
*/
private BigDecimal rewardAmount;
/**
* 赠送积分
*/
private Integer rewardPoints;
/**
* 赠送优惠券信息
*/
private String couponInfoList;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 修改时间
*/
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
private Long shopRechargeId;
}

View File

@@ -0,0 +1,96 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 充值流水表 实体类。
*
* @author zs
* @since 2025-09-16
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("mk_shop_recharge_flow")
public class MkShopRechargeFlow implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 门店id
*/
private Long shopId;
/**
* 主店id
*/
private Long masterShopId;
/**
* 用户手机号
*/
private String phone;
/**
* 用户名
*/
private String nickName;
/**
* 充值金额
*/
private BigDecimal amount;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 备注
*/
private String remark;
/**
* 用户id
*/
private Long userId;
/**
* 现金充值 recharge_cash
微信充值 recharge_wx
支付宝 recharge_alipay
充值奖励recharge_reward_amount
充值退款 recharge_refund
订单消费 order_cost
订单退款 order_refund
管理员充值 recharge_admin
管理员消费 admin_cost
*/
private String type;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,244 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Time;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* 优惠券信息表 实体类。
*
* @author ww
* @since 2025-09-11
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("mk_shop_coupon")
@Accessors(chain = true)
public class ShopCoupon implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增主键
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 店铺ID
*/
private Long shopId;
/**
* 同步Id
*/
private Long syncId;
/**
* 优惠券类型1-满减券2-商品兑换券3-折扣券4-第二件半价券5-消费送券6-买一送一券7-固定价格券8-免配送费券
*/
private Integer couponType;
/**
* 券名称
*/
private String title;
/**
* 可用门店类型only-仅本店all-所有门店custom-指定门店
*/
private String useShopType;
/**
* 可用门店
*/
private String useShops;
/**
* 可使用类型dine堂食/pickup自取/deliv配送/express快递
*/
private String useType;
/**
* 有效期类型fixed固定时间custom自定义时间
*/
private String validType;
/**
* 有效期(天)
*/
private Integer validDays;
/**
* 有效期开始时间
*/
private LocalDateTime validStartTime;
/**
* 有效期结束时间
*/
private LocalDateTime validEndTime;
/**
* 隔天生效
*/
private Integer daysToTakeEffect;
/**
* 可用周期,如:周一,周二,周三,周四,周五,周六,周七
*/
private String useDays;
/**
* 可用时间段类型all-全时段custom-指定时段
*/
private String useTimeType;
/**
* 可用开始时间
*/
private Time useStartTime;
/**
* 可用结束时间
*/
private Time useEndTime;
/**
* 发放设置:不可自行领取/no可领取/yes
*/
private String getType;
/**
* 用户领取方式
*/
private String getMode;
/**
* 总发放数量,-10086为不限量
*/
private Integer giveNum;
/**
* 已发放数量
*/
private Integer giftNum;
/**
* 可领取用户:全部/all新用户一次/new仅会员/vip
*/
private String getUserType;
/**
* 每人领取限量,-10086为不限量
*/
private Integer getLimit;
/**
* 每人每日使用限量,-10086为不限量
*/
private Integer useLimit;
/**
* 与限时折扣同享0-否1-是
*/
private Integer discountShare;
/**
* 与会员价同享0-否1-是
*/
private Integer vipPriceShare;
/**
* 附加规则说明
*/
private String ruleDetails;
/**
* 状态0-禁用1-启用
*/
private Integer status;
/**
* 已使用数量
*/
private Integer useNum;
/**
* 剩余数量
*/
private Integer leftNum;
/**
* 指定门槛商品
*/
private String foods;
/**
* 使用门槛:满多少金额
*/
private BigDecimal fullAmount;
/**
* 使用门槛:减多少金额
*/
private BigDecimal discountAmount;
/**
* 折扣%
*/
private Integer discountRate;
/**
* 可抵扣最大金额 元
*/
private BigDecimal maxDiscountAmount;
/**
* 使用规则price_asc-价格低到高price_desc-高到低
*/
private String useRule;
/**
* 抵扣数量
*/
private Integer discountNum;
/**
* 与其它优惠共享0-否1-是
*/
private Integer otherCouponShare;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 更新时间
*/
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 删除状态0-正常1-已删除
*/
private Integer isDel;
}

View File

@@ -0,0 +1,100 @@
package com.czg.market.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 会员基础配置 实体类。
*
* @author zs
* @since 2025-09-10
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_member_config")
public class TbMemberConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 提交生日/姓名
*/
private Integer isSubmitInfo;
/**
* 方案列表
*/
private String configList;
/**
* 条件开通条件项
*/
private String conditionList;
/**
* 参与会员价门店
*/
private String memberPriceShopIdList;
/**
* 是否享受会员价
*/
private Integer isMemberPrice;
/**
* 每消费一元经验值
*/
private Long costReward;
/**
* 每充值一元经验值
*/
private Long rechargeReward;
/**
* 店铺id
*/
private Long shopId;
/**
* 规则说明
*/
private String remark;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 修改时间
*/
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
private String openType;
private String memberPriceShopType;
}

View File

@@ -0,0 +1,14 @@
package com.czg.market.service;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MemberExpFlow;
/**
* 会员经验值流水表 服务层。
*
* @author zs
* @since 2025-09-12
*/
public interface MemberExpFlowService extends IService<MemberExpFlow> {
}

View File

@@ -0,0 +1,16 @@
package com.czg.market.service;
import com.czg.market.vo.MemberLevelVO;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MemberLevelConfig;
/**
* 会员等级配置 服务层。
*
* @author zs
* @since 2025-09-10
*/
public interface MemberLevelConfigService extends IService<MemberLevelConfig> {
MemberLevelVO detail(Long memberLevelId);
}

View File

@@ -0,0 +1,16 @@
package com.czg.market.service;
import com.czg.market.dto.MemberOrderDTO;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MemberOrder;
/**
* 会员充值订单 服务层。
*
* @author zs
* @since 2025-09-11
*/
public interface MemberOrderService extends IService<MemberOrder> {
MemberOrder createMemberOrder(MemberOrderDTO orderDTO);
}

View File

@@ -0,0 +1,20 @@
package com.czg.market.service;
import com.czg.exception.ApiNotPrintException;
import com.czg.market.dto.MkConsumeDiscountDTO;
import com.czg.market.vo.MkConsumeDiscountVO;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MkConsumeDiscount;
/**
* 新客立减 服务层。
*
* @author zs
* @since 2025-09-16
*/
public interface MkConsumeDiscountService extends IService<MkConsumeDiscount> {
MkConsumeDiscountVO detail(Long shopId);
Boolean edit(Long shopId, MkConsumeDiscountDTO consumeDiscountDTO) throws ApiNotPrintException;
}

View File

@@ -0,0 +1,78 @@
package com.czg.market.service;
import com.czg.market.dto.MkCouponGiftDTO;
import com.czg.market.entity.MkCouponGift;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import java.util.List;
/**
* 券赠送关联表 服务层。
*
* @author ww
* @since 2025-09-12
*/
public interface MkCouponGiftService extends IService<MkCouponGift> {
/**
* 券关联表查询
*/
Page<MkCouponGiftDTO> getCouponGiftPage(Long couponId, Integer type);
/**
* 根据sourceId查询关联券
*
* @param sourceId 来源Id
* @param type 类型 1 会员开通赠券 2 会员周活动 3 消费赠券
*/
List<MkCouponGiftDTO> getCouponGiftBySourceId(Long sourceId, Integer type);
/**
* 新增关联券
*
* @param sourceId 来源ID
* @param type 类型 1 会员开通赠券 2 会员周活动 3 消费赠券
* @param couponGiftList 券ID 如果是子店铺 则使用主店铺的券ID-数量
*/
void addCouponGift(Long sourceId, String sourceName, Integer type, List<MkCouponGiftDTO> couponGiftList);
/**
* 更新关联券
*
* @param sourceId 来源ID
* @param type 类型 1 会员开通赠券 2 会员周活动 3 消费赠券
* @param couponGiftList 券ID 如果是子店铺 则使用主店铺的券ID和数量必填
*/
void upCouponGift(Long sourceId, String sourceName, Integer type, List<MkCouponGiftDTO> couponGiftList);
/**
* 通过关联Id取消该关联关系
*/
void cancelGift(Long id);
/**
* 删除关联券
*
* @param sourceId 来源ID
* @param type 类型 1 会员开通赠券 2 会员周活动 3 消费赠券
*/
void deleteJoinCouponGift(Long sourceId, Integer type);
/**
* 通过券删除关联
*
* @param couponId 券ID
*/
void deleteCoupon(Long couponId);
/**
* 更新券名称
*
* @param couponId 券ID
* @param couponName 券名称
*/
void upCouponName(Long couponId, String couponName);
}

View File

@@ -0,0 +1,16 @@
package com.czg.market.service;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MkShopRechargeFlow;
/**
* 充值流水表 服务层。
*
* @author zs
* @since 2025-09-16
*/
public interface MkRechargeFlowService extends IService<MkShopRechargeFlow> {
Page<MkShopRechargeFlow> pageInfo(Long shopId, String startTime, String ednTime, String type);
}

View File

@@ -0,0 +1,14 @@
package com.czg.market.service;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MkShopConsumeDiscountRecord;
/**
* 新客立减减免记录 服务层。
*
* @author zs
* @since 2025-09-17
*/
public interface MkShopConsumeDiscountRecordService extends IService<MkShopConsumeDiscountRecord> {
MkShopConsumeDiscountRecord get(Long shopId);
}

View File

@@ -0,0 +1,21 @@
package com.czg.market.service;
import com.czg.market.dto.MkShopConsumerCouponDTO;
import com.czg.market.entity.MkShopConsumerCoupon;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
/**
* 消费赠券表 服务层。
*
* @author ww
* @since 2025-09-12
*/
public interface MkShopConsumerCouponService extends IService<MkShopConsumerCoupon> {
Page<MkShopConsumerCouponDTO> getConsumerCouponPage(MkShopConsumerCouponDTO param);
MkShopConsumerCouponDTO getConsumerCouponById(Long id);
void addConsumerCoupon(MkShopConsumerCouponDTO param);
void updateConsumerCouponById(MkShopConsumerCouponDTO param);
void deleteConsumerCoupon(Long id);
}

View File

@@ -0,0 +1,49 @@
package com.czg.market.service;
import com.czg.account.dto.QueryReceiveDto;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.czg.market.dto.MkShopCouponGiftDTO;
import com.czg.market.dto.MkShopCouponRecordDTO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MkShopCouponRecord;
import java.util.List;
/**
* 优惠券发放记录表 服务层。
*
* @author ww
* @since 2025-09-13
*/
public interface MkShopCouponRecordService extends IService<MkShopCouponRecord> {
List<CouponReceiveVo> queryReceive(QueryReceiveDto param);
List<MkShopCouponRecord> findByUser(List<Long> shopUserIds, Integer status);
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type);
/**
* 优惠券列表/已领取详情
*
* @param search 用户Id/昵称/手机号
*/
Page<MkShopCouponRecordDTO> getRecord(String search, MkShopCouponRecordDTO param, String startTime, String endTime);
/**
* 发放券 统一方法
*
* @param giftDTO 除 sourceFlowId 外 全必填 如果有 也填
* @param number 发放数量
* @param isLimit 是否校验限领,活动与管理员添加 不计限领
*/
void receiveCoupon(MkShopCouponGiftDTO giftDTO, Integer number, boolean isLimit);
/**
* 用户优惠券 失效/删除
*/
void deleteRecord(Long id);
}

View File

@@ -0,0 +1,14 @@
package com.czg.market.service;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MkShopRechargeDetail;
/**
* 充值面额详情 服务层。
*
* @author zs
* @since 2025-09-16
*/
public interface MkShopRechargeDetailService extends IService<MkShopRechargeDetail> {
}

View File

@@ -0,0 +1,20 @@
package com.czg.market.service;
import com.czg.market.dto.MkShopRechargeDTO;
import com.czg.market.vo.MkShopRechargeVO;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.MkShopRecharge;
/**
* 充值配置表 服务层。
*
* @author zs
* @since 2025-09-16
*/
public interface MkShopRechargeService extends IService<MkShopRecharge> {
MkShopRechargeVO detail(Long shopId);
Boolean edit(Long shopId, MkShopRechargeDTO shopRechargeDTO);
}

View File

@@ -0,0 +1,36 @@
package com.czg.market.service;
import com.czg.account.vo.UserCouponVo;
import com.czg.market.dto.ShopCouponDTO;
import com.czg.market.entity.MkShopCouponRecord;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.ShopCoupon;
import java.util.List;
/**
* 优惠券信息表 服务层。
*
* @author ww
* @since 2025-09-11
*/
public interface ShopCouponService extends IService<ShopCoupon> {
Page<ShopCouponDTO> getCouponPage(ShopCouponDTO param);
ShopCouponDTO getCouponById(Long id);
void addCoupon(ShopCouponDTO param);
void updateCouponById(ShopCouponDTO param);
void deleteCoupon(Long id);
Page<MkShopCouponRecord> find(Long userId, Long shopId, Integer status);
List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type);
Boolean use(List<Long> ids, Long shopUserId, Long orderId);
Boolean refund(Long orderId, Long shopUserId);
}

View File

@@ -0,0 +1,49 @@
package com.czg.market.service;
import com.czg.constant.TableValueConstant;
import com.czg.exception.ApiNotPrintException;
import com.czg.market.dto.MemberConfigDTO;
import com.czg.market.dto.MemberLevelDTO;
import com.czg.market.vo.MemberConfigVO;
import com.czg.market.vo.MemberLevelVO;
import com.mybatisflex.core.service.IService;
import com.czg.market.entity.TbMemberConfig;
import java.math.BigDecimal;
import java.util.ArrayList;
/**
* 会员基础配置 服务层。
*
* @author zs
* @since 2025-09-10
*/
public interface TbMemberConfigService extends IService<TbMemberConfig> {
MemberConfigVO detail(Long shopId);
Boolean edit(Long shopId, MemberConfigDTO memberDTO);
Boolean addLevel(Long shopId, MemberLevelDTO levelDTO) throws ApiNotPrintException;
Boolean editLevel(Long shopId, MemberLevelDTO levelDTO);
ArrayList<MemberLevelVO> listLevel(Long shopId);
/**
* 根据传入的用户Id校验是否符合条件符合加入会员
* @param shopId 店铺id
* @param userId 用户id
* @return 是否加入成功
*/
boolean joinMember(Long shopId, Long userId, Long memberOrderId);
/**
* 发放会员奖励
* @param money 实际消费金额
* @param expVal 经验值只有当type为pay的时候才生效
* @return 是否成功
*/
boolean deliver(Long shopId, Long userId, TableValueConstant.MemberExpFlow.Type type, BigDecimal money, Integer expVal, Long sourceId);
}

View File

@@ -0,0 +1,14 @@
package com.czg.market.vo;
import com.czg.market.entity.ShopCoupon;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class CouponInfoVO implements Serializable {
private ShopCoupon coupon;
private Integer num;
}

View File

@@ -0,0 +1,88 @@
package com.czg.market.vo;
import com.czg.market.dto.MemberConfigDTO;
import jakarta.validation.Valid;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class MemberConfigVO implements Serializable {
/**
* id
*/
@NotNull(message = "id不能为空")
private Long id;
/**
* 提交生日/姓名
*/
@NotNull(message = "提交生日/姓名不能为空")
private Integer isSubmitInfo;
/**
* 方案列表
*/
@Valid
private List<MemberConfigDTO.ConfigList> configList;
/**
* 条件开通条件项
*/
@Valid
private List<MemberConfigDTO.condition> conditionList;
/**
* 购买开通金额
*/
@DecimalMin(value = "0.01", message = "金额不能小于0.01")
private BigDecimal openAmount;
/**
* 参与会员价门店
*/
private List<Long> memberPriceShopIdList;
/**
* 是否享受会员价
*/
@NotNull(message = "是否享受会员价不能为空")
private Integer isMemberPrice;
/**
* 每消费一元经验值
*/
@Min(value = 0, message = "消费增成长值最小为0")
private Long costReward;
/**
* 每充值一元经验值
*/
@Min(value = 0, message = "充值增成长值最小为0")
private Long rechargeReward;
/**
* 规则说明
*/
@NotBlank(message = "规则说明不能为空")
private String remark;
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
private String openType;
private String memberPriceShopType;
}

View File

@@ -0,0 +1,88 @@
package com.czg.market.vo;
import com.czg.market.dto.MemberLevelDTO;
import com.czg.market.entity.ShopCoupon;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class MemberLevelVO implements Serializable {
private String remark;
/**
* ID
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 会员名称
*/
private String name;
/**
* 所需成长值
*/
private Integer experienceValue;
/**
* 会员折扣
*/
private Integer discount;
/**
* logo
*/
private String logo;
/**
* 消费送积分消费n元送1积分, 0为禁用
*/
private Float costRewardPoints;
/**
* 周期奖励状态 0禁用 1启用
*/
private Integer isCycleReward;
/**
* 周期时间包含周 月 年 日
*/
private Integer cycleTime;
private String cycleUnit;
/**
* 赠送积分
*/
private Integer cycleRewardPoints;
/**
* 优惠券列表
*/
private List<MemberLevelDTO.ConfigCoupon> cycleRewardCouponList;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
private Integer isCostRewardPoints;
}

View File

@@ -0,0 +1,61 @@
package com.czg.market.vo;
import com.czg.market.entity.MkConsumeDiscountRandom;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class MkConsumeDiscountVO implements Serializable {
/**
* ID
*/
private Long id;
/**
* 是否开启
*/
private Integer isEnable;
/**
* 固定 FIXED 随机 RANDOM
*/
private String discountType;
/**
* 固定减免金额
*/
private BigDecimal discountAmount;
/**
* 随机减免规则
*/
private List<MkConsumeDiscountRandom> randomDiscountList;
/**
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
*/
private List<String> useTypeList;
/**
* 店铺id
*/
private Long shopId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,50 @@
package com.czg.market.vo;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class MkShopRechargeDetailVO implements Serializable {
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 充值金额
*/
private BigDecimal amount;
/**
* 赠送金额
*/
private BigDecimal rewardAmount;
/**
* 赠送积分
*/
private Integer rewardPoints;
/**
* 赠送优惠券信息
*/
private List<CouponInfoVO> couponInfoList;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
private Long shopRechargeId;
}

View File

@@ -0,0 +1,64 @@
package com.czg.market.vo;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class MkShopRechargeVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
* 主店id
*/
private Long masterShopId;
/**
* 可用分店id
*/
private List<Long> shopIdList;
/**
* all 全部可用 part部分门店可用
*/
private String useType;
/**
* 是否自定义金额
*/
private Integer isCustom;
/**
* 充值并下单
*/
private Integer isOrder;
/**
* 充值说明
*/
private String remark;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 修改时间
*/
private LocalDateTime updateTime;
/**
* 是否开启
*/
private Integer isEnable;
private List<MkShopRechargeDetailVO> rechargeDetailList;
}

View File

@@ -51,7 +51,7 @@ public class CheckOrderPay implements Serializable {
/**
* 折扣比例(计算时 向上取整保留 两位小数)
*/
private BigDecimal discountRatio;
// private BigDecimal discountRatio;
/**
* 手动优惠金额
*/
@@ -62,9 +62,9 @@ public class CheckOrderPay implements Serializable {
*/
private BigDecimal productCouponDiscountAmount;
/**
* 满减优惠券抵扣金额
* 其它优惠券抵扣金额
*/
private BigDecimal fullCouponDiscountAmount;
private BigDecimal otherCouponDiscountAmount;
/**
* 用户使用的卡券
*/
@@ -108,15 +108,15 @@ public class CheckOrderPay implements Serializable {
return pointsNum == null ? 0 : pointsNum;
}
public BigDecimal getDiscountRatio() {
if (discountRatio == null) {
return BigDecimal.ZERO;
}
return discountRatio.setScale(2, RoundingMode.UP);
}
// public BigDecimal getDiscountRatio() {
// if (discountRatio == null) {
// return BigDecimal.ZERO;
// }
// return discountRatio.setScale(2, RoundingMode.UP);
// }
public BigDecimal getFullCouponDiscountAmount() {
return fullCouponDiscountAmount == null ? BigDecimal.ZERO : fullCouponDiscountAmount;
public BigDecimal getOtherCouponDiscountAmount() {
return otherCouponDiscountAmount == null ? BigDecimal.ZERO : otherCouponDiscountAmount;
}
public BigDecimal getProductCouponDiscountAmount() {

View File

@@ -102,6 +102,10 @@ public class OrderDetail implements Serializable {
* 优惠券抵扣数量
*/
private BigDecimal couponNum;
/**
* 半价券抵扣数量
*/
private BigDecimal halfPriceCouponNum;
/**
* 退菜数量(不管价格)

View File

@@ -102,6 +102,10 @@ public class OrderInfo implements Serializable {
* 满减优惠券抵扣金额
*/
private BigDecimal fullCouponDiscountAmount;
/**
* 其它优惠券抵扣金额
*/
private BigDecimal otherCouponDiscountAmount;
/**
* 折扣金额

View File

@@ -17,7 +17,6 @@ import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 订单表 服务层。
@@ -50,12 +49,8 @@ public interface OrderInfoService extends IService<OrderInfo> {
void expired(Long orderId);
OrderInfo createPayOrder(Long shopId, BigDecimal amount, String remark);
void processOrderDetails2(List<OrderDetail> orderDetails, Map<Long, Integer> prodCouponMap,
BigDecimalDTO prodCouponAmount, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
boolean isAllPack, Integer userAllPack, boolean isVipPrice);
void getOrderAmount(List<OrderDetail> orderDetails, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
BigDecimalDTO tempAmount, boolean isAllPack, Integer userAllPack, boolean isVipPrice);
Boolean printOrder(Long shopId, OrderInfoPrintDTO orderInfoPrintDTO);

View File

@@ -85,4 +85,10 @@ public interface ShopSyncService {
* @param vendorId 供应商Id
*/
void syncVendorBySourceShop(Long sourceShopId, Long vendorId, Long sysUserId);
/**
* 同步优惠券
* @param type 1 新增 2 修改 3 删除
*/
void syncCouponBySourceShop(Long sourceShopId, Long couponId, Integer type);
}

View File

@@ -0,0 +1,41 @@
package com.czg.constant;
import lombok.Getter;
/**
* @author Administrator
*/
public interface TableValueConstant {
interface MemberExpFlow {
@Getter
enum Type {
RECHARGE("RECHARGE", "充值增积分"),
PAY("PAY", "购买会员增积分"),
MEMBER_TASK("MEMBER_TASK", "会员周奖励"),
COST("COST", "消费增积分");
private final String code;
private final String msg;
Type(String code, String msg) {
this.code = code;
this.msg = msg;
}
}
}
interface ConsumeDiscount {
@Getter
enum DiscountType {
FIXED("fixed", "固定减免"),
RANDOM("random", "随机减免");
private final String code;
private final String msg;
DiscountType(String code, String msg) {
this.code = code;
this.msg = msg;
}
}
}
}

View File

@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 校验工具类
@@ -17,6 +18,19 @@ import java.util.Map;
*/
public class AssertUtil {
/**
* 判断两个对象是否不相等,如果不相等则抛出异常
* @param a 实际值
* @param b 期望值
* @param message 异常消息
*/
public static void isNotEqual(Object a, Object b, String message) {
// 如果实际值与期望值不相等,则抛出异常
if (!Objects.equals(a, b)) {
throw new ValidateException(message);
}
}
/**
* 检查字符串是否不为空或空白字符,如果为空或空白字符则抛出异常
*

View File

@@ -2,6 +2,8 @@ package com.czg.utils;
import cn.hutool.core.util.StrUtil;
import java.time.LocalDate;
/**
* @author ww
* @description
@@ -15,4 +17,18 @@ public class CzgStrUtils {
public static String getStrOrNull(String str) {
return StrUtil.isNotBlank(str) ? str : null;
}
/**
* 获取当天是周几
* @return 周几
*/
public static String getStrWeek() {
int dayOfWeek = LocalDate.now().getDayOfWeek().getValue();
// 定义汉字星期数组索引0不用从1开始对应周一到周日
String[] chineseWeeks = {"", "", "", "", "", "", "", ""};
return "" + chineseWeeks[dayOfWeek];
}
}

View File

@@ -0,0 +1,11 @@
package com.czg.validator.group.member;
/**
* @author admin admin@cashier.com
* @since 1.0.0
*/
public interface MemberLevelCycleRewardGroup {
}

View File

@@ -1,37 +0,0 @@
package com.czg.service.account.service.impl;
import com.czg.account.dto.QueryReceiveDto;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.service.ShopActivateCouponRecordService;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.czg.service.account.mapper.ShopActivateCouponRecordMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import java.util.List;
/**
* 活动商品赠送记录表 服务层实现。
*
* @author ww
* @since 2025-02-20
*/
@DubboService
public class ShopActivateCouponRecordServiceImpl extends ServiceImpl<ShopActivateCouponRecordMapper, ShopActivateCouponRecord> implements ShopActivateCouponRecordService {
@Override
public List<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
return getMapper().queryReceive(param);
}
@Override
public List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status) {
return getMapper().findByUser(shopUserIds, status);
}
@Override
public List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type) {
return getMapper().queryByVipIdAndShopId(shopId, shopUserId, type);
}
}

View File

@@ -1,191 +0,0 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.czg.account.dto.ShopActivateDTO;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
import com.czg.account.entity.ShopActivate;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.entity.ShopCoupon;
import com.czg.account.entity.ShopUser;
import com.czg.account.service.*;
import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.ShopActivateMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 活动 服务层实现。
*
* @author ww
* @since 2025-02-17
*/
@Slf4j
@DubboService
public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, ShopActivate> implements ShopActivateService {
@Resource
private ShopCouponService couponService;
@Resource
private ShopActivateCouponRecordService inRecordService;
@Resource
private ShopUserService shopUserService;
@Resource
private MemberPointsService pointsService;
@Override
public List<ShopActivateDTO> getList(Long shopId) {
List<ShopActivateDTO> activateDtoS = queryChain().select()
.eq(ShopActivate::getShopId, shopId == null ? StpKit.USER.getShopId() : shopId)
.orderBy(ShopActivate::getAmount, true)
.listAs(ShopActivateDTO.class);
for (ShopActivateDTO activateDTO : activateDtoS) {
if (StrUtil.isNotBlank(activateDTO.getCoupons())) {
//组装优惠券
activateDTO.setCouponList(getCoupons(activateDTO.getCoupons()));
}
}
return activateDtoS;
}
@Override
public Boolean add(ShopActivateDTO activateDTO) {
ShopActivate shopActivate = new ShopActivate();
BeanUtil.copyProperties(activateDTO, shopActivate);
return save(shopActivate);
}
@Override
public Boolean edit(ShopActivateDTO activateDTO) {
ShopActivate shopActivate = new ShopActivate();
BeanUtil.copyProperties(activateDTO, shopActivate);
return updateById(shopActivate);
}
@Override
public void giveActivate(ShopUser shopUser, BigDecimal memAmount, Long activateId, Long relationId) {
if (activateId == null) {
return;
}
ShopActivate activate = getById(activateId);
if (ObjectUtil.isNull(activate)) {
return;
}
//赠送优惠券
if (activate.getIsGiftCoupon() == 1 && StrUtil.isNotBlank(activate.getCoupons())) {
Map<Long, Integer> couponUseMap = JSONObject.parseObject(activate.getCoupons(), new TypeReference<>() {
});
Map<Long, ShopCoupon> couponMap = new HashMap<>();
couponUseMap.forEach((couponId, giftNumber) -> {
ShopCoupon shopCoupon;
if (couponMap.containsKey(couponId)) {
shopCoupon = couponMap.get(couponId);
} else {
shopCoupon = couponService.queryChain().select().eq(ShopCoupon::getId, couponId).one();
couponMap.put(couponId, shopCoupon);
}
if (shopCoupon != null && shopCoupon.getStatus().equals(1) && shopCoupon.getLeftNumber() > giftNumber) {
LocalDateTime start = LocalDateTime.now().with(LocalTime.MIN);
LocalDateTime end = null;
if ("fixed".equals(shopCoupon.getValidityType())) {
//固定时间
end = LocalDateTimeUtil.offset(start, shopCoupon.getValidDays(), ChronoUnit.DAYS).with(LocalTime.MAX);
} else if ("custom".equals(shopCoupon.getValidityType())) {
//自定义时间
start = shopCoupon.getValidStartTime();
end = shopCoupon.getValidEndTime();
}
List<ShopActivateCouponRecord> actGiveRecords = new ArrayList<>();
ShopActivateCouponRecord record = new ShopActivateCouponRecord();
record.setShopUserId(shopUser.getId());
record.setCouponId(shopCoupon.getId());
record.setShopId(shopUser.getShopId());
record.setSourceActId(activate.getId());
record.setSourceFlowId(relationId);
record.setUseStartTime(start);
record.setUseEndTime(end);
record.setSource("activate");
record.setName(shopCoupon.getTitle());
record.setCouponJson(getCouponJson(activate, shopCoupon));
if (shopCoupon.getType() == 1) {
record.setType(1);
record.setFullAmount(shopCoupon.getFullAmount());
record.setDiscountAmount(shopCoupon.getDiscountAmount());
} else if (shopCoupon.getType() == 2) {
record.setType(2);
record.setProId(shopCoupon.getProId());
}
for (int i = 0; i < giftNumber; i++) {
actGiveRecords.add(record);
}
inRecordService.saveBatch(actGiveRecords);
couponService.updateChain()
.set(ShopCoupon::getLeftNumber, shopCoupon.getLeftNumber() - giftNumber)
.eq(ShopCoupon::getId, shopCoupon.getId())
.update();
}
});
}
//赠送金额
if (activate.getGiftAmount() != null && activate.getGiftAmount().compareTo(BigDecimal.ZERO) > 0) {
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
.setId(shopUser.getId())
.setMoney(activate.getGiftAmount())
.setType(1)
.setRemark("充值活动赠送")
.setRelationId(relationId)
.setBizEnum(ShopUserFlowBizEnum.AWARD_IN);
//更新会员余额 并生成流水
shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
}
if (activate.getGiftPoints() != null && activate.getGiftPoints() > 0) {
pointsService.addPoints(shopUser.getId(), activate.getGiftPoints(), "储值赠送积分", null);
}
}
/**
* 获取优惠券详细信息 目前仅返回 id 名称 剩余数量 赠送数量
*/
private List<ShopCoupon> getCoupons(String couponJson) {
Map<String, Integer> couponMap;
try {
couponMap = JSONObject.parseObject(couponJson, new TypeReference<>() {
});
} catch (Exception e) {
return new ArrayList<>();
}
if (couponMap.isEmpty()) {
return new ArrayList<>();
}
List<ShopCoupon> list = couponService.queryChain()
.select(ShopCoupon::getId, ShopCoupon::getTitle, ShopCoupon::getLeftNumber)
.in(ShopCoupon::getId, couponMap.keySet())
.list();
list.forEach(coupon -> coupon.setNumber(couponMap.get(coupon.getId().toString())));
return list;
}
private String getCouponJson(ShopActivate activate, ShopCoupon tbShopCoupon) {
JSONObject result = new JSONObject();
result.put("activate", JSONObject.toJSONString(activate));
result.put("coupon", JSONObject.toJSONString(tbShopCoupon));
return result.toJSONString();
}
}

View File

@@ -1,222 +0,0 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.QueryReceiveDto;
import com.czg.account.dto.ShopCouponDTO;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.entity.ShopCoupon;
import com.czg.account.entity.ShopUser;
import com.czg.account.service.ShopActivateCouponRecordService;
import com.czg.account.service.ShopCouponService;
import com.czg.account.service.ShopInfoService;
import com.czg.account.service.ShopUserService;
import com.czg.account.vo.CouponReceiveVo;
import com.czg.account.vo.UserCouponVo;
import com.czg.product.entity.Product;
import com.czg.product.service.ProductService;
import com.czg.service.account.mapper.ShopCouponMapper;
import com.czg.utils.AssertUtil;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import java.math.BigDecimal;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* 优惠券 服务层实现。
*
* @author ww
* @since 2025-02-17
*/
@Slf4j
@DubboService
public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService {
@Resource
private ShopActivateCouponRecordService couponRecordService;
@Resource
private ShopUserService shopUserService;
@Resource
private ShopInfoService shopInfoService;
@DubboReference
private ProductService productService;
@Override
public List<ShopCouponDTO> getList(Long shopId, Integer type, Integer status) {
List<ShopCouponDTO> coupons = queryChain().select()
.eq(ShopCoupon::getShopId, shopId)
.eq(ShopCoupon::getType, type)
.eq(ShopCoupon::getStatus, status)
.orderBy(ShopCoupon::getCreateTime).desc()
.listAs(ShopCouponDTO.class);
System.out.println(coupons);
coupons.forEach(coupon -> {
if (coupon.getProId() != null) {
Product product = productService.getById(coupon.getProId());
coupon.setProName(product.getName());
}
});
return coupons;
}
@Override
public Boolean add(ShopCouponDTO couponDTO) {
ShopCoupon shopCoupon = new ShopCoupon();
BeanUtil.copyProperties(couponDTO, shopCoupon);
shopCoupon.setLeftNumber(shopCoupon.getNumber());
return save(shopCoupon);
}
@Override
public Boolean edit(ShopCouponDTO couponDTO) {
ShopCoupon shopCoupon = new ShopCoupon();
BeanUtil.copyProperties(couponDTO, shopCoupon);
if (couponDTO.getNumber() != null) {
ShopCoupon tbShopCoupon = getById(couponDTO.getId());
if (shopCoupon.getNumber() < tbShopCoupon.getNumber()) {
throw new ValidateException("修改失败 发放数量不可减少");
} else {
shopCoupon.setLeftNumber(shopCoupon.getLeftNumber() + shopCoupon.getNumber() - tbShopCoupon.getNumber());
}
}
return updateById(shopCoupon);
}
@Override
public Page<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
Page<Object> page = PageUtil.buildPage();
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
return PageUtil.convert(new PageInfo<>(couponRecordService.queryReceive(param)));
}
@Override
public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
Page<Object> page = PageUtil.buildPage();
List<Long> shopUserIds = shopUserService.queryChain()
.eq(ShopUser::getUserId, userId)
.eq(ShopUser::getShopId, shopId)
.select(ShopUser::getId).listAs(Long.class);
if (CollectionUtil.isNotEmpty(shopUserIds)) {
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
return PageUtil.convert(new PageInfo<>(couponRecordService.findByUser(shopUserIds, status)));
}
return new Page<>();
}
@Override
public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type) {
List<UserCouponVo> tbUserCouponVos = couponRecordService.queryByVipIdAndShopId(shopId, shopUserId, type);
if (CollectionUtil.isNotEmpty(tbUserCouponVos)) {
String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("");
LocalTime now = LocalTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
//券id 券使用描述
Map<Long, JSONObject> coupons = new HashMap<>();
for (UserCouponVo tbUserCouponVo : tbUserCouponVos) {
if (!coupons.containsKey(tbUserCouponVo.getCouponId())) {
setCouponInfo(coupons, tbUserCouponVo, null, week, now, formatter);
}
JSONObject couponJson = coupons.get(tbUserCouponVo.getCouponId());
tbUserCouponVo.setUseRestrictions(couponJson.getString("useRestrictions"));
tbUserCouponVo.setUse(couponJson.getBoolean("isUse"));
}
tbUserCouponVos.sort(Comparator.comparing(UserCouponVo::isUse).reversed());
return tbUserCouponVos;
}
return null;
}
@Override
public Boolean use(List<Long> ids, Long shopUserId, Long orderId) {
List<ShopActivateCouponRecord> records = couponRecordService.listByIds(ids);
if (records.isEmpty()) {
log.error("优惠券使用失败订单Id:{}", orderId);
return false;
}
// 使用流来统计 couponId 出现的次数
Map<Long, Long> couponIdCountMap = records.stream()
.collect(Collectors.groupingBy(ShopActivateCouponRecord::getCouponId,
Collectors.counting()
));
couponIdCountMap.forEach((couponId, count) -> {
ShopCoupon tbShopCoupon = getById(couponId);
tbShopCoupon.setUseNumber(tbShopCoupon.getUseNumber() + count.intValue());
ShopCoupon coupon1 = new ShopCoupon();
coupon1.setId(couponId);
coupon1.setUseNumber(tbShopCoupon.getUseNumber());
updateById(coupon1);
});
return couponRecordService.updateChain()
.set(ShopActivateCouponRecord::getStatus, 1)
.set(ShopActivateCouponRecord::getTargetId, orderId)
.eq(ShopActivateCouponRecord::getShopUserId, shopUserId)
.in(ShopActivateCouponRecord::getId, ids).update();
}
/**
* 退还券
*/
@Override
public Boolean refund(Long orderId, Long shopUserId) {
return couponRecordService.updateChain()
.set(ShopActivateCouponRecord::getStatus, 0)
.eq(ShopActivateCouponRecord::getShopUserId, shopUserId)
.eq(ShopActivateCouponRecord::getTargetId, orderId)
.update();
}
private void setCouponInfo(Map<Long, JSONObject> coupons, UserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) {
JSONObject json = new JSONObject();
boolean isUse = true;
ShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
StringBuilder useRestrictions = new StringBuilder("每天 ");
if (amount != null && tbShopCoupon.getType().equals(1)) {
if (amount.compareTo(tbShopCoupon.getFullAmount()) < 0) {
isUse = false;
}
}
if (StrUtil.isNotBlank(tbShopCoupon.getUserDays())) {
String[] split = tbShopCoupon.getUserDays().split(",");
if (split.length != 7) {
useRestrictions = new StringBuilder(STR."\{tbShopCoupon.getUserDays()} ");
}
if (!tbShopCoupon.getUserDays().contains(week)) {
isUse = false;
}
}
if ("custom".equals(tbShopCoupon.getUseTimeType())) {
if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) {
isUse = false;
}
useRestrictions.append(
STR."\{tbShopCoupon.getUseStartTime().format(formatter)}-\{tbShopCoupon.getUseEndTime().format(formatter)}");
} else {
useRestrictions.append("全时段");
}
useRestrictions.append(" 可用");
json.put("isUse", isUse);
json.put("useRestrictions", useRestrictions);
coupons.put(tbUserCouponVo.getCouponId(), json);
}
}

View File

@@ -1,92 +1,92 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.ShopShareCouponDTO;
import com.czg.account.dto.ShopShareDTO;
import com.czg.account.entity.ShopCoupon;
import com.czg.account.service.ShopCouponService;
import com.czg.account.vo.ShopShareRecordVO;
import com.czg.account.vo.ShopShareVO;
import com.czg.exception.ApiNotPrintException;
import com.czg.service.account.mapper.ShopShareRecordMapper;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopShare;
import com.czg.account.service.ShopShareService;
import com.czg.service.account.mapper.ShopShareMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
/**
* 店铺分享 服务层实现。
*
* @author zs
* @since 2025-03-05
*/
@Service
public class ShopShareServiceImpl extends ServiceImpl<ShopShareMapper, ShopShare> implements ShopShareService{
@Resource
private ShopCouponService shopCouponService;
@Resource
private ShopShareRecordMapper shopShareRecordMapper;
@Override
public ShopShareVO get(Long shopId) {
ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
ShopShareVO shopShareVO = new ShopShareVO();
if (shopShare != null) {
BeanUtil.copyProperties(shopShare, shopShareVO);
if (StrUtil.isNotBlank(shopShare.getRewardCoupon())) {
// shopShareVO.setRewardCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getRewardCoupon()))));
shopShareVO.setRewardCouponList(JSONArray.parseArray(shopShare.getRewardCoupon(), ShopShareCouponDTO.class));
}
if (StrUtil.isNotBlank(shopShare.getNewCoupon())) {
// shopShareVO.setNewCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getNewCoupon()))));
shopShareVO.setNewCouponList(JSONArray.parseArray(shopShare.getNewCoupon(), ShopShareCouponDTO.class));
}
}
return shopShareVO;
}
@Override
public Boolean add(Long shopId, ShopShareDTO shopShareDTO) {
ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
if (shopShare == null) {
shopShare = new ShopShareVO();
shopShare.setShopId(shopId);
}
if (shopShareDTO.getNewCouponList() != null && !shopShareDTO.getNewCouponList().isEmpty()) {
long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getNewCouponList().stream().map(ShopShareCouponDTO::getId).toList()).eq(ShopCoupon::getShopId, shopId));
if (count != shopShareDTO.getNewCouponList().size()) {
throw new ApiNotPrintException("优惠券不存在");
}
shopShare.setNewCoupon(JSONArray.toJSONString(shopShareDTO.getNewCouponList()));
}
if (shopShareDTO.getRewardCouponList() != null && !shopShareDTO.getRewardCouponList().isEmpty()) {
long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getRewardCouponList().stream().map(ShopShareCouponDTO::getId).toList()).eq(ShopCoupon::getShopId, shopId));
if (count != shopShareDTO.getRewardCouponList().size()) {
throw new ApiNotPrintException("优惠券不存在");
}
shopShare.setRewardCoupon(JSONArray.toJSONString(shopShareDTO.getRewardCouponList()));
}
BeanUtil.copyProperties(shopShareDTO, shopShare);
return saveOrUpdate(shopShare);
}
@Override
public Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status) {
Page<Object> page = PageUtil.buildPage();
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
return PageUtil.convert(new PageInfo<>(shopShareRecordMapper.getRecord(shopId, key, status)));
}
}
//package com.czg.service.account.service.impl;
//
//import cn.hutool.core.bean.BeanUtil;
//import cn.hutool.core.util.StrUtil;
//import com.alibaba.fastjson2.JSONArray;
//import com.alibaba.fastjson2.JSONObject;
//import com.czg.account.dto.ShopShareCouponDTO;
//import com.czg.account.dto.ShopShareDTO;
//import com.czg.account.entity.ShopCoupon;
//import com.czg.account.service.ShopCouponService;
//import com.czg.account.vo.ShopShareRecordVO;
//import com.czg.account.vo.ShopShareVO;
//import com.czg.exception.ApiNotPrintException;
//import com.czg.service.account.mapper.ShopShareRecordMapper;
//import com.czg.utils.PageUtil;
//import com.github.pagehelper.PageHelper;
//import com.github.pagehelper.PageInfo;
//import com.mybatisflex.core.paginate.Page;
//import com.mybatisflex.core.query.QueryWrapper;
//import com.mybatisflex.spring.service.impl.ServiceImpl;
//import com.czg.account.entity.ShopShare;
//import com.czg.account.service.ShopShareService;
//import com.czg.service.account.mapper.ShopShareMapper;
//import jakarta.annotation.Resource;
//import org.springframework.stereotype.Service;
//
///**
// * 店铺分享 服务层实现。
// *
// * @author zs
// * @since 2025-03-05
// */
//@Service
//public class ShopShareServiceImpl extends ServiceImpl<ShopShareMapper, ShopShare> implements ShopShareService{
// @Resource
// private ShopCouponService shopCouponService;
// @Resource
// private ShopShareRecordMapper shopShareRecordMapper;
//
// @Override
// public ShopShareVO get(Long shopId) {
// ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
// ShopShareVO shopShareVO = new ShopShareVO();
// if (shopShare != null) {
// BeanUtil.copyProperties(shopShare, shopShareVO);
// if (StrUtil.isNotBlank(shopShare.getRewardCoupon())) {
//// shopShareVO.setRewardCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getRewardCoupon()))));
// shopShareVO.setRewardCouponList(JSONArray.parseArray(shopShare.getRewardCoupon(), ShopShareCouponDTO.class));
// }
//
// if (StrUtil.isNotBlank(shopShare.getNewCoupon())) {
//// shopShareVO.setNewCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(shopShare.getNewCoupon()))));
// shopShareVO.setNewCouponList(JSONArray.parseArray(shopShare.getNewCoupon(), ShopShareCouponDTO.class));
// }
// }
// return shopShareVO;
// }
//
// @Override
// public Boolean add(Long shopId, ShopShareDTO shopShareDTO) {
// ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
// if (shopShare == null) {
// shopShare = new ShopShareVO();
// shopShare.setShopId(shopId);
// }
//
// if (shopShareDTO.getNewCouponList() != null && !shopShareDTO.getNewCouponList().isEmpty()) {
// long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getNewCouponList().stream().map(ShopShareCouponDTO::getId).toList()).eq(ShopCoupon::getShopId, shopId));
// if (count != shopShareDTO.getNewCouponList().size()) {
// throw new ApiNotPrintException("优惠券不存在");
// }
// shopShare.setNewCoupon(JSONArray.toJSONString(shopShareDTO.getNewCouponList()));
// }
//
// if (shopShareDTO.getRewardCouponList() != null && !shopShareDTO.getRewardCouponList().isEmpty()) {
// long count = shopCouponService.count(new QueryWrapper().in(ShopCoupon::getId, shopShareDTO.getRewardCouponList().stream().map(ShopShareCouponDTO::getId).toList()).eq(ShopCoupon::getShopId, shopId));
// if (count != shopShareDTO.getRewardCouponList().size()) {
// throw new ApiNotPrintException("优惠券不存在");
// }
// shopShare.setRewardCoupon(JSONArray.toJSONString(shopShareDTO.getRewardCouponList()));
// }
// BeanUtil.copyProperties(shopShareDTO, shopShare);
// return saveOrUpdate(shopShare);
// }
//
// @Override
// public Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status) {
// Page<Object> page = PageUtil.buildPage();
// PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
// return PageUtil.convert(new PageInfo<>(shopShareRecordMapper.getRecord(shopId, key, status)));
// }
//}

View File

@@ -11,6 +11,9 @@ import com.czg.config.RedisCst;
import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.enums.YesNoEnum;
import com.czg.exception.ApiNotPrintException;
import com.czg.market.entity.MkShopCouponRecord;
import com.czg.market.service.MkShopCouponRecordService;
import com.czg.market.service.TbMemberConfigService;
import com.czg.order.entity.OrderInfo;
import com.czg.order.service.OrderDetailService;
import com.czg.order.service.OrderInfoService;
@@ -61,8 +64,8 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
private UserInfoService userInfoService;
@Resource
private RedisService redisService;
@Resource
private ShopActivateCouponRecordService shopActivateCouponRecordService;
@DubboReference
private MkShopCouponRecordService couponRecordService;
@Resource
private ShopInfoMapper shopInfoMapper;
@Resource
@@ -71,6 +74,8 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
private FreeDineConfigService freeDineConfigService;
@Resource
private ShopConfigMapper shopConfigMapper;
@DubboReference
private TbMemberConfigService memberConfigService;
private ShopUser getUserInfo(Long shopId, Long shopUserId) {
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getId, shopUserId).one();
@@ -308,6 +313,8 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
shopUser.setUserId(null);
shopUser.setShopId(null);
}
memberConfigService.joinMember(shopId, userId, null);
return saveOrUpdate(shopUser);
}
@@ -332,7 +339,11 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
save(shopUser);
shopUser = getById(shopUser.getId());
} else {
couponNum = shopActivateCouponRecordService.count(new QueryWrapper().eq(ShopActivateCouponRecord::getShopUserId, shopUser.getId()).eq(ShopActivateCouponRecord::getStatus, 0));
couponNum = couponRecordService.count(new QueryWrapper()
.eq(MkShopCouponRecord::getShopUserId, shopUser.getId())
.eq(MkShopCouponRecord::getStatus, 0)
.eq(MkShopCouponRecord::getIsDel,0)
);
}
ShopUserDetailDTO shopUserDetailDTO = BeanUtil.copyProperties(shopUser, ShopUserDetailDTO.class);
shopUserDetailDTO.setCouponNum(couponNum);
@@ -359,7 +370,11 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
@Override
public ShopUser getDetail(Integer id, Integer userId) {
ShopUser shopUser = getOne(new QueryWrapper().eq(ShopUser::getShopId, StpKit.USER.getUsableShopId()).eq(ShopUser::getId, id).eq(ShopUser::getUserId, userId));
long count = shopActivateCouponRecordService.count(new QueryWrapper().eq(ShopActivateCouponRecord::getShopUserId, shopUser.getId()).eq(ShopActivateCouponRecord::getStatus, 0));
long count = couponRecordService.count(new QueryWrapper()
.eq(MkShopCouponRecord::getShopUserId, shopUser.getId())
.eq(MkShopCouponRecord::getStatus, 0)
.eq(MkShopCouponRecord::getIsDel,0)
);
ShopUserDTO shopUserDTO = BeanUtil.copyProperties(shopUser, ShopUserDTO.class);
shopUserDTO.setCouponNum(count);
shopUserDTO.setOrderNumber(orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, userId).eq(OrderInfo::getShopId, StpKit.USER.getShopId(0L)).eq(OrderInfo::getStatus, "done")));

View File

@@ -39,17 +39,17 @@
</select>
<select id="selectAssetsSummary" resultType="com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO">
SELECT
IFNULL(SUM(b.amount), 0) AS amount,
IFNULL(SUM(b.account_points), 0) AS accountPoints,
COUNT(DISTINCT c.id) AS couponNum
SELECT IFNULL(SUM(b.amount), 0) AS amount,
IFNULL(SUM(b.account_points), 0) AS accountPoints,
COUNT(DISTINCT c.id) AS couponNum
FROM tb_shop_user AS b
LEFT JOIN tb_shop_activate_coupon_record AS c
ON c.shop_id = b.shop_id
AND c.shop_user_id = b.id
AND c.`status` = 1
AND c.use_start_time &lt; NOW()
AND c.use_end_time > NOW()
LEFT JOIN mk_shop_coupon_record AS c
ON c.shop_id = b.shop_id
AND c.shop_user_id = b.id
AND c.`status` = 1
AND c.use_start_time &lt; NOW()
AND c.use_end_time > NOW()
AND c.is_del = 0
WHERE b.user_id = #{userId};
@@ -66,10 +66,11 @@
-- 预计算优惠券数量
LEFT JOIN (
SELECT shop_user_id, COUNT(*) AS couponNum
FROM tb_shop_activate_coupon_record
FROM mk_shop_coupon_record
WHERE status = 0
AND use_start_time &lt; NOW()
AND use_end_time > NOW()
AND is_del = 0
GROUP BY shop_user_id
) c ON c.shop_user_id = a.id

View File

@@ -1,190 +0,0 @@
package com.czg;
import com.mybatisflex.codegen.Generator;
import com.mybatisflex.codegen.config.*;
import com.mybatisflex.core.service.IService;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.zaxxer.hikari.HikariDataSource;
/**
* @author ww
*/
public class Main {
private final static String BASE_URL = "rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com";
private final static String PORT = "3306";
private final static String USERNAME = "cashier";
private final static String PASSWORD = "Cashier@1@";
private final static String DATABASE = "czg_cashier";
static String currentWorkingDirectory = System.getProperty("user.dir");
static String basePackage = "com.czg.";
public static void main(String[] args) {
// packageName 指定生成代码项目
// tableName 指定需要生成的表
// String packageName = "system";
String packageName = "account";
// String packageName = "product";
// String packageName = "order";
String tableName = "tb_order_info";
String author = "zs";
//是否生成DTO实体 默认生成
boolean isGenerateDto = true;
//配置数据源
HikariDataSource dataSource = new HikariDataSource();
dataSource.setJdbcUrl("jdbc:mysql://" + BASE_URL + ":" + PORT + "/" + DATABASE);
dataSource.setUsername(USERNAME);
dataSource.setPassword(PASSWORD);
String projectPath = currentWorkingDirectory + "/cash-service/" + packageName + "-service";
// 生成 mapper 和 service实现
GlobalConfig globalConfig = createGlobalConfigUseStyle(projectPath, packageName, "tb", tableName);
globalConfig.setAuthor(author);
Generator generator = new Generator(dataSource, globalConfig);
generator.generate();
// 生成 entity 和 service
GlobalConfig serviceConfig = createServiceGlobalConfigUseStyle(currentWorkingDirectory + "/cash-common/cash-common-service",
basePackage + packageName, "tb", tableName);
Generator serviceGenerator = new Generator(dataSource, serviceConfig);
serviceConfig.setAuthor(author);
serviceGenerator.generate();
//默认生成全参数DTO
if(isGenerateDto){
GlobalConfig dtoConfig = createDtoGlobalConfig(currentWorkingDirectory + "/cash-common/cash-common-service",
basePackage + packageName, "tb", tableName);
Generator dtoGenerator = new Generator(dataSource, dtoConfig);
dtoConfig.setAuthor(author);
dtoGenerator.generate();
}
}
public static GlobalConfig createGlobalConfigUseStyle(String projectPath, String packageName, String tablePrefix, String... tableNames) {
//创建配置内容
GlobalConfig globalConfig = new GlobalConfig();
//设置根包
globalConfig.getPackageConfig()
.setSourceDir(projectPath + "/src/main/java")
.setEntityPackage(basePackage + packageName + ".entity")
.setServicePackage(basePackage + packageName + ".service")
.setServiceImplPackage(basePackage + "service." + packageName + ".service.impl")
.setMapperPackage(basePackage + "service." + packageName + ".mapper")
.setBasePackage(basePackage + "service." + packageName);
globalConfig.getServiceConfig()
.setClassSuffix("Service");
globalConfig.getServiceImplConfig()
.setClassSuffix("ServiceImpl")
.setSuperClass(ServiceImpl.class);
globalConfig.enableServiceImpl();
globalConfig.setServiceImplTemplatePath("templates/serviceImpl.tpl");
globalConfig.getMapperConfig()
.setClassSuffix("Mapper");
globalConfig.enableMapper();
globalConfig.setMapperXmlPath(projectPath + "/src/main/resources/mapper");
globalConfig.enableMapperXml();
//设置表前缀和只生成哪些表setGenerateTable 未配置时,生成所有表
globalConfig.getStrategyConfig()
.setTablePrefix(tablePrefix)
.setGenerateTable(tableNames);
//设置生成 mapper
globalConfig.enableMapper();
return globalConfig;
}
public static GlobalConfig createServiceGlobalConfigUseStyle(String projectPath, String packageName, String tablePrefix, String... tableNames) {
//创建配置内容
GlobalConfig globalConfig = new GlobalConfig();
//设置根包
globalConfig.getPackageConfig()
.setSourceDir(projectPath + "/src/main/java")
.setBasePackage(packageName);
globalConfig.getServiceConfig()
.setClassSuffix("Service")
.setSuperClass(IService.class);
globalConfig.enableService();
//设置表前缀和只生成哪些表setGenerateTable 未配置时,生成所有表
globalConfig.getStrategyConfig()
.setTablePrefix(tablePrefix)
.setGenerateTable(tableNames);
//设置生成 entity 并启用 Lombok
globalConfig.enableEntity()
.setWithLombok(true)
.setJdkVersion(21);
//可以单独配置某个列
ColumnConfig createTime = new ColumnConfig();
createTime.setColumnName("create_time");
createTime.setOnInsertValue("now()");
globalConfig.getStrategyConfig()
.setColumnConfig(createTime);
ColumnConfig updateTime = new ColumnConfig();
updateTime.setColumnName("update_time");
updateTime.setOnUpdateValue("now()");
updateTime.setOnInsertValue("now()");
globalConfig.getStrategyConfig()
.setColumnConfig(updateTime);
// ColumnConfig deleted = new ColumnConfig();
// deleted.setColumnName("is_del");
// deleted.setLogicDelete(true);
// globalConfig.getStrategyConfig()
// .setColumnConfig(deleted);
// ColumnConfig version = new ColumnConfig();
// version.setColumnName("version");
// version.setVersion(true);
// globalConfig.getStrategyConfig()
// .setColumnConfig(version);
return globalConfig;
}
public static GlobalConfig createDtoGlobalConfig(String projectPath, String packageName, String tablePrefix, String... tableNames) {
//创建配置内容
GlobalConfig globalConfig = new GlobalConfig();
//设置根包
globalConfig.getPackageConfig()
.setEntityPackage(packageName + ".dto")
.setSourceDir(projectPath + "/src/main/java")
.setBasePackage(packageName);
//设置表前缀和只生成哪些表setGenerateTable 未配置时,生成所有表
globalConfig.getStrategyConfig()
.setTablePrefix(tablePrefix)
.setGenerateTable(tableNames);
globalConfig.setEntityTemplatePath("templates/entityDto.tpl");
globalConfig.getEntityConfig()
.setClassSuffix("DTO")
;
//设置生成 entity 并启用 Lombok
globalConfig.enableEntity()
.setWithLombok(true)
.setJdkVersion(21);
return globalConfig;
}
}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.czg</groupId>
<artifactId>cash-service</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>market-service</artifactId>
<name>market-service</name>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,31 @@
package com.czg.service.market.enums;
import lombok.Getter;
/**
* 订单状态枚举类
* @author ww
*/
@Getter
public enum OrderStatusEnums {
UNPAID("unpaid", "待支付"),
IN_PRODUCTION("in_production", "制作中"),
WAIT_OUT("wait_out", "待取餐"),
DONE("done", "订单完成"),
REFUNDING("refunding", "申请退单"),
REFUND("refund", "退单"),
PART_REFUND("part_refund", "部分退单"),
CANCELLED("cancelled", "取消订单");
private final String code;
private final String msg;
OrderStatusEnums(String code, String msg) {
this.code = code;
this.msg = msg;
}
}

Some files were not shown because too many files have changed in this diff Show More