package com.hai.schedule; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.service.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.Scheduled; import javax.annotation.Resource; import javax.xml.ws.RespectBinding; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; /** * @Auther: 胡锐 * @Description: 订单定时任务 * @Date: 2021/3/27 15:41 */ @Configuration public class HighOrderSchedule { private static final Logger log = LoggerFactory.getLogger(HighOrderSchedule.class); @Resource private HighOrderService highOrderService; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighGoldRecService highGoldRecService; @Resource private BsOrderRebateService bsOrderRebateService; /** * @Author 胡锐 * @Description 完成团油订单 超过支付时间24小时订单自动完成 * @Date 2021/4/4 22:45 **/ // @Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次 // public void finishGasOrder() { // List> mapList = highOrderService.getFinishGasOrder(); // if (mapList != null && mapList.size() > 0) { // for (Map map : mapList) { // HighOrder order = highOrderService.getOrderById(Long.parseLong(map.get("orderId").toString())); // if (order != null) { // order.setOrderStatus(3); // order.setFinishTime(new Date()); // highOrderService.updateOrderDetail(order); // } // } // } // } /** * @Author Sum1Dream * @name integralRebateOrder.java * @Description // 执行返利操作 * @Date 15:13 2022/8/22 * @Param [] * @return void */ @Scheduled(cron="0 0/10 * * * ?") //每 5分钟执行一次 public void integralRebateOrder() { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } } } }