From 71656127d2d3fa023eb767343a9ac01172f2802d Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期三, 27 八月 2025 21:31:40 +0800 Subject: [PATCH] bug修改 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java | 9 ++++ cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java | 6 +++ cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponInfo.html | 1 cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java | 3 + cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/UserCouponClient.java | 9 ++++ cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/model/UserCoupon.java | 11 +++++ cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java | 31 +++++++++++++-- cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java | 6 +- cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java | 8 ++++ cloud-server-account/src/main/java/com/dsh/account/model/dto/VipRefundDto.java | 2 + cloud-server-management/src/main/webapp/static/modular/system/vipPayment/vipPayment.js | 6 ++- cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/dto/VipRefundDto.java | 2 + cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponRecord.html | 2 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java | 4 ++ 14 files changed, 87 insertions(+), 13 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java index f105e65..3577d45 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java @@ -105,8 +105,9 @@ if (parse.before(new Date())){ appUser.setIsVip(0); } + vipPayment.setRemark(vipRefundDto.getRemark()); appUserService.updateById(appUser); - vipPayment.setState(3); + vipPayment.setPayStatus(3); vipPaymentService.updateById(vipPayment); return "200"; } diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/dto/VipRefundDto.java b/cloud-server-account/src/main/java/com/dsh/account/model/dto/VipRefundDto.java index 30ade03..9899550 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/model/dto/VipRefundDto.java +++ b/cloud-server-account/src/main/java/com/dsh/account/model/dto/VipRefundDto.java @@ -12,5 +12,7 @@ String id; // 会员到期时间 String endTime; + // 退款备注 + String remark; } diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java index 6734e97..73654b5 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java @@ -250,16 +250,16 @@ switch (vip.getTimeType()) { case 1: // 天 - localDateTime.plusDays(time); + localDateTime = localDateTime.plusDays(time); break; case 2: // 月 - localDateTime.plusMonths(time); + localDateTime = localDateTime.plusMonths(time); break; case 3: // 年 - localDateTime.plusYears(time); + localDateTime = localDateTime.plusYears(time); break; } appUser.setIsVip(1); 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 e894f41..e5baec9 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 @@ -130,7 +130,7 @@ // 使用 Stream + 手动拷贝提升性能和可读性(或使用 MapStruct) vipDetailVOS = list.stream().map(vipDetail -> { VipDetailVO vo = new VipDetailVO(); - BeanUtils.copyProperties(vo, vipDetail); // 注意参数顺序是否正确 + BeanUtils.copyProperties(vipDetail, vo); // 注意参数顺序是否正确 return vo; }).collect(Collectors.toList()); List<Coupon> coupons = couponService.list(); @@ -947,5 +947,12 @@ @PostMapping("/base/coupon/updateType") public void updateType(@RequestBody Long id) { 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); + } + } } diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java index 3963a6a..bbfc1cb 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java @@ -11,6 +11,9 @@ import com.dsh.activity.feignclient.account.model.AppUser; import com.dsh.activity.feignclient.model.CouponStuAvailableVo; import com.dsh.activity.feignclient.model.QueryUserCouponByIdAndUserId; +import com.dsh.activity.feignclient.other.SiteClient; +import com.dsh.activity.feignclient.other.StoreClient; +import com.dsh.activity.feignclient.other.model.Store; import com.dsh.activity.model.CouponListVo; import com.dsh.activity.model.GrantCoupon; import com.dsh.activity.model.SendCouponReq; @@ -31,10 +34,7 @@ import javax.annotation.Resource; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Api @@ -62,6 +62,10 @@ private StudentClient studentClient; @Autowired private VipDetailService vipDetailService; + @Autowired + private StoreClient storeClient; + @Autowired + private SiteClient siteClient; @@ -204,6 +208,25 @@ } } + @ResponseBody + @PostMapping("/userCoupon/updateUserCouponStatus/{id}/{storeId}/{siteId}") + public void updateUserCouponStatus(@PathVariable("id") Long id,@PathVariable("storeId") Integer storeId,@PathVariable("siteId") Integer siteId) { + + UserCoupon userCoupon = userCouponService.getOne(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getId, id)); + userCoupon.setStatus(2); + if (userCoupon.getIsVipGrant()!=null && userCoupon.getIsVipGrant()==1){ + VipDetail vipDetailServiceById = vipDetailService.getById(userCoupon.getVipDetailId()); + vipDetailServiceById.setStatus(2); + List<Store> stores = storeClient.queryStoreByIds(Collections.singletonList(vipDetailServiceById.getUseStoreId())); + Store store = stores.get(0); + vipDetailServiceById.setUseSiteId(siteId); + vipDetailServiceById.setUseStoreId(storeId); + vipDetailServiceById.setOperatorId(store.getOperatorId()); + vipDetailServiceById.setUseTime(new Date()); + vipDetailService.updateById(vipDetailServiceById); + } + } + @Autowired private ICouponService couponService; diff --git a/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/UserCouponClient.java b/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/UserCouponClient.java index 9d7b306..eb9dbef 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/UserCouponClient.java +++ b/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/UserCouponClient.java @@ -3,6 +3,7 @@ import com.dsh.course.feignclient.activity.model.SendCouponReq; import com.dsh.course.feignclient.activity.model.UserCoupon; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -22,6 +23,14 @@ */ @PostMapping("/userCoupon/queryUserCouponById1") UserCoupon queryUserCouponById(Long id); + /** + * 根据id获取用户优惠券数据 + * + * @param id + * @return + */ + @PostMapping("/userCoupon/updateUserCouponStatus/{id}/{storeId}/{siteId}") + void updateUserCouponStatus(@PathVariable("id") Long id,@PathVariable("storeId") Integer storeId,@PathVariable("siteId") Integer siteId); /** * 送优惠券 diff --git a/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/model/UserCoupon.java b/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/model/UserCoupon.java index 9a82e0b..9a88dc4 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/model/UserCoupon.java +++ b/cloud-server-course/src/main/java/com/dsh/course/feignclient/activity/model/UserCoupon.java @@ -1,5 +1,6 @@ package com.dsh.course.feignclient.activity.model; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @@ -38,4 +39,14 @@ */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date insertTime; + /** + * 是否为会员赠送 0否1是 + */ + @TableField("isVipGrant") + private Integer isVipGrant; + /** + * vipDetailId 会员权益赠送记录id + */ + @TableField("vipDetailId") + private Integer vipDetailId; } diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java index b6210d4..4c5e1c5 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java @@ -24,8 +24,10 @@ import com.dsh.course.feignclient.account.model.*; import com.dsh.course.feignclient.activity.BenefitVideoClient; import com.dsh.course.feignclient.activity.CouponClient; +import com.dsh.course.feignclient.activity.UserCouponClient; import com.dsh.course.feignclient.activity.model.BenefitsVideos; import com.dsh.course.feignclient.activity.model.Coupon; +import com.dsh.course.feignclient.activity.model.UserCoupon; import com.dsh.course.feignclient.model.RecordAppoint; import com.dsh.course.feignclient.other.StoreClient; import com.dsh.course.feignclient.other.model.Store; @@ -108,6 +110,8 @@ @Resource private CouponClient client; + @Resource + private UserCouponClient userCouponClient; @Resource private PayMoneyUtil payMoneyUtil; @@ -1265,7 +1269,11 @@ coursePackageOrder1.setOrderNumber(orderNumber); coursePackageOrder1.setAppUserId(null); coursePackageOrderService.updateById(coursePackageOrder1); + TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrder1.getCoursePackageId()); + // 将用户优惠券修改为已使用 + Long userCouponId = coursePackageOrder1.getUserCouponId(); + userCouponClient.updateUserCouponStatus(userCouponId,coursePackage.getStoreId(),coursePackage.getSiteId()); CoursePackagePaymentConfig coursePackagePaymentConfig = coursePackagePaymentConfigService.getOne(new QueryWrapper<CoursePackagePaymentConfig>() .eq("coursePackageId", coursePackageOrder1.getCoursePackageId()) .eq("classHours", coursePackageOrder1.getClassHours()) diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java index 9df4c59..0dd44be 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java @@ -1280,7 +1280,11 @@ coursePackageOrder1.setOrderNumber(trade_no); coursePackageOrder1.setAppUserId(null); coursePackageOrderService.updateById(coursePackageOrder1); + TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrder1.getCoursePackageId()); + // 将用户优惠券修改为已使用 + Long userCouponId = coursePackageOrder1.getUserCouponId(); + userCouponClient.updateUserCouponStatus(userCouponId,coursePackage.getStoreId(),coursePackage.getSiteId()); CoursePackagePaymentConfig coursePackagePaymentConfig = coursePackagePaymentConfigService.getById(attach); addCoursePackageOrderStudent(coursePackageOrder1.getId(), coursePackagePaymentConfig); TCoursePackage byId = coursePackageService.getById(coursePackageOrder1.getCoursePackageId()); diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java index 716e013..2d5658f 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java @@ -107,6 +107,9 @@ case 3: coupon.setTypeValue("体验券"); break; + case 4: + coupon.setTypeValue("抵扣券"); + break; } switch (coupon.getUserPopulation()){ case 1: @@ -204,6 +207,9 @@ case 3: coupon.setTypeValue("体验券"); break; + case 4: + coupon.setTypeValue("抵扣券"); + break; } switch (coupon.getUserPopulation()){ case 1: diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/dto/VipRefundDto.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/dto/VipRefundDto.java index 18d6273..87a4a8e 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/dto/VipRefundDto.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/dto/VipRefundDto.java @@ -14,5 +14,7 @@ String id; // 会员到期时间 String endTime; + // 会员到期时间 + String remark; } diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponInfo.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponInfo.html index e407d7c..c3503ce 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponInfo.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponInfo.html @@ -99,7 +99,6 @@ <label class="col-sm-1 control-label" style="margin-left: -1%;width: 14%;margin-top: -5px">抵扣券: </label> <div class="col-sm-9"> <select style="width: 300px" class="form-control" id="goods" name="pCode" > - <option value="">请选择商品</option> @for(obj in goods){ <option style="width: 35%" value="${obj.id}">${obj.name}</option> @} diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponRecord.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponRecord.html index 36db409..1e2f5c5 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponRecord.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponRecord.html @@ -29,7 +29,7 @@ </div> </div> <div class="hidden-xs" id="TCouponTableToolbar" role="group"> - @if(type==3){ + @if(type==3 || type==4){ <#button name="核销" icon="fa-plus" clickFun="TCoupon.updateType()"/> @} </div> diff --git a/cloud-server-management/src/main/webapp/static/modular/system/vipPayment/vipPayment.js b/cloud-server-management/src/main/webapp/static/modular/system/vipPayment/vipPayment.js index 9288238..5481cab 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/vipPayment/vipPayment.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/vipPayment/vipPayment.js @@ -70,7 +70,8 @@ console.log( e) const data1 = { id:null, - vipEndTime:"" + endTime:"", + remark:"" }; var index = layer.load(1,{ @@ -107,7 +108,8 @@ return; } data1.id = e; - data1.vipEndTime = $("#vipEndTime").val(); + data1.endTime = $("#vipEndTime").val(); + data1.remark = $("#refusal").val(); $.ajax({ url: Feng.ctxPath + "/vipDetail/refund", type: "POST", -- Gitblit v1.7.1