From dcb96821f905f3fd93c059d8703517bdcac4d336 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期二, 29 九月 2026 20:02:02 +0800
Subject: [PATCH] 排序问题及门店手机号展示问题
---
cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
index e5baec9..ad16b6f 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -125,7 +125,10 @@
.le(StringUtils.hasLength(vipDetailDto.getUseEndTime()), VipDetail::getUseTime, vipDetailDto.getUseEndTime())
.eq(vipDetailDto.getOperatorId() != null, VipDetail::getOperatorId, vipDetailDto.getOperatorId())
.eq(vipDetailDto.getType() != null, VipDetail::getType, vipDetailDto.getType())
- .eq(vipDetailDto.getStatus() != null, VipDetail::getStatus, vipDetailDto.getStatus()).list();
+ .eq(vipDetailDto.getStatus() != null, VipDetail::getStatus, vipDetailDto.getStatus())
+ .orderByDesc(VipDetail::getInsertTime)
+ .list();
+
// 使用 Stream + 手动拷贝提升性能和可读性(或使用 MapStruct)
vipDetailVOS = list.stream().map(vipDetail -> {
@@ -375,7 +378,8 @@
.eq("state", 1)
.eq("status", 1)
.le("startTime", currentDate)
- .ge("endTime", currentDate));
+ .ge("endTime", currentDate)
+ .orderByDesc("insertTime", "id"));
if (couponList.size() > 0) {
Iterator<Coupon> iterator = couponList.iterator();
while (iterator.hasNext()) {
@@ -751,8 +755,19 @@
coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
break;
case 2:
- coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
- coupon.setCash(dataVo.getRequiredCash());
+ if (dataVo.getRequiredCash() != null){
+ coupon.setCash(dataVo.getRequiredCash());
+ }else{
+ coupon.setCash(BigDecimal.ZERO);
+
+ }
+ if (dataVo.getRequiredPoints() != null){
+ coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
+
+ }else{
+ coupon.setIntegral(BigDecimal.ZERO);
+
+ }
break;
case 3:
coupon.setCash(dataVo.getRequiredCash());
@@ -811,6 +826,7 @@
Integer pickUpQuantity = dataVo.getPickUpQuantity();
// 赠送用户数量
int count = quantityIssued / pickUpQuantity;
+
// 自动发券
if (dataVo.getDistributionMethod() == 3) {
// 判断用户人群 再判断限领数量
@@ -820,6 +836,9 @@
// 全部用户ids
List<Integer> collect = tAppUsers.stream()
.map(TAppUser::getId).collect(Collectors.toList());
+ if (collect.size()<count){
+ count = collect.size();
+ }
for (int i = 0; i < count; i++) {
for (int j = 0; j < pickUpQuantity; j++) {
UserCoupon u1 = new UserCoupon();
@@ -838,6 +857,9 @@
List<Integer> collect1 = tAppUsers.stream().filter(t -> t.getVipEndTime().after(new Date()))
.map(TAppUser::getId)
.collect(Collectors.toList());
+ if (collect1.size()<count){
+ count = collect1.size();
+ }
for (int i = 0; i < count; i++) {
for (int j = 0; j < pickUpQuantity; j++) {
UserCoupon u1 = new UserCoupon();
@@ -854,6 +876,9 @@
case 3:
// 给已有学员用户发券 获取已有学员的用户ids
List<Integer> collect2 = studentClient.getHasStudentUser();
+ if (collect2.size()<count){
+ count = collect2.size();
+ }
for (int i = 0; i < count; i++) {
for (int j = 0; j < pickUpQuantity; j++) {
UserCoupon u1 = new UserCoupon();
@@ -952,6 +977,26 @@
VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId());
vipDetailServiceById.setUseTime(new Date());
vipDetailServiceById.setStatus(2);
+ vipDetailServiceById.setOperatorId(0);
+ vipDetailService.updateById(vipDetailServiceById);
+ }
+
+ }
+ @GetMapping("/base/coupon/updateTypeOther/{id}/{operatorId}/{storeId}/{siteId}")
+ void updateTypeOther(@PathVariable("id")Long id,@PathVariable("operatorId")Integer operatorId,
+ @PathVariable("storeId")Integer storeId,@PathVariable("siteId")Integer siteId){
+ couponService.updateType(id);
+ UserCoupon userCoupon = userCouponService.getById(id);
+ if (userCoupon.getIsVipGrant()!=null&& userCoupon.getIsVipGrant()==1){
+ VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId());
+ vipDetailServiceById.setUseTime(new Date());
+ vipDetailServiceById.setStatus(2);
+ vipDetailServiceById.setOperatorId(operatorId);
+ vipDetailServiceById.setUseStoreId(storeId);
+ if (siteId!=0){
+ vipDetailServiceById.setUseSiteId(siteId);
+ }
+ vipDetailService.updateById(vipDetailServiceById);
}
}
--
Gitblit v1.7.1