mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
Merge branch 'dev' of https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web into dev
This commit is contained in:
@@ -7,7 +7,6 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.dto.DebugOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
@@ -126,4 +125,114 @@ public class SplitBillService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 重试运营商分账V2
|
||||
* @param dto
|
||||
* @throws BaseAdaPayException
|
||||
*/
|
||||
public void retryMerchantSplitV2(QueryOrderSplitRecordDTO dto) throws BaseAdaPayException {
|
||||
String startTime = dto.getStartTime();
|
||||
String endTime = dto.getEndTime();
|
||||
// 首先根据 merchantId、startTime、endTime 查出日期区间内所有订单信息(包括 paymentId)
|
||||
List<OrderPaymentDetailVO> recordList = orderBasicInfoService.getSplitOrders(dto);
|
||||
if (CollectionUtils.isEmpty(recordList)) {
|
||||
log.info("重试运营商分账-根据参数未查询到符合条件的订单, param:{}", dto);
|
||||
return;
|
||||
}
|
||||
|
||||
// 循环一次,获得paymentIdList 与 Map
|
||||
List<String> paymentIdList = Lists.newArrayList();
|
||||
Map<String, OrderPaymentDetailVO> paymentIdMap = Maps.newHashMap();
|
||||
Set<String> stationIdSet = Sets.newHashSet();
|
||||
for (OrderPaymentDetailVO orderPaymentDetailVO : recordList) {
|
||||
paymentIdList.add(orderPaymentDetailVO.getPaymentId());
|
||||
paymentIdMap.put(orderPaymentDetailVO.getPaymentId(), orderPaymentDetailVO);
|
||||
stationIdSet.add(orderPaymentDetailVO.getStationId());
|
||||
}
|
||||
|
||||
// 判断订单是否已经成功分账, 将未分账的订单进行筛选、汇总
|
||||
Map<String, List<String>> splitInfoMap = adapayService.getSplitInfoMapByPaymentIdList(paymentIdList);
|
||||
if (splitInfoMap == null || splitInfoMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 未分帐paymentId列表
|
||||
List<String> unSplitPaymentIdList = splitInfoMap.get("unSplitList");
|
||||
// 已分帐paymentId列表
|
||||
List<String> splitPaymentIdList = splitInfoMap.get("splitList");
|
||||
|
||||
/*
|
||||
如果未分帐paymentId列表不为空,则循环每个paymentId进行debugOrder
|
||||
*/
|
||||
if (CollectionUtils.isNotEmpty(unSplitPaymentIdList)) {
|
||||
// 将 paymentIdList 与 recordList 进行匹配,筛选出 orderCodeList
|
||||
List<String> orderCodeList = Lists.newArrayList();
|
||||
for (String unSplitPaymentId : unSplitPaymentIdList) {
|
||||
OrderPaymentDetailVO orderPaymentDetailVO = paymentIdMap.get(unSplitPaymentId);
|
||||
if (orderPaymentDetailVO != null) {
|
||||
orderCodeList.add(orderPaymentDetailVO.getOrderCode());
|
||||
}
|
||||
}
|
||||
|
||||
// 调用 debugOrder 接口进行重新分账
|
||||
for (String orderCode : orderCodeList) {
|
||||
DebugOrderDTO debugOrderDTO = new DebugOrderDTO();
|
||||
debugOrderDTO.setOrderCode(orderCode);
|
||||
debugOrderDTO.setReSplitFlag(Constants.ONE);
|
||||
|
||||
try {
|
||||
Map<String, Object> stringObjectMap = tempService.debugOrder(debugOrderDTO);
|
||||
log.info("重试运营商分账-debugOrder接口调用成功, param:{}, result:{}", debugOrderDTO, stringObjectMap);
|
||||
} catch (Exception e) {
|
||||
log.error("重试运营商分账-debugOrder接口调用异常, param:{}", debugOrderDTO, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
如果已分帐paymentId列表不为空,则循环每个paymentId进行校验OrderSplitRecord数据是否正确
|
||||
*/
|
||||
if (CollectionUtils.isNotEmpty(splitPaymentIdList)) {
|
||||
// 将 paymentIdList 与 recordList 进行匹配,筛选出 orderCodeList
|
||||
List<String> orderCodeList = Lists.newArrayList();
|
||||
for (String unSplitPaymentId : splitPaymentIdList) {
|
||||
OrderPaymentDetailVO orderPaymentDetailVO = paymentIdMap.get(unSplitPaymentId);
|
||||
if (orderPaymentDetailVO != null) {
|
||||
orderCodeList.add(orderPaymentDetailVO.getOrderCode());
|
||||
}
|
||||
}
|
||||
for (String orderCode : orderCodeList) {
|
||||
tempService.checkOrderSplitRecord(orderCode);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
重新计算站点日报和运营商日报
|
||||
*/
|
||||
// 获取日期区间内所有日期
|
||||
List<String> dateList = DateUtils.getAllDatesInTheDateRange(startTime, endTime);
|
||||
stationIdSet.parallelStream().forEach(stationId -> {
|
||||
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
|
||||
for (String tradeDate : dateList) {
|
||||
try {
|
||||
settleOrderReportService.generateDailyOrderReports(stationInfo, tradeDate);
|
||||
log.info("重试运营商分账-生成站点日报成功, param:{}", tradeDate);
|
||||
}catch (Exception e) {
|
||||
log.error("重试运营商分账-生成站点日报异常, param:{}", tradeDate, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 重新计算运营商日报
|
||||
for (String tradeDate : dateList) {
|
||||
try {
|
||||
orderBasicInfoService.generateMerchantBill(dto.getMerchantId(), tradeDate);
|
||||
log.info("重试运营商分账-生成运营商日报成功, param:{}", tradeDate);
|
||||
}catch (Exception e) {
|
||||
log.error("重试运营商分账-生成运营商日报异常, param:{}", tradeDate, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1422,7 +1422,35 @@ public class TempService {
|
||||
.orderBasicInfo(orderBasicInfo)
|
||||
.build();
|
||||
|
||||
orderBasicInfoService.splittingMethodTemp(afterSettleOrderDTO);
|
||||
orderBasicInfoService.checkOrUpdateOrderSplitRecord(afterSettleOrderDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查订单分账记录
|
||||
* @param orderCode
|
||||
*/
|
||||
public void checkOrderSplitRecord(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
|
||||
// 组装after参数
|
||||
AfterSettleOrderDTO afterSettleOrderDTO = AfterSettleOrderDTO.builder()
|
||||
.orderCode(orderBasicInfo.getOrderCode())
|
||||
.merchantId(orderBasicInfo.getMerchantId())
|
||||
.stationId(orderBasicInfo.getStationId())
|
||||
.orderPayAmount(orderBasicInfo.getPayAmount()) // 支付金额
|
||||
.orderConsumeAmount(orderBasicInfo.getOrderAmount()) // 消费金额
|
||||
.orderSettleAmount(orderBasicInfo.getSettleAmount()) // 结算金额
|
||||
.orderElectricityAmount(orderDetail.getTotalElectricityAmount()) // 电费金额
|
||||
.orderElectricityDiscountAmount(orderDetail.getDiscountElectricityAmount()) // 电费折扣金额
|
||||
.orderServiceAmount(orderDetail.getTotalServiceAmount()) // 服务费金额
|
||||
.orderServiceDiscountAmount(orderDetail.getDiscountServiceAmount()) // 服务费折扣金额
|
||||
.orderRefundAmount(orderBasicInfo.getRefundAmount()) // 退款金额
|
||||
.orderBasicInfo(orderBasicInfo)
|
||||
.build();
|
||||
|
||||
orderBasicInfoService.checkOrUpdateOrderSplitRecord(afterSettleOrderDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ public class PaymentTestController {
|
||||
@Test
|
||||
public void queryCreateConfirmReverseNew() throws BaseAdaPayException {
|
||||
List<String> paymentIdList = getPaymentIdList(); // 查询分账信息
|
||||
List<String> splitInfoByPaymentIdList = adapayService.getSplitInfoByPaymentIdList(paymentIdList);
|
||||
System.out.println("未分账paymentId:" + splitInfoByPaymentIdList);
|
||||
Map<String, List<String>> splitInfoMap = adapayService.getSplitInfoMapByPaymentIdList(paymentIdList);
|
||||
System.out.println("splitInfoMap:" + JSON.toJSONString(splitInfoMap));
|
||||
}
|
||||
|
||||
public List<String> getPaymentIdList() {
|
||||
|
||||
@@ -1,138 +1,3 @@
|
||||
002212025092522524610817300778411462656
|
||||
002212025092523381210817312211484381184
|
||||
002212025092601015510817333280098480128
|
||||
002212025092605040010817394205119447040
|
||||
002212025092606182910817412949334286336
|
||||
002212025092606283410817415485092900864
|
||||
002212025092606320010817416349857419264
|
||||
002212025092606472410817420223817416704
|
||||
002212025092606533410817421777744281600
|
||||
002212025092606551910817422215214215168
|
||||
002212025092607014510817423836484845568
|
||||
002212025092607103010817426039769513984
|
||||
002212025092607114710817426360587776000
|
||||
002212025092607181110817427970810130432
|
||||
002212025092607283610817430592267218944
|
||||
002212025092607330310817431714629267456
|
||||
002212025092607443110817434600184737792
|
||||
002212025092607470210817435231280394240
|
||||
002212025092607472410817435325526700032
|
||||
002212025092607555310817437459504242688
|
||||
002212025092608012310817438842039107584
|
||||
002212025092608235510817444513182859264
|
||||
002212025092608360110817447558478266368
|
||||
002212025092608403710817448716433309696
|
||||
002212025092609001210817453646720376832
|
||||
002212025092609075410817455582949519360
|
||||
002212025092609080710817455637798436864
|
||||
002212025092609122710817456726278885376
|
||||
002212025092609142010817457201518993408
|
||||
002212025092609345210817462370805583872
|
||||
002212025092609352610817462513231572992
|
||||
002212025092609392110817463499425542144
|
||||
002212025092610111110817471506553053184
|
||||
002212025092610300210817476250265186304
|
||||
002212025092610335810817477240380833792
|
||||
002212025092610461810817480345155649536
|
||||
002212025092610595510817483774011748352
|
||||
002212025092611014510817484233174491136
|
||||
002212025092611044910817485007464128512
|
||||
002212025092611194410817488758472126464
|
||||
002212025092611290110817491095056130048
|
||||
002212025092611433210817494747938410496
|
||||
002212025092611501610817496441996664832
|
||||
002212025092611550210817497643622821888
|
||||
002212025092611552910817497755774320640
|
||||
002212025092611560610817497912691621888
|
||||
002212025092611571910817498219530412032
|
||||
002212025092611585210817498606702268416
|
||||
002212025092612055210817500369916219392
|
||||
002212025092612081010817500949912817664
|
||||
002212025092612121410817501973256032256
|
||||
002212025092612122210817502004008525824
|
||||
002212025092612123510817502058383777792
|
||||
002212025092612141310817502469869862912
|
||||
002212025092612244110817505106405171200
|
||||
002212025092612251010817505225737605120
|
||||
002212025092612294310817506372015726592
|
||||
002212025092612294310817506373315964928
|
||||
002212025092612362710817508066912862208
|
||||
002212025092612415110817509424554536960
|
||||
002212025092612551310817512788558462976
|
||||
002212025092613015510817514474538635264
|
||||
002212025092613072010817515837700173824
|
||||
002212025092613082410817516108530429952
|
||||
002212025092613152310817517864551297024
|
||||
002212025092613251110817520328079802368
|
||||
002212025092613254110817520455683256320
|
||||
002212025092613593310817528977678508032
|
||||
002212025092614023410817529739422687232
|
||||
002212025092614083410817531247455178752
|
||||
002212025092614121810817532188845735936
|
||||
002212025092614135610817532597245259776
|
||||
002212025092614173410817533514787180544
|
||||
002212025092614195710817534110638387200
|
||||
002212025092614231710817534950858141696
|
||||
002212025092614463810817540826650083328
|
||||
002212025092614515110817542140159430656
|
||||
002212025092614582310817543784670380032
|
||||
002212025092615112110817547047977607169
|
||||
002212025092615175910817548716693590016
|
||||
002212025092615202310817549323123138560
|
||||
002212025092615403810817554419231866880
|
||||
002212025092615555710817558271821561856
|
||||
002212025092616030610817560070297030656
|
||||
002212025092616080310817561314822836224
|
||||
002212025092616120610817562335112290304
|
||||
002212025092616155210817563284652531712
|
||||
002212025092616225510817565056901156864
|
||||
002212025092616241910817565411214991360
|
||||
002212025092616304910817567047287300096
|
||||
002212025092616375510817568834597384192
|
||||
002212025092616394710817569303705116672
|
||||
002212025092616465110817571082945658880
|
||||
002212025092616540010817572881123618816
|
||||
002212025092616564710817573580108271616
|
||||
002212025092616574410817573821368836096
|
||||
002212025092617003610817574541266743296
|
||||
002212025092617061910817575980156436480
|
||||
002212025092617101510817576968808411136
|
||||
002212025092617134110817577835439538176
|
||||
002212025092617273710817581340678279168
|
||||
002212025092617321210817582495349186560
|
||||
002212025092617333510817582841446236160
|
||||
002212025092617345310817583167838580736
|
||||
002212025092617390310817584217526059008
|
||||
002212025092617445210817585681229406208
|
||||
002212025092617464610817586160675962880
|
||||
002212025092617560210817588492063064064
|
||||
002212025092617563610817588633004097536
|
||||
002212025092617584210817589163516604416
|
||||
002212025092618000010817589490299166720
|
||||
002212025092618061810817591074533781504
|
||||
002212025092618380910817599089915531264
|
||||
002212025092618483310817601709288038400
|
||||
002212025092618542510817603184256835584
|
||||
002212025092619023710817605249721016320
|
||||
002212025092619045110817605810038083584
|
||||
002212025092619062310817606195288961024
|
||||
002212025092619111010817607400782266368
|
||||
002212025092619193210817609505593061376
|
||||
002212025092619193710817609524907978752
|
||||
002212025092619225310817610349063557120
|
||||
002212025092619252610817610991110524928
|
||||
002212025092619264910817611337136558080
|
||||
002212025092619290210817611895289225216
|
||||
002212025092619490910817616958728646656
|
||||
002212025092619494110817617090832453632
|
||||
002212025092619551710817618501150556160
|
||||
002212025092620062310817621294707703808
|
||||
002212025092620135710817623198037028864
|
||||
002212025092620222510817625331318464512
|
||||
002212025092620272710817626597281337344
|
||||
002212025092620420310817630272376651776
|
||||
002212025092621112910817637676828954624
|
||||
002212025092621354910817643801028395008
|
||||
002212025092621413910817645268435312640
|
||||
002212025092621444910817646066690895872
|
||||
002212025092622084610817652092584701952
|
||||
|
||||
Reference in New Issue
Block a user