| | |
| | | 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.model.CoachChangeStateVO; |
| | | import com.dsh.activity.model.PointMerchandiseIncomeVo; |
| | | import com.dsh.activity.model.PointMerchandiseVo; |
| | | import com.dsh.activity.model.WriteOffDTO; |
| | | import com.dsh.activity.model.QueryDataFee; |
| | | import com.dsh.activity.model.request.*; |
| | | import com.dsh.activity.model.response.GoodsInfoOneVo; |
| | | import com.dsh.activity.model.response.StoreVos; |
| | |
| | | @Resource |
| | | private PointsMerchandiseCityService pmdsCityService; |
| | | |
| | | @Autowired |
| | | private UserPointsMerchandiseService userPointsMerchandiseService; |
| | | |
| | | /** |
| | | * 门票上下架 state=1 上架 state=2 下架 |
| | | */ |
| | | @RequestMapping("/base/pointMerchars/changeState") |
| | | public Object changeState(@RequestBody CoachChangeStateVO dto){ |
| | | return pmdsService.changeState(dto); |
| | | } |
| | | /** |
| | | * 门票核销 |
| | | */ |
| | | @RequestMapping("/base/pointMerchars/writeOff") |
| | | public Object writeOff(@RequestBody WriteOffDTO dto){ |
| | | UserPointsMerchandise byId = userPointsMerchandiseService.getById(dto.getId()); |
| | | byId.setStoreId(dto.getVerifiStoreId()); |
| | | byId.setStatus(2); |
| | | byId.setVerificationTime(new Date()); |
| | | byId.setUserId(null); |
| | | byId.setVerificationUserId(dto.getVerificationUserId()); |
| | | return userPointsMerchandiseService.updateById(byId); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/base/pointMerchars/ticketList") |
| | | public List<Map<String,Object>> ticketList(@RequestBody IntegralGoodsOfSearch ofSearch){ |
| | | List<Map<String, Object>> result = pmdsService.ticketList(ofSearch); |
| | | if (result.size() > 0){ |
| | | for (Map<String, Object> stringObjectMap : result) { |
| | | Integer o = (Integer) stringObjectMap.get("id"); |
| | | String startTime = (String) stringObjectMap.get("startTime"); |
| | | String endTime = (String) stringObjectMap.get("endTime"); |
| | | stringObjectMap.put("timeValue",startTime + "至"+endTime); |
| | | int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, o)); |
| | | int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, o) |
| | | .eq(UserPointsMerchandise::getStatus,2)); |
| | | stringObjectMap.put("hasExchangeQty",count1); |
| | | stringObjectMap.put("hasPickQty",count2); |
| | | |
| | | stringObjectMap.put("activeStatus",dealTimeStatus(startTime,endTime)); |
| | | } |
| | | if (ToolUtil.isNotEmpty(ofSearch.getActiveStatus())){ |
| | | result = dealTimeData(result,ofSearch.getActiveStatus()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/base/pointMerchars/queryGoodsListSearch") |
| | | public List<Map<String,Object>> getIntegralGoodsListOfSearch(@RequestBody IntegralGoodsOfSearch ofSearch){ |
| | | System.out.println(ofSearch); |
| | | List<Map<String, Object>> mapList = pmdsService.queryGoodsListOfSearch(ofSearch); |
| | | if (mapList.size() > 0){ |
| | | for (Map<String, Object> stringObjectMap : mapList) { |
| | | Integer o = (Integer) stringObjectMap.get("id"); |
| | | String startTime = (String) stringObjectMap.get("startTime"); |
| | | String endTime = (String) stringObjectMap.get("endTime"); |
| | | stringObjectMap.put("timeValue",startTime + "至"+endTime); |
| | | int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, o)); |
| | | int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, o) |
| | | .eq(UserPointsMerchandise::getStatus,2)); |
| | | stringObjectMap.put("hasExchangeQty",count1); |
| | | stringObjectMap.put("hasPickQty",count2); |
| | | |
| | | stringObjectMap.put("activeStatus",dealTimeStatus(startTime,endTime)); |
| | | } |
| | | if (ToolUtil.isNotEmpty(ofSearch.getActiveStatus())){ |
| | | mapList = dealTimeData(mapList,ofSearch.getActiveStatus()); |
| | | } |
| | | } |
| | | System.out.println("mapList->"+mapList); |
| | | return mapList; |
| | | } |
| | | /** |
| | | * 获取积分商票消费金额 |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/base/pointMerchars/getAmount") |
| | | public List<PointMerchandiseIncomeVo> getAmount(){ |
| | | return userPointsMerchandiseService.getAmount(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/pointMerchars/convertGoods") |
| | |
| | | for (PointsMerchandise merchandise : merchandises) { |
| | | IntegralCommodity integralCommodity = new IntegralCommodity(); |
| | | integralCommodity.setCommodityId(merchandise.getId()); |
| | | integralCommodity.setCommodityImg(merchandise.getProductImages()); |
| | | integralCommodity.setCommodityImg(merchandise.getCover()); |
| | | integralCommodity.setCommodityName(merchandise.getName()); |
| | | integralCommodity.setCommodityPrice(merchandise.getPrice()); |
| | | integralCommodity.setGoodsType(merchandise.getType()); |
| | |
| | | |
| | | list = pmdsService.list(new QueryWrapper<PointsMerchandise>() |
| | | .eq("state", 1) |
| | | .eq("shelves",1)); |
| | | .eq("shelves",1).le("startTime",new Date()).ge("endTime",new Date())); |
| | | if (list.size() > 0 ){ |
| | | Iterator<PointsMerchandise> iterator = list.iterator(); |
| | | while (iterator.hasNext()) { |
| | | PointsMerchandise merchandise = iterator.next(); |
| | | if (merchandise.getUseScope() == 2 && (!Objects.equals(merchandise.getCityCode(), cityCode) && !Objects.equals(merchandise.getProvinceCode(), provinceCode))) { |
| | | if (merchandise.getUseScope() == 2 && (!cityCode.equals(merchandise.getCityCode()) || !provinceCode.equals(merchandise.getProvinceCode()))) { |
| | | iterator.remove(); // 移除符合条件的商品 |
| | | } |
| | | } |
| | |
| | | detailsVo.setGoodId(merchandise.getId()); |
| | | List<String> list2 = new ArrayList<>(); |
| | | String cover = merchandise.getCover(); |
| | | list2.add(cover); |
| | | list2.addAll(Arrays.asList(StrUtils.splitStr2StrArr(merchandise.getProductImages(), ","))); |
| | | detailsVo.setPics(list2); |
| | | Collections.sort(detailsVo.getPics(), (s1, s2) -> { |
| | |
| | | detailsResponse.setEndTime(simpleDateFormat.format(merchandise.getEndTime())); |
| | | detailsResponse.setUseStatus(pointsMerchandise.getStatus() == 1 ? 2 : 1); |
| | | detailsResponse.setGoodType(merchandise.getType()); |
| | | if(merchandise.getType()==3){ |
| | | detailsResponse.setUserId(appUserId); |
| | | if(merchandise.getUseScope()==1){ |
| | | detailsResponse.setSid(0); |
| | | }else if(merchandise.getUseScope()==2){ |
| | | |
| | | }else if(merchandise.getUseScope()==3){ |
| | | |
| | | } |
| | | } |
| | | responses.add(detailsResponse); |
| | | } |
| | | detailsVo.setDetailsResponses(responses); |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/pointMerchars/queryGoodsListSearch") |
| | | public List<Map<String,Object>> getIntegralGoodsListOfSearch(@RequestBody IntegralGoodsOfSearch ofSearch){ |
| | | System.out.println(ofSearch); |
| | | List<Map<String, Object>> mapList = pmdsService.queryGoodsListOfSearch(ofSearch); |
| | | if (mapList.size() > 0){ |
| | | for (Map<String, Object> stringObjectMap : mapList) { |
| | | Integer o = (Integer) stringObjectMap.get("id"); |
| | | String startTime = (String) stringObjectMap.get("startTime"); |
| | | String endTime = (String) stringObjectMap.get("endTime"); |
| | | stringObjectMap.put("timeValue",startTime + "至"+endTime); |
| | | int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, o)); |
| | | int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getPointsMerchandiseId, o) |
| | | .eq(UserPointsMerchandise::getStatus,2)); |
| | | stringObjectMap.put("hasExchangeQty",count1); |
| | | stringObjectMap.put("hasPickQty",count2); |
| | | |
| | | stringObjectMap.put("activeStatus",dealTimeStatus(startTime,endTime)); |
| | | } |
| | | if (ToolUtil.isNotEmpty(ofSearch.getActiveStatus())){ |
| | | mapList = dealTimeData(mapList,ofSearch.getActiveStatus()); |
| | | } |
| | | } |
| | | System.out.println("mapList->"+mapList); |
| | | return mapList; |
| | | } |
| | | |
| | | public int dealTimeStatus(String startTime, String endTime){ |
| | | LocalDate now = LocalDate.now(); |
| | |
| | | vo.setSort(byId.getSort()); |
| | | vo.setContent(byId.getRedemptionInstructions()); |
| | | } |
| | | int count = userPointsMerchandiseService.count(new LambdaQueryWrapper<UserPointsMerchandise>().eq(UserPointsMerchandise::getPointsMerchandiseId, pointMercharsId)); |
| | | vo.setNum(count); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/pointMerchars/queryFee") |
| | | @ResponseBody |
| | | public HashMap<String, Object> queryFee(@RequestBody QueryDataFee queryDataFee){ |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | String data = queryDataFee.getData(); |
| | | List<Integer> ids = queryDataFee.getIds(); |
| | | if(ids.size()==0){ |
| | | ids.add(-1); |
| | | } |
| | | List<PointsMerchandise> list1 = pmdsService.list(new LambdaQueryWrapper<PointsMerchandise>().eq(PointsMerchandise::getRedemptionMethod, 3)); |
| | | LambdaQueryWrapper<UserPointsMerchandise> vipPaymentLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(data)){ |
| | | String stime = data.split(" - ")[0]+" 00:00:00"; |
| | | String etime = data.split(" - ")[1]+" 23:59:59"; |
| | | vipPaymentLambdaQueryWrapper.between(UserPointsMerchandise::getInsertTime,stime,etime); |
| | | } |
| | | vipPaymentLambdaQueryWrapper.in(UserPointsMerchandise::getUserId,ids); |
| | | List<Integer> collect = list1.stream().map(PointsMerchandise::getId).collect(Collectors.toList()); |
| | | if(collect.size()==0){ |
| | | collect.add(-1); |
| | | } |
| | | vipPaymentLambdaQueryWrapper.in(UserPointsMerchandise::getPointsMerchandiseId,collect); |
| | | vipPaymentLambdaQueryWrapper.eq(UserPointsMerchandise::getPayStatus,2); |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | List<UserPointsMerchandise> list = upmseService.list(vipPaymentLambdaQueryWrapper); |
| | | |
| | | double a =0; |
| | | double d =0; |
| | | double m =0; |
| | | double j =0; |
| | | double y =0; |
| | | for (UserPointsMerchandise userPointsMerchandise : list) { |
| | | for (PointsMerchandise pointsMerchandise : list1) { |
| | | if(pointsMerchandise.getId()==userPointsMerchandise.getPointsMerchandiseId()){ |
| | | a += pointsMerchandise.getCash().doubleValue(); |
| | | } |
| | | if(pointsMerchandise.getType()==3){ |
| | | if(pointsMerchandise.getCardType()==1){ |
| | | d += pointsMerchandise.getCash().doubleValue(); |
| | | } |
| | | if(pointsMerchandise.getCardType()==2){ |
| | | m += pointsMerchandise.getCash().doubleValue(); |
| | | } |
| | | if(pointsMerchandise.getCardType()==3){ |
| | | j += pointsMerchandise.getCash().doubleValue(); |
| | | } |
| | | if(pointsMerchandise.getCardType()==4){ |
| | | y += pointsMerchandise.getCash().doubleValue(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | map.put("all",a); |
| | | map.put("day",d); |
| | | map.put("month",m); |
| | | map.put("quarter",j); |
| | | map.put("year",y); |
| | | return map; |
| | | |
| | | |
| | | } |
| | | |
| | | } |