Przeglądaj źródła

//..

private_deployment
xhxu 1 rok temu
rodzic
commit
0bbdb48b21
1 zmienionych plików z 78 dodań i 78 usunięć
  1. +78
    -78
      suimangSchedule/src/main/java/com/iformall/schedule/ProductOrderSharingSchedule.java

+ 78
- 78
suimangSchedule/src/main/java/com/iformall/schedule/ProductOrderSharingSchedule.java Wyświetl plik

@@ -1,78 +1,78 @@
package com.iformall.schedule;
import com.iformall.domain.po.ProductOrder;
import com.iformall.domain.po.ProductOrderSharing;
import com.iformall.enums.*;
import com.iformall.service.ProductOrderService;
import com.iformall.service.ProductOrderSharingService;
import com.iformall.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
public class ProductOrderSharingSchedule {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ProductOrderService productOrderService;
@Autowired
private ProductOrderSharingService productOrderSharingService;
@Scheduled(cron = "0 15 1 * * ?") // 每天凌晨02:00分账重试
public void productOrderSharingSchedule() {
ProductOrder productOrderQ = new ProductOrder();
productOrderQ.setOrderStatus(EnumProductOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode());
productOrderQ.setProfitSharing(EnumProfitSharing.PROFIT_SHARING_MAST.getCode());
productOrderQ.setPayEndDate(DateUtils.getDateBefore(7,new Date()));
List<ProductOrder> orderList = productOrderService.findList(productOrderQ);
for (ProductOrder order: orderList) {
try{
productOrderService.handldSharing(order);
productOrderSharingService.sharingOrder(order.getId());
}catch(Exception e){
logger.error("分账失败:" + e.getMessage());
}
}
}
@Scheduled(cron = "0 15 2 * * ?") // 每天凌晨02:00分账重试
public void productOrderSharing2Schedule() {
ProductOrderSharing productOrderSharingQ = new ProductOrderSharing();
productOrderSharingQ.setSettleStatus(EnumProductOrderSettleStatus.unfreeze_before.getCode());
List<ProductOrderSharing> sharingList = productOrderSharingService.findList(productOrderSharingQ);
for (ProductOrderSharing sharing: sharingList) {
try{
productOrderSharingService.sharingOrder(sharing.getId());
}catch(Exception e){
logger.error("分账失败:" + e.getMessage());
}
}
}
@Scheduled(cron = "0 15 3 * * ?") // 查询分账结果
public void productOrderSharingQuerySchedule() {
ProductOrderSharing productOrderSharingQ = new ProductOrderSharing();
productOrderSharingQ.setSettleStatus(EnumProductOrderSettleStatus.unfreeze_ing.getCode());
List<ProductOrderSharing> sharingList = productOrderSharingService.findList(productOrderSharingQ);
for (ProductOrderSharing sharing: sharingList) {
try{
productOrderSharingService.handleSharingOrder(sharing.getId());
}catch(Exception e){
logger.error("分账失败:" + e.getMessage());
}
}
}
}
//package com.iformall.schedule;
//
//import com.iformall.domain.po.ProductOrder;
//import com.iformall.domain.po.ProductOrderSharing;
//import com.iformall.enums.*;
//import com.iformall.service.ProductOrderService;
//import com.iformall.service.ProductOrderSharingService;
//import com.iformall.utils.DateUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import java.util.*;
//
//@Component
//public class ProductOrderSharingSchedule {
//
// private final Logger logger = LoggerFactory.getLogger(this.getClass());
//
// @Autowired
// private ProductOrderService productOrderService;
//
// @Autowired
// private ProductOrderSharingService productOrderSharingService;
//
// @Scheduled(cron = "0 15 1 * * ?") // 每天凌晨02:00分账重试
// public void productOrderSharingSchedule() {
// ProductOrder productOrderQ = new ProductOrder();
// productOrderQ.setOrderStatus(EnumProductOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode());
// productOrderQ.setProfitSharing(EnumProfitSharing.PROFIT_SHARING_MAST.getCode());
// productOrderQ.setPayEndDate(DateUtils.getDateBefore(7,new Date()));
// List<ProductOrder> orderList = productOrderService.findList(productOrderQ);
// for (ProductOrder order: orderList) {
// try{
// productOrderService.handldSharing(order);
//
// productOrderSharingService.sharingOrder(order.getId());
//
// }catch(Exception e){
// logger.error("分账失败:" + e.getMessage());
// }
//
// }
// }
//
// @Scheduled(cron = "0 15 2 * * ?") // 每天凌晨02:00分账重试
// public void productOrderSharing2Schedule() {
// ProductOrderSharing productOrderSharingQ = new ProductOrderSharing();
// productOrderSharingQ.setSettleStatus(EnumProductOrderSettleStatus.unfreeze_before.getCode());
// List<ProductOrderSharing> sharingList = productOrderSharingService.findList(productOrderSharingQ);
// for (ProductOrderSharing sharing: sharingList) {
// try{
// productOrderSharingService.sharingOrder(sharing.getId());
// }catch(Exception e){
// logger.error("分账失败:" + e.getMessage());
// }
//
// }
// }
//
// @Scheduled(cron = "0 15 3 * * ?") // 查询分账结果
// public void productOrderSharingQuerySchedule() {
// ProductOrderSharing productOrderSharingQ = new ProductOrderSharing();
// productOrderSharingQ.setSettleStatus(EnumProductOrderSettleStatus.unfreeze_ing.getCode());
// List<ProductOrderSharing> sharingList = productOrderSharingService.findList(productOrderSharingQ);
// for (ProductOrderSharing sharing: sharingList) {
// try{
// productOrderSharingService.handleSharingOrder(sharing.getId());
// }catch(Exception e){
// logger.error("分账失败:" + e.getMessage());
// }
//
// }
// }
//
//}

Ładowanie…
Anuluj
Zapisz