diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java index 44f7f59d..9adb4abb 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java @@ -34,6 +34,9 @@ import com.skyeye.eve.rest.quartz.SysQuartzMation; import com.skyeye.eve.service.IQuartzService; import com.skyeye.exception.CustomException; import com.skyeye.rest.shopmaterialnorms.sevice.IShopMaterialNormsService; +import com.skyeye.xxljob.ShopXxlJob; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -69,6 +72,8 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl @Autowired private ShopTradeCartService shopTradeCartService; + private static Logger log = LoggerFactory.getLogger(ShopXxlJob.class); + @Override public void createPrepose(Order order) { // 订单编号 @@ -256,7 +261,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl public void createPostpose(Order order, String userId) { orderItemService.setValueAndCreateEntity(order, userId); couponUseService.updateState(order.getCouponUseId());// 更新用户领取的优惠券状态 + log.info("订单id:"+order.getId()+"创建定时任务-- 开始"); startUpTaskQuartz(order.getId(), order.getOddNumber(), DateUtil.getTimeAndToString()); + log.info("订单id:"+order.getId()+"创建定时任务-- 结束"); shopTradeCartService.deleteMySelect(userId); } @@ -473,6 +480,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelType), params.get("cancelType")); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString()); update(updateWrapper); + log.info("订单id" + one.getId() + "取消订单--取消定时任务-- 开始"); + iQuartzService.stopAndDeleteTaskQuartz(one.getId());// 删除任务 + log.info("订单id" + one.getId() + "取消订单--取消定时任务-- 结束"); refreshCache(params.get("id").toString()); } else { throw new CustomException("订单不可取消"); @@ -530,7 +540,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionNo), payOrderRespDTO.get("no").toString()); update(updateWrapper); refreshCache(id); + log.info("订单id" + one.getId() + "支付成功--删除定时任务-- 开始"); iQuartzService.stopAndDeleteTaskQuartz(id);// 删除定时任务 + log.info("订单id" + one.getId() + "支付成功--删除定时任务-- 结束"); } @Override diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java index 44448b04..39aac077 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java @@ -11,6 +11,8 @@ import com.skyeye.eve.service.IQuartzService; import com.skyeye.order.service.OrderService; import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.handler.annotation.XxlJob; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -39,16 +41,24 @@ public class ShopXxlJob { @Autowired private IQuartzService iQuartzService; + private static Logger log = LoggerFactory.getLogger(ShopXxlJob.class); + @XxlJob("setShopCouponStateService") public void setShopCouponStateService() { String param = XxlJobHelper.getJobParam(); Map paramMap = JSONUtil.toBean(param, null); String couponId = paramMap.get("objectId");// 优惠券id try { + log.info("优惠券id(couponId)" + couponId + "---修改优惠券的状态---开始"); couponService.setStateByCoupon(couponId);// 修改优惠券的状态 + log.info("优惠券id(couponId)" + couponId + "---修改优惠券的状态---结束"); + log.info("优惠券id(couponId)" + couponId + "---修改领取的优惠券的状态---开始"); couponUseService.setCouponUseStateByDate(couponId);// 修改领取的优惠券的状态 + log.info("优惠券id(couponId)" + couponId + "---修改领取的优惠券的状态---结束"); } finally { + log.info("优惠券id(couponId)" + couponId + "---删除任务---开始"); iQuartzService.stopAndDeleteTaskQuartz(couponId);// 删除任务 + log.info("优惠券id(couponId)" + couponId + "---删除任务---结束"); } } @@ -59,9 +69,13 @@ public class ShopXxlJob { String userId = paramMap.get("userId"); String couponUseId = paramMap.get("objectId");// 领取的优惠券id try { + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---修改领取的优惠券的状态---开始"); couponUseService.setCouponUseStateByTerm(userId, couponUseId);// 修改领取的优惠券的状态} + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---修改领取的优惠券的状态---结束"); } finally { + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---删除任务---开始"); iQuartzService.stopAndDeleteTaskQuartz(couponUseId);// 删除任务 + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---删除任务---结束"); } } @@ -71,9 +85,13 @@ public class ShopXxlJob { Map paramMap = JSONUtil.toBean(param, null); String orderId = paramMap.get("objectId");// 订单的主键id try { + log.info("订单的主键id(orderId)" + orderId + "---修改订单的状态为取消---开始"); orderService.setOrderCancle(orderId);// 修改订单的状态为取消 + log.info("订单的主键id(orderId)" + orderId + "---修改订单的状态为取消---结束"); } finally { + log.info("订单的主键id(orderId)" + orderId + "---删除任务---开始"); iQuartzService.stopAndDeleteTaskQuartz(orderId);// 删除任务 + log.info("订单的主键id(orderId)" + orderId + "---删除任务---结束"); } } }