From c06ee3fbcc216b7d960c42b96ae7722172496217 Mon Sep 17 00:00:00 2001 From: wuwenxiong <646448316@qq.com> Date: Fri, 17 Sep 2021 16:55:50 +0800 Subject: [PATCH] =?UTF-8?q?2021-09-17=E4=BC=98=E5=8C=96=E8=B0=83=E6=95=B4-?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerSupermarketProductService.java | 12 +++++----- .../com/cowr/ssjygl/prepay/PrepayService.java | 22 +++++++++++++------ .../CustomerSupermarketProductController.java | 4 ++-- .../local/ssjygl/prepay/PrepayController.java | 5 +++-- .../CustomerSupermarketProductController.java | 4 ++-- .../ssjygl/prepay/PrepayController.java | 5 +++-- 6 files changed, 30 insertions(+), 22 deletions(-) diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java index dac6624..5d11c32 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/customer/supermarketproduct/CustomerSupermarketProductService.java @@ -80,10 +80,10 @@ public class CustomerSupermarketProductService extends BaseService { } } - public Record findAllSupermarket(PageParam pp, Integer customer_id, String customer_name) { + public Record findAllSupermarket(PageParam pp, Integer customer_id, Integer customer_type_id) { List cols = Supermarket.dao.find("select id, name, name2 from supermarket where del = 0"); - String selectsql = " select a.customer_id, c.name customer_name "; + String selectsql = " select a.customer_id, c.name customer_name, c.customer_type_id "; String fromsql = " from (\n" + " select t.customer_id from customer_supermarket_product t\n" + " group by t.customer_id\n" + @@ -95,11 +95,9 @@ public class CustomerSupermarketProductService extends BaseService { if (customer_id != null) { fromsql += " and c.id = ? \n"; paraList.add(customer_id); - } - - if (StrKit.notBlank(customer_name)) { - fromsql += " and c.name like ? \n"; - paraList.add("%" + customer_name.trim() + "%"); + } else if (customer_type_id != null) { + fromsql += " and c.customer_type_id = ? \n"; + paraList.add(customer_type_id); } String totalRowSql = "select count(*) " + fromsql; 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 9923022..d841993 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 @@ -415,13 +415,14 @@ public class PrepayService { * * @return */ - public List flow(Integer customer_id, String stm, String etm) { + public List flow(Integer customer_id, Integer customer_type_id, String stm, String etm) { String sql = "select * from ( \n" + " select a.sn id, a.create_time tm, 0 - a.total_price amount, '扣费' type, \n" + - " case when a.paid > 0 then concat('补差额', a.paid) else '' end memo, a.customer_id, a.customer_name \n" + + " case when a.paid > 0 then concat('补差额', a.paid) else '' end memo, a.customer_id, a.customer_name, a.customer_type_id \n" + " from ( \n" + - " select t.sn, t.total_price, t.paid, t.customer_id, t.customer_name, t.create_time \n" + + " select t.sn, t.total_price, t.paid, t.customer_id, t.customer_name, t.create_time, c.customer_type_id \n" + " from order_temp t \n" + + " left join customer c on t.customer_id = c.id \n" + " where t.isprepaid = 1 \n" + " and t.state = ? \n" + " and t.prepay_customer_id is not null\n" + @@ -430,7 +431,7 @@ public class PrepayService { " ) a \n" + " left join transport p on p.order_sn = a.sn \n" + " union \n" + - " select concat('prepay_detail_', t.id) id, t.verify_time tm, t.amount, '付费' type, '' memo, c.id customer_id, c.name customer_name \n" + + " select concat('prepay_detail_', t.id) id, t.verify_time tm, t.amount, '付费' type, '' memo, c.id customer_id, c.name customer_name, c.customer_type_id \n" + " from prepay_detail t \n" + " left join customer c on c.id = t.customer_id \n" + " where t.state = 2 \n" + @@ -438,7 +439,7 @@ public class PrepayService { " and t.verify_time <= ? \n" + " \n" + " union \n" + - " select concat('refund_detail_', t.id) id, t.verify_time tm, 0 - t.amount amount, '退费' type, '' memo, c.id customer_id, c.name customer_name \n" + + " select concat('refund_detail_', t.id) id, t.verify_time tm, 0 - t.amount amount, '退费' type, '' memo, c.id customer_id, c.name customer_name, c.customer_type_id \n" + " from refund_detail t \n" + " left join customer c on c.id = t.customer_id \n" + " where t.state = 3 \n" + // 退费有三个状态 @@ -462,6 +463,13 @@ 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"; + } } sql += " order by b.tm desc"; @@ -469,7 +477,7 @@ public class PrepayService { return Db.find(sql, paraList.toArray()); } - public Workbook flowExport(Integer customer_id, String stm, String etm) { + public Workbook flowExport(Integer customer_id, Integer customer_type_id, String stm, String etm) { Customer customer = Customer.dao.findById(customer_id); String cname = ""; @@ -477,7 +485,7 @@ public class PrepayService { cname = customer.getName(); } - List list = flow(customer_id, stm, etm); + List list = flow(customer_id, customer_type_id, stm, etm); list.sort(new Comparator() { public int compare(Record o1, Record o2) { diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/customer/supermarketproduct/CustomerSupermarketProductController.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/customer/supermarketproduct/CustomerSupermarketProductController.java index 4743e4e..b503500 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/customer/supermarketproduct/CustomerSupermarketProductController.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/customer/supermarketproduct/CustomerSupermarketProductController.java @@ -27,8 +27,8 @@ public class CustomerSupermarketProductController extends Controller { public void findAllSupermarket() { PageParam pp = getBean(PageParam.class, "", true); Integer customer_id = getInt("customer_id"); - String customer_name = get("customer_name"); - renderJson(Result.object(CustomerSupermarketProductService.me.findAllSupermarket(pp, customer_id, customer_name))); + Integer customer_type_id = getInt("customer_type_id"); + renderJson(Result.object(CustomerSupermarketProductService.me.findAllSupermarket(pp, customer_id, customer_type_id))); } public void getAllSupProduct(){ 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 6b15631..4320eff 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 @@ -43,13 +43,14 @@ public class PrepayController extends BaseController { public void flow() { 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.success(PrepayService.me.flow(customer_id, stm, etm))); + renderJson(Result.success(PrepayService.me.flow(customer_id, customer_type_id, stm, etm))); } else { - Workbook wb = PrepayService.me.flowExport(customer_id, stm, etm); + Workbook wb = PrepayService.me.flowExport(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/customer/supermarketproduct/CustomerSupermarketProductController.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/customer/supermarketproduct/CustomerSupermarketProductController.java index 9d921a5..7d5f472 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/customer/supermarketproduct/CustomerSupermarketProductController.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/customer/supermarketproduct/CustomerSupermarketProductController.java @@ -61,8 +61,8 @@ public class CustomerSupermarketProductController extends Controller { public void findAllSupermarket() { PageParam pp = getBean(PageParam.class, "", true); Integer customer_id = getInt("customer_id"); - String customer_name = get("customer_name"); - renderJson(Result.object(CustomerSupermarketProductService.me.findAllSupermarket(pp, customer_id, customer_name))); + Integer customer_type_id = getInt("customer_type_id"); + renderJson(Result.object(CustomerSupermarketProductService.me.findAllSupermarket(pp, customer_id, customer_type_id))); } public void getAllSupProduct(){ 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 c553c6b..917be22 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 @@ -68,6 +68,7 @@ public class PrepayController extends BaseController { public void flow() { 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")); @@ -83,9 +84,9 @@ public class PrepayController extends BaseController { String etm = get("etm"); if (export == 0) { - renderJson(Result.success(PrepayService.me.flow(customer_id, stm, etm))); + renderJson(Result.success(PrepayService.me.flow(customer_id, customer_type_id, stm, etm))); } else { - Workbook wb = PrepayService.me.flowExport(customer_id, stm, etm); + Workbook wb = PrepayService.me.flowExport(customer_id, customer_type_id, stm, etm); render(new ExcelRender("客户流水_" + System.currentTimeMillis() + ".xlsx", wb)); } }