From 867dde624b009fe1f288f292ea68699abd0600f7 Mon Sep 17 00:00:00 2001 From: rentaiming <806181062@qq.com> Date: 星期五, 12 七月 2024 08:56:31 +0800 Subject: [PATCH] 修改bug --- ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/ICouponMemberService.java | 7 + ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/vo/CouponMemberVO.java | 76 +++++++++++++++++++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/PaylogServiceImpl.java | 33 ++++++- ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java | 9 ++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java | 1 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java | 22 +++++ ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsGroupPurchaseServiceImpl.java | 10 + ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java | 1 ruoyi-modules/ruoyi-article/src/main/resources/bootstrap.yml | 12 +- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 11 ++ ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/CouponMemberServiceImpl.java | 36 +++++++- ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm | 2 ruoyi-modules/ruoyi-gen/target/classes/vm/java/controller.java.vm | 2 ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/ForepartCouponMemberController.java | 7 + 14 files changed, 194 insertions(+), 35 deletions(-) diff --git a/ruoyi-modules/ruoyi-article/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-article/src/main/resources/bootstrap.yml index d8b60a6..18d90fd 100644 --- a/ruoyi-modules/ruoyi-article/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-article/src/main/resources/bootstrap.yml @@ -17,13 +17,13 @@ nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8858 + server-addr: 192.168.110.188:8858 service: ${spring.application.name} group: DEFAULT_GROUP namespace: 689e0f09-d102-460c-ac5c-5ea50a3174be config: # 配置中心地址 - server-addr: 127.0.0.1:8858 + server-addr: 192.168.110.188:8858 namespace: 689e0f09-d102-460c-ac5c-5ea50a3174be group: DEFAULT_GROUP name: ${spring.application.name} @@ -41,13 +41,13 @@ nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 192.168.110.188:8848 service: ${spring.application.name} group: DEFAULT_GROUP namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 192.168.110.188:8848 namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 group: DEFAULT_GROUP name: ${spring.application.name} @@ -65,13 +65,13 @@ nacos: discovery: # 服务注册地址 - server-addr: 127.0.0.1:8848 + server-addr: 192.168.110.188:8848 service: ${spring.application.name} group: DEFAULT_GROUP namespace: 96712c7a-480b-4f40-b783-39f00f3b33ce config: # 配置中心地址 - server-addr: 127.0.0.1:8848 + server-addr: 192.168.110.188:8848 namespace: 96712c7a-480b-4f40-b783-39f00f3b33ce group: DEFAULT_GROUP name: ${spring.application.name} diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java index 3a85a56..5ff9459 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java @@ -21,6 +21,7 @@ import com.ruoyi.common.core.enums.AuctionStartStatusEnum; import com.ruoyi.common.core.enums.BidStatusEnum; import com.ruoyi.common.core.enums.OrderFromEnum; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.system.api.constants.NotificationTypeConstant; import com.ruoyi.system.api.domain.*; @@ -105,7 +106,7 @@ wrapper1.eq(AuctionSalesroomGoods::getStatus,2); wrapper1.eq(AuctionSalesroomGoods::getDelFlag,0); wrapper1.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); - wrapper1.orderByAsc(AuctionSalesroomGoods::getSortNum); + wrapper1.orderByDesc(AuctionSalesroomGoods::getSortNum); wrapper1.last("limit 1"); auctionSalesroomGoods = this.getOne(wrapper1); if (auctionSalesroomGoods==null){ @@ -297,10 +298,16 @@ public void auctionSalesroomStart(AuctionSalesroomDTO ationSalesroomGoodsDTO) { AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( ationSalesroomGoodsDTO.getAuctionSalesroomId()); + + if (auctionSalesroom.getStatus().getCode()==1){ + throw new ServiceException("拍卖会已开始,请勿点击"); + } + auctionSalesroom.setStatus(AuctionStartStatusEnum.IN_AUCTION); auctionSalesroom.setStartTime(LocalDateTime.now()); auctionSalesroomMapper.updateById(auctionSalesroom); + LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); wrapper2.eq(AuctionSalesroomGoods::getStatus,0); wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java index 29c9a1a..3da6fd8 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java @@ -53,6 +53,7 @@ import com.ruoyi.common.core.utils.page.Checker; import com.ruoyi.common.core.utils.page.CollUtils; import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.RemoteFileService; import com.ruoyi.system.api.constants.NotificationTypeConstant; import com.ruoyi.system.api.domain.AppMiniLoginVO; @@ -240,9 +241,9 @@ if (sysUser==null){ throw new ServiceException("手机号未注册"); } - /* if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){ + if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){ throw new ServiceException("密码输入错误"); - }*/ + } LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery(); wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,arepartAuctionBidRecordDTO.getAuctionSalesroomQrcode()); @@ -613,11 +614,27 @@ throw new ServiceException("出价不能比每次最少加价低"); } + + LambdaQueryWrapper<AuctionBidRecord> wrapper3=Wrappers.lambdaQuery(); + wrapper3.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId()); + wrapper3.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId()); + wrapper3.eq(AuctionBidRecord::getDelFlag,0); + wrapper3.orderByDesc(AuctionBidRecord::getLastBidAmount); + wrapper3.last("limit 1"); + AuctionBidRecord one3 = auctionBidRecordService.getOne(wrapper3); + if (one3!=null){ + if (bidVO.getLastBidAmount().doubleValue()<one3.getLastBidAmount().doubleValue()){ + throw new ServiceException("出价不能比当前最高价低"); + } + } + + LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery(); wrapper1.eq(AuctionBidRecord::getMemberId,bidVO.getMemberId()); wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId()); wrapper1.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId()); wrapper1.eq(AuctionBidRecord::getDelFlag,0); + AuctionBidRecord one = auctionBidRecordService.getOne(wrapper1); if (one!=null){ BigDecimal bigDecimal1=one.getLastBidAmount().add(byId.getMinimumMarkupAmount()); @@ -694,6 +711,7 @@ } } + LambdaQueryWrapper<AuctionBidRecord> wrapper3=Wrappers.lambdaQuery(); wrapper3.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId()); wrapper3.eq(AuctionBidRecord::getDelFlag,0); diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm index e5fe3b5..6ef3a78 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm @@ -32,7 +32,7 @@ * @date ${datetime} */ @RestController -@RequestMapping("/${businessName}") +@RequestMapping("/{businessName}") public class ${ClassName}Controller extends BaseController { @Autowired diff --git a/ruoyi-modules/ruoyi-gen/target/classes/vm/java/controller.java.vm b/ruoyi-modules/ruoyi-gen/target/classes/vm/java/controller.java.vm index e5fe3b5..6ef3a78 100644 --- a/ruoyi-modules/ruoyi-gen/target/classes/vm/java/controller.java.vm +++ b/ruoyi-modules/ruoyi-gen/target/classes/vm/java/controller.java.vm @@ -32,7 +32,7 @@ * @date ${datetime} */ @RestController -@RequestMapping("/${businessName}") +@RequestMapping("/{businessName}") public class ${ClassName}Controller extends BaseController { @Autowired diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsGroupPurchaseServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsGroupPurchaseServiceImpl.java index e7e27f7..7075d6f 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsGroupPurchaseServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsGroupPurchaseServiceImpl.java @@ -305,7 +305,11 @@ GoodsSku byId = goodsSkuService.getById(homeGoodsSkuDTO.getGoodsSkuId()); LambdaQueryWrapper<GoodsGroupPurchase> wrapper3= Wrappers.lambdaQuery(); wrapper3.eq(GoodsGroupPurchase::getDelFlag,0); - wrapper3.eq(GoodsGroupPurchase::getGoodsSkuId,homeGoodsSkuDTO.getGoodsSkuId()); + wrapper3.eq(GoodsGroupPurchase::getListingStatus,0); + List arr=new ArrayList<>(); + arr.add(0); + arr.add(1); + wrapper3.in(GoodsGroupPurchase::getStartStatus,arr); GoodsGroupPurchase one = this.getOne(wrapper3); GoodsGroupPurchaseInfoVO goodsGroupPurchaseInfoVO=new GoodsGroupPurchaseInfoVO(); goodsGroupPurchaseInfoVO.setGoodsSkuId(one.getId()); @@ -313,8 +317,8 @@ goodsGroupPurchaseInfoVO.setYears(String.valueOf(byId.getYears().getYear())); goodsGroupPurchaseInfoVO.setCoverPic(byId.getCoverPic()); goodsGroupPurchaseInfoVO.setPrice(byId.getPrice()); - goodsGroupPurchaseInfoVO.setShareTitle(byId.getShareTitle()); - goodsGroupPurchaseInfoVO.setSharePic(byId.getSharePic()); + goodsGroupPurchaseInfoVO.setShareTitle(one.getShareTitle()); + goodsGroupPurchaseInfoVO.setSharePic(one.getSharePic()); goodsGroupPurchaseInfoVO.setGroupPurchasePrice(one.getGroupPurchasePrice()); goodsGroupPurchaseInfoVO.setGroupSize(one.getGroupSize()); goodsGroupPurchaseInfoVO.setLimitNumber(one.getLimitNumber()); diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java index f785acd..2b9c673 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java @@ -316,6 +316,7 @@ public void updGoodsStock1(GoodsStockUpdDTO goodsStockUpdDTOS) { GoodsSku goodsSkus = this.getById(goodsStockUpdDTOS.getGoodsSkuId()); goodsSkus.setStock(goodsStockUpdDTOS.getAuctionStock()); + goodsSkus.setSoldQuantity(goodsStockUpdDTOS.getSoldQuantity()); this.updateById(goodsSkus); } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java index f6c8267..8709bd7 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderAuctionBondServiceImpl.java @@ -161,6 +161,7 @@ orderAuctionBond.setAuctionGoodsId(memberAuctionSalesroomBondDTO.getAuctionGoodsId()); orderAuctionBond.setMemberId(memberAuctionSalesroomBondDTO.getMemberId()); orderAuctionBond.setBond(data.getBond()); + orderAuctionBond.setOrderTimeSx(data.getEndTime()); orderAuctionBond.setBoundStatus(BondStatusEnum.TO_PLAY); orderAuctionBond.setBondType(AuctionOrderTypeEnum.AUCTION_ITEMS); if (memberAuctionSalesroomBondDTO.getPaymentMethod() == 1) { diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index 91b9323..f6a063f 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -373,6 +373,9 @@ if (data.getListingStatus().getCode()==1){ throw new ServiceException("该商品已经下架"); } + if (data.getStartStatus().getCode()==0){ + throw new ServiceException("该商品未开始"); + } Integer m=data.getCurrentNumber()+1; if (m>data.getGroupSize()){ throw new ServiceException("对不起,大成团人数"); @@ -813,6 +816,7 @@ GoodsStockUpdDTO goodsStockUpdDTO1 = new GoodsStockUpdDTO(); goodsStockUpdDTO1.setGoodsSkuId(order.getGoodsSkuId()); goodsStockUpdDTO1.setAuctionStock(goodsSku.getStock()+order.getGoodsQuantity()); + goodsStockUpdDTO1.setSoldQuantity(goodsSku.getSoldQuantity()-order.getGoodsQuantity()); goodsSkuClient.updGoodsStock1(goodsStockUpdDTO1,SecurityConstants.INNER); } @@ -821,7 +825,8 @@ GoodsStockUpdDTO goodsStockUpdDTO1 = new GoodsStockUpdDTO(); goodsStockUpdDTO1.setGoodsSkuId(order.getGoodsSkuId()); goodsStockUpdDTO1.setAuctionStock(data.getSeckillStock()+order.getGoodsQuantity()); - goodsSkuClient.updGoodsStock1(goodsStockUpdDTO1,SecurityConstants.INNER); + goodsStockUpdDTO1.setSoldQuantity(data.getSoldQuantity()-order.getGoodsQuantity()); + goodsSkuClient.updGoodsSeckill(goodsStockUpdDTO1,SecurityConstants.INNER); } @@ -836,6 +841,7 @@ GoodsStockUpdDTO goodsStockUpdDTO1 = new GoodsStockUpdDTO(); goodsStockUpdDTO1.setGoodsSkuId(order.getGoodsSkuId()); goodsStockUpdDTO1.setAuctionStock(goodsSku.getStock()+order.getGoodsQuantity()); + goodsStockUpdDTO1.setSoldQuantity(goodsSku.getSoldQuantity()-order.getGoodsQuantity()); goodsSkuClient.updGoodsStock1(goodsStockUpdDTO1,SecurityConstants.INNER); } @@ -844,7 +850,8 @@ GoodsStockUpdDTO goodsStockUpdDTO1 = new GoodsStockUpdDTO(); goodsStockUpdDTO1.setGoodsSkuId(order.getGoodsSkuId()); goodsStockUpdDTO1.setAuctionStock(data.getSeckillStock()+order.getGoodsQuantity()); - goodsSkuClient.updGoodsStock1(goodsStockUpdDTO1,SecurityConstants.INNER); + goodsStockUpdDTO1.setSoldQuantity(data.getSoldQuantity()-order.getGoodsQuantity()); + goodsSkuClient.updGoodsSeckill(goodsStockUpdDTO1,SecurityConstants.INNER); } if (order.getCouponId()!=0){ diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/PaylogServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/PaylogServiceImpl.java index 9ad3bc1..a276ee2 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/PaylogServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/PaylogServiceImpl.java @@ -18,6 +18,7 @@ import com.ruoyi.common.core.enums.OrderStatusEnum; import com.ruoyi.common.core.enums.PaymentMethodEnum; import com.ruoyi.common.core.enums.PointStatusEnum; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.order.domain.Paylog; import com.ruoyi.order.mapper.OrderAuctionBondMapper; @@ -228,7 +229,7 @@ return this.alipay(orderNO, subject, body, price, request); } if (type == 2){ // 微信预下单 - return this.wxpay(2, orderNO, body, openId, price, request); + return this.wxpay(2 ,orderNO, body, openId, price, request); } }else{ LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); @@ -244,7 +245,7 @@ return this.alipay(orderNO, subject, body, price, request); } if (type == 2) { // 微信预下单 - return this.wxpay(2,page1.getOrderTimeSx(), orderNO, body,openId, price, request); + return this.wxpay(2, orderNO, body,openId, price, request); } } @@ -305,8 +306,16 @@ wrapper1.eq(OrderAuctionBond::getOrderNo,paylog1.getOutTradeNo()); wrapper1.eq(OrderAuctionBond::getDelFlag,0); OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); + + if (one1.getOrderTimeSx().isAfter(LocalDateTime.now())){ + boolean bo = refundForAlipay(paylog1.getOutTradeNo(), paylog1.getTradeNo(), paylog1.getPayMoney()); + } + + one1.setBoundStatus(BondStatusEnum.PAID); orderAuctionBondMapper.updateById(one1); + + }else{ LambdaQueryWrapper<Order> wrapper1= Wrappers.lambdaQuery(); wrapper1.eq(Order::getOrderNo,paylog1.getOutTradeNo()); @@ -434,6 +443,20 @@ wrapper1.eq(OrderAuctionBond::getOrderNo,paylog.getOutTradeNo()); wrapper1.eq(OrderAuctionBond::getDelFlag,0); OrderAuctionBond one1 = orderAuctionBondMapper.selectOne(wrapper1); + if (one1.getOrderTimeSx().isAfter(LocalDateTime.now())){ + String refundMoney = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); + Integer refundFee = Integer.parseInt(refundMoney.substring(0, refundMoney.length() - 3)); + String money = SinataUtil.doubleRetainTwo(paylog.getPayMoney() * 100d); + Integer totalFee = Integer.parseInt(money.substring(0, money.length() - 3)); + refundFee = Integer.parseInt(money.substring(0, money.length() - 3)); + + String regEx = "[^0-9]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(paylog.getOutTradeNo()); + String ma = m.replaceAll("").trim(); + refundForWxpay(4, paylog.getTradeNo(), paylog.getOutTradeNo(), "R" + ma, totalFee, refundFee, "2"); + } + one1.setBoundStatus(BondStatusEnum.PAID); one1.setPaymentMethod(PaymentMethodEnum.WECHAT); orderAuctionBondMapper.updateById(one1); @@ -570,7 +593,7 @@ * @param request * @return */ - public static R<Map<String, Object>> wxpay(Integer apptype,LocalDateTime sx,String outTradeNo, String body,String openId, Double price, + public static R<Map<String, Object>> wxpay(Integer apptype,String outTradeNo, String body,String openId, Double price, HttpServletRequest request) { // 获取预支付接口返回参数 Map<String, Object> map1 = new HashMap<String, Object>(); @@ -610,10 +633,6 @@ paraMap.put("body", body); //设置请求参数(商户订单号) paraMap.put("out_trade_no", outTradeNo); - if (sx!=null){ - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); - paraMap.put("time_expire",sx.format(formatter)); - } //设置请求参数(总金额) String money=SinataUtil.doubleRetainTwo(price*100d); diff --git a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/ForepartCouponMemberController.java b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/ForepartCouponMemberController.java index d320bc7..a5e8aef 100644 --- a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/ForepartCouponMemberController.java +++ b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/ForepartCouponMemberController.java @@ -3,6 +3,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.promotion.controller.forepart.vo.CouponMemberVO; import com.ruoyi.system.api.domain.dto.CouponMemberDTO; import com.ruoyi.system.api.domain.CouponMember; import com.ruoyi.promotion.service.ICouponMemberService; @@ -34,19 +35,19 @@ @PostMapping("/getCouponMemberList") @ApiOperation(value = "用户端-获取用户优惠卷") - public R<PageDTO<CouponMember>> getCouponMemberList(@RequestBody CouponMemberDTO couponMemberDTO) { + public R<PageDTO<CouponMemberVO>> getCouponMemberList(@RequestBody CouponMemberDTO couponMemberDTO) { return R.ok(iCouponMemberService.getCouponMemberList(couponMemberDTO)); } @PostMapping("/getCouponMember") @ApiOperation(value = "用户端-获取用户下单优惠卷") - public R<List<CouponMember>> getCouponMemberl(@RequestBody CouponMemberDTO couponMemberDTO) { + public R<List<CouponMemberVO>> getCouponMemberl(@RequestBody CouponMemberDTO couponMemberDTO) { return R.ok(iCouponMemberService.getCouponMemberl(couponMemberDTO)); } @PostMapping("/updCouponMember") @ApiOperation(value = "用户端-获取用户下单获取优惠卷") - public R<List<CouponMember>> updCouponMember1(@RequestBody CouponMemberDTO couponMemberDTO) { + public R<List<CouponMemberVO>> updCouponMember1(@RequestBody CouponMemberDTO couponMemberDTO) { return R.ok(iCouponMemberService.updCouponMember1(couponMemberDTO)); } diff --git a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/vo/CouponMemberVO.java b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/vo/CouponMemberVO.java new file mode 100644 index 0000000..727af79 --- /dev/null +++ b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/controller/forepart/vo/CouponMemberVO.java @@ -0,0 +1,76 @@ +package com.ruoyi.promotion.controller.forepart.vo; + +import com.baomidou.mybatisplus.annotation.*; +import com.ruoyi.common.core.enums.CouponTypeEnum; +import com.ruoyi.common.core.enums.CouponUseEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class CouponMemberVO { + @ApiModelProperty(value = "优惠券领取id") + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + @ApiModelProperty(value = "优惠券id") + private Long couponId; + + @ApiModelProperty(value = "优惠券名称") + private String couponName; + + @ApiModelProperty(value = "会员id") + private Long memberId; + + @ApiModelProperty(value = "优惠券类型 1=满减券 2=代金券 3=折扣券") + private CouponTypeEnum couponType; + + @ApiModelProperty(value = "优惠券状态 0:未使用, 1:已使用") + private CouponUseEnum couponStatus; + + @ApiModelProperty(value = "满减金额,例如:满100元") + private BigDecimal fullReductionAmount; + + @ApiModelProperty(value = "减少金额,例如:减50元") + private BigDecimal reductionAmount; + + @ApiModelProperty(value = "代金券金额,例如:50元") + private BigDecimal voucherAmount; + + @ApiModelProperty(value = "折扣额度,例如:8折") + private Integer discountRate; + + @ApiModelProperty(value = "最高可抵扣金额,例如:200元") + private BigDecimal maxDiscount; + + @ApiModelProperty(value = "优惠券说明") + private String description; + + @ApiModelProperty(value = "有效期起") + private LocalDateTime startDate; + + @ApiModelProperty(value = "有效期止") + private LocalDateTime endDate; + + @ApiModelProperty(value = "创建者") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty(value = "创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty(value = "更新者") + @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + @ApiModelProperty(value = "更新时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @ApiModelProperty(value = "删除标志(0代表存在 1代表删除)") + @TableLogic + private Integer delFlag; +} diff --git a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/ICouponMemberService.java b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/ICouponMemberService.java index cf5c5bb..42bad5a 100644 --- a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/ICouponMemberService.java +++ b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/ICouponMemberService.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.promotion.controller.forepart.vo.CouponMemberVO; import com.ruoyi.system.api.domain.dto.CouponMemberDTO; import com.ruoyi.system.api.domain.CouponMember; import org.springframework.web.bind.annotation.RequestBody; @@ -18,15 +19,15 @@ */ public interface ICouponMemberService extends IService<CouponMember> { - PageDTO<CouponMember> getCouponMemberList(CouponMemberDTO couponMemberDTO); + PageDTO<CouponMemberVO> getCouponMemberList(CouponMemberDTO couponMemberDTO); CouponMember getCouponMember(@RequestBody CouponMemberDTO couponMemberDTO); void updCouponMember(@RequestBody CouponMemberDTO couponMemberDTO); - List<CouponMember> getCouponMemberl(@RequestBody CouponMemberDTO couponMemberDTO); + List<CouponMemberVO> getCouponMemberl(@RequestBody CouponMemberDTO couponMemberDTO); - List<CouponMember> updCouponMember1(@RequestBody CouponMemberDTO couponMemberDTO); + List<CouponMemberVO> updCouponMember1(@RequestBody CouponMemberDTO couponMemberDTO); } diff --git a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/CouponMemberServiceImpl.java b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/CouponMemberServiceImpl.java index aefa38e..52cb391 100644 --- a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/CouponMemberServiceImpl.java +++ b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/CouponMemberServiceImpl.java @@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.enums.CouponUseEnum; import com.ruoyi.common.core.enums.ListingStatusEnum; +import com.ruoyi.common.core.utils.page.BeanUtils; import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.promotion.controller.forepart.vo.CouponMemberVO; import com.ruoyi.promotion.domain.Coupon; import com.ruoyi.promotion.mapper.CouponMapper; import com.ruoyi.promotion.mapper.CouponMemberMapper; @@ -15,6 +17,8 @@ import com.ruoyi.system.api.domain.CouponMember; import com.ruoyi.system.api.domain.GoodsSku; import com.ruoyi.system.api.domain.dto.CouponMemberDTO; + +import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -38,7 +42,7 @@ private CouponMapper couponMapper; @Override - public PageDTO<CouponMember> getCouponMemberList(CouponMemberDTO couponMemberDTO) { + public PageDTO<CouponMemberVO> getCouponMemberList(CouponMemberDTO couponMemberDTO) { LambdaQueryWrapper<Coupon> wrapper= Wrappers.lambdaQuery(); wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.REMOVED_FROM_THE_SHELF); wrapper.eq(Coupon::getDelFlag,0); @@ -59,7 +63,13 @@ wrapper1.eq(CouponMember::getMemberId,couponMemberDTO.getMemberId()); wrapper1.eq(CouponMember::getDelFlag,0); Page<CouponMember> page1 = this.page(page, wrapper1); - return PageDTO.of(page1); + PageDTO<CouponMemberVO> articleCommentsVOPageDTO = PageDTO.of(page1, CouponMemberVO.class); + List<CouponMemberVO> list2 = articleCommentsVOPageDTO.getList(); + for (CouponMemberVO couponMember:list2){ + Coupon coupon = couponMapper.selectById(couponMember.getCouponId()); + couponMember.setCouponName(coupon.getCouponName()); + } + return articleCommentsVOPageDTO; } @Override @@ -75,7 +85,7 @@ } @Override - public List<CouponMember> getCouponMemberl(CouponMemberDTO couponMemberDTO) { + public List<CouponMemberVO> getCouponMemberl(CouponMemberDTO couponMemberDTO) { LambdaQueryWrapper<Coupon> wrapper= Wrappers.lambdaQuery(); wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.REMOVED_FROM_THE_SHELF); @@ -94,11 +104,18 @@ } wrapper1.eq(CouponMember::getDelFlag,0); List<CouponMember> page1 = this.list(wrapper1); - return page1; + List<CouponMemberVO> couponMemberVOS=new ArrayList<>(); + for (CouponMember couponMember:page1){ + CouponMemberVO couponMemberVO= BeanUtils.copyProperties(couponMember,CouponMemberVO.class); + Coupon coupon = couponMapper.selectById(couponMemberVO.getCouponId()); + couponMemberVO.setCouponName(coupon.getCouponName()); + couponMemberVOS.add(couponMemberVO); + } + return couponMemberVOS; } @Override - public List<CouponMember> updCouponMember1(CouponMemberDTO couponMemberDTO) { + public List<CouponMemberVO> updCouponMember1(CouponMemberDTO couponMemberDTO) { LambdaQueryWrapper<Coupon> wrapper= Wrappers.lambdaQuery(); wrapper.eq(Coupon::getCouponStatus, ListingStatusEnum.REMOVED_FROM_THE_SHELF); @@ -118,6 +135,13 @@ wrapper1.eq(CouponMember::getMemberId,couponMemberDTO.getMemberId()); wrapper1.eq(CouponMember::getDelFlag,0); List<CouponMember> page1 = this.list(wrapper1); - return page1; + List<CouponMemberVO> couponMemberVOS=new ArrayList<>(); + for (CouponMember couponMember:page1){ + CouponMemberVO couponMemberVO= BeanUtils.copyProperties(couponMember,CouponMemberVO.class); + Coupon coupon = couponMapper.selectById(couponMemberVO.getCouponId()); + couponMemberVO.setCouponName(coupon.getCouponName()); + couponMemberVOS.add(couponMemberVO); + } + return couponMemberVOS; } } -- Gitblit v1.7.1