Compare commits
14 Commits
5a6a34d85b
...
backup-250
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f252fa669 | ||
|
|
f1f4256fc9 | ||
|
|
328a59f6b4 | ||
|
|
6e5a0df70b | ||
| a5b791f007 | |||
| 83cc406ec0 | |||
| 956c5d2b2a | |||
| 37e384b491 | |||
| 240b54467d | |||
| 25c6b49733 | |||
|
|
df11252cd0 | ||
|
|
bfbcb7301a | ||
|
|
cde4185dea | ||
|
|
b3f378f528 |
@@ -0,0 +1,86 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,54 +1,54 @@
|
|||||||
//package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
//
|
|
||||||
//import com.czg.account.dto.ShopShareDTO;
|
import com.czg.account.dto.ShopShareDTO;
|
||||||
//import com.czg.account.service.ShopShareService;
|
import com.czg.account.service.ShopShareService;
|
||||||
//import com.czg.account.vo.ShopShareRecordVO;
|
import com.czg.account.vo.ShopShareRecordVO;
|
||||||
//import com.czg.account.vo.ShopShareVO;
|
import com.czg.account.vo.ShopShareVO;
|
||||||
//import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
//import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
//import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
//import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
//import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
//import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
//import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * 小程序分享奖励管理
|
* 小程序分享奖励管理
|
||||||
// * @author Administrator
|
* @author Administrator
|
||||||
// */
|
*/
|
||||||
//@RestController
|
@RestController
|
||||||
//@RequestMapping("/admin/shopShare")
|
@RequestMapping("/admin/shopShare")
|
||||||
//public class ShopShareController {
|
public class ShopShareController {
|
||||||
// @Resource
|
@Resource
|
||||||
// private ShopShareService shopShareService;
|
private ShopShareService shopShareService;
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 获取分享奖励配置
|
* 获取分享奖励配置
|
||||||
// */
|
*/
|
||||||
// @SaAdminCheckPermission(value = "shopShare:list", name = "分享好友信息")
|
@SaAdminCheckPermission(value = "shopShare:list", name = "分享好友信息")
|
||||||
// @GetMapping
|
@GetMapping
|
||||||
// public CzgResult<ShopShareVO> get() {
|
public CzgResult<ShopShareVO> get() {
|
||||||
// return CzgResult.success(shopShareService.get(StpKit.USER.getShopId()));
|
return CzgResult.success(shopShareService.get(StpKit.USER.getShopId()));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 修改分享奖励配置
|
* 修改分享奖励配置
|
||||||
// */
|
*/
|
||||||
// @SaAdminCheckPermission(value = "shopShare:add", name = "分享好友信息添加")
|
@SaAdminCheckPermission(value = "shopShare:add", name = "分享好友信息添加")
|
||||||
// @PostMapping
|
@PostMapping
|
||||||
// public CzgResult<Boolean> add(@RequestBody @Validated ShopShareDTO shopShareDTO) {
|
public CzgResult<Boolean> add(@RequestBody @Validated ShopShareDTO shopShareDTO) {
|
||||||
// return CzgResult.success(shopShareService.add(StpKit.USER.getShopId(), shopShareDTO));
|
return CzgResult.success(shopShareService.add(StpKit.USER.getShopId(), shopShareDTO));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 分享奖励记录
|
* 分享奖励记录
|
||||||
// * @param key 邀请人/被邀请人手机号或昵称
|
* @param key 邀请人/被邀请人手机号或昵称
|
||||||
// * @param status 0 非新用户 1 未领取 2 已领取 3 已使用 不传递为全部
|
* @param status 0 非新用户 1 未领取 2 已领取 3 已使用 不传递为全部
|
||||||
// * @return 分页数据
|
* @return 分页数据
|
||||||
// */
|
*/
|
||||||
// @SaAdminCheckPermission(value = "shopShare:record", name = "分享邀请记录")
|
@SaAdminCheckPermission(value = "shopShare:record", name = "分享邀请记录")
|
||||||
// @GetMapping("/record")
|
@GetMapping("/record")
|
||||||
// public CzgResult<Page<ShopShareRecordVO>> record(String key, Integer status) {
|
public CzgResult<Page<ShopShareRecordVO>> record(String key, Integer status) {
|
||||||
// return CzgResult.success(shopShareService.recordPage(StpKit.USER.getShopId(), key, status));
|
return CzgResult.success(shopShareService.recordPage(StpKit.USER.getShopId(), key, status));
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
package com.czg.controller.admin;
|
|
||||||
|
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
|
||||||
import com.czg.log.annotation.OperationLog;
|
|
||||||
import com.czg.market.dto.ShopCouponDTO;
|
|
||||||
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 org.apache.dubbo.config.annotation.DubboReference;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/admin/coupon")
|
|
||||||
public class ACouponController {
|
|
||||||
@Resource
|
|
||||||
private ShopCouponService shopCouponService;
|
|
||||||
@DubboReference
|
|
||||||
private ShopSyncService shopSyncService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页
|
|
||||||
*/
|
|
||||||
@GetMapping("page")
|
|
||||||
@OperationLog("优惠券列表-分页")
|
|
||||||
@SaAdminCheckPermission("coupon:page")
|
|
||||||
public CzgResult<Page<ShopCouponDTO>> getCouponPage(ShopCouponDTO param) {
|
|
||||||
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);
|
|
||||||
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);
|
|
||||||
asyncToBranchShop(dto.getId(),2);
|
|
||||||
return CzgResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@DeleteMapping("{id}")
|
|
||||||
@OperationLog("优惠券-删除")
|
|
||||||
@SaAdminCheckPermission("prodGroup:delete")
|
|
||||||
public CzgResult<Void> deleteCoupon(@PathVariable("id") Long id) {
|
|
||||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
|
||||||
shopCouponService.deleteCoupon(id);
|
|
||||||
asyncToBranchShop(id,3);
|
|
||||||
return CzgResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void asyncToBranchShop(Long id,Integer type) {
|
|
||||||
long shopId = StpKit.USER.getShopId(0L);
|
|
||||||
ThreadUtil.execAsync(() -> {
|
|
||||||
shopSyncService.syncCouponBySourceShop(shopId, id,type);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
package com.czg.controller.admin;
|
|
||||||
|
|
||||||
import com.czg.market.dto.MemberConfigDTO;
|
|
||||||
import com.czg.market.dto.MemberLevelDTO;
|
|
||||||
import com.czg.market.entity.MemberLevelConfig;
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置信息获取
|
|
||||||
* 权限标识: 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) {
|
|
||||||
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) {
|
|
||||||
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(memberConfigService.remove(new QueryWrapper().eq(MemberLevelDTO::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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
|
|
||||||
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
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
|
|
||||||
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
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -5,7 +5,6 @@ import com.czg.annotation.SaStaffCheckPermission;
|
|||||||
import com.czg.entity.resp.CzgBaseResp;
|
import com.czg.entity.resp.CzgBaseResp;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.resp.CzgResult;
|
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.VipPayParamDTO;
|
||||||
import com.czg.service.order.dto.VipRefundDTO;
|
import com.czg.service.order.dto.VipRefundDTO;
|
||||||
import com.czg.service.order.service.PayService;
|
import com.czg.service.order.service.PayService;
|
||||||
@@ -70,21 +69,6 @@ public class VipPayController {
|
|||||||
return payService.ltPayVip(ServletUtil.getClientIP(request), payParam);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 正扫
|
* 正扫
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,13 +2,10 @@ package com.czg.controller.user;
|
|||||||
|
|
||||||
import com.czg.annotation.Debounce;
|
import com.czg.annotation.Debounce;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.order.dto.MemberOrderDTO;
|
|
||||||
import com.czg.order.dto.OrderCannelDTO;
|
import com.czg.order.dto.OrderCannelDTO;
|
||||||
import com.czg.order.dto.OrderInfoAddDTO;
|
import com.czg.order.dto.OrderInfoAddDTO;
|
||||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
import com.czg.order.dto.OrderInfoQueryDTO;
|
||||||
import com.czg.order.entity.MemberOrder;
|
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.service.MemberOrderService;
|
|
||||||
import com.czg.order.service.OrderInfoService;
|
import com.czg.order.service.OrderInfoService;
|
||||||
import com.czg.order.vo.HistoryOrderVo;
|
import com.czg.order.vo.HistoryOrderVo;
|
||||||
import com.czg.order.vo.OrderInfoVo;
|
import com.czg.order.vo.OrderInfoVo;
|
||||||
@@ -38,8 +35,6 @@ public class UserOrderController {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderInfoService orderInfoService;
|
private OrderInfoService orderInfoService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MemberOrderService memberOrderService;
|
|
||||||
/**
|
/**
|
||||||
* 订单列表
|
* 订单列表
|
||||||
*/
|
*/
|
||||||
@@ -75,21 +70,6 @@ public class UserOrderController {
|
|||||||
return CzgResult.success(orderInfoService.createOrder(addDto));
|
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}")
|
@PutMapping("/{id}")
|
||||||
public CzgResult<Void> upOrderIsDel(@PathVariable("id") Long id) {
|
public CzgResult<Void> upOrderIsDel(@PathVariable("id") Long id) {
|
||||||
//效验数据
|
//效验数据
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
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.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动赠送商品表 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ShopCouponProductDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动Id
|
||||||
|
*/
|
||||||
|
private Long couponId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -129,8 +129,4 @@ public class ShopUser implements Serializable {
|
|||||||
* 已经合并过来的用户信息,jsonArray格式,[{"id":1,"shopId":2,...},{"id":1,"shopId":2,...}]
|
* 已经合并过来的用户信息,jsonArray格式,[{"id":1,"shopId":2,...},{"id":1,"shopId":2,...}]
|
||||||
*/
|
*/
|
||||||
private String mergedUsers;
|
private String mergedUsers;
|
||||||
|
|
||||||
private Long memberLevelId;
|
|
||||||
|
|
||||||
private Long experience;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
//package com.czg.account.service;
|
package com.czg.account.service;
|
||||||
//
|
|
||||||
//import com.czg.account.dto.ShopShareDTO;
|
import com.czg.account.dto.ShopShareDTO;
|
||||||
//import com.czg.account.vo.ShopShareRecordVO;
|
import com.czg.account.vo.ShopShareRecordVO;
|
||||||
//import com.czg.account.vo.ShopShareVO;
|
import com.czg.account.vo.ShopShareVO;
|
||||||
//import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
//import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
//import com.czg.account.entity.ShopShare;
|
import com.czg.account.entity.ShopShare;
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * 店铺分享 服务层。
|
* 店铺分享 服务层。
|
||||||
// *
|
*
|
||||||
// * @author zs
|
* @author zs
|
||||||
// * @since 2025-03-05
|
* @since 2025-03-05
|
||||||
// */
|
*/
|
||||||
//public interface ShopShareService extends IService<ShopShare> {
|
public interface ShopShareService extends IService<ShopShare> {
|
||||||
//
|
|
||||||
// ShopShareVO get(Long shopId);
|
ShopShareVO get(Long shopId);
|
||||||
//
|
|
||||||
// Boolean add(Long shopId, ShopShareDTO shopShareDTO);
|
Boolean add(Long shopId, ShopShareDTO shopShareDTO);
|
||||||
//
|
|
||||||
// Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status);
|
Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status);
|
||||||
//}
|
}
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
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.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class MemberConfigDTO {
|
|
||||||
@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;
|
|
||||||
private List<ShopCoupon> couponList;
|
|
||||||
@NotBlank(message = "会员周期不为空")
|
|
||||||
private String circleTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public static class condition {
|
|
||||||
private String code;
|
|
||||||
private String value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "id不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提交生日/姓名
|
|
||||||
*/
|
|
||||||
@NotNull(message = "提交生日/姓名不能为空")
|
|
||||||
private Integer isSubmitInfo;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 方案列表
|
|
||||||
*/
|
|
||||||
@Valid
|
|
||||||
private List<ConfigList> configList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 条件开通条件项
|
|
||||||
*/
|
|
||||||
@Valid
|
|
||||||
private List<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 Float costReward;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 每充值一元经验值
|
|
||||||
*/
|
|
||||||
@Min(value = 0, message = "充值增成长值最小为0")
|
|
||||||
private Float rechargeReward;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 规则说明
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "规则说明不能为空")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
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 Long 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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 周期时间包含周 月 年 日
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "周期时间不为空", groups = MemberLevelCycleRewardGroup.class)
|
|
||||||
private String cycleTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 赠送积分
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0.01", message = "赠送积分不能小于0.01")
|
|
||||||
private Float cycleRewardPoints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券列表
|
|
||||||
*/
|
|
||||||
private List<ShopCoupon> cycleRewardCouponList;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,285 +0,0 @@
|
|||||||
|
|
||||||
package com.czg.market.dto;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.sql.Time;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import com.czg.validator.group.DefaultGroup;
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券信息表 实体类。
|
|
||||||
*
|
|
||||||
* @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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可用门店类型:all-所有门店,custom-指定门店
|
|
||||||
*/
|
|
||||||
private String useShopType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可用门店
|
|
||||||
*/
|
|
||||||
private String useShops;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可使用类型:堂食/自取/配送/快递
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可领取用户:全部/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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 折扣券(3)校验
|
|
||||||
if (couponType == 3) {
|
|
||||||
// 校验折扣率、满多少可用和最大抵扣金额
|
|
||||||
return discountRate != null && discountRate > 0 && discountRate <= 100
|
|
||||||
&& fullAmount != null && maxDiscountAmount != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第二件半价券(4)、买一送一券(6)、商品兑换券(2)校验
|
|
||||||
if (couponType == 2 || couponType == 4 || couponType == 6) {
|
|
||||||
// 校验可用商品不为空且不为空字符串
|
|
||||||
if (foods == null || foods.trim().isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// 校验使用规则不为空
|
|
||||||
return useRule != null && !useRule.trim().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其他类型优惠券暂不做特殊校验,返回true
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
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 Long experienceValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员折扣
|
|
||||||
*/
|
|
||||||
private Integer discount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* logo
|
|
||||||
*/
|
|
||||||
private String logo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消费送积分,消费n元送1积分, 0为禁用
|
|
||||||
*/
|
|
||||||
private Float costRewardPoints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 周期奖励状态 0禁用 1启用
|
|
||||||
*/
|
|
||||||
private Integer isCycleReward;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 周期时间包含周 月 年 日
|
|
||||||
*/
|
|
||||||
private String cycleTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 赠送积分
|
|
||||||
*/
|
|
||||||
private Float cycleRewardPoints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券列表
|
|
||||||
*/
|
|
||||||
private String cycleRewardCouponList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺id
|
|
||||||
*/
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@Column(onInsertValue = "now()")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改时间
|
|
||||||
*/
|
|
||||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券信息表 实体类。
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2025-09-11
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺ID
|
|
||||||
*/
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步Id
|
|
||||||
*/
|
|
||||||
private Long syncId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
|
||||||
*/
|
|
||||||
private Integer couponType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 券名称
|
|
||||||
*/
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可用门店类型:all-所有门店,custom-指定门店
|
|
||||||
*/
|
|
||||||
private String useShopType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可用门店
|
|
||||||
*/
|
|
||||||
private String useShops;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可使用类型:堂食/自取/配送/快递
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可领取用户:全部/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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
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-10
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Table("tb_member_config")
|
|
||||||
public class TbMemberConfig implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@Id(keyType = KeyType.Auto)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提交生日/姓名
|
|
||||||
*/
|
|
||||||
private Integer isSubmitInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 方案列表
|
|
||||||
*/
|
|
||||||
private String configList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 条件开通条件项
|
|
||||||
*/
|
|
||||||
private String conditionList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 购买开通金额
|
|
||||||
*/
|
|
||||||
private BigDecimal openAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参与会员价门店
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.czg.market.service;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.service.IService;
|
|
||||||
import com.czg.market.entity.MemberLevelConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员等级配置 服务层。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-10
|
|
||||||
*/
|
|
||||||
public interface MemberLevelConfigService extends IService<MemberLevelConfig> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.czg.market.service;
|
|
||||||
|
|
||||||
import com.czg.market.dto.ShopCouponDTO;
|
|
||||||
import com.mybatisflex.core.paginate.Page;
|
|
||||||
import com.mybatisflex.core.service.IService;
|
|
||||||
import com.czg.market.entity.ShopCoupon;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券信息表 服务层。
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.czg.market.service;
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发放会员奖励
|
|
||||||
* @param isCost 是否是消费 true 消费 false 充值
|
|
||||||
*/
|
|
||||||
boolean deliver(Long shopId, Long userId, BigDecimal money, boolean isCost);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
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.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MemberConfigVO {
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
package com.czg.market.vo;
|
|
||||||
|
|
||||||
import com.czg.market.entity.ShopCoupon;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MemberLevelVO {
|
|
||||||
/**
|
|
||||||
* ID
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所需成长值
|
|
||||||
*/
|
|
||||||
private Long experienceValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员折扣
|
|
||||||
*/
|
|
||||||
private Integer discount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* logo
|
|
||||||
*/
|
|
||||||
private String logo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消费送积分,消费n元送1积分, 0为禁用
|
|
||||||
*/
|
|
||||||
private Float costRewardPoints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 周期奖励状态 0禁用 1启用
|
|
||||||
*/
|
|
||||||
private Integer isCycleReward;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 周期时间包含周 月 年 日
|
|
||||||
*/
|
|
||||||
private String cycleTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 赠送积分
|
|
||||||
*/
|
|
||||||
private Float cycleRewardPoints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券列表
|
|
||||||
*/
|
|
||||||
private List<ShopCoupon> cycleRewardCouponList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺id
|
|
||||||
*/
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改时间
|
|
||||||
*/
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
|
|
||||||
package com.czg.order.dto;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
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 {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
package com.czg.order.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-11
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Table("tb_member_order")
|
|
||||||
public class MemberOrder implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
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 String circleTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券信息
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.czg.order.service;
|
|
||||||
|
|
||||||
import com.czg.order.dto.MemberOrderDTO;
|
|
||||||
import com.mybatisflex.core.service.IService;
|
|
||||||
import com.czg.order.entity.MemberOrder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员充值订单 服务层。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-11
|
|
||||||
*/
|
|
||||||
public interface MemberOrderService extends IService<MemberOrder> {
|
|
||||||
|
|
||||||
MemberOrder createMemberOrder(MemberOrderDTO orderDTO);
|
|
||||||
}
|
|
||||||
@@ -85,10 +85,4 @@ public interface ShopSyncService {
|
|||||||
* @param vendorId 供应商Id
|
* @param vendorId 供应商Id
|
||||||
*/
|
*/
|
||||||
void syncVendorBySourceShop(Long sourceShopId, Long vendorId, Long sysUserId);
|
void syncVendorBySourceShop(Long sourceShopId, Long vendorId, Long sysUserId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步优惠券
|
|
||||||
* @param type 1 新增 2 修改 3 删除
|
|
||||||
*/
|
|
||||||
void syncCouponBySourceShop(Long sourceShopId, Long couponId, Integer type);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
package com.czg.validator.group.member;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author admin admin@cashier.com
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public interface MemberLevelCycleRewardGroup {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.czg.service.market.mapper;
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
|
||||||
import com.czg.market.entity.ShopCoupon;
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.ShopCoupon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠券信息表 映射层。
|
* 优惠券 映射层。
|
||||||
*
|
*
|
||||||
* @author ww
|
* @author ww
|
||||||
* @since 2025-09-11
|
* @since 2025-02-17
|
||||||
*/
|
*/
|
||||||
public interface ShopCouponMapper extends BaseMapper<ShopCoupon> {
|
public interface ShopCouponMapper extends BaseMapper<ShopCoupon> {
|
||||||
|
|
||||||
@@ -167,20 +167,19 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
roleNames.add("分店商户");
|
roleNames.add("分店商户");
|
||||||
List<String> headShopPromissionList = sysMenuMapper.selectByRoleId(2L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
List<String> headShopPromissionList = sysMenuMapper.selectByRoleId(2L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
||||||
List<String> branchShopPromissionList = sysMenuMapper.selectByRoleId(3L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
List<String> branchShopPromissionList = sysMenuMapper.selectByRoleId(3L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
||||||
promissionList.removeAll(headShopPromissionList);
|
// promissionList.removeAll(headShopPromissionList);
|
||||||
promissionList.addAll(branchShopPromissionList);
|
promissionList.addAll(branchShopPromissionList);
|
||||||
}
|
}
|
||||||
StpKit.USER.addRoleList(roleNames);
|
StpKit.USER.addRoleList(roleNames);
|
||||||
StpKit.USER.addPermissionList(promissionList);
|
StpKit.USER.addPermissionList(promissionList);
|
||||||
String platformType = ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType");
|
if (PlatformTypeEnum.PC_CLIENT.getValue().equals(platType)) {
|
||||||
if (PlatformTypeEnum.PC_CLIENT.getValue().equals(platformType)) {
|
|
||||||
// 初始化交班记录
|
// 初始化交班记录
|
||||||
HandoverRecord entity = getHandoverRecord(isStaff, shopInfo, shopStaff);
|
HandoverRecord entity = getHandoverRecord(isStaff, shopInfo, shopStaff);
|
||||||
handoverRecordService.initHandoverRecord(entity);
|
handoverRecordService.initHandoverRecord(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
redisService.del(RedisCst.LOGIN_CODE + loginDTO.uuid());
|
redisService.del(RedisCst.LOGIN_CODE + loginDTO.uuid());
|
||||||
return new LoginVO(StpKit.USER.getTokenInfo(), new ArrayList<>(), loginDTO.loginType(), shopInfo, shopStaff);
|
return new LoginVO(StpKit.USER.getTokenInfo(), promissionList, loginDTO.loginType(), shopInfo, shopStaff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,191 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,216 +1,222 @@
|
|||||||
//package com.czg.service.account.service.impl;
|
package com.czg.service.account.service.impl;
|
||||||
//
|
|
||||||
//import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
//import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
//import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
//import cn.hutool.core.exceptions.ValidateException;
|
import cn.hutool.core.exceptions.ValidateException;
|
||||||
//import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
//import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSON;
|
||||||
//import com.czg.account.dto.QueryReceiveDto;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
//import com.czg.account.entity.ShopActivateCouponRecord;
|
import com.czg.account.dto.QueryReceiveDto;
|
||||||
//import com.czg.account.entity.ShopUser;
|
import com.czg.account.dto.ShopCouponDTO;
|
||||||
//import com.czg.account.service.ShopActivateCouponRecordService;
|
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||||
//import com.czg.account.service.ShopInfoService;
|
import com.czg.account.entity.ShopCoupon;
|
||||||
//import com.czg.account.service.ShopUserService;
|
import com.czg.account.entity.ShopUser;
|
||||||
//import com.czg.account.vo.CouponReceiveVo;
|
import com.czg.account.service.ShopActivateCouponRecordService;
|
||||||
//import com.czg.account.vo.UserCouponVo;
|
import com.czg.account.service.ShopCouponService;
|
||||||
//import com.czg.product.entity.Product;
|
import com.czg.account.service.ShopInfoService;
|
||||||
//import com.czg.product.service.ProductService;
|
import com.czg.account.service.ShopUserService;
|
||||||
//import com.czg.utils.PageUtil;
|
import com.czg.account.vo.CouponReceiveVo;
|
||||||
//import com.github.pagehelper.PageHelper;
|
import com.czg.account.vo.UserCouponVo;
|
||||||
//import com.github.pagehelper.PageInfo;
|
import com.czg.product.entity.Product;
|
||||||
//import com.mybatisflex.core.paginate.Page;
|
import com.czg.product.service.ProductService;
|
||||||
//import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.czg.service.account.mapper.ShopCouponMapper;
|
||||||
//import jakarta.annotation.Resource;
|
import com.czg.utils.AssertUtil;
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
import com.czg.utils.PageUtil;
|
||||||
//import org.apache.dubbo.config.annotation.DubboReference;
|
import com.github.pagehelper.PageHelper;
|
||||||
//import org.apache.dubbo.config.annotation.DubboService;
|
import com.github.pagehelper.PageInfo;
|
||||||
//
|
import com.mybatisflex.core.paginate.Page;
|
||||||
//import java.math.BigDecimal;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
//import java.time.LocalTime;
|
import jakarta.annotation.Resource;
|
||||||
//import java.time.format.DateTimeFormatter;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
//import java.util.*;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
//import java.util.stream.Collectors;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
//
|
|
||||||
///**
|
import java.math.BigDecimal;
|
||||||
// * 优惠券 服务层实现。
|
import java.time.LocalTime;
|
||||||
// *
|
import java.time.format.DateTimeFormatter;
|
||||||
// * @author ww
|
import java.util.*;
|
||||||
// * @since 2025-02-17
|
import java.util.stream.Collectors;
|
||||||
// */
|
|
||||||
//@Slf4j
|
/**
|
||||||
//@DubboService
|
* 优惠券 服务层实现。
|
||||||
//public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService {
|
*
|
||||||
//
|
* @author ww
|
||||||
// @Resource
|
* @since 2025-02-17
|
||||||
// private ShopActivateCouponRecordService couponRecordService;
|
*/
|
||||||
// @Resource
|
@Slf4j
|
||||||
// private ShopUserService shopUserService;
|
@DubboService
|
||||||
// @Resource
|
public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService {
|
||||||
// private ShopInfoService shopInfoService;
|
|
||||||
// @DubboReference
|
@Resource
|
||||||
// private ProductService productService;
|
private ShopActivateCouponRecordService couponRecordService;
|
||||||
//
|
@Resource
|
||||||
// @Override
|
private ShopUserService shopUserService;
|
||||||
// public List<ShopCouponDTO> getList(Long shopId, Integer type, Integer status) {
|
@Resource
|
||||||
// List<ShopCouponDTO> coupons = queryChain().select()
|
private ShopInfoService shopInfoService;
|
||||||
// .eq(ShopCoupon::getShopId, shopId)
|
@DubboReference
|
||||||
// .eq(ShopCoupon::getType, type)
|
private ProductService productService;
|
||||||
// .eq(ShopCoupon::getStatus, status)
|
|
||||||
// .orderBy(ShopCoupon::getCreateTime).desc()
|
@Override
|
||||||
// .listAs(ShopCouponDTO.class);
|
public List<ShopCouponDTO> getList(Long shopId, Integer type, Integer status) {
|
||||||
// System.out.println(coupons);
|
List<ShopCouponDTO> coupons = queryChain().select()
|
||||||
// coupons.forEach(coupon -> {
|
.eq(ShopCoupon::getShopId, shopId)
|
||||||
// if (coupon.getProId() != null) {
|
.eq(ShopCoupon::getType, type)
|
||||||
// Product product = productService.getById(coupon.getProId());
|
.eq(ShopCoupon::getStatus, status)
|
||||||
// coupon.setProName(product.getName());
|
.orderBy(ShopCoupon::getCreateTime).desc()
|
||||||
// }
|
.listAs(ShopCouponDTO.class);
|
||||||
// });
|
System.out.println(coupons);
|
||||||
// return coupons;
|
coupons.forEach(coupon -> {
|
||||||
// }
|
if (coupon.getProId() != null) {
|
||||||
//
|
Product product = productService.getById(coupon.getProId());
|
||||||
// @Override
|
coupon.setProName(product.getName());
|
||||||
// public Boolean add(ShopCouponDTO couponDTO) {
|
}
|
||||||
// ShopCoupon shopCoupon = new ShopCoupon();
|
});
|
||||||
// BeanUtil.copyProperties(couponDTO, shopCoupon);
|
return coupons;
|
||||||
// shopCoupon.setLeftNumber(shopCoupon.getNumber());
|
}
|
||||||
// return save(shopCoupon);
|
|
||||||
// }
|
@Override
|
||||||
//
|
public Boolean add(ShopCouponDTO couponDTO) {
|
||||||
// @Override
|
ShopCoupon shopCoupon = new ShopCoupon();
|
||||||
// public Boolean edit(ShopCouponDTO couponDTO) {
|
BeanUtil.copyProperties(couponDTO, shopCoupon);
|
||||||
// ShopCoupon shopCoupon = new ShopCoupon();
|
shopCoupon.setLeftNumber(shopCoupon.getNumber());
|
||||||
// BeanUtil.copyProperties(couponDTO, shopCoupon);
|
return save(shopCoupon);
|
||||||
// if (couponDTO.getNumber() != null) {
|
}
|
||||||
// ShopCoupon tbShopCoupon = getById(couponDTO.getId());
|
|
||||||
// if (shopCoupon.getNumber() < tbShopCoupon.getNumber()) {
|
@Override
|
||||||
// throw new ValidateException("修改失败 发放数量不可减少");
|
public Boolean edit(ShopCouponDTO couponDTO) {
|
||||||
// } else {
|
ShopCoupon shopCoupon = new ShopCoupon();
|
||||||
// shopCoupon.setLeftNumber(shopCoupon.getLeftNumber() + shopCoupon.getNumber() - tbShopCoupon.getNumber());
|
BeanUtil.copyProperties(couponDTO, shopCoupon);
|
||||||
// }
|
if (couponDTO.getNumber() != null) {
|
||||||
// }
|
ShopCoupon tbShopCoupon = getById(couponDTO.getId());
|
||||||
// return updateById(shopCoupon);
|
if (shopCoupon.getNumber() < tbShopCoupon.getNumber()) {
|
||||||
// }
|
throw new ValidateException("修改失败 发放数量不可减少");
|
||||||
//
|
} else {
|
||||||
// @Override
|
shopCoupon.setLeftNumber(shopCoupon.getLeftNumber() + shopCoupon.getNumber() - tbShopCoupon.getNumber());
|
||||||
// public Page<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
|
}
|
||||||
// Page<Object> page = PageUtil.buildPage();
|
}
|
||||||
// PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
|
return updateById(shopCoupon);
|
||||||
// return PageUtil.convert(new PageInfo<>(couponRecordService.queryReceive(param)));
|
}
|
||||||
// }
|
|
||||||
//
|
@Override
|
||||||
//
|
public Page<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
|
||||||
// @Override
|
Page<Object> page = PageUtil.buildPage();
|
||||||
// public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
|
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
|
||||||
// Page<Object> page = PageUtil.buildPage();
|
return PageUtil.convert(new PageInfo<>(couponRecordService.queryReceive(param)));
|
||||||
// List<Long> shopUserIds = shopUserService.queryChain()
|
}
|
||||||
// .eq(ShopUser::getUserId, userId)
|
|
||||||
// .eq(ShopUser::getShopId, shopId)
|
|
||||||
// .select(ShopUser::getId).listAs(Long.class);
|
@Override
|
||||||
// if (CollectionUtil.isNotEmpty(shopUserIds)) {
|
public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
|
||||||
// PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
|
Page<Object> page = PageUtil.buildPage();
|
||||||
// return PageUtil.convert(new PageInfo<>(couponRecordService.findByUser(shopUserIds, status)));
|
List<Long> shopUserIds = shopUserService.queryChain()
|
||||||
// }
|
.eq(ShopUser::getUserId, userId)
|
||||||
// return new Page<>();
|
.eq(ShopUser::getShopId, shopId)
|
||||||
// }
|
.select(ShopUser::getId).listAs(Long.class);
|
||||||
//
|
if (CollectionUtil.isNotEmpty(shopUserIds)) {
|
||||||
// @Override
|
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
|
||||||
// public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type) {
|
return PageUtil.convert(new PageInfo<>(couponRecordService.findByUser(shopUserIds, status)));
|
||||||
// List<UserCouponVo> tbUserCouponVos = couponRecordService.queryByVipIdAndShopId(shopId, shopUserId, type);
|
}
|
||||||
// if (CollectionUtil.isNotEmpty(tbUserCouponVos)) {
|
return new Page<>();
|
||||||
// String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("周");
|
}
|
||||||
// LocalTime now = LocalTime.now();
|
|
||||||
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
@Override
|
||||||
//
|
public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type) {
|
||||||
// //券id 券使用描述
|
List<UserCouponVo> tbUserCouponVos = couponRecordService.queryByVipIdAndShopId(shopId, shopUserId, type);
|
||||||
// Map<Long, JSONObject> coupons = new HashMap<>();
|
if (CollectionUtil.isNotEmpty(tbUserCouponVos)) {
|
||||||
// for (UserCouponVo tbUserCouponVo : tbUserCouponVos) {
|
String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("周");
|
||||||
// if (!coupons.containsKey(tbUserCouponVo.getCouponId())) {
|
LocalTime now = LocalTime.now();
|
||||||
// setCouponInfo(coupons, tbUserCouponVo, null, week, now, formatter);
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||||
// }
|
|
||||||
// JSONObject couponJson = coupons.get(tbUserCouponVo.getCouponId());
|
//券id 券使用描述
|
||||||
// tbUserCouponVo.setUseRestrictions(couponJson.getString("useRestrictions"));
|
Map<Long, JSONObject> coupons = new HashMap<>();
|
||||||
// tbUserCouponVo.setUse(couponJson.getBoolean("isUse"));
|
for (UserCouponVo tbUserCouponVo : tbUserCouponVos) {
|
||||||
//
|
if (!coupons.containsKey(tbUserCouponVo.getCouponId())) {
|
||||||
// }
|
setCouponInfo(coupons, tbUserCouponVo, null, week, now, formatter);
|
||||||
// tbUserCouponVos.sort(Comparator.comparing(UserCouponVo::isUse).reversed());
|
}
|
||||||
// return tbUserCouponVos;
|
JSONObject couponJson = coupons.get(tbUserCouponVo.getCouponId());
|
||||||
// }
|
tbUserCouponVo.setUseRestrictions(couponJson.getString("useRestrictions"));
|
||||||
// return null;
|
tbUserCouponVo.setUse(couponJson.getBoolean("isUse"));
|
||||||
// }
|
|
||||||
//
|
}
|
||||||
// @Override
|
tbUserCouponVos.sort(Comparator.comparing(UserCouponVo::isUse).reversed());
|
||||||
// public Boolean use(List<Long> ids, Long shopUserId, Long orderId) {
|
return tbUserCouponVos;
|
||||||
// List<ShopActivateCouponRecord> records = couponRecordService.listByIds(ids);
|
}
|
||||||
// if (records.isEmpty()) {
|
return null;
|
||||||
// log.error("优惠券使用失败,订单Id:{}", orderId);
|
}
|
||||||
// return false;
|
|
||||||
// }
|
@Override
|
||||||
// // 使用流来统计 couponId 出现的次数
|
public Boolean use(List<Long> ids, Long shopUserId, Long orderId) {
|
||||||
// Map<Long, Long> couponIdCountMap = records.stream()
|
List<ShopActivateCouponRecord> records = couponRecordService.listByIds(ids);
|
||||||
// .collect(Collectors.groupingBy(ShopActivateCouponRecord::getCouponId,
|
if (records.isEmpty()) {
|
||||||
// Collectors.counting()
|
log.error("优惠券使用失败,订单Id:{}", orderId);
|
||||||
// ));
|
return false;
|
||||||
// couponIdCountMap.forEach((couponId, count) -> {
|
}
|
||||||
// ShopCoupon tbShopCoupon = getById(couponId);
|
// 使用流来统计 couponId 出现的次数
|
||||||
// tbShopCoupon.setUseNumber(tbShopCoupon.getUseNumber() + count.intValue());
|
Map<Long, Long> couponIdCountMap = records.stream()
|
||||||
// ShopCoupon coupon1 = new ShopCoupon();
|
.collect(Collectors.groupingBy(ShopActivateCouponRecord::getCouponId,
|
||||||
// coupon1.setId(couponId);
|
Collectors.counting()
|
||||||
// coupon1.setUseNumber(tbShopCoupon.getUseNumber());
|
));
|
||||||
// updateById(coupon1);
|
couponIdCountMap.forEach((couponId, count) -> {
|
||||||
// });
|
ShopCoupon tbShopCoupon = getById(couponId);
|
||||||
// return couponRecordService.updateChain()
|
tbShopCoupon.setUseNumber(tbShopCoupon.getUseNumber() + count.intValue());
|
||||||
// .set(ShopActivateCouponRecord::getStatus, 1)
|
ShopCoupon coupon1 = new ShopCoupon();
|
||||||
// .set(ShopActivateCouponRecord::getTargetId, orderId)
|
coupon1.setId(couponId);
|
||||||
// .eq(ShopActivateCouponRecord::getShopUserId, shopUserId)
|
coupon1.setUseNumber(tbShopCoupon.getUseNumber());
|
||||||
// .in(ShopActivateCouponRecord::getId, ids).update();
|
updateById(coupon1);
|
||||||
// }
|
});
|
||||||
//
|
return couponRecordService.updateChain()
|
||||||
// /**
|
.set(ShopActivateCouponRecord::getStatus, 1)
|
||||||
// * 退还券
|
.set(ShopActivateCouponRecord::getTargetId, orderId)
|
||||||
// */
|
.eq(ShopActivateCouponRecord::getShopUserId, shopUserId)
|
||||||
// @Override
|
.in(ShopActivateCouponRecord::getId, ids).update();
|
||||||
// public Boolean refund(Long orderId, Long shopUserId) {
|
}
|
||||||
// return couponRecordService.updateChain()
|
|
||||||
// .set(ShopActivateCouponRecord::getStatus, 0)
|
/**
|
||||||
// .eq(ShopActivateCouponRecord::getShopUserId, shopUserId)
|
* 退还券
|
||||||
// .eq(ShopActivateCouponRecord::getTargetId, orderId)
|
*/
|
||||||
// .update();
|
@Override
|
||||||
// }
|
public Boolean refund(Long orderId, Long shopUserId) {
|
||||||
//
|
return couponRecordService.updateChain()
|
||||||
// private void setCouponInfo(Map<Long, JSONObject> coupons, UserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) {
|
.set(ShopActivateCouponRecord::getStatus, 0)
|
||||||
// JSONObject json = new JSONObject();
|
.eq(ShopActivateCouponRecord::getShopUserId, shopUserId)
|
||||||
// boolean isUse = true;
|
.eq(ShopActivateCouponRecord::getTargetId, orderId)
|
||||||
// ShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
|
.update();
|
||||||
// StringBuilder useRestrictions = new StringBuilder("每天 ");
|
}
|
||||||
// if (amount != null && tbShopCoupon.getType().equals(1)) {
|
|
||||||
// if (amount.compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
private void setCouponInfo(Map<Long, JSONObject> coupons, UserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) {
|
||||||
// isUse = false;
|
JSONObject json = new JSONObject();
|
||||||
// }
|
boolean isUse = true;
|
||||||
// }
|
ShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
|
||||||
// if (StrUtil.isNotBlank(tbShopCoupon.getUserDays())) {
|
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||||
// String[] split = tbShopCoupon.getUserDays().split(",");
|
if (amount != null && tbShopCoupon.getType().equals(1)) {
|
||||||
// if (split.length != 7) {
|
if (amount.compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
||||||
// useRestrictions = new StringBuilder(STR."\{tbShopCoupon.getUserDays()} ");
|
isUse = false;
|
||||||
// }
|
}
|
||||||
// if (!tbShopCoupon.getUserDays().contains(week)) {
|
}
|
||||||
// isUse = false;
|
if (StrUtil.isNotBlank(tbShopCoupon.getUserDays())) {
|
||||||
// }
|
String[] split = tbShopCoupon.getUserDays().split(",");
|
||||||
// }
|
if (split.length != 7) {
|
||||||
// if ("custom".equals(tbShopCoupon.getUseTimeType())) {
|
useRestrictions = new StringBuilder(STR."\{tbShopCoupon.getUserDays()} ");
|
||||||
// if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) {
|
}
|
||||||
// isUse = false;
|
if (!tbShopCoupon.getUserDays().contains(week)) {
|
||||||
// }
|
isUse = false;
|
||||||
// useRestrictions.append(
|
}
|
||||||
// STR."\{tbShopCoupon.getUseStartTime().format(formatter)}-\{tbShopCoupon.getUseEndTime().format(formatter)}");
|
}
|
||||||
// } else {
|
if ("custom".equals(tbShopCoupon.getUseTimeType())) {
|
||||||
// useRestrictions.append("全时段");
|
if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) {
|
||||||
// }
|
isUse = false;
|
||||||
// useRestrictions.append(" 可用");
|
}
|
||||||
// json.put("isUse", isUse);
|
useRestrictions.append(
|
||||||
// json.put("useRestrictions", useRestrictions);
|
STR."\{tbShopCoupon.getUseStartTime().format(formatter)}-\{tbShopCoupon.getUseEndTime().format(formatter)}");
|
||||||
//
|
} else {
|
||||||
// coupons.put(tbUserCouponVo.getCouponId(), json);
|
useRestrictions.append("全时段");
|
||||||
// }
|
}
|
||||||
//
|
useRestrictions.append(" 可用");
|
||||||
//}
|
json.put("isUse", isUse);
|
||||||
|
json.put("useRestrictions", useRestrictions);
|
||||||
|
|
||||||
|
coupons.put(tbUserCouponVo.getCouponId(), json);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,92 +1,92 @@
|
|||||||
//package com.czg.service.account.service.impl;
|
package com.czg.service.account.service.impl;
|
||||||
//
|
|
||||||
//import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
//import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
//import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
//import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
//import com.czg.account.dto.ShopShareCouponDTO;
|
import com.czg.account.dto.ShopShareCouponDTO;
|
||||||
//import com.czg.account.dto.ShopShareDTO;
|
import com.czg.account.dto.ShopShareDTO;
|
||||||
//import com.czg.account.entity.ShopCoupon;
|
import com.czg.account.entity.ShopCoupon;
|
||||||
//import com.czg.account.service.ShopCouponService;
|
import com.czg.account.service.ShopCouponService;
|
||||||
//import com.czg.account.vo.ShopShareRecordVO;
|
import com.czg.account.vo.ShopShareRecordVO;
|
||||||
//import com.czg.account.vo.ShopShareVO;
|
import com.czg.account.vo.ShopShareVO;
|
||||||
//import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
//import com.czg.service.account.mapper.ShopShareRecordMapper;
|
import com.czg.service.account.mapper.ShopShareRecordMapper;
|
||||||
//import com.czg.utils.PageUtil;
|
import com.czg.utils.PageUtil;
|
||||||
//import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
//import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
//import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
//import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
//import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
//import com.czg.account.entity.ShopShare;
|
import com.czg.account.entity.ShopShare;
|
||||||
//import com.czg.account.service.ShopShareService;
|
import com.czg.account.service.ShopShareService;
|
||||||
//import com.czg.service.account.mapper.ShopShareMapper;
|
import com.czg.service.account.mapper.ShopShareMapper;
|
||||||
//import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
//import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * 店铺分享 服务层实现。
|
* 店铺分享 服务层实现。
|
||||||
// *
|
*
|
||||||
// * @author zs
|
* @author zs
|
||||||
// * @since 2025-03-05
|
* @since 2025-03-05
|
||||||
// */
|
*/
|
||||||
//@Service
|
@Service
|
||||||
//public class ShopShareServiceImpl extends ServiceImpl<ShopShareMapper, ShopShare> implements ShopShareService{
|
public class ShopShareServiceImpl extends ServiceImpl<ShopShareMapper, ShopShare> implements ShopShareService{
|
||||||
// @Resource
|
@Resource
|
||||||
// private ShopCouponService shopCouponService;
|
private ShopCouponService shopCouponService;
|
||||||
// @Resource
|
@Resource
|
||||||
// private ShopShareRecordMapper shopShareRecordMapper;
|
private ShopShareRecordMapper shopShareRecordMapper;
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public ShopShareVO get(Long shopId) {
|
public ShopShareVO get(Long shopId) {
|
||||||
// ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
|
ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
|
||||||
// ShopShareVO shopShareVO = new ShopShareVO();
|
ShopShareVO shopShareVO = new ShopShareVO();
|
||||||
// if (shopShare != null) {
|
if (shopShare != null) {
|
||||||
// BeanUtil.copyProperties(shopShare, shopShareVO);
|
BeanUtil.copyProperties(shopShare, shopShareVO);
|
||||||
// if (StrUtil.isNotBlank(shopShare.getRewardCoupon())) {
|
if (StrUtil.isNotBlank(shopShare.getRewardCoupon())) {
|
||||||
//// shopShareVO.setRewardCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(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));
|
shopShareVO.setRewardCouponList(JSONArray.parseArray(shopShare.getRewardCoupon(), ShopShareCouponDTO.class));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (StrUtil.isNotBlank(shopShare.getNewCoupon())) {
|
if (StrUtil.isNotBlank(shopShare.getNewCoupon())) {
|
||||||
//// shopShareVO.setNewCouponList(shopCouponService.list(new QueryWrapper().eq(ShopCoupon::getShopId, shopId).in(ShopCoupon::getId, JSONArray.parseArray(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));
|
shopShareVO.setNewCouponList(JSONArray.parseArray(shopShare.getNewCoupon(), ShopShareCouponDTO.class));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return shopShareVO;
|
return shopShareVO;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public Boolean add(Long shopId, ShopShareDTO shopShareDTO) {
|
public Boolean add(Long shopId, ShopShareDTO shopShareDTO) {
|
||||||
// ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
|
ShopShare shopShare = getOne(new QueryWrapper().eq(ShopShare::getShopId, shopId));
|
||||||
// if (shopShare == null) {
|
if (shopShare == null) {
|
||||||
// shopShare = new ShopShareVO();
|
shopShare = new ShopShareVO();
|
||||||
// shopShare.setShopId(shopId);
|
shopShare.setShopId(shopId);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (shopShareDTO.getNewCouponList() != null && !shopShareDTO.getNewCouponList().isEmpty()) {
|
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));
|
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()) {
|
if (count != shopShareDTO.getNewCouponList().size()) {
|
||||||
// throw new ApiNotPrintException("优惠券不存在");
|
throw new ApiNotPrintException("优惠券不存在");
|
||||||
// }
|
}
|
||||||
// shopShare.setNewCoupon(JSONArray.toJSONString(shopShareDTO.getNewCouponList()));
|
shopShare.setNewCoupon(JSONArray.toJSONString(shopShareDTO.getNewCouponList()));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (shopShareDTO.getRewardCouponList() != null && !shopShareDTO.getRewardCouponList().isEmpty()) {
|
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));
|
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()) {
|
if (count != shopShareDTO.getRewardCouponList().size()) {
|
||||||
// throw new ApiNotPrintException("优惠券不存在");
|
throw new ApiNotPrintException("优惠券不存在");
|
||||||
// }
|
}
|
||||||
// shopShare.setRewardCoupon(JSONArray.toJSONString(shopShareDTO.getRewardCouponList()));
|
shopShare.setRewardCoupon(JSONArray.toJSONString(shopShareDTO.getRewardCouponList()));
|
||||||
// }
|
}
|
||||||
// BeanUtil.copyProperties(shopShareDTO, shopShare);
|
BeanUtil.copyProperties(shopShareDTO, shopShare);
|
||||||
// return saveOrUpdate(shopShare);
|
return saveOrUpdate(shopShare);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status) {
|
public Page<ShopShareRecordVO> recordPage(Long shopId, String key, Integer status) {
|
||||||
// Page<Object> page = PageUtil.buildPage();
|
Page<Object> page = PageUtil.buildPage();
|
||||||
// PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
|
PageHelper.startPage(Math.toIntExact(page.getPageNumber()), Math.toIntExact(page.getPageSize()));
|
||||||
// return PageUtil.convert(new PageInfo<>(shopShareRecordMapper.getRecord(shopId, key, status)));
|
return PageUtil.convert(new PageInfo<>(shopShareRecordMapper.getRecord(shopId, key, status)));
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import com.czg.config.RedisCst;
|
|||||||
import com.czg.enums.ShopUserFlowBizEnum;
|
import com.czg.enums.ShopUserFlowBizEnum;
|
||||||
import com.czg.enums.YesNoEnum;
|
import com.czg.enums.YesNoEnum;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.market.service.TbMemberConfigService;
|
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.service.OrderDetailService;
|
import com.czg.order.service.OrderDetailService;
|
||||||
import com.czg.order.service.OrderInfoService;
|
import com.czg.order.service.OrderInfoService;
|
||||||
@@ -72,8 +71,6 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||||||
private FreeDineConfigService freeDineConfigService;
|
private FreeDineConfigService freeDineConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
private ShopConfigMapper shopConfigMapper;
|
private ShopConfigMapper shopConfigMapper;
|
||||||
@DubboReference
|
|
||||||
private TbMemberConfigService memberConfigService;
|
|
||||||
|
|
||||||
private ShopUser getUserInfo(Long shopId, Long shopUserId) {
|
private ShopUser getUserInfo(Long shopId, Long shopUserId) {
|
||||||
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getId, shopUserId).one();
|
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getId, shopUserId).one();
|
||||||
@@ -311,8 +308,6 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||||||
shopUser.setUserId(null);
|
shopUser.setUserId(null);
|
||||||
shopUser.setShopId(null);
|
shopUser.setShopId(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
memberConfigService.joinMember(shopId, userId);
|
|
||||||
return saveOrUpdate(shopUser);
|
return saveOrUpdate(shopUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.czg.service.market.mapper.ShopCouponMapper">
|
<mapper namespace="com.czg.service.account.mapper.ShopCouponMapper">
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.czg.service.market.mapper;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.czg.market.entity.TbMemberConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员基础配置 映射层。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-10
|
|
||||||
*/
|
|
||||||
public interface TbMemberConfigMapper extends BaseMapper<TbMemberConfig> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.czg.service.market.mapper;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.czg.market.entity.MemberLevelConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员等级配置 映射层。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-10
|
|
||||||
*/
|
|
||||||
public interface TbMemberLevelConfigMapper extends BaseMapper<MemberLevelConfig> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
package com.czg.service.market.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.exceptions.ValidateException;
|
|
||||||
import com.czg.market.dto.ShopCouponDTO;
|
|
||||||
import com.czg.market.entity.ShopCoupon;
|
|
||||||
import com.czg.market.service.ShopCouponService;
|
|
||||||
import com.czg.service.market.mapper.ShopCouponMapper;
|
|
||||||
import com.czg.utils.AssertUtil;
|
|
||||||
import com.czg.utils.PageUtil;
|
|
||||||
import com.mybatisflex.core.paginate.Page;
|
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券信息表 服务层实现。
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2025-09-11
|
|
||||||
*/
|
|
||||||
@DubboService
|
|
||||||
public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ShopCouponDTO> getCouponPage(ShopCouponDTO param) {
|
|
||||||
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
|
|
||||||
queryWrapper.eq(ShopCoupon::getShopId, param.getShopId())
|
|
||||||
.eq(ShopCoupon::getCouponType, param.getCouponType())
|
|
||||||
.orderBy(ShopCoupon::getCreateTime).desc();
|
|
||||||
return pageAs(PageUtil.buildPage(), queryWrapper, ShopCouponDTO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ShopCouponDTO getCouponById(Long id) {
|
|
||||||
AssertUtil.isNull(id, "优惠券ID不能为空");
|
|
||||||
return getOneAs(new QueryWrapper().eq(ShopCoupon::getId, id), ShopCouponDTO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addCoupon(ShopCouponDTO param) {
|
|
||||||
ShopCoupon coupon = BeanUtil.toBean(param, ShopCoupon.class);
|
|
||||||
save(coupon);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateCouponById(ShopCouponDTO param) {
|
|
||||||
if (param.getGiveNum() != null && param.getGiveNum() != -10086) {
|
|
||||||
ShopCoupon tbShopCoupon = getById(param.getId());
|
|
||||||
if (param.getGiveNum() < tbShopCoupon.getGiveNum()) {
|
|
||||||
throw new ValidateException("修改失败 发放数量不可减少");
|
|
||||||
} else {
|
|
||||||
param.setLeftNum(tbShopCoupon.getLeftNum() + tbShopCoupon.getGiveNum() - param.getGiveNum());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ShopCoupon coupon = BeanUtil.toBean(param, ShopCoupon.class);
|
|
||||||
updateById(coupon,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteCoupon(Long id) {
|
|
||||||
AssertUtil.isNull(id, "优惠券ID不能为空");
|
|
||||||
removeById(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,283 +0,0 @@
|
|||||||
package com.czg.service.market.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.czg.market.dto.MemberConfigDTO;
|
|
||||||
import com.czg.market.dto.MemberLevelDTO;
|
|
||||||
import com.czg.account.entity.*;
|
|
||||||
import com.czg.account.service.*;
|
|
||||||
import com.czg.market.vo.MemberConfigVO;
|
|
||||||
import com.czg.market.vo.MemberLevelVO;
|
|
||||||
import com.czg.exception.CzgException;
|
|
||||||
import com.czg.market.entity.MemberLevelConfig;
|
|
||||||
import com.czg.market.entity.ShopCoupon;
|
|
||||||
import com.czg.market.entity.TbMemberConfig;
|
|
||||||
import com.czg.market.service.MemberLevelConfigService;
|
|
||||||
import com.czg.market.service.TbMemberConfigService;
|
|
||||||
import com.czg.order.entity.OrderInfo;
|
|
||||||
import com.czg.order.entity.OrderPayment;
|
|
||||||
import com.czg.order.service.OrderInfoService;
|
|
||||||
import com.czg.order.service.OrderPaymentService;
|
|
||||||
import com.czg.service.market.enums.OrderStatusEnums;
|
|
||||||
import com.czg.service.market.mapper.TbMemberConfigMapper;
|
|
||||||
import com.czg.validator.ValidatorUtil;
|
|
||||||
import com.czg.validator.group.member.MemberLevelCycleRewardGroup;
|
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员基础配置 服务层实现。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-10
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@DubboService
|
|
||||||
public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper, TbMemberConfig> implements TbMemberConfigService {
|
|
||||||
private final List<String> conditionMap = CollUtil.toList("BIND_PHONE", "ORDER", "COST_AMOUNT", "RECHARGE_AMOUNT");
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MemberLevelConfigService levelConfigService;
|
|
||||||
@DubboReference
|
|
||||||
private UserInfoService userInfoService;
|
|
||||||
@DubboReference
|
|
||||||
private ShopUserService shopUserService;
|
|
||||||
@DubboReference
|
|
||||||
private OrderInfoService orderInfoService;
|
|
||||||
@DubboReference
|
|
||||||
private OrderPaymentService orderPaymentService;
|
|
||||||
@DubboReference
|
|
||||||
private MemberPointsService memberPointsService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MemberConfigVO detail(Long shopId) {
|
|
||||||
TbMemberConfig memberConfig = getOne(new QueryWrapper().eq(TbMemberConfig::getShopId, shopId));
|
|
||||||
if (memberConfig == null) {
|
|
||||||
memberConfig = new TbMemberConfig();
|
|
||||||
memberConfig.setShopId(shopId);
|
|
||||||
save(memberConfig);
|
|
||||||
memberConfig = getOne(new QueryWrapper().eq(TbMemberConfig::getShopId, shopId));
|
|
||||||
}
|
|
||||||
|
|
||||||
MemberConfigVO memberConfigVO = BeanUtil.copyProperties(memberConfig, MemberConfigVO.class, "configList", "conditionList");
|
|
||||||
if (StrUtil.isNotBlank(memberConfig.getConfigList())) {
|
|
||||||
memberConfigVO.setConfigList(JSONArray.parseArray(memberConfig.getConfigList()).toList(MemberConfigDTO.ConfigList.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(memberConfig.getConditionList())) {
|
|
||||||
memberConfigVO.setConditionList(JSONArray.parseArray(memberConfig.getConditionList()).toList(MemberConfigDTO.condition.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(memberConfig.getMemberPriceShopIdList())) {
|
|
||||||
memberConfigVO.setMemberPriceShopIdList(JSONArray.parseArray(memberConfig.getMemberPriceShopIdList()).toList(Long.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
return memberConfigVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean edit(Long shopId, MemberConfigDTO memberDTO) {
|
|
||||||
TbMemberConfig memberConfig = getOne(new QueryWrapper().eq(TbMemberConfig::getShopId, shopId));
|
|
||||||
BeanUtil.copyProperties(memberDTO, memberConfig);
|
|
||||||
if ((memberDTO.getConfigList() == null || memberDTO.getConfigList().isEmpty()) && memberDTO.getOpenAmount() == null) {
|
|
||||||
throw new CzgException("会员开通方式必须选择一个");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (memberDTO.getConfigList() != null && !memberDTO.getConfigList().isEmpty()) {
|
|
||||||
memberDTO.getConfigList().forEach(item -> {
|
|
||||||
if (item.getReward() == null && (item.getCouponList() == null || item.getCouponList().isEmpty())) {
|
|
||||||
throw new CzgException("方案列表中赠送成长值和赠送优惠券不能同时为空");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
memberConfig.setConfigList(JSONObject.toJSONString(memberDTO.getConfigList()));
|
|
||||||
memberConfig.setConditionList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memberConfig.getConfigList() != null && !memberConfig.getConfigList().isEmpty() && memberConfig.getOpenAmount() != null) {
|
|
||||||
throw new CzgException("会员开通方式为单选条件");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memberDTO.getConditionList() != null && !memberDTO.getConditionList().isEmpty()) {
|
|
||||||
// ArrayList<String> conditionList = CollUtil.newArrayList(conditionMap);
|
|
||||||
memberDTO.getConditionList().forEach(item -> {
|
|
||||||
if (!conditionMap.contains(item.getCode())) {
|
|
||||||
throw new CzgException("条件列表中code值错误");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// conditionList.forEach(item -> {
|
|
||||||
// memberDTO.getConditionList().add(new MemberDTO.condition(item, null));
|
|
||||||
// });
|
|
||||||
|
|
||||||
memberConfig.setConditionList(JSONObject.toJSONString(memberDTO.getConditionList()));
|
|
||||||
memberConfig.setOpenAmount(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memberDTO.getMemberPriceShopIdList() != null && !memberDTO.getMemberPriceShopIdList().isEmpty()) {
|
|
||||||
memberConfig.setMemberPriceShopIdList(JSONObject.toJSONString(memberDTO.getMemberPriceShopIdList()));
|
|
||||||
}
|
|
||||||
return updateById(memberConfig, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkLevelDto(Long shopId, MemberLevelDTO levelDTO) {
|
|
||||||
long count = levelConfigService.count(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId).eq(MemberLevelConfig::getName, levelDTO.getName()).ne(MemberLevelConfig::getId, levelDTO.getId()));
|
|
||||||
if (count > 0) {
|
|
||||||
throw new CzgException("会员等级名称已存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
MemberLevelConfig lastConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId)
|
|
||||||
.lt(MemberLevelConfig::getId, levelDTO.getId())
|
|
||||||
.limit(1).orderBy(MemberLevelConfig::getId, false).ne(MemberLevelConfig::getId, levelDTO.getId()));
|
|
||||||
if (lastConfig == null && levelDTO.getExperienceValue() > 0) {
|
|
||||||
throw new CzgException("1级时本字段必须为0");
|
|
||||||
} else if (lastConfig != null && levelDTO.getExperienceValue() <= lastConfig.getExperienceValue()) {
|
|
||||||
throw new CzgException("会员等级经验值必须大于上一等级经验值");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (levelDTO.getIsCycleReward() == 1) {
|
|
||||||
if (levelDTO.getCycleRewardPoints() == null && (levelDTO.getCycleRewardCouponList() == null || levelDTO.getCycleRewardCouponList().isEmpty())) {
|
|
||||||
throw new CzgException("周期奖励成长值和优惠券不能同时为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
ValidatorUtil.validateEntity(levelDTO, MemberLevelCycleRewardGroup.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean addLevel(Long shopId, MemberLevelDTO levelDTO) {
|
|
||||||
checkLevelDto(shopId, levelDTO);
|
|
||||||
|
|
||||||
MemberLevelConfig levelConfig = BeanUtil.copyProperties(levelDTO, MemberLevelConfig.class);
|
|
||||||
levelConfig.setShopId(shopId);
|
|
||||||
if (levelDTO.getCycleRewardCouponList() != null && !levelDTO.getCycleRewardCouponList().isEmpty()) {
|
|
||||||
levelConfig.setCycleRewardCouponList(JSONObject.toJSONString(levelDTO.getCycleRewardCouponList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return levelConfigService.save(levelConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean editLevel(Long shopId, MemberLevelDTO levelDTO) {
|
|
||||||
MemberLevelConfig levelConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getId, levelDTO.getId()).eq(MemberLevelConfig::getShopId, shopId));
|
|
||||||
Optional.ofNullable(levelConfig).orElseThrow(() -> new CzgException("会员等级不存在"));
|
|
||||||
checkLevelDto(shopId, levelDTO);
|
|
||||||
BeanUtil.copyProperties(levelDTO, levelConfig);
|
|
||||||
|
|
||||||
if (levelDTO.getCycleRewardCouponList() != null && !levelDTO.getCycleRewardCouponList().isEmpty()) {
|
|
||||||
levelConfig.setCycleRewardCouponList(JSONObject.toJSONString(levelDTO.getCycleRewardCouponList()));
|
|
||||||
} else {
|
|
||||||
levelConfig.setCycleRewardCouponList(null);
|
|
||||||
}
|
|
||||||
return levelConfigService.updateById(levelConfig, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ArrayList<MemberLevelVO> listLevel(Long shopId) {
|
|
||||||
ArrayList<MemberLevelVO> memberLevelVOS = new ArrayList<>();
|
|
||||||
levelConfigService.list(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId)).forEach(item -> {
|
|
||||||
MemberLevelVO memberLevelVO = BeanUtil.copyProperties(item, MemberLevelVO.class, "cycleRewardCouponList");
|
|
||||||
if (StrUtil.isNotBlank(item.getCycleRewardCouponList())) {
|
|
||||||
memberLevelVO.setCycleRewardCouponList(JSONArray.parseArray(item.getCycleRewardCouponList()).toList(ShopCoupon.class));
|
|
||||||
}
|
|
||||||
memberLevelVOS.add(memberLevelVO);
|
|
||||||
});
|
|
||||||
|
|
||||||
return memberLevelVOS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deliver(Long shopId, Long userId, BigDecimal money, boolean isCost) {
|
|
||||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
|
|
||||||
if (shopUser == null || shopUser.getIsVip() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
MemberConfigVO memberConfig = detail(shopId);
|
|
||||||
if (memberConfig == null) {
|
|
||||||
log.warn("会员配置不存在, 店铺id: {}", shopId);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shopUser.getExperience() == null) {
|
|
||||||
shopUser.setExperience(0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 消费经验
|
|
||||||
if (memberConfig.getCostReward() != null && isCost) {
|
|
||||||
shopUser.setExperience(money.longValue() * memberConfig.getCostReward() + shopUser.getExperience());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 充值经验
|
|
||||||
if (memberConfig.getRechargeReward() != null && !isCost) {
|
|
||||||
shopUser.setExperience(money.longValue() * memberConfig.getRechargeReward() + shopUser.getExperience());
|
|
||||||
}
|
|
||||||
|
|
||||||
MemberLevelConfig levelConfig = levelConfigService.getById(shopUser.getMemberLevelId());
|
|
||||||
if (levelConfig == null) {
|
|
||||||
log.warn("会员等级配置不存在, 店铺id: {}, 等级id: {}", shopId, shopUser.getMemberLevelId());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 消费送积分
|
|
||||||
if (isCost && levelConfig.getCostRewardPoints() != null) {
|
|
||||||
int points = (int) (money.floatValue() / levelConfig.getCostRewardPoints());
|
|
||||||
memberPointsService.addPoints(shopUser.getId(), points, "会员消费送积分", null);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean joinMember(Long shopId, Long userId) {
|
|
||||||
MemberConfigVO memberConfigVO = detail(shopId);
|
|
||||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
|
|
||||||
if (shopUser == null) {
|
|
||||||
log.warn("用户不存在, 店铺id: {}, 用户id: {}", shopId, userId);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
boolean canOpen = false;
|
|
||||||
// 条件开通
|
|
||||||
if (memberConfigVO.getOpenAmount() == null) {
|
|
||||||
for (MemberConfigDTO.condition item : memberConfigVO.getConditionList()) {
|
|
||||||
canOpen = switch (item.getCode()) {
|
|
||||||
case "BIND_PHONE" -> StrUtil.isNotBlank(shopUser.getPhone());
|
|
||||||
case "ORDER" ->
|
|
||||||
orderInfoService.count(new QueryWrapper().eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getUserId, userId)
|
|
||||||
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode())) > Integer.parseInt(item.getValue());
|
|
||||||
case "COST_AMOUNT" ->
|
|
||||||
orderInfoService.list(new QueryWrapper().eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getUserId, userId)
|
|
||||||
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode()))
|
|
||||||
.stream().map(OrderInfo::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) > 0;
|
|
||||||
case "RECHARGE_AMOUNT" ->
|
|
||||||
orderPaymentService.list(new QueryWrapper().eq(OrderPayment::getShopId, shopId)
|
|
||||||
.eq(OrderPayment::getSourceId, shopUser.getId()).isNotNull(OrderPayment::getTradeNumber))
|
|
||||||
.stream().map(OrderPayment::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) > 0;
|
|
||||||
default -> throw new CzgException("会员开通条件类型错误");
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 购买开通
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canOpen) {
|
|
||||||
MemberLevelConfig levelConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId).orderBy(MemberLevelConfig::getExperienceValue, true).limit(1));
|
|
||||||
shopUser.setMemberLevelId(levelConfig.getId());
|
|
||||||
shopUser.setIsVip(1);
|
|
||||||
shopUserService.updateById(shopUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.czg.service.market.service.impl;
|
|
||||||
|
|
||||||
import com.czg.service.market.mapper.TbMemberLevelConfigMapper;
|
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|
||||||
import com.czg.market.entity.MemberLevelConfig;
|
|
||||||
import com.czg.market.service.MemberLevelConfigService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员等级配置 服务层实现。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-10
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TbMemberLevelConfigServiceImpl extends ServiceImpl<TbMemberLevelConfigMapper, MemberLevelConfig> implements MemberLevelConfigService{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.czg.service.market.mapper.TbMemberConfigMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.czg.service.market.mapper.TbMemberLevelConfigMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.czg.service.order.dto;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付接收参数 实体类
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @description
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class VipMemberPayParamDTO {
|
|
||||||
@NotNull(message = "店铺不能为空")
|
|
||||||
private Long shopId;
|
|
||||||
@NotNull(message = "用户ID不能为空")
|
|
||||||
private Long shopUserId;
|
|
||||||
@NotNull(message = "会员订单id不能为空")
|
|
||||||
private Long memberOrderId;
|
|
||||||
/**
|
|
||||||
* 平台类型 pc 收银机客户端 wechat 微信小程序 alipay 支付宝小程序 admin-pc PC管理端 admin-app APP管理端
|
|
||||||
*/
|
|
||||||
private String platformType;
|
|
||||||
private String payType;
|
|
||||||
private String openId;
|
|
||||||
/**
|
|
||||||
* 扫码支付 扫描码
|
|
||||||
*/
|
|
||||||
private String authCode;
|
|
||||||
private String pwd;
|
|
||||||
private String returnUrl;
|
|
||||||
private String buyerRemark;
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.czg.service.order.mapper;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.czg.order.entity.MemberOrder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员充值订单 映射层。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-11
|
|
||||||
*/
|
|
||||||
public interface MemberOrderMapper extends BaseMapper<MemberOrder> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import com.czg.entity.resp.CzgRefundResp;
|
|||||||
import com.czg.order.dto.OrderInfoRefundDTO;
|
import com.czg.order.dto.OrderInfoRefundDTO;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.service.order.dto.OrderPayParamDTO;
|
import com.czg.service.order.dto.OrderPayParamDTO;
|
||||||
import com.czg.service.order.dto.VipMemberPayParamDTO;
|
|
||||||
import com.czg.service.order.dto.VipPayParamDTO;
|
import com.czg.service.order.dto.VipPayParamDTO;
|
||||||
import com.czg.service.order.dto.VipRefundDTO;
|
import com.czg.service.order.dto.VipRefundDTO;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
@@ -120,6 +119,4 @@ public interface PayService {
|
|||||||
* @param refundOrderId 平台退款订单号 二选一
|
* @param refundOrderId 平台退款订单号 二选一
|
||||||
*/
|
*/
|
||||||
CzgResult<CzgRefundResp> queryRefund(Long shopId, String mchRefundNo, String refundOrderId);
|
CzgResult<CzgRefundResp> queryRefund(Long shopId, String mchRefundNo, String refundOrderId);
|
||||||
|
|
||||||
CzgResult<Map<String, Object>> ltPayMember(String clientIP, VipMemberPayParamDTO payParam);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.czg.service.order.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.czg.market.dto.MemberConfigDTO;
|
|
||||||
import com.czg.account.entity.ShopInfo;
|
|
||||||
import com.czg.account.entity.UserInfo;
|
|
||||||
import com.czg.account.service.ShopInfoService;
|
|
||||||
import com.czg.account.service.ShopUserService;
|
|
||||||
import com.czg.market.service.TbMemberConfigService;
|
|
||||||
import com.czg.account.service.UserInfoService;
|
|
||||||
import com.czg.market.vo.MemberConfigVO;
|
|
||||||
import com.czg.exception.CzgException;
|
|
||||||
import com.czg.order.dto.MemberOrderDTO;
|
|
||||||
import com.czg.service.order.enums.OrderStatusEnums;
|
|
||||||
import com.czg.utils.AssertUtil;
|
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|
||||||
import com.czg.order.entity.MemberOrder;
|
|
||||||
import com.czg.order.service.MemberOrderService;
|
|
||||||
import com.czg.service.order.mapper.MemberOrderMapper;
|
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员充值订单 服务层实现。
|
|
||||||
*
|
|
||||||
* @author zs
|
|
||||||
* @since 2025-09-11
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper, MemberOrder> implements MemberOrderService {
|
|
||||||
@DubboReference
|
|
||||||
private ShopInfoService shopInfoService;
|
|
||||||
@DubboReference
|
|
||||||
private UserInfoService userInfoService;
|
|
||||||
@DubboReference
|
|
||||||
private ShopUserService shopUserService;
|
|
||||||
@DubboReference
|
|
||||||
private TbMemberConfigService memberConfigService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MemberOrder createMemberOrder(MemberOrderDTO orderDTO) {
|
|
||||||
ShopInfo shopInfo = shopInfoService.getById(orderDTO.getShopId());
|
|
||||||
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
|
||||||
|
|
||||||
if (orderDTO.getUserId() != null) {
|
|
||||||
UserInfo userInfo = userInfoService.getById(orderDTO.getUserId());
|
|
||||||
AssertUtil.isNull(userInfo, "生成订单失败,用户信息不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
MemberConfigVO memberConfigVO = memberConfigService.detail(shopInfo.getId());
|
|
||||||
if(memberConfigVO.getConfigList() == null || memberConfigVO.getConfigList().isEmpty()) {
|
|
||||||
throw new CzgException("会员开通方案未配置,请联系店铺");
|
|
||||||
}
|
|
||||||
|
|
||||||
MemberConfigDTO.ConfigList configItem = memberConfigVO.getConfigList().stream()
|
|
||||||
.filter(item -> item.getName().equals(orderDTO.getName()))
|
|
||||||
.findFirst()
|
|
||||||
.orElseThrow(() -> new CzgException("会员开通方案未配置,请联系店铺"));
|
|
||||||
|
|
||||||
|
|
||||||
//生成订单
|
|
||||||
MemberOrder orderInfo = new MemberOrder();
|
|
||||||
|
|
||||||
orderInfo.setOrderNo(orderDTO.getPlatformType() + IdUtil.getSnowflakeNextId());
|
|
||||||
orderInfo.setShopId(orderDTO.getShopId());
|
|
||||||
orderInfo.setPayAmount(BigDecimal.ZERO);
|
|
||||||
orderInfo.setStatus(OrderStatusEnums.UNPAID.getCode());
|
|
||||||
orderInfo.setAmount(configItem.getPrice().multiply(BigDecimal.valueOf(orderDTO.getNum())));
|
|
||||||
orderInfo.setPrice(configItem.getPrice());
|
|
||||||
orderInfo.setName(configItem.getName());
|
|
||||||
orderInfo.setUserId(orderDTO.getUserId());
|
|
||||||
orderInfo.setReward(configItem.getReward());
|
|
||||||
orderInfo.setCircleTime(configItem.getCircleTime());
|
|
||||||
if (configItem.getCouponList() != null && !configItem.getCouponList().isEmpty()) {
|
|
||||||
orderInfo.setCouponList(JSONObject.toJSONString(configItem.getCouponList()));
|
|
||||||
}
|
|
||||||
orderInfo.setNum(orderDTO.getNum());
|
|
||||||
save(orderInfo);
|
|
||||||
return orderInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -107,12 +107,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
private ShopUserFlowService flowService;
|
private ShopUserFlowService flowService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopTableService shopTableService;
|
private ShopTableService shopTableService;
|
||||||
// @DubboReference
|
@DubboReference
|
||||||
// private ShopActivateService activateService;
|
private ShopActivateService activateService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private PointsBasicSettingService pointsBasicService;
|
private PointsBasicSettingService pointsBasicService;
|
||||||
// @DubboReference
|
@DubboReference
|
||||||
// private ShopCouponService couponService;
|
private ShopCouponService couponService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopActivateCouponRecordService couponRecordService;
|
private ShopActivateCouponRecordService couponRecordService;
|
||||||
// 延迟 5 秒
|
// 延迟 5 秒
|
||||||
@@ -692,9 +692,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
.set(OrderInfo::getPayAmount, 0)
|
.set(OrderInfo::getPayAmount, 0)
|
||||||
.update();
|
.update();
|
||||||
} else {
|
} else {
|
||||||
// //会员活动
|
//会员活动
|
||||||
// activateService.giveActivate(shopUser, new BigDecimal(czgCallBackDto.getAmount()).divide(new BigDecimal(100), 2, RoundingMode.DOWN),
|
activateService.giveActivate(shopUser, new BigDecimal(czgCallBackDto.getAmount()).divide(new BigDecimal(100), 2, RoundingMode.DOWN),
|
||||||
// payment.getRelatedId(), flowId);
|
payment.getRelatedId(), flowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -785,7 +785,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
//券消耗
|
//券消耗
|
||||||
List<Long> coupons = JSON.parseArray(orderInfo.getCouponInfoList(), Long.class);
|
List<Long> coupons = JSON.parseArray(orderInfo.getCouponInfoList(), Long.class);
|
||||||
if (CollUtil.isNotEmpty(coupons)) {
|
if (CollUtil.isNotEmpty(coupons)) {
|
||||||
// couponService.use(coupons, shopUser.getId(), orderInfo.getId());
|
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String[] payTypes = {PayEnums.VIP_PAY.getValue(), PayEnums.CREDIT_PAY.getValue()};
|
String[] payTypes = {PayEnums.VIP_PAY.getValue(), PayEnums.CREDIT_PAY.getValue()};
|
||||||
@@ -972,7 +972,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
//券消耗
|
//券消耗
|
||||||
List<Long> coupons = JSON.parseArray(orderInfo.getCouponInfoList(), Long.class);
|
List<Long> coupons = JSON.parseArray(orderInfo.getCouponInfoList(), Long.class);
|
||||||
if (CollUtil.isNotEmpty(coupons)) {
|
if (CollUtil.isNotEmpty(coupons)) {
|
||||||
// couponService.use(coupons, shopUser.getId(), orderInfo.getId());
|
couponService.use(coupons, shopUser.getId(), orderInfo.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import com.czg.order.entity.OrderPayment;
|
import com.czg.order.entity.OrderPayment;
|
||||||
import com.czg.order.service.OrderPaymentService;
|
import com.czg.order.service.OrderPaymentService;
|
||||||
import com.czg.service.order.mapper.OrderPaymentMapper;
|
import com.czg.service.order.mapper.OrderPaymentMapper;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,7 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
* @author ww
|
* @author ww
|
||||||
* @since 2025-02-15
|
* @since 2025-02-15
|
||||||
*/
|
*/
|
||||||
@DubboService
|
@Service
|
||||||
public class OrderPaymentServiceImpl extends ServiceImpl<OrderPaymentMapper, OrderPayment> implements OrderPaymentService{
|
public class OrderPaymentServiceImpl extends ServiceImpl<OrderPaymentMapper, OrderPayment> implements OrderPaymentService{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,19 @@ import com.czg.exception.PaySuccessException;
|
|||||||
import com.czg.order.dto.BigDecimalDTO;
|
import com.czg.order.dto.BigDecimalDTO;
|
||||||
import com.czg.order.dto.CheckOrderPay;
|
import com.czg.order.dto.CheckOrderPay;
|
||||||
import com.czg.order.dto.OrderInfoRefundDTO;
|
import com.czg.order.dto.OrderInfoRefundDTO;
|
||||||
import com.czg.order.entity.MemberOrder;
|
|
||||||
import com.czg.order.entity.OrderDetail;
|
import com.czg.order.entity.OrderDetail;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.entity.OrderPayment;
|
import com.czg.order.entity.OrderPayment;
|
||||||
import com.czg.order.enums.PayEnums;
|
import com.czg.order.enums.PayEnums;
|
||||||
import com.czg.order.service.*;
|
import com.czg.order.service.CreditBuyerOrderService;
|
||||||
|
import com.czg.order.service.OrderDetailService;
|
||||||
|
import com.czg.order.service.OrderInfoService;
|
||||||
|
import com.czg.order.service.OrderPaymentService;
|
||||||
import com.czg.resp.CzgRespCode;
|
import com.czg.resp.CzgRespCode;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.service.CzgPayService;
|
import com.czg.service.CzgPayService;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
import com.czg.service.order.dto.OrderPayParamDTO;
|
import com.czg.service.order.dto.OrderPayParamDTO;
|
||||||
import com.czg.service.order.dto.VipMemberPayParamDTO;
|
|
||||||
import com.czg.service.order.dto.VipPayParamDTO;
|
import com.czg.service.order.dto.VipPayParamDTO;
|
||||||
import com.czg.service.order.dto.VipRefundDTO;
|
import com.czg.service.order.dto.VipRefundDTO;
|
||||||
import com.czg.service.order.enums.OrderStatusEnums;
|
import com.czg.service.order.enums.OrderStatusEnums;
|
||||||
@@ -74,14 +75,14 @@ public class PayServiceImpl implements PayService {
|
|||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopInfoService shopInfoService;
|
private ShopInfoService shopInfoService;
|
||||||
// @DubboReference
|
@DubboReference
|
||||||
// private ShopActivateService shopActivateService;
|
private ShopActivateService shopActivateService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopUserFlowService userFlowService;
|
private ShopUserFlowService userFlowService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopActivateCouponRecordService inRecordService;
|
private ShopActivateCouponRecordService inRecordService;
|
||||||
// @DubboReference
|
@DubboReference
|
||||||
// private ShopCouponService couponService;
|
private ShopCouponService couponService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private MemberPointsService pointsService;
|
private MemberPointsService pointsService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
@@ -100,8 +101,6 @@ public class PayServiceImpl implements PayService {
|
|||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
@Resource
|
@Resource
|
||||||
private RabbitPublisher rabbitPublisher;
|
private RabbitPublisher rabbitPublisher;
|
||||||
@Resource
|
|
||||||
private MemberOrderService memberOrderService;
|
|
||||||
|
|
||||||
private final BigDecimal MONEY_RATE = new BigDecimal("100");
|
private final BigDecimal MONEY_RATE = new BigDecimal("100");
|
||||||
|
|
||||||
@@ -372,7 +371,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
//更新会员余额 并生成流水
|
//更新会员余额 并生成流水
|
||||||
Long flowId = shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
|
Long flowId = shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
|
||||||
//会员活动
|
//会员活动
|
||||||
// shopActivateService.giveActivate(shopUser, payParam.getAmount(), payParam.getActivateId(), flowId);
|
shopActivateService.giveActivate(shopUser, payParam.getAmount(), payParam.getActivateId(), flowId);
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,21 +390,6 @@ public class PayServiceImpl implements PayService {
|
|||||||
"会员充值", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
|
"会员充值", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CzgResult<Map<String, Object>> ltPayMember(String clientIP, VipMemberPayParamDTO payParam) {
|
|
||||||
MemberOrder memberOrder = memberOrderService.getOne(new QueryWrapper().eq(MemberOrder::getId, payParam.getMemberOrderId()));
|
|
||||||
AssertUtil.isNull(memberOrder, "充值会员失败 该会员订单不存在");
|
|
||||||
ShopUser shopUser = shopUserService.getById(payParam.getShopUserId());
|
|
||||||
AssertUtil.isNull(shopUser, "充值失败 该店铺用户不存在");
|
|
||||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
|
||||||
AssertUtil.isBlank(payParam.getPayType(), "支付方式不能为空");
|
|
||||||
String payOrderNo = payParam.getPlatformType() + IdUtil.getSnowflakeNextId();
|
|
||||||
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), "memberPay", payOrderNo,
|
|
||||||
"", memberOrder.getAmount(), payParam.getMemberOrderId()));
|
|
||||||
return ltPay(payParam.getShopId(), payParam.getPayType(), new CzgLtPayReq(payOrderNo, memberOrder.getAmount().multiply(MONEY_RATE).longValue(),
|
|
||||||
payParam.getPayType(), "会员充值", payParam.getOpenId(), clientIP, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public CzgResult<Map<String, Object>> ltPayVip(String clintIp, VipPayParamDTO payParam) {
|
public CzgResult<Map<String, Object>> ltPayVip(String clintIp, VipPayParamDTO payParam) {
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.czg.service.order.mapper.MemberOrderMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
<module>system-service</module>
|
<module>system-service</module>
|
||||||
<module>code-generator</module>
|
<module>code-generator</module>
|
||||||
<module>pay-service</module>
|
<module>pay-service</module>
|
||||||
<module>market-service</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import com.czg.account.service.ShopInfoService;
|
|||||||
import com.czg.account.service.ShopUserService;
|
import com.czg.account.service.ShopUserService;
|
||||||
import com.czg.account.service.SyncNoticeService;
|
import com.czg.account.service.SyncNoticeService;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.market.dto.ShopCouponDTO;
|
|
||||||
import com.czg.market.entity.ShopCoupon;
|
|
||||||
import com.czg.market.service.ShopCouponService;
|
|
||||||
import com.czg.product.entity.*;
|
import com.czg.product.entity.*;
|
||||||
import com.czg.product.service.*;
|
import com.czg.product.service.*;
|
||||||
import com.czg.product.vo.ProductGroupVo;
|
import com.czg.product.vo.ProductGroupVo;
|
||||||
@@ -76,8 +73,6 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
@Resource
|
@Resource
|
||||||
private ShopVendorService vendorService;
|
private ShopVendorService vendorService;
|
||||||
@Resource
|
|
||||||
private ShopCouponService couponService;
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private SyncNoticeService syncNoticeService;
|
private SyncNoticeService syncNoticeService;
|
||||||
|
|
||||||
@@ -1289,66 +1284,4 @@ public class ShopSyncServiceImpl implements ShopSyncService {
|
|||||||
throw new CzgException("主店数据同步方式不是自动同步");
|
throw new CzgException("主店数据同步方式不是自动同步");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void syncCouponBySourceShop(Long sourceShopId, Long couponId, Integer type) {
|
|
||||||
AssertUtil.isNull(sourceShopId, "{}不能为空", "源店铺ID");
|
|
||||||
AssertUtil.isNull(couponId, "{}不能为空", "优惠券ID");
|
|
||||||
AssertUtil.isNull(type, "{}不能为空", "操作类型");
|
|
||||||
ShopInfo sourceShop = shopInfoService.getById(sourceShopId);
|
|
||||||
if (StrUtil.isBlank(sourceShop.getShopType()) || "only".equals(sourceShop.getShopType())
|
|
||||||
|| sourceShop.getIsHeadShop() == null || sourceShop.getIsHeadShop() != 1) {
|
|
||||||
// 主店不是主店铺或主店是单店,不进行优惠券同步
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ShopCoupon couponSource = couponService.getById(couponId);
|
|
||||||
List<Long> ids = new ArrayList<>();
|
|
||||||
if ("all".equals(couponSource.getUseShopType())) {
|
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
|
||||||
queryWrapper.select(column(ShopConfig::getId));
|
|
||||||
queryWrapper.eq(ShopConfig::getMainId, sourceShopId);
|
|
||||||
ids = shopConfigService.listAs(queryWrapper, Long.class);
|
|
||||||
} else {
|
|
||||||
if (StrUtil.isBlank(couponSource.getUseShops())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ids = Arrays.stream(couponSource.getUseShops().split(","))
|
|
||||||
.map(Long::parseLong)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
if (CollUtil.isEmpty(ids)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
couponSource.setId(null);
|
|
||||||
switch (type) {
|
|
||||||
case 1://新增
|
|
||||||
saveCouponsForShops(ids, couponSource, couponId);
|
|
||||||
break;
|
|
||||||
case 2://先删除再新增
|
|
||||||
deleteCouponsBySyncId(couponId);
|
|
||||||
saveCouponsForShops(ids, couponSource, couponId);
|
|
||||||
break;
|
|
||||||
case 3:// 删除
|
|
||||||
deleteCouponsBySyncId(couponId);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// 处理未知类型,可根据业务需求抛出异常或忽略
|
|
||||||
throw new IllegalArgumentException("不支持的操作类型: " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveCouponsForShops(List<Long> ids, ShopCoupon coupon, Long couponId) {
|
|
||||||
ids.forEach(id -> {
|
|
||||||
coupon.setShopId(id);
|
|
||||||
coupon.setSyncId(couponId);
|
|
||||||
coupon.setId(null); // 确保是新增操作
|
|
||||||
couponService.save(coupon);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteCouponsBySyncId(Long couponId) {
|
|
||||||
couponService.remove(new QueryWrapper()
|
|
||||||
.eq(ShopCoupon::getSyncId, couponId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
1
pom.xml
1
pom.xml
@@ -26,7 +26,6 @@
|
|||||||
<module>cash-service</module>
|
<module>cash-service</module>
|
||||||
<module>cash-sdk</module>
|
<module>cash-sdk</module>
|
||||||
<module>cash-dependencies</module>
|
<module>cash-dependencies</module>
|
||||||
<module>cash-api/market-server</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
Reference in New Issue
Block a user