From 7b0f1be3f25064b99cffb4bf05378c4fe4496483 Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 11 Jul 2019 14:12:01 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=BB=9F=E8=AE=A1][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=9A=E6=80=81=E5=88=86=E6=9E=90]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/sys/WxBusinessController.java | 24 ++++++++++++++++++- .../resources/mapper/WxBusinessMapper.xml | 16 ++++++------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java b/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java index 0329f478e..b76cce2da 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java @@ -121,11 +121,33 @@ public class WxBusinessController extends BaseController { if(m.get("volume") != null) { //单位转万 BigDecimal b = (BigDecimal)m.get("volume"); - String dstr = b.divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_HALF_UP).toString(); + String dstr = b.divide(new BigDecimal(10000)).setScale(4, BigDecimal.ROUND_HALF_UP).toString(); businessDataVo.setSale(dstr); } if(m.get("sale") != null) businessDataVo.setSaleRate(m.get("sale").toString()); + + if(m.get("rent") == null){ + m.put("rent",0); + } + if(m.get("sale") == null){ + m.put("sale",0); + m.put("rentSaleRate",0); + businessDataVo.setRentSaleRate("0"); + exeList.add(businessDataVo); + continue; + } + BigDecimal sale = new BigDecimal(m.get("sale").toString()); + BigDecimal rent = new BigDecimal(m.get("rent").toString()); + if(sale.doubleValue() <= 0){ + businessDataVo.setRentSaleRate("0"); + exeList.add(businessDataVo); + continue; + }else { + BigDecimal divide = rent.divide(sale, 2, BigDecimal.ROUND_HALF_UP); + m.put("rentSaleRate", divide); + businessDataVo.setRentSaleRate(divide.toString()); + } exeList.add(businessDataVo); } excelService.exportExcel(exeList, null, "业态统计", WxBusinessDataVo.class, "业态统计列表.xlsx", response, false); diff --git a/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml b/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml index 982c74165..2131f44e9 100644 --- a/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBusinessMapper.xml @@ -86,13 +86,13 @@ round( (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m - left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) + left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) /100,2) volume, round( (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m - left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) + left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) / (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m @@ -119,7 +119,7 @@ round( (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m - left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) / + left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) / (select sum(mtd.trade_count) from wx_merchant m left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = b.id and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) @@ -134,7 +134,7 @@ round( (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m - left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id) + left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id) / (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m @@ -148,7 +148,7 @@ round( (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m - left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id)/ + left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 and m.id = mm.id)/ (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m left join wx_merchant_shop mtd on mtd.merchant_id = m.id @@ -158,7 +158,7 @@ round( (select if(sum(mtd.trade_amt) is null,0,sum(mtd.trade_amt)) from wx_merchant m - left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.create_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) + left join wx_merchant_trade_daily mtd on mtd.merchant_id = m.id where m.business_id = #{id} and m.tenant_id=#{tenantId} and mtd.report_date between #{startdate} and #{enddate} and m.status = 1 and m.is_del = 0 ) / (select if(sum(ws.operation_area) is null,0,sum(ws.operation_area)) from wx_merchant m @@ -167,7 +167,7 @@ where m.business_id = #{id} and m.tenant_id=#{tenantId} and m.status = 1 and m.is_del = 0 ) /100,2) - ,2) devoteRate + *100,2) devoteRate from wx_merchant mm left join wx_merchant_trade_daily mtd on mtd.merchant_id = mm.id @@ -175,7 +175,7 @@ left join wx_shop ws on(wmt.shop_id = ws.id) where mm.business_id=#{id} and mm.tenant_id=#{tenantId} and mm.status = 1 and mm.is_del = 0 - and mtd.create_date between #{startdate} and #{enddate} + and mtd.report_date between #{startdate} and #{enddate} group by mm.id order by devoteRate desc