逐日统计表添加砂站筛选
parent
0f448353c2
commit
576af2c44a
|
|
@ -859,23 +859,36 @@ public class OrderStatService {
|
|||
* @param tm YYYY-MM
|
||||
* @return
|
||||
*/
|
||||
public List<Record> mdstat(String tm) {
|
||||
public List<Record> mdstat(String tm,Integer supermarket_id) {
|
||||
String paramsSql="";
|
||||
if(supermarket_id!=null){
|
||||
paramsSql="and t.supermarket_id = ? \n";
|
||||
}
|
||||
|
||||
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" +
|
||||
"from (\n" +
|
||||
" select t.create_time, t.weight, t.paid, t.total_price\n" +
|
||||
" from order_sale t\n" +
|
||||
" where t.state = ? \n" +
|
||||
paramsSql+
|
||||
" and t.create_time like ? \n" +
|
||||
" union all\n" +
|
||||
" select t.create_time, t.weight, t.paid, t.total_price\n" +
|
||||
" from order_temp t\n" +
|
||||
" where t.state = ? \n" +
|
||||
paramsSql+
|
||||
" and t.create_time like ? \n" +
|
||||
") 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, tm + "%", OrderStateEnum.RECEIVED.getStateid(),supermarket_id, tm + "%");
|
||||
|
||||
List<Record> dblist = Db.find(sql, OrderStateEnum.RECEIVED.getStateid(), tm + "%", OrderStateEnum.RECEIVED.getStateid(), tm + "%");
|
||||
}else {
|
||||
dblist = Db.find(sql, OrderStateEnum.RECEIVED.getStateid(), tm + "%", OrderStateEnum.RECEIVED.getStateid(), tm + "%");
|
||||
|
||||
}
|
||||
|
||||
Record total = new Record();
|
||||
total.set("date", null);
|
||||
|
|
@ -913,8 +926,8 @@ public class OrderStatService {
|
|||
* @param tm YYYY-MM
|
||||
* @return
|
||||
*/
|
||||
public Workbook mdstatExport(String tm) {
|
||||
List<Record> list = mdstat(tm);
|
||||
public Workbook mdstatExport(String tm,Integer supermarket_id) {
|
||||
List<Record> list = mdstat(tm,supermarket_id);
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("销售月逐日统计");
|
||||
|
||||
|
|
|
|||
|
|
@ -178,12 +178,13 @@ public class OrderStatController extends BaseController {
|
|||
@Before(MonthValidator.class)
|
||||
public void mdstat() {
|
||||
String tm = get("tm");
|
||||
Integer supermarket_id=getInt("supermarket_id");
|
||||
int export = getInt("export", 0);
|
||||
|
||||
if (export == 0) {
|
||||
renderJson(Result.object(OrderStatService.me.mdstat(tm)));
|
||||
renderJson(Result.object(OrderStatService.me.mdstat(tm,supermarket_id)));
|
||||
} else {
|
||||
Workbook wb = OrderStatService.me.mdstatExport(tm);
|
||||
Workbook wb = OrderStatService.me.mdstatExport(tm,supermarket_id);
|
||||
render(new ExcelRender(tm + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue