From 6af0c7434178ca41e727c700af8174201a865de9 Mon Sep 17 00:00:00 2001 From: nickchange <126672920+nickchange@users.noreply.github.com> Date: 星期四, 02 十一月 2023 11:55:29 +0800 Subject: [PATCH] 10.31.8 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 96 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 94 insertions(+), 2 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 55f23ea..e5ca82e 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 @@ -701,6 +701,9 @@ 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()); @@ -763,7 +766,7 @@ 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(); @@ -821,7 +824,7 @@ 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); @@ -881,6 +884,95 @@ 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()); -- Gitblit v1.7.1