From 8033ea73b898357ad8853524ba558b18c42c2bbe Mon Sep 17 00:00:00 2001 From: nickchange <126672920+nickchange@users.noreply.github.com> Date: 星期三, 01 十一月 2023 20:27:51 +0800 Subject: [PATCH] 10.31.6 --- cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 93 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 91 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..e374344 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 @@ -763,7 +763,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 +821,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 +881,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