| | |
| | | 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()); |
| | |
| | | String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | | detailsResponse.setStartTime(startDate); |
| | | detailsResponse.setEndTime(endDate); |
| | | detailsResponse.setEndTime(startDate); |
| | | |
| | | Date now = new Date(); |
| | | Calendar cal1 = Calendar.getInstance(); |
| | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(pointsMerchandise.getInsertTime()); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 365); |
| | | calendar.add(Calendar.DAY_OF_MONTH, 372); |
| | | Date end = calendar.getTime(); |
| | | String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); |
| | | String endDate = dateFormat.format(end); |
| | |
| | | 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()); |