From 9dfe234cf18e431da8524c483644e7394d05c0f7 Mon Sep 17 00:00:00 2001 From: wuwenxiong <646448316@qq.com> Date: Fri, 21 Jan 2022 17:21:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E5=94=AE=E6=8F=90=E8=B4=A7=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=A2=9E=E5=8A=A0=E5=B7=B2=E6=8F=90=E8=B4=A7=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presellorder/PresellOrderService.java | 2 +- .../ssjygl/stat/sale/OrderStatService.java | 69 ++++++++++++++++--- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/presellorder/PresellOrderService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/presellorder/PresellOrderService.java index b05c814..9943f81 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/presellorder/PresellOrderService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/presellorder/PresellOrderService.java @@ -223,7 +223,7 @@ public class PresellOrderService extends BaseService { " ordercluster t\n" + " WHERE\n" + " t.sale_type = 1\n" + - " AND t.state < 5\n" + + " AND t.state <= 5\n" + " AND t.customer_id = ?\n" + " ),\n" + " 0\n" + diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java index bf4dd80..245d3a6 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java @@ -2750,26 +2750,29 @@ public class OrderStatService { row.createCell(a++).setCellValue("序号"); row.createCell(a++).setCellValue("客户名称"); row.createCell(a++).setCellValue("总预售金额(元)"); - row.createCell(a++).setCellValue("已提货金额(元)"); + row.createCell(a++).setCellValue("总提货金额(元)"); + row.createCell(a++).setCellValue("总提货量(吨)"); Row row2 = sheet.createRow(1); - int a2 = 4; + int a2 = 5; for (int i = 0; i < sups.size(); i++) { Record s = sups.get(i); row.createCell(a).setCellValue(s.getStr("name")); - sheet.addMergedRegion(new CellRangeAddress(0, 0, a, a + 1)); - a += 2; + sheet.addMergedRegion(new CellRangeAddress(0, 0, a, a + 2)); + a += 3; row2.createCell(a2++).setCellValue("预售金额(元)"); row2.createCell(a2++).setCellValue("已提货金额(元)"); + row2.createCell(a2++).setCellValue("已提货量(吨)"); } sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0)); sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1)); sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2)); sheet.addMergedRegion(new CellRangeAddress(0, 1, 3, 3)); + sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4)); int datalen = list.size(); int colcnt = a; @@ -2784,10 +2787,12 @@ public class OrderStatService { int b = 2; row.createCell(b++).setCellValue(DataUtil.getDefaultByRecord(rec, "total_presell_amount")); row.createCell(b++).setCellValue(DataUtil.getDefaultByRecord(rec, "total_presell_pug")); + row.createCell(b++).setCellValue(DataUtil.getDefaultByRecord(rec, "total_weight")); for (Record s : sups) { row.createCell(b++).setCellValue(DataUtil.getDefaultByRecord(rec, "xsl_" + s.getInt("id"))); row.createCell(b++).setCellValue(DataUtil.getDefaultByRecord(rec, "xse_" + s.getInt("id"))); + row.createCell(b++).setCellValue(DataUtil.getDefaultByRecord(rec, "xsw_" + s.getInt("id"))); } } @@ -2866,6 +2871,7 @@ public class OrderStatService { " g.customer_id,\n" + " ifnull(sum(g.presell_amount), 0) total_presell_amount,\n" + " ifnull(sum(g.pug_amount), 0) total_presell_pug,\n" + + " ifnull(sum(g.weight), 0) total_weight,\n" + " ifnull(sum(case when g.supermarket_id = 1 or g.supermarket_id = 7 then g.presell_amount end), 0) xsl_1,\n" + " ifnull(sum(case when g.supermarket_id = 2 then g.presell_amount end), 0) xsl_2,\n" + " ifnull(sum(case when g.supermarket_id = 3 then g.presell_amount end), 0) xsl_3,\n" + @@ -2879,17 +2885,24 @@ public class OrderStatService { " ifnull(sum(case when g.supermarket_id = 4 then g.pug_amount end), 0) xse_4,\n" + " ifnull(sum(case when g.supermarket_id = 5 or g.supermarket_id = 9 then g.pug_amount end), 0) xse_5,\n" + " ifnull(sum(case when g.supermarket_id = 6 or g.supermarket_id = 8 or g.supermarket_id = 10 then g.pug_amount end), 0) xse_6,\n" + - " ifnull(sum(case when g.supermarket_id = 11 then g.pug_amount end), 0) xse_11\n" + + " ifnull(sum(case when g.supermarket_id = 11 then g.pug_amount end), 0) xse_11, \n" + + " ifnull(sum(case when g.supermarket_id = 1 or g.supermarket_id = 7 then g.weight end), 0) xsw_1,\n" + + " ifnull(sum(case when g.supermarket_id = 2 then g.weight end), 0) xsw_2,\n" + + " ifnull(sum(case when g.supermarket_id = 3 then g.weight end), 0) xsw_3,\n" + + " ifnull(sum(case when g.supermarket_id = 4 then g.weight end), 0) xsw_4,\n" + + " ifnull(sum(case when g.supermarket_id = 5 or g.supermarket_id = 9 then g.weight end), 0) xsw_5,\n" + + " ifnull(sum(case when g.supermarket_id = 6 or g.supermarket_id = 8 or g.supermarket_id = 10 then g.weight end), 0) xsw_6,\n" + + " ifnull(sum(case when g.supermarket_id = 11 then g.weight end), 0) xsw_11\n" + " from (\n" + - " select a.customer_id, a.supermarket_id, sum(a.presell_amount) presell_amount, sum(a.pug_amount) pug_amount from (\n" + - " select t.customer_id, t.supermarket_id, sum(t.presell_amount) presell_amount, 0 pug_amount from presell_order t\n" + + " select a.customer_id, a.supermarket_id, sum(a.presell_amount) presell_amount, sum(a.pug_amount) pug_amount, sum(a.weight) weight from (\n" + + " select t.customer_id, t.supermarket_id, sum(t.presell_amount) presell_amount, 0 pug_amount, 0 weight from presell_order t\n" + " where t.del = 0\n" + paramsSql + " group by t.customer_id, t.supermarket_id\n" + " \n" + " union\n" + " \n" + - " select t.customer_id, t.supermarket_id, 0 presell_amount, sum(t.total_price) pug_amount from order_temp t\n" + + " select t.customer_id, t.supermarket_id, 0 presell_amount, sum(t.total_price) pug_amount, sum(t.weight) weight from order_temp t\n" + " left join ordercluster c on c.id = t.ordercluster_id\n" + " left join presell_order p on p.id = c.presell_order_id\n" + " where t.sale_type = 1\n" + @@ -2905,6 +2918,7 @@ public class OrderStatService { List ret = new ArrayList<>(); double all_total_presell_amount = 0.0; double all_total_presell_pug = 0.0; + double all_total_weight = 0.0; double all_xsl_1 = 0.0; double all_xsl_2 = 0.0; double all_xsl_3 = 0.0; @@ -2919,12 +2933,20 @@ public class OrderStatService { double all_xse_5 = 0.0; double all_xse_6 = 0.0; double all_xse_11 = 0.0; + double all_xsw_1 = 0.0; + double all_xsw_2 = 0.0; + double all_xsw_3 = 0.0; + double all_xsw_4 = 0.0; + double all_xsw_5 = 0.0; + double all_xsw_6 = 0.0; + double all_xsw_11 = 0.0; for (int i = 0; i < list.size(); i++) { Record r = list.get(i); String name = r.getStr("name"); double total_presell_amount = DataUtil.getDefaultByRecord(r, "total_presell_amount"); double total_presell_pug = DataUtil.getDefaultByRecord(r, "total_presell_pug"); + double total_weight = DataUtil.getDefaultByRecord(r, "total_weight"); double xsl_1 = DataUtil.getDefaultByRecord(r, "xsl_1"); double xsl_2 = DataUtil.getDefaultByRecord(r, "xsl_2"); double xsl_3 = DataUtil.getDefaultByRecord(r, "xsl_3"); @@ -2939,12 +2961,20 @@ public class OrderStatService { double xse_5 = DataUtil.getDefaultByRecord(r, "xse_5"); double xse_6 = DataUtil.getDefaultByRecord(r, "xse_6"); double xse_11 = DataUtil.getDefaultByRecord(r, "xse_11"); + double xsw_1 = DataUtil.getDefaultByRecord(r, "xsw_1"); + double xsw_2 = DataUtil.getDefaultByRecord(r, "xsw_2"); + double xsw_3 = DataUtil.getDefaultByRecord(r, "xsw_3"); + double xsw_4 = DataUtil.getDefaultByRecord(r, "xsw_4"); + double xsw_5 = DataUtil.getDefaultByRecord(r, "xsw_5"); + double xsw_6 = DataUtil.getDefaultByRecord(r, "xsw_6"); + double xsw_11 = DataUtil.getDefaultByRecord(r, "xsw_11"); Record rec = new Record(); rec.set("inx", i + 1); rec.set("name", name); rec.set("total_presell_amount", total_presell_amount); rec.set("total_presell_pug", total_presell_pug); + rec.set("total_weight", total_weight); rec.set("xsl_1", xsl_1); rec.set("xsl_2", xsl_2); rec.set("xsl_3", xsl_3); @@ -2959,11 +2989,19 @@ public class OrderStatService { rec.set("xse_5", xse_5); rec.set("xse_6", xse_6); rec.set("xse_11", xse_11); + rec.set("xsw_1", xsw_1); + rec.set("xsw_2", xsw_2); + rec.set("xsw_3", xsw_3); + rec.set("xsw_4", xsw_4); + rec.set("xsw_5", xsw_5); + rec.set("xsw_6", xsw_6); + rec.set("xsw_11", xsw_11); ret.add(rec); all_total_presell_amount += total_presell_amount; all_total_presell_pug += total_presell_pug; + all_total_weight += total_weight; all_xsl_1 += xsl_1; all_xsl_2 += xsl_2; all_xsl_3 += xsl_3; @@ -2978,6 +3016,13 @@ public class OrderStatService { all_xse_5 += xse_5; all_xse_6 += xse_6; all_xse_11 += xse_11; + all_xsw_1 += xsw_1; + all_xsw_2 += xsw_2; + all_xsw_3 += xsw_3; + all_xsw_4 += xsw_4; + all_xsw_5 += xsw_5; + all_xsw_6 += xsw_6; + all_xsw_11 += xsw_11; } Record r = new Record(); @@ -2985,6 +3030,7 @@ public class OrderStatService { r.set("name", "合计"); r.set("total_presell_amount", all_total_presell_amount); r.set("total_presell_pug", all_total_presell_pug); + r.set("total_weight", all_total_weight); r.set("xsl_1", all_xsl_1); r.set("xsl_2", all_xsl_2); r.set("xsl_3", all_xsl_3); @@ -2999,6 +3045,13 @@ public class OrderStatService { r.set("xse_5", all_xse_5); r.set("xse_6", all_xse_6); r.set("xse_11", all_xse_11); + r.set("xsw_1", all_xsw_1); + r.set("xsw_2", all_xsw_2); + r.set("xsw_3", all_xsw_3); + r.set("xsw_4", all_xsw_4); + r.set("xsw_5", all_xsw_5); + r.set("xsw_6", all_xsw_6); + r.set("xsw_11", all_xsw_11); ret.add(r);