Browse Source

商家端可用日期逻辑修改

zhangchen 4 tháng trước cách đây
mục cha
commit
d5e6379ffb

+ 6 - 6
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponServiceImpl.java

@@ -94,9 +94,9 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
             String specifiedDay = lifeDiscountCoupon.getSpecifiedDay();
             if(!StringUtils.isEmpty(specifiedDay)){
                 int sDay = Integer.parseInt(specifiedDay);
-                if(sDay > 0 && lifeDiscountCouponDto.getBeginGetDate() != null){
-                    Date beginGetDate = Date.from(lifeDiscountCouponDto.getBeginGetDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
-                    Date validDate = addDaysToDateJava8(beginGetDate, sDay);
+                if(sDay > 0 && lifeDiscountCouponDto.getEndGetDate() != null){
+                    Date endGetDate = Date.from(lifeDiscountCouponDto.getEndGetDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
+                    Date validDate = addDaysToDateJava8(endGetDate, sDay);
                     LocalDate validDateLocalDate = validDate.toInstant()
                             .atZone(ZoneId.systemDefault())
                             .toLocalDate();
@@ -189,9 +189,9 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
             String specifiedDay = lifeDiscountCouponDto.getSpecifiedDay();
             if(!StringUtils.isEmpty(specifiedDay)){
                 int sDay = Integer.parseInt(specifiedDay);
-                if(sDay > 0 && lifeDiscountCouponDto.getBeginGetDate() != null) {
-                    Date beginGetDate = Date.from(lifeDiscountCouponDto.getBeginGetDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
-                    Date validDate = addDaysToDateJava8(beginGetDate, sDay);
+                if(sDay > 0 && lifeDiscountCouponDto.getEndGetDate() != null) {
+                    Date endGetDate = Date.from(lifeDiscountCouponDto.getEndGetDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
+                    Date validDate = addDaysToDateJava8(endGetDate, sDay);
                     LocalDate validDateLocalDate = validDate.toInstant()
                             .atZone(ZoneId.systemDefault())
                             .toLocalDate();