|
@@ -71,20 +71,15 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
|
@Resource
|
|
|
OcrConfig ocrConfig;
|
|
|
|
|
|
- /** 增 */
|
|
|
- void add(TbInvoiceOrder t){
|
|
|
-// String result = orcImage(t.getBillImage());
|
|
|
-// String transactionId = getTransId(result);
|
|
|
+ /** 增 --PC后台上传截图的情况*/
|
|
|
+ String add(TbInvoiceOrder t){
|
|
|
String transactionId;
|
|
|
- boolean isWxNotify = false;
|
|
|
if(StrUtil.isEmpty(t.getTransactionId())){
|
|
|
//手动上传账单的情况
|
|
|
String result = orcImage(t.getBillImage());
|
|
|
transactionId = getTransId(result);
|
|
|
}else{
|
|
|
- //微信回调的情况
|
|
|
transactionId = t.getTransactionId();
|
|
|
- isWxNotify = true;
|
|
|
}
|
|
|
|
|
|
TbInvoiceOrder InOrder = findByTransactionId(transactionId);
|
|
@@ -96,7 +91,71 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
|
List<String> carNos = new ArrayList<>();
|
|
|
TbOrder tbOrder = tbOrderService.findByTransactionId(transactionId);
|
|
|
if(tbOrder == null){
|
|
|
- throw new BusinessException("不存在该交易单号的业务订单");
|
|
|
+// throw new BusinessException("不存在该交易单号的业务订单");
|
|
|
+ return "500";
|
|
|
+ }
|
|
|
+ BigDecimal billMoney = new BigDecimal(tbOrder.getPrice());
|
|
|
+ String attachStr = tbOrder.getAttach();
|
|
|
+ Attach attach = JSONUtil.toBean(attachStr, Attach.class);
|
|
|
+ String businessId = attach.getB();
|
|
|
+ if (StrUtil.isNotEmpty(businessId)) {
|
|
|
+ List<String> businessIds = StrUtil.splitTrim(businessId, ",");
|
|
|
+ List<TbBusiness> businessList = tbBusinessService.listByIds(businessIds);
|
|
|
+
|
|
|
+ for (TbBusiness tbBusiness : businessList) {
|
|
|
+ businessNoList.add(tbBusiness.getNo());
|
|
|
+ List<String> carNoList = new ArrayList<>();
|
|
|
+ if(StrUtil.isNotEmpty(tbBusiness.getCardNo())){
|
|
|
+ carNoList.addAll(StrUtil.split(tbBusiness.getCardNo(), "、"));
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(tbBusiness.getChinaCarNo())){
|
|
|
+ carNoList.addAll(StrUtil.split(tbBusiness.getChinaCarNo(), "、"));
|
|
|
+ }
|
|
|
+ for (String no : carNoList) {
|
|
|
+ if(!carNos.contains(no)){
|
|
|
+ carNos.add(no);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ TbGoods good = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
|
+ businessNameList.add(good.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<PriceBO> cars = JSONUtil.toList(attach.getC(), PriceBO.class);
|
|
|
+ if(cars.size()>0){
|
|
|
+ businessNameList.add("停车费");
|
|
|
+ for (PriceBO bo1 : cars) {
|
|
|
+ TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
|
|
|
+ businessNoList.add(car.getNo());
|
|
|
+ if(!carNos.contains(car.getCarNo())){
|
|
|
+ carNos.add(car.getCarNo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String businessNameStr = businessNameList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ String businessNoStr = businessNoList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ String carNoStr = carNos.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ t.setBusinessName(businessNameStr).setBusinessNo(businessNoStr).setCarNo(carNoStr).setStatus(1)
|
|
|
+ .setTransactionId(transactionId).setBillMoney(billMoney)
|
|
|
+ .setStatus(0).setCreateTime(new Date());
|
|
|
+ tbInvoiceOrderMapper.add(t);
|
|
|
+ return "200";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**增 --微信回调自动生成整车业务开票订单的情况*/
|
|
|
+ public void addT(String transactionId){
|
|
|
+ TbInvoiceOrder t = new TbInvoiceOrder();
|
|
|
+ TbInvoiceOrder InOrder = findByTransactionId(transactionId);
|
|
|
+ if(InOrder != null){
|
|
|
+ throw new BusinessException("该账单已生成开票订单");
|
|
|
+ }
|
|
|
+ List<String> businessNameList = new ArrayList<>();
|
|
|
+ List<String> businessNoList = new ArrayList<>();
|
|
|
+ List<String> carNos = new ArrayList<>();
|
|
|
+ TbOrder tbOrder = tbOrderService.findByTransactionId(transactionId);
|
|
|
+ if(tbOrder == null){
|
|
|
+ throw new BusinessException("交易单号识别有误,或不存在该交易单号的业务订单");
|
|
|
}
|
|
|
BigDecimal billMoney = new BigDecimal(tbOrder.getPrice());
|
|
|
String attachStr = tbOrder.getAttach();
|
|
@@ -116,8 +175,6 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
|
if(StrUtil.isNotEmpty(tbBusiness.getChinaCarNo())){
|
|
|
carNoList.addAll(StrUtil.split(tbBusiness.getChinaCarNo(), "、"));
|
|
|
}
|
|
|
-// List<String> yuecarNoList = StrUtil.split(tbBusiness.getCardNo(), "、");
|
|
|
-// List<String> chinaCarNoList = StrUtil.split(tbBusiness.getChinaCarNo(), "、");
|
|
|
for (String no : carNoList) {
|
|
|
if(!carNos.contains(no)){
|
|
|
carNos.add(no);
|
|
@@ -127,15 +184,15 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
|
TbGoods good = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
|
businessNameList.add(good.getName());
|
|
|
//微信回调的情况下,获取整车业务的客户id
|
|
|
- if(isWxNotify && !includZheng && StrUtil.contains(good.getName(), "整车")){
|
|
|
+ if(!includZheng && StrUtil.contains(good.getName(), "整车")){
|
|
|
includZheng = true;
|
|
|
t.setCustomerId(tbBusiness.getCustomerId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(isWxNotify && !includZheng){
|
|
|
+ if(!includZheng){
|
|
|
log.error("该交易单号不包含整车业务,不自动生成开票订单, transactionId: " + transactionId );
|
|
|
- return;
|
|
|
+ return ;
|
|
|
}
|
|
|
List<PriceBO> cars = JSONUtil.toList(attach.getC(), PriceBO.class);
|
|
|
if(cars.size()>0){
|
|
@@ -148,7 +205,6 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
String businessNameStr = businessNameList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
String businessNoStr = businessNoList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
String carNoStr = carNos.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
@@ -156,14 +212,9 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
|
.setTransactionId(transactionId).setBillMoney(billMoney)
|
|
|
.setStatus(0).setCreateTime(new Date());
|
|
|
tbInvoiceOrderMapper.add(t);
|
|
|
- }
|
|
|
-
|
|
|
- public void addT(String transactionId){
|
|
|
- TbInvoiceOrder t = new TbInvoiceOrder();
|
|
|
- t.setTransactionId(transactionId);
|
|
|
- this.add(t);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/** 删 */
|
|
|
int delete(Long id){
|
|
|
return tbInvoiceOrderMapper.delete(id);
|