| | |
| | | } |
| | | return detailsVo; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private UserCouponService userCouponService; |
| | | @PostMapping("/base/pointMerchars/getGoodDetails") |
| | | public ProductDetailsVo getGoodDetailsWithId(@RequestBody ProductDetailRequest detailRequest){ |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | detailsVo.setBelongsScope(coupon.getUserPopulation()); |
| | | // int couponNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() |
| | | // .eq("pointsMerchandiseId",merchandise.getId() )); |
| | | detailsVo.setRedeemedNum(coupon.getPickUpQuantity()); |
| | | detailsVo.setResidueNum(Math.max(coupon.getQuantityIssued() - coupon.getPickUpQuantity(), 0)); |
| | | |
| | | |
| | | |
| | | int couponCounts = userCouponService.count(new QueryWrapper<UserCoupon>().eq("couponId", coupon.getId())); |
| | | // detailsVo.setRedeemedNum(coupon.getPickUpQuantity()); |
| | | detailsVo.setRedeemedNum(couponCounts); |
| | | |
| | | detailsVo.setResidueNum(Math.max(coupon.getQuantityIssued() - couponCounts, 0)); |
| | | |
| | | detailsVo.setPerLimit(coupon.getPickUpQuantity()); |
| | | detailsVo.setExchangeType(coupon.getRedemptionMethod()); |
| | | if (coupon.getRedemptionMethod() == 1){ |
| | |
| | | if (pointsMerchandises.size() > 0 ){ |
| | | for (UserPointsMerchandise pointsMerchandise : pointsMerchandises) { |
| | | PointsMerchandise merchandise = pmdsService.getById(pointsMerchandise.getPointsMerchandiseId()); |
| | | if (merchandise==null){ |
| | | continue; |
| | | } |
| | | ExchangeDetailsResponse detailsResponse = new ExchangeDetailsResponse(); |
| | | detailsResponse.setDetailsId(pointsMerchandise.getId()); |
| | | detailsResponse.setGoodName(merchandise.getName()); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | if (merchandise.getCardType()==1){ |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pointsMerchandise.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 1); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsResponse.setStartTime(startDate); |
| | | detailsResponse.setEndTime(startDate); |
| | | |
| | | Date now = new Date(); |
| | | Calendar cal1 = Calendar.getInstance(); |
| | | cal1.setTime(pointsMerchandise.getInsertTime()); |
| | | |
| | | Calendar cal2 = Calendar.getInstance(); |
| | | cal2.setTime(now); |
| | | |
| | | // Compare the year, month, and day of the two Calendar instances |
| | | boolean isSameDate = cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && |
| | | cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && |
| | | cal1.get(Calendar.DAY_OF_MONTH) == cal2.get(Calendar.DAY_OF_MONTH); |
| | | |
| | | // Print the result |
| | | if (isSameDate) { |
| | | detailsResponse.setUseStatus(3); |
| | | } else { |
| | | System.out.println("The two dates do not have the same date."); |
| | | } |
| | | |
| | | |
| | | } else if (merchandise.getCardType()==2) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pointsMerchandise.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 31); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsResponse.setStartTime(startDate); |
| | | detailsResponse.setEndTime(endDate); |
| | | |
| | | Date now = new Date(); |
| | | if (now.after(end)){ |
| | | detailsResponse.setUseStatus(3); |
| | | } |
| | | |
| | | } else if (merchandise.getCardType()==3) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pointsMerchandise.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 93); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsResponse.setStartTime(startDate); |
| | | detailsResponse.setEndTime(endDate); |
| | | |
| | | Date now = new Date(); |
| | | if (now.after(end)){ |
| | | detailsResponse.setUseStatus(3); |
| | | } |
| | | |
| | | } else if (merchandise.getCardType()==4) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pointsMerchandise.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 372); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsResponse.setStartTime(startDate); |
| | | detailsResponse.setEndTime(endDate); |
| | | |
| | | Date now = new Date(); |
| | | if (now.after(end)){ |
| | | detailsResponse.setUseStatus(3); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | responses.add(detailsResponse); |
| | | } |
| | |
| | | return 0; // 保持原顺序 |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | if (pmdsServiceById.getCardType()==1){ |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pmdsServiceById.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 1); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pmdsServiceById.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | pmdsServiceById.setStartTime(pmdsServiceById.getInsertTime()); |
| | | pmdsServiceById.setEndTime(pmdsServiceById.getInsertTime()); |
| | | |
| | | Date now = new Date(); |
| | | Calendar cal1 = Calendar.getInstance(); |
| | | cal1.setTime(pmdsServiceById.getInsertTime()); |
| | | |
| | | Calendar cal2 = Calendar.getInstance(); |
| | | cal2.setTime(now); |
| | | |
| | | // Compare the year, month, and day of the two Calendar instances |
| | | boolean isSameDate = cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && |
| | | cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && |
| | | cal1.get(Calendar.DAY_OF_MONTH) == cal2.get(Calendar.DAY_OF_MONTH); |
| | | |
| | | // Print the result |
| | | if (isSameDate) { |
| | | detailsVo.setUseType(3); |
| | | } else { |
| | | System.out.println("The two dates do not have the same date."); |
| | | } |
| | | |
| | | |
| | | } else if (pmdsServiceById.getCardType()==2) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pmdsServiceById.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 31); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pmdsServiceById.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsVo.setStartTime(startDate); |
| | | detailsVo.setEndTime(endDate); |
| | | |
| | | Date now = new Date(); |
| | | if (now.after(end)){ |
| | | detailsVo.setUseType(3); |
| | | } |
| | | |
| | | } else if (pmdsServiceById.getCardType()==3) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pmdsServiceById.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 93); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pmdsServiceById.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsVo.setStartTime(startDate); |
| | | detailsVo.setEndTime(endDate); |
| | | |
| | | Date now = new Date(); |
| | | if (now.after(end)){ |
| | | detailsVo.setUseType(3); |
| | | } |
| | | |
| | | } else if (pmdsServiceById.getCardType()==4) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pmdsServiceById.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 372); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pmdsServiceById.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsVo.setStartTime(startDate); |
| | | detailsVo.setEndTime(endDate); |
| | | |
| | | Date now = new Date(); |
| | | if (now.after(end)){ |
| | | detailsVo.setUseType(3); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | break; |
| | | case 2: |
| | | CoursePackage coursePackage = cpClient.queryCoursePackageById(pmdsServiceById.getCoursePackageId()); |