diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/PrepayService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/PrepayService.java index d841993..b4c4323 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/PrepayService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/PrepayService.java @@ -1,15 +1,13 @@ package com.cowr.ssjygl.prepay; +import com.cowr.common.Const; +import com.cowr.common.enums.OrderStateEnum; import com.cowr.common.enums.OrderTypeEnum; +import com.cowr.common.utils.DataUtil; import com.cowr.common.utils.DateTimeUtil; +import com.cowr.common.view.PageParam; import com.cowr.model.*; import com.cowr.ssjygl.CacheData; -import com.cowr.common.Const; -import com.cowr.common.utils.DataUtil; -import com.cowr.common.view.PageParam; -import com.cowr.common.enums.OrderStateEnum; -import com.cowr.ssjygl.customer.receiver.CustomerReceiverService; -import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService; import com.cowr.ssjygl.prepay.prepaycustomer.PrepayCustomerService; import com.cowr.ssjygl.prepay.refunddetail.RefundDetailService; import com.jfinal.kit.StrKit; @@ -165,9 +163,10 @@ public class PrepayService { * @param etm * @return */ - public List consumption(Integer customer_id, Integer supermarket_id, String stm, String etm, String truck_license,Integer invoice_type) { + public List consumption(Integer customer_id, Integer customer_type_id, Integer supermarket_id, String stm, String etm, String truck_license, Integer invoice_type) { String temp_sql = " select t.sn, t.supermarket_id, t.truck_license, t.weight, t.total_price, t.paid, t.customer_id, t.customer_name, t.create_time \n" + " from order_temp t \n" + + " left join customer c on c.id = t.customer_id \n" + " where t.state = ? \n" + " and t.isprepaid = 1 \n" + " and t.prepay_customer_id is not null \n" + @@ -193,6 +192,9 @@ public class PrepayService { if (customer_id != null && customer_id > 0) { temp_sql += " and t.customer_id = ? \n"; tempList.add(customer_id); + } else if (customer_type_id != null) { + temp_sql += " and c.customer_type_id = ? \n"; + tempList.add(customer_type_id); } if (StrKit.notBlank(truck_license)) { @@ -225,7 +227,7 @@ public class PrepayService { return Db.find(sql, paraList.toArray()); } - public Workbook consumptionExport(Integer customer_id, Integer supermarket_id, String stm, String etm, String truck_license,Integer invoice_type) { + public Workbook consumptionExport(Integer customer_id, Integer customer_type_id, Integer supermarket_id, String stm, String etm, String truck_license, Integer invoice_type) { Customer customer = Customer.dao.findById(customer_id); String cname = ""; @@ -233,7 +235,7 @@ public class PrepayService { cname = customer.getName(); } - List list = consumption(customer_id, supermarket_id, stm, etm, truck_license,invoice_type); + List list = consumption(customer_id, customer_type_id, supermarket_id, stm, etm, truck_license, invoice_type); list.sort(new Comparator() { public int compare(Record o1, Record o2) { @@ -463,13 +465,9 @@ public class PrepayService { if (customer_id != null && customer_id > 0) { sql += " and b.customer_id = ? \n"; paraList.add(customer_id); - } else { - if (customer_type_id != null && customer_type_id >= 0 && customer_type_id != 99) { - sql += " and b.customer_type_id = ? \n"; - paraList.add(customer_id); - } else if (customer_type_id != null && customer_type_id == 99) { // 散户 - sql += " and b.customer_id is null \n"; - } + } else if (customer_type_id != null) { + sql += " and b.customer_type_id = ? \n"; + paraList.add(customer_type_id); } sql += " order by b.tm desc"; diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/prepaydetail/PrepayDetailService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/prepaydetail/PrepayDetailService.java index ee914b8..0f9e65f 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/prepaydetail/PrepayDetailService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/prepay/prepaydetail/PrepayDetailService.java @@ -1,12 +1,12 @@ package com.cowr.ssjygl.prepay.prepaydetail; -import com.cowr.ssjygl.CacheData; import com.cowr.common.Const; import com.cowr.common.base.BaseService; import com.cowr.common.utils.DataUtil; import com.cowr.common.view.PageParam; import com.cowr.model.Customer; import com.cowr.model.PrepayDetail; +import com.cowr.ssjygl.CacheData; import com.jfinal.kit.StrKit; import com.jfinal.log.Log; import com.jfinal.plugin.activerecord.Db; @@ -107,7 +107,7 @@ public class PrepayDetailService extends BaseService { return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray()); } - public List list(Integer customer_id, String stm, String etm) { + public List list(Integer customer_id, Integer customer_type_id, String stm, String etm) { if (customer_id != null) { return Db.find("select t.*, c.name customer_name from prepay_detail t \n" + " left join customer c on c.id = t.customer_id" + @@ -116,15 +116,23 @@ public class PrepayDetailService extends BaseService { " and t.verify_time >= ? \n" + " and t.verify_time <= ? ", customer_id, stm, etm); } else { - return Db.find("select t.*, c.name customer_name from prepay_detail t \n" + + String sql = "select t.*, c.name customer_name from prepay_detail t \n" + " left join customer c on c.id = t.customer_id" + " where t.state = 2 \n" + " and t.verify_time >= ? \n" + - " and t.verify_time <= ? ", stm, etm); + " and t.verify_time <= ? "; + List paraList = new ArrayList<>(); + paraList.add(stm); + paraList.add(etm); + if (customer_type_id != null) { + sql += " and c.customer_type_id = ? "; + paraList.add(customer_type_id); + } + return Db.find(sql, paraList.toArray()); } } - public Workbook listExport(Integer customer_id, String stm, String etm) { + public Workbook listExport(Integer customer_id, Integer customer_type_id, String stm, String etm) { Customer customer = Customer.dao.findById(customer_id); String cname = ""; @@ -132,7 +140,7 @@ public class PrepayDetailService extends BaseService { cname = customer.getName(); } - List list = list(customer_id, stm, etm); + List list = list(customer_id, customer_type_id, stm, etm); list.sort(new Comparator() { public int compare(Record o1, Record o2) { diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java index 098424b..8ff67e3 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/customer/CustomerStatService.java @@ -2,7 +2,6 @@ package com.cowr.ssjygl.stat.customer; import com.cowr.common.utils.DataUtil; import com.cowr.common.view.ReportExcelStyle; -import com.jfinal.kit.StrKit; import com.jfinal.log.Log; import com.jfinal.plugin.activerecord.Db; import com.jfinal.plugin.activerecord.Record; @@ -25,68 +24,38 @@ public class CustomerStatService { * @param customer_id * @return */ - public List checkAccount(String tm, Integer customer_id, Boolean stat_product, Integer product_id) { - String querytm = tm + " 23:59:59"; - String sql; - String fromSql; - String tempSql; - String productSql = ""; - String customerSql= ""; - List paraList = new ArrayList<>(); + public List checkAccount(String tm, Integer customer_id, Integer customer_type_id) { + String querytm = tm + " 23:59:59"; + String sql; + String fromSql; + String tempSql; + String customerSql = ""; + List paraList = new ArrayList<>(); - if (stat_product) { - fromSql = "select t.customer_id id,\n" + - " c.`name`,\n" + - " t.surplus,\n" + - " a.total_price,\n" + - " a.total_weight,\n" + - " a.total_cnt,\n" + - " b.amount,\n" + - " b.refund_amount,\n" + - " b.amount - ifnull(a.total_price,0) - b.refund_amount then_surplus,a.product_id,a.product_name\n"; - if (customer_id != null) { - customerSql= " and t.customer_id = ? \n"; - } - if (product_id != null && product_id > 0) { - productSql = " and t.product_id=? "; - } - tempSql = " select t.customer_id, sum(t.total_price) total_price, sum(t.weight) total_weight, count(t.sn) total_cnt,t.product_id,t.product_name\n" + - " from order_temp t\n" + - " where t.customer_id is not null\n" + - " and t.create_time <= ? \n" + - " and t.state = 5\n" + - customerSql + - productSql + - " group by t.customer_id,t.product_id,t.product_name\n"; - - - } else { - if (customer_id != null) { - customerSql= " and t.customer_id = ? \n"; - } - fromSql = "select t.customer_id id,\n" + - " c.`name`,\n" + - " t.surplus,\n" + - " a.total_price,\n" + - " a.total_weight,\n" + - " a.total_cnt,\n" + - " b.amount,\n" + - " b.refund_amount,\n" + - " b.amount - ifnull(a.total_price,0) - b.refund_amount then_surplus\n"; - tempSql = " select t.customer_id, sum(t.total_price) total_price, sum(t.weight) total_weight, count(t.sn) total_cnt\n" + - " from order_temp t\n" + - " where t.customer_id is not null\n" + - " and t.create_time <= ? \n" + - " and t.state = 5\n" + - customerSql + - " group by t.customer_id\n"; + if (customer_id != null) { + customerSql = " and t.customer_id = ? \n"; } + + fromSql = "select t.customer_id id,\n" + + " c.`name`,\n" + + " t.surplus,\n" + + " a.total_price,\n" + + " a.total_weight,\n" + + " a.total_cnt,\n" + + " b.amount,\n" + + " b.refund_amount,\n" + + " b.amount - ifnull(a.total_price,0) - b.refund_amount then_surplus\n"; + tempSql = " select t.customer_id, sum(t.total_price) total_price, sum(t.weight) total_weight, count(t.sn) total_cnt\n" + + " from order_temp t\n" + + " where t.customer_id is not null\n" + + " and t.create_time <= ? \n" + + " and t.state = 5\n" + + customerSql + + " group by t.customer_id\n"; + if (customer_id != null) { paraList.add(querytm); paraList.add(customer_id); - if (stat_product&&product_id != null && product_id > 0) { - paraList.add(product_id); - } paraList.add(querytm); paraList.add(customer_id); paraList.add(querytm); @@ -97,7 +66,7 @@ public class CustomerStatService { " from prepay_customer t\n" + " left join customer c on c.id= t.customer_id\n" + " join(\n" + - tempSql+ + tempSql + " ) a on a.customer_id = t.customer_id\n" + " left join(\n" + " select a.customer_id, a.amount, ifnull(b.amount, 0) refund_amount\n" + @@ -129,17 +98,12 @@ public class CustomerStatService { return Db.find(sql, paraList.toArray()); } else { paraList.add(querytm); - if (stat_product&&product_id != null && product_id > 0) { - paraList.add(product_id); - } paraList.add(querytm); paraList.add(querytm); sql = fromSql + " from prepay_customer t\n" + " left join customer c on c.id= t.customer_id\n" + - " join(\n" + - tempSql+ - " ) a on a.customer_id = t.customer_id\n" + + " join (\n" + tempSql + " ) a on a.customer_id = t.customer_id\n" + " left join(\n" + " select a.customer_id, a.amount, ifnull(b.amount, 0) refund_amount\n" + " from(\n" + @@ -161,28 +125,30 @@ public class CustomerStatService { " and a.confirm_time <= ?\n" + " group by t.customer_id\n" + " ) b on b.customer_id= a.customer_id\n" + - " ) b on b.customer_id= t.customer_id\n" + - " order by t.customer_id"; + " ) b on b.customer_id= t.customer_id\n"; + + if (customer_type_id != null) { // 客户对账不管临散订单 + sql += " where c.customer_type_id = ? \n"; + paraList.add(customer_type_id); + } + + sql += " order by t.customer_id"; return Db.find(sql, paraList.toArray()); } } - public Workbook checkAccountExport(String tm, Integer customer_id, Boolean stat_product, Integer product_id) { - List list = checkAccount(tm, customer_id,stat_product,product_id); + public Workbook checkAccountExport(String tm, Integer customer_id, Integer customer_type_id) { + List list = checkAccount(tm, customer_id, customer_type_id); - Workbook wb = new XSSFWorkbook(); - Sheet sheet = wb.createSheet(tm + " 客户对账统计"); + Workbook wb = new XSSFWorkbook(); + Sheet sheet = wb.createSheet(tm + " 客户对账统计"); // 表头 start - Row row = sheet.createRow(0); - int a = 0; + Row row = sheet.createRow(0); + int a = 0; int end_col = 8; row.createCell(a++).setCellValue("序号"); - if (stat_product) { - row.createCell(a++).setCellValue("品类"); - end_col=9; - } row.createCell(a++).setCellValue("客户"); row.createCell(a++).setCellValue("余额"); row.createCell(a++).setCellValue("累计充值"); @@ -197,12 +163,9 @@ public class CustomerStatService { for (int i = 0; i < datalen; i++) { Record record = list.get(i); row = sheet.createRow(i + 1); - a = 0; + a = 0; row.createCell(a++).setCellValue(i + 1); - if (stat_product) { - row.createCell(a++).setCellValue(record.getStr("product_name")); - } row.createCell(a++).setCellValue(record.getStr("name")); row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "then_surplus")); row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "amount")); @@ -212,7 +175,7 @@ public class CustomerStatService { row.createCell(a++).setCellValue(record.getStr("total_cnt")); } - ReportExcelStyle.setCommonCellStyle(wb, sheet, datalen-1, end_col); + ReportExcelStyle.setCommonCellStyle(wb, sheet, datalen - 1, end_col); return wb; } 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 0c8a8d2..ef3b1f8 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 @@ -1853,13 +1853,14 @@ 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.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 = 7; + int a2 = 8; for (Supermarket s : sups) { row.createCell(a).setCellValue(s.getName()); @@ -1877,6 +1878,7 @@ public class OrderStatService { sheet.addMergedRegion(new CellRangeAddress(0, 1, 4, 4)); sheet.addMergedRegion(new CellRangeAddress(0, 1, 5, 5)); sheet.addMergedRegion(new CellRangeAddress(0, 1, 6, 6)); + sheet.addMergedRegion(new CellRangeAddress(0, 1, 7, 7)); int datalen = list.size(); int colcnt = a; @@ -1905,10 +1907,11 @@ public class OrderStatService { row.createCell(a++).setCellValue(c + 1); row.createCell(a++).setCellValue(record.getStr("customer_type_name")); row.createCell(a++).setCellValue(record.getStr("customer_name")); + row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "prepay_total_amount")); row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "weight")); row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "total_price")); - row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "prepay_total_amount")); row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "prepay_surplus")); + row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "refund_total_amount")); for (Supermarket s : sups) { row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(record, "xsl_" + s.getId())); @@ -2021,7 +2024,8 @@ public class OrderStatService { " tp.name customer_type_name,\n" + " c.name customer_name,\n" + " c.name,\n" + - " a.total_amount prepay_total_amount,\n" + + " a.total_amount prepay_total_amount, \n" + + " b.total_amount refund_total_amount, \n" + " p.surplus prepay_surplus\n" + " from customer c \n" + " left join ( \n" + @@ -2029,12 +2033,26 @@ public class OrderStatService { " where t.state = 2 \n" + " and t.verify_time > ? \n" + " group by t.customer_id \n" + - " ) a on c.id = a.customer_id \n" + + " ) a on c.id = a.customer_id \n\n" + + " left join (\n" + + " select t.customer_id, sum(t.amount) total_amount from refund_detail t \n" + + " where t.state = 3 \n" + + " and t.verify_time > ? \n" + + " group by t.customer_id\n" + + " ) b on c.id = b.customer_id " + " left join customer_type tp on tp.id = c.customer_type_id\n" + " left join prepay_customer p on p.customer_id = c.id\n" + " where " + cidsql + " a.customer_id is not null \n" + // 查询时间段内有购砂、起始时间年内有充值的 " union\n" + - " select 0 customer_id, 99 customer_type_id, '零散' customer_type_name, '零散客户' customer_name, '零散客户' name, null prepay_total_amount, null prepay_surplus", tm); + " select " + + " 0 customer_id, " + + " 99 customer_type_id, " + + " '零散' customer_type_name, " + + " '零散客户' customer_name, " + + " '零散客户' name, " + + " null prepay_total_amount, " + + " null refund_total_amount, " + + " null prepay_surplus ", tm, tm); customer_pre_list.sort(new Comparator() { @Override @@ -2081,6 +2099,7 @@ public class OrderStatService { record.set("children", list); double prepay_total_amount = 0.0; + double refund_total_amount = 0.0; double prepay_surplus = 0.0; double weight = 0.0; double total_price = 0.0; @@ -2098,25 +2117,27 @@ public class OrderStatService { double xse_6 = 0.0; for (Record r : list) { - prepay_total_amount = DataUtil.getDefaultByRecord(r, "prepay_total_amount"); - prepay_surplus = DataUtil.getDefaultByRecord(r, "prepay_surplus"); - weight = DataUtil.getDefaultByRecord(r, "weight"); - total_price = DataUtil.getDefaultByRecord(r, "total_price"); - xsl_1 = DataUtil.getDefaultByRecord(r, "xsl_1"); - xsl_2 = DataUtil.getDefaultByRecord(r, "xsl_2"); - xsl_3 = DataUtil.getDefaultByRecord(r, "xsl_3"); - xsl_4 = DataUtil.getDefaultByRecord(r, "xsl_4"); - xsl_5 = DataUtil.getDefaultByRecord(r, "xsl_5"); - xsl_6 = DataUtil.getDefaultByRecord(r, "xsl_6"); - xse_1 = DataUtil.getDefaultByRecord(r, "xse_1"); - xse_2 = DataUtil.getDefaultByRecord(r, "xse_2"); - xse_3 = DataUtil.getDefaultByRecord(r, "xse_3"); - xse_4 = DataUtil.getDefaultByRecord(r, "xse_4"); - xse_5 = DataUtil.getDefaultByRecord(r, "xse_5"); - xse_6 = DataUtil.getDefaultByRecord(r, "xse_6"); + prepay_total_amount += DataUtil.getDefaultByRecord(r, "prepay_total_amount"); + refund_total_amount += DataUtil.getDefaultByRecord(r, "refund_total_amount"); + prepay_surplus += DataUtil.getDefaultByRecord(r, "prepay_surplus"); + weight += DataUtil.getDefaultByRecord(r, "weight"); + total_price += DataUtil.getDefaultByRecord(r, "total_price"); + xsl_1 += DataUtil.getDefaultByRecord(r, "xsl_1"); + xsl_2 += DataUtil.getDefaultByRecord(r, "xsl_2"); + xsl_3 += DataUtil.getDefaultByRecord(r, "xsl_3"); + xsl_4 += DataUtil.getDefaultByRecord(r, "xsl_4"); + xsl_5 += DataUtil.getDefaultByRecord(r, "xsl_5"); + xsl_6 += DataUtil.getDefaultByRecord(r, "xsl_6"); + xse_1 += DataUtil.getDefaultByRecord(r, "xse_1"); + xse_2 += DataUtil.getDefaultByRecord(r, "xse_2"); + xse_3 += DataUtil.getDefaultByRecord(r, "xse_3"); + xse_4 += DataUtil.getDefaultByRecord(r, "xse_4"); + xse_5 += DataUtil.getDefaultByRecord(r, "xse_5"); + xse_6 += DataUtil.getDefaultByRecord(r, "xse_6"); } record.set("prepay_total_amount", prepay_total_amount); + record.set("refund_total_amount", refund_total_amount); record.set("prepay_surplus", prepay_surplus); record.set("weight", weight); record.set("total_price", total_price); @@ -2155,42 +2176,42 @@ public class OrderStatService { paramsSql = "and t.invoice_type = ?\n"; } String sql = "select\n" + - "\tg.customer_id,\n" + - "\tifnull(c.name, '零散用户') customer_name,\n" + - "\tifnull(sum(g.weight), 0) weight,\n" + - "\tifnull(sum(g.total_price), 0) total_price,\n" + - "\tifnull(sum(case g.supermarket_id when 1 then g.weight end), 0) zw_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 2 then g.weight end), 0) tp_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 3 then g.weight end), 0) sc_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 4 then g.weight end), 0) sb_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 5 then g.weight end), 0) jr_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 6 then g.weight end), 0) yg_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 7 then g.weight end), 0) zwsc_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 8 then g.weight end), 0) ya_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 9 then g.weight end), 0) sl_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 10 then g.weight end), 0) hdw_xsl,\n" + - "\tifnull(sum(case g.supermarket_id when 1 then g.total_price end), 0) zw_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 2 then g.total_price end), 0) tp_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 3 then g.total_price end), 0) sc_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 4 then g.total_price end), 0) sb_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 5 then g.total_price end), 0) jr_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 6 then g.total_price end), 0) yg_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 7 then g.total_price end), 0) zwsc_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 8 then g.total_price end), 0) ya_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 9 then g.total_price end), 0) sl_xse,\n" + - "\tifnull(sum(case g.supermarket_id when 10 then g.total_price end), 0) hdw_xse\n" + + " g.customer_id,\n" + + " ifnull(c.name, '零散用户') customer_name,\n" + + " ifnull(sum(g.weight), 0) weight,\n" + + " ifnull(sum(g.total_price), 0) total_price,\n" + + " ifnull(sum(case g.supermarket_id when 1 then g.weight end), 0) zw_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 2 then g.weight end), 0) tp_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 3 then g.weight end), 0) sc_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 4 then g.weight end), 0) sb_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 5 then g.weight end), 0) jr_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 6 then g.weight end), 0) yg_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 7 then g.weight end), 0) zwsc_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 8 then g.weight end), 0) ya_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 9 then g.weight end), 0) sl_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 10 then g.weight end), 0) hdw_xsl,\n" + + " ifnull(sum(case g.supermarket_id when 1 then g.total_price end), 0) zw_xse,\n" + + " ifnull(sum(case g.supermarket_id when 2 then g.total_price end), 0) tp_xse,\n" + + " ifnull(sum(case g.supermarket_id when 3 then g.total_price end), 0) sc_xse,\n" + + " ifnull(sum(case g.supermarket_id when 4 then g.total_price end), 0) sb_xse,\n" + + " ifnull(sum(case g.supermarket_id when 5 then g.total_price end), 0) jr_xse,\n" + + " ifnull(sum(case g.supermarket_id when 6 then g.total_price end), 0) yg_xse,\n" + + " ifnull(sum(case g.supermarket_id when 7 then g.total_price end), 0) zwsc_xse,\n" + + " ifnull(sum(case g.supermarket_id when 8 then g.total_price end), 0) ya_xse,\n" + + " ifnull(sum(case g.supermarket_id when 9 then g.total_price end), 0) sl_xse,\n" + + " ifnull(sum(case g.supermarket_id when 10 then g.total_price end), 0) hdw_xse\n" + "from (\n" + - "\tselect\n" + - "\t\tifnull(t.customer_id, 0) customer_id,\n" + - "\t\tt.supermarket_id,\n" + - "\t\tifnull(sum(t.weight), 0) weight,\n" + - "\t\tifnull(sum(t.total_price), 0) total_price\n" + - "\tfrom order_temp t\n" + - "\twhere t.state = 5\n" + - "\tand t.create_time >= ?\n" + - "\tand t.create_time <= ?\n" + + " select\n" + + " ifnull(t.customer_id, 0) customer_id,\n" + + " t.supermarket_id,\n" + + " ifnull(sum(t.weight), 0) weight,\n" + + " ifnull(sum(t.total_price), 0) total_price\n" + + " from order_temp t\n" + + " where t.state = 5\n" + + " and t.create_time >= ?\n" + + " and t.create_time <= ?\n" + paramsSql + - "\tgroup by t.customer_id, t.supermarket_id\n" + + " group by t.customer_id, t.supermarket_id\n" + ") g\n" + "left join customer c on c.id = g.customer_id\n" + "group by g.customer_id"; diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/transport/TransportService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/transport/TransportService.java index 7d26614..4ff8b3c 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/transport/TransportService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/transport/TransportService.java @@ -3,14 +3,17 @@ package com.cowr.ssjygl.transport; import com.cowr.common.Const; import com.cowr.common.base.BaseService; import com.cowr.common.enums.OrderStateEnum; +import com.cowr.common.utils.DateTimeUtil; import com.cowr.common.view.PageParam; -import com.cowr.model.*; +import com.cowr.model.Transport; import com.jfinal.kit.StrKit; import com.jfinal.plugin.activerecord.Db; import com.jfinal.plugin.activerecord.Page; import com.jfinal.plugin.activerecord.Record; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; /** * Generated by COWR Sun Apr 12 21:56:13 CST 2020 @@ -119,19 +122,23 @@ public class TransportService extends BaseService { * @return */ public List inSupermarket(int supermarket_id) { - String sql = "SELECT\n" + - " t.*, t.id transport_id\n" + - "FROM\n" + - " `transport` t\n" + - "WHERE\n" + - " t.state < ?\n" + - "AND t.supermarket_id = ?\n" + - "GROUP BY\n" + - " t.truck_license\n" + - "ORDER BY\n" + - " t.out_time DESC"; + String today = DateTimeUtil.sdf.get().format(new Date()); + String sql = "select t.*, t.id transport_id, a.ordercluster_id, c.customer_id, c.customer_name, c.req_receipt from transport t\n" + + " left join (\n" + + " select t.truck_license, t.ordercluster_id from (\n" + + " select t.truck_license, max(c.id) ordercluster_id from ordercluster_truck t\n" + + " left join ordercluster c on t.ordercluster_id = c.id\n" + + " where c.start_time <= ? \n" + + " and c.cutoff_time >= ? \n" + + " group by t.truck_license\n" + + " ) t\n" + + " ) a on a.truck_license = t.truck_license\n" + + " left join ordercluster c on a.ordercluster_id = c.id\n" + + " where t.state < 5\n" + + " and t.supermarket_id = ? \n" + + " order by t.flag, t.out_time desc "; - return Db.find(sql, OrderStateEnum.RECEIVED.getStateid(), supermarket_id); + return Db.find(sql, today + " 23:59:59", today + " 00:00:00", supermarket_id); } /** diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/PrepayController.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/PrepayController.java index 4320eff..9ec4924 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/PrepayController.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/PrepayController.java @@ -26,15 +26,16 @@ public class PrepayController extends BaseController { public void consumption() { int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出 Integer customer_id = getInt("customer_id"); + Integer customer_type_id = getInt("customer_type_id"); Integer supermarket_id = getInt("supermarket_id"); String stm = get("stm"); String etm = get("etm"); String truck_license = get("truck_license"); Integer invoice_type = getInt("invoice_type"); if (export == 0) { - renderJson(Result.success(PrepayService.me.consumption(customer_id, supermarket_id, stm, etm, truck_license,invoice_type))); + renderJson(Result.success(PrepayService.me.consumption(customer_id, customer_type_id, supermarket_id, stm, etm, truck_license,invoice_type))); } else { - Workbook wb = PrepayService.me.consumptionExport(customer_id, supermarket_id, stm, etm, truck_license,invoice_type); + Workbook wb = PrepayService.me.consumptionExport(customer_id, customer_type_id, supermarket_id, stm, etm, truck_license,invoice_type); render(new ExcelRender("消费记录_" + System.currentTimeMillis() + ".xlsx", wb)); } } @@ -62,13 +63,14 @@ public class PrepayController extends BaseController { public void prepaydetail() { int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出 Integer customer_id = getInt("customer_id"); + Integer customer_type_id = getInt("customer_type_id"); String stm = get("stm"); String etm = get("etm"); if (export == 0) { - renderJson(Result.object(PrepayDetailService.me.list(customer_id, stm, etm))); + renderJson(Result.object(PrepayDetailService.me.list(customer_id, customer_type_id, stm, etm))); } else { - Workbook wb = PrepayDetailService.me.listExport(customer_id, stm, etm); + Workbook wb = PrepayDetailService.me.listExport(customer_id, customer_type_id, stm, etm); render(new ExcelRender("付费详情_" + System.currentTimeMillis() + ".xlsx", wb)); } } diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/prepaydetail/PrepayDetailController.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/prepaydetail/PrepayDetailController.java index 7bc9cc9..aebadec 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/prepaydetail/PrepayDetailController.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/prepay/prepaydetail/PrepayDetailController.java @@ -69,13 +69,14 @@ public class PrepayDetailController extends Controller { public void list() { int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出 int customer_id = getInt("customer_id", 0); + Integer customer_type_id = getInt("customer_type_id"); String stm = get("stm"); String etm = get("etm"); if (export == 0) { - renderJson(Result.object(PrepayDetailService.me.list(customer_id, stm, etm))); + renderJson(Result.object(PrepayDetailService.me.list(customer_id, customer_type_id, stm, etm))); } else { - Workbook wb = PrepayDetailService.me.listExport(customer_id, stm, etm); + Workbook wb = PrepayDetailService.me.listExport(customer_id, customer_type_id, stm, etm); render(new ExcelRender("客户流水_" + System.currentTimeMillis() + ".xlsx", wb)); } } diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportDeviceService.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportDeviceService.java index 5682ba6..f24a7ff 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportDeviceService.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportDeviceService.java @@ -237,9 +237,10 @@ public class TransportDeviceService { CliCacheData.nowLicenseMap.put(which, ""); CliCacheData.nowWeightMap.put(which, 0d); + TransportSyncService.me.updateCancelTransportState(which, truck_license, supermarket_id, sysuser); + return Config.deviceThread.cmdResetFlow(which) - && ActionCmdLogSyncService.me.save(cmdlog.toJson(), sysuser) - && TransportSyncService.me.updateCancelTransportState(which, truck_license, supermarket_id, sysuser); + && ActionCmdLogSyncService.me.save(cmdlog.toJson(), sysuser); } public boolean cmdRodUp(int num, String which, String memo, Sysuser sysuser) { diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java index a3d113c..9d86d2a 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java @@ -693,6 +693,7 @@ public class TransportSyncService { private boolean outWeigh(Transport transport, Double weight, String which) { transport.setSecondWeight(new BigDecimal(weight)); transport.setSecondWeightWhich(which); + transport.setFlag(0); SyncTask synctask = new SyncTask(); @@ -1003,6 +1004,7 @@ public class TransportSyncService { transport.setSecondWeight(new BigDecimal(weight)); transport.setSecondWeightWhich(which); + transport.setFlag(0); if (transport.getOutTime() == null) { transport.setOutTime(new Date()); @@ -1166,21 +1168,16 @@ public class TransportSyncService { // 根据车牌、超市id、当前时间大于入场时间、出厂时间不为空查出记录后将flag改为1 public boolean updateCancelTransportState(String which, String truck_license, Integer supermarket_id, Sysuser sysuser) { - String sql = "SELECT\n" + - " *\n" + - "FROM\n" + - " `transport`\n" + - "WHERE\n" + - " truck_license = ?\n" + - "AND in_which = ?\n" + - "AND supermarket_id = ?\n" + - "AND in_time < ?\n" + - "AND out_time IS NOT NULL"; + String sql = "select * from transport \n" + + " where truck_license = ?\n" + + " and state < 5 \n" + + " and out_which = ? \n" + + " and supermarket_id = ?\n" + + " and out_time is not null"; List paramsList = new ArrayList<>(); paramsList.add(truck_license); paramsList.add(which); paramsList.add(supermarket_id); - paramsList.add(DateTimeUtil.sdfhms.get().format(new Date())); Transport transport = Transport.dao.findFirst(sql, paramsList.toArray()); if (transport == null) { diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/StatSmsJob.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/StatSmsJob.java index 4e86266..cc38732 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/StatSmsJob.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/jobs/StatSmsJob.java @@ -193,6 +193,9 @@ public class StatSmsJob implements Job { /** * 累计销售汇总,含前日汇总 + * 王乐 2021-08-17 + * 四家客户2020年12月30日、31日两天的销售数据是固定值(4677.26吨、420953.4元) + * 2021年新增客户销售=2021年销售汇总 -四家客户充值金额(2000万)+四家客户2020年12月30日、31日两天的销售数据 */ public void statAggr() { Date now = new Date(); diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java index b3c718c..b93d36b 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java @@ -2,7 +2,6 @@ package com.cowr.service.ssjygl.order.ordercluster; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.cowr.common.Const; import com.cowr.common.enums.Enums; import com.cowr.common.enums.OrderStateEnum; import com.cowr.common.utils.DateTimeUtil; @@ -107,10 +106,10 @@ public class OrderclusterSyncService extends BaseSyncService { if (mini_truck < 1) { return Result.failed("最低运输车辆数错误"); } - if(max_truck<1){ + if (max_truck < 1) { return Result.failed("最高运输车辆数错误"); } - if(mini_truck>max_truck){ + if (mini_truck > max_truck) { return Result.failed("最低运输车辆不能超过最高运输车辆数错误"); } @@ -145,9 +144,9 @@ public class OrderclusterSyncService extends BaseSyncService { } // 超时在指定时间段内还有未完成的配额 - String query_start_time = DateTimeUtil.sdf.get().format(start_time); - String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time); - List undonlist = OrderclusterService.me.undonlist(supermarket_id, customer_id, query_start_time, query_cutoff_time); + String query_start_time = DateTimeUtil.sdf.get().format(start_time); + String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time); + List undonlist = OrderclusterService.me.undonlist(supermarket_id, customer_id, query_start_time, query_cutoff_time); if (undonlist != null && !undonlist.isEmpty()) { return Result.failedstr("客户[%s]在砂站[%s][%s]至[%s]内还有未完成的配额", customerObj.getName(), SvrCacheData.SUP_CACHE.get(supermarket_id).getName(), query_start_time, query_cutoff_time); @@ -183,7 +182,7 @@ public class OrderclusterSyncService extends BaseSyncService { model.setCreateUserName(sysuser.getName()); model.setState(OrderStateEnum.INITIAL.getStateid()); // 新增固定为 1 - model.setReqReceipt(1); // 固定供砂客户肯定是需要发票的,至于是普票还是专票,由客户信息决定 + model.setReqReceipt(customerObj.getInvoiceType() == 1 ? 1 : 0); // 客户是普票,这里就开发票, req_receipt 设为 1;客户是专票的,这里开结算单,req_receipt 设置为 0 model.setPayType(2); model.setUuid(StrKit.getRandomUUID()); @@ -251,7 +250,7 @@ public class OrderclusterSyncService extends BaseSyncService { Integer product_id, Sysuser sysuser ) { - String query_start_time = DateTimeUtil.sdf.get().format(start_time); + String query_start_time = DateTimeUtil.sdf.get().format(start_time); String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time); Supermarket supermarket = SvrCacheData.SUP_CACHE.get(supermarket_id); if (supermarket == null) { @@ -313,7 +312,7 @@ public class OrderclusterSyncService extends BaseSyncService { return Result.failed(StrKit.join(ts, ",") + " 车牌号在黑名单中"); } - ts.add(0, query_start_time + " 00:00:00"); + ts.add(0, query_start_time + " 00:00:00"); ts.add(0, query_cutoff_time + " 23:59:59"); List chkduk = Db.find( "select * from ordercluster_truck t \n" + @@ -546,8 +545,8 @@ public class OrderclusterSyncService extends BaseSyncService { oldobj.setTotalWeight(model.getTotalWeight()); } - String query_start_time = DateTimeUtil.sdf.get().format(oldobj.getStartTime()); - String query_cutoff_time = DateTimeUtil.sdf.get().format(oldobj.getCutoffTime()); + String query_start_time = DateTimeUtil.sdf.get().format(oldobj.getStartTime()); + String query_cutoff_time = DateTimeUtil.sdf.get().format(oldobj.getCutoffTime()); List chk = new ArrayList<>(); String[] truckarr = trucks.split(","); List ts = new ArrayList<>(); @@ -581,7 +580,7 @@ public class OrderclusterSyncService extends BaseSyncService { return Result.failed(StrKit.join(retts, ",") + " 车牌号在黑名单中"); } - ts.add(0, query_start_time + " 00:00:00"); + ts.add(0, query_start_time + " 00:00:00"); ts.add(0, query_cutoff_time + " 23:59:59"); List chkduk = Db.find( "select * from ordercluster_truck t \n" + @@ -739,7 +738,7 @@ public class OrderclusterSyncService extends BaseSyncService { return Result.failed(false, "订单已完成,不能修改"); } - BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量 + BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量 // BigDecimal surplus_weight = oldobj.getTotalWeight().subtract(overweight); // 剩余量 if (oldobj.getCustomerId() != null) { @@ -833,13 +832,22 @@ public class OrderclusterSyncService extends BaseSyncService { oldobj.setState(OrderStateEnum.INVALID.getStateid()); // 将订单状态置为 9 // TODO: 如果后面加了派车车辆,要将关联派车取消 + SyncTask synctask = new SyncTask(); + try { boolean ret = Db.tx(new IAtom() { @Override public boolean run() throws SQLException { try { - return oldobj.update() - && SyncTaskService.me.save(new SyncTask().addUpdateData(oldobj), oldobj.getSupermarketId()) + boolean ret = oldobj.update(); + + if (!ret) { + return false; + } + + synctask.addUpdateData(oldobj); + + return SyncTaskService.me.save(synctask, oldobj.getSupermarketId()) && ModifyLogService.me.save(oldobj, null, Enums.DataOpType.UPDATE.getId(), sysuser); } catch (Exception e) { log.error(e.getMessage(), e); @@ -849,6 +857,10 @@ public class OrderclusterSyncService extends BaseSyncService { } }); + if (ret) { + SyncTaskService.me.send(synctask); + } + return ret ? Result.success(oldobj) : Result.failed("修改失败"); } catch (Exception e) { log.error(e.getMessage(), e); @@ -913,13 +925,22 @@ public class OrderclusterSyncService extends BaseSyncService { oldobj.setCompleteTime(new Date()); // TODO: 如果后面加了派车车辆,要将关联派车取消 + SyncTask synctask = new SyncTask(); + try { boolean ret = Db.tx(new IAtom() { @Override public boolean run() throws SQLException { try { - return oldobj.update() - && SyncTaskService.me.save(new SyncTask().addUpdateData(oldobj), oldobj.getSupermarketId()) + boolean ret = oldobj.update(); + + if (ret) { + return false; + } + + synctask.addUpdateData(oldobj); + + return SyncTaskService.me.save(synctask, oldobj.getSupermarketId()) && ModifyLogService.me.save(oldobj, null, Enums.DataOpType.UPDATE.getId(), sysuser); } catch (Exception e) { log.error(e.getMessage(), e); @@ -929,6 +950,10 @@ public class OrderclusterSyncService extends BaseSyncService { } }); + if (ret) { + SyncTaskService.me.send(synctask); + } + return ret ? Result.success(oldobj) : Result.failed("修改失败"); } catch (Exception e) { log.error(e.getMessage(), e); @@ -937,23 +962,24 @@ public class OrderclusterSyncService extends BaseSyncService { } /** - *获取最大可购买重量 + * 获取最大可购买重量 + * * @param customer_id 客户ID - * @param unit_price 单价 + * @param unit_price 单价 * @return */ - public Map getMaximumConfiguration( int customer_id,String unit_price){ - Map result=new HashMap(); + public Map getMaximumConfiguration(int customer_id, String unit_price) { + Map result = new HashMap(); Integer count = Db.queryInt("select count(distinct s.name) from ordercluster t \n" + " join supermarket s on s.id = t.supermarket_id \n" + " where t.state<5 and t.customer_id =?", customer_id); - result.put("count",count); + result.put("count", count); //当前用户如果只在一个沙场里面买沙,就计算最大可购买重量 - if(count<=1){ - PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(customer_id); - BigDecimal availableBalance = RefundDetailService.me.getAvailableBalance(prepayCustomer.getCustomerId(), prepayCustomer.getSurplus()); - BigDecimal maximumConfiguration=availableBalance.divide(new BigDecimal(unit_price),2,BigDecimal.ROUND_DOWN); - result.put("maximumConfiguration",maximumConfiguration); + if (count <= 1) { + PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(customer_id); + BigDecimal availableBalance = RefundDetailService.me.getAvailableBalance(prepayCustomer.getCustomerId(), prepayCustomer.getSurplus()); + BigDecimal maximumConfiguration = availableBalance.divide(new BigDecimal(unit_price), 2, BigDecimal.ROUND_DOWN); + result.put("maximumConfiguration", maximumConfiguration); } return result; } diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/PrepayController.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/PrepayController.java index 917be22..d26a33c 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/PrepayController.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/PrepayController.java @@ -40,6 +40,7 @@ public class PrepayController extends BaseController { public void consumption() { int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出 Integer customer_id = getInt("customer_id"); + Integer customer_type_id = getInt("customer_type_id"); Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token")); @@ -57,9 +58,9 @@ public class PrepayController extends BaseController { String truck_license = get("truck_license"); Integer invoice_type = getInt("invoice_type"); if (export == 0) { - renderJson(Result.success(PrepayService.me.consumption(customer_id, supermarket_id, stm, etm, truck_license,invoice_type))); + renderJson(Result.success(PrepayService.me.consumption(customer_id, customer_type_id, supermarket_id, stm, etm, truck_license,invoice_type))); } else { - Workbook wb = PrepayService.me.consumptionExport(customer_id, supermarket_id, stm, etm, truck_license,invoice_type); + Workbook wb = PrepayService.me.consumptionExport(customer_id, customer_type_id, supermarket_id, stm, etm, truck_license,invoice_type); render(new ExcelRender("消费记录_" + System.currentTimeMillis() + ".xlsx", wb)); } } @@ -98,6 +99,7 @@ public class PrepayController extends BaseController { public void prepaydetail() { int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出 Integer customer_id = getInt("customer_id"); + Integer customer_type_id = getInt("customer_type_id"); Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token")); @@ -113,9 +115,9 @@ public class PrepayController extends BaseController { String etm = get("etm"); if (export == 0) { - renderJson(Result.object(PrepayDetailService.me.list(customer_id, stm, etm))); + renderJson(Result.object(PrepayDetailService.me.list(customer_id, customer_type_id, stm, etm))); } else { - Workbook wb = PrepayDetailService.me.listExport(customer_id, stm, etm); + Workbook wb = PrepayDetailService.me.listExport(customer_id, customer_type_id, stm, etm); render(new ExcelRender("付费详情_" + System.currentTimeMillis() + ".xlsx", wb)); } } diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/prepaydetail/PrepayDetailController.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/prepaydetail/PrepayDetailController.java index 7b3193f..295e421 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/prepaydetail/PrepayDetailController.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/prepay/prepaydetail/PrepayDetailController.java @@ -147,13 +147,14 @@ public class PrepayDetailController extends Controller { public void list() { int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出 int customer_id = getInt("customer_id", 0); + Integer customer_type_id = getInt("customer_type_id"); String stm = get("stm"); String etm = get("etm"); if (export == 0) { - renderJson(Result.object(PrepayDetailService.me.list(customer_id, stm, etm))); + renderJson(Result.object(PrepayDetailService.me.list(customer_id, customer_type_id, stm, etm))); } else { - Workbook wb = PrepayDetailService.me.listExport(customer_id, stm, etm); + Workbook wb = PrepayDetailService.me.listExport(customer_id, customer_type_id, stm, etm); render(new ExcelRender("客户流水_" + System.currentTimeMillis() + ".xlsx", wb)); } } diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/stat/customer/CustomerStatController.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/stat/customer/CustomerStatController.java index f942ade..bc6248d 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/stat/customer/CustomerStatController.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/stat/customer/CustomerStatController.java @@ -14,14 +14,13 @@ public class CustomerStatController extends Controller { public void checkAccount() { String tm = get("tm"); Integer customer_id = getInt("customer_id"); - Integer product_id = getInt("product_id"); - Boolean stat_product = getBoolean("stat_product",false); + Integer customer_type_id = getInt("customer_type_id"); int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出 if (export == 0) { - renderJson(Result.object(CustomerStatService.me.checkAccount(tm, customer_id, stat_product, product_id))); + renderJson(Result.object(CustomerStatService.me.checkAccount(tm, customer_id, customer_type_id))); } else { - Workbook wb = CustomerStatService.me.checkAccountExport(tm, customer_id, stat_product, product_id); + Workbook wb = CustomerStatService.me.checkAccountExport(tm, customer_id, customer_type_id); render(new ExcelRender(tm + "_客户对账统计_" + System.currentTimeMillis() + ".xlsx", wb)); }