领券bug
This commit is contained in:
parent
bd95204bb0
commit
5cad54a5d0
@ -58,7 +58,7 @@ public interface CardFavorableService extends IService<CardFavorable> {
|
||||
/**
|
||||
* 查询优惠券接口(小程序)
|
||||
* @param page
|
||||
* @param cardFavorable
|
||||
* @param cardFavorableDTOS
|
||||
* @return
|
||||
*/
|
||||
IPage selectAllByCondition(Page page, CardFavorableDTOS cardFavorableDTOS);
|
||||
|
@ -35,6 +35,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -155,17 +158,27 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
|
||||
if (ObjectUtils.isNotEmpty(cardFavorable) && ObjectUtils.isNotEmpty(cardFavorable.getTimeType())){
|
||||
if (cardFavorable.getTimeType().equals("0")){
|
||||
cardFavorableRecord.setStartTime(new Date());
|
||||
long endTimeL = new Date().getTime() + cardFavorable.getValidityZero() * 86400000;
|
||||
cardFavorableRecord.setEndTime(new Date(endTimeL));
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate localDate = today.plusDays(cardFavorable.getValidityZero());
|
||||
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
cardFavorableRecord.setEndTime(from);
|
||||
}else if (cardFavorable.getTimeType().equals("1")){
|
||||
cardFavorableRecord.setStartTime(cardFavorable.getEffectiveDate());
|
||||
long endTimeM = cardFavorable.getEffectiveDate().getTime() + cardFavorable.getValidityOne() * 86400000;
|
||||
cardFavorableRecord.setEndTime(new Date(endTimeM));
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate localDate = today.plusDays(cardFavorable.getValidityOne());
|
||||
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
cardFavorableRecord.setEndTime(from);
|
||||
}else {
|
||||
long startTimeN = new Date().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L;
|
||||
long endTimeN = startTimeN + cardFavorable.getValidityTwo() * 86400000L;
|
||||
cardFavorableRecord.setStartTime(new Date(startTimeN));
|
||||
cardFavorableRecord.setEndTime(new Date(endTimeN));
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate localDate = today.plusDays(cardFavorable.getValidityTwo());
|
||||
LocalDate localDates = today.plusDays(Integer.parseInt(cardFavorable.getValidityDay()));
|
||||
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date froms = Date.from(localDates.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
cardFavorableRecord.setStartTime(froms);
|
||||
cardFavorableRecord.setEndTime(from);
|
||||
}
|
||||
cardFavorableRecord.setCardFavorableId(id);
|
||||
cardFavorableRecord.setStoreId(cardFavorable.getStoreId());
|
||||
|
@ -222,7 +222,15 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
|
||||
List<CouponVO> records = couponVOS.getRecords();
|
||||
//有效期
|
||||
List<CouponVO> collect = records.stream().filter(s -> s.getEndTime().getTime() > System.currentTimeMillis()).collect(Collectors.toList());
|
||||
couponVOS.setRecords(collect);
|
||||
if (ObjectUtils.isNotEmpty(collect)){
|
||||
for (CouponVO couponVO : collect) {
|
||||
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
|
||||
cardFavorableRecord.setId(couponVO.getCardRecordId());
|
||||
cardFavorableRecord.setStatus("2");
|
||||
cardFavorableRecordMapper.updateById(cardFavorableRecord);
|
||||
}
|
||||
}
|
||||
//couponVOS.setRecords(collect);
|
||||
return couponVOS;
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -839,18 +841,24 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
//优惠券开始结束时间
|
||||
if (ObjectUtils.isNotEmpty(cardValueVoucher) && ObjectUtils.isNotEmpty(cardValueVoucher.getTimeType())) {
|
||||
if (cardValueVoucher.getTimeType().equals("0")) {
|
||||
cardFavorableRecord.setStartTime(new Date());
|
||||
long endTimeL = new Date().getTime() + cardValueVoucher.getValidityZero() * 86400000;
|
||||
cardFavorableRecord.setEndTime(new Date(endTimeL));
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate localDate = today.plusDays(cardValueVoucher.getValidityZero());
|
||||
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
cardFavorableRecord.setEndTime(from);
|
||||
} else if (cardValueVoucher.getTimeType().equals("1")) {
|
||||
cardFavorableRecord.setStartTime(cardValueVoucher.getEffectiveDate());
|
||||
long endTimeM = cardValueVoucher.getEffectiveDate().getTime() + cardValueVoucher.getValidityOne() * 86400000;
|
||||
cardFavorableRecord.setEndTime(new Date(endTimeM));
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate localDate = today.plusDays(cardValueVoucher.getValidityOne());
|
||||
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
cardFavorableRecord.setEndTime(from);
|
||||
} else {
|
||||
long startTimeN = new Date().getTime() + Integer.parseInt(cardValueVoucher.getValidityDay()) * 86400000L;
|
||||
long endTimeN = startTimeN + cardValueVoucher.getValidityTwo() * 86400000L;
|
||||
cardFavorableRecord.setStartTime(new Date(startTimeN));
|
||||
cardFavorableRecord.setEndTime(new Date(endTimeN));
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate localDate = today.plusDays(cardValueVoucher.getValidityTwo());
|
||||
LocalDate localDates = today.plusDays(Integer.parseInt(cardValueVoucher.getValidityDay()));
|
||||
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date froms = Date.from(localDates.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
cardFavorableRecord.setStartTime(froms);
|
||||
cardFavorableRecord.setEndTime(from);
|
||||
}
|
||||
}
|
||||
cardFavorableRecordService.save(cardFavorableRecord);
|
||||
|
Loading…
Reference in New Issue
Block a user