统计添加客户类型筛选

dev
lisai17@sina.com 2021-09-22 14:56:57 +08:00
parent 1446981fd6
commit 4e0227d14c
4 changed files with 647 additions and 431 deletions

View File

@ -17,16 +17,16 @@ public class OrderStatController extends BaseController {
*/ */
@Before(DayValidator.class) @Before(DayValidator.class)
public void daydetail() { public void daydetail() {
String tm = get("tm"); String tm = get("tm");
String truck_license = getUpperCaseVal("truck_license"); String truck_license = getUpperCaseVal("truck_license");
String sn = get("sn"); String sn = get("sn");
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer trans_co_id = getInt("trans_co_id"); Integer trans_co_id = getInt("trans_co_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
Integer type = getInt("type"); Integer type = getInt("type");
Integer isprepaid = getInt("isprepaid"); Integer isprepaid = getInt("isprepaid");
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
Integer customer_type_id = getInt("customer_type_id"); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
@ -69,8 +69,8 @@ public class OrderStatController extends BaseController {
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); int export = getInt("export", 0);
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.monthgrid(tm, supermarket_id, customer_id, stat_product, product_id))); renderJson(Result.object(OrderStatService.me.monthgrid(tm, supermarket_id, customer_id, stat_product, product_id)));
@ -117,14 +117,16 @@ public class OrderStatController extends BaseController {
*/ */
@Before(DayValidator.class) @Before(DayValidator.class)
public void daystatCustomer() { public void daystatCustomer() {
String tm = get("tm"); String tm = get("tm");
Integer invoice_type = getInt("invoice_type"); Integer invoice_type = getInt("invoice_type");
int export = getInt("export", 0); Integer customer_id = getInt("customer_id");
Boolean stat_product = getBoolean("stat_product",false); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0);
Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product))); renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type, stat_product); Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type, stat_product, customer_id, customer_type_id);
render(new ExcelRender(tm + "_销售日统计_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_销售日统计_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@ -134,14 +136,16 @@ public class OrderStatController extends BaseController {
*/ */
@Before(MonthValidator.class) @Before(MonthValidator.class)
public void monthstatCustomer() { public void monthstatCustomer() {
String tm = get("tm"); String tm = get("tm");
Integer invoice_type = getInt("invoice_type"); Integer invoice_type = getInt("invoice_type");
int export = getInt("export", 0); Integer customer_id = getInt("customer_id");
Boolean stat_product = getBoolean("stat_product",false); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0);
Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product))); renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type, stat_product); Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type, stat_product, customer_id, customer_type_id);
render(new ExcelRender(tm + "_销售月统计_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_销售月统计_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@ -155,7 +159,7 @@ public class OrderStatController extends BaseController {
String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59" String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59"
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
int export = getInt("export", 0); int export = getInt("export", 0);
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
if (export == 0) { if (export == 0) {
@ -231,19 +235,20 @@ public class OrderStatController extends BaseController {
*/ */
@Before(DayValidator.class) @Before(DayValidator.class)
public void statDayCustomer() { public void statDayCustomer() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_ids = get("customer_ids"); Integer customer_type_id = getInt("customer_type_id");
Integer product_id = getInt("product_id"); String customer_ids = get("customer_ids");
boolean stat_product = getBoolean("stat_product", false); Integer product_id = getInt("product_id");
Integer isprepaid = getInt("isprepaid"); boolean stat_product = getBoolean("stat_product", false);
Integer isprepaid = getInt("isprepaid");
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid))); renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid)));
} else { } else {
Workbook wb = OrderStatService.me.statCustomerExport("砂站日销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid); Workbook wb = OrderStatService.me.statCustomerExport("砂站日销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid);
render(new ExcelRender(tm + "_砂站日" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_砂站日" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@ -253,91 +258,97 @@ public class OrderStatController extends BaseController {
*/ */
@Before(MonthValidator.class) @Before(MonthValidator.class)
public void statMonthCustomer() { public void statMonthCustomer() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_ids = get("customer_ids"); Integer customer_type_id = getInt("customer_type_id");
Integer product_id = getInt("product_id"); String customer_ids = get("customer_ids");
boolean stat_product = getBoolean("stat_product", false); Integer product_id = getInt("product_id");
Integer isprepaid = getInt("isprepaid"); boolean stat_product = getBoolean("stat_product", false);
Integer isprepaid = getInt("isprepaid");
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid))); renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid)));
} else { } else {
Workbook wb = OrderStatService.me.statCustomerExport("砂站月销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid); Workbook wb = OrderStatService.me.statCustomerExport("砂站月销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid);
render(new ExcelRender(tm + "_砂站月" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_砂站月" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@Before(StartAndEndIntervalValidator.class) @Before(StartAndEndIntervalValidator.class)
public void statRangeCustomer() { public void statRangeCustomer() {
String stm = get("stm"); // 前端将 YYYY-MM-DD 后面补 " 00:00:00" String stm = get("stm"); // 前端将 YYYY-MM-DD 后面补 " 00:00:00"
String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59" String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59"
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_ids = get("customer_ids"); Integer customer_type_id = getInt("customer_type_id");
Integer product_id = getInt("product_id"); String customer_ids = get("customer_ids");
boolean stat_product = getBoolean("stat_product", false); Integer product_id = getInt("product_id");
Integer isprepaid = getInt("isprepaid"); boolean stat_product = getBoolean("stat_product", false);
Integer isprepaid = getInt("isprepaid");
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.statCustomer(null, stm, etm, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid))); renderJson(Result.object(OrderStatService.me.statCustomer(null, stm, etm, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid)));
} else { } else {
Workbook wb = OrderStatService.me.statCustomerExport("砂站时段销售汇总表", null, stm, etm, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid); Workbook wb = OrderStatService.me.statCustomerExport("砂站时段销售汇总表", null, stm, etm, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid);
render(new ExcelRender(stm + "_" + etm + "_砂站" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(stm + "_" + etm + "_砂站" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
public void statYearCustomer() { public void statYearCustomer() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 Integer customer_id = getInt("customer_id");
Boolean stat_product = getBoolean("stat_product",false); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm, stat_product))); renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm, stat_product, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm, stat_product); Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm, stat_product, customer_id, customer_type_id);
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
public void statYearBySup() { public void statYearBySup() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatBySup(tm, stat_product))); renderJson(Result.object(OrderStatService.me.salestat(tm)));
} else { } else {
Workbook wb = OrderStatService.me.yearStatBySupExport(tm, stat_product); Workbook wb = OrderStatService.me.yearsalestatExport(tm);
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@Before(StartAndEndIntervalValidator.class) @Before(StartAndEndIntervalValidator.class)
public void statRangeAllCustomer() { public void statRangeAllCustomer() {
String stm = get("stm"); String stm = get("stm");
String etm = get("etm"); String etm = get("etm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
Integer customer_id = getInt("customer_id");
Integer customer_type_id = getInt("customer_type_id");
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm, stat_product, product_id))); renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm, stat_product, product_id, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm, stat_product, product_id); Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm, stat_product, product_id, customer_id, customer_type_id);
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@Before(StartAndEndIntervalValidator.class) @Before(StartAndEndIntervalValidator.class)
public void statRangeAllSup() { public void statRangeAllSup() {
String stm = get("stm"); String stm = get("stm");
String etm = get("etm"); String etm = get("etm");
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm, stat_product, product_id))); renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm, stat_product, product_id)));
@ -351,10 +362,10 @@ public class OrderStatController extends BaseController {
* *
*/ */
public void yearStatisticsByCustomerId() { public void yearStatisticsByCustomerId() {
String year = get("year"); String year = get("year");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_name = get("customer_name"); String customer_name = get("customer_name");
Integer type = getInt("type"); Integer type = getInt("type");
renderJson(Result.object(OrderStatService.me.yearStatisticsByCustomerId(year, customer_id, customer_name, type))); renderJson(Result.object(OrderStatService.me.yearStatisticsByCustomerId(year, customer_id, customer_name, type)));
} }
} }

View File

@ -193,9 +193,15 @@ public class StatSmsJob implements Job {
/** /**
* *
* 2021-08-17 * 2021-09-22
* 20201230314677.26420953.4 *
* 2021=2021 -2000+2020123031 * 274.62-27.34
* 21830.32-2011.27
*
*
*
* 27.342011.27
* 274.6221830.32
*/ */
public void statAggr() { public void statAggr() {
Date now = new Date(); Date now = new Date();
@ -264,8 +270,18 @@ public class StatSmsJob implements Job {
} }
obj.put("aggr_cnt", orderobj.get("aggr_cnt")); obj.put("aggr_cnt", orderobj.get("aggr_cnt"));
obj.put("aggr_weight", String.format("%.2f万", orderobj.getBigDecimal("aggr_weight").divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP))); obj.put("aggr_weight", String.format("%.2f万",
obj.put("aggr_price", String.format("%.2f万", orderobj.getBigDecimal("aggr_price").divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP))); orderobj.getBigDecimal("aggr_weight")
.divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)
.subtract(new BigDecimal("27.34"))
)
);
obj.put("aggr_price", String.format("%.2f万",
orderobj.getBigDecimal("aggr_price")
.divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)
.subtract(new BigDecimal("2011.27"))
)
);
obj.put("customer_weight", String.format("%.2f万", revenueobj.getBigDecimal("weight").divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP))); obj.put("customer_weight", String.format("%.2f万", revenueobj.getBigDecimal("weight").divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)));
obj.put("customer_price", String.format("%.2f万", revenueobj.getBigDecimal("total_price").divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP))); obj.put("customer_price", String.format("%.2f万", revenueobj.getBigDecimal("total_price").divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_HALF_UP)));

View File

@ -40,10 +40,10 @@ public class OrderStatController extends BaseController {
customer_id = tokenuser.getEntityId(); customer_id = tokenuser.getEntityId();
} }
Integer type = getInt("type"); Integer type = getInt("type");
Integer isprepaid = getInt("isprepaid"); Integer isprepaid = getInt("isprepaid");
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
Integer customer_type_id = getInt("customer_type_id"); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
@ -84,8 +84,8 @@ public class OrderStatController extends BaseController {
public void monthgrid() { public void monthgrid() {
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token")); Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
@ -145,15 +145,17 @@ public class OrderStatController extends BaseController {
*/ */
@Before(DayValidator.class) @Before(DayValidator.class)
public void daystatCustomer() { public void daystatCustomer() {
String tm = get("tm"); String tm = get("tm");
Integer invoice_type = getInt("invoice_type"); Integer invoice_type = getInt("invoice_type");
int export = getInt("export", 0); Integer customer_id = getInt("customer_id");
Boolean stat_product = getBoolean("stat_product",false); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0);
Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product))); renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type, stat_product); Workbook wb = OrderStatService.me.daysalestatCustomerExport(tm, invoice_type, stat_product, customer_id, customer_type_id);
render(new ExcelRender(tm + "_销售日统计_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_销售日统计_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@ -163,15 +165,17 @@ public class OrderStatController extends BaseController {
*/ */
@Before(MonthValidator.class) @Before(MonthValidator.class)
public void monthstatCustomer() { public void monthstatCustomer() {
String tm = get("tm"); String tm = get("tm");
Integer invoice_type = getInt("invoice_type"); Integer invoice_type = getInt("invoice_type");
int export = getInt("export", 0); Integer customer_id = getInt("customer_id");
Boolean stat_product = getBoolean("stat_product",false); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0);
Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product))); renderJson(Result.object(OrderStatService.me.salestatCustomer(tm, invoice_type, stat_product, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type, stat_product); Workbook wb = OrderStatService.me.monthsalestatCustomerExport(tm, invoice_type, stat_product, customer_id, customer_type_id);
render(new ExcelRender(tm + "_销售月统计_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_销售月统计_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@ -184,14 +188,14 @@ public class OrderStatController extends BaseController {
String stm = get("stm"); // 前端将 YYYY-MM-DD 后面补 " 00:00:00" String stm = get("stm"); // 前端将 YYYY-MM-DD 后面补 " 00:00:00"
String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59" String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59"
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
int export = getInt("export", 0); int export = getInt("export", 0);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.mdstat(stm, etm, supermarket_id, stat_product,product_id))); renderJson(Result.object(OrderStatService.me.mdstat(stm, etm, supermarket_id, stat_product, product_id)));
} else { } else {
Workbook wb = OrderStatService.me.mdstatExport(stm, etm, supermarket_id, stat_product,product_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)); render(new ExcelRender(stm.substring(0, 10) + "至" + etm.substring(0, 10) + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
} }
@ -261,11 +265,12 @@ public class OrderStatController extends BaseController {
*/ */
@Before(DayValidator.class) @Before(DayValidator.class)
public void statDayCustomer() { public void statDayCustomer() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_ids = get("customer_ids"); Integer customer_type_id = getInt("customer_type_id");
String customer_ids = get("customer_ids");
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token")); Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
@ -274,8 +279,9 @@ public class OrderStatController extends BaseController {
renderJson(Result.noauth()); renderJson(Result.noauth());
return; return;
} else if (tokenuser.getType() == UserTypeEnum.CUSTOMER.getTypeid()) { } else if (tokenuser.getType() == UserTypeEnum.CUSTOMER.getTypeid()) {
customer_id = tokenuser.getEntityId(); customer_id = tokenuser.getEntityId();
customer_ids = null; customer_ids = null;
customer_type_id = null;
} }
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
@ -283,9 +289,9 @@ public class OrderStatController extends BaseController {
Integer isprepaid = getInt("isprepaid"); Integer isprepaid = getInt("isprepaid");
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid))); renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid)));
} else { } else {
Workbook wb = OrderStatService.me.statCustomerExport("砂站日销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid); Workbook wb = OrderStatService.me.statCustomerExport("砂站日销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid);
render(new ExcelRender(tm + "_砂站日" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_砂站日" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@ -295,11 +301,12 @@ public class OrderStatController extends BaseController {
*/ */
@Before(MonthValidator.class) @Before(MonthValidator.class)
public void statMonthCustomer() { public void statMonthCustomer() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_ids = get("customer_ids"); Integer customer_type_id = getInt("customer_type_id");
String customer_ids = get("customer_ids");
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token")); Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
@ -317,21 +324,22 @@ public class OrderStatController extends BaseController {
Integer isprepaid = getInt("isprepaid"); Integer isprepaid = getInt("isprepaid");
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid))); renderJson(Result.object(OrderStatService.me.statCustomer(tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid)));
} else { } else {
Workbook wb = OrderStatService.me.statCustomerExport("砂站月销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid); Workbook wb = OrderStatService.me.statCustomerExport("砂站月销售汇总表", tm, null, null, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid);
render(new ExcelRender(tm + "_砂站月" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(tm + "_砂站月" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@Before(StartAndEndIntervalValidator.class) @Before(StartAndEndIntervalValidator.class)
public void statRangeCustomer() { public void statRangeCustomer() {
String stm = get("stm"); // 前端将 YYYY-MM-DD 后面补 " 00:00:00" String stm = get("stm"); // 前端将 YYYY-MM-DD 后面补 " 00:00:00"
String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59" String etm = get("etm"); // 前端将 YYYY-MM-DD 后面补 " 23:59:59"
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Integer supermarket_id = getInt("supermarket_id"); Integer supermarket_id = getInt("supermarket_id");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_ids = get("customer_ids"); Integer customer_type_id = getInt("customer_type_id");
String customer_ids = get("customer_ids");
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token")); Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
@ -349,64 +357,69 @@ public class OrderStatController extends BaseController {
Integer isprepaid = getInt("isprepaid"); Integer isprepaid = getInt("isprepaid");
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.statCustomer(null, stm, etm, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid))); renderJson(Result.object(OrderStatService.me.statCustomer(null, stm, etm, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid)));
} else { } else {
Workbook wb = OrderStatService.me.statCustomerExport("砂站时段销售汇总表", null, stm, etm, supermarket_id, customer_id, customer_ids, stat_product, product_id, isprepaid); Workbook wb = OrderStatService.me.statCustomerExport("砂站时段销售汇总表", null, stm, etm, supermarket_id, customer_id, customer_ids, customer_type_id, stat_product, product_id, isprepaid);
render(new ExcelRender(stm + "_" + etm + "_砂站" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender(stm + "_" + etm + "_砂站" + (isprepaid != null && isprepaid == 1 ? "预付费" : "") + "销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
public void statYearCustomer() { public void statYearCustomer() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 Integer customer_id = getInt("customer_id");
Boolean stat_product = getBoolean("stat_product",false); Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm, stat_product))); renderJson(Result.object(OrderStatService.me.yearStatByCustomer(tm, stat_product, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm, stat_product); Workbook wb = OrderStatService.me.yearStatByCustomerExport(tm, stat_product, customer_id, customer_type_id);
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
public void statYearBySup() { public void statYearBySup() {
String tm = get("tm"); String tm = get("tm");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatBySup(tm, stat_product))); renderJson(Result.object(OrderStatService.me.salestat(tm)));
} else { } else {
Workbook wb = OrderStatService.me.yearStatBySupExport(tm, stat_product); Workbook wb = OrderStatService.me.yearsalestatExport(tm);
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@Before(StartAndEndIntervalValidator.class) @Before(StartAndEndIntervalValidator.class)
public void statRangeAllCustomer() { public void statRangeAllCustomer() {
String stm = get("stm"); String stm = get("stm");
String etm = get("etm"); String etm = get("etm");
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 Integer customer_id = getInt("customer_id");
Integer customer_type_id = getInt("customer_type_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm, stat_product, product_id))); renderJson(Result.object(OrderStatService.me.yearStatByCustomer(stm, etm, stat_product, product_id, customer_id, customer_type_id)));
} else { } else {
Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm, stat_product,product_id); Workbook wb = OrderStatService.me.yearStatByCustomerExport(stm, etm, stat_product, product_id, customer_id, customer_type_id);
render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender("按客户统计总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@Before(StartAndEndIntervalValidator.class) @Before(StartAndEndIntervalValidator.class)
public void statRangeAllSup() { public void statRangeAllSup() {
String stm = get("stm"); String stm = get("stm");
String etm = get("etm"); String etm = get("etm");
Boolean stat_product = getBoolean("stat_product",false); Boolean stat_product = getBoolean("stat_product", false);
Integer product_id = getInt("product_id"); Integer product_id = getInt("product_id");
int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出 int export = getInt("export", 0); // 是否导出为exce 0 不导出1 导出
if (export == 0) { if (export == 0) {
renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm, stat_product,product_id))); renderJson(Result.object(OrderStatService.me.yearStatBySup(stm, etm, stat_product, product_id)));
} else { } else {
Workbook wb = OrderStatService.me.yearStatBySupExport(stm, etm, stat_product,product_id); Workbook wb = OrderStatService.me.yearStatBySupExport(stm, etm, stat_product, product_id);
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb)); render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
} }
} }
@ -432,10 +445,10 @@ public class OrderStatController extends BaseController {
* *
*/ */
public void yearStatisticsByCustomerId() { public void yearStatisticsByCustomerId() {
String year = get("year"); String year = get("year");
Integer customer_id = getInt("customer_id"); Integer customer_id = getInt("customer_id");
String customer_name = get("customer_name"); String customer_name = get("customer_name");
Integer type = getInt("type"); Integer type = getInt("type");
renderJson(Result.object(OrderStatService.me.yearStatisticsByCustomerId(year, customer_id, customer_name, type))); renderJson(Result.object(OrderStatService.me.yearStatisticsByCustomerId(year, customer_id, customer_name, type)));
} }