定时任务 订单分账逻辑

This commit is contained in:
2023-07-26 19:41:13 +08:00
parent 85908b4c70
commit c25e90e9ff
7 changed files with 69 additions and 22 deletions

View File

@@ -136,9 +136,18 @@ public interface IOrderBasicInfoService {
List<OrderVO> getListByMemberIdAndOrderStatus(String memberId, List<String> orderStatusList, LocalDateTime dateTime, String stationId);
void doPaymentConfirm(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException;
void orderSplittingOperations(String merchantId, String tradeDate);
void tempOrderRefund();
void doPaymentConfirm(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException;
/**
* 批量查询订单
* @param orderCodeList
* @return
*/
List<OrderBasicInfo> queryOrderList(List<String> orderCodeList);
void tempOrderRefund();
void realTimeMonitorDataRedis2DB(String transactionCode, String orderCode);

View File

@@ -28,9 +28,11 @@ public interface IPileMerchantInfoService {
* @param pileMerchantInfo 充电桩运营商信息
* @return 充电桩运营商信息集合
*/
public List<PileMerchantInfo> selectPileMerchantInfoList(PileMerchantInfo pileMerchantInfo);
List<PileMerchantInfo> selectPileMerchantInfoListWithAuth(PileMerchantInfo pileMerchantInfo);
/**
List<PileMerchantInfo> selectPileMerchantInfoList(PileMerchantInfo pileMerchantInfo);
/**
* 新增充电桩运营商信息
*
* @param pileMerchantInfo 充电桩运营商信息

View File

@@ -874,12 +874,14 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
* orderSplittingOperations
* 只有开通结算账户的运营商才走分账逻辑
*/
private void orderSplittingOperations(String merchantId, String tradeDate) {
@Override
public void orderSplittingOperations(String merchantId, String tradeDate) {
// 查询运营商有没有开通结算账户
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(merchantId);
if (adapayMemberAccount == null) {
logger.error("订单分账逻辑error, 运营商id:{}, 未配置结算账户", merchantId);
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_MEMBER_IS_NULL_ERROR);
// throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_MEMBER_IS_NULL_ERROR);
return;
}
// 根据交易日期查询运营商下面所有站点的交易日报
@@ -913,6 +915,13 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
*/
@Override
public void doPaymentConfirm(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException {
LocalDateTime now = LocalDateTime.now();
LocalDateTime dateTime = LocalDateTime.of(2023, 8, 1, 0, 0, 0);
if (now.isBefore(dateTime)) {
logger.info("当前时间:{}早于:{}, 此订单不进行分账处理, 订单信息:{}", DateUtils.formatDateTime(now), DateUtils.formatDateTime(dateTime), JSON.toJSONString(orderBasicInfo));
return;
}
// 查询订单的交易id
AdapayCallbackRecord adapayCallbackRecord = adapayCallbackRecordService.selectByOrderCode(orderBasicInfo.getOrderCode());
if (adapayCallbackRecord == null) {
@@ -967,6 +976,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
* @param orderCodeList
* @return
*/
@Override
public List<OrderBasicInfo> queryOrderList(List<String> orderCodeList) {
List<OrderBasicInfo> resultList = Lists.newArrayList();
if (CollectionUtils.isEmpty(orderCodeList)) {

View File

@@ -59,13 +59,12 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
/**
* 查询充电桩运营商信息列表
*
* 带权限校验
* @param pileMerchantInfo 充电桩运营商信息
* @return 充电桩运营商信息
*/
@Override
// @DataScope(deptAlias = "t")
public List<PileMerchantInfo> selectPileMerchantInfoList(PileMerchantInfo pileMerchantInfo) {
public List<PileMerchantInfo> selectPileMerchantInfoListWithAuth(PileMerchantInfo pileMerchantInfo) {
AuthorizedDeptVO authorizedMap = SecurityUtils.getAuthorizedMap();
if (authorizedMap == null) {
// 为空表示没有权限,返回空数组
@@ -73,7 +72,17 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
}
pileMerchantInfo.setStationDeptIds(authorizedMap.getStationDeptIds());
pileMerchantInfo.setMerchantDeptIds(authorizedMap.getMerchantDeptIds());
return selectPileMerchantInfoList(pileMerchantInfo);
}
/**
* 查询充电桩运营商信息列表
* 无权限校验
* @param pileMerchantInfo 充电桩运营商信息
* @return 充电桩运营商信息
*/
@Override
public List<PileMerchantInfo> selectPileMerchantInfoList(PileMerchantInfo pileMerchantInfo) {
List<PileMerchantInfo> list = pileMerchantInfoMapper.selectPileMerchantInfoList(pileMerchantInfo);
if (Objects.nonNull(list)) {
for (PileMerchantInfo p:list) {