From a1cadd023734d1e33f6455ec87fb7e2783d808fe Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期一, 11 三月 2024 16:04:14 +0800 Subject: [PATCH] bug修改 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 130 ++++++++++++++++++++++++++++++++++--------- 1 files changed, 103 insertions(+), 27 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 a276027..27f65ba 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 @@ -10,11 +10,9 @@ import com.dsh.activity.feignclient.course.model.CoursePackagePaymentConfig; import com.dsh.activity.feignclient.model.*; import com.dsh.activity.feignclient.other.OperatorClient; +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.feignclient.other.model.StoreDetailOfCourse; -import com.dsh.activity.feignclient.other.model.StoreInfoDto; -import com.dsh.activity.feignclient.other.model.TOperatorCity; +import com.dsh.activity.feignclient.other.model.*; import com.dsh.activity.model.CoachChangeStateVO; import com.dsh.activity.model.PointMerchandiseIncomeVo; import com.dsh.activity.model.PointMerchandiseVo; @@ -27,6 +25,7 @@ import com.dsh.activity.util.*; import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -78,6 +77,8 @@ @Resource private CouponCityService ccityService; + @Autowired + private SiteClient siteClient; @Resource @@ -441,7 +442,7 @@ detailsVo.setGoodName(coursePackage.getName()); detailsVo.setBelongsScope(merchandise.getUserPopulation()); int coursePackageNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() - .eq("pointsMerchandiseId", merchandise.getId())); + .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); detailsVo.setRedeemedNum(coursePackageNums); detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - coursePackageNums, 0)); detailsVo.setPerLimit(merchandise.getPickUpQuantity()); @@ -504,7 +505,7 @@ detailsVo.setGoodName(merchandise.getName()); detailsVo.setBelongsScope(merchandise.getUserPopulation()); int count = upmseService.count(new QueryWrapper<UserPointsMerchandise>() - .eq("pointsMerchandiseId", merchandise.getId())); + .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); detailsVo.setRedeemedNum(count); detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - count, 0)); detailsVo.setPerLimit(merchandise.getPickUpQuantity()); @@ -559,7 +560,7 @@ detailsVo.setGoodName(coupon.getName()); detailsVo.setBelongsScope(coupon.getUserPopulation()); int couponNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() - .eq("pointsMerchandiseId", merchandise.getId())); + .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); detailsVo.setRedeemedNum(couponNums); detailsVo.setResidueNum(Math.max(coupon.getQuantityIssued() - couponNums, 0)); detailsVo.setPerLimit(coupon.getPickUpQuantity()); @@ -639,7 +640,7 @@ detailsVo.setGoodName(coursePackage.getName()); detailsVo.setBelongsScope(merchandise.getUserPopulation()); int coursePackageNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() - .eq("pointsMerchandiseId", merchandise.getId())); + .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); detailsVo.setRedeemedNum(coursePackageNums); detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - coursePackageNums, 0)); detailsVo.setPerLimit(merchandise.getPickUpQuantity()); @@ -702,7 +703,7 @@ detailsVo.setGoodName(merchandise.getName()); detailsVo.setBelongsScope(merchandise.getUserPopulation()); int count = upmseService.count(new QueryWrapper<UserPointsMerchandise>() - .eq("pointsMerchandiseId", merchandise.getId())); + .eq("pointsMerchandiseId", merchandise.getId()).eq("payStatus", 2).eq("state", 1)); detailsVo.setRedeemedNum(count); detailsVo.setResidueNum(Math.max(merchandise.getQuantityIssued() - count, 0)); detailsVo.setPerLimit(merchandise.getPickUpQuantity()); @@ -885,7 +886,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 后续调整为门票指定多个区域 @@ -908,11 +909,27 @@ list4.add(43); detailsResponse.setRid(list4); } - } } //====================================================== } + }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); } @@ -1381,7 +1398,8 @@ public int queryUserHasGoodsNums(@RequestBody AppUserGoodResp goodResp) { int count = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() .eq(UserPointsMerchandise::getUserId, goodResp.getAppUserId()) - .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId())); + .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId()) + .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1)); System.out.println(count); return count; } @@ -1390,7 +1408,8 @@ @PostMapping("/base/pointMerchars/queryUserHasGoodsNums1") public int queryUserHasGoodsNums1(@RequestBody AppUserGoodResp goodResp) { int count = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() - .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId())); + .eq(UserPointsMerchandise::getPointsMerchandiseId, goodResp.getGoodId()) + .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1)); System.out.println(count); return count; } @@ -1622,6 +1641,9 @@ case 3: infoOneVo.setExchangeArea("指定门店"); break; + case 4: + infoOneVo.setExchangeArea("指定场地"); + break; default: break; } @@ -1659,27 +1681,66 @@ List<StoreVos> storeVos = new ArrayList<>(); List<PointsMerchandiseStore> list = pmdstoService.list(new QueryWrapper<PointsMerchandiseStore>() .eq("pointsMerchandiseId", id)); - if (list.size() > 0) { - List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList()); - List<Store> stores = stoClient.queryStoreByIds(collect); - if (stores.size() > 0) { - for (Store store : stores) { - StoreVos storeVos1 = new StoreVos(); - storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市"); - if (store.getOperatorId() == 0) { - storeVos1.setNum2("平台"); - } else { + PointsMerchandise byId = pmdsService.getById(id); - storeVos1.setNum2(store.getOName()); + if (list.size() > 0) { + + if (byId.getUseScope()==3){ + // 如果是指定门店 + List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList()); + + List<Store> stores = stoClient.queryStoreByIds(collect); + if (stores.size() > 0) { + int a = 0; + for (Store store : stores) { + StoreVos storeVos1 = new StoreVos(); + storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市"); + if (store.getOperatorId()==null){ + storeVos1.setNum2("平台"); + }else if (store.getOperatorId() == 0) { + storeVos1.setNum2("平台"); + } else { + storeVos1.setNum2(store.getOName()); + } + storeVos1.setNum3(store.getName()); + storeVos1.setNum4(store.getIds()); + storeVos.add(storeVos1); } - storeVos1.setNum3(store.getName()); - storeVos1.setNum4(store.getIds()); - storeVos.add(storeVos1); } + }else if (byId.getUseScope()==4){ + // 如果是指定场地 + List<Integer> collect1 = list.stream().map(PointsMerchandiseStore::getSiteId).collect(Collectors.toList()); + int temp =0; + List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList()); + List<Store> stores = stoClient.queryStoreByIds(collect); + while (temp!=collect1.size()){ + for (Store store : stores) { + Integer integer = collect1.get(temp); + Site site = siteClient.querySiteById(integer); + StoreVos storeVos1 = new StoreVos(); + storeVos1.setNum5(site.getName()); + storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市"); + if (store.getOperatorId()==null){ + storeVos1.setNum2("平台"); + }else if (store.getOperatorId() == 0) { + storeVos1.setNum2("平台"); + } else { + storeVos1.setNum2(store.getOName()); + } + storeVos1.setNum3(store.getName()); + storeVos1.setNum4(store.getIds()); + storeVos.add(storeVos1); + temp++; + } + } + + } + } return storeVos; } + @ResponseBody @@ -1742,6 +1803,20 @@ 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; + } + } for (String s : split[1].split(",")) { PointsMerchandiseStore pointsMerchandiseStore = new PointsMerchandiseStore(); pointsMerchandiseStore.setPointsMerchandiseId(Integer.valueOf(split[0])); @@ -1751,6 +1826,7 @@ return save; } + @PostMapping("/base/pointMerchars/addCitys") public Boolean addCitys(@RequestBody ArrayList<Map<String, String>> objects) { try { -- Gitblit v1.7.1