修改配置星巴克 肯德基 会员充值 话费 微信商户号

dev-discount
袁野 2 years ago
parent 55247ab60d
commit 24f6a46c8b
  1. 196
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  2. 127
      hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java

@ -39,9 +39,6 @@ public class HighOrderSchedule {
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private OutRechargeChildOrderService rechargeChildOrderService;
@Resource
private HighGoldRecService highGoldRecService;
@ -67,81 +64,6 @@ public class HighOrderSchedule {
}
}
/**
* @return void
* @Author Sum1Dream
* @name cancelMobileOrder.java
* @Description // 取消话费订单
* @Date 3:33 下午 2021/12/10
* @Param []
*/
@Scheduled(cron = "0 0/1 * * * ?") //每15分钟执行一次
public void cancelMobileOrder() {
List<OutRechargeOrder> orderList = outRechargeOrderService.getOutRechargeOrderList();
if (orderList != null && orderList.size() > 0) {
for (OutRechargeOrder order : orderList) {
try {
outRechargeOrderService.cancelOrder(order.getId());
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}
}
}
}
/**
* @return void
* @Author Sum1Dream
* @name cancelOrder.java
* @Description // 定时发起
* @Date 14:18 2022/5/31
* @Param []
*/
@Scheduled(cron = "0 0/1 * * * ?") //每5分钟执行一次
public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>();
map.put("payStatus", String.valueOf(102));
map.put("rechargeStatus", String.valueOf(205));
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
if (orderList.size() > 0) {
for (OutRechargeOrder order : orderList) {
try {
// 查询充值子订单
Map<String, Object> childOrderMap = new HashMap<>();
childOrderMap.put("parent_order_id", order.getId());
childOrderMap.put("status", 102);
List<OutRechargeChildOrder> childOrderList = rechargeChildOrderService.getListRechargeChildOrder(childOrderMap);
System.out.println("话费定时任务 -> 判断是否存在已支付订单:订单id:" + order.getId());
if (childOrderList.size() == 0) {
Date rechargeTime = order.getCreateTimed();
Date currentTime = new Date();
int hours = (int) ((currentTime.getTime() - rechargeTime.getTime()) / (1000 * 60 * 60));
// 判断快充 并且 充值时间小于6
// if (order.getRechargeType() == 1 && hours < 6) {
// System.out.println("话费定时任务 -> 请求快充:订单id:" + order.getId());
// outRechargeOrderService.pollRequest(order);
// continue;
// }
// 判断慢充 并且 充值时间小于72
if (hours < 72) {
System.out.println("话费定时任务 -> 请求慢充:订单id:" + order.getId());
outRechargeOrderService.pollRequest(order);
continue;
}
System.out.println("话费定时任务 -> 退款任务" + order.getId());
outRechargeOrderService.rechargeOrderToRefund(order.getId());
}
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}
}
}
System.out.println("话费定时任务 -> 结束任务");
}
/**
* @Author 胡锐
@ -298,120 +220,6 @@ public class HighOrderSchedule {
}
}
// /**
// * @Author 胡锐
// * @Description 处理话KFC订单
// * @Date 2021/4/4 22:45
// **/
// @Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
// public void handleKfcOrder() {
// List<HighOrder> orderList = highOrderService.getAlreadyPaidKfcOrder();
// if (orderList != null && orderList.size() > 0) {
// for (HighOrder order : orderList) {
// try {
// HighOrder highOrder = highOrderService.getOrderById(order.getId());
// if (highOrder != null) {
// JSONObject mobileOrderJson = QianZhuConfig.getKfcOrderByOrderNo(highOrder.getOrderNo());
// if (mobileOrderJson != null && mobileOrderJson.getBoolean("success")) {
// JSONObject data = mobileOrderJson.getJSONObject("data");
//
// // 订单状态 0:待付款 5:排队中 15:TRAN_SUCCESS:交易成功 -5:已取消
// if (data.getInteger("status") == 15) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(3);
// }
// highOrder.setOrderStatus(3);
// highOrder.setFinishTime(new Date());
// highOrderService.updateOrder(highOrder);
// }
//
// if (data.getInteger("status") == -5) {
// if (highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
// OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
// if (orderRefundModel.getResult_code().equals("SUCCESS")) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(4);
// }
// highOrder.setOrderStatus(4);
// highOrder.setRefundTime(new Date());
// highOrder.setRefundPrice(highOrder.getPayRealPrice());
// highOrderService.updateOrder(highOrder);
// }
// } else {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(5);
// }
// highOrder.setCancelTime(new Date());
// highOrder.setOrderStatus(5);
// highOrderService.updateOrder(highOrder);
// }
// }
// }
// }
// } catch (Exception e) {
// log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
// }
// }
// }
// }
// /**
// * @Author 胡锐
// * @Description 处理电影票订单
// * @Date 2021/4/4 22:45
// **/
// @Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
// public void handleCinemaOrder() {
// List<HighOrder> orderList = highOrderService.getAlreadyPaidCinemaOrder();
// if (orderList != null && orderList.size() > 0) {
// for (HighOrder order : orderList) {
// try {
// HighOrder highOrder = highOrderService.getOrderById(order.getId());
// if (highOrder != null) {
// JSONObject mobileOrderJson = QianZhuConfig.getCinemaOrderByOrderNo(highOrder.getOrderNo());
// if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) {
// JSONObject data = mobileOrderJson.getJSONObject("data");
//
// // 订单状态 0:待付款 5:待出票 10:已出票 15:交易成功 -5:已取消
// if (data.getInteger("status") == 10 || data.getInteger("status") == 15) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(3);
// }
// highOrder.setOrderStatus(3);
// highOrder.setFinishTime(new Date());
// highOrderService.updateOrder(highOrder);
// }
//
// if (data.getInteger("status") == -5) {
// if (highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
// OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
// if (orderRefundModel.getResult_code().equals("SUCCESS")) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(4);
// }
// highOrder.setOrderStatus(4);
// highOrder.setRefundTime(new Date());
// highOrder.setRefundPrice(highOrder.getPayRealPrice());
// highOrderService.updateOrder(highOrder);
// }
// } else {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(5);
// }
// highOrder.setCancelTime(new Date());
// highOrder.setOrderStatus(5);
// highOrderService.updateOrder(highOrder);
// }
// }
// }
// }
// } catch (Exception e) {
// log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
// }
// }
// }
// }
/**
* @Author 胡锐
* @Description 完成团油订单 超过支付时间24小时订单自动完成
@ -439,7 +247,7 @@ public class HighOrderSchedule {
* @Param []
* @return void
*/
@Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次
@Scheduled(cron="0 0/5 * * * ?") //每 5分钟执行一次
public void integralRebateOrder() {
List<HighOrder> order = highOrderService.integralRebateOrder();
for (HighOrder highOrder : order) {
@ -477,7 +285,7 @@ public class HighOrderSchedule {
* @Param []
* @return void
*/
@Scheduled(cron="0 0/5 * * * ?") //每1分钟执行一次
@Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次
public void integralRebateRechargeOrder() {
List<OutRechargeOrder> order = outRechargeOrderService.integralRebateRechargeOrder();
for (OutRechargeOrder outRechargeOrder : order) {

@ -0,0 +1,127 @@
package com.hai.schedule;
import com.hai.entity.OutRechargeChildOrder;
import com.hai.entity.OutRechargeOrder;
import com.hai.service.OutRechargeChildOrderService;
import com.hai.service.OutRechargeOrderService;
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 java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @serviceName HighRechargeOrderSchedule.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 充值订单定时任务
* @createTime 09:57 2023/1/13
**/
@Configuration
public class HighRechargeOrderSchedule {
Logger log = LoggerFactory.getLogger(HighRechargeOrderSchedule.class);
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private OutRechargeChildOrderService rechargeChildOrderService;
/**
* @return void
* @Author Sum1Dream
* @name cancelMobileOrder.java
* @Description // 取消话费订单
* @Date 3:33 下午 2021/12/10
* @Param []
*/
@Scheduled(cron = "0 0/1 * * * ?") //每15分钟执行一次
public void cancelMobileOrder() {
List<OutRechargeOrder> orderList = outRechargeOrderService.getOutRechargeOrderList();
if (orderList != null && orderList.size() > 0) {
for (OutRechargeOrder order : orderList) {
try {
outRechargeOrderService.cancelOrder(order.getId());
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}
}
}
}
/**
* @return void
* @Author Sum1Dream
* @name cancelOrder.java
* @Description // 定时发起
* @Date 14:18 2022/5/31
* @Param []
*/
@Scheduled(cron = "0 0/1 * * * ?") //每5分钟执行一次
public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>();
map.put("payStatus", String.valueOf(102));
map.put("rechargeStatus", String.valueOf(205));
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
if (orderList.size() > 0) {
for (OutRechargeOrder order : orderList) {
try {
// 查询充值子订单
Map<String, Object> childOrderMap = new HashMap<>();
childOrderMap.put("parent_order_id", order.getId());
childOrderMap.put("status", 102);
List<OutRechargeChildOrder> childOrderList = rechargeChildOrderService.getListRechargeChildOrder(childOrderMap);
System.out.println("话费定时任务 -> 判断是否存在已支付订单:订单id:" + order.getId());
if (childOrderList.size() == 0) {
Date rechargeTime = order.getCreateTimed();
Date currentTime = new Date();
int hours = (int) ((currentTime.getTime() - rechargeTime.getTime()) / (1000 * 60 * 60));
// 充值时间小于72
if (hours < 72) {
System.out.println("话费定时任务 -> 请求慢充:订单id:" + order.getId());
outRechargeOrderService.pollRequest(order);
continue;
}
System.out.println("话费定时任务 -> 退款任务" + order.getId());
outRechargeOrderService.rechargeOrderToRefund(order.getId());
}
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}
}
}
System.out.println("话费定时任务 -> 结束任务");
}
@Scheduled(cron = "0 0/1 * * * ?") //每分钟执行一次
public void failRechargeOrder() {
Map<String , Object> map = new HashMap<>();
map.put("payStatus" , 102);
map.put("rechargeStatus" , 203);
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
if (orderList != null && orderList.size() > 0) {
for (OutRechargeOrder order : orderList) {
try {
outRechargeOrderService.rechargeOrderToRefund(order.getId());
} catch (Exception e) {
log.error("HighCouponSchedule --> expiredCoupon() error!", e);
}
}
}
}
}
Loading…
Cancel
Save