|
|
|
@@ -1,6 +1,7 @@ |
|
|
|
package com.iformall.schedule; |
|
|
|
|
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxMall; |
|
|
|
import com.iformall.domain.po.WxProfitSharingOrder; |
|
|
|
import com.iformall.enums.EnumProfitSharingOrderStatus; |
|
|
|
import com.iformall.mapper.*; |
|
|
|
@@ -24,40 +25,51 @@ public class SharingOrderResultSchedule { |
|
|
|
@Autowired |
|
|
|
private WxProfitSharingOrderMapper wxProfitSharingOrderMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxMallMapper wxMallMapper; |
|
|
|
|
|
|
|
private List<WxMall> getMalls() { |
|
|
|
WxMall wxMall =new WxMall(); |
|
|
|
return wxMallMapper.findList(wxMall); |
|
|
|
} |
|
|
|
|
|
|
|
@Scheduled(cron = "0 15 0 * * ?") // 每天凌晨00:15更新分账结果 |
|
|
|
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 |
|
|
|
public void sharingOrderResultSchedule() { |
|
|
|
|
|
|
|
WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); |
|
|
|
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getCode()); |
|
|
|
List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); |
|
|
|
for(WxProfitSharingOrder sharingOrder : list) { |
|
|
|
try { |
|
|
|
ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); |
|
|
|
logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() |
|
|
|
+ " ID:" +sharingOrder.getId() |
|
|
|
+ " MSG:" + result.message); |
|
|
|
} catch (Exception e){ |
|
|
|
logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() |
|
|
|
+ " ID:" +sharingOrder.getId() |
|
|
|
+ " MSG:" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getCode()); |
|
|
|
list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); |
|
|
|
for(WxProfitSharingOrder sharingOrder : list) { |
|
|
|
try { |
|
|
|
ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); |
|
|
|
logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() |
|
|
|
+ " ID:" + sharingOrder.getId() |
|
|
|
+ " MSG:" + result.message); |
|
|
|
} catch (Exception e){ |
|
|
|
logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() |
|
|
|
+ " ID:" +sharingOrder.getId() |
|
|
|
+ " MSG:" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<WxMall> malls = getMalls(); |
|
|
|
for (WxMall mall: malls) { |
|
|
|
WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); |
|
|
|
wxProfitSharingOrder.setTenantId(mall.getTenantId()); |
|
|
|
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getCode()); |
|
|
|
List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); |
|
|
|
for(WxProfitSharingOrder sharingOrder : list) { |
|
|
|
try { |
|
|
|
ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); |
|
|
|
logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() |
|
|
|
+ " ID:" +sharingOrder.getId() |
|
|
|
+ " MSG:" + result.message); |
|
|
|
} catch (Exception e){ |
|
|
|
logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() |
|
|
|
+ " ID:" +sharingOrder.getId() |
|
|
|
+ " MSG:" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getCode()); |
|
|
|
list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); |
|
|
|
for(WxProfitSharingOrder sharingOrder : list) { |
|
|
|
try { |
|
|
|
ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); |
|
|
|
logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() |
|
|
|
+ " ID:" + sharingOrder.getId() |
|
|
|
+ " MSG:" + result.message); |
|
|
|
} catch (Exception e){ |
|
|
|
logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() |
|
|
|
+ " ID:" +sharingOrder.getId() |
|
|
|
+ " MSG:" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|