|
@@ -22,6 +22,10 @@ import com.pj.project.tb_business.TbBusiness;
|
|
import com.pj.project.tb_business.TbBusinessService;
|
|
import com.pj.project.tb_business.TbBusinessService;
|
|
import com.pj.project.tb_business_car.TbBusinessCar;
|
|
import com.pj.project.tb_business_car.TbBusinessCar;
|
|
import com.pj.project.tb_business_car.TbBusinessCarService;
|
|
import com.pj.project.tb_business_car.TbBusinessCarService;
|
|
|
|
+import com.pj.project.tb_costomer.TbCostomer;
|
|
|
|
+import com.pj.project.tb_costomer.TbCostomerService;
|
|
|
|
+import com.pj.project.tb_fee_details.TbFeeDetails;
|
|
|
|
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
|
|
import com.pj.project.tb_goods.TbGoods;
|
|
import com.pj.project.tb_goods.TbGoods;
|
|
import com.pj.project.tb_goods.TbGoodsService;
|
|
import com.pj.project.tb_goods.TbGoodsService;
|
|
import com.pj.project.tb_order.TbOrder;
|
|
import com.pj.project.tb_order.TbOrder;
|
|
@@ -58,20 +62,29 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
@Resource
|
|
@Resource
|
|
TbBusinessCarService tbBusinessCarService;
|
|
TbBusinessCarService tbBusinessCarService;
|
|
@Resource
|
|
@Resource
|
|
|
|
+ TbCostomerService tbCostomerService;
|
|
|
|
+ @Resource
|
|
|
|
+ TbFeeDetailsService tbFeeDetailsService;
|
|
|
|
+ @Resource
|
|
MyConfig myConfig;
|
|
MyConfig myConfig;
|
|
@Resource
|
|
@Resource
|
|
OcrConfig ocrConfig;
|
|
OcrConfig ocrConfig;
|
|
|
|
|
|
/** 增 */
|
|
/** 增 */
|
|
- int add(TbInvoiceOrder t){
|
|
|
|
- String result = orcImage(t.getBillImage());
|
|
|
|
- String transactionId = getTransId(result);
|
|
|
|
-// if(StrUtil.isEmpty(t.getTransactionId())){
|
|
|
|
-// String result = orcImage(t.getBillImage());
|
|
|
|
-// transactionId = getTransId(result);
|
|
|
|
-// }else{
|
|
|
|
-// transactionId = t.getTransactionId();
|
|
|
|
-// }
|
|
|
|
|
|
+ void add(TbInvoiceOrder t){
|
|
|
|
+// String result = orcImage(t.getBillImage());
|
|
|
|
+// String transactionId = getTransId(result);
|
|
|
|
+ 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);
|
|
TbInvoiceOrder InOrder = findByTransactionId(transactionId);
|
|
if(InOrder != null){
|
|
if(InOrder != null){
|
|
@@ -87,15 +100,26 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
String attachStr = tbOrder.getAttach();
|
|
String attachStr = tbOrder.getAttach();
|
|
Attach attach = JSONUtil.toBean(attachStr, Attach.class);
|
|
Attach attach = JSONUtil.toBean(attachStr, Attach.class);
|
|
String businessId = attach.getB();
|
|
String businessId = attach.getB();
|
|
|
|
+ boolean includZheng = false;//是否包含整车业务
|
|
if (StrUtil.isNotEmpty(businessId)) {
|
|
if (StrUtil.isNotEmpty(businessId)) {
|
|
List<String> businessIds = StrUtil.splitTrim(businessId, ",");
|
|
List<String> businessIds = StrUtil.splitTrim(businessId, ",");
|
|
List<TbBusiness> businessList = tbBusinessService.listByIds(businessIds);
|
|
List<TbBusiness> businessList = tbBusinessService.listByIds(businessIds);
|
|
|
|
+
|
|
for (TbBusiness tbBusiness : businessList) {
|
|
for (TbBusiness tbBusiness : businessList) {
|
|
businessNoList.add(tbBusiness.getNo());
|
|
businessNoList.add(tbBusiness.getNo());
|
|
TbGoods good = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
TbGoods good = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
businessNameList.add(good.getName());
|
|
businessNameList.add(good.getName());
|
|
|
|
+ //微信回调的情况下,获取整车业务的客户id
|
|
|
|
+ if(isWxNotify && !includZheng && StrUtil.contains(good.getName(), "整车")){
|
|
|
|
+ includZheng = true;
|
|
|
|
+ t.setCustomerId(tbBusiness.getCustomerId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(isWxNotify && !includZheng){
|
|
|
|
+ log.error("该交易单号不包含整车业务,不自动生成开票订单, transactionId: " + transactionId );
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
List<PriceBO> cars = JSONUtil.toList(attach.getC(), PriceBO.class);
|
|
List<PriceBO> cars = JSONUtil.toList(attach.getC(), PriceBO.class);
|
|
if(cars.size()>0){
|
|
if(cars.size()>0){
|
|
businessNameList.add("停车费");
|
|
businessNameList.add("停车费");
|
|
@@ -110,9 +134,15 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
t.setBusinessName(businessNameStr).setBusinessNo(businessNoStr).setStatus(1)
|
|
t.setBusinessName(businessNameStr).setBusinessNo(businessNoStr).setStatus(1)
|
|
.setTransactionId(transactionId).setBillMoney(billMoney)
|
|
.setTransactionId(transactionId).setBillMoney(billMoney)
|
|
.setStatus(0).setCreateTime(new Date());
|
|
.setStatus(0).setCreateTime(new Date());
|
|
- return tbInvoiceOrderMapper.add(t);
|
|
|
|
|
|
+ tbInvoiceOrderMapper.add(t);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void addT(String transactionId){
|
|
|
|
+ TbInvoiceOrder t = new TbInvoiceOrder();
|
|
|
|
+ t.setTransactionId(transactionId);
|
|
|
|
+ this.add(t);
|
|
|
|
+ }
|
|
|
|
+
|
|
/** 删 */
|
|
/** 删 */
|
|
int delete(Long id){
|
|
int delete(Long id){
|
|
return tbInvoiceOrderMapper.delete(id);
|
|
return tbInvoiceOrderMapper.delete(id);
|
|
@@ -189,4 +219,9 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
|
|
return new BigDecimal(money);
|
|
return new BigDecimal(money);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public List<TbFeeDetails> getDetailsByTransId(String transactionId) {
|
|
|
|
+ List<TbFeeDetails> detailsList = tbFeeDetailsService.findByTransactionId(transactionId);
|
|
|
|
+ return detailsList;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|