From 9486766c806fe1d9e082b2fd02ea1cc558f1b443 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期四, 08 五月 2025 09:21:57 +0800 Subject: [PATCH] bug修改 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 137 ++++++++++++++++++++++++++++----------------- 1 files changed, 84 insertions(+), 53 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 27f65ba..59bfd58 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 @@ -226,10 +226,12 @@ String endTime = (String) stringObjectMap.get("endTime"); stringObjectMap.put("timeValue", startTime + "至" + endTime); int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() - .eq(UserPointsMerchandise::getPointsMerchandiseId, o)); + .eq(UserPointsMerchandise::getPointsMerchandiseId, o) + .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1)); int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() .eq(UserPointsMerchandise::getPointsMerchandiseId, o) - .eq(UserPointsMerchandise::getStatus, 2)); + .eq(UserPointsMerchandise::getStatus, 2) + .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1)); stringObjectMap.put("hasExchangeQty", count1); stringObjectMap.put("hasPickQty", count2); @@ -324,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); } @@ -335,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); @@ -348,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; } @@ -394,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()) { @@ -886,7 +906,7 @@ detailsResponse.setSid(collect); if (collect.size() > 0) { // 获取rid -// List<Integer> rid= stoClient.querySiteIdById(collect); +// List<Integer> rid= stoClient.querySiteIdById(collect); //detailsResponse.setRid(rid); // todo 修改区域id 临时 // 根据门店id 写死区域id 后续调整为门票指定多个区域 @@ -914,22 +934,22 @@ //====================================================== } }else{ - // todo 返回门店id 和场地id - // 查询指定场地 - List<PointsMerchandiseStore> list = pmdstoService.list(new LambdaQueryWrapper<PointsMerchandiseStore>() - .eq(PointsMerchandiseStore::getPointsMerchandiseId, merchandise.getId())); - // 门店 - ArrayList<Integer> list3 = new ArrayList<>(); - // 场地 - ArrayList<Integer> list4 = new ArrayList<>(); - for (PointsMerchandiseStore temp : list) { - Integer storeId = temp.getStoreId(); - Integer siteId = temp.getSiteId(); - list3.add(storeId); - list4.add(siteId); - } - detailsResponse.setRid(list4); - detailsResponse.setSid(list3); + // todo 返回门店id 和场地id + // 查询指定场地 + List<PointsMerchandiseStore> list = pmdstoService.list(new LambdaQueryWrapper<PointsMerchandiseStore>() + .eq(PointsMerchandiseStore::getPointsMerchandiseId, merchandise.getId())); + // 门店 + ArrayList<Integer> list3 = new ArrayList<>(); + // 场地 + ArrayList<Integer> list4 = new ArrayList<>(); + for (PointsMerchandiseStore temp : list) { + Integer storeId = temp.getStoreId(); + Integer siteId = temp.getSiteId(); + list3.add(storeId); + list4.add(siteId); + } + detailsResponse.setRid(list4); + detailsResponse.setSid(list3); } @@ -1361,7 +1381,6 @@ @PostMapping("/base/pointMerchars/updateDetailsUserPointMercase") public void updateDetailsUserPointMercase(@RequestBody UserPointsMerchandise merchandise) { merchandise.setUserId(null); - merchandise.setPointsMerchandiseId(null); upmseService.updateById(merchandise); } @@ -1440,8 +1459,6 @@ @PostMapping("/base/pointMerchars/getConsumeDetails") public List<ConsumeDetail> getConsumeDetails(@RequestBody BillingDataRequestVo requestVo) { return upmseService.getConsumeDetails(requestVo); - - } @@ -1547,17 +1564,20 @@ List<Map<String, Object>> mapList = new ArrayList<>(); LambdaQueryWrapper<UserPointsMerchandise> userPointsMerchandiseLambdaQueryWrapper = new LambdaQueryWrapper<>(); userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getPointsMerchandiseId, pointMercharsPayedVo.getId()); + userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1); 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)); 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); } } @@ -1709,12 +1729,19 @@ } }else if (byId.getUseScope()==4){ // 如果是指定场地 - List<Integer> collect1 = list.stream().map(PointsMerchandiseStore::getSiteId).collect(Collectors.toList()); + List<Integer> collect1 = list.stream().map(PointsMerchandiseStore::getSiteId).distinct().collect(Collectors.toList()); int temp =0; List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList()); + List<Store> stores1 = new ArrayList<>(); + for (Integer integer : collect) { + List<Integer> list1 = new ArrayList<>(); + list1.add(integer); + List<Store> stores = stoClient.queryStoreByIds(list1); + stores1.addAll(stores); + } List<Store> stores = stoClient.queryStoreByIds(collect); while (temp!=collect1.size()){ - for (Store store : stores) { + for (Store store : stores1) { Integer integer = collect1.get(temp); Site site = siteClient.querySiteById(integer); StoreVos storeVos1 = new StoreVos(); @@ -1747,10 +1774,14 @@ @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"); @@ -1803,19 +1834,19 @@ public Boolean addOther(@RequestBody String pam) { Boolean save = false; String[] split = pam.split("_"); - if (split.length > 2) { - if (StringUtils.hasLength(split[2])) { - for (String s : split[2].split(",")) { - PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); - pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); - pointsMerchandiseStore.setSiteId(Integer.valueOf(s)); - Site site = siteClient.querySiteById(Integer.valueOf(s)); - pointsMerchandiseStore.setStoreId(site.getStoreId()); - save = pmdstoService.save(pointsMerchandiseStore); - } - // 这个门票是选择的场地 - return save; + if (split.length>2){ + if (StringUtils.hasLength(split[2])){ + for (String s : split[2].split(",")) { + PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); + pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); + pointsMerchandiseStore.setSiteId(Integer.valueOf(s)); + Site site = siteClient.querySiteById(Integer.valueOf(s)); + pointsMerchandiseStore.setStoreId(site.getStoreId()); + save = pmdstoService.save(pointsMerchandiseStore); } + // 这个门票是选择的场地 + return save; + } } for (String s : split[1].split(",")) { PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); -- Gitblit v1.7.1