'提交代码'

dev-discount
胡锐 4 years ago
parent 7353792e8f
commit fcf971386e
  1. 3
      hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java
  2. 24
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java

@ -39,7 +39,7 @@ public class SynchronizeCNPC {
@Resource @Resource
private SecSinopecConfigService secSinopecConfigService; private SecSinopecConfigService secSinopecConfigService;
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 @Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次
public void certification() { public void certification() {
List<SecSinopecConfig> sinopecConfig = secSinopecConfigService.getListSinopecConfig(new HashMap<>()); List<SecSinopecConfig> sinopecConfig = secSinopecConfigService.getListSinopecConfig(new HashMap<>());
@ -55,6 +55,7 @@ public class SynchronizeCNPC {
String token = data.getString("token"); String token = data.getString("token");
Calendar instance = Calendar.getInstance(); Calendar instance = Calendar.getInstance();
instance.set(Calendar.DATE, 1);
instance.add(Calendar.MINUTE, -10); instance.add(Calendar.MINUTE, -10);
Map<String,Object> bodyMap = new HashMap<>(); Map<String,Object> bodyMap = new HashMap<>();

@ -135,19 +135,19 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
map.put("status", "1"); map.put("status", "1");
map.put("couponCodeId", code.getId()); map.put("couponCodeId", code.getId());
List<HighUserCoupon> list = highUserCouponService.getUserCouponList(map); List<HighUserCoupon> list = highUserCouponService.getUserCouponList(map);
for (HighUserCoupon userCoupon : list) { if (list.size() > 0) {
userCoupon.setStatus(2); for (HighUserCoupon userCoupon : list) {
userCoupon.setConsumeTime(useTime); userCoupon.setStatus(2);
userCoupon.setConsumeTime(useTime);
HighChildOrder order = highOrderService.getChildOrderByUserGoods(userCoupon.getUserId(), 1, userCoupon.getCouponId()); HighChildOrder order = highOrderService.getChildOrderByUserGoods(userCoupon.getUserId(), 1, userCoupon.getCouponId());
if (order == null) { if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单");
}
userCoupon.setConsumeTime(new Date());
userCoupon.setStatus(2); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponService.updateUserCoupon(userCoupon);
highOrderService.childOrderComplete(order.getId());
} }
userCoupon.setConsumeTime(new Date());
userCoupon.setStatus(2); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponService.updateUserCoupon(userCoupon);
highOrderService.childOrderComplete(order.getId());
} }
} }
} }

Loading…
Cancel
Save