统计支持多品类
parent
44a47ccaad
commit
a7ac815703
|
|
@ -25,21 +25,17 @@ public class CustomerStatService {
|
|||
* @param customer_id
|
||||
* @return
|
||||
*/
|
||||
public List<Record> checkAccount(String tm, Integer customer_id) {
|
||||
public List<Record> checkAccount(String tm, Integer customer_id, Boolean stat_product, Integer product_id) {
|
||||
String querytm = tm + " 23:59:59";
|
||||
String sql = null;
|
||||
|
||||
if (customer_id != null) {
|
||||
String sql;
|
||||
String fromSql;
|
||||
String tempSql;
|
||||
String productSql = "";
|
||||
String customerSql= "";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
paraList.add(querytm);
|
||||
paraList.add(customer_id);
|
||||
paraList.add(querytm);
|
||||
paraList.add(customer_id);
|
||||
paraList.add(querytm);
|
||||
paraList.add(customer_id);
|
||||
paraList.add(customer_id);
|
||||
|
||||
sql = "select t.customer_id id,\n" +
|
||||
if (stat_product) {
|
||||
fromSql = "select t.customer_id id,\n" +
|
||||
" c.`name`,\n" +
|
||||
" t.surplus,\n" +
|
||||
" a.total_price,\n" +
|
||||
|
|
@ -47,17 +43,61 @@ public class CustomerStatService {
|
|||
" a.total_cnt,\n" +
|
||||
" b.amount,\n" +
|
||||
" b.refund_amount,\n" +
|
||||
" b.amount - ifnull(a.total_price,0) - b.refund_amount then_surplus\n" +
|
||||
" from prepay_customer t\n" +
|
||||
" left join customer c on c.id= t.customer_id\n" +
|
||||
" left join(\n" +
|
||||
" select t.customer_id, sum(t.total_price) total_price, sum(t.weight) total_weight, count(t.sn) total_cnt\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" +
|
||||
" and t.customer_id = ? \n" +
|
||||
" group by t.customer_id\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) {
|
||||
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);
|
||||
paraList.add(customer_id);
|
||||
paraList.add(customer_id);
|
||||
|
||||
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" +
|
||||
" left join(\n" +
|
||||
" select a.customer_id, a.amount, ifnull(b.amount, 0) refund_amount\n" +
|
||||
|
|
@ -88,24 +128,17 @@ public class CustomerStatService {
|
|||
|
||||
return Db.find(sql, paraList.toArray());
|
||||
} else {
|
||||
sql = "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" +
|
||||
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" +
|
||||
" left join(\n" +
|
||||
" 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" +
|
||||
" group by 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" +
|
||||
|
|
@ -131,12 +164,12 @@ public class CustomerStatService {
|
|||
" ) b on b.customer_id= t.customer_id\n" +
|
||||
" order by t.customer_id";
|
||||
|
||||
return Db.find(sql, querytm, querytm, querytm);
|
||||
return Db.find(sql, paraList.toArray());
|
||||
}
|
||||
}
|
||||
|
||||
public Workbook checkAccountExport(String tm, Integer customer_id) {
|
||||
List<Record> list = checkAccount(tm, customer_id);
|
||||
public Workbook checkAccountExport(String tm, Integer customer_id, Boolean stat_product, Integer product_id) {
|
||||
List<Record> list = checkAccount(tm, customer_id,stat_product,product_id);
|
||||
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet(tm + " 客户对账统计");
|
||||
|
|
@ -144,7 +177,12 @@ public class CustomerStatService {
|
|||
// 表头 start
|
||||
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("累计充值");
|
||||
|
|
@ -155,7 +193,6 @@ public class CustomerStatService {
|
|||
// 表头 end
|
||||
|
||||
int datalen = list.size();
|
||||
int end_col = 8;
|
||||
|
||||
for (int i = 0; i < datalen; i++) {
|
||||
Record record = list.get(i);
|
||||
|
|
@ -163,6 +200,9 @@ public class CustomerStatService {
|
|||
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"));
|
||||
|
|
@ -172,7 +212,7 @@ public class CustomerStatService {
|
|||
row.createCell(a++).setCellValue(record.getStr("total_cnt"));
|
||||
}
|
||||
|
||||
ReportExcelStyle.setCommonCellStyle(wb, sheet, datalen, end_col);
|
||||
ReportExcelStyle.setCommonCellStyle(wb, sheet, datalen-1, end_col);
|
||||
|
||||
return wb;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,33 +327,55 @@ public class OrderStatService {
|
|||
* @param tm YYYY-MM
|
||||
* @return
|
||||
*/
|
||||
public Record monthgrid(String tm, Integer supermarket_id, Integer customer_id) {
|
||||
public Record monthgrid(String tm, Integer supermarket_id, Integer customer_id, Boolean stat_product, Integer product_id) {
|
||||
String sql;
|
||||
String paramsSql = "";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
paraList.add(OrderStateEnum.RECEIVED.getStateid());
|
||||
paraList.add(tm + "%");
|
||||
|
||||
if (supermarket_id != null && supermarket_id > 0) {
|
||||
paramsSql += " and t.supermarket_id = ? \n";
|
||||
paraList.add(supermarket_id);
|
||||
}
|
||||
|
||||
if (customer_id != null && customer_id > 0) {
|
||||
paramsSql += " and t.customer_id = ? \n";
|
||||
paraList.add(customer_id);
|
||||
}
|
||||
|
||||
// 使用实际支付金额统计
|
||||
String sql = "select ifnull(max(t.customer_id), t.customer_name) customer_id, ifnull(t.customer_name, '民用') customer_name, t.supermarket_id, max(s.name) supermarket_name, count(*) cnt, sum(t.total_price) total \n" +
|
||||
if(stat_product){
|
||||
if(product_id != null && product_id > 0){
|
||||
paramsSql += " and t.product_id = ? \n";
|
||||
paraList.add(product_id);
|
||||
}
|
||||
sql ="select ifnull(max(t.customer_id), t.customer_name) customer_id, ifnull(t.customer_name, '民用') customer_name, t.supermarket_id, max(s.name) supermarket_name, count(*) cnt, sum(t.total_price) total,t.product_id, t.product_name \n"+
|
||||
" from (\n" +
|
||||
" select t.customer_id, t.customer_name, t.supermarket_id, t.paid, t.total_price, 3 type \n" +
|
||||
" select t.customer_id, t.customer_name , t.supermarket_id, t.paid, t.total_price,t.product_id, t.product_name, 3 type \n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ? \n" +
|
||||
" and t.create_time like ?\n" +
|
||||
" ) t\n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id\n" +
|
||||
" where 1 = 1 \n";
|
||||
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
paraList.add(OrderStateEnum.RECEIVED.getStateid());
|
||||
paraList.add(tm + "%");
|
||||
|
||||
if (supermarket_id != null && supermarket_id > 0) {
|
||||
sql += " and t.supermarket_id = ? \n";
|
||||
paraList.add(supermarket_id);
|
||||
" where 1 = 1 \n"+
|
||||
paramsSql +
|
||||
" group by t.customer_name, t.supermarket_id, t.product_id, t.product_name";
|
||||
} else {
|
||||
sql = "select ifnull(max(t.customer_id), t.customer_name) customer_id, ifnull(t.customer_name, '民用') customer_name, t.supermarket_id, max(s.name) supermarket_name, count(*) cnt, sum(t.total_price) total \n" +
|
||||
" from (\n" +
|
||||
" select t.customer_id, t.customer_name , t.supermarket_id, t.paid, t.total_price, 3 type \n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ? \n" +
|
||||
" and t.create_time like ?\n" +
|
||||
" ) t\n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id\n" +
|
||||
" where 1 = 1 \n" +
|
||||
paramsSql +
|
||||
"group by t.customer_name, t.supermarket_id";
|
||||
}
|
||||
|
||||
if (customer_id != null && customer_id > 0) {
|
||||
sql += " and t.customer_id = ? \n";
|
||||
paraList.add(customer_id);
|
||||
}
|
||||
|
||||
sql += " group by t.customer_name, t.supermarket_id";
|
||||
|
||||
List<Record> dblist = Db.find(sql, paraList.toArray());
|
||||
Map<Integer, String> spkeys = new HashMap<>(); // supermarket_id <-> supermarket_name
|
||||
|
|
@ -385,7 +407,7 @@ public class OrderStatService {
|
|||
outobj.set("id", sql_customer_id);
|
||||
outobj.set("name", record.getStr("customer_name"));
|
||||
outobj.set("total", outobj.getDouble("total") + record.getDouble("total"));
|
||||
|
||||
outobj.set("product_name", record.getStr("product_name"));
|
||||
outobj.set(supermarket_id_str, record.getDouble("total"));
|
||||
}
|
||||
|
||||
|
|
@ -422,8 +444,8 @@ public class OrderStatService {
|
|||
* @param tm
|
||||
* @return
|
||||
*/
|
||||
public Workbook monthgridExport(String tm, Integer supermarket_id, Integer customer_id) {
|
||||
Record grid = monthgrid(tm, supermarket_id, customer_id);
|
||||
public Workbook monthgridExport(String tm, Integer supermarket_id, Integer customer_id, Boolean stat_product, Integer product_id) {
|
||||
Record grid = monthgrid(tm, supermarket_id, customer_id, stat_product, product_id);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("销售月汇总");
|
||||
|
||||
|
|
@ -531,10 +553,24 @@ public class OrderStatService {
|
|||
* @param tm
|
||||
* @return
|
||||
*/
|
||||
public List<Record> salestatCustomer(String tm, Integer invoice_type) {
|
||||
public List<Record> salestatCustomer(String tm, Integer invoice_type, Boolean stat_product) {
|
||||
|
||||
List<Record> dblist = null;
|
||||
if (invoice_type != null) {
|
||||
if(stat_product){
|
||||
dblist = Db.find("select max(t.customer_id) id, t.customer_name name, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight, max(t.invoice_type) invoiceType,t.product_name\n" +
|
||||
" from (\n" +
|
||||
" select ifnull(t.customer_id, t.customer_name) customer_id, t.customer_name, t.paid, t.total_price, t.weight, t.invoice_type,t.product_id,t.product_name\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ? \n" +
|
||||
" and t.invoice_type = ? \n" +
|
||||
" and t.create_time like ? \n" +
|
||||
" ) t\n" +
|
||||
" group by t.customer_name,t.product_id,t.product_name",
|
||||
OrderStateEnum.RECEIVED.getStateid(),
|
||||
invoice_type,
|
||||
tm + "%");
|
||||
}else {
|
||||
dblist = Db.find("select max(t.customer_id) id, t.customer_name name, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight, max(t.invoice_type) invoiceType\n" +
|
||||
" from (\n" +
|
||||
" select ifnull(t.customer_id, t.customer_name) customer_id, t.customer_name, t.paid, t.total_price, t.weight, t.invoice_type\n" +
|
||||
|
|
@ -546,9 +582,24 @@ public class OrderStatService {
|
|||
" group by t.customer_name",
|
||||
OrderStateEnum.RECEIVED.getStateid(),
|
||||
invoice_type,
|
||||
tm + "%");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if(stat_product){
|
||||
dblist = Db.find("select max(t.customer_id) id, t.customer_name name, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight, max(t.invoice_type) invoiceType,t.product_name\n" +
|
||||
" from (\n" +
|
||||
" select ifnull(t.customer_id, t.customer_name) customer_id, t.customer_name, t.paid, t.total_price, t.weight, t.invoice_type,t.product_id,t.product_name\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ? \n" +
|
||||
" and t.create_time like ? \n" +
|
||||
" ) t\n" +
|
||||
" group by t.customer_name,t.product_id,t.product_name",
|
||||
OrderStateEnum.RECEIVED.getStateid(),
|
||||
tm + "%"
|
||||
);
|
||||
} else {
|
||||
}else {
|
||||
dblist = Db.find("select max(t.customer_id) id, t.customer_name name, count(*) as orderCount, sum(t.total_price) as totalPrice, sum(t.weight) as weight, max(t.invoice_type) invoiceType\n" +
|
||||
" from (\n" +
|
||||
" select ifnull(t.customer_id, t.customer_name) customer_id, t.customer_name, t.paid, t.total_price, t.weight, t.invoice_type\n" +
|
||||
|
|
@ -562,6 +613,8 @@ public class OrderStatService {
|
|||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Record total = new Record();
|
||||
total.set("id", 0);
|
||||
total.set("name", "合计");
|
||||
|
|
@ -576,7 +629,7 @@ public class OrderStatService {
|
|||
}
|
||||
|
||||
total.set("weight", Double.parseDouble(String.format("%.2f", total.getDouble("weight"))));
|
||||
|
||||
total.set("product_name", "");
|
||||
dblist.add(total);
|
||||
|
||||
return dblist;
|
||||
|
|
@ -684,8 +737,8 @@ public class OrderStatService {
|
|||
* @param tm
|
||||
* @return
|
||||
*/
|
||||
public Workbook salestatCustomerExport(String tm, String title, String subtitle, Integer invoice_type) {
|
||||
List<Record> list = salestatCustomer(tm, invoice_type);
|
||||
public Workbook salestatCustomerExport(String tm, String title, String subtitle, Integer invoice_type, Boolean stat_product) {
|
||||
List<Record> list = salestatCustomer(tm, invoice_type, stat_product);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet(title);
|
||||
|
||||
|
|
@ -741,7 +794,7 @@ public class OrderStatService {
|
|||
}
|
||||
|
||||
|
||||
public Workbook daysalestatCustomerExport(String tm, Integer invoice_type) {
|
||||
public Workbook daysalestatCustomerExport(String tm, Integer invoice_type, Boolean stat_product) {
|
||||
String title = "销售日统计";
|
||||
|
||||
|
||||
|
|
@ -755,10 +808,10 @@ public class OrderStatService {
|
|||
|
||||
subtitle += title;
|
||||
|
||||
return salestatCustomerExport(tm, title, subtitle, invoice_type);
|
||||
return salestatCustomerExport(tm, title, subtitle, invoice_type, stat_product);
|
||||
}
|
||||
|
||||
public Workbook monthsalestatCustomerExport(String tm, Integer invoice_type) {
|
||||
public Workbook monthsalestatCustomerExport(String tm, Integer invoice_type, Boolean stat_product) {
|
||||
String title = "销售月统计";
|
||||
|
||||
// 副标题 start
|
||||
|
|
@ -771,7 +824,7 @@ public class OrderStatService {
|
|||
|
||||
subtitle += title;
|
||||
|
||||
return salestatCustomerExport(tm, title, subtitle, invoice_type);
|
||||
return salestatCustomerExport(tm, title, subtitle, invoice_type, stat_product);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -781,31 +834,51 @@ public class OrderStatService {
|
|||
* @param supermarket_id
|
||||
* @return
|
||||
*/
|
||||
public List<Record> mdstat(String stm, String etm, Integer supermarket_id) {
|
||||
String paramsSql = "";
|
||||
if (supermarket_id != null) {
|
||||
paramsSql = "and t.supermarket_id = ? \n";
|
||||
public List<Record> mdstat(String stm, String etm, Integer supermarket_id, Boolean stat_product, Integer product_id) {
|
||||
String sql;
|
||||
List<Object> paramsArray = new ArrayList<>();
|
||||
paramsArray.add(OrderStateEnum.RECEIVED.getStateid());
|
||||
paramsArray.add(stm);
|
||||
paramsArray.add(etm);
|
||||
String productParams = "";
|
||||
|
||||
if (supermarket_id != null && supermarket_id > 0) {
|
||||
productParams += " and t.supermarket_id = ?\n";
|
||||
paramsArray.add(supermarket_id);
|
||||
}
|
||||
if(stat_product){
|
||||
if (product_id != null && product_id > 0) {
|
||||
productParams += " and t.product_id = ?\n";
|
||||
paramsArray.add(product_id);
|
||||
}
|
||||
|
||||
String sql = "select date_format(t.create_time, '%Y-%m-%d') as date, sum(t.weight) as weight, sum(t.total_price) as totalPrice\n" +
|
||||
sql = "select date_format(t.create_time, '%Y-%m-%d') as date, count(t.sn) truckCnt, sum(t.weight) as weight, sum(t.total_price) as totalPrice,t.product_id,t.product_name\n" +
|
||||
"from (\n" +
|
||||
" select t.create_time, t.weight, t.paid, t.total_price\n" +
|
||||
" select t.sn, t.create_time, t.weight, t.paid, t.total_price,t.product_id,t.product_name\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ? \n" +
|
||||
paramsSql +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ? \n" +
|
||||
productParams +
|
||||
") t\n" +
|
||||
"group by date_format(t.create_time, '%Y-%m-%d') ,t.product_id,t.product_name\n" +
|
||||
"order by date_format(t.create_time, '%Y-%m-%d'),t.product_id,t.product_name";
|
||||
} else {
|
||||
sql = "select date_format(t.create_time, '%Y-%m-%d') as date, count(t.sn) truckCnt, sum(t.weight) as weight, sum(t.total_price) as totalPrice\n" +
|
||||
"from (\n" +
|
||||
" select t.sn, t.create_time, t.weight, t.paid, t.total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ? \n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ? \n" +
|
||||
productParams +
|
||||
") t\n" +
|
||||
"group by date_format(t.create_time, '%Y-%m-%d')\n" +
|
||||
"order by date_format(t.create_time, '%Y-%m-%d')";
|
||||
|
||||
List<Record> dblist;
|
||||
if (supermarket_id != null) {
|
||||
dblist = Db.find(sql, OrderStateEnum.RECEIVED.getStateid(), supermarket_id, stm, etm);
|
||||
} else {
|
||||
dblist = Db.find(sql, OrderStateEnum.RECEIVED.getStateid(), stm, etm);
|
||||
}
|
||||
|
||||
List<Record> dblist = Db.find(sql, paramsArray.toArray());
|
||||
|
||||
Record total = new Record();
|
||||
total.set("id", dblist.size() + 1);
|
||||
total.set("date", null);
|
||||
|
|
@ -843,8 +916,8 @@ public class OrderStatService {
|
|||
* @param supermarket_id
|
||||
* @return
|
||||
*/
|
||||
public Workbook mdstatExport(String stm, String etm, Integer supermarket_id) {
|
||||
List<Record> list = mdstat(stm, etm, supermarket_id);
|
||||
public Workbook mdstatExport(String stm, String etm, Integer supermarket_id, Boolean stat_product, Integer product_id) {
|
||||
List<Record> list = mdstat(stm, etm, supermarket_id, stat_product, product_id);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("销售月逐日统计");
|
||||
|
||||
|
|
@ -1313,9 +1386,18 @@ public class OrderStatService {
|
|||
return wb;
|
||||
}
|
||||
|
||||
public List<Record> yearStatBySup(String year) {
|
||||
public List<Record> yearStatBySup(String year, Boolean stat_product) {
|
||||
List<Record> list;
|
||||
if (StrKit.notBlank(year)) {
|
||||
if(stat_product){
|
||||
list = Db.find("select s.id, s.name, a.cnt, a.total_price, a.total_weight,a.product_id,a.product_name from supermarket s\n" +
|
||||
"left join (\n" +
|
||||
" select t.supermarket_id id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight,t.product_id,t.product_name from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.create_time like ? \n" +
|
||||
" group by t.supermarket_id,t.product_id,t.product_name\n" +
|
||||
") a on s.id = a.id order by s.id", year + "%");
|
||||
}else {
|
||||
list = Db.find("select s.id, s.name, a.cnt, a.total_price, a.total_weight from supermarket s\n" +
|
||||
"left join (\n" +
|
||||
" select t.supermarket_id id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight from order_temp t\n" +
|
||||
|
|
@ -1323,7 +1405,17 @@ public class OrderStatService {
|
|||
" and t.create_time like ? \n" +
|
||||
" group by t.supermarket_id\n" +
|
||||
") a on s.id = a.id order by s.id", year + "%");
|
||||
}
|
||||
|
||||
} else {
|
||||
if(stat_product){
|
||||
list = Db.find("select s.id, s.name, a.cnt, a.total_price, a.total_weight,a.product_id,a.product_name from supermarket s\n" +
|
||||
"left join (\n" +
|
||||
" select t.supermarket_id id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight,t.product_id,t.product_name from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" group by t.supermarket_id,t.product_id,t.product_name\n" +
|
||||
") a on s.id = a.id order by s.id");
|
||||
}else {
|
||||
list = Db.find("select s.id, s.name, a.cnt, a.total_price, a.total_weight from supermarket s\n" +
|
||||
"left join (\n" +
|
||||
" select t.supermarket_id id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight from order_temp t\n" +
|
||||
|
|
@ -1332,6 +1424,8 @@ public class OrderStatService {
|
|||
") a on s.id = a.id order by s.id");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Record hj = new Record();
|
||||
hj.set("id", 0);
|
||||
hj.set("name", "合计");
|
||||
|
|
@ -1356,8 +1450,8 @@ public class OrderStatService {
|
|||
return list;
|
||||
}
|
||||
|
||||
public Workbook yearStatBySupExport(String year) {
|
||||
List<Record> list = yearStatBySup(year);
|
||||
public Workbook yearStatBySupExport(String year, Boolean stat_product) {
|
||||
List<Record> list = yearStatBySup(year, stat_product);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet;
|
||||
|
||||
|
|
@ -1398,15 +1492,36 @@ public class OrderStatService {
|
|||
return wb;
|
||||
}
|
||||
|
||||
public List<Record> yearStatBySup(String stm, String etm) {
|
||||
List<Record> list = Db.find("select s.id, s.name, a.cnt, a.total_price, a.total_weight from supermarket s\n" +
|
||||
public List<Record> yearStatBySup(String stm, String etm, Boolean stat_product, Integer product_id) {
|
||||
List<Record> list;
|
||||
String paramsSql = "";
|
||||
List<Object> paramsArray = new ArrayList<>();
|
||||
paramsArray.add(stm);
|
||||
paramsArray.add(etm);
|
||||
if (stat_product) {
|
||||
if(product_id != null && product_id > 0){
|
||||
paramsSql+=" and t.product_id=? \n";
|
||||
paramsArray.add(product_id);
|
||||
}
|
||||
list = Db.find("select s.id, s.name, a.cnt, a.total_price, a.total_weight ,a.product_id,a.product_name from supermarket s\n" +
|
||||
"left join (\n" +
|
||||
" select t.supermarket_id id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight,t.product_id,t.product_name from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ? \n" +
|
||||
paramsSql+
|
||||
" group by t.supermarket_id,t.product_id,t.product_name\n" +
|
||||
") a on s.id = a.id order by s.id", paramsArray.toArray());
|
||||
}else {
|
||||
list = Db.find("select s.id, s.name, a.cnt, a.total_price, a.total_weight from supermarket s\n" +
|
||||
"left join (\n" +
|
||||
" select t.supermarket_id id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ? \n" +
|
||||
" group by t.supermarket_id\n" +
|
||||
") a on s.id = a.id order by s.id", stm, etm);
|
||||
") a on s.id = a.id order by s.id", paramsArray.toArray());
|
||||
}
|
||||
|
||||
Record hj = new Record();
|
||||
hj.set("id", 0);
|
||||
|
|
@ -1432,8 +1547,8 @@ public class OrderStatService {
|
|||
return list;
|
||||
}
|
||||
|
||||
public Workbook yearStatBySupExport(String stm, String etm) {
|
||||
List<Record> list = yearStatBySup(stm, etm);
|
||||
public Workbook yearStatBySupExport(String stm, String etm, Boolean stat_product,Integer product_id) {
|
||||
List<Record> list = yearStatBySup(stm, etm, stat_product, product_id);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet(stm.substring(0, 10) + " ~ " + etm.substring(0, 10) + "年销售汇总");
|
||||
|
||||
|
|
@ -1467,9 +1582,19 @@ public class OrderStatService {
|
|||
return wb;
|
||||
}
|
||||
|
||||
public List<Record> yearStatByCustomer(String year) {
|
||||
public List<Record> yearStatByCustomer(String year, Boolean stat_product) {
|
||||
List<Record> list;
|
||||
if (StrKit.notBlank(year)) {
|
||||
if(stat_product){
|
||||
list = Db.find("select ifnull(c.name, '零散') name, a.*, p.surplus total_surplus ,a.product_id,a.product_name from (\n" +
|
||||
" select ifnull(t.customer_id, -1) id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight,t.product_id,t.product_name from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.create_time like ? \n" +
|
||||
" group by t.customer_id,t.product_id,t.product_name\n" +
|
||||
" ) a\n" +
|
||||
" left join customer c on c.id = a.id\n" +
|
||||
" left join prepay_customer p on p.customer_id = a.id", year + "%");
|
||||
}else {
|
||||
list = Db.find("select ifnull(c.name, '零散') name, a.*, p.surplus total_surplus from (\n" +
|
||||
" select ifnull(t.customer_id, -1) id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
|
|
@ -1478,7 +1603,18 @@ public class OrderStatService {
|
|||
" ) a\n" +
|
||||
" left join customer c on c.id = a.id\n" +
|
||||
" left join prepay_customer p on p.customer_id = a.id", year + "%");
|
||||
}
|
||||
|
||||
} else {
|
||||
if(stat_product){
|
||||
list = Db.find("select ifnull(c.name, '零散') name, a.*, p.surplus total_surplus,a.product_id,a.product_name from (\n" +
|
||||
" select ifnull(t.customer_id, -1) id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight,t.product_id,t.product_name from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" group by t.customer_id,t.product_id,t.product_name\n" +
|
||||
" ) a\n" +
|
||||
" left join customer c on c.id = a.id\n" +
|
||||
" left join prepay_customer p on p.customer_id = a.id");
|
||||
}else {
|
||||
list = Db.find("select ifnull(c.name, '零散') name, a.*, p.surplus total_surplus from (\n" +
|
||||
" select ifnull(t.customer_id, -1) id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
|
|
@ -1488,6 +1624,8 @@ public class OrderStatService {
|
|||
" left join prepay_customer p on p.customer_id = a.id");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Record hj = new Record();
|
||||
hj.set("id", 0);
|
||||
hj.set("name", "合计");
|
||||
|
|
@ -1520,8 +1658,8 @@ public class OrderStatService {
|
|||
}
|
||||
|
||||
|
||||
public Workbook yearStatByCustomerExport(String year) {
|
||||
List<Record> list = yearStatByCustomer(year);
|
||||
public Workbook yearStatByCustomerExport(String year, Boolean stat_product) {
|
||||
List<Record> list = yearStatByCustomer(year, stat_product);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet;
|
||||
|
||||
|
|
@ -1580,17 +1718,38 @@ public class OrderStatService {
|
|||
}
|
||||
|
||||
|
||||
public List<Record> yearStatByCustomer(String stm, String etm) {
|
||||
List<Record> list = Db.find("select ifnull(c.name, '零散') name, a.*, p.surplus total_surplus from (\n" +
|
||||
" select ifnull(t.customer_id, -1) id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight from order_temp t\n" +
|
||||
public List<Record> yearStatByCustomer(String stm, String etm, Boolean stat_product, Integer product_id) {
|
||||
List<Record> list;
|
||||
String paramsSql = "";
|
||||
List<Object> paramsArray = new ArrayList<>();
|
||||
paramsArray.add(stm);
|
||||
paramsArray.add(etm);
|
||||
if(stat_product){
|
||||
if(product_id != null && product_id > 0){
|
||||
paramsSql +=" and t.product_id=? \n";
|
||||
paramsArray.add(product_id);
|
||||
}
|
||||
list = Db.find("select c.id id, ifnull(c.name, '零散') name, a.*, p.surplus total_surplus ,a.product_id,a.product_name from (\n" +
|
||||
" select ifnull(t.customer_id, -1) id, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight,t.product_id,t.product_name from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ? \n" +
|
||||
paramsSql+
|
||||
" group by t.customer_id,t.product_id,t.product_name\n" +
|
||||
" ) a\n" +
|
||||
" left join customer c on c.id = a.id\n" +
|
||||
" left join prepay_customer p on p.customer_id = a.id", paramsArray.toArray());
|
||||
}else {
|
||||
list = Db.find("select c.id, ifnull(c.name, '零散') name, a.*, p.surplus total_surplus from (\n" +
|
||||
" select ifnull(t.customer_id, -1) id,, count(t.sn) cnt, sum(t.total_price) total_price, sum(weight) total_weight from order_temp t\n" +
|
||||
" where t.state = 5\n" +
|
||||
" and t.create_time >= ? \n" +
|
||||
" and t.create_time <= ? \n" +
|
||||
" group by t.customer_id\n" +
|
||||
" ) a\n" +
|
||||
" left join customer c on c.id = a.id\n" +
|
||||
" left join prepay_customer p on p.customer_id = a.id", stm, etm);
|
||||
|
||||
" left join prepay_customer p on p.customer_id = a.id", paramsArray.toArray());
|
||||
}
|
||||
|
||||
Record hj = new Record();
|
||||
hj.set("id", 0);
|
||||
|
|
@ -1624,8 +1783,8 @@ public class OrderStatService {
|
|||
}
|
||||
|
||||
|
||||
public Workbook yearStatByCustomerExport(String stm, String etm) {
|
||||
List<Record> list = yearStatByCustomer(stm, etm);
|
||||
public Workbook yearStatByCustomerExport(String stm, String etm, Boolean stat_product, Integer product_id) {
|
||||
List<Record> list = yearStatByCustomer(stm, etm, stat_product, product_id);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet(stm.substring(0, 10) + " ~ " + stm.substring(0, 10) + "时段销售汇总");
|
||||
|
||||
|
|
|
|||
|
|
@ -69,11 +69,13 @@ public class OrderStatController extends BaseController {
|
|||
Integer customer_id = getInt("customer_id");
|
||||
String tm = get("tm");
|
||||
int export = getInt("export", 0);
|
||||
Integer product_id = getInt("product_id");
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.monthgrid(tm, supermarket_id, customer_id)));
|
||||
renderJson(Result.object(OrderStatService.me.monthgrid(tm, supermarket_id, customer_id, stat_product, product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.monthgridExport(tm, supermarket_id, customer_id);
|
||||
Workbook wb = OrderStatService.me.monthgridExport(tm, supermarket_id, customer_id, stat_product, product_id);
|
||||
render(new ExcelRender(tm + "_销售月汇总_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -118,10 +120,11 @@ public class OrderStatController extends BaseController {
|
|||
String tm = get("tm");
|
||||
Integer invoice_type = getInt("invoice_type");
|
||||
int export = getInt("export", 0);
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type)));
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type);
|
||||
Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type, stat_product);
|
||||
render(new ExcelRender(tm + "_销售日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -134,11 +137,11 @@ public class OrderStatController extends BaseController {
|
|||
String tm = get("tm");
|
||||
Integer invoice_type = getInt("invoice_type");
|
||||
int export = getInt("export", 0);
|
||||
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type)));
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type);
|
||||
Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type, stat_product);
|
||||
render(new ExcelRender(tm + "_销售月统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -152,11 +155,13 @@ public class OrderStatController extends BaseController {
|
|||
String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59"
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
int export = getInt("export", 0);
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
Integer product_id = getInt("product_id");
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.mdstat(stm, etm, supermarket_id)));
|
||||
renderJson(Result.object(OrderStatService.me.mdstat(stm, etm, supermarket_id, stat_product, product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.mdstatExport(stm, etm, supermarket_id);
|
||||
Workbook wb = OrderStatService.me.mdstatExport(stm, etm, supermarket_id, stat_product, product_id);
|
||||
|
||||
render(new ExcelRender(stm.substring(0, 10) + "至" + etm.substring(0, 10) + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
|
|
@ -288,10 +293,11 @@ public class OrderStatController extends BaseController {
|
|||
public void statYearCustomer() {
|
||||
String tm = get("tm");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm);
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm, stat_product);
|
||||
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -299,10 +305,12 @@ public class OrderStatController extends BaseController {
|
|||
public void statYearBySup() {
|
||||
String tm = get("tm");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(tm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(tm, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(tm);
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(tm, stat_product);
|
||||
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -312,10 +320,13 @@ public class OrderStatController extends BaseController {
|
|||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
Integer product_id = getInt("product_id");
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm, stat_product, product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm);
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm, stat_product, product_id);
|
||||
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -324,11 +335,14 @@ public class OrderStatController extends BaseController {
|
|||
public void statRangeAllSup() {
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
Integer product_id = getInt("product_id");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm, stat_product, product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(stm, etm);
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(stm, etm, stat_product, product_id);
|
||||
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,13 +14,14 @@ 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);
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(CustomerStatService.me.checkAccount(tm, customer_id)));
|
||||
renderJson(Result.object(CustomerStatService.me.checkAccount(tm, customer_id, stat_product, product_id)));
|
||||
} else {
|
||||
Workbook wb = CustomerStatService.me.checkAccountExport(tm, customer_id);
|
||||
Workbook wb = CustomerStatService.me.checkAccountExport(tm, customer_id, stat_product, product_id);
|
||||
|
||||
render(new ExcelRender(tm + "_客户对账统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ public class OrderStatController extends BaseController {
|
|||
public void monthgrid() {
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
Integer customer_id = getInt("customer_id");
|
||||
Integer product_id = getInt("product_id");
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
|
|
@ -99,9 +101,9 @@ public class OrderStatController extends BaseController {
|
|||
int export = getInt("export", 0);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.monthgrid(tm, supermarket_id, customer_id)));
|
||||
renderJson(Result.object(OrderStatService.me.monthgrid(tm, supermarket_id, customer_id, stat_product, product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.monthgridExport(tm, supermarket_id, customer_id);
|
||||
Workbook wb = OrderStatService.me.monthgridExport(tm, supermarket_id, customer_id, stat_product, product_id);
|
||||
render(new ExcelRender(tm + "_销售月汇总_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -146,10 +148,12 @@ public class OrderStatController extends BaseController {
|
|||
String tm = get("tm");
|
||||
Integer invoice_type = getInt("invoice_type");
|
||||
int export = getInt("export", 0);
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type)));
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type);
|
||||
Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type, stat_product);
|
||||
render(new ExcelRender(tm + "_销售日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -162,11 +166,12 @@ public class OrderStatController extends BaseController {
|
|||
String tm = get("tm");
|
||||
Integer invoice_type = getInt("invoice_type");
|
||||
int export = getInt("export", 0);
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type)));
|
||||
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type);
|
||||
Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type, stat_product);
|
||||
render(new ExcelRender(tm + "_销售月统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -179,12 +184,14 @@ public class OrderStatController extends BaseController {
|
|||
String stm = get("stm"); // 前端将 YYYY-MM-DD 后面补 " 00:00:00"
|
||||
String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59"
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
Integer product_id = getInt("product_id");
|
||||
int export = getInt("export", 0);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.mdstat(stm, etm, supermarket_id)));
|
||||
renderJson(Result.object(OrderStatService.me.mdstat(stm, etm, supermarket_id, stat_product,product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.mdstatExport(stm, etm, supermarket_id);
|
||||
Workbook wb = OrderStatService.me.mdstatExport(stm, etm, supermarket_id, stat_product,product_id);
|
||||
|
||||
render(new ExcelRender(stm.substring(0, 10) + "至" + etm.substring(0, 10) + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
|
|
@ -352,10 +359,12 @@ public class OrderStatController extends BaseController {
|
|||
public void statYearCustomer() {
|
||||
String tm = get("tm");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm);
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm, stat_product);
|
||||
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -363,10 +372,11 @@ public class OrderStatController extends BaseController {
|
|||
public void statYearBySup() {
|
||||
String tm = get("tm");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(tm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(tm, stat_product)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(tm);
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(tm, stat_product);
|
||||
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -375,11 +385,13 @@ public class OrderStatController extends BaseController {
|
|||
public void statRangeAllCustomer() {
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
Integer product_id = getInt("product_id");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm, stat_product, product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm);
|
||||
Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm, stat_product,product_id);
|
||||
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
@ -388,11 +400,13 @@ public class OrderStatController extends BaseController {
|
|||
public void statRangeAllSup() {
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
Boolean stat_product = getBoolean("stat_product",false);
|
||||
Integer product_id = getInt("product_id");
|
||||
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm)));
|
||||
renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm, stat_product,product_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(stm, etm);
|
||||
Workbook wb = OrderStatService.me.yearStatBySupExport(stm, etm, stat_product,product_id);
|
||||
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue