联调修改

dev
wany 2025-04-07 15:24:13 +08:00
parent efc87ba4b2
commit 1c65dae6cf
4 changed files with 221 additions and 6 deletions

View File

@ -839,4 +839,191 @@ public class OrderTempService extends BaseService {
return wb;
}
public List<Record> findList(String sn,
String truck_license,
Integer supermarket_id,
Integer supermarket_type,
Integer customer_id,
String customer_name,
String stm,
String etm,
Integer isprepaid,
Integer state,
Integer type,
String invoice_code,
Integer invoice_type,
String ticket_code,
Integer product_id,
Boolean invoice_code_is_null
) {
String selectsql = "select t.* ,t.sn as old_sn,t.ticket_code as old_ticket_code,ot.ticket_code as new_ticket_code,ot.sn as new_sn" +
", 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" +
", ot.trans_price in_trans_price, ot.weight in_weight \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" +
" left join order_transfer ot on ot.old_sn = t.sn \n" +
" where 1=1 ";
List<Object> paraList = new ArrayList<>();
if (supermarket_type != null && supermarket_type == 3) {
selectsql = "select t.*,t.ticket_code as new_ticket_code,t.sn as new_sn " +
", 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" +
", s1.name customer_name \n" +
", t.trans_price in_trans_price, t.weight in_weight,ot.ticket_code as old_ticket_code \n";
fromsql = "from order_transfer t \n" +
" left join transport p on p.order_sn = t.sn \n" +
" left join supermarket s on s.id = t.sandfarm_id \n" +
" left join supermarket s1 on s1.id = t.supermarket_id \n" +
" left join order_temp ot on t.old_sn = ot.sn \n" +
" where 1=1 ";
supermarket_type = 1;
}
if (StrKit.notBlank(sn)) {
fromsql += " and t.sn like ? \n";
paraList.add("%" + sn.trim() + "%");
}
if (supermarket_id != null) {
fromsql += " and s.id = ? \n";
paraList.add(supermarket_id);
}
if (supermarket_type != null) {
fromsql += " and s.type = ? \n";
paraList.add(supermarket_type);
}
if (StrKit.notBlank(truck_license)) {
fromsql += " and t.truck_license like ? \n";
paraList.add("%" + truck_license.trim() + "%");
}
if (StrKit.notBlank(customer_name)) {
if (supermarket_type != null && supermarket_type == 1){
fromsql += " and s1.name like ? \n";
}else{
fromsql += " and t.customer_name like ? \n";
}
paraList.add("%" + customer_name.trim() + "%");
}
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.trim() + "%");
}
}
if (state != null) {
fromsql += " and t.state = ? \n";
paraList.add(state);
}
if (type != null && (type == 0 || type == 1)) {
fromsql += " and t.sale_type = ? \n";
paraList.add(type);
}
if (invoice_type != null) {
fromsql += " and t.invoice_type = ? \n";
paraList.add(invoice_type);
}
if (StrKit.notBlank(ticket_code)) {
fromsql += " and t.ticket_code like ? \n";
paraList.add("%" + ticket_code.trim() + "%");
}
String findSql = selectsql + fromsql;
// 前端传了排序字段,并且排序字段存在相关表中
findSql += " order by t.create_time desc";
List<Record> list = Db.find(findSql, paraList.toArray());
if (!list.isEmpty()) {
List<String> sqlparams = new ArrayList<>();
List<String> params = new ArrayList<>();
for (Record record : list) {
sqlparams.add("?");
params.add(record.getStr("sn"));
}
if (!sqlparams.isEmpty()) {
// 一个订单的发票可以作废多次,但是每个订单只能有一个是正在作废中的
List<InvoiceInvalidVerify> verifies1 = InvoiceInvalidVerify.dao.find(
"select * from invoice_invalid_verify t where t.order_sn in(" + StrKit.join(sqlparams, ",") + ") and t.state = 1 ", params.toArray());
List<OrderInvalidVerify> verifies2 = OrderInvalidVerify.dao.find(
"select * from order_invalid_verify t where t.order_sn in(" + StrKit.join(sqlparams, ",") + ") and ( t.state = 1 or t.state = 2 )", params.toArray());
List<TicketInvalidVerify> verifies3 = TicketInvalidVerify.dao.find(
"select * from ticket_invalid_verify t where t.order_sn in(" + StrKit.join(sqlparams, ",") + ") and t.state = 1 ", params.toArray());
for (Record record : list) {
String rdsn = record.getStr("sn");
for (InvoiceInvalidVerify v : verifies1) {
if (rdsn.equals(v.getOrderSn())) {
record.set("invoice_invalid_verify_state", 1);
}
}
for (TicketInvalidVerify v : verifies3) {
if (rdsn.equals(v.getOrderSn())) {
record.set("ticket_invalid_verify_state", 1);
}
}
for (OrderInvalidVerify v : verifies2) {
if (rdsn.equals(v.getOrderSn())) {
record.set("order_invalid_verify_state", 1);
}
}
}
}
}
return list;
}
}

View File

@ -69,6 +69,7 @@ import com.cowr.service.ssjygl.ticket.log.TicketLogController;
import com.cowr.service.ssjygl.ticket.receive.TicketReceiveController;
import com.cowr.service.ssjygl.transport.TransportQueryController;
import com.cowr.service.ssjygl.transportcompany.TransportCompanyController;
import com.cowr.service.ssjygl.transpriceconfig.TransPriceConfigTransferController;
import com.cowr.service.ssjygl.transpricelog.TransPriceLogController;
import com.cowr.service.ssjygl.truck.TruckController;
import com.cowr.service.ssjygl.truck.truckweightlimit.TruckWeightLimitController;
@ -261,6 +262,8 @@ public class Config extends JFinalConfig {
// -- 数据初始化
me.add("/init", InitDataController.class);
me.add("/price/transfer", TransPriceConfigTransferController.class);
}
@Override

View File

@ -69,6 +69,37 @@ public class OrderTempController extends BaseController {
renderJson(Result.object(OrderTempService.me.find(pp, sn, truck_license, supermarket_id, supermarket_type, customer_id, customer_name, stm, etm, isprepaid, state, type, invoice_code, invoice_type, ticket_code, product_id, invoice_code_is_null)));
}
public void findList() {
String stm = get("stm", now().minusDays(TM_TIME) + " 00:00:00");
String etm = get("etm",now() + " 23:59:59");
String truck_license = getUpperCaseVal("truck_license");
String customer_name = get("customer_name");
String sn = get("sn");
Integer state = getInt("state");
Integer type = getInt("type");
String invoice_code = get("invoice_code");
String ticket_code = get("ticket_code");
Integer product_id = getInt("product_id");
Integer invoice_type = getInt("invoice_type");
Integer supermarket_id = getInt("supermarket_id");
Integer supermarket_type = getInt("supermarket_type");
Integer isprepaid = getInt("isprepaid");
Integer customer_id = getInt("customer_id");
Boolean invoice_code_is_null = getBoolean("invoice_code_is_null");
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
// 是客户账户
if (tokenuser == null) {
renderJson(Result.noauth());
return;
} else if (tokenuser.getType() == UserTypeEnum.CUSTOMER.getTypeid()) {
customer_id = tokenuser.getEntityId();
}
renderJson(Result.object(OrderTempService.me.findList(sn, truck_license, supermarket_id, supermarket_type, customer_id, customer_name, stm, etm, isprepaid, state, type, invoice_code, invoice_type, ticket_code, product_id, invoice_code_is_null)));
}
@Before(StartAndEndIntervalValidator.class)
public void export1() {
String stm = get("stm", now().minusDays(TM_TIME) + " 00:00:00");

View File

@ -1,18 +1,12 @@
package com.cowr.service.ssjygl.transpriceconfig;
import com.cowr.common.view.Result;
import com.cowr.model.Product;
import com.cowr.model.Sysuser;
import com.cowr.model.TransPriceConfigTransfer;
import com.cowr.service.ssjygl.product.ProductSyncService;
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
import com.cowr.ssjygl.product.ProductValidator;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import java.util.List;
/**
* Generated by COWR Mon Apr 06 09:50:28 CST 2020