|
@@ -322,6 +322,9 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
@Value("${shared.saleData}")
|
|
|
private String SHARED_SALE_DATA;
|
|
|
|
|
|
+ @Value("${oldStudySys.saveInvoice}")
|
|
|
+ private String OLD_SAVE_INVOICE;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public TopOldOrderVo queryById(String orderSn) {
|
|
@@ -394,16 +397,22 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
.eq(TopNuoMplatformLog::getStatus, 2));
|
|
|
if (CollectionUtils.isNotEmpty(fromLogs)){
|
|
|
BigDecimal invoiceTotal = BigDecimal.ZERO;
|
|
|
+ List<String> invoiceUrls = new ArrayList<>();
|
|
|
for (TopNuoMplatformLog fromLog : fromLogs) {
|
|
|
OrderInvoiceHostBo invoiceBo = JSONObject.parseObject(fromLog.getContent(), OrderInvoiceHostBo.class);
|
|
|
if (ObjectUtils.isNotNull(invoiceBo)){
|
|
|
BigDecimal price = invoiceBo.getOrder().getInvoiceDetail().getPrice();
|
|
|
invoiceTotal = invoiceTotal.add(price);
|
|
|
}
|
|
|
- orderVo.setInvoiceDate(invoiceBo.getOrder().getInvoiceDate());
|
|
|
+ if (ObjectUtils.isNotNull(invoiceBo)){
|
|
|
+ orderVo.setInvoiceDate(invoiceBo.getOrder().getInvoiceDate());
|
|
|
+ }
|
|
|
+ String url = StringUtils.isNotBlank(fromLog.getOssPdfUrl()) ? fromLog.getOssPdfUrl():fromLog.getPdfUrl();
|
|
|
+ invoiceUrls.add(url);
|
|
|
}
|
|
|
orderVo.setInvoiceMoney(invoiceTotal);
|
|
|
orderVo.setInvoiceStatus(1);
|
|
|
+ orderVo.setInvoiceUrl(invoiceUrls);
|
|
|
}else {
|
|
|
orderVo.setInvoiceStatus(0);
|
|
|
}
|
|
@@ -5186,6 +5195,53 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
|
|
|
return topOldOrderQuestionService.saveBatch(collect);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean invoiceUpload(TopInvoiceUploadBo bo) {
|
|
|
+ TopOldOrder order = getOne(new LambdaQueryWrapper<TopOldOrder>().eq(TopOldOrder::getOrderSn, bo.getOrderSn()));
|
|
|
+ if (ObjectUtils.isNull(order)){
|
|
|
+ throw new CustomException("订单查询失败,请检查订单号");
|
|
|
+ }
|
|
|
+
|
|
|
+ //新增发票
|
|
|
+ TopNuoMplatformLog entity = new TopNuoMplatformLog();
|
|
|
+ entity.setOrderNo(bo.getOrderSn());
|
|
|
+ entity.setOrderNoList(bo.getOrderSn());
|
|
|
+ entity.setTenantId(order.getTenantId().toString());
|
|
|
+ entity.setStatus(2);
|
|
|
+ entity.setFromPlat(3);
|
|
|
+ entity.setPdfUrl(bo.getInvoiceUrl());
|
|
|
+ entity.setOssPdfUrl(bo.getInvoiceUrl());
|
|
|
+ entity.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ entity.setCreateTime(DateUtils.getNowTime());
|
|
|
+ topNuoMplatformLogService.save(entity);
|
|
|
+
|
|
|
+ //修改订单发票状态
|
|
|
+ update(new LambdaUpdateWrapper<TopOldOrder>()
|
|
|
+ .eq(TopOldOrder::getOrderSn,bo.getOrderSn())
|
|
|
+ .set(TopOldOrder::getInvoiceStatus,1));
|
|
|
+
|
|
|
+ //通知旧系统
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
|
|
|
+ params.put("stamp", nowTime.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("orderSn", order.getOrderSn());
|
|
|
+ params.put("invoiceUrl", bo.getInvoiceUrl());
|
|
|
+ String respone = "";
|
|
|
+ String path = OLD_SAVE_INVOICE;
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(path, params);
|
|
|
+ if (!respone.contains("\"Status\":true")) {
|
|
|
+ throw new CustomException("旧系统新增发票接口请求错误" + respone);
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new CustomException("旧系统新增发票接口请求错误" + e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private String hideIDCard(String idCard) {
|
|
|
if (idCard == null || idCard.length() != 18) {
|
|
|
return idCard;
|