|
@@ -84,11 +84,23 @@ public class ApiCarFreeChargeServiceImpl implements ApiCarFreeChargeService {
|
|
|
|
|
|
// 根据运单发票状态更新运单状态
|
|
|
if (invoiceResultDto.getWaybillStatus().equals("3")) {
|
|
|
- // 开票完成
|
|
|
- startService.updateBillStartStatus(invoiceResultDto.getWaybillNum(), CommonConstant.STATUS_INVOICE_OVER);
|
|
|
+ if (po.getId() == null) {
|
|
|
+ po.setIsSearch(2);
|
|
|
+ po.setStatus(CommonConstant.STATUS_INVOICE_OVER);
|
|
|
+ startService.saveBillStart(po);
|
|
|
+ } else {
|
|
|
+ // 开票完成
|
|
|
+ startService.updateBillStartStatus(invoiceResultDto.getWaybillNum(), CommonConstant.STATUS_INVOICE_OVER);
|
|
|
+ }
|
|
|
} else {
|
|
|
- // 开票中
|
|
|
- startService.updateBillStartStatus(invoiceResultDto.getWaybillNum(), CommonConstant.STATUS_MAKING_INVOICE);
|
|
|
+ if (po.getId() == null) {
|
|
|
+ po.setIsSearch(2);
|
|
|
+ po.setStatus(CommonConstant.STATUS_MAKING_INVOICE);
|
|
|
+ startService.saveBillStart(po);
|
|
|
+ } else {
|
|
|
+ // 开票中
|
|
|
+ startService.updateBillStartStatus(invoiceResultDto.getWaybillNum(), CommonConstant.STATUS_MAKING_INVOICE);
|
|
|
+ }
|
|
|
}
|
|
|
if (invoiceResultDto.getResult() != null) {
|
|
|
// 判断运单查询发票返回共用信息在数据库中是否存在,不存在则存入
|
|
@@ -103,7 +115,7 @@ public class ApiCarFreeChargeServiceImpl implements ApiCarFreeChargeService {
|
|
|
Collectors.collectingAndThen(
|
|
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InvoiceResult::getFee))), ArrayList::new));
|
|
|
//计费
|
|
|
- newSearchInvoiceResultList.stream().forEach(t -> {
|
|
|
+ for (InvoiceResult t : newSearchInvoiceResultList) {
|
|
|
if (!redisTemplate.hasKey(CommonConstant.TRANSACTION_ID_KEY + t.getTransactionId())) {
|
|
|
// todo 此处计费需要使用消息实现
|
|
|
// UserBalanceDto userBalanceDto = userBalanceService.getUserBalance(po.getUserId());
|
|
@@ -137,11 +149,9 @@ public class ApiCarFreeChargeServiceImpl implements ApiCarFreeChargeService {
|
|
|
realChargeService.saveRealCharge(realChargeDto);
|
|
|
log.warn("计费日志:{},计费用户id:{}", JSON.toJSONString(t), po.getUserId());
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
- // 遍历发票集合
|
|
|
- invoiceResultDto.getResult().stream().forEach(t -> {
|
|
|
- t.setTransactionId(t.getTransactionId());
|
|
|
+ for (InvoiceResult t : invoiceResultDto.getResult()) {
|
|
|
if (!redisTemplate.hasKey(CommonConstant.NUM_FIND_INVOICE_KEY + t.getInvoiceNum() + "_" + t.getInvoiceCode())) {
|
|
|
SearchInvoiceResultDto dto = new SearchInvoiceResultDto();
|
|
|
BeanUtil.copyProperties(dto, t);
|
|
@@ -154,7 +164,7 @@ public class ApiCarFreeChargeServiceImpl implements ApiCarFreeChargeService {
|
|
|
//存入redis交易id
|
|
|
redisTemplate.opsForValue().set(CommonConstant.TRANSACTION_ID_KEY + t.getTransactionId(), t.getTransactionId());
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
return apiResponseData;
|
|
|
} else {
|