dev
parent
9cfdbf85cf
commit
65f18b634f
|
|
@ -2,7 +2,10 @@ package com.cowr.ssjygl.order.ordertemp;
|
|||
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.enums.OrderStateEnum;
|
||||
import com.cowr.common.enums.UserTypeEnum;
|
||||
import com.cowr.common.utils.DataUtil;
|
||||
import com.cowr.common.utils.DateTimeUtil;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.OrderTemp;
|
||||
|
|
@ -11,6 +14,10 @@ import com.jfinal.kit.StrKit;
|
|||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -131,9 +138,9 @@ public class OrderTempService extends BaseService {
|
|||
paraList.add(product_id);
|
||||
}
|
||||
|
||||
if(invoice_code_is_null != null && invoice_code_is_null){
|
||||
if (invoice_code_is_null != null && invoice_code_is_null) {
|
||||
fromsql += " and t.invoice_code is null \n";
|
||||
}else{
|
||||
} else {
|
||||
if (StrKit.notBlank(invoice_code)) {
|
||||
fromsql += " and t.invoice_code like ? \n";
|
||||
paraList.add("%" + invoice_code + "%");
|
||||
|
|
@ -168,4 +175,161 @@ public class OrderTempService extends BaseService {
|
|||
|
||||
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||
}
|
||||
|
||||
|
||||
public Workbook export(String sn,
|
||||
String truck_license,
|
||||
Integer supermarket_id,
|
||||
Integer customer_id,
|
||||
String customer_name,
|
||||
String stm,
|
||||
String etm,
|
||||
Integer isprepaid,
|
||||
Integer state,
|
||||
String invoice_code,
|
||||
Integer invoice_type,
|
||||
Integer product_id,
|
||||
Boolean invoice_code_is_null
|
||||
) {
|
||||
String selectsql = "select t.* " +
|
||||
", p.order_sn \n" +
|
||||
", p.in_time, p.out_time, p.in_which, p.out_which, p.in_mode, p.out_mode \n" +
|
||||
", p.first_weight, p.second_weight, p.first_weigh_mode, p.second_weight_mode \n" +
|
||||
", p.first_pic, p.first_weight_which, p.second_weight_which, p.second_pic \n" +
|
||||
", p.arrive_time, p.type, p.memo transport_memo, s.name supermarket_name \n";
|
||||
String fromsql = "from order_temp t \n" +
|
||||
" left join transport p on p.order_sn = t.sn \n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id \n" +
|
||||
" where 1=1 ";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (StrKit.notBlank(sn)) {
|
||||
fromsql += " and t.sn like ? \n";
|
||||
paraList.add("%" + sn + "%");
|
||||
}
|
||||
|
||||
if (supermarket_id != null) {
|
||||
fromsql += " and t.supermarket_id = ? \n";
|
||||
paraList.add(supermarket_id);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(truck_license)) {
|
||||
fromsql += " and t.truck_license like ? \n";
|
||||
paraList.add("%" + truck_license + "%");
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(customer_name)) {
|
||||
fromsql += " and t.customer_name like ? \n";
|
||||
paraList.add("%" + customer_name + "%");
|
||||
}
|
||||
|
||||
if (customer_id != null) {
|
||||
fromsql += " and t.customer_id = ? \n";
|
||||
paraList.add(customer_id);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(stm)) {
|
||||
fromsql += " and t.create_time >= ? \n";
|
||||
paraList.add(stm);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(etm)) {
|
||||
fromsql += " and t.create_time <= ? \n";
|
||||
paraList.add(etm);
|
||||
}
|
||||
|
||||
if (isprepaid != null) {
|
||||
fromsql += " and t.isprepaid = ? \n";
|
||||
paraList.add(isprepaid);
|
||||
}
|
||||
|
||||
if (product_id != null) {
|
||||
fromsql += " and t.product_id = ? \n";
|
||||
paraList.add(product_id);
|
||||
}
|
||||
|
||||
if (invoice_code_is_null != null && invoice_code_is_null) {
|
||||
fromsql += " and t.invoice_code is null \n";
|
||||
} else {
|
||||
if (StrKit.notBlank(invoice_code)) {
|
||||
fromsql += " and t.invoice_code like ? \n";
|
||||
paraList.add("%" + invoice_code + "%");
|
||||
}
|
||||
}
|
||||
|
||||
if (state != null) {
|
||||
fromsql += " and t.state = ? \n";
|
||||
paraList.add(state);
|
||||
}
|
||||
|
||||
if (invoice_type != null) {
|
||||
fromsql += " and t.invoice_type = ? \n";
|
||||
paraList.add(invoice_type);
|
||||
}
|
||||
|
||||
String findSql = selectsql + fromsql + " order by t.create_time desc";
|
||||
List<Record> list = Db.find(findSql, paraList.toArray());
|
||||
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("运输日志");
|
||||
|
||||
// 表头 start
|
||||
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("开票人");
|
||||
// 表头 end
|
||||
|
||||
int datalen = list.size();
|
||||
for (int i = 0; i < datalen; i++) {
|
||||
Record order = list.get(i);
|
||||
|
||||
row = sheet.createRow(i + 1);
|
||||
a = 0;
|
||||
row.createCell(a++).setCellValue(i + 1);
|
||||
row.createCell(a++).setCellValue(order.getStr("sn"));
|
||||
row.createCell(a++).setCellValue(DateTimeUtil.sdfhms.get().format(order.getDate("create_time")));
|
||||
row.createCell(a++).setCellValue(order.getStr("supermarket_name"));
|
||||
row.createCell(a++).setCellValue(order.getStr("customer_texpayer_name"));
|
||||
row.createCell(a++).setCellValue(order.getStr("customer_texpayer_num"));
|
||||
row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(order, "weight"));
|
||||
row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(order, "first_weight"));
|
||||
row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(order, "second_weight"));
|
||||
row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(order, "total_price"));
|
||||
row.createCell(a++).setCellValue(order.getStr("truck_license"));
|
||||
row.createCell(a++).setCellValue(order.getStr("invoice_number"));
|
||||
row.createCell(a++).setCellValue(order.getStr("invoice_code"));
|
||||
row.createCell(a++).setCellValue(order.getInt("invoice_type") == 2 ? "专票" : "普票");
|
||||
|
||||
switch (order.getInt("state")) {
|
||||
case 1:
|
||||
row.createCell(a++).setCellValue("新建"); break;
|
||||
case 4:
|
||||
row.createCell(a++).setCellValue("待付款"); break;
|
||||
case 5:
|
||||
row.createCell(a++).setCellValue("已完成"); break;
|
||||
case 9:
|
||||
row.createCell(a++).setCellValue("已取消"); break;
|
||||
default:
|
||||
row.createCell(a++).setCellValue("");
|
||||
}
|
||||
row.createCell(a++).setCellValue(order.getStr("settlement_user_name"));
|
||||
}
|
||||
|
||||
return wb;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,17 +3,19 @@ package com.cowr.local.ssjygl.order.ordertemp;
|
|||
import com.cowr.common.base.BaseController;
|
||||
import com.cowr.common.enums.Enums;
|
||||
import com.cowr.common.enums.OrderTypeEnum;
|
||||
import com.cowr.common.validator.StartAndEndIntervalValidator;
|
||||
import com.cowr.common.view.ExcelRender;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.local.ssjygl.order.LocalOrderService;
|
||||
import com.cowr.local.ssjygl.system.sysuser.SysuserSyncService;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.ssjygl.order.OrderCancelValidator;
|
||||
import com.cowr.ssjygl.order.SnValidator;
|
||||
import com.cowr.ssjygl.order.ordertemp.OrderTempPKValidator;
|
||||
import com.cowr.ssjygl.order.ordertemp.OrderTempService;
|
||||
import com.jfinal.aop.Before;
|
||||
import com.jfinal.log.Log;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
public class OrderTempController extends BaseController {
|
||||
private static Log log = Log.getLog(OrderTempController.class);
|
||||
|
|
@ -44,6 +46,27 @@ public class OrderTempController extends BaseController {
|
|||
renderJson(Result.object(OrderTempService.me.find(pp, sn, truck_license, supermarket_id, customer_id, customer_name, stm, etm, isprepaid, state, invoice_code, invoice_type, product_id, invoice_code_is_null)));
|
||||
}
|
||||
|
||||
@Before(StartAndEndIntervalValidator.class)
|
||||
public void export() {
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
String truck_license = getUpperCaseVal("truck_license");
|
||||
String customer_name = get("customer_name");
|
||||
String sn = get("sn");
|
||||
Integer state = getInt("state");
|
||||
Integer product_id = getInt("product_id");
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
Integer isprepaid = getInt("isprepaid");
|
||||
String invoice_code = get("invoice_code");
|
||||
Integer invoice_type = getInt("invoice_type");
|
||||
Integer customer_id = getInt("customer_id");
|
||||
Boolean invoice_code_is_null = getBoolean("invoice_code_is_null");
|
||||
|
||||
Workbook wb = OrderTempService.me.export(sn, truck_license, supermarket_id, customer_id, customer_name, stm, etm, isprepaid, state, invoice_code, invoice_type, product_id, invoice_code_is_null);
|
||||
|
||||
render(new ExcelRender("运输日志_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
|
||||
@Before(OrderTempPayValidator.class)
|
||||
public void pay() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.cowr.service.ssjygl.order.ordertemp;
|
|||
|
||||
import com.cowr.common.base.BaseController;
|
||||
import com.cowr.common.enums.UserTypeEnum;
|
||||
import com.cowr.common.validator.StartAndEndIntervalValidator;
|
||||
import com.cowr.common.view.ExcelRender;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.Sysuser;
|
||||
|
|
@ -10,6 +12,7 @@ import com.cowr.ssjygl.order.OrderCancelValidator;
|
|||
import com.cowr.ssjygl.order.ordertemp.OrderTempPKValidator;
|
||||
import com.cowr.ssjygl.order.ordertemp.OrderTempService;
|
||||
import com.jfinal.aop.Before;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
public class OrderTempController extends BaseController {
|
||||
@Before(OrderTempPKValidator.class)
|
||||
|
|
@ -57,6 +60,27 @@ public class OrderTempController extends BaseController {
|
|||
renderJson(Result.object(OrderTempService.me.find(pp, sn, truck_license, supermarket_id, customer_id, customer_name, stm, etm, isprepaid, state, invoice_code, invoice_type, product_id, invoice_code_is_null)));
|
||||
}
|
||||
|
||||
@Before(StartAndEndIntervalValidator.class)
|
||||
public void export() {
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
String truck_license = getUpperCaseVal("truck_license");
|
||||
String customer_name = get("customer_name");
|
||||
String sn = get("sn");
|
||||
Integer state = getInt("state");
|
||||
Integer product_id = getInt("product_id");
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
Integer isprepaid = getInt("isprepaid");
|
||||
String invoice_code = get("invoice_code");
|
||||
Integer invoice_type = getInt("invoice_type");
|
||||
Integer customer_id = getInt("customer_id");
|
||||
Boolean invoice_code_is_null = getBoolean("invoice_code_is_null");
|
||||
|
||||
Workbook wb = OrderTempService.me.export(sn, truck_license, supermarket_id, customer_id, customer_name, stm, etm, isprepaid, state, invoice_code, invoice_type, product_id, invoice_code_is_null);
|
||||
|
||||
render(new ExcelRender("运输日志_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单取消
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue