From ac3e9a7f0b21fb630049f9e191bd760eefd21467 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期六, 16 八月 2025 18:04:38 +0800 Subject: [PATCH] 管理后台会员管理 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 154 insertions(+), 19 deletions(-) diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java index b3ea633..82b47e7 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java @@ -326,7 +326,8 @@ QueryWrapper<PointsMerchandise> wrapper = new QueryWrapper<PointsMerchandise>() .eq("state", 1) .eq("shelves", 1) - .gt("endTime", new Date()); + .gt("endTime", new Date()) + .eq("status", 1); if(cIds.size() > 0){ wrapper.in("id", cIds); } @@ -337,7 +338,17 @@ integralCommodity.setCommodityId(merchandise.getId()); integralCommodity.setCommodityImg(merchandise.getCover()); integralCommodity.setCommodityName(merchandise.getName()); - integralCommodity.setCommodityPrice(merchandise.getPrice()); + if(merchandise.getRedemptionMethod() == 1){ + integralCommodity.setIntegral(merchandise.getIntegral()); + } + if(merchandise.getRedemptionMethod() == 2){ + integralCommodity.setCommodityPrice(merchandise.getPrice()); + integralCommodity.setIntegral(merchandise.getIntegral()); + } + if(merchandise.getRedemptionMethod() == 3){ + integralCommodity.setCommodityPrice(merchandise.getPrice()); + } + integralCommodity.setRedemptionMethod(merchandise.getRedemptionMethod()); integralCommodity.setGoodsType(merchandise.getType()); integralCommodity.setSort(merchandise.getSort()); commodity.add(integralCommodity); @@ -350,27 +361,30 @@ storeCoupons.add(couponStore.getCouponId()); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - QueryWrapper<Coupon> queryWrapper = new QueryWrapper<Coupon>().eq("state", 1).gt("endTime", sdf.format(new Date())); + QueryWrapper<Coupon> queryWrapper = new QueryWrapper<Coupon>() + .eq("state", 1).gt("endTime", sdf.format(new Date())); if(storeCoupons.size() > 0){ queryWrapper.in("id", storeCoupons); } List<Coupon> list = couponService.list(queryWrapper.last(" ORDER BY insertTime desc")); if (!list.isEmpty()){ for (Coupon coupon : list) { - IntegralCommodity integralCommodity = new IntegralCommodity(); - integralCommodity.setCommodityId(coupon.getId()); - integralCommodity.setCommodityImg(coupon.getCover()); - integralCommodity.setCommodityName(coupon.getName()); - integralCommodity.setCommodityPrice(coupon.getIntegral()); - integralCommodity.setGoodsType(coupon.getType()); -// integralCommodity.setSort(coupon.getSort()); - commodity.add(integralCommodity); + IntegralCommodity integralCommodity = new IntegralCommodity(); + integralCommodity.setCommodityId(coupon.getId()); + integralCommodity.setCommodityImg(coupon.getCover()); + integralCommodity.setCommodityName(coupon.getName()); + if(coupon.getRedemptionMethod() == 1){ + integralCommodity.setIntegral(coupon.getIntegral().intValue()); + } + if(coupon.getRedemptionMethod() == 2){ + integralCommodity.setCommodityPrice(coupon.getCash()); + integralCommodity.setIntegral(coupon.getIntegral().intValue()); + } + integralCommodity.setRedemptionMethod(coupon.getRedemptionMethod()); + integralCommodity.setGoodsType(4); + commodity.add(integralCommodity); } - } - - - System.out.println(commodity); return commodity; } @@ -396,7 +410,11 @@ list = pmdsService.list(new QueryWrapper<PointsMerchandise>() .eq("state", 1) - .eq("shelves", 1).le("startTime", new Date()).ge("endTime", new Date())); + .eq("shelves", 1) + .le("startTime", new Date()) + .ge("endTime", new Date()) + .eq("status", 1) + ); if (list.size() > 0) { Iterator<PointsMerchandise> iterator = list.iterator(); while (iterator.hasNext()) { @@ -605,6 +623,8 @@ @Autowired private UserCouponService userCouponService; + @Autowired + private VipDetailService vipDetailService; @PostMapping("/base/pointMerchars/getGoodDetails") public ProductDetailsVo getGoodDetailsWithId(@RequestBody ProductDetailRequest detailRequest) { @@ -1021,6 +1041,28 @@ detailsVo.setDetailsResponses(responses); } + // 2.0新增会员权益赠送门票 + List<VipDetail> list = vipDetailService.lambdaQuery() + .eq(VipDetail::getAppUserId, appUserId).eq(VipDetail::getType, 2).list(); + for (VipDetail vipDetail : list) { + ExchangeDetailsResponse detailsResponse = new ExchangeDetailsResponse(); + // 添加-用于区分会员权益门票 + detailsResponse.setDetailsId(Long.valueOf("-"+vipDetail.getId())); + detailsResponse.setGoodName(vipDetail.getTicketName()); + detailsResponse.setStartTime(simpleDateFormat.format(vipDetail.getStartTime())); + detailsResponse.setEndTime(simpleDateFormat.format(vipDetail.getEndTime())); + + + detailsResponse.setUseStatus(vipDetail.getStatus()); + detailsResponse.setGoodType(3); + // 表明是会员赠送的门票 + detailsResponse.setExchangeType(3); + // 全国通用 + detailsResponse.setRid(Collections.singletonList(0)); + detailsResponse.setSid(Collections.singletonList(0)); + + responses.add(detailsResponse); + } if (userCoupons.size() > 0) { for (UserCoupon userCoupon : userCoupons) { @@ -1065,9 +1107,95 @@ public PointDetailsVo getSpecificsOfGoods(@RequestBody Long speMercharsId) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); PointDetailsVo detailsVo = new PointDetailsVo(); + + if (speMercharsId.toString().contains("-1")){ + // 会员门票 + VipDetail vipDetail = vipDetailService.getById(Math.abs(speMercharsId)); + if (vipDetail.getType()==1){ + Coupon coupon = iCouponService.getById(vipDetail.getCouponId()); + detailsVo.setDetailsId(Long.valueOf(coupon.getId())); + List<String> list3 = new ArrayList<>(); + list3.add(ToolUtil.isEmpty(coupon.getCover()) ? "" : coupon.getCover()); + if (ToolUtil.isNotEmpty(coupon.getProductImages())) { + list3.addAll(Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ","))); + } + detailsVo.setPics(list3); + Collections.sort(detailsVo.getPics(), (s1, s2) -> { + if (s1.equals(coupon.getCover())) { + return -1; // s1排在前面 + } else if (s2.equals(coupon.getCover())) { + return 1; // s2排在前面 + } else { + return 0; // 保持原顺序 + } + }); + detailsVo.setGoodName(coupon.getName()); + detailsVo.setExchangeType(coupon.getRedemptionMethod()); + if (coupon.getRedemptionMethod() == 1) { + detailsVo.setIntegral(coupon.getIntegral().intValue()); + } else { + detailsVo.setIntegral(coupon.getIntegral().intValue()); + detailsVo.setCash(coupon.getCash()); + } + if (coupon.getUseScope() == 1) { + detailsVo.setExchangeAddrType(1); + detailsVo.setBelongs("全国通用"); + } else if (coupon.getUseScope() == 2) { + detailsVo.setExchangeAddrType(2); + List<CouponCity> list = ccityService.list(new LambdaQueryWrapper<CouponCity>() + .eq(CouponCity::getCouponId, coupon.getId())); + if (list.size() > 0) { + detailsVo.setBelongs(list.get(0).getProvince() + "|" + list.get(0).getCity() + "用户可用"); + } + } else { + detailsVo.setExchangeAddrType(3); + List<CouponStore> list = cstoreService.list(new QueryWrapper<CouponStore>() + .eq("couponId", coupon.getId())); + StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(list.get(0).getStoreId()); + detailsVo.setBelongs(courseOfStore.getStoreName() + "可用"); + } + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + detailsVo.setStartTime(format.format(coupon.getStartTime())); + detailsVo.setEndTime(format.format(coupon.getEndTime())); + + detailsVo.setContents(coupon.getIllustrate()); + detailsVo.setGoodType(4); + }else{ + + // 门票 + detailsVo.setDetailsId(Long.valueOf("-"+vipDetail.getId())); + detailsVo.setGoodName(vipDetail.getTicketName()); + switch (vipDetail.getStatus()){ + case 1: + detailsVo.setUseType(2); + break; + case 2: + detailsVo.setUseType(1); + break; + case 3: + detailsVo.setUseType(3); + break; + } + detailsVo.setStartTime(simpleDateFormat.format(vipDetail.getStartTime())); + detailsVo.setEndTime(simpleDateFormat.format(vipDetail.getEndTime())); + detailsVo.setOrderTime(simpleDateFormat.format(vipDetail.getInsertTime())); + if (vipDetail.getUseTime()!=null){ + detailsVo.setWriteOffTime(simpleDateFormat.format(vipDetail.getUseTime())); + } + if (vipDetail.getUseStoreId()!=null){ + StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(vipDetail.getUseStoreId()); + detailsVo.setWriteOffName(courseOfStore.getStoreName()); + } + + detailsVo.setBelongs("全国通用"); + detailsVo.setGoodType(3); + detailsVo.setCardType(1); + detailsVo.setExchangeAddrType(1); + } + detailsVo.setDetailsId(Long.valueOf("-"+vipDetail.getId())); + return detailsVo; + } UserPointsMerchandise byId = upmseService.getById(speMercharsId); - - if (ToolUtil.isNotEmpty(byId)) { List<PointsMerchandiseStore> stores = storeService.list(new QueryWrapper<PointsMerchandiseStore>().eq("pointsMerchandiseId", byId.getPointsMerchandiseId())); @@ -1550,14 +1678,17 @@ if (ToolUtil.isNotEmpty(pointMercharsPayedVo.getStatus())) { userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getStatus, pointMercharsPayedVo.getStatus()); } - List<UserPointsMerchandise> list = upmseService.list(userPointsMerchandiseLambdaQueryWrapper); + List<UserPointsMerchandise> list = upmseService.list(userPointsMerchandiseLambdaQueryWrapper.orderByDesc(UserPointsMerchandise::getPaymentTime) + .isNotNull(UserPointsMerchandise::getPaymentTime)); System.out.println(list); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (list.size() > 0) { for (UserPointsMerchandise pointsMerchandise : list) { Map<String, Object> map = new HashMap<>(); map.put("id", pointsMerchandise.getId()); map.put("userId", pointsMerchandise.getUserId()); map.put("status", pointsMerchandise.getStatus()); + map.put("payTime", sdf.format(pointsMerchandise.getPaymentTime())); mapList.add(map); } } @@ -1754,11 +1885,15 @@ @PostMapping("/base/pointMerchars/updateGoodsDetail") public boolean updateGoodsDetail(@RequestBody Map<String, Object> map) { try { + String name = (String) map.get("name"); Integer pointMerchandiseId = (Integer) map.get("pointMerchandiseId"); PointsMerchandise byId1 = pmdsService.getById(pointMerchandiseId); if (Integer.valueOf(map.get("type").toString()) != 1) { byId1.setStatus(2); } + if(StringUtils.hasLength(name)){ + byId1.setName(name); + } Integer quantityIssued = (Integer) map.get("quantityIssued"); Integer pickUpQuantity = (Integer) map.get("pickUpQuantity"); String redemptionInstructions = (String) map.get("redemptionInstructions"); -- Gitblit v1.7.1