瀏覽代碼

装卸业务打印,账单识别失败手动填transactionId

lzm 3 年之前
父節點
當前提交
e9ea80ebbc

+ 5 - 0
sp-admin/sa-frame/menu-list.js

@@ -308,6 +308,11 @@ var menuList = [{
 						name: '账单确认',
 						isShow: false
 					},
+					{
+						id: 'tb-business-zx-print',
+						name: '装卸打印',
+						isShow: false
+					},
 				]
 			},
 

+ 21 - 0
sp-admin/sa-view/tb-business/tb-car-disincle-list.html

@@ -104,6 +104,9 @@
 							<el-button v-if="sa.isAuth('tb-business-car-bind')" class="c-btn" type="primary"
 								@click="businessFn(s.row)">绑定车辆
 							</el-button>
+							<el-button v-if="sa.isAuth('tb-business-zx-print')&&zxShow(s.row.goodsName)" class="c-btn" type="success"
+									   @click="zxPrint(s.row.id)">装卸打印
+							</el-button>
 							<el-button class="c-btn" type="danger"
 								v-if="sa.isAuth('tb-flex-business-del')&&s.row.adminConfirmInput==0&&s.row.payMoney==0"
 								@click="del(s.row)">删除
@@ -175,6 +178,24 @@
 					goodsList: [],
 				},
 				methods: {
+					zxShow(goodsName){
+						var flag = goodsName.indexOf("整车");
+						if(flag > 0 || flag === 0){
+							return true;
+						}else {
+							return false;
+						}
+					},
+					zxPrint(id){
+						this.$confirm('    点击确定开始打印!', '提示', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+						}).then(() => {
+							sa.showIframe('打印装卸业务确认单', 'print-zxbusiness.html?id=' + id , '1000px', '100%');
+						}).catch(() => {
+
+						});;
+					},
 					getGoodsList(){
 						sa.ajax('/TbGoods/getList', function(resp) {
 							this.goodsList = resp.data;

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -50,6 +50,8 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
     //其他业务
     public static final String PERMISSION_FLAX_BUSINESS_ADD = "tb-flex-business-add";
     public static final String PERMISSION_FLAX_BUSINESS_EDIT = "tb-flex-business-edit";
+    //装卸打印
+    public static final String PERMISSION_ZX_PRINT = "tb-business-zx-print";
 
 
 

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java

@@ -265,6 +265,10 @@ public class TbBusinessController {
     public AjaxJson getOtherBusinessById(String id) {
         return AjaxJson.getSuccessData(tbBusinessService.getOtherBusinessById(id));
     }
+    @RequestMapping("getZxBusinessById")
+    public AjaxJson getZxBusinessById(String id) {
+        return AjaxJson.getSuccessData(tbBusinessService.getZxBusinessById(id));
+    }
 
     @RequestMapping("deleteOtherBusiness")
     public AjaxJson deleteOtherBusiness(String id, String businessCarId) {

+ 9 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -600,6 +600,15 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusiness.setCars(cars);
         return tbBusiness;
     }
+    /**获取业务信息,但只取装卸类型的收费项*/
+    public TbBusiness getZxBusinessById(String id) {
+        TbBusiness tbBusiness = this.getById(id);
+        List<TbBusinessItem> tbBusinessItems = tbBusinessItemService.findZxByBusinessId(id);
+        tbBusiness.setItems(tbBusinessItems);
+        List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(id);
+        tbBusiness.setCars(cars);
+        return tbBusiness;
+    }
 
     public void deleteOtherBusiness(String id) {
         TbBusiness db = super.getById(id);

+ 10 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java

@@ -119,6 +119,16 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
         return list(ew);
     }
 
+    /**获取装卸类型的item*/
+    public List<TbBusinessItem> findZxByBusinessId(String businessId) {
+        QueryWrapper<TbBusinessItem> ew = new QueryWrapper<>();
+        ew.eq("business_id", businessId);
+        ew.like("item_type_name", "装卸");
+        ew.orderByDesc("pick");
+        ew.orderByAsc("confirm");
+        return list(ew);
+    }
+
 
     public void confirmBusinessItem(long id) {
         TbBusinessItem tbBusinessItem = this.getById(id);

+ 6 - 2
sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrderController.java

@@ -34,8 +34,12 @@ public class TbInvoiceOrderController {
 	@SaCheckPermission(TbInvoiceOrder.PERMISSION_CODE)
 	@Transactional(rollbackFor = Exception.class)
 	public AjaxJson add(TbInvoiceOrder t){
-		tbInvoiceOrderService.add(t);
-		return AjaxJson.getSuccess();
+        String result = tbInvoiceOrderService.add(t);
+        if(StrUtil.equals("200", result)){
+            return AjaxJson.getSuccess();
+        }else {
+            return AjaxJson.getSuccess("fail");
+        }
 	}
 
 	/** 删 */  

+ 71 - 20
sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrderService.java

@@ -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);

+ 1 - 1
sp-server/src/main/java/com/pj/project/wx_send_msg/WxMsgTask.java

@@ -21,7 +21,7 @@ public class WxMsgTask {
     /**
      * 3分钟执行一次
      */
-    @Scheduled(fixedRate = 180000)
+    //@Scheduled(fixedRate = 180000)
     public void check() {
         List<WxSendMsg> list = wxSendMsgService.list();
         list.forEach(wxSendMsg -> {

+ 1 - 1
sp-server/src/main/resources/application-dev.yml

@@ -6,7 +6,7 @@ spring:
     # 数据源配置
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
-        url: jdbc:mysql://127.0.0.1:3307/pco08010?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:3307/pco0815?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
         username: root
         password: 1234
         # 是否打开sql监控台  (生产环境请务必关闭此选项)