From 0872bd05123a6c9c8fa46a44465b7a703f676fb4 Mon Sep 17 00:00:00 2001 From: lisy <linlangsur163@163.com> Date: 星期四, 13 七月 2023 14:58:51 +0800 Subject: [PATCH] 使用福利:积分兑换记录的详情查询 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 160 insertions(+), 7 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 6793ca6..26c9023 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 @@ -7,15 +7,14 @@ import com.dsh.activity.feignclient.course.CoursePackageConfigClient; import com.dsh.activity.feignclient.course.model.CoursePackage; import com.dsh.activity.feignclient.course.model.CoursePackagePaymentConfig; -import com.dsh.activity.feignclient.model.IntegralCommodity; -import com.dsh.activity.feignclient.model.ProductDetailRequest; -import com.dsh.activity.feignclient.model.ProductDetailsVo; +import com.dsh.activity.feignclient.model.*; import com.dsh.activity.feignclient.other.StoreClient; import com.dsh.activity.feignclient.other.model.StoreDetailOfCourse; import com.dsh.activity.model.request.CommodityRequest; import com.dsh.activity.service.*; import com.dsh.activity.util.GDMapGeocodingUtil; import com.dsh.activity.util.StrUtils; +import com.dsh.activity.util.ToolUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -125,7 +124,18 @@ CoursePackage coursePackage = cpClient.queryCoursePackageById(detailRequest.getGoodId()); detailsVo.setGoodId(coursePackage.getId()); - detailsVo.setPics(Arrays.asList(StrUtils.splitStr2StrArr(coursePackage.getDetailDrawing(), ","))); + List<String> list1 = Arrays.asList(StrUtils.splitStr2StrArr(coursePackage.getDetailDrawing(), ",")); + list1.add(coursePackage.getCoverDrawing()); + detailsVo.setPics(list1); + Collections.sort(detailsVo.getPics(), (s1, s2) -> { + if (s1.equals(coursePackage.getCoverDrawing())) { + return -1; // s1排在前面 + } else if (s2.equals(coursePackage.getCoverDrawing())) { + return 1; // s2排在前面 + } else { + return 0; // 保持原顺序 + } + }); detailsVo.setGoodName(coursePackage.getName()); detailsVo.setBelongsScope(merchandise.getUserPopulation()); int coursePackageNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() @@ -168,8 +178,19 @@ case 3: detailsVo.setGoodId(merchandise.getId()); - String[] strings = StrUtils.splitStr2StrArr(merchandise.getProductImages(), ","); - detailsVo.setPics(Arrays.asList(strings)); + List<String> list2 = Arrays.asList(StrUtils.splitStr2StrArr(merchandise.getProductImages(), ",")); + list2.add(merchandise.getCover()); + detailsVo.setPics(list2); + Collections.sort(detailsVo.getPics(), (s1, s2) -> { + if (s1.equals(merchandise.getCover())) { + return -1; // s1排在前面 + } else if (s2.equals(merchandise.getCover())) { + return 1; // s2排在前面 + } else { + return 0; // 保持原顺序 + } + }); + detailsVo.setPics(list2); detailsVo.setGoodName(merchandise.getName()); detailsVo.setBelongsScope(merchandise.getUserPopulation()); int count = upmseService.count(new QueryWrapper<UserPointsMerchandise>() @@ -205,7 +226,18 @@ // 优惠券 Coupon coupon = iCouponService.getById(detailRequest.getGoodId()); detailsVo.setGoodId(coupon.getId()); - detailsVo.setPics(Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ","))); + List<String> list3 = Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ",")); + list3.add(coupon.getCover()); + 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.setBelongsScope(coupon.getUserPopulation()); int couponNums = uconService.count(new QueryWrapper<UserCoupon>() @@ -241,4 +273,125 @@ } + + @PostMapping("/base/pointMerchars/getDetailsOfExchange") + public List<ExchangeDetailsResponse> getIntegralExchangeDetails(@RequestBody Integer appUserId){ + List<ExchangeDetailsResponse> responses = new ArrayList<>(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + List<UserPointsMerchandise> pointsMerchandises = upmseService.list(new QueryWrapper<UserPointsMerchandise>() + .eq("userId",appUserId )); + if (pointsMerchandises.size() > 0 ){ + for (UserPointsMerchandise pointsMerchandise : pointsMerchandises) { + PointsMerchandise merchandise = pmdsService.getById(pointsMerchandise.getPointsMerchandiseId()); + ExchangeDetailsResponse detailsResponse = new ExchangeDetailsResponse(); + detailsResponse.setDetailsId(pointsMerchandise.getId()); + detailsResponse.setGoodName(merchandise.getName()); + if (merchandise.getRedemptionMethod() == 1){ + detailsResponse.setRequiredType(merchandise.getIntegral()+"积分"); + }else { + detailsResponse.setRequiredType(merchandise.getIntegral()+"积分 ¥"+merchandise.getCash()); + } + detailsResponse.setStartTime(simpleDateFormat.format(merchandise.getStartTime())); + detailsResponse.setEndTime(simpleDateFormat.format(merchandise.getEndTime())); + detailsResponse.setUseStatus(pointsMerchandise.getStatus()); + detailsResponse.setGoodType(merchandise.getType()); + responses.add(detailsResponse); + } + } + return responses; + } + + + + @PostMapping("/base/pointMerchars/getSpecificsOfGoods") + public PointDetailsVo getSpecificsOfGoods(@RequestBody Integer speMercharsId){ + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + PointDetailsVo detailsVo = new PointDetailsVo(); + UserPointsMerchandise byId = upmseService.getById(speMercharsId); + if (ToolUtil.isNotEmpty(byId)){ + PointsMerchandise pmdsServiceById = pmdsService.getById(byId.getPointsMerchandiseId()); + detailsVo.setDetailsId(byId.getId()); + switch (pmdsServiceById.getType()){ + case 1: + case 3: + List<String> list2 = Arrays.asList(StrUtils.splitStr2StrArr(pmdsServiceById.getProductImages(), ",")); + list2.add(pmdsServiceById.getCover()); + detailsVo.setPics(list2); + Collections.sort(detailsVo.getPics(), (s1, s2) -> { + if (s1.equals(pmdsServiceById.getCover())) { + return -1; // s1排在前面 + } else if (s2.equals(pmdsServiceById.getCover())) { + return 1; // s2排在前面 + } else { + return 0; // 保持原顺序 + } + }); + break; + case 2: + CoursePackage coursePackage = cpClient.queryCoursePackageById(pmdsServiceById.getCoursePackageId()); + List<String> list1 = Arrays.asList(StrUtils.splitStr2StrArr(coursePackage.getDetailDrawing(), ",")); + list1.add(coursePackage.getCoverDrawing()); + detailsVo.setPics(list1); + Collections.sort(detailsVo.getPics(), (s1, s2) -> { + if (s1.equals(coursePackage.getCoverDrawing())) { + return -1; // s1排在前面 + } else if (s2.equals(coursePackage.getCoverDrawing())) { + return 1; // s2排在前面 + } else { + return 0; // 保持原顺序 + } + }); + break; + case 4: + Coupon coupon = iCouponService.getById(pmdsServiceById.getId()); + List<String> list3 = Arrays.asList(StrUtils.splitStr2StrArr(coupon.getProductImages(), ",")); + list3.add(coupon.getCover()); + 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; // 保持原顺序 + } + }); + break; + default: + break; + } + + detailsVo.setGoodName(pmdsServiceById.getName()); + detailsVo.setStartTime(simpleDateFormat.format(pmdsServiceById.getStartTime())); + detailsVo.setEndTime(simpleDateFormat.format(pmdsServiceById.getEndTime())); + detailsVo.setOrderTime(simpleDateFormat.format(byId.getInsertTime())); + if (byId.getStatus() == 1){ + detailsVo.setUseType(2); + }else { + detailsVo.setUseType(1); + detailsVo.setWriteOffTime(simpleDateFormat.format(byId.getVerificationTime())); + StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(byId.getVerifiStoreId()); + detailsVo.setWriteOffName(courseOfStore.getStoreName()); + } + switch (pmdsServiceById.getUseScope()){ + case 1: + detailsVo.setBelongs("全国通用"); + break; + case 2: + detailsVo.setBelongs(pmdsServiceById.getProvince()+pmdsServiceById.getCity()); + break; + case 3: + PointsMerchandiseStore one = pmdstoService.getOne(new QueryWrapper<PointsMerchandiseStore>() + .eq("pointsMerchandiseId",pmdsServiceById.getId() )); + StoreDetailOfCourse courseOfStore = stoClient.getCourseOfStore(one.getStoreId()); + detailsVo.setBelongs(courseOfStore.getStoreName()+" "+courseOfStore.getStoreAddr()); + break; + default: + break; + } + detailsVo.setContents(pmdsServiceById.getRedemptionInstructions()); + } + return detailsVo; + } + } -- Gitblit v1.7.1