diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index f54e7e141..9a377d4c7 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -1532,7 +1532,6 @@ public class WxBillAllServiceImpl implements WxBillAllService { public Map getReceiveAndPayBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { PageInfo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getReceiveAndPayBillAsPage(record)); Map result = new HashMap<>(); - initBalance(pageInfo.getList()); result.put("pageInfo", pageInfo); return result; } @@ -1572,25 +1571,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { excelService.exportExcel(list, null, name, OweMerchantVo.class, name + ".xlsx", response, false); } - public void initBalance(List> data){ - data.stream().forEach(e ->{ - if(e.get("receivePay")==null){ - e.put("receivePay",0); - } - if(e.get("payOut")==null){ - e.put("payOut",0); - } - BigDecimal r = new BigDecimal(e.get("receivePay")==null?"0":e.get("receivePay").toString()); - BigDecimal p = new BigDecimal(e.get("payOut")==null?"0":e.get("payOut").toString()); - e.put("balance",r.subtract(p)); - }); - } - @Override public void exportReceiveAndPayBillAsPage(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { List> data = wxBillAllMapper.getReceiveAndPayBillAsPage(record); - initBalance(data); - List list = new ArrayList<>(); for (Map map : data) { ReceivedAndPayVo oweMerchantVo = new ReceivedAndPayVo(); diff --git a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml index 85300ba84..ac9346ffa 100644 --- a/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillAllMapper.xml @@ -663,7 +663,50 @@ left join wx_merchant mm on pso.merchant_id=mm.id where pso.sharing_status !=5 )ss where ss.id = m.id - )/100,2) payOut + )/100,2) payOut, + + (round( + (select sum(bill.receive_pay) from ( + select merchant_id,receive_pay from wx_bill_rent where is_preview = 0 and status not in(3,6) + union all + select merchant_id,receive_pay from wx_bill_rent_deposit where status not in(3,6) + union all + select merchant_id,receive_pay from wx_bill_property where is_preview = 0 and status not in(3,6) + union all + select merchant_id,receive_pay from wx_bill_property_deposit where status not in(3,6) + union all + select merchant_id,receive_pay from wx_bill_daily where type in(1,2,3) and status not in(3,6) + union all + select merchant_id,receive_pay from wx_bill_other where status not in(3,6) + union all + select merchant_id,receive_pay from wx_bill_other_deposit where status not in(3,6) + ) bill where bill.merchant_id = m.id + )/100,2)- + round( + (select sum(ss.money) from ( + select ms.subsidy money,mm.id + from wx_merchant_subsidy ms + left join wx_coupon_order co on co.id = ms.coupon_order_id + left join wx_coupon c on c.id = co.coupon_id + left join wx_merchant mm on mm.id = ms.merchant_id + left join wx_card_spend cs on cs.order_id = ms.order_id + left join wx_c_user cu on cu.id = cs.owner_id + where ms.order_type in(3,0) and ms.status = 0 + union all + select ms.subsidy money,mm.id + from wx_merchant_subsidy ms + left join wx_coupon_order co on co.id = ms.coupon_order_id + left join wx_coupon c on c.id = co.coupon_id + left join wx_merchant mm on mm.id = ms.merchant_id + left join wx_card_spend cs on cs.order_id = ms.order_id + left join wx_c_user cu on cu.id = cs.owner_id + where ms.order_type in(3,0) and ms.status = 0 + union all + select pay_amount money,mm.id from wx_profit_sharing_order pso + left join wx_merchant mm on pso.merchant_id=mm.id + where pso.sharing_status !=5 + )ss where ss.id = m.id + )/100,2)) balance from wx_merchant m left join wx_merchant_shop wms on wms.merchant_id = m.id left join wx_shop ws on wms.shop_id = ws.id where 1=1