|
@@ -20,6 +20,7 @@ import com.dk.oauth.model.query.integral.CouponReceiveQuery;
|
|
|
import com.dk.oauth.model.query.integral.CouponUseQuery;
|
|
import com.dk.oauth.model.query.integral.CouponUseQuery;
|
|
|
import com.dk.oauth.model.response.integral.CouponReceiveResponse;
|
|
import com.dk.oauth.model.response.integral.CouponReceiveResponse;
|
|
|
import com.dk.oauth.model.response.integral.CouponUseResponse;
|
|
import com.dk.oauth.model.response.integral.CouponUseResponse;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -29,6 +30,7 @@ import java.time.ZoneOffset;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
@Service
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public class CouponUseService extends BaseService<CouponUse> {
|
|
public class CouponUseService extends BaseService<CouponUse> {
|
|
@@ -118,6 +120,7 @@ public class CouponUseService extends BaseService<CouponUse> {
|
|
|
//查询全部优惠券使用
|
|
//查询全部优惠券使用
|
|
|
List<CouponUseResponse> couponUseResponseList = couponUseMapper.selectByCond(new CouponUseQuery()
|
|
List<CouponUseResponse> couponUseResponseList = couponUseMapper.selectByCond(new CouponUseQuery()
|
|
|
.setCouponStatus(Constant.couponStatus.WEI_SHI_YONG.getName()));
|
|
.setCouponStatus(Constant.couponStatus.WEI_SHI_YONG.getName()));
|
|
|
|
|
+ log.info("retrievalCouponStatus查询全部优惠券使用:{}",couponUseResponseList);
|
|
|
//数据存在
|
|
//数据存在
|
|
|
if (couponUseResponseList != null && couponUseResponseList.size() > 0) {
|
|
if (couponUseResponseList != null && couponUseResponseList.size() > 0) {
|
|
|
for (CouponUseResponse couponUseResponse : couponUseResponseList) {
|
|
for (CouponUseResponse couponUseResponse : couponUseResponseList) {
|
|
@@ -125,6 +128,7 @@ public class CouponUseService extends BaseService<CouponUse> {
|
|
|
long beOverdueTime = couponUseResponse.getReceiveDate().plusDays(couponUseResponse.getUseValidDays()).toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
long beOverdueTime = couponUseResponse.getReceiveDate().plusDays(couponUseResponse.getUseValidDays()).toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
//当前时间
|
|
//当前时间
|
|
|
long nowTime = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
long nowTime = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
|
|
+ log.info("过期时间:{},当前时间:{}",beOverdueTime,nowTime);
|
|
|
//当前时间大于过期时间 优惠券已过期
|
|
//当前时间大于过期时间 优惠券已过期
|
|
|
if ((nowTime / 1000) > (beOverdueTime / 1000)) {
|
|
if ((nowTime / 1000) > (beOverdueTime / 1000)) {
|
|
|
//类型转换
|
|
//类型转换
|
|
@@ -140,9 +144,9 @@ public class CouponUseService extends BaseService<CouponUse> {
|
|
|
new UpdateWrapper<CouponUse>().lambda()
|
|
new UpdateWrapper<CouponUse>().lambda()
|
|
|
.eq(CouponUse::getUseId, UUID.fromString(couponUse.getUseId()))
|
|
.eq(CouponUse::getUseId, UUID.fromString(couponUse.getUseId()))
|
|
|
);
|
|
);
|
|
|
|
|
+ log.info("couponUse数据:{}",couponUse);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
return ResponseResultUtil.success();
|
|
return ResponseResultUtil.success();
|
|
|
}
|
|
}
|