代码提交
parent
24a7275f5c
commit
0413098c53
|
|
@ -252,5 +252,28 @@ public abstract class BaseSupermarket<M extends BaseSupermarket<M>> extends Base
|
|||
return getInt("invoice_type");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: type
|
||||
* type: INT(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 1
|
||||
*
|
||||
* @param type 0.超市,1.取土场
|
||||
*/
|
||||
@JSONField(name = "type")
|
||||
public void setType(Integer type) {
|
||||
set("type", type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return type 0.超市,1.取土场
|
||||
*/
|
||||
@JSONField(name = "type")
|
||||
public Integer getType() {
|
||||
return getInt("type");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,24 @@ public class OrderTempService extends BaseService {
|
|||
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (supermarket_type != null && supermarket_type == 1) {
|
||||
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" +
|
||||
", s1.name customer_name \n" +
|
||||
", t.sn in_sn, t.trans_price in_trans_price, t.weight in_weight \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 ";
|
||||
}
|
||||
|
||||
|
||||
if (StrKit.notBlank(sn)) {
|
||||
fromsql += " and t.sn like ? \n";
|
||||
paraList.add("%" + sn.trim() + "%");
|
||||
|
|
@ -137,8 +155,12 @@ public class OrderTempService extends BaseService {
|
|||
}
|
||||
|
||||
if (StrKit.notBlank(customer_name)) {
|
||||
fromsql += " and t.customer_name like ? \n";
|
||||
paraList.add("%" + customer_name.trim() + "%");
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -3219,11 +3219,15 @@ public class OrderStatService {
|
|||
" ifnull( sum( CASE WHEN g.supermarket_id = 3 THEN g.count END ), 0 ) xsc_3,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 3 THEN g.source_weight END ), 0 ) xss_3,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 3 THEN g.weight END ), 0 ) xsw_3,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 3 THEN g.trans_price END ), 0 ) xst_3\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 3 THEN g.trans_price END ), 0 ) xst_3,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 4 THEN g.count END ), 0 ) xsc_4,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 4 THEN g.source_weight END ), 0 ) xss_4,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 4 THEN g.weight END ), 0 ) xsw_4,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 4 THEN g.trans_price END ), 0 ) xst_4\n" +
|
||||
"FROM\n" +
|
||||
" (\n" +
|
||||
" SELECT\n" +
|
||||
" ifnull( t.trans_co_id, 0 ) trans_co_id,\n" +
|
||||
" ifnull( t.trans_co_id, ifnull( ot.trans_co_id, 0 ) ) trans_co_id,\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" t.truck_license license,\n" +
|
||||
" ifnull( count( t.sn ), 0 ) count,\n" +
|
||||
|
|
@ -3310,6 +3314,10 @@ public class OrderStatService {
|
|||
double all_xsc_3 = 0.0;
|
||||
double all_xss_3 = 0.0;
|
||||
double all_xsw_3 = 0.0;
|
||||
double all_xst_4 = 0.0;
|
||||
double all_xsc_4 = 0.0;
|
||||
double all_xss_4 = 0.0;
|
||||
double all_xsw_4 = 0.0;
|
||||
|
||||
typelist.add(new Record().set("trans_co_id", 0).set("trans_name", "未分类"));
|
||||
|
||||
|
|
@ -3331,6 +3339,10 @@ public class OrderStatService {
|
|||
double xsc_3 = 0.0;
|
||||
double xss_3 = 0.0;
|
||||
double xsw_3 = 0.0;
|
||||
double xst_4 = 0.0;
|
||||
double xsc_4 = 0.0;
|
||||
double xss_4 = 0.0;
|
||||
double xsw_4 = 0.0;
|
||||
|
||||
for (Record r : list) {
|
||||
count += DataUtil.getDefaultByRecord(r, "count");
|
||||
|
|
@ -3344,6 +3356,10 @@ public class OrderStatService {
|
|||
xst_3 += DataUtil.getDefaultByRecord(r, "xst_3");
|
||||
xss_3 += DataUtil.getDefaultByRecord(r, "xss_3");
|
||||
xsw_3 += DataUtil.getDefaultByRecord(r, "xse_3");
|
||||
xsc_4 += DataUtil.getDefaultByRecord(r, "xsc_4");
|
||||
xst_4 += DataUtil.getDefaultByRecord(r, "xst_4");
|
||||
xss_4 += DataUtil.getDefaultByRecord(r, "xss_4");
|
||||
xsw_4 += DataUtil.getDefaultByRecord(r, "xse_4");
|
||||
|
||||
all_count += DataUtil.getDefaultByRecord(r, "count");
|
||||
all_weight += DataUtil.getDefaultByRecord(r, "weight");
|
||||
|
|
@ -3356,6 +3372,10 @@ public class OrderStatService {
|
|||
all_xst_3 += DataUtil.getDefaultByRecord(r, "xst_3");
|
||||
all_xss_3 += DataUtil.getDefaultByRecord(r, "xss_3");
|
||||
all_xsw_3 += DataUtil.getDefaultByRecord(r, "xse_3");
|
||||
all_xsc_4 += DataUtil.getDefaultByRecord(r, "xsc_4");
|
||||
all_xst_4 += DataUtil.getDefaultByRecord(r, "xst_4");
|
||||
all_xss_4 += DataUtil.getDefaultByRecord(r, "xss_4");
|
||||
all_xsw_4 += DataUtil.getDefaultByRecord(r, "xse_4");
|
||||
}
|
||||
|
||||
record.set("count", count);
|
||||
|
|
@ -3369,6 +3389,10 @@ public class OrderStatService {
|
|||
record.set("xsc_3", xsc_3);
|
||||
record.set("xss_3", xss_3);
|
||||
record.set("xsw_3", xsw_3);
|
||||
record.set("xst_4", xst_4);
|
||||
record.set("xsc_4", xsc_4);
|
||||
record.set("xss_4", xss_4);
|
||||
record.set("xsw_4", xsw_4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3391,6 +3415,10 @@ public class OrderStatService {
|
|||
record.set("xst_3", all_xst_3);
|
||||
record.set("xss_3", all_xss_3);
|
||||
record.set("xsw_3", all_xsw_3);
|
||||
record.set("xsc_4", all_xsc_4);
|
||||
record.set("xst_4", all_xst_4);
|
||||
record.set("xss_4", all_xss_4);
|
||||
record.set("xsw_4", all_xsw_4);
|
||||
|
||||
|
||||
typelist.add(record);
|
||||
|
|
|
|||
|
|
@ -52,12 +52,11 @@ public class OrderTransferController extends BaseController {
|
|||
String uuid = get("uuid");
|
||||
String transport_id = get("transport_id");
|
||||
String old_sn = get("old_sn");
|
||||
Integer sandfarm_id = getInt("sandfarm_id");
|
||||
Integer product_id = getInt("product_id",1);
|
||||
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
||||
Double source_weight = getParaToDouble("source_weight");
|
||||
|
||||
renderJson(OrderTransferSyncService.me.pay(uuid, transport_id, old_sn, sandfarm_id, product_id, printer, source_weight, tokenuser));
|
||||
renderJson(OrderTransferSyncService.me.pay(uuid, transport_id, old_sn, product_id, printer, source_weight, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ public class OrderTransferPayValidator extends CrudParamValidator {
|
|||
protected void validate(Controller c) {
|
||||
validateString("uuid", 32, 32, "uuid", "uuid 长度 32,必填");
|
||||
validateString("transport_id", 32, 32, "transport_id", "transport_id 长度 32,必填");
|
||||
validateInteger("sandfarm_id", 1, 2147483647, "sandfarm_id", "sandfarm_id 范围 1~2147483647");
|
||||
// validateInteger("sandfarm_id", 1, 2147483647, "sandfarm_id", "sandfarm_id 范围 1~2147483647");
|
||||
validateString("old_sn", 1, 16, "old_sn", "old_sn 长度 1~16");
|
||||
|
||||
if (StrKit.notBlank(c.get("source_weight"))) {
|
||||
validateDouble("source_weight", 1, 9999, "source_weight", "source_weight 范围 1~999");
|
||||
validateDouble("source_weight", 0.01, 9999, "source_weight", "source_weight 范围 0.01~999");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.jfinal.plugin.activerecord.Record;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
public class OrderTransferSyncService {
|
||||
public static OrderTransferSyncService me = new OrderTransferSyncService();
|
||||
|
|
@ -38,7 +39,6 @@ public class OrderTransferSyncService {
|
|||
String uuid,
|
||||
String transport_id,
|
||||
String old_sn,
|
||||
Integer sandfarm_id,
|
||||
Integer product_id,
|
||||
String printerId,
|
||||
Double source_weight,
|
||||
|
|
@ -78,7 +78,20 @@ public class OrderTransferSyncService {
|
|||
SyncTask synctask = new SyncTask();
|
||||
OrderTransfer order = new OrderTransfer();
|
||||
order.setUuid(uuid);
|
||||
|
||||
if (old_sn.length() != 16) {
|
||||
return Result.failed("【%s】取土场订单编号错误", old_sn);
|
||||
}
|
||||
// YYYYMMDD + 两位销售点id(避免离线生成订单号重复) + 两位订单类型 + 四位序列号
|
||||
Integer sandfarm_id = Integer.valueOf(old_sn.substring(8, 10));
|
||||
|
||||
Supermarket byId = Supermarket.dao.findById(sandfarm_id);
|
||||
if (Objects.isNull(byId) || byId.getType() != 1) {
|
||||
return Result.failedstr("当前订单号不是取土场订单");
|
||||
}
|
||||
|
||||
order.setOldSn(old_sn);
|
||||
order.setSandfarmId(sandfarm_id);
|
||||
|
||||
if (order.checkDuplicate("uuid")) {
|
||||
return Result.failed("【%s】已经存在", uuid);
|
||||
|
|
@ -105,7 +118,7 @@ public class OrderTransferSyncService {
|
|||
order.setTruckLicense(transport.getTruckLicense());
|
||||
order.setProductId(product.getId());
|
||||
order.setProductName(product.getName());
|
||||
order.setSandfarmId(sandfarm_id);
|
||||
|
||||
order.setWeight(net_weight); // 使用净重更新重量
|
||||
|
||||
order.setCreateUserId(sysuser.getId());
|
||||
|
|
@ -126,8 +139,10 @@ public class OrderTransferSyncService {
|
|||
order.setTransCoTexpayerName(tc.getTexpayerName());
|
||||
order.setTransCoTexpayerNum(tc.getTexpayerNum());
|
||||
|
||||
order.setTransDistance(SupermarketSandfarmDistanceService.me.getDistance(transport.getSupermarketId(), sandfarm_id)); // 转运运距
|
||||
order.setTransUnitPrice(new BigDecimal(TransPriceService.me.getTransferStartTransPrice(order.getTransDistance().doubleValue()))); // 转运单价
|
||||
BigDecimal distance = SupermarketSandfarmDistanceService.me.getDistance(transport.getSupermarketId(), sandfarm_id);
|
||||
order.setTransDistance(distance); // 转运运距
|
||||
BigDecimal transUnitPrice = new BigDecimal(TransPriceService.me.getTransferStartTransPrice(order.getTransDistance().doubleValue()));
|
||||
order.setTransUnitPrice(transUnitPrice); // 转运单价
|
||||
// 支付时,用净重计算运费
|
||||
order.setTransPrice(new BigDecimal(TransPriceService.me.caleTransferTransPrice( net_weight.doubleValue(), order.getTransDistance().doubleValue()))); // 转运运费
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ import com.jfinal.aop.Clear;
|
|||
import com.jfinal.core.Controller;
|
||||
import com.jfinal.upload.UploadFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_signed_
|
||||
|
|
@ -78,6 +81,45 @@ public class CustomerContractSignedController extends Controller {
|
|||
renderJson(CustomerContractSignedService.me.delete(model, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复 customer_contract_template
|
||||
*/
|
||||
@Before(CustomerContractTemplatePKValidator.class)
|
||||
public void restore(){
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
}
|
||||
CustomerContractSigned model = getModel(CustomerContractSigned.class, "", true); // 忽略不在model中的字段
|
||||
CustomerContractSigned byPk = model.findByPk();
|
||||
if (Objects.isNull(byPk)){
|
||||
renderJson(Result.failed(false, "当前数据不存在"));
|
||||
return;
|
||||
}
|
||||
Integer type = byPk.getType();
|
||||
if (Objects.isNull(type)) {
|
||||
renderJson(Result.failed(false, "type不能为空"));
|
||||
return;
|
||||
}
|
||||
if (type == 0){ // 公司
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 0 and del = 0 and state = 1 and id != ?",model.getId());
|
||||
if (!list.isEmpty()){
|
||||
renderJson(Result.failed(false, "已有正在生效的电子签字"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (type == 1){ //客户
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 1 and del = 0 and state = 1 and create_id = ? and id != ?"
|
||||
, tokenuser.getId(),model.getId());
|
||||
if (!list.isEmpty()){
|
||||
renderJson(Result.failed(false, "已有正在生效的电子签字"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
renderJson(CustomerContractSignedService.me.restore(model));
|
||||
}
|
||||
/**
|
||||
* 分页查找 customer_contract_signed_
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class CustomerContractSignedService extends BaseService {
|
|||
}
|
||||
}
|
||||
if (type == 1){ // 公司
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 0 and del = 0 and state = 1 and create_id = ?", sysuser.getId());
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 1 and del = 0 and state = 1 and create_id = ?", sysuser.getId());
|
||||
if (!list.isEmpty()){
|
||||
return Result.failed(false, "已有正在生效的电子签字");
|
||||
}
|
||||
|
|
@ -168,13 +168,13 @@ public class CustomerContractSignedService extends BaseService {
|
|||
return Result.failed(false, "type不能为空");
|
||||
}
|
||||
if (type == 0){ // 公司
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 0 and del = 0 and state = 1 and id = ?",model.getId());
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 0 and del = 0 and state = 1 and id != ?",model.getId());
|
||||
if (!list.isEmpty()){
|
||||
return Result.failed(false, "已有正在生效的电子签字");
|
||||
}
|
||||
}
|
||||
if (type == 1){ // 公司
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 0 and del = 0 and state = 1 and create_id = ? and id = ?"
|
||||
List<CustomerContractSigned> list = CustomerContractSigned.dao.find("select * from customer_contract_signed where type = 1 and del = 0 and state = 1 and create_id = ? and id != ?"
|
||||
, sysuser.getId(),model.getId());
|
||||
if (!list.isEmpty()){
|
||||
return Result.failed(false, "已有正在生效的电子签字");
|
||||
|
|
|
|||
|
|
@ -57,6 +57,13 @@ public class AuthInterceptor implements Interceptor {
|
|||
|
||||
add("/customer/contractsignedlog/getByUserId");
|
||||
add("/customer/contractsignedlog/save");
|
||||
|
||||
add("/customer/contractsigned/find");
|
||||
add("/customer/contractsigned/save");
|
||||
add("/customer/contractsigned/edit");
|
||||
add("/customer/contractsigned/del");
|
||||
add("/customer/contractsigned/restore");
|
||||
|
||||
add("/customer/contracttemplate/get");
|
||||
|
||||
}});
|
||||
|
|
|
|||
Loading…
Reference in New Issue