各砂站运输量统计表调整-增加石畈砂站虚拟站

dev
wuwenxiong 2021-10-18 17:26:03 +08:00
parent 76bea3a3ec
commit 87dcf2c864
2 changed files with 43 additions and 11 deletions

View File

@ -2151,15 +2151,32 @@ public class OrderStatService {
year = tm.substring(0, 4);
}
Record rec = new Record().set("id", 99).set("name", "石畈处置砂").set("isdeploy", 1).set("del", 0);
List<Record> sups = Db.find("select t.*, s.yield from supermarket t \n" +
" left join supermarket_yield s on s.supermarket_id = t.id and s.year = ? \n" +
" where id <= 6 or id = 11 ", year);
if (sups.size() > 0) {
sups.add(rec);
}
String paramsSql = "";
if (invoice_type != null) {
paramsSql = "and t.invoice_type = ? \n";
}
String sql_union = "union select\n" +
" ifnull(t.customer_id, 0) customer_id,\n" +
" 99 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.supermarket_id = 4" +
" and t.create_time>= '2021-09-08 00:00:00' \n" +
" and t.create_time<= '2021-10-15 23:59:59'\n" +
paramsSql +
" group by t.customer_id\n";
String sql = "select\n" +
" g.customer_id,\n" +
" ifnull(sum(g.weight), 0) weight,\n" +
@ -2171,13 +2188,15 @@ public class OrderStatService {
" ifnull(sum(case when g.supermarket_id = 5 or g.supermarket_id = 9 then g.weight end), 0) xsl_5,\n" +
" ifnull(sum(case when g.supermarket_id = 6 or g.supermarket_id = 8 or g.supermarket_id = 10 then g.weight end), 0) xsl_6,\n" +
" ifnull(sum(case when g.supermarket_id = 11 then g.weight end), 0) xsl_11,\n" +
" ifnull(sum(case when g.supermarket_id = 99 then g.weight end), 0) xsl_99,\n" +
" ifnull(sum(case when g.supermarket_id = 1 or g.supermarket_id = 7 then g.total_price end), 0) xse_1,\n" +
" ifnull(sum(case when g.supermarket_id = 2 then g.total_price end), 0) xse_2,\n" +
" ifnull(sum(case when g.supermarket_id = 3 then g.total_price end), 0) xse_3,\n" +
" ifnull(sum(case when g.supermarket_id = 4 then g.total_price end), 0) xse_4,\n" +
" ifnull(sum(case when g.supermarket_id = 5 or g.supermarket_id = 9 then g.total_price end), 0) xse_5,\n" +
" ifnull(sum(case when g.supermarket_id = 6 or g.supermarket_id = 8 or g.supermarket_id = 10 then g.total_price end), 0) xse_6,\n" +
" ifnull(sum(case when g.supermarket_id = 11 then g.total_price end), 0) xse_11\n" +
" ifnull(sum(case when g.supermarket_id = 11 then g.total_price end), 0) xse_11,\n" +
" ifnull(sum(case when g.supermarket_id = 99 then g.total_price end), 0) xse_99\n" +
" from (\n" +
" select\n" +
" ifnull(t.customer_id, 0) customer_id,\n" +
@ -2190,6 +2209,7 @@ public class OrderStatService {
" and t.create_time<= ?\n" +
paramsSql +
" group by t.customer_id, t.supermarket_id\n" +
sql_union +
" ) g\n" +
" group by g.customer_id\n";
@ -2296,6 +2316,7 @@ public class OrderStatService {
double all_xsl_5 = 0.0;
double all_xsl_6 = 0.0;
double all_xsl_11 = 0.0;
double all_xsl_99 = 0.0;
double all_xse_1 = 0.0;
double all_xse_2 = 0.0;
double all_xse_3 = 0.0;
@ -2303,6 +2324,7 @@ public class OrderStatService {
double all_xse_5 = 0.0;
double all_xse_6 = 0.0;
double all_xse_11 = 0.0;
double all_xse_99 = 0.0;
for (Record record : typelist) {
Integer customer_type_id = record.getInt("customer_type_id");
@ -2323,6 +2345,7 @@ public class OrderStatService {
double xsl_5 = 0.0;
double xsl_6 = 0.0;
double xsl_11 = 0.0;
double xsl_99 = 0.0;
double xse_1 = 0.0;
double xse_2 = 0.0;
double xse_3 = 0.0;
@ -2330,6 +2353,7 @@ public class OrderStatService {
double xse_5 = 0.0;
double xse_6 = 0.0;
double xse_11 = 0.0;
double xse_99 = 0.0;
for (Record r : list) {
prepay_total_amount += DataUtil.getDefaultByRecord(r, "prepay_total_amount");
@ -2344,6 +2368,7 @@ public class OrderStatService {
xsl_5 += DataUtil.getDefaultByRecord(r, "xsl_5");
xsl_6 += DataUtil.getDefaultByRecord(r, "xsl_6");
xsl_11 += DataUtil.getDefaultByRecord(r, "xsl_11");
xsl_99 += DataUtil.getDefaultByRecord(r, "xsl_99");
xse_1 += DataUtil.getDefaultByRecord(r, "xse_1");
xse_2 += DataUtil.getDefaultByRecord(r, "xse_2");
xse_3 += DataUtil.getDefaultByRecord(r, "xse_3");
@ -2351,6 +2376,7 @@ public class OrderStatService {
xse_5 += DataUtil.getDefaultByRecord(r, "xse_5");
xse_6 += DataUtil.getDefaultByRecord(r, "xse_6");
xse_11 += DataUtil.getDefaultByRecord(r, "xse_11");
xse_99 += DataUtil.getDefaultByRecord(r, "xse_99");
all_prepay_total_amount += DataUtil.getDefaultByRecord(r, "prepay_total_amount");
all_refund_total_amount += DataUtil.getDefaultByRecord(r, "refund_total_amount");
@ -2364,6 +2390,7 @@ public class OrderStatService {
all_xsl_5 += DataUtil.getDefaultByRecord(r, "xsl_5");
all_xsl_6 += DataUtil.getDefaultByRecord(r, "xsl_6");
all_xsl_11 += DataUtil.getDefaultByRecord(r, "xsl_11");
all_xsl_99 += DataUtil.getDefaultByRecord(r, "xsl_99");
all_xse_1 += DataUtil.getDefaultByRecord(r, "xse_1");
all_xse_2 += DataUtil.getDefaultByRecord(r, "xse_2");
all_xse_3 += DataUtil.getDefaultByRecord(r, "xse_3");
@ -2371,6 +2398,7 @@ public class OrderStatService {
all_xse_5 += DataUtil.getDefaultByRecord(r, "xse_5");
all_xse_6 += DataUtil.getDefaultByRecord(r, "xse_6");
all_xse_11 += DataUtil.getDefaultByRecord(r, "xse_11");
all_xse_99 += DataUtil.getDefaultByRecord(r, "xse_99");
}
record.set("prepay_total_amount", prepay_total_amount);
@ -2385,6 +2413,7 @@ public class OrderStatService {
record.set("xsl_5", xsl_5);
record.set("xsl_6", xsl_6);
record.set("xsl_11", xsl_11);
record.set("xsl_99", xsl_99);
record.set("xse_1", xse_1);
record.set("xse_2", xse_2);
record.set("xse_3", xse_3);
@ -2392,6 +2421,7 @@ public class OrderStatService {
record.set("xse_5", xse_5);
record.set("xse_6", xse_6);
record.set("xse_11", xse_11);
record.set("xse_99", xse_99);
}
}
@ -2422,6 +2452,7 @@ public class OrderStatService {
record.set("xsl_5", all_xsl_5);
record.set("xsl_6", all_xsl_6);
record.set("xsl_11", all_xsl_11);
record.set("xsl_99", all_xsl_99);
record.set("xse_1", all_xse_1);
record.set("xse_2", all_xse_2);
record.set("xse_3", all_xse_3);
@ -2429,6 +2460,7 @@ public class OrderStatService {
record.set("xse_5", all_xse_5);
record.set("xse_6", all_xse_6);
record.set("xse_11", all_xse_11);
record.set("xse_99", all_xse_99);
typelist.add(record);

View File

@ -163,17 +163,17 @@ public class TicketLogService extends BaseService {
Row row = sheet.createRow(0);
int a = 0;
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.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("车牌号");
@ -192,10 +192,10 @@ public class TicketLogService extends BaseService {
a = 0;
row.createCell(a++).setCellValue(i + 1);
row.createCell(a++).setCellValue(order.getStr("ticket_code"));
row.createCell(a++).setCellValue(order.getStr("invoice_number"));
row.createCell(a++).setCellValue(order.getStr("invoice_code"));
// row.createCell(a++).setCellValue(order.getStr("invoice_number"));
// row.createCell(a++).setCellValue(order.getStr("invoice_code"));
row.createCell(a++).setCellValue(order.getStr("customer_texpayer_name"));
row.createCell(a++).setCellValue(order.getStr("customer_texpayer_num"));
// row.createCell(a++).setCellValue(order.getStr("customer_texpayer_num"));
row.createCell(a++).setCellValue(order.getStr("order_sn"));
row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(order, "total_price"));
row.createCell(a++).setCellValue(DateTimeUtil.sdfhms.get().format(order.getDate("create_time")));