Merge branch 'ls-dev' into dev
commit
01344e1a52
|
|
@ -14,9 +14,10 @@ import java.util.List;
|
||||||
* 300 注册用户
|
* 300 注册用户
|
||||||
* 400 占位
|
* 400 占位
|
||||||
* <p>
|
* <p>
|
||||||
* 500 公司总经理,权限:查看、付费审核、退费审核
|
* 500 公司总经理,权限:查看、配额
|
||||||
* 501 公司财务人员,权限:查看、付费、退费
|
* 501 公司财务人员,权限:查看、付费、退费
|
||||||
* 502 公司领导,权限:查看
|
* 502 公司领导,权限:查看
|
||||||
|
* 503 公司财务经理 付费审核、退费审核
|
||||||
*/
|
*/
|
||||||
public enum RoleEnum {
|
public enum RoleEnum {
|
||||||
DEVOPS(99),
|
DEVOPS(99),
|
||||||
|
|
@ -32,6 +33,7 @@ public enum RoleEnum {
|
||||||
PRESIDENT(500),
|
PRESIDENT(500),
|
||||||
TREASURER(501),
|
TREASURER(501),
|
||||||
PRESIDENTVIEW(502),
|
PRESIDENTVIEW(502),
|
||||||
|
FINANCEMANAGER(503),
|
||||||
|
|
||||||
CHAISHA(600);
|
CHAISHA(600);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,13 @@ public class Result {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result failedstr(String format, Object... objs) {
|
public static Result failedstr(String format, Object... objs) {
|
||||||
|
try {
|
||||||
return new Result(Result.PARAM_ERROR, null, String.format(format, objs));
|
return new Result(Result.PARAM_ERROR, null, String.format(format, objs));
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
|
||||||
|
return new Result(Result.PARAM_ERROR, null, "请求失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result failed(Map<String, String> validerr) {
|
public static Result failed(Map<String, String> validerr) {
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,14 @@ public class SyncTask extends BaseSyncTask<SyncTask> {
|
||||||
this.setIncrementData(JSONObject.toJSONString(_increment_data));
|
this.setIncrementData(JSONObject.toJSONString(_increment_data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SyncTask clone(){
|
||||||
|
SyncTask out = super.clone();
|
||||||
|
out._save_data = (JSONObject) this._save_data.clone();
|
||||||
|
out._update_data = (JSONObject) this._update_data.clone();
|
||||||
|
out._delete_data = (JSONObject) this._delete_data.clone();
|
||||||
|
out._increment_data = (JSONObject) this._increment_data.clone();
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.cowr.model;
|
||||||
|
|
||||||
|
import com.cowr.model.base.BaseTicketInvalidVerify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:22 CST 2021
|
||||||
|
* TableName: ticket_invalid_verify
|
||||||
|
* Remarks: 结算单管理 - 结算单作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class TicketInvalidVerify extends BaseTicketInvalidVerify<TicketInvalidVerify> {
|
||||||
|
public static final TicketInvalidVerify dao = new TicketInvalidVerify().dao();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.cowr.model;
|
||||||
|
|
||||||
|
import com.cowr.model.base.BaseTicketLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:22 CST 2021
|
||||||
|
* TableName: ticket_log
|
||||||
|
* Remarks: 结算单管理 - 结算单使用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class TicketLog extends BaseTicketLog<TicketLog> {
|
||||||
|
public static final TicketLog dao = new TicketLog().dao();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.cowr.model;
|
||||||
|
|
||||||
|
import com.cowr.model.base.BaseTicketReceive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:22 CST 2021
|
||||||
|
* TableName: ticket_receive
|
||||||
|
* Remarks: 结算单管理 - 领用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class TicketReceive extends BaseTicketReceive<TicketReceive> {
|
||||||
|
public static final TicketReceive dao = new TicketReceive().dao();
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ package com.cowr.model;
|
||||||
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated by COWR Sun May 17 21:43:18 CST 2020
|
* Generated by COWR Fri Feb 26 16:03:22 CST 2021
|
||||||
* <pre>
|
* <pre>
|
||||||
* Example:
|
* Example:
|
||||||
* public void configPlugin(Plugins me) {
|
* public void configPlugin(Plugins me) {
|
||||||
|
|
@ -26,14 +26,14 @@ public class _MappingKit {
|
||||||
arp.addMapping("product", "id", Product.class);
|
arp.addMapping("product", "id", Product.class);
|
||||||
// Composite Primary Key order: supermarket_id,customer_receiver_id
|
// Composite Primary Key order: supermarket_id,customer_receiver_id
|
||||||
arp.addMapping("supermarket_receiver_distance", "supermarket_id,customer_receiver_id", SupermarketReceiverDistance.class);
|
arp.addMapping("supermarket_receiver_distance", "supermarket_id,customer_receiver_id", SupermarketReceiverDistance.class);
|
||||||
// Composite Primary Key order: supermarket_id,customer_id
|
|
||||||
arp.addMapping("supermarket_customer_distance", "supermarket_id,customer_id", SupermarketCustomerDistance.class);
|
|
||||||
arp.addMapping("transport_company", "id", TransportCompany.class);
|
arp.addMapping("transport_company", "id", TransportCompany.class);
|
||||||
// Composite Primary Key order: supermarket_id,sandfarm_id
|
// Composite Primary Key order: supermarket_id,sandfarm_id
|
||||||
arp.addMapping("supermarket_sandfarm_distance", "supermarket_id,sandfarm_id", SupermarketSandfarmDistance.class);
|
arp.addMapping("supermarket_sandfarm_distance", "supermarket_id,sandfarm_id", SupermarketSandfarmDistance.class);
|
||||||
arp.addMapping("sandfarm", "id", Sandfarm.class);
|
arp.addMapping("sandfarm", "id", Sandfarm.class);
|
||||||
// Composite Primary Key order: supermarket_id,product_id
|
// Composite Primary Key order: supermarket_id,product_id
|
||||||
arp.addMapping("supermarket_product", "supermarket_id,product_id", SupermarketProduct.class);
|
arp.addMapping("supermarket_product", "supermarket_id,product_id", SupermarketProduct.class);
|
||||||
|
// Composite Primary Key order: supermarket_id,customer_id
|
||||||
|
arp.addMapping("supermarket_customer_distance", "supermarket_id,customer_id", SupermarketCustomerDistance.class);
|
||||||
arp.addMapping("blacklist", "id", Blacklist.class);
|
arp.addMapping("blacklist", "id", Blacklist.class);
|
||||||
arp.addMapping("truck", "license", Truck.class);
|
arp.addMapping("truck", "license", Truck.class);
|
||||||
arp.addMapping("purchase", "id", Purchase.class);
|
arp.addMapping("purchase", "id", Purchase.class);
|
||||||
|
|
@ -42,24 +42,28 @@ public class _MappingKit {
|
||||||
arp.addMapping("customer_receiver", "id", CustomerReceiver.class);
|
arp.addMapping("customer_receiver", "id", CustomerReceiver.class);
|
||||||
arp.addMapping("customer_register", "id", CustomerRegister.class);
|
arp.addMapping("customer_register", "id", CustomerRegister.class);
|
||||||
arp.addMapping("customer_contact", "id", CustomerContact.class);
|
arp.addMapping("customer_contact", "id", CustomerContact.class);
|
||||||
// Composite Primary Key order: customer_id,supermarket_id,product_id
|
|
||||||
arp.addMapping("customer_supermarket_product", "customer_id,supermarket_id,product_id", CustomerSupermarketProduct.class);
|
|
||||||
arp.addMapping("prepay_detail", "id", PrepayDetail.class);
|
arp.addMapping("prepay_detail", "id", PrepayDetail.class);
|
||||||
arp.addMapping("prepay_detail_state_history", "id", PrepayDetailStateHistory.class);
|
arp.addMapping("prepay_detail_state_history", "id", PrepayDetailStateHistory.class);
|
||||||
arp.addMapping("refund_detail", "id", RefundDetail.class);
|
arp.addMapping("refund_detail", "id", RefundDetail.class);
|
||||||
arp.addMapping("refund_detail_state_history", "id", RefundDetailStateHistory.class);
|
arp.addMapping("refund_detail_state_history", "id", RefundDetailStateHistory.class);
|
||||||
|
// Composite Primary Key order: customer_id,supermarket_id,product_id
|
||||||
|
arp.addMapping("customer_supermarket_product", "customer_id,supermarket_id,product_id", CustomerSupermarketProduct.class);
|
||||||
|
arp.addMapping("customer_pact", "id", CustomerPact.class);
|
||||||
arp.addMapping("prepay_customer", "id", PrepayCustomer.class);
|
arp.addMapping("prepay_customer", "id", PrepayCustomer.class);
|
||||||
arp.addMapping("prepay_truck", "id", PrepayTruck.class);
|
arp.addMapping("prepay_truck", "id", PrepayTruck.class);
|
||||||
arp.addMapping("sms_log", "id", SmsLog.class);
|
|
||||||
arp.addMapping("sms_notice_contact", "id", SmsNoticeContact.class);
|
|
||||||
arp.addMapping("sync_task", "id", SyncTask.class);
|
arp.addMapping("sync_task", "id", SyncTask.class);
|
||||||
arp.addMapping("ossfile_log", "id", OssfileLog.class);
|
arp.addMapping("ossfile_log", "id", OssfileLog.class);
|
||||||
arp.addMapping("modify_log", "id", ModifyLog.class);
|
arp.addMapping("sms_log", "id", SmsLog.class);
|
||||||
arp.addMapping("action_cmd_log", "id", ActionCmdLog.class);
|
arp.addMapping("action_cmd_log", "id", ActionCmdLog.class);
|
||||||
|
arp.addMapping("modify_log", "id", ModifyLog.class);
|
||||||
arp.addMapping("sysuser", "id", Sysuser.class);
|
arp.addMapping("sysuser", "id", Sysuser.class);
|
||||||
arp.addMapping("trans_price_config_trash", "id", TransPriceConfigTrash.class);
|
arp.addMapping("trans_price_config_trash", "id", TransPriceConfigTrash.class);
|
||||||
arp.addMapping("trans_price_config_transfer", "id", TransPriceConfigTransfer.class);
|
arp.addMapping("trans_price_config_transfer", "id", TransPriceConfigTransfer.class);
|
||||||
|
arp.addMapping("sms_notice_contact", "id", SmsNoticeContact.class);
|
||||||
arp.addMapping("trans_price_config_sale", "id", TransPriceConfigSale.class);
|
arp.addMapping("trans_price_config_sale", "id", TransPriceConfigSale.class);
|
||||||
|
arp.addMapping("ticket_invalid_verify", "id", TicketInvalidVerify.class);
|
||||||
|
arp.addMapping("ticket_log", "id", TicketLog.class);
|
||||||
|
arp.addMapping("ticket_receive", "id", TicketReceive.class);
|
||||||
// Composite Primary Key order: unit_id,unit_type
|
// Composite Primary Key order: unit_id,unit_type
|
||||||
arp.addMapping("cctv", "unit_id,unit_type", Cctv.class);
|
arp.addMapping("cctv", "unit_id,unit_type", Cctv.class);
|
||||||
// Composite Primary Key order: id,unit_id,unit_type
|
// Composite Primary Key order: id,unit_id,unit_type
|
||||||
|
|
@ -70,8 +74,8 @@ public class _MappingKit {
|
||||||
arp.addMapping("order_seq", "tm,supermarket_id,type", OrderSeq.class);
|
arp.addMapping("order_seq", "tm,supermarket_id,type", OrderSeq.class);
|
||||||
arp.addMapping("order_trash", "sn", OrderTrash.class);
|
arp.addMapping("order_trash", "sn", OrderTrash.class);
|
||||||
arp.addMapping("stock_modify_log", "id", StockModifyLog.class);
|
arp.addMapping("stock_modify_log", "id", StockModifyLog.class);
|
||||||
arp.addMapping("ordercluster_truck", "id", OrderclusterTruck.class);
|
|
||||||
arp.addMapping("order_invalid_verify", "id", OrderInvalidVerify.class);
|
arp.addMapping("order_invalid_verify", "id", OrderInvalidVerify.class);
|
||||||
|
arp.addMapping("ordercluster_truck", "id", OrderclusterTruck.class);
|
||||||
arp.addMapping("ordercluster", "id", Ordercluster.class);
|
arp.addMapping("ordercluster", "id", Ordercluster.class);
|
||||||
arp.addMapping("order_transfer", "sn", OrderTransfer.class);
|
arp.addMapping("order_transfer", "sn", OrderTransfer.class);
|
||||||
arp.addMapping("order_sale", "sn", OrderSale.class);
|
arp.addMapping("order_sale", "sn", OrderSale.class);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import com.jfinal.plugin.activerecord.IBean;
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated by COWR Mon Aug 17 11:15:31 CST 2020
|
* Generated by COWR Mon Mar 01 10:54:13 CST 2021
|
||||||
* TableName: order_sale
|
* TableName: order_sale
|
||||||
* Remarks: 订单相关 - 销售单
|
* Remarks: 订单相关 - 销售单
|
||||||
* PrimaryKey: sn
|
* PrimaryKey: sn
|
||||||
|
|
@ -26,7 +26,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: YES
|
* isPrimaryKey: YES
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param sn YYYYMMDD + 两位销售点id(避免离线生成订单号重复) + 两位订单类型 + 四位序列号
|
* @param sn YYYYMMDD + 两位销售点id(避免离线生成订单号重复) + 两位订单类型 + 四位序列号
|
||||||
*/
|
*/
|
||||||
@JSONField(name="sn")
|
@JSONField(name="sn")
|
||||||
|
|
@ -49,7 +48,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param uuid UUID 唯一验证,避免重复提交
|
* @param uuid UUID 唯一验证,避免重复提交
|
||||||
*/
|
*/
|
||||||
@JSONField(name="uuid")
|
@JSONField(name="uuid")
|
||||||
|
|
@ -72,7 +70,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transportId 出入场记录id
|
* @param transportId 出入场记录id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="transport_id")
|
@JSONField(name="transport_id")
|
||||||
|
|
@ -95,8 +92,7 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
* @param supermarketId 超市id
|
||||||
* @param supermarketId 砂站id
|
|
||||||
*/
|
*/
|
||||||
@JSONField(name="supermarket_id")
|
@JSONField(name="supermarket_id")
|
||||||
public void setSupermarketId(Integer supermarketId) {
|
public void setSupermarketId(Integer supermarketId) {
|
||||||
|
|
@ -105,7 +101,7 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return supermarket_id 砂站id
|
* @return supermarket_id 超市id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="supermarket_id")
|
@JSONField(name="supermarket_id")
|
||||||
public Integer getSupermarketId() {
|
public Integer getSupermarketId() {
|
||||||
|
|
@ -118,7 +114,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerId
|
* @param customerId
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_id")
|
@JSONField(name="customer_id")
|
||||||
|
|
@ -141,7 +136,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerName
|
* @param customerName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_name")
|
@JSONField(name="customer_name")
|
||||||
|
|
@ -164,7 +158,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerTexpayerName 客户开票公司名称
|
* @param customerTexpayerName 客户开票公司名称
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_texpayer_name")
|
@JSONField(name="customer_texpayer_name")
|
||||||
|
|
@ -187,7 +180,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerTexpayerNum 客户纳税人识别号
|
* @param customerTexpayerNum 客户纳税人识别号
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_texpayer_num")
|
@JSONField(name="customer_texpayer_num")
|
||||||
|
|
@ -210,7 +202,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerAddress
|
* @param customerAddress
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_address")
|
@JSONField(name="customer_address")
|
||||||
|
|
@ -233,7 +224,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerPhone
|
* @param customerPhone
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_phone")
|
@JSONField(name="customer_phone")
|
||||||
|
|
@ -256,7 +246,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerBankName
|
* @param customerBankName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_bank_name")
|
@JSONField(name="customer_bank_name")
|
||||||
|
|
@ -279,7 +268,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerBankAccount
|
* @param customerBankAccount
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_bank_account")
|
@JSONField(name="customer_bank_account")
|
||||||
|
|
@ -302,7 +290,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverName 收货人
|
* @param customerReceiverName 收货人
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_name")
|
@JSONField(name="customer_receiver_name")
|
||||||
|
|
@ -325,7 +312,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverPhone 收货人电话
|
* @param customerReceiverPhone 收货人电话
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_phone")
|
@JSONField(name="customer_receiver_phone")
|
||||||
|
|
@ -348,7 +334,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverAddress 送货地址
|
* @param customerReceiverAddress 送货地址
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_address")
|
@JSONField(name="customer_receiver_address")
|
||||||
|
|
@ -371,7 +356,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverLgtd 收货地址经度
|
* @param customerReceiverLgtd 收货地址经度
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_lgtd")
|
@JSONField(name="customer_receiver_lgtd")
|
||||||
|
|
@ -394,7 +378,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverLttd 收货地址纬度
|
* @param customerReceiverLttd 收货地址纬度
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_lttd")
|
@JSONField(name="customer_receiver_lttd")
|
||||||
|
|
@ -417,7 +400,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoId 物流公司
|
* @param transCoId 物流公司
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_id")
|
@JSONField(name="trans_co_id")
|
||||||
|
|
@ -440,7 +422,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoName
|
* @param transCoName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_name")
|
@JSONField(name="trans_co_name")
|
||||||
|
|
@ -463,7 +444,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoTexpayerName 物流公司开票公司名称
|
* @param transCoTexpayerName 物流公司开票公司名称
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_texpayer_name")
|
@JSONField(name="trans_co_texpayer_name")
|
||||||
|
|
@ -486,7 +466,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoTexpayerNum
|
* @param transCoTexpayerNum
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_texpayer_num")
|
@JSONField(name="trans_co_texpayer_num")
|
||||||
|
|
@ -509,7 +488,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoAddress
|
* @param transCoAddress
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_address")
|
@JSONField(name="trans_co_address")
|
||||||
|
|
@ -532,7 +510,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoPhone
|
* @param transCoPhone
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_phone")
|
@JSONField(name="trans_co_phone")
|
||||||
|
|
@ -555,7 +532,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoBankName
|
* @param transCoBankName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_bank_name")
|
@JSONField(name="trans_co_bank_name")
|
||||||
|
|
@ -578,7 +554,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoBankAccount
|
* @param transCoBankAccount
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_bank_account")
|
@JSONField(name="trans_co_bank_account")
|
||||||
|
|
@ -601,7 +576,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param truckLicense 车牌号
|
* @param truckLicense 车牌号
|
||||||
*/
|
*/
|
||||||
@JSONField(name="truck_license")
|
@JSONField(name="truck_license")
|
||||||
|
|
@ -624,7 +598,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param driverName 司机姓名
|
* @param driverName 司机姓名
|
||||||
*/
|
*/
|
||||||
@JSONField(name="driver_name")
|
@JSONField(name="driver_name")
|
||||||
|
|
@ -647,7 +620,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param driverPhone 司机手机号
|
* @param driverPhone 司机手机号
|
||||||
*/
|
*/
|
||||||
@JSONField(name="driver_phone")
|
@JSONField(name="driver_phone")
|
||||||
|
|
@ -670,7 +642,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param unitPrice 单价
|
* @param unitPrice 单价
|
||||||
*/
|
*/
|
||||||
@JSONField(name="unit_price")
|
@JSONField(name="unit_price")
|
||||||
|
|
@ -693,7 +664,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param totalPrice 总价,应付金额
|
* @param totalPrice 总价,应付金额
|
||||||
*/
|
*/
|
||||||
@JSONField(name="total_price")
|
@JSONField(name="total_price")
|
||||||
|
|
@ -716,7 +686,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param weight 购买重量
|
* @param weight 购买重量
|
||||||
*/
|
*/
|
||||||
@JSONField(name="weight")
|
@JSONField(name="weight")
|
||||||
|
|
@ -739,7 +708,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param paid 实际支付金额
|
* @param paid 实际支付金额
|
||||||
*/
|
*/
|
||||||
@JSONField(name="paid")
|
@JSONField(name="paid")
|
||||||
|
|
@ -762,7 +730,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param pickTime 提货时间
|
* @param pickTime 提货时间
|
||||||
*/
|
*/
|
||||||
@JSONField(name="pick_time")
|
@JSONField(name="pick_time")
|
||||||
|
|
@ -785,7 +752,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transDistance 运距
|
* @param transDistance 运距
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_distance")
|
@JSONField(name="trans_distance")
|
||||||
|
|
@ -808,7 +774,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transPrice 运费
|
* @param transPrice 运费
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_price")
|
@JSONField(name="trans_price")
|
||||||
|
|
@ -831,7 +796,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transUnitPrice 运输单价
|
* @param transUnitPrice 运输单价
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_unit_price")
|
@JSONField(name="trans_unit_price")
|
||||||
|
|
@ -854,7 +818,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 1
|
* defaultValue: 1
|
||||||
*
|
|
||||||
* @param payType 支付方式: 1,现场支付; 2,在线支付
|
* @param payType 支付方式: 1,现场支付; 2,在线支付
|
||||||
*/
|
*/
|
||||||
@JSONField(name="pay_type")
|
@JSONField(name="pay_type")
|
||||||
|
|
@ -877,7 +840,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param createTime
|
* @param createTime
|
||||||
*/
|
*/
|
||||||
@JSONField(name="create_time")
|
@JSONField(name="create_time")
|
||||||
|
|
@ -900,7 +862,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param createUserId 创建用户id
|
* @param createUserId 创建用户id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="create_user_id")
|
@JSONField(name="create_user_id")
|
||||||
|
|
@ -923,7 +884,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param createUserName 创建用户名
|
* @param createUserName 创建用户名
|
||||||
*/
|
*/
|
||||||
@JSONField(name="create_user_name")
|
@JSONField(name="create_user_name")
|
||||||
|
|
@ -946,7 +906,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param settlementUserId 结算用户id
|
* @param settlementUserId 结算用户id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="settlement_user_id")
|
@JSONField(name="settlement_user_id")
|
||||||
|
|
@ -969,7 +928,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param settlementUserName 结算用户名
|
* @param settlementUserName 结算用户名
|
||||||
*/
|
*/
|
||||||
@JSONField(name="settlement_user_name")
|
@JSONField(name="settlement_user_name")
|
||||||
|
|
@ -992,13 +950,13 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 1
|
* defaultValue: 1
|
||||||
*
|
|
||||||
* @param state 1,初始状态;
|
* @param state 1,初始状态;
|
||||||
* 2,已进场;(后台自动设置)
|
2,已进场;(后台自动设置)
|
||||||
* 3,已装载
|
3,已装载
|
||||||
* 4,已离场(后台自动设置)
|
4,已离场(后台自动设置)
|
||||||
* 5,已收货
|
5,已收货
|
||||||
* 9,订单作废
|
9,订单作废
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@JSONField(name="state")
|
@JSONField(name="state")
|
||||||
public void setState(Integer state) {
|
public void setState(Integer state) {
|
||||||
|
|
@ -1008,11 +966,12 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return state 1,初始状态;
|
* @return state 1,初始状态;
|
||||||
* 2,已进场;(后台自动设置)
|
2,已进场;(后台自动设置)
|
||||||
* 3,已装载
|
3,已装载
|
||||||
* 4,已离场(后台自动设置)
|
4,已离场(后台自动设置)
|
||||||
* 5,已收货
|
5,已收货
|
||||||
* 9,订单作废
|
9,订单作废
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@JSONField(name="state")
|
@JSONField(name="state")
|
||||||
public Integer getState() {
|
public Integer getState() {
|
||||||
|
|
@ -1025,7 +984,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 0
|
* defaultValue: 0
|
||||||
*
|
|
||||||
* @param reqReceipt 是否需要发票,0 默认不需要,1需要
|
* @param reqReceipt 是否需要发票,0 默认不需要,1需要
|
||||||
*/
|
*/
|
||||||
@JSONField(name="req_receipt")
|
@JSONField(name="req_receipt")
|
||||||
|
|
@ -1048,7 +1006,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param orderclusterId ordercluste id
|
* @param orderclusterId ordercluste id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="ordercluster_id")
|
@JSONField(name="ordercluster_id")
|
||||||
|
|
@ -1071,7 +1028,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: CURRENT_TIMESTAMP
|
* defaultValue: CURRENT_TIMESTAMP
|
||||||
*
|
|
||||||
* @param changeTime 最后修改时间
|
* @param changeTime 最后修改时间
|
||||||
*/
|
*/
|
||||||
@JSONField(name="change_time")
|
@JSONField(name="change_time")
|
||||||
|
|
@ -1094,7 +1050,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 0
|
* defaultValue: 0
|
||||||
*
|
|
||||||
* @param isprepaid 是否已预付,在结算时勾选
|
* @param isprepaid 是否已预付,在结算时勾选
|
||||||
*/
|
*/
|
||||||
@JSONField(name="isprepaid")
|
@JSONField(name="isprepaid")
|
||||||
|
|
@ -1117,7 +1072,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param memo 备注
|
* @param memo 备注
|
||||||
*/
|
*/
|
||||||
@JSONField(name="memo")
|
@JSONField(name="memo")
|
||||||
|
|
@ -1140,7 +1094,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param productId 品类id
|
* @param productId 品类id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="product_id")
|
@JSONField(name="product_id")
|
||||||
|
|
@ -1163,7 +1116,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param productName 品类名称
|
* @param productName 品类名称
|
||||||
*/
|
*/
|
||||||
@JSONField(name="product_name")
|
@JSONField(name="product_name")
|
||||||
|
|
@ -1186,7 +1138,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param prepayCustomerId 预付费客户 prepay_customer 表的id
|
* @param prepayCustomerId 预付费客户 prepay_customer 表的id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="prepay_customer_id")
|
@JSONField(name="prepay_customer_id")
|
||||||
|
|
@ -1209,7 +1160,6 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param invoiceCode 发票号码
|
* @param invoiceCode 发票号码
|
||||||
*/
|
*/
|
||||||
@JSONField(name="invoice_code")
|
@JSONField(name="invoice_code")
|
||||||
|
|
@ -1226,5 +1176,93 @@ public abstract class BaseOrderSale<M extends BaseOrderSale<M>> extends BaseMode
|
||||||
return getStr("invoice_code");
|
return getStr("invoice_code");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_number
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invoiceNumber 发票代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_number")
|
||||||
|
public void setInvoiceNumber(String invoiceNumber) {
|
||||||
|
set("invoice_number", invoiceNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_number 发票代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_number")
|
||||||
|
public String getInvoiceNumber() {
|
||||||
|
return getStr("invoice_number");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_type
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: 1
|
||||||
|
* @param invoiceType 1.普票,2.专票
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_type")
|
||||||
|
public void setInvoiceType(Integer invoiceType) {
|
||||||
|
set("invoice_type", invoiceType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_type 1.普票,2.专票
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_type")
|
||||||
|
public Integer getInvoiceType() {
|
||||||
|
return getInt("invoice_type");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_site
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: 1
|
||||||
|
* @param invoiceSite 1.砂站,2.结算中心
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_site")
|
||||||
|
public void setInvoiceSite(Integer invoiceSite) {
|
||||||
|
set("invoice_site", invoiceSite);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_site 1.砂站,2.结算中心
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_site")
|
||||||
|
public Integer getInvoiceSite() {
|
||||||
|
return getInt("invoice_site");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: ticket_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param ticketCode 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public void setTicketCode(String ticketCode) {
|
||||||
|
set("ticket_code", ticketCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ticket_code 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public String getTicketCode() {
|
||||||
|
return getStr("ticket_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import com.jfinal.plugin.activerecord.IBean;
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated by COWR Mon Sep 28 16:46:22 CST 2020
|
* Generated by COWR Mon Mar 01 10:54:13 CST 2021
|
||||||
* TableName: order_temp
|
* TableName: order_temp
|
||||||
* Remarks: 订单相关 - 外销单
|
* Remarks: 订单相关 - 外销单
|
||||||
* PrimaryKey: sn
|
* PrimaryKey: sn
|
||||||
|
|
@ -26,7 +26,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: YES
|
* isPrimaryKey: YES
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param sn YYYYMMDD + 两位销售点id(避免离线生成订单号重复) + 两位订单类型 + 四位序列号
|
* @param sn YYYYMMDD + 两位销售点id(避免离线生成订单号重复) + 两位订单类型 + 四位序列号
|
||||||
*/
|
*/
|
||||||
@JSONField(name="sn")
|
@JSONField(name="sn")
|
||||||
|
|
@ -49,7 +48,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param uuid UUID 唯一验证
|
* @param uuid UUID 唯一验证
|
||||||
*/
|
*/
|
||||||
@JSONField(name="uuid")
|
@JSONField(name="uuid")
|
||||||
|
|
@ -72,7 +70,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transportId 出入场记录id
|
* @param transportId 出入场记录id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="transport_id")
|
@JSONField(name="transport_id")
|
||||||
|
|
@ -95,8 +92,7 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
* @param supermarketId 超市id
|
||||||
* @param supermarketId 砂站id
|
|
||||||
*/
|
*/
|
||||||
@JSONField(name="supermarket_id")
|
@JSONField(name="supermarket_id")
|
||||||
public void setSupermarketId(Integer supermarketId) {
|
public void setSupermarketId(Integer supermarketId) {
|
||||||
|
|
@ -105,7 +101,7 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return supermarket_id 砂站id
|
* @return supermarket_id 超市id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="supermarket_id")
|
@JSONField(name="supermarket_id")
|
||||||
public Integer getSupermarketId() {
|
public Integer getSupermarketId() {
|
||||||
|
|
@ -118,7 +114,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param weight 购买重量
|
* @param weight 购买重量
|
||||||
*/
|
*/
|
||||||
@JSONField(name="weight")
|
@JSONField(name="weight")
|
||||||
|
|
@ -141,7 +136,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param truckLicense 车牌号
|
* @param truckLicense 车牌号
|
||||||
*/
|
*/
|
||||||
@JSONField(name="truck_license")
|
@JSONField(name="truck_license")
|
||||||
|
|
@ -164,14 +158,14 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 1
|
* defaultValue: 1
|
||||||
*
|
|
||||||
* @param state 1,初始状态;
|
* @param state 1,初始状态;
|
||||||
* 2,已进场;(后台自动设置)
|
2,已进场;(后台自动设置)
|
||||||
* 3,已装载
|
3,已装载
|
||||||
* 4,已离场(
|
4,已离场(
|
||||||
* 后台自动设置)(扩展,已生成待支付订单)
|
后台自动设置)(扩展,已生成待支付订单)
|
||||||
* 5,已收货
|
5,已收货
|
||||||
* 9,订单作废
|
9,订单作废
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@JSONField(name="state")
|
@JSONField(name="state")
|
||||||
public void setState(Integer state) {
|
public void setState(Integer state) {
|
||||||
|
|
@ -181,12 +175,13 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return state 1,初始状态;
|
* @return state 1,初始状态;
|
||||||
* 2,已进场;(后台自动设置)
|
2,已进场;(后台自动设置)
|
||||||
* 3,已装载
|
3,已装载
|
||||||
* 4,已离场(
|
4,已离场(
|
||||||
* 后台自动设置)(扩展,已生成待支付订单)
|
后台自动设置)(扩展,已生成待支付订单)
|
||||||
* 5,已收货
|
5,已收货
|
||||||
* 9,订单作废
|
9,订单作废
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@JSONField(name="state")
|
@JSONField(name="state")
|
||||||
public Integer getState() {
|
public Integer getState() {
|
||||||
|
|
@ -199,7 +194,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param createTime 创建时间
|
* @param createTime 创建时间
|
||||||
*/
|
*/
|
||||||
@JSONField(name="create_time")
|
@JSONField(name="create_time")
|
||||||
|
|
@ -222,7 +216,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param createUserId 创建用户id
|
* @param createUserId 创建用户id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="create_user_id")
|
@JSONField(name="create_user_id")
|
||||||
|
|
@ -245,7 +238,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param createUserName 创建用户名
|
* @param createUserName 创建用户名
|
||||||
*/
|
*/
|
||||||
@JSONField(name="create_user_name")
|
@JSONField(name="create_user_name")
|
||||||
|
|
@ -268,7 +260,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param settlementUserId 结算用户id
|
* @param settlementUserId 结算用户id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="settlement_user_id")
|
@JSONField(name="settlement_user_id")
|
||||||
|
|
@ -291,7 +282,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param settlementUserName 结算用户名
|
* @param settlementUserName 结算用户名
|
||||||
*/
|
*/
|
||||||
@JSONField(name="settlement_user_name")
|
@JSONField(name="settlement_user_name")
|
||||||
|
|
@ -314,7 +304,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param unitPrice 单价
|
* @param unitPrice 单价
|
||||||
*/
|
*/
|
||||||
@JSONField(name="unit_price")
|
@JSONField(name="unit_price")
|
||||||
|
|
@ -337,7 +326,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param totalPrice 总价,应付费
|
* @param totalPrice 总价,应付费
|
||||||
*/
|
*/
|
||||||
@JSONField(name="total_price")
|
@JSONField(name="total_price")
|
||||||
|
|
@ -360,7 +348,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param paid 实际支付金额
|
* @param paid 实际支付金额
|
||||||
*/
|
*/
|
||||||
@JSONField(name="paid")
|
@JSONField(name="paid")
|
||||||
|
|
@ -383,7 +370,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 1
|
* defaultValue: 1
|
||||||
*
|
|
||||||
* @param payType 支付方式: 1,现场支付; 2,在线支付
|
* @param payType 支付方式: 1,现场支付; 2,在线支付
|
||||||
*/
|
*/
|
||||||
@JSONField(name="pay_type")
|
@JSONField(name="pay_type")
|
||||||
|
|
@ -406,7 +392,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: CURRENT_TIMESTAMP
|
* defaultValue: CURRENT_TIMESTAMP
|
||||||
*
|
|
||||||
* @param changeTime 最后修改时间
|
* @param changeTime 最后修改时间
|
||||||
*/
|
*/
|
||||||
@JSONField(name="change_time")
|
@JSONField(name="change_time")
|
||||||
|
|
@ -429,7 +414,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 0
|
* defaultValue: 0
|
||||||
*
|
|
||||||
* @param isprepaid 是否已预付,在结算时勾选
|
* @param isprepaid 是否已预付,在结算时勾选
|
||||||
*/
|
*/
|
||||||
@JSONField(name="isprepaid")
|
@JSONField(name="isprepaid")
|
||||||
|
|
@ -452,7 +436,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param memo 备注
|
* @param memo 备注
|
||||||
*/
|
*/
|
||||||
@JSONField(name="memo")
|
@JSONField(name="memo")
|
||||||
|
|
@ -475,7 +458,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerId
|
* @param customerId
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_id")
|
@JSONField(name="customer_id")
|
||||||
|
|
@ -498,7 +480,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerName
|
* @param customerName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_name")
|
@JSONField(name="customer_name")
|
||||||
|
|
@ -521,7 +502,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerTexpayerName 客户开票公司名称
|
* @param customerTexpayerName 客户开票公司名称
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_texpayer_name")
|
@JSONField(name="customer_texpayer_name")
|
||||||
|
|
@ -544,7 +524,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerTexpayerNum 客户纳税人识别号
|
* @param customerTexpayerNum 客户纳税人识别号
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_texpayer_num")
|
@JSONField(name="customer_texpayer_num")
|
||||||
|
|
@ -567,7 +546,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerAddress
|
* @param customerAddress
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_address")
|
@JSONField(name="customer_address")
|
||||||
|
|
@ -586,11 +564,10 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name: customer_phone
|
* name: customer_phone
|
||||||
* type: CHAR(11)
|
* type: CHAR(20)
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerPhone
|
* @param customerPhone
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_phone")
|
@JSONField(name="customer_phone")
|
||||||
|
|
@ -613,7 +590,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerBankName
|
* @param customerBankName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_bank_name")
|
@JSONField(name="customer_bank_name")
|
||||||
|
|
@ -636,7 +612,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerBankAccount
|
* @param customerBankAccount
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_bank_account")
|
@JSONField(name="customer_bank_account")
|
||||||
|
|
@ -659,7 +634,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverName 收货人
|
* @param customerReceiverName 收货人
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_name")
|
@JSONField(name="customer_receiver_name")
|
||||||
|
|
@ -682,7 +656,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverPhone 收货人电话
|
* @param customerReceiverPhone 收货人电话
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_phone")
|
@JSONField(name="customer_receiver_phone")
|
||||||
|
|
@ -705,7 +678,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverAddress 送货地址
|
* @param customerReceiverAddress 送货地址
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_address")
|
@JSONField(name="customer_receiver_address")
|
||||||
|
|
@ -728,7 +700,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverLgtd 收货地址经度
|
* @param customerReceiverLgtd 收货地址经度
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_lgtd")
|
@JSONField(name="customer_receiver_lgtd")
|
||||||
|
|
@ -751,7 +722,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param customerReceiverLttd 收货地址纬度
|
* @param customerReceiverLttd 收货地址纬度
|
||||||
*/
|
*/
|
||||||
@JSONField(name="customer_receiver_lttd")
|
@JSONField(name="customer_receiver_lttd")
|
||||||
|
|
@ -774,7 +744,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoId 物流公司
|
* @param transCoId 物流公司
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_id")
|
@JSONField(name="trans_co_id")
|
||||||
|
|
@ -797,7 +766,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoName
|
* @param transCoName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_name")
|
@JSONField(name="trans_co_name")
|
||||||
|
|
@ -820,7 +788,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoTexpayerName 物流公司开票公司名称
|
* @param transCoTexpayerName 物流公司开票公司名称
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_texpayer_name")
|
@JSONField(name="trans_co_texpayer_name")
|
||||||
|
|
@ -843,7 +810,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoTexpayerNum
|
* @param transCoTexpayerNum
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_texpayer_num")
|
@JSONField(name="trans_co_texpayer_num")
|
||||||
|
|
@ -866,7 +832,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoAddress
|
* @param transCoAddress
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_address")
|
@JSONField(name="trans_co_address")
|
||||||
|
|
@ -889,7 +854,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoPhone
|
* @param transCoPhone
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_phone")
|
@JSONField(name="trans_co_phone")
|
||||||
|
|
@ -912,7 +876,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoBankName
|
* @param transCoBankName
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_bank_name")
|
@JSONField(name="trans_co_bank_name")
|
||||||
|
|
@ -935,7 +898,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param transCoBankAccount
|
* @param transCoBankAccount
|
||||||
*/
|
*/
|
||||||
@JSONField(name="trans_co_bank_account")
|
@JSONField(name="trans_co_bank_account")
|
||||||
|
|
@ -958,7 +920,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param productId 品类id
|
* @param productId 品类id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="product_id")
|
@JSONField(name="product_id")
|
||||||
|
|
@ -981,7 +942,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: NO
|
* isNullable: NO
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param productName 品类名称
|
* @param productName 品类名称
|
||||||
*/
|
*/
|
||||||
@JSONField(name="product_name")
|
@JSONField(name="product_name")
|
||||||
|
|
@ -1004,7 +964,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param orderclusterId ordercluste id
|
* @param orderclusterId ordercluste id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="ordercluster_id")
|
@JSONField(name="ordercluster_id")
|
||||||
|
|
@ -1027,7 +986,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param prepayCustomerId 预付费客户 prepay_customer 表的id
|
* @param prepayCustomerId 预付费客户 prepay_customer 表的id
|
||||||
*/
|
*/
|
||||||
@JSONField(name="prepay_customer_id")
|
@JSONField(name="prepay_customer_id")
|
||||||
|
|
@ -1050,7 +1008,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param oldSn 兼容旧系统的数据
|
* @param oldSn 兼容旧系统的数据
|
||||||
*/
|
*/
|
||||||
@JSONField(name="old_sn")
|
@JSONField(name="old_sn")
|
||||||
|
|
@ -1073,7 +1030,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param invoiceCode 发票号码
|
* @param invoiceCode 发票号码
|
||||||
*/
|
*/
|
||||||
@JSONField(name="invoice_code")
|
@JSONField(name="invoice_code")
|
||||||
|
|
@ -1096,7 +1052,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue:
|
* defaultValue:
|
||||||
*
|
|
||||||
* @param invoiceNumber 发票代码
|
* @param invoiceNumber 发票代码
|
||||||
*/
|
*/
|
||||||
@JSONField(name="invoice_number")
|
@JSONField(name="invoice_number")
|
||||||
|
|
@ -1119,7 +1074,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 1
|
* defaultValue: 1
|
||||||
*
|
|
||||||
* @param invoiceType 1.普票,2.专票
|
* @param invoiceType 1.普票,2.专票
|
||||||
*/
|
*/
|
||||||
@JSONField(name="invoice_type")
|
@JSONField(name="invoice_type")
|
||||||
|
|
@ -1142,7 +1096,6 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
* isNullable: YES
|
* isNullable: YES
|
||||||
* isPrimaryKey: NO
|
* isPrimaryKey: NO
|
||||||
* defaultValue: 1
|
* defaultValue: 1
|
||||||
*
|
|
||||||
* @param invoiceSite 1.砂站,2.结算中心
|
* @param invoiceSite 1.砂站,2.结算中心
|
||||||
*/
|
*/
|
||||||
@JSONField(name="invoice_site")
|
@JSONField(name="invoice_site")
|
||||||
|
|
@ -1159,5 +1112,27 @@ public abstract class BaseOrderTemp<M extends BaseOrderTemp<M>> extends BaseMode
|
||||||
return getInt("invoice_site");
|
return getInt("invoice_site");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: ticket_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param ticketCode 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public void setTicketCode(String ticketCode) {
|
||||||
|
set("ticket_code", ticketCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ticket_code 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public String getTicketCode() {
|
||||||
|
return getStr("ticket_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -955,6 +955,7 @@ public abstract class BaseOrdercluster<M extends BaseOrdercluster<M>> extends Ba
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mini_truck 最少指派的车辆数
|
* @return mini_truck 最少指派的车辆数
|
||||||
*/
|
*/
|
||||||
|
|
@ -963,5 +964,21 @@ public abstract class BaseOrdercluster<M extends BaseOrdercluster<M>> extends Ba
|
||||||
return getInt("mini_truck");
|
return getInt("mini_truck");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param maxTruck 最高指派的车辆数
|
||||||
|
*/
|
||||||
|
@JSONField(name = "max_truck")
|
||||||
|
public void setMaxTruck(Integer maxTruck) {
|
||||||
|
set("max_truck", maxTruck);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return 最高指派车辆数
|
||||||
|
*/
|
||||||
|
@JSONField(name = "max_truck")
|
||||||
|
public Integer getMaxTruck() {
|
||||||
|
return getInt("max_truck");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,360 @@
|
||||||
|
package com.cowr.model.base;
|
||||||
|
|
||||||
|
import com.cowr.common.base.BaseModel;
|
||||||
|
import com.jfinal.plugin.activerecord.IBean;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Mon Mar 01 10:54:13 CST 2021
|
||||||
|
* TableName: ticket_invalid_verify
|
||||||
|
* Remarks: 结算单管理 - 结算单作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public abstract class BaseTicketInvalidVerify<M extends BaseTicketInvalidVerify<M>> extends BaseModel<M> implements IBean {
|
||||||
|
|
||||||
|
public static final String tablename = "ticket_invalid_verify";
|
||||||
|
|
||||||
|
@JSONField(serialize=false)
|
||||||
|
public String getTablename(){
|
||||||
|
return tablename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: id
|
||||||
|
* type: CHAR(32)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: YES
|
||||||
|
* defaultValue:
|
||||||
|
* @param id uuid
|
||||||
|
*/
|
||||||
|
@JSONField(name="id")
|
||||||
|
public void setId(String id) {
|
||||||
|
set("id", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return id uuid
|
||||||
|
*/
|
||||||
|
@JSONField(name="id")
|
||||||
|
public String getId() {
|
||||||
|
return getStr("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: ticket_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param ticketCode 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public void setTicketCode(String ticketCode) {
|
||||||
|
set("ticket_code", ticketCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ticket_code 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public String getTicketCode() {
|
||||||
|
return getStr("ticket_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: create_time
|
||||||
|
* type: DATETIME(19)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param createTime 创建时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_time")
|
||||||
|
public void setCreateTime(java.util.Date createTime) {
|
||||||
|
set("create_time", createTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return create_time 创建时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_time")
|
||||||
|
public java.util.Date getCreateTime() {
|
||||||
|
return get("create_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: change_time
|
||||||
|
* type: TIMESTAMP(19)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: CURRENT_TIMESTAMP
|
||||||
|
* @param changeTime 最后修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="change_time")
|
||||||
|
public void setChangeTime(java.util.Date changeTime) {
|
||||||
|
set("change_time", changeTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return change_time 最后修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="change_time")
|
||||||
|
public java.util.Date getChangeTime() {
|
||||||
|
return get("change_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: state
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: 1
|
||||||
|
* @param state 付费状态。
|
||||||
|
1.提交、待审核
|
||||||
|
2.审核通过,计入余额
|
||||||
|
9.作废
|
||||||
|
*/
|
||||||
|
@JSONField(name="state")
|
||||||
|
public void setState(Integer state) {
|
||||||
|
set("state", state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return state 付费状态。
|
||||||
|
1.提交、待审核
|
||||||
|
2.审核通过,计入余额
|
||||||
|
9.作废
|
||||||
|
*/
|
||||||
|
@JSONField(name="state")
|
||||||
|
public Integer getState() {
|
||||||
|
return getInt("state");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: create_user_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param createUserId 创建用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_user_id")
|
||||||
|
public void setCreateUserId(Integer createUserId) {
|
||||||
|
set("create_user_id", createUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return create_user_id 创建用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_user_id")
|
||||||
|
public Integer getCreateUserId() {
|
||||||
|
return getInt("create_user_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: create_user_name
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param createUserName 创建用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_user_name")
|
||||||
|
public void setCreateUserName(String createUserName) {
|
||||||
|
set("create_user_name", createUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return create_user_name 创建用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_user_name")
|
||||||
|
public String getCreateUserName() {
|
||||||
|
return getStr("create_user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: verify_user_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param verifyUserId 审核用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="verify_user_id")
|
||||||
|
public void setVerifyUserId(Integer verifyUserId) {
|
||||||
|
set("verify_user_id", verifyUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return verify_user_id 审核用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="verify_user_id")
|
||||||
|
public Integer getVerifyUserId() {
|
||||||
|
return getInt("verify_user_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: verify_user_name
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param verifyUserName 审核用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="verify_user_name")
|
||||||
|
public void setVerifyUserName(String verifyUserName) {
|
||||||
|
set("verify_user_name", verifyUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return verify_user_name 审核用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="verify_user_name")
|
||||||
|
public String getVerifyUserName() {
|
||||||
|
return getStr("verify_user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: order_sn
|
||||||
|
* type: CHAR(16)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param orderSn 关联订单号,方便查询
|
||||||
|
*/
|
||||||
|
@JSONField(name="order_sn")
|
||||||
|
public void setOrderSn(String orderSn) {
|
||||||
|
set("order_sn", orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return order_sn 关联订单号,方便查询
|
||||||
|
*/
|
||||||
|
@JSONField(name="order_sn")
|
||||||
|
public String getOrderSn() {
|
||||||
|
return getStr("order_sn");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: type
|
||||||
|
* type: SMALLINT(5)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param type 1、2、3、4、5
|
||||||
|
*/
|
||||||
|
@JSONField(name="type")
|
||||||
|
public void setType(Integer type) {
|
||||||
|
set("type", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return type 1、2、3、4、5
|
||||||
|
*/
|
||||||
|
@JSONField(name="type")
|
||||||
|
public Integer getType() {
|
||||||
|
return getInt("type");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: ticket_receive_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param ticketReceiveId 领用记录id
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_receive_id")
|
||||||
|
public void setTicketReceiveId(Integer ticketReceiveId) {
|
||||||
|
set("ticket_receive_id", ticketReceiveId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ticket_receive_id 领用记录id
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_receive_id")
|
||||||
|
public Integer getTicketReceiveId() {
|
||||||
|
return getInt("ticket_receive_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: supermarket_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param supermarketId 超市id
|
||||||
|
*/
|
||||||
|
@JSONField(name="supermarket_id")
|
||||||
|
public void setSupermarketId(Integer supermarketId) {
|
||||||
|
set("supermarket_id", supermarketId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return supermarket_id 超市id
|
||||||
|
*/
|
||||||
|
@JSONField(name="supermarket_id")
|
||||||
|
public Integer getSupermarketId() {
|
||||||
|
return getInt("supermarket_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invalid_memo
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invalidMemo 作废申请说明
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_memo")
|
||||||
|
public void setInvalidMemo(String invalidMemo) {
|
||||||
|
set("invalid_memo", invalidMemo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invalid_memo 作废申请说明
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_memo")
|
||||||
|
public String getInvalidMemo() {
|
||||||
|
return getStr("invalid_memo");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: memo
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param memo 审核说明
|
||||||
|
*/
|
||||||
|
@JSONField(name="memo")
|
||||||
|
public void setMemo(String memo) {
|
||||||
|
set("memo", memo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return memo 审核说明
|
||||||
|
*/
|
||||||
|
@JSONField(name="memo")
|
||||||
|
public String getMemo() {
|
||||||
|
return getStr("memo");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,464 @@
|
||||||
|
package com.cowr.model.base;
|
||||||
|
|
||||||
|
import com.cowr.common.base.BaseModel;
|
||||||
|
import com.jfinal.plugin.activerecord.IBean;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Wed Mar 03 11:26:53 CST 2021
|
||||||
|
* TableName: ticket_log
|
||||||
|
* Remarks: 结算单管理 - 结算单使用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public abstract class BaseTicketLog<M extends BaseTicketLog<M>> extends BaseModel<M> implements IBean {
|
||||||
|
|
||||||
|
public static final String tablename = "ticket_log";
|
||||||
|
|
||||||
|
@JSONField(serialize=false)
|
||||||
|
public String getTablename(){
|
||||||
|
return tablename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: id
|
||||||
|
* type: CHAR(32)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: YES
|
||||||
|
* defaultValue:
|
||||||
|
* @param id uuid
|
||||||
|
*/
|
||||||
|
@JSONField(name="id")
|
||||||
|
public void setId(String id) {
|
||||||
|
set("id", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return id uuid
|
||||||
|
*/
|
||||||
|
@JSONField(name="id")
|
||||||
|
public String getId() {
|
||||||
|
return getStr("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: ticket_receive_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param ticketReceiveId 领用记录id
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_receive_id")
|
||||||
|
public void setTicketReceiveId(Integer ticketReceiveId) {
|
||||||
|
set("ticket_receive_id", ticketReceiveId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ticket_receive_id 领用记录id
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_receive_id")
|
||||||
|
public Integer getTicketReceiveId() {
|
||||||
|
return getInt("ticket_receive_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: ticket_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param ticketCode 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public void setTicketCode(String ticketCode) {
|
||||||
|
set("ticket_code", ticketCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ticket_code 结算单代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="ticket_code")
|
||||||
|
public String getTicketCode() {
|
||||||
|
return getStr("ticket_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: create_time
|
||||||
|
* type: DATETIME(19)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: CURRENT_TIMESTAMP
|
||||||
|
* @param createTime 创建时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_time")
|
||||||
|
public void setCreateTime(java.util.Date createTime) {
|
||||||
|
set("create_time", createTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return create_time 创建时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_time")
|
||||||
|
public java.util.Date getCreateTime() {
|
||||||
|
return get("create_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: change_time
|
||||||
|
* type: TIMESTAMP(19)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: CURRENT_TIMESTAMP
|
||||||
|
* @param changeTime 最后修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="change_time")
|
||||||
|
public void setChangeTime(java.util.Date changeTime) {
|
||||||
|
set("change_time", changeTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return change_time 最后修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="change_time")
|
||||||
|
public java.util.Date getChangeTime() {
|
||||||
|
return get("change_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: state
|
||||||
|
* type: SMALLINT(5)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: 1
|
||||||
|
* @param state 1 新领取、未使用,5 已使用,9 作废
|
||||||
|
*/
|
||||||
|
@JSONField(name="state")
|
||||||
|
public void setState(Integer state) {
|
||||||
|
set("state", state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return state 1 新领取、未使用,5 已使用,9 作废
|
||||||
|
*/
|
||||||
|
@JSONField(name="state")
|
||||||
|
public Integer getState() {
|
||||||
|
return getInt("state");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: settlement_time
|
||||||
|
* type: DATETIME(19)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param settlementTime 开票时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="settlement_time")
|
||||||
|
public void setSettlementTime(java.util.Date settlementTime) {
|
||||||
|
set("settlement_time", settlementTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return settlement_time 开票时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="settlement_time")
|
||||||
|
public java.util.Date getSettlementTime() {
|
||||||
|
return get("settlement_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: settlement_user_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param settlementUserId 开票用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="settlement_user_id")
|
||||||
|
public void setSettlementUserId(Integer settlementUserId) {
|
||||||
|
set("settlement_user_id", settlementUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return settlement_user_id 开票用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="settlement_user_id")
|
||||||
|
public Integer getSettlementUserId() {
|
||||||
|
return getInt("settlement_user_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: settlement_user_name
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param settlementUserName 开票用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="settlement_user_name")
|
||||||
|
public void setSettlementUserName(String settlementUserName) {
|
||||||
|
set("settlement_user_name", settlementUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return settlement_user_name 开票用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="settlement_user_name")
|
||||||
|
public String getSettlementUserName() {
|
||||||
|
return getStr("settlement_user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invalid_time
|
||||||
|
* type: DATETIME(19)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invalidTime 作废时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_time")
|
||||||
|
public void setInvalidTime(java.util.Date invalidTime) {
|
||||||
|
set("invalid_time", invalidTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invalid_time 作废时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_time")
|
||||||
|
public java.util.Date getInvalidTime() {
|
||||||
|
return get("invalid_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invalid_user_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invalidUserId 作废用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_user_id")
|
||||||
|
public void setInvalidUserId(Integer invalidUserId) {
|
||||||
|
set("invalid_user_id", invalidUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invalid_user_id 作废用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_user_id")
|
||||||
|
public Integer getInvalidUserId() {
|
||||||
|
return getInt("invalid_user_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invalid_user_name
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invalidUserName 作废用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_user_name")
|
||||||
|
public void setInvalidUserName(String invalidUserName) {
|
||||||
|
set("invalid_user_name", invalidUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invalid_user_name 作废用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_user_name")
|
||||||
|
public String getInvalidUserName() {
|
||||||
|
return getStr("invalid_user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invalid_memo
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invalidMemo 作废说明
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_memo")
|
||||||
|
public void setInvalidMemo(String invalidMemo) {
|
||||||
|
set("invalid_memo", invalidMemo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invalid_memo 作废说明
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_memo")
|
||||||
|
public String getInvalidMemo() {
|
||||||
|
return getStr("invalid_memo");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: order_sn
|
||||||
|
* type: CHAR(16)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param orderSn 关联订单号,方便查询
|
||||||
|
*/
|
||||||
|
@JSONField(name="order_sn")
|
||||||
|
public void setOrderSn(String orderSn) {
|
||||||
|
set("order_sn", orderSn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return order_sn 关联订单号,方便查询
|
||||||
|
*/
|
||||||
|
@JSONField(name="order_sn")
|
||||||
|
public String getOrderSn() {
|
||||||
|
return getStr("order_sn");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: type
|
||||||
|
* type: SMALLINT(5)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param type 1、2、3、4、5
|
||||||
|
*/
|
||||||
|
@JSONField(name="type")
|
||||||
|
public void setType(Integer type) {
|
||||||
|
set("type", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return type 1、2、3、4、5
|
||||||
|
*/
|
||||||
|
@JSONField(name="type")
|
||||||
|
public Integer getType() {
|
||||||
|
return getInt("type");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_number
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invoiceNumber 结算单换取的发票代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_number")
|
||||||
|
public void setInvoiceNumber(String invoiceNumber) {
|
||||||
|
set("invoice_number", invoiceNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_number 结算单换取的发票代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_number")
|
||||||
|
public String getInvoiceNumber() {
|
||||||
|
return getStr("invoice_number");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invoiceCode 结算单换取的发票代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_code")
|
||||||
|
public void setInvoiceCode(String invoiceCode) {
|
||||||
|
set("invoice_code", invoiceCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_code 结算单换取的发票代码
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_code")
|
||||||
|
public String getInvoiceCode() {
|
||||||
|
return getStr("invoice_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_time
|
||||||
|
* type: DATETIME(19)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invoiceTime 开专票时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_time")
|
||||||
|
public void setInvoiceTime(java.util.Date invoiceTime) {
|
||||||
|
set("invoice_time", invoiceTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_time 开专票时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_time")
|
||||||
|
public java.util.Date getInvoiceTime() {
|
||||||
|
return get("invoice_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_user_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invoiceUserId 开专票用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_user_id")
|
||||||
|
public void setInvoiceUserId(Integer invoiceUserId) {
|
||||||
|
set("invoice_user_id", invoiceUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_user_id 开专票用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_user_id")
|
||||||
|
public Integer getInvoiceUserId() {
|
||||||
|
return getInt("invoice_user_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invoice_user_name
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invoiceUserName 开专票用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_user_name")
|
||||||
|
public void setInvoiceUserName(String invoiceUserName) {
|
||||||
|
set("invoice_user_name", invoiceUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_user_name 开专票用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_user_name")
|
||||||
|
public String getInvoiceUserName() {
|
||||||
|
return getStr("invoice_user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,266 @@
|
||||||
|
package com.cowr.model.base;
|
||||||
|
|
||||||
|
import com.cowr.common.base.BaseModel;
|
||||||
|
import com.jfinal.plugin.activerecord.IBean;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Mon Mar 01 10:54:13 CST 2021
|
||||||
|
* TableName: ticket_receive
|
||||||
|
* Remarks: 结算单管理 - 领用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public abstract class BaseTicketReceive<M extends BaseTicketReceive<M>> extends BaseModel<M> implements IBean {
|
||||||
|
|
||||||
|
public static final String tablename = "ticket_receive";
|
||||||
|
|
||||||
|
@JSONField(serialize=false)
|
||||||
|
public String getTablename(){
|
||||||
|
return tablename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: YES
|
||||||
|
* defaultValue:
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
@JSONField(name="id")
|
||||||
|
public void setId(Integer id) {
|
||||||
|
set("id", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
|
@JSONField(name="id")
|
||||||
|
public Integer getId() {
|
||||||
|
return getInt("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: surplus
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param surplus 剩余数量
|
||||||
|
*/
|
||||||
|
@JSONField(name="surplus")
|
||||||
|
public void setSurplus(Integer surplus) {
|
||||||
|
set("surplus", surplus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return surplus 剩余数量
|
||||||
|
*/
|
||||||
|
@JSONField(name="surplus")
|
||||||
|
public Integer getSurplus() {
|
||||||
|
return getInt("surplus");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: start_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param startCode 起始号码
|
||||||
|
*/
|
||||||
|
@JSONField(name="start_code")
|
||||||
|
public void setStartCode(String startCode) {
|
||||||
|
set("start_code", startCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return start_code 起始号码
|
||||||
|
*/
|
||||||
|
@JSONField(name="start_code")
|
||||||
|
public String getStartCode() {
|
||||||
|
return getStr("start_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: end_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param endCode 截止号码
|
||||||
|
*/
|
||||||
|
@JSONField(name="end_code")
|
||||||
|
public void setEndCode(String endCode) {
|
||||||
|
set("end_code", endCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return end_code 截止号码
|
||||||
|
*/
|
||||||
|
@JSONField(name="end_code")
|
||||||
|
public String getEndCode() {
|
||||||
|
return getStr("end_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: current_code
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param currentCode 当前使用到的号码
|
||||||
|
*/
|
||||||
|
@JSONField(name="current_code")
|
||||||
|
public void setCurrentCode(String currentCode) {
|
||||||
|
set("current_code", currentCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return current_code 当前使用到的号码
|
||||||
|
*/
|
||||||
|
@JSONField(name="current_code")
|
||||||
|
public String getCurrentCode() {
|
||||||
|
return getStr("current_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: create_time
|
||||||
|
* type: DATETIME(19)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: CURRENT_TIMESTAMP
|
||||||
|
* @param createTime 创建时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_time")
|
||||||
|
public void setCreateTime(java.util.Date createTime) {
|
||||||
|
set("create_time", createTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return create_time 创建时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="create_time")
|
||||||
|
public java.util.Date getCreateTime() {
|
||||||
|
return get("create_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: change_time
|
||||||
|
* type: TIMESTAMP(19)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: CURRENT_TIMESTAMP
|
||||||
|
* @param changeTime 最后修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="change_time")
|
||||||
|
public void setChangeTime(java.util.Date changeTime) {
|
||||||
|
set("change_time", changeTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return change_time 最后修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(name="change_time")
|
||||||
|
public java.util.Date getChangeTime() {
|
||||||
|
return get("change_time");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: receive_user_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param receiveUserId 领取用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="receive_user_id")
|
||||||
|
public void setReceiveUserId(Integer receiveUserId) {
|
||||||
|
set("receive_user_id", receiveUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return receive_user_id 领取用户id
|
||||||
|
*/
|
||||||
|
@JSONField(name="receive_user_id")
|
||||||
|
public Integer getReceiveUserId() {
|
||||||
|
return getInt("receive_user_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: receive_user_name
|
||||||
|
* type: VARCHAR(255)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param receiveUserName 领取用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="receive_user_name")
|
||||||
|
public void setReceiveUserName(String receiveUserName) {
|
||||||
|
set("receive_user_name", receiveUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return receive_user_name 领取用户姓名
|
||||||
|
*/
|
||||||
|
@JSONField(name="receive_user_name")
|
||||||
|
public String getReceiveUserName() {
|
||||||
|
return getStr("receive_user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: supermarket_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param supermarketId 领取超市id
|
||||||
|
*/
|
||||||
|
@JSONField(name="supermarket_id")
|
||||||
|
public void setSupermarketId(Integer supermarketId) {
|
||||||
|
set("supermarket_id", supermarketId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return supermarket_id 领取超市id
|
||||||
|
*/
|
||||||
|
@JSONField(name="supermarket_id")
|
||||||
|
public Integer getSupermarketId() {
|
||||||
|
return getInt("supermarket_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name: invalid_count
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue: 0
|
||||||
|
* @param invalidCount 作废数量
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_count")
|
||||||
|
public void setInvalidCount(Integer invalidCount) {
|
||||||
|
set("invalid_count", invalidCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invalid_count 作废数量
|
||||||
|
*/
|
||||||
|
@JSONField(name="invalid_count")
|
||||||
|
public Integer getInvalidCount() {
|
||||||
|
return getInt("invalid_count");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.cowr.ssjygl.blacklist;
|
package com.cowr.ssjygl.blacklist;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cowr.common.Const;
|
import com.cowr.common.Const;
|
||||||
import com.cowr.common.base.BaseService;
|
import com.cowr.common.base.BaseService;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import com.cowr.model.Blacklist;
|
import com.cowr.model.Blacklist;
|
||||||
import com.cowr.model.Truck;
|
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
import com.jfinal.plugin.activerecord.Page;
|
import com.jfinal.plugin.activerecord.Page;
|
||||||
|
|
@ -73,4 +73,22 @@ public class BlacklistService extends BaseService {
|
||||||
" and truck_license = ? \n" +
|
" and truck_license = ? \n" +
|
||||||
" limit 0,1 ", license);
|
" limit 0,1 ", license);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Blacklist json2model(JSONObject obj) {
|
||||||
|
Blacklist blacklist = new Blacklist();
|
||||||
|
blacklist.setId(obj.getString("id"));
|
||||||
|
blacklist.setTruckLicense(obj.getString("truck_license"));
|
||||||
|
blacklist.setDriverName(obj.getString("driver_name"));
|
||||||
|
blacklist.setDriverPhone(obj.getString("driver_phone"));
|
||||||
|
blacklist.setOrderSn(obj.getString("order_sn"));
|
||||||
|
blacklist.setSetTime(obj.getDate("set_time"));
|
||||||
|
blacklist.setSetUserId(obj.getInteger("set_user_id"));
|
||||||
|
blacklist.setSetUserName(obj.getString("set_user_name"));
|
||||||
|
blacklist.setRemoveTime(obj.getDate("remove_time"));
|
||||||
|
blacklist.setRemoveUserId(obj.getInteger("remove_user_id"));
|
||||||
|
blacklist.setRemoveUserName(obj.getString("remove_user_name"));
|
||||||
|
blacklist.setReasonType(obj.getInteger("reason_type"));
|
||||||
|
blacklist.setReasonDetail(obj.getString("reason_detail"));
|
||||||
|
return blacklist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public class CustomerValidator extends CrudParamValidator {
|
||||||
|
|
||||||
validateString("texpayer_num", 0, 20, "texpayer_num", "texpayer_num 长度 0~20");
|
validateString("texpayer_num", 0, 20, "texpayer_num", "texpayer_num 长度 0~20");
|
||||||
validateString("bank_name", 0, 128, "bank_name", "bank_name 长度 0~128");
|
validateString("bank_name", 0, 128, "bank_name", "bank_name 长度 0~128");
|
||||||
validateString("bank_account", 0, 20, "bank_account", "bank_account 长度 0~20");
|
validateString("bank_account", 0, 128, "bank_account", "bank_account 长度 0~20");
|
||||||
|
|
||||||
if (StrKit.notBlank(c.get("invoice_type"))) {
|
if (StrKit.notBlank(c.get("invoice_type"))) {
|
||||||
validateInteger("invoice_type", 1, 2, "invoice_type", "invoice_type 范围 1~2");
|
validateInteger("invoice_type", 1, 2, "invoice_type", "invoice_type 范围 1~2");
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
||||||
* PrimaryKey: id
|
* PrimaryKey: id
|
||||||
*/
|
*/
|
||||||
public class InvoiceReceiveService extends BaseService {
|
public class InvoiceReceiveService extends BaseService {
|
||||||
private static Log log = Log.getLog(InvoiceReceiveService.class);
|
private static final Log log = Log.getLog(InvoiceReceiveService.class);
|
||||||
public static final InvoiceReceiveService me = new InvoiceReceiveService();
|
public static final InvoiceReceiveService me = new InvoiceReceiveService();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,13 +40,13 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer code = Integer.parseInt(invoice_code);
|
Long code = Long.parseLong(invoice_code);
|
||||||
String sql = "select * from invoice_receive t\n" +
|
String sql = "select * from invoice_receive t\n" +
|
||||||
" where t.supermarket_id = ? \n" +
|
" where t.supermarket_id = ? \n" +
|
||||||
" and t.surplus > 0 \n" +
|
" and t.surplus > 0 \n" +
|
||||||
" and t.invoice_number = ? \n" +
|
" and t.invoice_number = ? \n" +
|
||||||
" and cast(t.start_code as unsigned integer) <= ? \n" +
|
" and cast(t.start_code as unsigned) <= ? \n" +
|
||||||
" and cast(t.end_code as unsigned integer) >= ? \n" +
|
" and cast(t.end_code as unsigned) >= ? \n" +
|
||||||
" limit 1";
|
" limit 1";
|
||||||
|
|
||||||
InvoiceReceive receive = InvoiceReceive.dao.findFirst(sql, supermarket_id, invoice_number, code, code);
|
InvoiceReceive receive = InvoiceReceive.dao.findFirst(sql, supermarket_id, invoice_number, code, code);
|
||||||
|
|
@ -56,6 +56,7 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 有领用记录,可以是已经被使用完的
|
* 有领用记录,可以是已经被使用完的
|
||||||
|
*
|
||||||
* @param supermarket_id
|
* @param supermarket_id
|
||||||
* @param invoice_number
|
* @param invoice_number
|
||||||
* @param invoice_code
|
* @param invoice_code
|
||||||
|
|
@ -66,12 +67,12 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer code = Integer.parseInt(invoice_code);
|
Long code = Long.parseLong(invoice_code);
|
||||||
String sql = "select * from invoice_receive t\n" +
|
String sql = "select * from invoice_receive t\n" +
|
||||||
" where t.supermarket_id = ? \n" +
|
" where t.supermarket_id = ? \n" +
|
||||||
" and t.invoice_number = ? \n" +
|
" and t.invoice_number = ? \n" +
|
||||||
" and cast(t.start_code as unsigned integer) <= ? \n" +
|
" and cast(t.start_code as unsigned) <= ? \n" +
|
||||||
" and cast(t.end_code as unsigned integer) >= ? \n" +
|
" and cast(t.end_code as unsigned) >= ? \n" +
|
||||||
" limit 1";
|
" limit 1";
|
||||||
|
|
||||||
InvoiceReceive receive = InvoiceReceive.dao.findFirst(sql, supermarket_id, invoice_number, code, code);
|
InvoiceReceive receive = InvoiceReceive.dao.findFirst(sql, supermarket_id, invoice_number, code, code);
|
||||||
|
|
@ -90,7 +91,7 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String next_invoice_code = String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getCurrentCode()) + 1);
|
String next_invoice_code = String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getCurrentCode()) + 1);
|
||||||
|
|
||||||
// 按领用 id 找到所有作废的发票
|
// 按领用 id 找到所有作废的发票
|
||||||
List<InvoiceLog> invoiceLogs = InvoiceLog.dao.find(
|
List<InvoiceLog> invoiceLogs = InvoiceLog.dao.find(
|
||||||
|
|
@ -114,7 +115,7 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String next_next_invoice_code = String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(next_invoice_code) + 1);
|
String next_next_invoice_code = String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(next_invoice_code) + 1);
|
||||||
|
|
||||||
return getValidInvoiceCode(receive, next_next_invoice_code, invoiceLogs);
|
return getValidInvoiceCode(receive, next_next_invoice_code, invoiceLogs);
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +126,7 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
|
|
||||||
private String getValidInvoiceCode(String invoice_number, String next_invoice_code, Map<String, InvoiceLog> map) {
|
private String getValidInvoiceCode(String invoice_number, String next_invoice_code, Map<String, InvoiceLog> map) {
|
||||||
if (map.containsKey(invoice_number + "_" + next_invoice_code)) { // 说明下一个发票号码已经作废,需要继续顺延
|
if (map.containsKey(invoice_number + "_" + next_invoice_code)) { // 说明下一个发票号码已经作废,需要继续顺延
|
||||||
return getValidInvoiceCode(invoice_number, String.format("%0" + next_invoice_code.length() + "d", Integer.parseInt(next_invoice_code) + 1), map);
|
return getValidInvoiceCode(invoice_number, String.format("%0" + next_invoice_code.length() + "d", Long.parseLong(next_invoice_code) + 1), map);
|
||||||
} else {
|
} else {
|
||||||
return next_invoice_code;
|
return next_invoice_code;
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +143,7 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
String sql = "select * from invoice_receive t\n" +
|
String sql = "select * from invoice_receive t\n" +
|
||||||
" where t.supermarket_id = ? \n" +
|
" where t.supermarket_id = ? \n" +
|
||||||
" and t.surplus > 0\n" +
|
" and t.surplus > 0\n" +
|
||||||
" order by cast(t.start_code as unsigned integer) asc";
|
" order by cast(t.start_code as unsigned) asc";
|
||||||
|
|
||||||
List<InvoiceReceive> receives = InvoiceReceive.dao.find(sql, supermarket_id);
|
List<InvoiceReceive> receives = InvoiceReceive.dao.find(sql, supermarket_id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,12 @@ package com.cowr.ssjygl.order.ordertemp;
|
||||||
|
|
||||||
import com.cowr.common.Const;
|
import com.cowr.common.Const;
|
||||||
import com.cowr.common.base.BaseService;
|
import com.cowr.common.base.BaseService;
|
||||||
import com.cowr.common.enums.OrderStateEnum;
|
|
||||||
import com.cowr.common.enums.UserTypeEnum;
|
import com.cowr.common.enums.UserTypeEnum;
|
||||||
import com.cowr.common.utils.DataUtil;
|
import com.cowr.common.utils.DataUtil;
|
||||||
import com.cowr.common.utils.DateTimeUtil;
|
import com.cowr.common.utils.DateTimeUtil;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.model.InvoiceInvalidVerify;
|
import com.cowr.model.*;
|
||||||
import com.cowr.model.OrderInvalidVerify;
|
|
||||||
import com.cowr.model.OrderTemp;
|
|
||||||
import com.cowr.model.Sysuser;
|
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
import com.jfinal.plugin.activerecord.Page;
|
import com.jfinal.plugin.activerecord.Page;
|
||||||
|
|
@ -95,6 +91,7 @@ public class OrderTempService extends BaseService {
|
||||||
Integer state,
|
Integer state,
|
||||||
String invoice_code,
|
String invoice_code,
|
||||||
Integer invoice_type,
|
Integer invoice_type,
|
||||||
|
String ticket_code,
|
||||||
Integer product_id,
|
Integer product_id,
|
||||||
Boolean invoice_code_is_null
|
Boolean invoice_code_is_null
|
||||||
) {
|
) {
|
||||||
|
|
@ -175,6 +172,11 @@ public class OrderTempService extends BaseService {
|
||||||
paraList.add(invoice_type);
|
paraList.add(invoice_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(ticket_code)) {
|
||||||
|
fromsql += " and t.ticket_code like ? \n";
|
||||||
|
paraList.add("%" + ticket_code.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
String totalRowSql = "select count(*) " + fromsql;
|
String totalRowSql = "select count(*) " + fromsql;
|
||||||
String findSql = selectsql + fromsql;
|
String findSql = selectsql + fromsql;
|
||||||
|
|
||||||
|
|
@ -211,6 +213,8 @@ public class OrderTempService extends BaseService {
|
||||||
List<OrderInvalidVerify> verifies2 = OrderInvalidVerify.dao.find(
|
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());
|
"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) {
|
for (Record record : list) {
|
||||||
String rdsn = record.getStr("sn");
|
String rdsn = record.getStr("sn");
|
||||||
|
|
@ -221,6 +225,12 @@ public class OrderTempService extends BaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (TicketInvalidVerify v : verifies3) {
|
||||||
|
if (rdsn.equals(v.getOrderSn())) {
|
||||||
|
record.set("ticket_invalid_verify_state", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (OrderInvalidVerify v : verifies2) {
|
for (OrderInvalidVerify v : verifies2) {
|
||||||
if (rdsn.equals(v.getOrderSn())) {
|
if (rdsn.equals(v.getOrderSn())) {
|
||||||
record.set("order_invalid_verify_state", 1);
|
record.set("order_invalid_verify_state", 1);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ public class InvoiceUseController extends Controller {
|
||||||
Integer invoice_type = getInt("invoice_type");
|
Integer invoice_type = getInt("invoice_type");
|
||||||
String invoice_number = get("invoice_number");
|
String invoice_number = get("invoice_number");
|
||||||
String invoice_code = get("invoice_code");
|
String invoice_code = get("invoice_code");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
Integer invoice_state = getInt("invoice_state");
|
Integer invoice_state = getInt("invoice_state");
|
||||||
String order_sn = get("order_sn");
|
String order_sn = get("order_sn");
|
||||||
String truck_license = get("truck_license");
|
String truck_license = get("truck_license");
|
||||||
|
|
@ -23,9 +24,9 @@ public class InvoiceUseController extends Controller {
|
||||||
|
|
||||||
int export = getInt("export", 0);
|
int export = getInt("export", 0);
|
||||||
if (export == 0) {
|
if (export == 0) {
|
||||||
renderJson(Result.success(InvoiceUseService.me.statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, order_sn, truck_license, order_state)));
|
renderJson(Result.success(InvoiceUseService.me.statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state)));
|
||||||
}else{
|
}else{
|
||||||
Workbook wb = InvoiceUseService.me.statuseExport(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, order_sn, truck_license, order_state);
|
Workbook wb = InvoiceUseService.me.statuseExport(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state);
|
||||||
render(new ExcelRender(tm + "_票据使用记录_" + System.currentTimeMillis() + ".xlsx", wb));
|
render(new ExcelRender(tm + "_票据使用记录_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ public class InvoiceUseService {
|
||||||
String invoice_number,
|
String invoice_number,
|
||||||
String invoice_code,
|
String invoice_code,
|
||||||
Integer invoice_state,
|
Integer invoice_state,
|
||||||
|
String ticket_code,
|
||||||
String order_sn,
|
String order_sn,
|
||||||
String truck_license,
|
String truck_license,
|
||||||
Integer order_state
|
Integer order_state
|
||||||
|
|
@ -43,7 +44,7 @@ public class InvoiceUseService {
|
||||||
String logsql = "select \n" +
|
String logsql = "select \n" +
|
||||||
" t.id rowkey, t.invoice_number, t.`code` invoice_code, t.state invoice_state, t.settlement_user_name, t.settlement_time, t.create_time, t.invalid_time, t.invalid_memo, t.invoice_type, t.invalid_user_name\n" +
|
" t.id rowkey, t.invoice_number, t.`code` invoice_code, t.state invoice_state, t.settlement_user_name, t.settlement_time, t.create_time, t.invalid_time, t.invalid_memo, t.invoice_type, t.invalid_user_name\n" +
|
||||||
" , r.receive_user_name, r.create_time receive_time, r.supermarket_id\n" +
|
" , r.receive_user_name, r.create_time receive_time, r.supermarket_id\n" +
|
||||||
" , o.sn order_sn, o.weight, o.total_price, o.unit_price, o.truck_license, o.customer_id, o.customer_texpayer_name, o.customer_texpayer_num, o.isprepaid, o.state order_state\n" +
|
" , o.sn order_sn, o.weight, o.total_price, o.unit_price, o.truck_license, o.customer_id, o.customer_texpayer_name, o.customer_texpayer_num, o.isprepaid, o.state order_state, o.ticket_code\n" +
|
||||||
" , s.name supermarket_name " +
|
" , s.name supermarket_name " +
|
||||||
" from invoice_log t\n" +
|
" from invoice_log t\n" +
|
||||||
" left join invoice_receive r on t.invoice_receive_id = r.id\n" +
|
" left join invoice_receive r on t.invoice_receive_id = r.id\n" +
|
||||||
|
|
@ -54,8 +55,9 @@ public class InvoiceUseService {
|
||||||
String ordsql = "select\n" +
|
String ordsql = "select\n" +
|
||||||
" t.uuid rowkey, t.invoice_number, t.invoice_code, l.state invoice_state, t.settlement_user_name, l.settlement_time, t.create_time, l.invalid_time, l.invalid_memo, t.invoice_type, l.invalid_user_name\n" +
|
" t.uuid rowkey, t.invoice_number, t.invoice_code, l.state invoice_state, t.settlement_user_name, l.settlement_time, t.create_time, l.invalid_time, l.invalid_memo, t.invoice_type, l.invalid_user_name\n" +
|
||||||
" , r.receive_user_name, r.create_time receive_time, t.supermarket_id \n" +
|
" , r.receive_user_name, r.create_time receive_time, t.supermarket_id \n" +
|
||||||
" , t.sn order_sn, t.weight, t.total_price, t.unit_price, t.truck_license, t.customer_id, t.customer_texpayer_name, t.customer_texpayer_num, t.isprepaid, t.state order_state \n" +
|
" , t.sn order_sn, t.weight, t.total_price, t.unit_price, t.truck_license, t.customer_id, t.customer_texpayer_name, t.customer_texpayer_num, t.isprepaid, t.state order_state, t.ticket_code \n" +
|
||||||
" , s.name supermarket_name from order_temp t \n" +
|
" , s.name supermarket_name \n" +
|
||||||
|
" from order_temp t \n" +
|
||||||
" left join invoice_log l on l.invoice_number = t.invoice_number and l.code = t.invoice_code and l.order_sn = t.sn \n" +
|
" left join invoice_log l on l.invoice_number = t.invoice_number and l.code = t.invoice_code and l.order_sn = t.sn \n" +
|
||||||
" left join supermarket s on s.id = t.supermarket_id\n" +
|
" left join supermarket s on s.id = t.supermarket_id\n" +
|
||||||
" left join invoice_receive r on l.invoice_receive_id = r.id\n" +
|
" left join invoice_receive r on l.invoice_receive_id = r.id\n" +
|
||||||
|
|
@ -112,6 +114,14 @@ public class InvoiceUseService {
|
||||||
paramord.add("%" + truck_license.trim() + "%");
|
paramord.add("%" + truck_license.trim() + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(ticket_code)) {
|
||||||
|
logsql += " and o.ticket_code like ? \n";
|
||||||
|
ordsql += " and t.ticket_code like ? \n";
|
||||||
|
|
||||||
|
paramlog.add("%" + ticket_code.trim() + "%");
|
||||||
|
paramord.add("%" + ticket_code.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
if (invoice_state != null) {
|
if (invoice_state != null) {
|
||||||
if (invoice_state == 9) {
|
if (invoice_state == 9) {
|
||||||
logsql += " and t.state = ? \n";
|
logsql += " and t.state = ? \n";
|
||||||
|
|
@ -225,11 +235,12 @@ public class InvoiceUseService {
|
||||||
String invoice_number,
|
String invoice_number,
|
||||||
String invoice_code,
|
String invoice_code,
|
||||||
Integer invoice_state,
|
Integer invoice_state,
|
||||||
|
String ticket_code,
|
||||||
String order_sn,
|
String order_sn,
|
||||||
String truck_license,
|
String truck_license,
|
||||||
Integer order_state
|
Integer order_state
|
||||||
) {
|
) {
|
||||||
Record ret = statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, order_sn, truck_license, order_state);
|
Record ret = statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state);
|
||||||
|
|
||||||
List<Record> list = ret.get("list");
|
List<Record> list = ret.get("list");
|
||||||
|
|
||||||
|
|
@ -253,6 +264,7 @@ public class InvoiceUseService {
|
||||||
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("作废人");
|
||||||
|
|
@ -260,7 +272,7 @@ public class InvoiceUseService {
|
||||||
row.createCell(a++).setCellValue("备注");
|
row.createCell(a++).setCellValue("备注");
|
||||||
// 表头 end
|
// 表头 end
|
||||||
|
|
||||||
int end_col = 19;
|
int end_col = 20;
|
||||||
int datalen = list.size();
|
int datalen = list.size();
|
||||||
for (int i = 0; i < datalen; i++) {
|
for (int i = 0; i < datalen; i++) {
|
||||||
Record order = list.get(i);
|
Record order = list.get(i);
|
||||||
|
|
@ -313,6 +325,7 @@ public class InvoiceUseService {
|
||||||
} else {
|
} else {
|
||||||
row.createCell(a++).setCellValue("");
|
row.createCell(a++).setCellValue("");
|
||||||
}
|
}
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("ticket_code"));
|
||||||
row.createCell(a++).setCellValue(order.getStr("settlement_user_name"));
|
row.createCell(a++).setCellValue(order.getStr("settlement_user_name"));
|
||||||
if (order.get("settlement_time") != null) {
|
if (order.get("settlement_time") != null) {
|
||||||
row.createCell(a++).setCellValue(DateTimeUtil.sdfhms.get().format(order.getDate("settlement_time")));
|
row.createCell(a++).setCellValue(DateTimeUtil.sdfhms.get().format(order.getDate("settlement_time")));
|
||||||
|
|
|
||||||
|
|
@ -859,23 +859,36 @@ public class OrderStatService {
|
||||||
* @param tm YYYY-MM
|
* @param tm YYYY-MM
|
||||||
* @return
|
* @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" +
|
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" +
|
"from (\n" +
|
||||||
" select t.create_time, t.weight, t.paid, t.total_price\n" +
|
" select t.create_time, t.weight, t.paid, t.total_price\n" +
|
||||||
" from order_sale t\n" +
|
" from order_sale t\n" +
|
||||||
" where t.state = ? \n" +
|
" where t.state = ? \n" +
|
||||||
|
paramsSql+
|
||||||
" and t.create_time like ? \n" +
|
" and t.create_time like ? \n" +
|
||||||
" union all\n" +
|
" union all\n" +
|
||||||
" select t.create_time, t.weight, t.paid, t.total_price\n" +
|
" select t.create_time, t.weight, t.paid, t.total_price\n" +
|
||||||
" from order_temp t\n" +
|
" from order_temp t\n" +
|
||||||
" where t.state = ? \n" +
|
" where t.state = ? \n" +
|
||||||
|
paramsSql+
|
||||||
" and t.create_time like ? \n" +
|
" and t.create_time like ? \n" +
|
||||||
") t\n" +
|
") t\n" +
|
||||||
"group by date_format(t.create_time, '%Y-%m-%d')\n" +
|
"group by date_format(t.create_time, '%Y-%m-%d')\n" +
|
||||||
"order by date_format(t.create_time, '%Y-%m-%d')";
|
"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();
|
Record total = new Record();
|
||||||
total.set("date", null);
|
total.set("date", null);
|
||||||
|
|
@ -913,8 +926,8 @@ public class OrderStatService {
|
||||||
* @param tm YYYY-MM
|
* @param tm YYYY-MM
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Workbook mdstatExport(String tm) {
|
public Workbook mdstatExport(String tm,Integer supermarket_id) {
|
||||||
List<Record> list = mdstat(tm);
|
List<Record> list = mdstat(tm,supermarket_id);
|
||||||
Workbook wb = new XSSFWorkbook();
|
Workbook wb = new XSSFWorkbook();
|
||||||
Sheet sheet = wb.createSheet("销售月逐日统计");
|
Sheet sheet = wb.createSheet("销售月逐日统计");
|
||||||
|
|
||||||
|
|
@ -1846,7 +1859,7 @@ public class OrderStatService {
|
||||||
Sheet sheet = wb.createSheet(stm.substring(0, 10) + " ~ " + etm.substring(0, 10) + "各砂站运输量统计表");
|
Sheet sheet = wb.createSheet(stm.substring(0, 10) + " ~ " + etm.substring(0, 10) + "各砂站运输量统计表");
|
||||||
|
|
||||||
sheet.setColumnWidth(1,40*256);
|
sheet.setColumnWidth(1,40*256);
|
||||||
for(int i=2;i<28;i++){
|
for(int i=2;i<30;i++){
|
||||||
sheet.setColumnWidth(i,15*256);
|
sheet.setColumnWidth(i,15*256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1857,15 +1870,13 @@ public class OrderStatService {
|
||||||
sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
|
sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
|
||||||
sheet.addMergedRegion(new CellRangeAddress(0,1,3,3));
|
sheet.addMergedRegion(new CellRangeAddress(0,1,3,3));
|
||||||
int num = 4;
|
int num = 4;
|
||||||
for(int i=0;i<12;i++){
|
for(int i=0;i<13;i++){
|
||||||
sheet.addMergedRegion(new CellRangeAddress(0,0,num,num+1));
|
sheet.addMergedRegion(new CellRangeAddress(0,0,num,num+1));
|
||||||
num=num+2;
|
num=num+2;
|
||||||
}
|
}
|
||||||
// 通用单元格格式
|
// 通用单元格格式
|
||||||
Font font = wb.createFont();
|
Font font = wb.createFont();
|
||||||
CellStyle cellStyle = wb.createCellStyle();
|
CellStyle cellStyle = wb.createCellStyle();
|
||||||
// font.setFontHeight((short) (10 * 20));
|
|
||||||
// font.setFontName("宋体");
|
|
||||||
cellStyle.setBorderBottom(BorderStyle.THIN);
|
cellStyle.setBorderBottom(BorderStyle.THIN);
|
||||||
cellStyle.setBorderLeft(BorderStyle.THIN);
|
cellStyle.setBorderLeft(BorderStyle.THIN);
|
||||||
cellStyle.setBorderTop(BorderStyle.THIN);
|
cellStyle.setBorderTop(BorderStyle.THIN);
|
||||||
|
|
@ -1890,11 +1901,12 @@ public class OrderStatService {
|
||||||
row.createCell(20).setCellValue("融嘉合计");
|
row.createCell(20).setCellValue("融嘉合计");
|
||||||
row.createCell(22).setCellValue("盐港");
|
row.createCell(22).setCellValue("盐港");
|
||||||
row.createCell(24).setCellValue("永安");
|
row.createCell(24).setCellValue("永安");
|
||||||
row.createCell(26).setCellValue("盐港合计");
|
row.createCell(26).setCellValue("河东湾");
|
||||||
|
row.createCell(28).setCellValue("盐港合计");
|
||||||
|
|
||||||
row = sheet.createRow(1);
|
row = sheet.createRow(1);
|
||||||
num = 4;
|
num = 4;
|
||||||
for(int i=0;i<12;i++){
|
for(int i=0;i<13;i++){
|
||||||
row.createCell(num++).setCellValue("总销售量(吨)");
|
row.createCell(num++).setCellValue("总销售量(吨)");
|
||||||
row.createCell(num++).setCellValue("总销售额(元)");
|
row.createCell(num++).setCellValue("总销售额(元)");
|
||||||
}
|
}
|
||||||
|
|
@ -1929,6 +1941,8 @@ public class OrderStatService {
|
||||||
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "yg_xse"));
|
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "yg_xse"));
|
||||||
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "ya_xsl"));
|
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "ya_xsl"));
|
||||||
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "ya_xse"));
|
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "ya_xse"));
|
||||||
|
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "dhw_xsl"));
|
||||||
|
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "dhw_xse"));
|
||||||
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "yghj_xsl"));
|
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "yghj_xsl"));
|
||||||
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "yghj_xse"));
|
row.createCell(num++).setCellValue(DataUtil.getDefaultByRecord(sales, "yghj_xse"));
|
||||||
}
|
}
|
||||||
|
|
@ -1938,7 +1952,7 @@ public class OrderStatService {
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
row = sheet.createRow(r);
|
row = sheet.createRow(r);
|
||||||
}
|
}
|
||||||
for (int c = 0; c < 28; c++) {
|
for (int c = 0; c < 30; c++) {
|
||||||
Cell cell = row.getCell(c);
|
Cell cell = row.getCell(c);
|
||||||
|
|
||||||
if (cell == null) {
|
if (cell == null) {
|
||||||
|
|
@ -1954,302 +1968,82 @@ public class OrderStatService {
|
||||||
* 各砂站运输量统计表
|
* 各砂站运输量统计表
|
||||||
*/
|
*/
|
||||||
public List<Record> trafficStatisticsOfEachSandStation( String stm, String etm,Integer invoice_type){
|
public List<Record> trafficStatisticsOfEachSandStation( String stm, String etm,Integer invoice_type){
|
||||||
List<Record> dataList = new ArrayList<>();
|
List<Record> dataList = trafficStatistics(stm,etm,invoice_type);
|
||||||
//零散用户统计
|
if (dataList!=null&&!dataList.isEmpty()) {
|
||||||
Record scattered=scatteredUsersAreNotClassified(stm,etm,invoice_type);
|
for (Record oldRecord : dataList) {
|
||||||
if(scattered.getBigDecimal("weight").compareTo(new BigDecimal("0"))>0||scattered.getBigDecimal("total_price").compareTo(new BigDecimal("0"))>0){
|
Record newRecord =total(oldRecord);
|
||||||
Record scatteredSandStation=scatteredUsersClassificationStatistics(stm,etm,invoice_type);
|
oldRecord=newRecord;
|
||||||
scattered.setColumns(scatteredSandStation);
|
|
||||||
dataList.add(scattered);
|
|
||||||
}
|
|
||||||
//固定用户统计
|
|
||||||
List<Record> recordList = fixedUserUnclassified(stm,etm,invoice_type);
|
|
||||||
if(recordList!=null&&!recordList.isEmpty()){
|
|
||||||
for (Record record : recordList) {
|
|
||||||
if(record.getBigDecimal("weight").compareTo(new BigDecimal("0"))>0||record.getBigDecimal("total_price").compareTo(new BigDecimal("0"))>0){
|
|
||||||
Integer customer_id=record.getInt("customer_id");
|
|
||||||
Record sandStation=fixedUserClassificationStatistics(stm, etm,customer_id,invoice_type);
|
|
||||||
record.setColumns(sandStation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
dataList.addAll(recordList);
|
|
||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 零散用户
|
public List<Record> trafficStatistics(String stm, String etm,Integer invoice_type){
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 固定用户不分类统计:统计各个固定用户在所有砂站的销量和销售额
|
|
||||||
*/
|
|
||||||
public List<Record> fixedUserUnclassified(String stm, String etm,Integer invoice_type){
|
|
||||||
String paramsSql="";
|
String paramsSql="";
|
||||||
if(invoice_type!=null){
|
if(invoice_type!=null){
|
||||||
paramsSql="and t.invoice_type=?\n";
|
paramsSql="and t.invoice_type=?\n";
|
||||||
}
|
}
|
||||||
String sql="SELECT\n" +
|
String sql="select\n" +
|
||||||
"a.customer_name,\n" +
|
"\tg.customer_id,\n" +
|
||||||
" a.customer_id,\n" +
|
"\tifnull(c.name, '零散用户') customer_name,\n" +
|
||||||
"ifnull(sum( a.weight ),0) weight,\n" +
|
"\tifnull(sum(g.weight), 0) weight,\n" +
|
||||||
"ifnull(sum( a.total_price ),0) total_price\n" +
|
"\tifnull(sum(g.total_price), 0) total_price,\n" +
|
||||||
"FROM\n" +
|
"\tifnull(sum(case g.supermarket_id when 1 then g.weight end), 0) zw_xsl,\n" +
|
||||||
"(\n" +
|
"\tifnull(sum(case g.supermarket_id when 2 then g.weight end), 0) tp_xsl,\n" +
|
||||||
"SELECT\n" +
|
"\tifnull(sum(case g.supermarket_id when 3 then g.weight end), 0) sc_xsl,\n" +
|
||||||
"t.sn,t.customer_id,\n" +
|
"\tifnull(sum(case g.supermarket_id when 4 then g.weight end), 0) sb_xsl,\n" +
|
||||||
"t.customer_name,\n" +
|
"\tifnull(sum(case g.supermarket_id when 5 then g.weight end), 0) jr_xsl,\n" +
|
||||||
"t.weight,\n" +
|
"\tifnull(sum(case g.supermarket_id when 6 then g.weight end), 0) yg_xsl,\n" +
|
||||||
"t.total_price,\n" +
|
"\tifnull(sum(case g.supermarket_id when 7 then g.weight end), 0) zwsc_xsl,\n" +
|
||||||
"t.product_id,\n" +
|
"\tifnull(sum(case g.supermarket_id when 8 then g.weight end), 0) ya_xsl,\n" +
|
||||||
"t.product_name \n" +
|
"\tifnull(sum(case g.supermarket_id when 9 then g.weight end), 0) sl_xsl,\n" +
|
||||||
"FROM\n" +
|
"\tifnull(sum(case g.supermarket_id when 10 then g.weight end), 0) hdw_xsl,\n" +
|
||||||
"order_sale t \n" +
|
"\tifnull(sum(case g.supermarket_id when 1 then g.total_price end), 0) zw_xse,\n" +
|
||||||
"WHERE\n" +
|
"\tifnull(sum(case g.supermarket_id when 2 then g.total_price end), 0) tp_xse,\n" +
|
||||||
"t.state = 5 \n" +
|
"\tifnull(sum(case g.supermarket_id when 3 then g.total_price end), 0) sc_xse,\n" +
|
||||||
"AND t.create_time >=? \n" +
|
"\tifnull(sum(case g.supermarket_id when 4 then g.total_price end), 0) sb_xse,\n" +
|
||||||
"AND t.create_time <=? \n" +
|
"\tifnull(sum(case g.supermarket_id when 5 then g.total_price end), 0) jr_xse,\n" +
|
||||||
|
"\tifnull(sum(case g.supermarket_id when 6 then g.total_price end), 0) yg_xse,\n" +
|
||||||
|
"\tifnull(sum(case g.supermarket_id when 7 then g.total_price end), 0) zwsc_xse,\n" +
|
||||||
|
"\tifnull(sum(case g.supermarket_id when 8 then g.total_price end), 0) ya_xse,\n" +
|
||||||
|
"\tifnull(sum(case g.supermarket_id when 9 then g.total_price end), 0) sl_xse,\n" +
|
||||||
|
"\tifnull(sum(case g.supermarket_id when 10 then g.total_price end), 0) hdw_xse\n" +
|
||||||
|
"from (\n" +
|
||||||
|
"\n" +
|
||||||
|
"\tselect\n" +
|
||||||
|
"\t\tifnull(t.customer_id, 0) customer_id,\n" +
|
||||||
|
"\t\tt.supermarket_id,\n" +
|
||||||
|
"\t\tifnull(sum(t.weight), 0) weight,\n" +
|
||||||
|
"\t\tifnull(sum(t.total_price), 0) total_price\n" +
|
||||||
|
"\tfrom order_sale t\n" +
|
||||||
|
"\twhere t.state = 5\n" +
|
||||||
|
"\tand t.create_time>= ?\n" +
|
||||||
|
"\tand t.create_time<= ?\n" +
|
||||||
paramsSql+
|
paramsSql+
|
||||||
"AND t.isprepaid = 1 UNION\n" +
|
"\tgroup by t.customer_id, t.supermarket_id\n" +
|
||||||
"SELECT\n" +
|
"\tunion all\n" +
|
||||||
"t.sn,t.customer_id,\n" +
|
"\tselect\n" +
|
||||||
"t.customer_name,\n" +
|
"\t\tifnull(t.customer_id, 0) customer_id,\n" +
|
||||||
"t.weight,\n" +
|
"\t\tt.supermarket_id,\n" +
|
||||||
"t.total_price,\n" +
|
"\t\tifnull(sum(t.weight), 0) weight,\n" +
|
||||||
"t.product_id,\n" +
|
"\t\tifnull(sum(t.total_price), 0) total_price\n" +
|
||||||
"t.product_name \n" +
|
"\tfrom order_temp t\n" +
|
||||||
"FROM\n" +
|
"\twhere t.state = 5\n" +
|
||||||
"order_temp t \n" +
|
"\tand t.create_time>= ?\n" +
|
||||||
"WHERE\n" +
|
"\tand t.create_time<= ?\n" +
|
||||||
"t.state = 5 \n" +
|
|
||||||
"AND t.create_time >=? \n" +
|
|
||||||
"AND t.create_time <=? \n" +
|
|
||||||
paramsSql+
|
paramsSql+
|
||||||
"AND t.isprepaid = 1 \n" +
|
"\tgroup by t.customer_id, t.supermarket_id\n" +
|
||||||
") a\n" +
|
") g\n" +
|
||||||
" JOIN customer c ON c.id = a.customer_id \n" +
|
"left join customer c on c.id = g.customer_id\n" +
|
||||||
"GROUP BY\n" +
|
"group by g.customer_id";
|
||||||
"a.customer_id,a.customer_name";
|
|
||||||
|
|
||||||
List<Record> recordList;
|
List<Record> recordList;
|
||||||
if(invoice_type!=null) {
|
if(invoice_type!=null) {
|
||||||
recordList = Db.find(sql, stm,etm,invoice_type, stm,etm,invoice_type);
|
recordList = Db.find(sql, stm,etm,invoice_type, stm,etm,invoice_type);
|
||||||
}else {
|
}else {
|
||||||
recordList = Db.find(sql, stm,etm, stm,etm);
|
recordList = Db.find(sql, stm,etm, stm,etm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return recordList;
|
return recordList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 固定用户分类统计:统计各个固定用户在不同砂站的销量以及销售额
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Record fixedUserClassificationStatistics(String stm, String etm,Integer customer_id,Integer invoice_type){
|
|
||||||
String paramsSql="";
|
|
||||||
if(invoice_type!=null){
|
|
||||||
paramsSql="and t.invoice_type=?\n";
|
|
||||||
}
|
|
||||||
String sql="SELECT\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 1 THEN g.weight END ), 0.00 ) zw_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 1 THEN g.total_price END ), 0.00 ) zw_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 2 THEN g.weight END ), 0.00 ) tp_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 2 THEN g.total_price END ), 0.00 ) tp_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 3 THEN g.weight END ), 0.00 ) sc_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 3 THEN g.total_price END ), 0.00 ) sc_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 4 THEN g.weight END ), 0.00 ) sb_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 4 THEN g.total_price END ), 0.00 ) sb_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 5 THEN g.weight END ), 0.00 ) jr_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 5 THEN g.total_price END ), 0.00 ) jr_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 6 THEN g.weight END ), 0.00 ) yg_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 6 THEN g.total_price END ), 0.00 ) yg_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 7 THEN g.weight END ), 0.00 ) zwsc_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 7 THEN g.total_price END ), 0.00 ) zwsc_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 8 THEN g.weight END ), 0.00 ) ya_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 8 THEN g.total_price END ), 0.00 ) ya_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 9 THEN g.weight END ), 0.00 ) sl_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 9 THEN g.total_price END ), 0.00 ) sl_xse \n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"(\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"m.id,\n" +
|
|
||||||
"n.customer_id,\n" +
|
|
||||||
"IFNULL( n.weight, 0.00 ) weight,\n" +
|
|
||||||
"IFNULL( n.total_price, 0.00 ) total_price \n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"( SELECT id, NAME FROM supermarket ) m\n" +
|
|
||||||
"JOIN (\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"a.id,\n" +
|
|
||||||
"sum( a.weight ) weight,\n" +
|
|
||||||
"sum( a.total_price ) total_price,\n" +
|
|
||||||
"a.customer_id \n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"(\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"t.sn,t.supermarket_id AS id,\n" +
|
|
||||||
"t.customer_id,\n" +
|
|
||||||
"t.customer_name,\n" +
|
|
||||||
"t.weight,\n" +
|
|
||||||
"t.total_price,\n" +
|
|
||||||
"t.product_id,\n" +
|
|
||||||
"t.product_name \n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"order_sale t \n" +
|
|
||||||
"WHERE\n" +
|
|
||||||
"t.state = 5 \n" +
|
|
||||||
"AND t.create_time >=? \n" +
|
|
||||||
"AND t.create_time <=? \n" +
|
|
||||||
paramsSql+
|
|
||||||
"AND t.isprepaid = 1 UNION\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"t.sn,t.supermarket_id AS id,\n" +
|
|
||||||
"t.customer_id,\n" +
|
|
||||||
"t.customer_name,\n" +
|
|
||||||
"t.weight,\n" +
|
|
||||||
"t.total_price,\n" +
|
|
||||||
"t.product_id,\n" +
|
|
||||||
"t.product_name \n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"order_temp t \n" +
|
|
||||||
"WHERE\n" +
|
|
||||||
"t.state = 5 \n" +
|
|
||||||
"AND t.create_time >=? \n" +
|
|
||||||
"AND t.create_time <=? \n" +
|
|
||||||
paramsSql+
|
|
||||||
"AND t.isprepaid = 1 \n" +
|
|
||||||
") a\n" +
|
|
||||||
"JOIN customer c ON c.id = a.customer_id \n" +
|
|
||||||
"WHERE\n" +
|
|
||||||
"a.customer_id = ? \n" +
|
|
||||||
"GROUP BY\n" +
|
|
||||||
"a.id \n" +
|
|
||||||
") n ON m.id = n.id \n" +
|
|
||||||
") g \n" +
|
|
||||||
"GROUP BY\n" +
|
|
||||||
"g.customer_id";
|
|
||||||
Record record;
|
|
||||||
if(invoice_type!=null){
|
|
||||||
record = Db.findFirst(sql, stm,etm,invoice_type, stm,etm,invoice_type, customer_id);
|
|
||||||
}else {
|
|
||||||
record = Db.findFirst(sql, stm,etm, stm,etm, customer_id);
|
|
||||||
}
|
|
||||||
return total(record);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 零散用户不分类统计:统计所有零散用户在所有砂站的销量和销售额
|
|
||||||
*/
|
|
||||||
public Record scatteredUsersAreNotClassified(String stm, String etm,Integer invoice_type){
|
|
||||||
String paramsSql="";
|
|
||||||
if(invoice_type!=null){
|
|
||||||
paramsSql="and t.invoice_type=?\n";
|
|
||||||
}
|
|
||||||
String sql="SELECT '零散用户' customer_name, 0 customer_id,\n" +
|
|
||||||
"ifnull(sum( a.weight ),0) weight,\n" +
|
|
||||||
"ifnull(sum( a.total_price ),0) total_price\n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"(\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"t.sn,t.weight,\n" +
|
|
||||||
"t.total_price,\n" +
|
|
||||||
"t.product_id\n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"order_sale t \n" +
|
|
||||||
"WHERE\n" +
|
|
||||||
"t.state = 5 \n" +
|
|
||||||
"AND t.create_time >=?\n" +
|
|
||||||
"AND t.create_time <=?\n" +
|
|
||||||
paramsSql+
|
|
||||||
"AND t.isprepaid = 0 UNION\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"t.sn,t.weight,\n" +
|
|
||||||
"t.total_price,\n" +
|
|
||||||
"t.product_id\n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"order_temp t \n" +
|
|
||||||
"WHERE\n" +
|
|
||||||
"t.state = 5 \n" +
|
|
||||||
"AND t.create_time >=?\n" +
|
|
||||||
"AND t.create_time <=?\n" +
|
|
||||||
paramsSql+
|
|
||||||
"AND t.isprepaid = 0 \n" +
|
|
||||||
") a";
|
|
||||||
Record record;
|
|
||||||
if(invoice_type!=null){
|
|
||||||
record = Db.findFirst(sql, stm, etm,invoice_type, stm, etm,invoice_type);
|
|
||||||
}else {
|
|
||||||
record = Db.findFirst(sql, stm, etm, stm, etm);
|
|
||||||
}
|
|
||||||
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 零散用户分类统计:统计所有零散用户在各个沙场的销量和销售额
|
|
||||||
* @param stm
|
|
||||||
* @param etm
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Record scatteredUsersClassificationStatistics(String stm, String etm,Integer invoice_type){
|
|
||||||
String paramsSql="";
|
|
||||||
if(invoice_type!=null){
|
|
||||||
paramsSql="and t.invoice_type=?\n";
|
|
||||||
}
|
|
||||||
String sql="select \n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 1 THEN IFNULL( g.weight, 0 ) END ), 0 ) zw_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 1 THEN IFNULL( g.total_price, 0 ) END ), 0 ) zw_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 2 THEN IFNULL( g.weight, 0 ) END ), 0 ) tp_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 2 THEN IFNULL( g.total_price, 0 ) END ), 0 ) tp_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 3 THEN IFNULL( g.weight, 0 ) END ), 0 ) sc_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 3 THEN IFNULL( g.total_price, 0 ) END ), 0 ) sc_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 4 THEN IFNULL( g.weight, 0 ) END ), 0 ) sb_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 4 THEN IFNULL( g.total_price, 0 ) END ), 0 ) sb_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 5 THEN IFNULL( g.weight, 0 ) END ), 0 ) jr_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 5 THEN IFNULL( g.total_price, 0 ) END ), 0 ) jr_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 6 THEN IFNULL( g.weight, 0 ) END ), 0 ) yg_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 6 THEN IFNULL( g.total_price, 0 ) END ), 0 ) yg_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 7 THEN IFNULL( g.weight, 0 ) END ), 0 ) zwsc_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 7 THEN IFNULL( g.total_price, 0 ) END ), 0 ) zwsc_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 8 THEN IFNULL( g.weight, 0 ) END ), 0 ) ya_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 8 THEN IFNULL( g.total_price, 0 ) END ), 0 ) ya_xse,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 9 THEN IFNULL( g.weight, 0 ) END ), 0 ) sl_xsl,\n" +
|
|
||||||
"ifnull( sum( CASE g.id WHEN 9 THEN IFNULL( g.total_price, 0 ) END ), 0 ) sl_xse \n" +
|
|
||||||
" from (\n" +
|
|
||||||
"select m.id,n.weight,n.total_price from \n" +
|
|
||||||
"( SELECT id, NAME FROM supermarket ) m join \n" +
|
|
||||||
"(\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"t.sn,t.supermarket_id AS id,\n" +
|
|
||||||
"t.weight,\n" +
|
|
||||||
"t.total_price FROM\n" +
|
|
||||||
"order_sale t \n" +
|
|
||||||
"WHERE\n" +
|
|
||||||
"t.state = 5 \n" +
|
|
||||||
"AND t.create_time >=? \n" +
|
|
||||||
"AND t.create_time <=? \n" +
|
|
||||||
paramsSql+
|
|
||||||
"AND t.isprepaid = 0 UNION\n" +
|
|
||||||
"SELECT\n" +
|
|
||||||
"t.sn,t.supermarket_id AS id,\n" +
|
|
||||||
"t.weight,\n" +
|
|
||||||
"t.total_price\n" +
|
|
||||||
"FROM\n" +
|
|
||||||
"order_temp t \n" +
|
|
||||||
"WHERE\n" +
|
|
||||||
"t.state = 5 \n" +
|
|
||||||
"AND t.create_time >=? \n" +
|
|
||||||
"AND t.create_time <=? \n" +
|
|
||||||
paramsSql+
|
|
||||||
"AND t.isprepaid = 0 ) n on m.id=n.id\n" +
|
|
||||||
") g";
|
|
||||||
|
|
||||||
Record record;
|
|
||||||
if(invoice_type!=null) {
|
|
||||||
record = Db.findFirst(sql, stm,etm,invoice_type, stm,etm,invoice_type);
|
|
||||||
}else {
|
|
||||||
record = Db.findFirst(sql, stm,etm, stm,etm);
|
|
||||||
}
|
|
||||||
return total(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合计
|
* 合计
|
||||||
* @param record
|
* @param record
|
||||||
|
|
@ -2267,8 +2061,9 @@ public class OrderStatService {
|
||||||
record.set("jrhj_xsl",jrhj_xsl);
|
record.set("jrhj_xsl",jrhj_xsl);
|
||||||
record.set("jrhj_xse",jrhj_xse);
|
record.set("jrhj_xse",jrhj_xse);
|
||||||
//盐港合计
|
//盐港合计
|
||||||
BigDecimal yghj_xsl=new BigDecimal(record.getStr("yg_xsl")).add(new BigDecimal(record.getStr("ya_xsl")));
|
BigDecimal yghj_xsl=new BigDecimal(record.getStr("yg_xsl")).add(new BigDecimal(record.getStr("ya_xsl"))).add(new BigDecimal(record.getStr("hdw_xsl")));
|
||||||
BigDecimal yghj_xse=new BigDecimal(record.getStr("yg_xse")).add(new BigDecimal(record.getStr("ya_xse")));
|
BigDecimal yghj_xse=new BigDecimal(record.getStr("yg_xse")).add(new BigDecimal(record.getStr("ya_xse"))).add(new BigDecimal(record.getStr("hdw_xse")));
|
||||||
|
|
||||||
record.set("yghj_xsl",yghj_xsl);
|
record.set("yghj_xsl",yghj_xsl);
|
||||||
record.set("yghj_xse",yghj_xse);
|
record.set("yghj_xse",yghj_xse);
|
||||||
return record;
|
return record;
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ public class SupermarketService extends BaseService {
|
||||||
}
|
}
|
||||||
Record out = supermarket.toRecord();
|
Record out = supermarket.toRecord();
|
||||||
|
|
||||||
out.set("products", Db.find("select t.supermarket_id, p.id, p.name, t.unit_price from supermarket_product t\n" +
|
out.set("products", Db.find("select t.supermarket_id, p.id, p.name, t.unit_price,t.product_id from supermarket_product t\n" +
|
||||||
" left join product p on t.product_id = p.id \n" +
|
" left join product p on t.product_id = p.id \n" +
|
||||||
" where t.supermarket_id = ?", id));
|
" where t.supermarket_id = ?", id));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.cowr.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketInvalidVerify;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_invalid_verify
|
||||||
|
* Remarks: 结算单管理 - 结算单作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketInvalidVerifyPKValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateRequired("id", "id", "id 必填");
|
||||||
|
validateString("id", 1, 32, "id", "id 长度 1~32");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.cowr.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.Const;
|
||||||
|
import com.cowr.common.base.BaseService;
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.model.TicketInvalidVerify;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.Page;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_invalid_verify
|
||||||
|
* Remarks: 结算单管理 - 结算单作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketInvalidVerifyService extends BaseService {
|
||||||
|
public static final TicketInvalidVerifyService me = new TicketInvalidVerifyService();
|
||||||
|
|
||||||
|
public Page<Record> find(
|
||||||
|
PageParam pp,
|
||||||
|
String stm,
|
||||||
|
String etm,
|
||||||
|
String ticket_code,
|
||||||
|
String order_sn,
|
||||||
|
String create_user_name,
|
||||||
|
Integer supermarket_id,
|
||||||
|
Integer state
|
||||||
|
) {
|
||||||
|
String selectsql = "select t.*, s.name supermarket_name ";
|
||||||
|
String fromsql = "from ticket_invalid_verify t \n" +
|
||||||
|
" left join supermarket s on s.id = t.supermarket_id \n" +
|
||||||
|
" where 1=1 ";
|
||||||
|
List<Object> paraList = new ArrayList<>();
|
||||||
|
|
||||||
|
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 (StrKit.notBlank(ticket_code)) {
|
||||||
|
fromsql += " and t.ticket_code like ? \n";
|
||||||
|
paraList.add("%" + ticket_code.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(order_sn)) {
|
||||||
|
fromsql += " and t.order_sn like ? \n";
|
||||||
|
paraList.add("%" + order_sn.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(create_user_name)) {
|
||||||
|
fromsql += " and t.create_user_name like ? \n";
|
||||||
|
paraList.add("%" + create_user_name.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (supermarket_id != null) {
|
||||||
|
fromsql += " and t.supermarket_id = ? \n";
|
||||||
|
paraList.add(supermarket_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != null) {
|
||||||
|
fromsql += " and t.state = ? \n";
|
||||||
|
paraList.add(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
String totalRowSql = "select count(*) " + fromsql;
|
||||||
|
String findSql = selectsql + fromsql;
|
||||||
|
|
||||||
|
// 前端传了排序字段,并且排序字段存在相关表中
|
||||||
|
if (StrKit.notBlank(pp.getSort_field()) && TicketInvalidVerify.dao.hasColunm(pp.getSort_field())) {
|
||||||
|
findSql += " order by t." + pp.getSort_field() + " is null, t." + pp.getSort_field();
|
||||||
|
|
||||||
|
if (Const.ORDER_BY_ASC.equals(pp.getSort_order())) {
|
||||||
|
findSql += " " + Const.ORDER_BY_ASC;
|
||||||
|
} else {
|
||||||
|
findSql += " " + Const.ORDER_BY_DESC;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
findSql += " order by t.create_time desc ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.cowr.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketInvalidVerify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_invalid_verify
|
||||||
|
* Remarks: 结算单管理 - 结算单作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketInvalidVerifyValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateString("ticket_code", 1, 20, "ticket_code", "ticket_code 长度 1~20");
|
||||||
|
validateString("invalid_memo", 1, 255, "invalid_memo", "invalid_memo 长度 1~255");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.cowr.ssjygl.ticket.log;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketLog;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_log
|
||||||
|
* Remarks: 结算单管理 - 结算单使用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketLogPKValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateRequired("id", "id", "id 必填");
|
||||||
|
validateString("id", 1, 32, "id", "id 长度 1~32");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,258 @@
|
||||||
|
package com.cowr.ssjygl.ticket.log;
|
||||||
|
|
||||||
|
import com.cowr.common.Const;
|
||||||
|
import com.cowr.common.base.BaseService;
|
||||||
|
import com.cowr.common.enums.OrderStateEnum;
|
||||||
|
import com.cowr.common.utils.DataUtil;
|
||||||
|
import com.cowr.common.utils.DateTimeUtil;
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.model.TicketLog;
|
||||||
|
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.*;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_log
|
||||||
|
* Remarks: 结算单管理 - 结算单使用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketLogService extends BaseService {
|
||||||
|
public static final TicketLogService me = new TicketLogService();
|
||||||
|
|
||||||
|
public TicketLog checkUseTicketLog(String ticket_code) {
|
||||||
|
return TicketLog.dao.findFirst(
|
||||||
|
"select * from ticket_log t where t.ticket_code = ?",
|
||||||
|
ticket_code
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TicketLog checkInvalidTicketLog(String ticket_code) {
|
||||||
|
return TicketLog.dao.findFirst(
|
||||||
|
"select * from ticket_log t where t.state = ? and t.ticket_code = ?",
|
||||||
|
OrderStateEnum.INVALID.getStateid(),
|
||||||
|
ticket_code
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<Record> find(PageParam pp, Integer supermarket_id, Integer state, String order_sn, String stm, String etm, String ticket_code) {
|
||||||
|
String selectsql = "select t.*, r.supermarket_id, s.name supermarket_name, \n" +
|
||||||
|
" case when t.type = 1 then o.weight when t.type = 3 then p.weight end weight, \n" +
|
||||||
|
" case when t.type = 1 then o.total_price when t.type = 3 then p.total_price end total_price, \n" +
|
||||||
|
" case when t.type = 1 then o.create_time when t.type = 3 then p.create_time end create_time, \n" +
|
||||||
|
" case when t.type = 1 then o.settlement_user_name when t.type = 3 then p.settlement_user_name end settlement_user_name, \n" +
|
||||||
|
" case when t.type = 1 then o.customer_name when t.type = 3 then p.customer_name end customer_name ";
|
||||||
|
String fromsql = "from ticket_log t \n" +
|
||||||
|
" left join ticket_receive r on r.id = t.ticket_receive_id \n" +
|
||||||
|
" left join supermarket s on s.id = r.supermarket_id \n" +
|
||||||
|
" left join order_sale o on o.sn = t.order_sn \n" +
|
||||||
|
" left join order_temp p on p.sn = t.order_sn \n" +
|
||||||
|
" where 1=1 ";
|
||||||
|
List<Object> paraList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (supermarket_id != null) {
|
||||||
|
fromsql += " and r.supermarket_id = ? \n";
|
||||||
|
paraList.add(supermarket_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != null) {
|
||||||
|
fromsql += " and t.state = ? \n";
|
||||||
|
paraList.add(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(order_sn)) {
|
||||||
|
fromsql += " and t.order_sn like ? \n";
|
||||||
|
paraList.add("%" + order_sn.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (StrKit.notBlank(ticket_code)) {
|
||||||
|
fromsql += " and t.ticket_code like ? \n";
|
||||||
|
paraList.add("%" + ticket_code.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
String totalRowSql = "select count(*) " + fromsql;
|
||||||
|
String findSql = selectsql + fromsql;
|
||||||
|
|
||||||
|
// 前端传了排序字段,并且排序字段存在相关表中
|
||||||
|
if (StrKit.notBlank(pp.getSort_field()) && TicketLog.dao.hasColunm(pp.getSort_field())) {
|
||||||
|
findSql += " order by t." + pp.getSort_field() + " is null, t." + pp.getSort_field();
|
||||||
|
|
||||||
|
if (Const.ORDER_BY_ASC.equals(pp.getSort_order())) {
|
||||||
|
findSql += " " + Const.ORDER_BY_ASC;
|
||||||
|
} else {
|
||||||
|
findSql += " " + Const.ORDER_BY_DESC;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
findSql += " order by t.create_time desc";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Workbook export(Integer supermarket_id, Integer state, String order_sn, String stm, String etm, String ticket_code) {
|
||||||
|
String selectsql = "select t.*, r.supermarket_id, s.name supermarket_name, \n" +
|
||||||
|
" tr.first_weight, tr.second_weight, \n" +
|
||||||
|
" case when t.type = 1 then o.weight when t.type = 3 then p.weight end weight, \n" +
|
||||||
|
" case when t.type = 1 then o.total_price when t.type = 3 then p.total_price end total_price, \n" +
|
||||||
|
" case when t.type = 1 then o.create_time when t.type = 3 then p.create_time end order_create_time, \n" +
|
||||||
|
" case when t.type = 1 then o.settlement_user_name when t.type = 3 then p.settlement_user_name end settlement_user_name, \n" +
|
||||||
|
" case when t.type = 1 then o.truck_license when t.type = 3 then p.truck_license end truck_license, \n" +
|
||||||
|
" case when t.type = 1 then o.customer_texpayer_name when t.type = 3 then p.customer_texpayer_name end customer_texpayer_name, \n" +
|
||||||
|
" case when t.type = 1 then o.customer_texpayer_num when t.type = 3 then p.customer_texpayer_num end customer_texpayer_num, \n" +
|
||||||
|
" case when t.type = 1 then o.customer_name when t.type = 3 then p.customer_name end customer_name ";
|
||||||
|
String fromsql = "from ticket_log t \n" +
|
||||||
|
" left join ticket_receive r on r.id = t.ticket_receive_id \n" +
|
||||||
|
" left join supermarket s on s.id = r.supermarket_id \n" +
|
||||||
|
" left join order_sale o on o.sn = t.order_sn \n" +
|
||||||
|
" left join order_temp p on p.sn = t.order_sn \n" +
|
||||||
|
" left join transport tr on tr.order_sn = t.order_sn \n" +
|
||||||
|
" where 1=1 \n";
|
||||||
|
List<Object> paraList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (supermarket_id != null) {
|
||||||
|
fromsql += " and r.supermarket_id = ? \n";
|
||||||
|
paraList.add(supermarket_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != null) {
|
||||||
|
fromsql += " and t.state = ? \n";
|
||||||
|
paraList.add(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(order_sn)) {
|
||||||
|
fromsql += " and t.order_sn like ? \n";
|
||||||
|
paraList.add("%" + order_sn.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (StrKit.notBlank(ticket_code)) {
|
||||||
|
fromsql += " and t.ticket_code like ? \n";
|
||||||
|
paraList.add("%" + ticket_code.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
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("数量(吨)");
|
||||||
|
row.createCell(a++).setCellValue("皮重(吨)");
|
||||||
|
row.createCell(a++).setCellValue("毛重(吨)");
|
||||||
|
row.createCell(a++).setCellValue("备注");
|
||||||
|
// 表头 end
|
||||||
|
|
||||||
|
int end_col = 18;
|
||||||
|
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("ticket_code"));
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("invoice_number"));
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("invoice_code"));
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("customer_texpayer_name"));
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("customer_texpayer_num"));
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("order_sn"));
|
||||||
|
row.createCell(a++).setCellValue(DataUtil.getDefaultByRecord(order, "total_price"));
|
||||||
|
row.createCell(a++).setCellValue(DateTimeUtil.sdfhms.get().format(order.getDate("create_time")));
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("settlement_user_name"));
|
||||||
|
if (order.get("invalid_time") != null) {
|
||||||
|
row.createCell(a++).setCellValue(DateTimeUtil.sdfhms.get().format(order.getDate("invalid_time")));
|
||||||
|
} else {
|
||||||
|
row.createCell(a++).setCellValue("");
|
||||||
|
}
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("invalid_user_name"));
|
||||||
|
switch (order.getInt("state")) {
|
||||||
|
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("supermarket_name"));
|
||||||
|
row.createCell(a++).setCellValue(order.getStr("truck_license"));
|
||||||
|
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(order.getStr("invalid_memo"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通用单元格格式
|
||||||
|
Font font = wb.createFont();
|
||||||
|
CellStyle cellStyle = wb.createCellStyle();
|
||||||
|
font.setFontHeight((short) (10 * 20));
|
||||||
|
font.setFontName("宋体");
|
||||||
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||||
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||||
|
cellStyle.setFont(font);
|
||||||
|
|
||||||
|
// 设置通用单元格格式
|
||||||
|
for (int r = 0; r < datalen + 1; r++) {
|
||||||
|
row = sheet.getRow(r);
|
||||||
|
if (row == null) {
|
||||||
|
row = sheet.createRow(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int c = 0; c < end_col + 1; c++) {
|
||||||
|
Cell cell = row.getCell(c);
|
||||||
|
|
||||||
|
if (cell == null) {
|
||||||
|
cell = row.createCell(c);
|
||||||
|
}
|
||||||
|
cell.setCellStyle(cellStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return wb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.cowr.ssjygl.ticket.log;
|
||||||
|
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_log
|
||||||
|
* Remarks: 结算单管理 - 结算单使用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketLogValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
// 默认新增时,前端不需要传主键。若需要前端传主键,需要去掉这个判断
|
||||||
|
if (!"save".equals(getActionMethodName())) {
|
||||||
|
validateRequired("id", "id", "id 必填");
|
||||||
|
|
||||||
|
validateString("id", 1, 32, "id", "id 长度 1~32");
|
||||||
|
}
|
||||||
|
if (StrKit.notBlank(c.get("ticket_receive_id"))) { // 可为空字段,当传入值时,才做验证
|
||||||
|
validateInteger("ticket_receive_id", 1, 2147483647, "ticket_receive_id", "ticket_receive_id 范围 1~2147483647");
|
||||||
|
}
|
||||||
|
|
||||||
|
validateString("ticket_code", 1, 20, "ticket_code", "ticket_code 长度 1~20");
|
||||||
|
|
||||||
|
|
||||||
|
validateString("create_time", 0, 19, "create_time", "create_time 长度 0~19");
|
||||||
|
|
||||||
|
|
||||||
|
validateString("change_time", 0, 19, "change_time", "change_time 长度 0~19");
|
||||||
|
|
||||||
|
|
||||||
|
validateInteger("state", -999999, 999999, "state", "state 范围 -999999~999999");
|
||||||
|
|
||||||
|
|
||||||
|
validateString("settlement_time", 0, 19, "settlement_time", "settlement_time 长度 0~19");
|
||||||
|
|
||||||
|
validateDate("settlement_time", "yyyy-MM-dd HH:mm:ss", false, "settlement_time", "settlement_time 格式 yyyy-MM-dd HH:mm:ss"); // 默认时间时间字符串格式,生成后根据情况调整
|
||||||
|
if (StrKit.notBlank(c.get("settlement_user_id"))) { // 可为空字段,当传入值时,才做验证
|
||||||
|
validateInteger("settlement_user_id", 1, 2147483647, "settlement_user_id", "settlement_user_id 范围 1~2147483647");
|
||||||
|
}
|
||||||
|
|
||||||
|
validateString("settlement_user_name", 0, 255, "settlement_user_name", "settlement_user_name 长度 0~255");
|
||||||
|
|
||||||
|
|
||||||
|
validateString("invalid_time", 0, 19, "invalid_time", "invalid_time 长度 0~19");
|
||||||
|
|
||||||
|
validateDate("invalid_time", "yyyy-MM-dd HH:mm:ss", false, "invalid_time", "invalid_time 格式 yyyy-MM-dd HH:mm:ss"); // 默认时间时间字符串格式,生成后根据情况调整
|
||||||
|
if (StrKit.notBlank(c.get("invalid_user_id"))) { // 可为空字段,当传入值时,才做验证
|
||||||
|
validateInteger("invalid_user_id", 1, 2147483647, "invalid_user_id", "invalid_user_id 范围 1~2147483647");
|
||||||
|
}
|
||||||
|
|
||||||
|
validateString("invalid_user_name", 0, 255, "invalid_user_name", "invalid_user_name 长度 0~255");
|
||||||
|
|
||||||
|
|
||||||
|
validateString("invalid_memo", 0, 255, "invalid_memo", "invalid_memo 长度 0~255");
|
||||||
|
|
||||||
|
|
||||||
|
validateString("order_sn", 0, 16, "order_sn", "order_sn 长度 0~16");
|
||||||
|
|
||||||
|
if (StrKit.notBlank(c.get("type"))) { // 可为空字段,当传入值时,才做验证
|
||||||
|
validateInteger("type", -999999, 999999, "type", "type 范围 -999999~999999");
|
||||||
|
}
|
||||||
|
|
||||||
|
validateString("invoice_number", 0, 20, "invoice_number", "invoice_number 长度 0~20");
|
||||||
|
|
||||||
|
|
||||||
|
validateString("invoice_code", 0, 20, "invoice_code", "invoice_code 长度 0~20");
|
||||||
|
|
||||||
|
|
||||||
|
// 使用 model 更新时,model 不能只有主键有值
|
||||||
|
// 这里用 getActionMethodName 写死,判断是 update 时,才做验证
|
||||||
|
// 如果确实是需要将主键外的字段置为 null,可以在代码生成后删掉这段
|
||||||
|
if ("edit".equals(getActionMethodName())) {
|
||||||
|
validateUpdateModel(TicketLog.class, "", true); // 忽略不在model中的字段
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.cowr.ssjygl.ticket.receive;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketReceive;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_receive
|
||||||
|
* Remarks: 结算单管理 - 领用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketReceivePKValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateRequired("id", "id", "id 必填");
|
||||||
|
validateInteger("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,184 @@
|
||||||
|
package com.cowr.ssjygl.ticket.receive;
|
||||||
|
|
||||||
|
import com.cowr.common.Const;
|
||||||
|
import com.cowr.common.base.BaseService;
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.model.TicketLog;
|
||||||
|
import com.cowr.model.TicketReceive;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.Page;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_receive
|
||||||
|
* Remarks: 结算单管理 - 领用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketReceiveService extends BaseService {
|
||||||
|
private static final Log log = Log.getLog(TicketReceiveService.class);
|
||||||
|
public static final TicketReceiveService me = new TicketReceiveService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查结算单代码、结算单号码是否是领用过的,并且领用还没有被用完
|
||||||
|
*
|
||||||
|
* @param supermarket_id
|
||||||
|
* @param ticket_code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TicketReceive checkSurplusReceive(int supermarket_id, String ticket_code) {
|
||||||
|
if (!StrKit.notBlank(ticket_code)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long code = Long.parseLong(ticket_code);
|
||||||
|
|
||||||
|
String sql = "select * from ticket_receive t\n" +
|
||||||
|
" where t.supermarket_id = ? \n" +
|
||||||
|
" and t.surplus > 0 \n" +
|
||||||
|
" and cast(t.start_code as unsigned) <= ? \n" +
|
||||||
|
" and cast(t.end_code as unsigned) >= ? \n" +
|
||||||
|
" limit 1";
|
||||||
|
TicketReceive receive = TicketReceive.dao.findFirst(sql, supermarket_id, code, code);
|
||||||
|
|
||||||
|
return receive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TicketReceive checkReceive(int supermarket_id, String ticket_code) {
|
||||||
|
if (!StrKit.notBlank(ticket_code)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long code = Long.parseLong(ticket_code);
|
||||||
|
String sql = "select * from ticket_receive t\n" +
|
||||||
|
" where t.supermarket_id = ? \n" +
|
||||||
|
" and cast(t.start_code as unsigned) <= ? \n" +
|
||||||
|
" and cast(t.end_code as unsigned) >= ? \n" +
|
||||||
|
" limit 1";
|
||||||
|
|
||||||
|
TicketReceive receive = TicketReceive.dao.findFirst(sql, supermarket_id, code, code);
|
||||||
|
|
||||||
|
return receive;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getValidTicketCode(String next_ticket_code, Map<String, TicketLog> map) {
|
||||||
|
if (map.containsKey(next_ticket_code)) { // 说明下一个结算单号码已经作废,需要继续顺延
|
||||||
|
return getValidTicketCode(String.format("%0" + next_ticket_code.length() + "d", Long.parseLong(next_ticket_code) + 1), map);
|
||||||
|
} else {
|
||||||
|
return next_ticket_code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定砂站下一个可用的结算单号码
|
||||||
|
* TODO:要区分专票和普票
|
||||||
|
*
|
||||||
|
* @param supermarket_id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Record> nextTicketCodes(int supermarket_id) {
|
||||||
|
String sql = "select * from ticket_receive t\n" +
|
||||||
|
" where t.supermarket_id = ? \n" +
|
||||||
|
" and t.surplus > 0\n" +
|
||||||
|
" order by cast(t.start_code as unsigned) asc";
|
||||||
|
|
||||||
|
List<TicketReceive> receives = TicketReceive.dao.find(sql, supermarket_id);
|
||||||
|
|
||||||
|
if (receives.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Record> out = new ArrayList<>();
|
||||||
|
List<Object> params = new ArrayList<>();
|
||||||
|
List<String> sqlparams = new ArrayList<>();
|
||||||
|
|
||||||
|
for (TicketReceive receive : receives) {
|
||||||
|
params.add(receive.getId());
|
||||||
|
sqlparams.add("?");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sqlparams.isEmpty()) {
|
||||||
|
// 凡是有 ticket_log 记录的结算单都不能再用了
|
||||||
|
List<TicketLog> logs = TicketLog.dao.find("select * from ticket_log t where t.ticket_receive_id in(" + StrKit.join(sqlparams, ",") + ")", params.toArray());
|
||||||
|
|
||||||
|
Map<String, TicketLog> map = new HashMap<>();
|
||||||
|
|
||||||
|
for (TicketLog l : logs) {
|
||||||
|
map.put(l.getTicketCode(), l);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TicketReceive receive : receives) {
|
||||||
|
Record record = receive.toRecord();
|
||||||
|
|
||||||
|
String next_ticket_code = receive.getCurrentCode() == null ? receive.getStartCode() : receive.getCurrentCode();
|
||||||
|
next_ticket_code = getValidTicketCode(next_ticket_code, map);
|
||||||
|
|
||||||
|
if (Long.parseLong(next_ticket_code) > Long.parseLong(receive.getEndCode())) {
|
||||||
|
log.debug("顺延后的 next_ticket_code 超过了 end_code %s %s", receive.getId(), next_ticket_code);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
record.set("next_ticket_code", next_ticket_code);
|
||||||
|
|
||||||
|
out.add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<Record> find(PageParam pp, Integer supermarket_id, String reveiver_user_name, String stm, String etm) {
|
||||||
|
String selectsql = "select t.*, s.name supermarket_name, s.name2 supermarket_name2 ";
|
||||||
|
String fromsql = "from ticket_receive t \n" +
|
||||||
|
" left join supermarket s on s.id = t.supermarket_id" +
|
||||||
|
" where 1=1 ";
|
||||||
|
List<Object> paraList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (supermarket_id != null) {
|
||||||
|
fromsql += " and t.supermarket_id = ? \n";
|
||||||
|
paraList.add(supermarket_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(reveiver_user_name)) {
|
||||||
|
fromsql += " and t.receive_user_name like ? \n";
|
||||||
|
paraList.add("%" + reveiver_user_name.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
String totalRowSql = "select count(*) " + fromsql;
|
||||||
|
String findSql = selectsql + fromsql;
|
||||||
|
|
||||||
|
// 前端传了排序字段,并且排序字段存在相关表中
|
||||||
|
if (StrKit.notBlank(pp.getSort_field()) && TicketReceive.dao.hasColunm(pp.getSort_field())) {
|
||||||
|
findSql += " order by t." + pp.getSort_field() + " is null, t." + pp.getSort_field();
|
||||||
|
|
||||||
|
if (Const.ORDER_BY_ASC.equals(pp.getSort_order())) {
|
||||||
|
findSql += " " + Const.ORDER_BY_ASC;
|
||||||
|
} else {
|
||||||
|
findSql += " " + Const.ORDER_BY_DESC;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
findSql += " order by t.create_time desc";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.cowr.ssjygl.ticket.receive;
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketReceive;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Fri Feb 26 16:03:36 CST 2021
|
||||||
|
* TableName: ticket_receive
|
||||||
|
* Remarks: 结算单管理 - 领用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketReceiveValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
// 默认新增时,前端不需要传主键。若需要前端传主键,需要去掉这个判断
|
||||||
|
if (!"save".equals(getActionMethodName())) {
|
||||||
|
validateRequired("id", "id", "id 必填");
|
||||||
|
|
||||||
|
validateInteger("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||||
|
}
|
||||||
|
|
||||||
|
validateString("start_code", 1, 20, "start_code", "start_code 长度 1~20");
|
||||||
|
validateString("end_code", 1, 20, "end_code", "end_code 长度 1~20");
|
||||||
|
validateInteger("receive_user_id", 1, 2147483647, "receive_user_id", "receive_user_id 范围 1~2147483647");
|
||||||
|
validateInteger("supermarket_id", 1, 2147483647, "supermarket_id", "supermarket_id 范围 1~2147483647");
|
||||||
|
|
||||||
|
if (StrKit.notBlank(c.get("start_code"), c.get("end_code"))) {
|
||||||
|
if (c.getInt("end_code") - c.getInt("start_code") < 0) {
|
||||||
|
addError("end_code", "end_code 必须大于等于 start_code");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 model 更新时,model 不能只有主键有值
|
||||||
|
// 这里用 getActionMethodName 写死,判断是 update 时,才做验证
|
||||||
|
// 如果确实是需要将主键外的字段置为 null,可以在代码生成后删掉这段
|
||||||
|
if ("edit".equals(getActionMethodName())) {
|
||||||
|
validateUpdateModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -79,6 +79,10 @@ public class Main {
|
||||||
"invoice_invalid_verify",
|
"invoice_invalid_verify",
|
||||||
"order_invalid_verify",
|
"order_invalid_verify",
|
||||||
"sms_notice_contact",
|
"sms_notice_contact",
|
||||||
|
|
||||||
|
"ticket_invalid_verify",
|
||||||
|
"ticket_log",
|
||||||
|
"ticket_receive",
|
||||||
};
|
};
|
||||||
|
|
||||||
PropKit.use("db.properties");
|
PropKit.use("db.properties");
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.cowr.common.base.BaseService;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import #(modelPackageName).#(tableMeta.modelName);
|
import #(modelPackageName).#(tableMeta.modelName);
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
import com.jfinal.plugin.activerecord.Page;
|
import com.jfinal.plugin.activerecord.Page;
|
||||||
import com.jfinal.plugin.activerecord.Record;
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
@ -18,6 +19,7 @@ import java.util.List;
|
||||||
* PrimaryKey: #(tableMeta.primaryKey)
|
* PrimaryKey: #(tableMeta.primaryKey)
|
||||||
*/
|
*/
|
||||||
public class #(tableMeta.modelName)#(suffix) extends BaseService {
|
public class #(tableMeta.modelName)#(suffix) extends BaseService {
|
||||||
|
private static final Log log = Log.getLog(#(tableMeta.modelName)Service.class);
|
||||||
public static final #(tableMeta.modelName)Service me = new #(tableMeta.modelName)Service();
|
public static final #(tableMeta.modelName)Service me = new #(tableMeta.modelName)Service();
|
||||||
|
|
||||||
public Page<Record> find(PageParam pp) {
|
public Page<Record> find(PageParam pp) {
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,9 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
receive.setCurrentCode(receive.getEndCode());
|
receive.setCurrentCode(receive.getEndCode());
|
||||||
} else {
|
} else {
|
||||||
if (code.equals(receive.getStartCode())) { // 作废第一张发票
|
if (code.equals(receive.getStartCode())) { // 作废第一张发票
|
||||||
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getStartCode()) + 1));
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getStartCode()) + 1));
|
||||||
} else if (code.equals(receive.getCurrentCode())) { // 作废顺延的下一张发票
|
} else if (code.equals(receive.getCurrentCode())) { // 作废顺延的下一张发票
|
||||||
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getCurrentCode()) + 1));
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getCurrentCode()) + 1));
|
||||||
} else {
|
} else {
|
||||||
// 其他情况下不更新 current_code
|
// 其他情况下不更新 current_code
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,31 @@ package com.cowr.local.ssjygl.main;
|
||||||
|
|
||||||
import com.alibaba.druid.filter.stat.StatFilter;
|
import com.alibaba.druid.filter.stat.StatFilter;
|
||||||
import com.alibaba.druid.wall.WallFilter;
|
import com.alibaba.druid.wall.WallFilter;
|
||||||
|
import com.cowr.common.Interceptor.ReporterInterceptor;
|
||||||
import com.cowr.common.ctrl.HomeController;
|
import com.cowr.common.ctrl.HomeController;
|
||||||
|
import com.cowr.common.handler.GlobalHandler;
|
||||||
import com.cowr.common.oss.OSSKit;
|
import com.cowr.common.oss.OSSKit;
|
||||||
import com.cowr.local.ssjygl.customer.pact.CustomerPactController;
|
import com.cowr.common.plugin.QuartzPlugin;
|
||||||
import com.cowr.local.ssjygl.customer.supermarketproduct.CustomerSupermarketProductController;
|
import com.cowr.common.view.JsonRenderFactory;
|
||||||
import com.cowr.local.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyController;
|
|
||||||
import com.cowr.local.ssjygl.order.invalidverify.OrderInvalidVerifyController;
|
|
||||||
import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController;
|
|
||||||
import com.cowr.local.ssjygl.authlicense.AuthLicenseController;
|
import com.cowr.local.ssjygl.authlicense.AuthLicenseController;
|
||||||
import com.cowr.local.ssjygl.authlicense.AuthLicenseSyncService;
|
import com.cowr.local.ssjygl.authlicense.AuthLicenseSyncService;
|
||||||
import com.cowr.local.ssjygl.blacklist.BlacklistController;
|
import com.cowr.local.ssjygl.blacklist.BlacklistController;
|
||||||
import com.cowr.local.ssjygl.cache.CacheController;
|
import com.cowr.local.ssjygl.cache.CacheController;
|
||||||
import com.cowr.local.ssjygl.customer.CustomerController;
|
import com.cowr.local.ssjygl.customer.CustomerController;
|
||||||
import com.cowr.local.ssjygl.customer.contact.CustomerContactController;
|
import com.cowr.local.ssjygl.customer.contact.CustomerContactController;
|
||||||
|
import com.cowr.local.ssjygl.customer.pact.CustomerPactController;
|
||||||
import com.cowr.local.ssjygl.customer.receiver.CustomerReceiverController;
|
import com.cowr.local.ssjygl.customer.receiver.CustomerReceiverController;
|
||||||
|
import com.cowr.local.ssjygl.customer.supermarketproduct.CustomerSupermarketProductController;
|
||||||
import com.cowr.local.ssjygl.devicectrl.common.Const;
|
import com.cowr.local.ssjygl.devicectrl.common.Const;
|
||||||
import com.cowr.local.ssjygl.devicectrl.common.DeviceThread;
|
import com.cowr.local.ssjygl.devicectrl.common.DeviceThread;
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.CameraController;
|
import com.cowr.local.ssjygl.devicectrl.device.CameraController;
|
||||||
import com.cowr.local.ssjygl.driver.DriverController;
|
import com.cowr.local.ssjygl.driver.DriverController;
|
||||||
|
import com.cowr.local.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyController;
|
||||||
import com.cowr.local.ssjygl.invoice.log.InvoiceLogController;
|
import com.cowr.local.ssjygl.invoice.log.InvoiceLogController;
|
||||||
import com.cowr.local.ssjygl.invoice.receive.InvoiceReceiveController;
|
import com.cowr.local.ssjygl.invoice.receive.InvoiceReceiveController;
|
||||||
import com.cowr.local.ssjygl.netty.NettyClient;
|
import com.cowr.local.ssjygl.netty.NettyClient;
|
||||||
import com.cowr.local.ssjygl.netty.SocketIOService;
|
import com.cowr.local.ssjygl.netty.SocketIOService;
|
||||||
|
import com.cowr.local.ssjygl.order.invalidverify.OrderInvalidVerifyController;
|
||||||
import com.cowr.local.ssjygl.order.ordercluster.OrderclusterController;
|
import com.cowr.local.ssjygl.order.ordercluster.OrderclusterController;
|
||||||
import com.cowr.local.ssjygl.order.ordercluster.truck.OrderclusterTruckController;
|
import com.cowr.local.ssjygl.order.ordercluster.truck.OrderclusterTruckController;
|
||||||
import com.cowr.local.ssjygl.order.orderpurchase.OrderPurchaseController;
|
import com.cowr.local.ssjygl.order.orderpurchase.OrderPurchaseController;
|
||||||
|
|
@ -31,6 +34,8 @@ import com.cowr.local.ssjygl.order.ordersale.OrderSaleController;
|
||||||
import com.cowr.local.ssjygl.order.ordertemp.OrderTempController;
|
import com.cowr.local.ssjygl.order.ordertemp.OrderTempController;
|
||||||
import com.cowr.local.ssjygl.order.ordertransfer.OrderTransferController;
|
import com.cowr.local.ssjygl.order.ordertransfer.OrderTransferController;
|
||||||
import com.cowr.local.ssjygl.order.ordertrash.OrderTrashController;
|
import com.cowr.local.ssjygl.order.ordertrash.OrderTrashController;
|
||||||
|
import com.cowr.local.ssjygl.overall.OverallController;
|
||||||
|
import com.cowr.local.ssjygl.prepay.PrepayController;
|
||||||
import com.cowr.local.ssjygl.prepay.prepaydetail.PrepayDetailController;
|
import com.cowr.local.ssjygl.prepay.prepaydetail.PrepayDetailController;
|
||||||
import com.cowr.local.ssjygl.prepay.prepaytruck.PrepayTruckController;
|
import com.cowr.local.ssjygl.prepay.prepaytruck.PrepayTruckController;
|
||||||
import com.cowr.local.ssjygl.prepay.refunddetail.RefundDetailController;
|
import com.cowr.local.ssjygl.prepay.refunddetail.RefundDetailController;
|
||||||
|
|
@ -38,6 +43,7 @@ import com.cowr.local.ssjygl.product.ProductController;
|
||||||
import com.cowr.local.ssjygl.purchase.PurchaseController;
|
import com.cowr.local.ssjygl.purchase.PurchaseController;
|
||||||
import com.cowr.local.ssjygl.sandfarm.SandfarmController;
|
import com.cowr.local.ssjygl.sandfarm.SandfarmController;
|
||||||
import com.cowr.local.ssjygl.sms.log.SmsLogController;
|
import com.cowr.local.ssjygl.sms.log.SmsLogController;
|
||||||
|
import com.cowr.local.ssjygl.stat.sale.OrderStatController;
|
||||||
import com.cowr.local.ssjygl.supermarket.SupermarketController;
|
import com.cowr.local.ssjygl.supermarket.SupermarketController;
|
||||||
import com.cowr.local.ssjygl.supermarket.customerdistance.SupermarketCustomerDistanceController;
|
import com.cowr.local.ssjygl.supermarket.customerdistance.SupermarketCustomerDistanceController;
|
||||||
import com.cowr.local.ssjygl.supermarket.receiverdistance.SupermarketReceiverDistanceController;
|
import com.cowr.local.ssjygl.supermarket.receiverdistance.SupermarketReceiverDistanceController;
|
||||||
|
|
@ -45,13 +51,18 @@ import com.cowr.local.ssjygl.supermarket.sandfarmdistance.SupermarketSandfarmDis
|
||||||
import com.cowr.local.ssjygl.supermarket.stock.StockController;
|
import com.cowr.local.ssjygl.supermarket.stock.StockController;
|
||||||
import com.cowr.local.ssjygl.supermarket.stock.StockSyncService;
|
import com.cowr.local.ssjygl.supermarket.stock.StockSyncService;
|
||||||
import com.cowr.local.ssjygl.synctask.SyncTaskService;
|
import com.cowr.local.ssjygl.synctask.SyncTaskService;
|
||||||
import com.cowr.common.plugin.QuartzPlugin;
|
import com.cowr.local.ssjygl.system.sysuser.SysuserController;
|
||||||
|
import com.cowr.local.ssjygl.ticket.invalidverify.TicketInvalidVerifyController;
|
||||||
|
import com.cowr.local.ssjygl.ticket.log.TicketLogController;
|
||||||
|
import com.cowr.local.ssjygl.ticket.receive.TicketReceiveController;
|
||||||
import com.cowr.local.ssjygl.transport.TransportController;
|
import com.cowr.local.ssjygl.transport.TransportController;
|
||||||
import com.cowr.local.ssjygl.transport.TransportQueryController;
|
import com.cowr.local.ssjygl.transport.TransportQueryController;
|
||||||
import com.cowr.local.ssjygl.transportcompany.TransportCompanyController;
|
import com.cowr.local.ssjygl.transportcompany.TransportCompanyController;
|
||||||
import com.cowr.local.ssjygl.truck.TruckController;
|
import com.cowr.local.ssjygl.truck.TruckController;
|
||||||
import com.cowr.model.Supermarket;
|
import com.cowr.model.Supermarket;
|
||||||
|
import com.cowr.model._MappingKit;
|
||||||
import com.cowr.ssjygl.CacheData;
|
import com.cowr.ssjygl.CacheData;
|
||||||
|
import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController;
|
||||||
import com.cowr.ssjygl.cctv.CctvController;
|
import com.cowr.ssjygl.cctv.CctvController;
|
||||||
import com.cowr.local.ssjygl.prepay.PrepayController;
|
import com.cowr.local.ssjygl.prepay.PrepayController;
|
||||||
import com.cowr.local.ssjygl.overall.OverallController;
|
import com.cowr.local.ssjygl.overall.OverallController;
|
||||||
|
|
@ -128,7 +139,7 @@ public class Config extends JFinalConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPropConfig() {
|
private void initPropConfig() {
|
||||||
dbprop = PropKit.use(ENV + "/db.properties");
|
dbprop = PropKit.use(ENV + "/db.properties", "UTF-8");
|
||||||
configprop = PropKit.use(ENV + "/config.properties", "UTF-8");
|
configprop = PropKit.use(ENV + "/config.properties", "UTF-8");
|
||||||
|
|
||||||
CacheData.print_vendor = configprop.get("print.vendor");
|
CacheData.print_vendor = configprop.get("print.vendor");
|
||||||
|
|
@ -233,6 +244,11 @@ public class Config extends JFinalConfig {
|
||||||
me.add("/invoice/receive", InvoiceReceiveController.class);
|
me.add("/invoice/receive", InvoiceReceiveController.class);
|
||||||
me.add("/invoice/invalidverify", InvoiceInvalidVerifyController.class);
|
me.add("/invoice/invalidverify", InvoiceInvalidVerifyController.class);
|
||||||
|
|
||||||
|
// -- 结算单管理
|
||||||
|
me.add("/ticket/log", TicketLogController.class);
|
||||||
|
me.add("/ticket/receive", TicketReceiveController.class);
|
||||||
|
me.add("/ticket/invalidverify", TicketInvalidVerifyController.class);
|
||||||
|
|
||||||
// -- 日志
|
// -- 日志
|
||||||
me.add("/log/sms", SmsLogController.class);
|
me.add("/log/sms", SmsLogController.class);
|
||||||
me.add("/log/actioncmd", ActionCmdLogController.class);
|
me.add("/log/actioncmd", ActionCmdLogController.class);
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,14 @@ package com.cowr.local.ssjygl.main;
|
||||||
import com.jfinal.kit.PathKit;
|
import com.jfinal.kit.PathKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
import com.jfinal.server.undertow.UndertowServer;
|
import com.jfinal.server.undertow.UndertowServer;
|
||||||
|
import io.undertow.server.HandlerWrapper;
|
||||||
|
import io.undertow.server.HttpHandler;
|
||||||
|
import io.undertow.server.handlers.DisallowedMethodsHandler;
|
||||||
|
import io.undertow.servlet.api.DeploymentInfo;
|
||||||
|
import io.undertow.util.HttpString;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static Log log = Log.getLog(Main.class);
|
private static Log log = Log.getLog(Main.class);
|
||||||
|
|
@ -47,7 +53,19 @@ public class Main {
|
||||||
UndertowServer
|
UndertowServer
|
||||||
.create(Config.class, Config.ENV + "/undertow.txt")
|
.create(Config.class, Config.ENV + "/undertow.txt")
|
||||||
.addHotSwapClassPrefix("com.cowr.")
|
.addHotSwapClassPrefix("com.cowr.")
|
||||||
.start();
|
.onDeploy(new BiConsumer<ClassLoader, DeploymentInfo>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ClassLoader classLoader, DeploymentInfo deploymentInfo) {
|
||||||
|
deploymentInfo.addInitialHandlerChainWrapper(new HandlerWrapper() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpHandler wrap(HttpHandler handler) {
|
||||||
|
HttpString[] disallowedHttpMethods = {HttpString.tryFromString("TRACE"), HttpString.tryFromString("TRACK")};
|
||||||
|
return new DisallowedMethodsHandler(handler, disallowedHttpMethods);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,11 @@ public class OrderTempController extends BaseController {
|
||||||
Integer supermarket_id = getInt("supermarket_id");
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
Integer isprepaid = getInt("isprepaid");
|
Integer isprepaid = getInt("isprepaid");
|
||||||
String invoice_code = get("invoice_code");
|
String invoice_code = get("invoice_code");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
Integer invoice_type = getInt("invoice_type");
|
Integer invoice_type = getInt("invoice_type");
|
||||||
Integer customer_id = getInt("customer_id");
|
Integer customer_id = getInt("customer_id");
|
||||||
Boolean invoice_code_is_null = getBoolean("invoice_code_is_null");
|
Boolean invoice_code_is_null = getBoolean("invoice_code_is_null");
|
||||||
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)));
|
renderJson(Result.object(OrderTempService.me.find(pp, sn, truck_license, supermarket_id, customer_id, customer_name, stm, etm, isprepaid, state, invoice_code, invoice_type, ticket_code, product_id, invoice_code_is_null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before(StartAndEndIntervalValidator.class)
|
@Before(StartAndEndIntervalValidator.class)
|
||||||
|
|
@ -81,12 +82,13 @@ public class OrderTempController extends BaseController {
|
||||||
Integer product_id = getInt("product_id");
|
Integer product_id = getInt("product_id");
|
||||||
String invoice_number = get("invoice_number");
|
String invoice_number = get("invoice_number");
|
||||||
String invoice_code = get("invoice_code");
|
String invoice_code = get("invoice_code");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
Integer pay_type = getInt("pay_type");
|
Integer pay_type = getInt("pay_type");
|
||||||
String memo = get("memo");
|
String memo = get("memo");
|
||||||
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
||||||
int req_receipt = getInt("req_receipt", 0); // 是否需要发票,0 默认不需要,1需要
|
int req_receipt = getInt("req_receipt", 0); // 是否需要发票,0 默认不需要,1需要
|
||||||
|
|
||||||
renderJson(OrderTempSyncService.me.pay(uuid, transport_id, product_id, invoice_number, invoice_code, pay_type, memo, printer, tokenuser, req_receipt));
|
renderJson(OrderTempSyncService.me.pay(uuid, transport_id, product_id, invoice_number, invoice_code, ticket_code, pay_type, memo, printer, tokenuser, req_receipt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -104,11 +106,12 @@ public class OrderTempController extends BaseController {
|
||||||
Integer ordercluster_id = getInt("ordercluster_id");
|
Integer ordercluster_id = getInt("ordercluster_id");
|
||||||
String invoice_number = get("invoice_number");
|
String invoice_number = get("invoice_number");
|
||||||
String invoice_code = get("invoice_code");
|
String invoice_code = get("invoice_code");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
String memo = get("memo");
|
String memo = get("memo");
|
||||||
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
||||||
// int req_receipt = getInt("req_receipt", 0); // 是否需要发票,0 默认不需要,1需要
|
// int req_receipt = getInt("req_receipt", 0); // 是否需要发票,0 默认不需要,1需要
|
||||||
|
|
||||||
renderJson(OrderTempSyncService.me.payordercluster(uuid, transport_id, ordercluster_id, invoice_number, invoice_code, memo, printer, tokenuser));
|
renderJson(OrderTempSyncService.me.payordercluster(uuid, transport_id, ordercluster_id, invoice_number, invoice_code, ticket_code, memo, printer, tokenuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before(OrderTempPrepayValidator.class)
|
@Before(OrderTempPrepayValidator.class)
|
||||||
|
|
@ -125,12 +128,13 @@ public class OrderTempController extends BaseController {
|
||||||
Integer ordercluster_id = getInt("ordercluster_id");
|
Integer ordercluster_id = getInt("ordercluster_id");
|
||||||
String invoice_number = get("invoice_number");
|
String invoice_number = get("invoice_number");
|
||||||
String invoice_code = get("invoice_code");
|
String invoice_code = get("invoice_code");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
Integer product_id = getInt("product_id");
|
Integer product_id = getInt("product_id");
|
||||||
String memo = get("memo");
|
String memo = get("memo");
|
||||||
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
||||||
int req_receipt = getInt("req_receipt", 0); // 是否需要发票,0 默认不需要,1需要
|
int req_receipt = getInt("req_receipt", 0); // 是否需要发票,0 默认不需要,1需要
|
||||||
|
|
||||||
renderJson(OrderTempSyncService.me.prepay(uuid, transport_id, ordercluster_id, invoice_number, invoice_code, product_id, memo, printer, tokenuser, req_receipt));
|
renderJson(OrderTempSyncService.me.prepay(uuid, transport_id, ordercluster_id, invoice_number, invoice_code, ticket_code, product_id, memo, printer, tokenuser, req_receipt));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before(SnValidator.class)
|
@Before(SnValidator.class)
|
||||||
|
|
@ -155,6 +159,26 @@ public class OrderTempController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Before(SnValidator.class)
|
||||||
|
public void ticket() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String sn = get("sn");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
String printer = get("printer", Enums.PrinterIdEnum.printer1.name());
|
||||||
|
|
||||||
|
if (Integer.parseInt(sn.substring(10, 12)) != OrderTypeEnum.TEMP.getTypeid()) {
|
||||||
|
renderJson(Result.failed("sn 不能为 null"));
|
||||||
|
} else {
|
||||||
|
renderJson(OrderTempSyncService.me.ticket(sn, ticket_code, printer, tokenuser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Before(SnValidator.class)
|
@Before(SnValidator.class)
|
||||||
public void print() {
|
public void print() {
|
||||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,19 @@ import com.cowr.common.view.Result;
|
||||||
import com.cowr.local.ssjygl.actioncmdlog.ActionCmdLogSyncService;
|
import com.cowr.local.ssjygl.actioncmdlog.ActionCmdLogSyncService;
|
||||||
import com.cowr.local.ssjygl.main.CliCacheData;
|
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||||
import com.cowr.local.ssjygl.main.Config;
|
import com.cowr.local.ssjygl.main.Config;
|
||||||
|
import com.cowr.local.ssjygl.modifylog.ModifyLogSyncService;
|
||||||
import com.cowr.local.ssjygl.order.LocalOrderService;
|
import com.cowr.local.ssjygl.order.LocalOrderService;
|
||||||
import com.cowr.local.ssjygl.order.orderseq.OrderSeqService;
|
import com.cowr.local.ssjygl.order.orderseq.OrderSeqService;
|
||||||
|
import com.cowr.local.ssjygl.synctask.SyncTaskService;
|
||||||
|
import com.cowr.model.*;
|
||||||
import com.cowr.ssjygl.invoice.log.InvoiceLogService;
|
import com.cowr.ssjygl.invoice.log.InvoiceLogService;
|
||||||
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
||||||
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||||
import com.cowr.ssjygl.prepay.refunddetail.RefundDetailService;
|
import com.cowr.ssjygl.prepay.refunddetail.RefundDetailService;
|
||||||
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
||||||
import com.cowr.local.ssjygl.synctask.SyncTaskService;
|
|
||||||
import com.cowr.model.*;
|
|
||||||
import com.cowr.local.ssjygl.modifylog.ModifyLogSyncService;
|
|
||||||
import com.cowr.ssjygl.prepay.prepaycustomer.PrepayCustomerService;
|
import com.cowr.ssjygl.prepay.prepaycustomer.PrepayCustomerService;
|
||||||
|
import com.cowr.ssjygl.ticket.log.TicketLogService;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
import com.cowr.ssjygl.transprice.TransPriceService;
|
import com.cowr.ssjygl.transprice.TransPriceService;
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
|
|
@ -40,6 +42,7 @@ public class OrderTempSyncService {
|
||||||
Integer product_id,
|
Integer product_id,
|
||||||
String invoice_number,
|
String invoice_number,
|
||||||
String invoice_code,
|
String invoice_code,
|
||||||
|
String ticket_code,
|
||||||
Integer pay_type,
|
Integer pay_type,
|
||||||
String memo,
|
String memo,
|
||||||
String printerId,
|
String printerId,
|
||||||
|
|
@ -56,16 +59,6 @@ public class OrderTempSyncService {
|
||||||
return Result.failed("进出场记录已完结或者已作废,不能使用");
|
return Result.failed("进出场记录已完结或者已作废,不能使用");
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceReceive receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
|
||||||
if (receive == null) {
|
|
||||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
InvoiceLog invoiceLog = InvoiceLogService.me.checkUseInvoiceLog(invoice_number, invoice_code);
|
|
||||||
if (invoiceLog != null) {
|
|
||||||
return Result.failedstr("发票 %s|%s 已使用!重新打开结算界面,获取新的发票信息。", invoice_number, invoice_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
Product product = Product.dao.findById(product_id);
|
Product product = Product.dao.findById(product_id);
|
||||||
|
|
||||||
if (product == null) {
|
if (product == null) {
|
||||||
|
|
@ -105,9 +98,43 @@ public class OrderTempSyncService {
|
||||||
|
|
||||||
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次
|
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次
|
||||||
|
|
||||||
|
InvoiceReceive receive = null;
|
||||||
|
TicketReceive ticketReceive = null;
|
||||||
|
|
||||||
if (req_receipt == 1) { // 需要同时开具发票
|
if (req_receipt == 1) { // 需要同时开具发票
|
||||||
|
receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceLog invoiceLog = InvoiceLogService.me.checkUseInvoiceLog(invoice_number, invoice_code);
|
||||||
|
if (invoiceLog != null) {
|
||||||
|
return Result.failedstr("发票 %s|%s 已使用!重新打开结算界面,获取新的发票信息。", invoice_number, invoice_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
receive.setCurrentCode(invoice_code);
|
||||||
|
|
||||||
order.setInvoiceCode(invoice_code);
|
order.setInvoiceCode(invoice_code);
|
||||||
order.setInvoiceNumber(invoice_number);
|
order.setInvoiceNumber(invoice_number);
|
||||||
|
order.setInvoiceType(1);
|
||||||
|
} else {
|
||||||
|
// 不开发票的,必须使用结算单
|
||||||
|
ticketReceive = TicketReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), ticket_code);
|
||||||
|
if (ticketReceive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者结算单已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLogService.me.checkUseTicketLog(ticket_code);
|
||||||
|
if (ticketLog != null) {
|
||||||
|
return Result.failedstr("结算单 %s 已使用", ticket_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
ticketReceive.setSurplus(ticketReceive.getSurplus() - 1);
|
||||||
|
ticketReceive.setCurrentCode(ticket_code);
|
||||||
|
|
||||||
|
order.setTicketCode(ticket_code);
|
||||||
|
order.setInvoiceType(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
order.setTransportId(transport.getId());
|
order.setTransportId(transport.getId());
|
||||||
|
|
@ -143,6 +170,8 @@ public class OrderTempSyncService {
|
||||||
transport.setState(order.getState()); // 使用 order 的 state
|
transport.setState(order.getState()); // 使用 order 的 state
|
||||||
transport.setType(OrderTypeEnum.TEMP.getTypeid());
|
transport.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
|
InvoiceReceive finalReceive = receive;
|
||||||
|
TicketReceive finalTicketReceive = ticketReceive;
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
|
|
@ -181,12 +210,9 @@ public class OrderTempSyncService {
|
||||||
synctask.addUpdateData(stock);
|
synctask.addUpdateData(stock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (req_receipt == 1) { // 需要同时开具发票
|
if (req_receipt == 1) { // 需要同时开具发票
|
||||||
// 这里的 finalReceive 在前面肯定验证过了
|
// 这里的 finalReceive 在前面肯定验证过了
|
||||||
receive.setSurplus(receive.getSurplus() - 1);
|
ret = finalReceive.update();
|
||||||
receive.setCurrentCode(invoice_code);
|
|
||||||
|
|
||||||
ret = receive.update();
|
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
log.error("发票领用信息更新失败", invoice_code);
|
log.error("发票领用信息更新失败", invoice_code);
|
||||||
|
|
@ -195,7 +221,7 @@ public class OrderTempSyncService {
|
||||||
|
|
||||||
InvoiceLog invoiceLog = new InvoiceLog();
|
InvoiceLog invoiceLog = new InvoiceLog();
|
||||||
invoiceLog.setId(StrKit.getRandomUUID());
|
invoiceLog.setId(StrKit.getRandomUUID());
|
||||||
invoiceLog.setInvoiceReceiveId(receive.getId());
|
invoiceLog.setInvoiceReceiveId(finalReceive.getId());
|
||||||
invoiceLog.setCode(invoice_code);
|
invoiceLog.setCode(invoice_code);
|
||||||
invoiceLog.setInvoiceNumber(invoice_number);
|
invoiceLog.setInvoiceNumber(invoice_number);
|
||||||
invoiceLog.setState(OrderStateEnum.RECEIVED.getStateid());
|
invoiceLog.setState(OrderStateEnum.RECEIVED.getStateid());
|
||||||
|
|
@ -212,8 +238,36 @@ public class OrderTempSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
synctask.addSaveData(invoiceLog);
|
synctask.addSaveData(invoiceLog);
|
||||||
synctask.addUpdateData(receive);
|
synctask.addUpdateData(finalReceive);
|
||||||
// }
|
} else {
|
||||||
|
// 不开发票的,要开结算单
|
||||||
|
ret = finalTicketReceive.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
log.error("结算单领用信息更新失败", ticket_code);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = new TicketLog();
|
||||||
|
ticketLog.setId(StrKit.getRandomUUID());
|
||||||
|
ticketLog.setTicketReceiveId(finalTicketReceive.getId());
|
||||||
|
ticketLog.setTicketCode(ticket_code);
|
||||||
|
ticketLog.setState(OrderStateEnum.RECEIVED.getStateid());
|
||||||
|
ticketLog.setSettlementTime(now);
|
||||||
|
ticketLog.setSettlementUserId(order.getSettlementUserId());
|
||||||
|
ticketLog.setSettlementUserName(order.getSettlementUserName());
|
||||||
|
ticketLog.setOrderSn(order.getSn());
|
||||||
|
ticketLog.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
|
ret = ticketLog.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addSaveData(ticketLog);
|
||||||
|
synctask.addUpdateData(finalTicketReceive);
|
||||||
|
}
|
||||||
|
|
||||||
synctask.addUpdateData(transport);
|
synctask.addUpdateData(transport);
|
||||||
synctask.addSaveData(order);
|
synctask.addSaveData(order);
|
||||||
|
|
@ -244,6 +298,7 @@ public class OrderTempSyncService {
|
||||||
Integer ordercluster_id,
|
Integer ordercluster_id,
|
||||||
String invoice_number,
|
String invoice_number,
|
||||||
String invoice_code,
|
String invoice_code,
|
||||||
|
String ticket_code,
|
||||||
String memo,
|
String memo,
|
||||||
String printerId,
|
String printerId,
|
||||||
Sysuser sysuser
|
Sysuser sysuser
|
||||||
|
|
@ -313,6 +368,7 @@ public class OrderTempSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceReceive receive = null;
|
InvoiceReceive receive = null;
|
||||||
|
TicketReceive ticketReceive = null;
|
||||||
|
|
||||||
// 零散客户需要开具发票的,需要检查是否有有效的领用记录
|
// 零散客户需要开具发票的,需要检查是否有有效的领用记录
|
||||||
if (ordercluster.getReqReceipt() == 1) {
|
if (ordercluster.getReqReceipt() == 1) {
|
||||||
|
|
@ -335,6 +391,20 @@ public class OrderTempSyncService {
|
||||||
|
|
||||||
order.setInvoiceType(1); // 需要开发票的,都是冠名发票
|
order.setInvoiceType(1); // 需要开发票的,都是冠名发票
|
||||||
} else {
|
} else {
|
||||||
|
// 不开发票的,必须使用结算单
|
||||||
|
ticketReceive = TicketReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), ticket_code);
|
||||||
|
if (ticketReceive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者结算单已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLogService.me.checkUseTicketLog(ticket_code);
|
||||||
|
if (ticketLog != null) {
|
||||||
|
return Result.failedstr("结算单 %s 已使用", ticket_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
ticketReceive.setSurplus(ticketReceive.getSurplus() - 1);
|
||||||
|
ticketReceive.setCurrentCode(ticket_code);
|
||||||
|
order.setTicketCode(ticket_code);
|
||||||
order.setInvoiceType(2); // 不需要开发票的,都是要专票的
|
order.setInvoiceType(2); // 不需要开发票的,都是要专票的
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -428,6 +498,7 @@ public class OrderTempSyncService {
|
||||||
transport.setType(OrderTypeEnum.TEMP.getTypeid());
|
transport.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
InvoiceReceive finalReceive = receive;
|
InvoiceReceive finalReceive = receive;
|
||||||
|
TicketReceive finalTicketReceive = ticketReceive;
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
|
|
@ -508,6 +579,34 @@ public class OrderTempSyncService {
|
||||||
|
|
||||||
synctask.addSaveData(invoiceLog);
|
synctask.addSaveData(invoiceLog);
|
||||||
synctask.addUpdateData(finalReceive);
|
synctask.addUpdateData(finalReceive);
|
||||||
|
} else {
|
||||||
|
// 不开发票的,要开结算单
|
||||||
|
ret = finalTicketReceive.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
log.error("结算单领用信息更新失败", ticket_code);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = new TicketLog();
|
||||||
|
ticketLog.setId(StrKit.getRandomUUID());
|
||||||
|
ticketLog.setTicketReceiveId(finalTicketReceive.getId());
|
||||||
|
ticketLog.setTicketCode(ticket_code);
|
||||||
|
ticketLog.setState(OrderStateEnum.RECEIVED.getStateid());
|
||||||
|
ticketLog.setSettlementTime(now);
|
||||||
|
ticketLog.setSettlementUserId(order.getSettlementUserId());
|
||||||
|
ticketLog.setSettlementUserName(order.getSettlementUserName());
|
||||||
|
ticketLog.setOrderSn(order.getSn());
|
||||||
|
ticketLog.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
|
ret = ticketLog.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addSaveData(ticketLog);
|
||||||
|
synctask.addUpdateData(finalTicketReceive);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在这里更新sn字段之后存入
|
// 在这里更新sn字段之后存入
|
||||||
|
|
@ -536,6 +635,7 @@ public class OrderTempSyncService {
|
||||||
Integer ordercluster_id,
|
Integer ordercluster_id,
|
||||||
String invoice_number,
|
String invoice_number,
|
||||||
String invoice_code,
|
String invoice_code,
|
||||||
|
String ticket_code,
|
||||||
Integer product_id,
|
Integer product_id,
|
||||||
String memo,
|
String memo,
|
||||||
String printerId,
|
String printerId,
|
||||||
|
|
@ -633,13 +733,11 @@ public class OrderTempSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceReceive receive = null;
|
InvoiceReceive receive = null;
|
||||||
|
TicketReceive ticketReceive = null;
|
||||||
|
|
||||||
// 2020-09-29 需要开具专票的,先开具结算单,不打发票
|
// 2020-09-29 需要开具专票的,先开具结算单,不打发票
|
||||||
// 2020-10-12 所有砂站都可以开结算单
|
// 2020-10-12 所有砂站都可以开结算单
|
||||||
if (customer.getInvoiceType() == 2) {
|
if (customer.getInvoiceType() == 1) {
|
||||||
order.setInvoiceType(2);
|
|
||||||
// 需要专票的,在结算开了专票之后,再修改 invoice_site 字段
|
|
||||||
} else {
|
|
||||||
receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||||
if (receive == null) {
|
if (receive == null) {
|
||||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
|
|
@ -650,6 +748,9 @@ public class OrderTempSyncService {
|
||||||
return Result.failedstr("发票 %s|%s 已使用!重新打开结算界面,获取新的发票信息。", invoice_number, invoice_code);
|
return Result.failedstr("发票 %s|%s 已使用!重新打开结算界面,获取新的发票信息。", invoice_number, invoice_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
receive.setCurrentCode(invoice_code);
|
||||||
|
|
||||||
// 不满足开专票的条件的,就必须开具冠名发票
|
// 不满足开专票的条件的,就必须开具冠名发票
|
||||||
// if (req_receipt == 1) { // 需要同时开具发票
|
// if (req_receipt == 1) { // 需要同时开具发票
|
||||||
order.setInvoiceCode(invoice_code);
|
order.setInvoiceCode(invoice_code);
|
||||||
|
|
@ -657,6 +758,23 @@ public class OrderTempSyncService {
|
||||||
order.setInvoiceType(1);
|
order.setInvoiceType(1);
|
||||||
order.setInvoiceSite(1); // 在砂站开具冠名发票
|
order.setInvoiceSite(1); // 在砂站开具冠名发票
|
||||||
// }
|
// }
|
||||||
|
} else {
|
||||||
|
// 需要专票的,在结算开了专票之后,再修改 invoice_site 字段
|
||||||
|
// 不开冠名发票的,必须使用结算单
|
||||||
|
ticketReceive = TicketReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), ticket_code);
|
||||||
|
if (ticketReceive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者结算单已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLogService.me.checkUseTicketLog(ticket_code);
|
||||||
|
if (ticketLog != null) {
|
||||||
|
return Result.failedstr("结算单 %s 已使用", ticket_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
ticketReceive.setSurplus(ticketReceive.getSurplus() - 1);
|
||||||
|
ticketReceive.setCurrentCode(ticket_code);
|
||||||
|
order.setTicketCode(ticket_code);
|
||||||
|
order.setInvoiceType(2); // 不需要开发票的,都是要专票的
|
||||||
}
|
}
|
||||||
|
|
||||||
Product product = Product.dao.findById(ordercluster.getProductId());
|
Product product = Product.dao.findById(ordercluster.getProductId());
|
||||||
|
|
@ -740,6 +858,7 @@ public class OrderTempSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceReceive finalReceive = receive;
|
InvoiceReceive finalReceive = receive;
|
||||||
|
TicketReceive finalTicketReceive = ticketReceive;
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
|
|
@ -815,12 +934,10 @@ public class OrderTempSyncService {
|
||||||
synctask.addUpdateData(stock);
|
synctask.addUpdateData(stock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalReceive != null) {
|
// if (finalReceive != null) {
|
||||||
|
if (customer.getInvoiceType() == 1) {
|
||||||
// if (req_receipt == 1) { // 需要同时开具发票
|
// if (req_receipt == 1) { // 需要同时开具发票
|
||||||
// 这里的 finalReceive 在前面肯定验证过了
|
// 这里的 finalReceive 在前面肯定验证过了
|
||||||
finalReceive.setSurplus(finalReceive.getSurplus() - 1);
|
|
||||||
finalReceive.setCurrentCode(invoice_code);
|
|
||||||
|
|
||||||
ret = finalReceive.update();
|
ret = finalReceive.update();
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
@ -848,6 +965,34 @@ public class OrderTempSyncService {
|
||||||
|
|
||||||
synctask.addSaveData(invoiceLog);
|
synctask.addSaveData(invoiceLog);
|
||||||
synctask.addUpdateData(finalReceive);
|
synctask.addUpdateData(finalReceive);
|
||||||
|
} else {
|
||||||
|
// 不开发票的,要开结算单
|
||||||
|
ret = finalTicketReceive.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
log.error("结算单领用信息更新失败", ticket_code);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = new TicketLog();
|
||||||
|
ticketLog.setId(StrKit.getRandomUUID());
|
||||||
|
ticketLog.setTicketReceiveId(finalTicketReceive.getId());
|
||||||
|
ticketLog.setTicketCode(ticket_code);
|
||||||
|
ticketLog.setState(OrderStateEnum.RECEIVED.getStateid());
|
||||||
|
ticketLog.setSettlementTime(now);
|
||||||
|
ticketLog.setSettlementUserId(order.getSettlementUserId());
|
||||||
|
ticketLog.setSettlementUserName(order.getSettlementUserName());
|
||||||
|
ticketLog.setOrderSn(order.getSn());
|
||||||
|
ticketLog.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
|
ret = ticketLog.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addSaveData(ticketLog);
|
||||||
|
synctask.addUpdateData(finalTicketReceive);
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
@ -871,6 +1016,15 @@ public class OrderTempSyncService {
|
||||||
return LocalOrderService.me.orderPayComplete(ret, order.toRecord(), transport, printerId);
|
return LocalOrderService.me.orderPayComplete(ret, order.toRecord(), transport, printerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 再次开具冠名发票
|
||||||
|
* @param sn
|
||||||
|
* @param invoice_number
|
||||||
|
* @param invoice_code
|
||||||
|
* @param printerId
|
||||||
|
* @param sysuser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Result invoice(String sn, String invoice_number, String invoice_code, String printerId, Sysuser sysuser) {
|
public Result invoice(String sn, String invoice_number, String invoice_code, String printerId, Sysuser sysuser) {
|
||||||
// TODO: 判断权限
|
// TODO: 判断权限
|
||||||
|
|
||||||
|
|
@ -997,4 +1151,141 @@ public class OrderTempSyncService {
|
||||||
|
|
||||||
return Result.failed("开票失败");
|
return Result.failed("开票失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 再次开具结算单
|
||||||
|
* @param sn
|
||||||
|
* @param ticket_code
|
||||||
|
* @param printerId
|
||||||
|
* @param sysuser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Result ticket(String sn, String ticket_code, String printerId, Sysuser sysuser) {
|
||||||
|
// TODO: 判断权限
|
||||||
|
|
||||||
|
OrderTemp order = OrderTemp.dao.findById(sn);
|
||||||
|
|
||||||
|
if (order == null) {
|
||||||
|
return Result.failedstr("按订单号【%s】未找到记录", sn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(order.getInvoiceType() != 2){
|
||||||
|
return Result.failed("需要专票的订单才用结算单");
|
||||||
|
}
|
||||||
|
|
||||||
|
int orderstate = order.getState();
|
||||||
|
|
||||||
|
if (orderstate == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return Result.failed("订单已经取消");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(order.getTicketCode())) {
|
||||||
|
return Result.failedstr("请先将已开具的结算单[%s]取消", order.getTicketCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketReceive receive = TicketReceiveService.me.checkSurplusReceive(order.getSupermarketId(), ticket_code);
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者结算单已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLogService.me.checkUseTicketLog(ticket_code);
|
||||||
|
if (ticketLog != null) {
|
||||||
|
return Result.failedstr("结算单 %s 已使用", ticket_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
order.setTicketCode(ticket_code);
|
||||||
|
|
||||||
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
receive.setCurrentCode(ticket_code);
|
||||||
|
|
||||||
|
Record logrecord = new Record();
|
||||||
|
logrecord.set("sn", sn);
|
||||||
|
logrecord.set("ticket", ticket_code);
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = order.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = receive.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
log.error("结算单领用信息更新失败", ticket_code);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = new TicketLog();
|
||||||
|
ticketLog.setId(StrKit.getRandomUUID());
|
||||||
|
ticketLog.setTicketReceiveId(receive.getId());
|
||||||
|
ticketLog.setTicketCode(ticket_code);
|
||||||
|
ticketLog.setState(OrderStateEnum.RECEIVED.getStateid());
|
||||||
|
ticketLog.setSettlementTime(new Date());
|
||||||
|
ticketLog.setSettlementUserId(order.getSettlementUserId());
|
||||||
|
ticketLog.setSettlementUserName(order.getSettlementUserName());
|
||||||
|
ticketLog.setOrderSn(order.getSn());
|
||||||
|
ticketLog.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
|
ret = ticketLog.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addUpdateData(order);
|
||||||
|
synctask.addSaveData(ticketLog);
|
||||||
|
synctask.addUpdateData(receive);
|
||||||
|
|
||||||
|
return ret && SyncTaskService.me.save(synctask)
|
||||||
|
&& ModifyLogSyncService.me.save(order.tablename, "sn", logrecord.toJson(), Enums.DataOpType.UPDATE.getId(), sysuser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
// 数据库保存成功后,立即推送到服务端,及时更新发票使用信息
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
|
||||||
|
Transport transport = Transport.dao.findById(order.get("transport_id"));
|
||||||
|
|
||||||
|
if (transport == null) {
|
||||||
|
return Result.failed("运输记录不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
Record printdata = order.toRecord();
|
||||||
|
printdata.set("first_weight", transport.getFirstWeight());
|
||||||
|
printdata.set("second_weight", transport.getSecondWeight());
|
||||||
|
|
||||||
|
Record cmd = new Record();
|
||||||
|
cmd.set("cmd", "print");
|
||||||
|
cmd.set("sn", sn);
|
||||||
|
cmd.set("printer", printerId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Config.deviceThread.print(printerId, LocalOrderService.me.getPrintFile(printdata));
|
||||||
|
cmd.set("status", true);
|
||||||
|
|
||||||
|
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
cmd.set("status", false);
|
||||||
|
|
||||||
|
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
||||||
|
return Result.success("开票成功,打印指令失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.success("开票成功,打印指令已发送");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.failed("开票失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,11 +151,11 @@ public class OrderStatController extends BaseController {
|
||||||
public void mdstat() {
|
public void mdstat() {
|
||||||
String tm = get("tm");
|
String tm = get("tm");
|
||||||
int export = getInt("export", 0);
|
int export = getInt("export", 0);
|
||||||
|
Integer supermarket_id=getInt("supermarket_id");
|
||||||
if (export == 0) {
|
if (export == 0) {
|
||||||
renderJson(Result.object(OrderStatService.me.mdstat(tm)));
|
renderJson(Result.object(OrderStatService.me.mdstat(tm,supermarket_id)));
|
||||||
} else {
|
} else {
|
||||||
Workbook wb = OrderStatService.me.mdstatExport(tm);
|
Workbook wb = OrderStatService.me.mdstatExport(tm,supermarket_id);
|
||||||
render(new ExcelRender(tm + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
render(new ExcelRender(tm + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,17 @@ public class SysuserSyncService extends BaseService {
|
||||||
return roleid.equals(RoleEnum.TRANCOADMIN.getRoleid());
|
return roleid.equals(RoleEnum.TRANCOADMIN.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否财务经理
|
||||||
|
* 预付费审批、退费审批
|
||||||
|
* @param roleid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isFinanceManager(Integer roleid){
|
||||||
|
if (roleid == null) return false;
|
||||||
|
return roleid.equals(RoleEnum.FINANCEMANAGER.getRoleid());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是司机
|
* 是否是司机
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.cowr.local.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.local.ssjygl.system.sysuser.SysuserSyncService;
|
||||||
|
import com.cowr.model.Sysuser;
|
||||||
|
import com.cowr.model.TicketInvalidVerify;
|
||||||
|
import com.cowr.ssjygl.invoice.invalidverify.InvoiceInvalidBySnVerifyValidator;
|
||||||
|
import com.cowr.ssjygl.ticket.invalidverify.TicketInvalidVerifyService;
|
||||||
|
import com.cowr.ssjygl.ticket.invalidverify.TicketInvalidVerifyValidator;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
public class TicketInvalidVerifyController extends Controller {
|
||||||
|
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
String order_sn = get("order_sn");
|
||||||
|
String create_user_name = get("create_user_name");
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
Integer state = getInt("state");
|
||||||
|
|
||||||
|
renderJson(Result.object(TicketInvalidVerifyService.me.find(pp, stm, etm, ticket_code, order_sn, create_user_name, supermarket_id, state)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before(TicketInvalidVerifyValidator.class)
|
||||||
|
public void save() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketInvalidVerify model = getModel(TicketInvalidVerify.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketInvalidVerifySyncService.me.save(model, tokenuser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增 invoice_invalid_verify 发票管理 - 发票作废申请
|
||||||
|
*/
|
||||||
|
@Before(InvoiceInvalidBySnVerifyValidator.class)
|
||||||
|
public void saveBySn() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String order_sn = get("order_sn");
|
||||||
|
String invalid_memo = get("invalid_memo");
|
||||||
|
|
||||||
|
renderJson(TicketInvalidVerifySyncService.me.save(order_sn, invalid_memo, tokenuser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
package com.cowr.local.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.enums.OrderStateEnum;
|
||||||
|
import com.cowr.common.enums.OrderTypeEnum;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||||
|
import com.cowr.local.ssjygl.synctask.SyncTaskService;
|
||||||
|
import com.cowr.model.*;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TicketInvalidVerifySyncService {
|
||||||
|
private static final Log log = Log.getLog(TicketInvalidVerifySyncService.class);
|
||||||
|
public static TicketInvalidVerifySyncService me = new TicketInvalidVerifySyncService();
|
||||||
|
|
||||||
|
public Result save(String order_sn, String invalid_memo, Sysuser sysuser) {
|
||||||
|
OrderTemp order = OrderTemp.dao.findById(order_sn);
|
||||||
|
|
||||||
|
if (order == null) {
|
||||||
|
return Result.failedstr("按 %s 没有找到订单信息", order_sn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (order.getInvoiceType() == 2 && order.getInvoiceCode() != null) {
|
||||||
|
return Result.failed("已经开专票的结算单不能取消");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketReceive receive = TicketReceiveService.me.checkReceive(CliCacheData.SUP.getId(), order.getTicketCode());
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者订单没有开具有效的结算单");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketInvalidVerify old = TicketInvalidVerify.dao.findFirst(
|
||||||
|
"select * from ticket_invalid_verify t where t.order_sn = ? and t.state = 1 limit 1", order_sn);
|
||||||
|
|
||||||
|
if (old != null) {
|
||||||
|
return Result.failedstr("订单 %s 已提交申请", order_sn);
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketInvalidVerify model = new TicketInvalidVerify();
|
||||||
|
model.setId(StrKit.getRandomUUID());
|
||||||
|
model.setSupermarketId(CliCacheData.SUP.getId());
|
||||||
|
model.setCreateTime(new Date());
|
||||||
|
model.setCreateUserId(sysuser.getId());
|
||||||
|
model.setCreateUserName(sysuser.getName());
|
||||||
|
model.setTicketReceiveId(receive.getId());
|
||||||
|
model.setOrderSn(order.getSn());
|
||||||
|
model.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
|
model.setInvalidMemo(invalid_memo);
|
||||||
|
model.setTicketCode(order.getTicketCode());
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = model.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addSaveData(model);
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret ? Result.success(model) : Result.failed("保存失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result save(TicketInvalidVerify model, Sysuser sysuser) {
|
||||||
|
TicketInvalidVerify old = TicketInvalidVerify.dao.findFirst(
|
||||||
|
"select * from ticket_invalid_verify t \n" +
|
||||||
|
" where t.ticket_code = ? \n" +
|
||||||
|
" and t.state = 1 " +
|
||||||
|
" limit 1", model.getTicketCode());
|
||||||
|
|
||||||
|
if (old != null) {
|
||||||
|
return Result.failedstr("结算单 %s 已提交申请", model.getTicketCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先判断这张结算单有没有被领用
|
||||||
|
TicketReceive receive = TicketReceiveService.me.checkReceive(CliCacheData.SUP.getId(), model.getTicketCode());
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者结算单已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLog.dao.findFirst("select * from ticket_log t \n" +
|
||||||
|
" where t.ticket_code = ? limit 1 ", model.getTicketCode());
|
||||||
|
|
||||||
|
if (ticketLog != null) {
|
||||||
|
// 再判断这张结算单是不是已经被取消了
|
||||||
|
if (ticketLog.getState() == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return Result.failed("结算单已作废");
|
||||||
|
} else {
|
||||||
|
// 还要判断这张结算单已经在订单上使用了
|
||||||
|
return Result.failed("结算单已使用,请使用“取消结算单”功能");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model.setId(StrKit.getRandomUUID());
|
||||||
|
model.setSupermarketId(CliCacheData.SUP.getId());
|
||||||
|
model.setCreateTime(new Date());
|
||||||
|
model.setCreateUserId(sysuser.getId());
|
||||||
|
model.setCreateUserName(sysuser.getName());
|
||||||
|
model.setTicketReceiveId(receive.getId());
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = model.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addSaveData(model);
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret ? Result.success(model) : Result.failed("保存失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.cowr.local.ssjygl.ticket.log;
|
||||||
|
|
||||||
|
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.system.sysuser.SysuserSyncService;
|
||||||
|
import com.cowr.model.Sysuser;
|
||||||
|
import com.cowr.model.TicketLog;
|
||||||
|
import com.cowr.ssjygl.ticket.log.TicketLogPKValidator;
|
||||||
|
import com.cowr.ssjygl.ticket.log.TicketLogService;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
|
||||||
|
public class TicketLogController extends Controller {
|
||||||
|
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
Integer state = getInt("state");
|
||||||
|
String order_sn = get("order_sn");
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
renderJson(Result.object(TicketLogService.me.find(pp, supermarket_id, state, order_sn, stm, etm, ticket_code)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before(StartAndEndIntervalValidator.class)
|
||||||
|
public void export() {
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
Integer state = getInt("state");
|
||||||
|
String order_sn = get("order_sn");
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
|
||||||
|
Workbook wb = TicketLogService.me.export(supermarket_id, state, order_sn, stm, etm, ticket_code);
|
||||||
|
|
||||||
|
render(new ExcelRender("结算单使用日志_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查找单个对象 invoice_log 结算单管理 - 结算单使用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketLogPKValidator.class)
|
||||||
|
public void get() {
|
||||||
|
TicketLog model = getModel(TicketLog.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketLogService.me.findByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void invalid() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer supermarket_id = getInt("supermarket_id", 0);
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
String invalid_memo = get("invalid_memo");
|
||||||
|
|
||||||
|
renderJson(TicketLogSyncService.me.invalid(supermarket_id, ticket_code, invalid_memo, tokenuser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.cowr.local.ssjygl.ticket.log;
|
||||||
|
|
||||||
|
import com.cowr.common.enums.Enums;
|
||||||
|
import com.cowr.common.enums.OrderStateEnum;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.local.ssjygl.base.BaseSyncService;
|
||||||
|
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||||
|
import com.cowr.local.ssjygl.synctask.SyncTaskService;
|
||||||
|
import com.cowr.model.TicketLog;
|
||||||
|
import com.cowr.model.TicketReceive;
|
||||||
|
import com.cowr.model.SyncTask;
|
||||||
|
import com.cowr.model.Sysuser;
|
||||||
|
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TicketLogSyncService extends BaseSyncService {
|
||||||
|
private static Log log = Log.getLog(TicketLogSyncService.class);
|
||||||
|
public static TicketLogSyncService me = new TicketLogSyncService();
|
||||||
|
|
||||||
|
public Result invalid(int supermarket_id, String ticket_code, String invalid_memo, Sysuser sysuser) {
|
||||||
|
if (supermarket_id != CliCacheData.SUP.getId()) {
|
||||||
|
return Result.failed("砂站信息错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先判断这张结算单有没有被领用
|
||||||
|
TicketReceive receive = TicketReceiveService.me.checkSurplusReceive(supermarket_id, ticket_code);
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者结算单已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLog.dao.findFirst("select * from ticket_log t \n" +
|
||||||
|
" where t.ticket_code = ? limit 1 ", ticket_code);
|
||||||
|
|
||||||
|
if (ticketLog != null) {
|
||||||
|
// 再判断这张结算单是不是已经被取消了
|
||||||
|
if (ticketLog.getState() == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return Result.failed("结算单已作废");
|
||||||
|
} else {
|
||||||
|
// 还要判断这张结算单已经在订单上使用了
|
||||||
|
return Result.failed("结算单已使用,请使用“取消结算单”功能");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 然后就可以开始取消了
|
||||||
|
|
||||||
|
ticketLog = new TicketLog();
|
||||||
|
ticketLog.setId(StrKit.getRandomUUID());
|
||||||
|
ticketLog.setInvalidUserId(sysuser.getId());
|
||||||
|
ticketLog.setInvalidUserName(sysuser.getName());
|
||||||
|
ticketLog.setInvalidTime(new Date());
|
||||||
|
ticketLog.setInvalidMemo(invalid_memo);
|
||||||
|
ticketLog.setState(OrderStateEnum.INVALID.getStateid());
|
||||||
|
ticketLog.setTicketReceiveId(receive.getId());
|
||||||
|
ticketLog.setTicketCode(ticket_code);
|
||||||
|
|
||||||
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
receive.setInvalidCount(receive.getInvalidCount() + 1);
|
||||||
|
|
||||||
|
if (receive.getSurplus() == 0) {
|
||||||
|
// 作废最后一张结算单,当前结算单停再最后一个结算单号码上
|
||||||
|
receive.setCurrentCode(receive.getEndCode());
|
||||||
|
} else {
|
||||||
|
if (ticket_code.equals(receive.getStartCode())) { // 作废第一张结算单
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getStartCode()) + 1));
|
||||||
|
} else if (ticket_code.equals(receive.getCurrentCode())) { // 作废顺延的下一张结算单
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getCurrentCode()) + 1));
|
||||||
|
} else {
|
||||||
|
// 其他情况下不更新 current_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
|
TicketLog finalTicketLog = ticketLog;
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = finalTicketLog.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addSaveData(finalTicketLog);
|
||||||
|
|
||||||
|
ret = receive.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addUpdateData(receive);
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask)
|
||||||
|
&& ModifyLogService.me.save(finalTicketLog, null, Enums.DataOpType.SAVE.getId(), sysuser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 普票作废理解同步到砂站
|
||||||
|
if (ret) {
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret ? Result.success(ticketLog) : Result.failed(false, "处理失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.cowr.local.ssjygl.ticket.receive;
|
||||||
|
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketReceive;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceivePKValidator;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TicketReceiveController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键检查对象是否存在
|
||||||
|
* 返回 code = 200
|
||||||
|
* 存在时 data = true
|
||||||
|
* 不存在 data = false
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void checkExistsByPk() {
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveService.me.checkExistsByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查找 invoice_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
String reveiver_user_name = get("reveiver_user_name");
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
renderJson(Result.object(TicketReceiveService.me.find(pp, supermarket_id, reveiver_user_name, stm, etm)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查找单个对象 invoice_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void findByPk() {
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveService.me.findByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查找单个对象 invoice_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void get() {
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveService.me.findByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nextTicket() {
|
||||||
|
Integer supermarket_id = getInt("supermarket_id", 0);
|
||||||
|
|
||||||
|
List<Record> receives = TicketReceiveService.me.nextTicketCodes(supermarket_id);
|
||||||
|
if (receives == null || receives.isEmpty()) {
|
||||||
|
renderJson(Result.failed("没有有效的结算单领用记录"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderJson(Result.success(receives));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,16 +7,17 @@ import com.cowr.common.enums.OrderTypeEnum;
|
||||||
import com.cowr.common.utils.ImageUtil;
|
import com.cowr.common.utils.ImageUtil;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.local.ssjygl.main.Config;
|
import com.cowr.local.ssjygl.main.Config;
|
||||||
|
import com.cowr.model.*;
|
||||||
import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductService;
|
import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductService;
|
||||||
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
||||||
import com.cowr.ssjygl.order.OrderService;
|
import com.cowr.ssjygl.order.OrderService;
|
||||||
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||||
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
|
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
|
||||||
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
|
||||||
import com.cowr.model.*;
|
|
||||||
import com.cowr.ssjygl.order.ordersale.OrderSaleService;
|
import com.cowr.ssjygl.order.ordersale.OrderSaleService;
|
||||||
import com.cowr.ssjygl.order.ordertemp.OrderTempService;
|
import com.cowr.ssjygl.order.ordertemp.OrderTempService;
|
||||||
import com.cowr.ssjygl.prepay.PrepayService;
|
import com.cowr.ssjygl.prepay.PrepayService;
|
||||||
|
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
import com.cowr.ssjygl.transprice.TransPriceService;
|
import com.cowr.ssjygl.transprice.TransPriceService;
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
|
|
@ -129,9 +130,17 @@ public class TransportQueryService {
|
||||||
|
|
||||||
// transobj.set("next_invoice_code", InvoiceReceiveService.me.nextInvoiceCode(transport.getSupermarketId())); // 2020-09-21 加了发票代码
|
// transobj.set("next_invoice_code", InvoiceReceiveService.me.nextInvoiceCode(transport.getSupermarketId())); // 2020-09-21 加了发票代码
|
||||||
if (ordercluster.getReqReceipt() == 1) { // 需要打印发票的,才去插领票记录
|
if (ordercluster.getReqReceipt() == 1) { // 需要打印发票的,才去插领票记录
|
||||||
|
// 开专票的需要用结算单
|
||||||
|
if (prepayinfo != null && prepayinfo.get("prepay_customer_invoice_type") != null && prepayinfo.getInt("prepay_customer_invoice_type") == 2) {
|
||||||
|
transobj.set("invoice_numbers", new ArrayList<>());
|
||||||
|
transobj.set("ticket_numbers", TicketReceiveService.me.nextTicketCodes(transport.getSupermarketId()));
|
||||||
|
} else {
|
||||||
transobj.set("invoice_numbers", InvoiceReceiveService.me.nextInvoiceCodes(transport.getSupermarketId()));
|
transobj.set("invoice_numbers", InvoiceReceiveService.me.nextInvoiceCodes(transport.getSupermarketId()));
|
||||||
|
transobj.set("ticket_numbers", new ArrayList<>());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
transobj.set("invoice_numbers", new ArrayList<>());
|
transobj.set("invoice_numbers", new ArrayList<>());
|
||||||
|
transobj.set("ticket_numbers", TicketReceiveService.me.nextTicketCodes(transport.getSupermarketId()));
|
||||||
}
|
}
|
||||||
transobj.set("req_receipt", ordercluster.getReqReceipt()); // TODO 2020-10-12 如果放开购买,连零散购砂都不做配额了,这里需要修改
|
transobj.set("req_receipt", ordercluster.getReqReceipt()); // TODO 2020-10-12 如果放开购买,连零散购砂都不做配额了,这里需要修改
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||||
import com.cowr.ssjygl.customer.CustomerPKValidator;
|
import com.cowr.ssjygl.customer.CustomerPKValidator;
|
||||||
import com.cowr.ssjygl.customer.CustomerService;
|
import com.cowr.ssjygl.customer.CustomerService;
|
||||||
import com.cowr.ssjygl.customer.CustomerValidator;
|
import com.cowr.ssjygl.customer.CustomerValidator;
|
||||||
|
import com.cowr.ssjygl.prepay.refunddetail.RefundDetailService;
|
||||||
import com.jfinal.aop.Before;
|
import com.jfinal.aop.Before;
|
||||||
import com.jfinal.core.Controller;
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
|
@ -145,4 +146,9 @@ public class CustomerController extends Controller {
|
||||||
public void list() {
|
public void list() {
|
||||||
renderJson(Result.object(CustomerService.me.list()));
|
renderJson(Result.object(CustomerService.me.list()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getCustomerAccountBalance(){
|
||||||
|
Integer customer_id = getInt("customer_id");
|
||||||
|
renderJson(RefundDetailService.me.getCustomerAccountBalance(customer_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.cowr.service.ssjygl.invoice.invalidverify;
|
package com.cowr.service.ssjygl.invoice.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.enums.RoleEnum;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.model.Sysuser;
|
import com.cowr.model.Sysuser;
|
||||||
|
|
@ -36,7 +37,7 @@ public class InvoiceInvalidVerifyController extends Controller {
|
||||||
if (tokenuser == null) {
|
if (tokenuser == null) {
|
||||||
renderJson(Result.noauth());
|
renderJson(Result.noauth());
|
||||||
return;
|
return;
|
||||||
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能审核
|
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())&&!SysuserSyncService.me.isPresident(tokenuser.getRole())) { // 财务/结算中心才能审核
|
||||||
renderJson(Result.permissionDenied());
|
renderJson(Result.permissionDenied());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,9 @@ public class InvoiceInvalidVerifySyncService {
|
||||||
receive.setCurrentCode(receive.getEndCode());
|
receive.setCurrentCode(receive.getEndCode());
|
||||||
} else {
|
} else {
|
||||||
if (model.getInvoiceCode().equals(receive.getStartCode())) { // 作废第一张发票
|
if (model.getInvoiceCode().equals(receive.getStartCode())) { // 作废第一张发票
|
||||||
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getStartCode()) + 1));
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getStartCode()) + 1));
|
||||||
} else if (model.getInvoiceCode().equals(receive.getCurrentCode())) { // 作废顺延的下一张发票
|
} else if (model.getInvoiceCode().equals(receive.getCurrentCode())) { // 作废顺延的下一张发票
|
||||||
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getCurrentCode()) + 1));
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getCurrentCode()) + 1));
|
||||||
} else {
|
} else {
|
||||||
// 其他情况下不更新 current_code
|
// 其他情况下不更新 current_code
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,16 +48,24 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
|
|
||||||
List<OrderTemp> list = OrderTemp.dao.find("select * from order_temp t \n" +
|
List<OrderTemp> list = OrderTemp.dao.find("select * from order_temp t \n" +
|
||||||
" where t.invoice_code is null \n" +
|
" where t.invoice_code is null \n" +
|
||||||
|
" and t.state = " + OrderStateEnum.RECEIVED.getStateid() +
|
||||||
" and t.sn in(" + StrKit.join(question, ", ") + ")", ordersnlist.toArray());
|
" and t.sn in(" + StrKit.join(question, ", ") + ")", ordersnlist.toArray());
|
||||||
|
|
||||||
if (list.size() != snarr.length) {
|
|
||||||
|
List<TicketLog> ticketLogs = TicketLog.dao.find("select * from ticket_log t \n" +
|
||||||
|
" where t.invoice_code is null \n" +
|
||||||
|
" and t.state = " + OrderStateEnum.RECEIVED.getStateid() +
|
||||||
|
" and t.order_sn in(" + StrKit.join(question, ", ") + ")", ordersnlist.toArray());
|
||||||
|
|
||||||
|
if (list.size() != snarr.length || list.size() != ticketLogs.size()) {
|
||||||
return Result.failed("部分订单号未找到,或者已开票");
|
return Result.failed("部分订单号未找到,或者已开票");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InvoiceLog> logs = new ArrayList<>();
|
List<InvoiceLog> logs = new ArrayList<>();
|
||||||
Map<Integer, SyncTask> map = new HashMap<>();
|
Map<Integer, SyncTask> map = new HashMap<>();
|
||||||
|
|
||||||
for (OrderTemp o : list) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
OrderTemp o = list.get(i);
|
||||||
InvoiceLog invoiceLog = new InvoiceLog();
|
InvoiceLog invoiceLog = new InvoiceLog();
|
||||||
invoiceLog.setId(StrKit.getRandomUUID());
|
invoiceLog.setId(StrKit.getRandomUUID());
|
||||||
invoiceLog.setSettlementUserId(sysuser.getId());
|
invoiceLog.setSettlementUserId(sysuser.getId());
|
||||||
|
|
@ -77,6 +85,13 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
o.setInvoiceNumber(invoice_number);
|
o.setInvoiceNumber(invoice_number);
|
||||||
o.setInvoiceCode(invoice_code);
|
o.setInvoiceCode(invoice_code);
|
||||||
|
|
||||||
|
TicketLog ticketLog = ticketLogs.get(i);
|
||||||
|
ticketLog.setInvoiceNumber(invoice_number);
|
||||||
|
ticketLog.setInvoiceCode(invoice_code);
|
||||||
|
ticketLog.setInvoiceUserId(sysuser.getId());
|
||||||
|
ticketLog.setInvoiceUserName(sysuser.getName());
|
||||||
|
ticketLog.setInvoiceTime(new Date());
|
||||||
|
|
||||||
int supermarket_id = o.getSupermarketId();
|
int supermarket_id = o.getSupermarketId();
|
||||||
|
|
||||||
if (!map.containsKey(supermarket_id)) {
|
if (!map.containsKey(supermarket_id)) {
|
||||||
|
|
@ -85,13 +100,14 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
|
|
||||||
map.get(supermarket_id).addUpdateData(o);
|
map.get(supermarket_id).addUpdateData(o);
|
||||||
map.get(supermarket_id).addSaveData(invoiceLog);
|
map.get(supermarket_id).addSaveData(invoiceLog);
|
||||||
|
map.get(supermarket_id).addUpdateData(ticketLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
try {
|
try {
|
||||||
int[] saveret = Db.batchSave(logs, logs.size());
|
int[] saveret = Db.batchSave(logs, 500);
|
||||||
|
|
||||||
for (int i : saveret) {
|
for (int i : saveret) {
|
||||||
// 必须是每条 sql 修改一条记录
|
// 必须是每条 sql 修改一条记录
|
||||||
|
|
@ -100,7 +116,7 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] editret = Db.batchUpdate(list, list.size());
|
int[] editret = Db.batchUpdate(list, 500);
|
||||||
|
|
||||||
for (int i : editret) {
|
for (int i : editret) {
|
||||||
// 必须是每条 sql 修改一条记录
|
// 必须是每条 sql 修改一条记录
|
||||||
|
|
@ -109,6 +125,15 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int[] editlogsret = Db.batchUpdate(ticketLogs, 500);
|
||||||
|
|
||||||
|
for (int i : editlogsret) {
|
||||||
|
// 必须是每条 sql 修改一条记录
|
||||||
|
if (i != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 将订单同步到不同的砂站
|
// 将订单同步到不同的砂站
|
||||||
for (Map.Entry<Integer, SyncTask> entry : map.entrySet()) {
|
for (Map.Entry<Integer, SyncTask> entry : map.entrySet()) {
|
||||||
|
|
@ -182,9 +207,9 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
receive.setCurrentCode(receive.getEndCode());
|
receive.setCurrentCode(receive.getEndCode());
|
||||||
} else {
|
} else {
|
||||||
if (code.equals(receive.getStartCode())) { // 作废第一张发票
|
if (code.equals(receive.getStartCode())) { // 作废第一张发票
|
||||||
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getStartCode()) + 1));
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getStartCode()) + 1));
|
||||||
} else if (code.equals(receive.getCurrentCode())) { // 作废顺延的下一张发票
|
} else if (code.equals(receive.getCurrentCode())) { // 作废顺延的下一张发票
|
||||||
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getCurrentCode()) + 1));
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getCurrentCode()) + 1));
|
||||||
} else {
|
} else {
|
||||||
// 其他情况下不更新 current_code
|
// 其他情况下不更新 current_code
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +262,13 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
return Result.failed("未找到发票记录");
|
return Result.failed("未找到发票记录");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (invoiceLog.getInvoiceType() == 1) {
|
||||||
return cancelType1(invoiceLog, invalid_memo, sysuser);
|
return cancelType1(invoiceLog, invalid_memo, sysuser);
|
||||||
|
} else if (invoiceLog.getInvoiceType() == 2) {
|
||||||
|
return cancelType2(invoiceLog, invalid_memo, sysuser);
|
||||||
|
} else {
|
||||||
|
return Result.failed("发票记录错误");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -366,7 +397,7 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
invoiceLog.getCode()
|
invoiceLog.getCode()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ordlist.isEmpty()) {
|
if (loglist.isEmpty()) {
|
||||||
return Result.failed("发票使用信息错误");
|
return Result.failed("发票使用信息错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -374,6 +405,10 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
Map<String, OrderTemp> ordmap = new HashMap<>();
|
Map<String, OrderTemp> ordmap = new HashMap<>();
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
Record logrecord = new Record();
|
Record logrecord = new Record();
|
||||||
|
List<String> sql = new ArrayList<>();
|
||||||
|
List<Object> ticketparams = new ArrayList<>();
|
||||||
|
|
||||||
|
ticketparams.add(OrderStateEnum.RECEIVED.getStateid());
|
||||||
|
|
||||||
logrecord.set("state", OrderStateEnum.INVALID.getStateid());
|
logrecord.set("state", OrderStateEnum.INVALID.getStateid());
|
||||||
logrecord.set("invoice_type", invoiceLog.getInvoiceType());
|
logrecord.set("invoice_type", invoiceLog.getInvoiceType());
|
||||||
|
|
@ -393,6 +428,17 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
|
|
||||||
map.get(supermarket_id).addUpdateData(o);
|
map.get(supermarket_id).addUpdateData(o);
|
||||||
ordmap.put(o.getSn(), o);
|
ordmap.put(o.getSn(), o);
|
||||||
|
|
||||||
|
ticketparams.add(o.getTicketCode());
|
||||||
|
sql.add("?");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TicketLog> ticketloglist = TicketLog.dao.find("select * from ticket_log t \n" +
|
||||||
|
" where t.state = ? \n" +
|
||||||
|
" and t.ticket_code in(" + StrKit.join(sql, ",") + ")", ticketparams.toArray());
|
||||||
|
|
||||||
|
if (ticketloglist.isEmpty()) {
|
||||||
|
return Result.failed("结算单使用信息错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (InvoiceLog o : loglist) {
|
for (InvoiceLog o : loglist) {
|
||||||
|
|
@ -415,11 +461,31 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
map.get(supermarket_id).addUpdateData(o);
|
map.get(supermarket_id).addUpdateData(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (TicketLog o : ticketloglist) {
|
||||||
|
o.setInvoiceNumber(null);
|
||||||
|
o.setInvoiceCode(null);
|
||||||
|
o.setInvoiceUserId(null);
|
||||||
|
o.setInvoiceUserName(null);
|
||||||
|
o.setInvoiceTime(null);
|
||||||
|
|
||||||
|
if (!ordmap.containsKey(o.getOrderSn())) {
|
||||||
|
return Result.failedstr("发票[%s]未找到订单信息", o.getTicketCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
int supermarket_id = ordmap.get(o.getOrderSn()).getSupermarketId();
|
||||||
|
|
||||||
|
if (!map.containsKey(supermarket_id)) {
|
||||||
|
map.put(supermarket_id, new SyncTask());
|
||||||
|
}
|
||||||
|
|
||||||
|
map.get(supermarket_id).addUpdateData(o);
|
||||||
|
}
|
||||||
|
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
try {
|
try {
|
||||||
int[] editret = Db.batchUpdate(ordlist, ordlist.size());
|
int[] editret = Db.batchUpdate(ordlist, 500);
|
||||||
|
|
||||||
for (int i : editret) {
|
for (int i : editret) {
|
||||||
// 必须是每条 sql 修改一条记录
|
// 必须是每条 sql 修改一条记录
|
||||||
|
|
@ -428,7 +494,16 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editret = Db.batchUpdate(loglist, loglist.size());
|
editret = Db.batchUpdate(loglist, 500);
|
||||||
|
|
||||||
|
for (int i : editret) {
|
||||||
|
// 必须是每条 sql 修改一条记录
|
||||||
|
if (i != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
editret = Db.batchUpdate(ticketloglist, 500);
|
||||||
|
|
||||||
for (int i : editret) {
|
for (int i : editret) {
|
||||||
// 必须是每条 sql 修改一条记录
|
// 必须是每条 sql 修改一条记录
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.cowr.service.ssjygl.jobs;
|
package com.cowr.service.ssjygl.jobs;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.cowr.common.Const;
|
import com.cowr.common.Const;
|
||||||
import com.cowr.service.ssjygl.main.Config;
|
import com.cowr.service.ssjygl.main.Config;
|
||||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
|
|
@ -28,6 +29,7 @@ public class CheckExceptionDataJob implements Job {
|
||||||
|
|
||||||
for (Map.Entry<Integer, Record> entry : SvrCacheData.SUP_HEARTBEAT.entrySet()) {
|
for (Map.Entry<Integer, Record> entry : SvrCacheData.SUP_HEARTBEAT.entrySet()) {
|
||||||
Record c = entry.getValue();
|
Record c = entry.getValue();
|
||||||
|
if (c.get("tm") != null) {
|
||||||
long st = c.getLong("tm");
|
long st = c.getLong("tm");
|
||||||
|
|
||||||
// 五分钟以内的才进行判断,超过5分钟的,就认为是离线了
|
// 五分钟以内的才进行判断,超过5分钟的,就认为是离线了
|
||||||
|
|
@ -35,6 +37,9 @@ public class CheckExceptionDataJob implements Job {
|
||||||
if (nowst - st < Const.SUP_OFFLINE_TIME) {
|
if (nowst - st < Const.SUP_OFFLINE_TIME) {
|
||||||
onlineids.add(entry.getKey().toString());
|
onlineids.add(entry.getKey().toString());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
onlineids.add(entry.getKey().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cnt = Db.queryInt("select count(t.sn) cnt from order_temp t\n" +
|
int cnt = Db.queryInt("select count(t.sn) cnt from order_temp t\n" +
|
||||||
|
|
@ -49,13 +54,17 @@ public class CheckExceptionDataJob implements Job {
|
||||||
int sync = 0;
|
int sync = 0;
|
||||||
|
|
||||||
if (!onlineids.isEmpty()) {
|
if (!onlineids.isEmpty()) {
|
||||||
sync = Db.queryInt("select count(t.id) cnt from sync_task t \n" +
|
List<Record> tbyc = Db.query("select * from sync_task t \n" +
|
||||||
" where t.state = 0 \n" +
|
" where t.state = 0 \n" +
|
||||||
" and t.create_time < date_add(now(), interval -5 minute) \n" +
|
" and t.create_time < date_add(now(), interval -5 minute) \n" +
|
||||||
" and t.supermarket_id in(" + StrKit.join(onlineids, ",") + ") ");
|
" and t.supermarket_id in(" + StrKit.join(onlineids, ",") + ") ");
|
||||||
|
|
||||||
|
sync = tbyc.size();
|
||||||
|
|
||||||
if (sync > 0) {
|
if (sync > 0) {
|
||||||
content += "浠水砂石系统有 " + sync + " 条数据下发失败。";
|
content += "浠水砂石系统正式环境有 " + sync + " 条数据下发失败。";
|
||||||
|
|
||||||
|
log.debug("同步异常数据:%s", JSON.toJSONString(tbyc));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content += "没有找到" + Config.configprop.get("print.vendor") + "在线砂站信息。";
|
content += "没有找到" + Config.configprop.get("print.vendor") + "在线砂站信息。";
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ public class CheckUndonOrderclusterJob implements Job {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("自动转结完成, %s");
|
log.debug("自动转结完成");
|
||||||
} else {
|
} else {
|
||||||
log.debug("无未完成的订单");
|
log.debug("无未完成的订单");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import com.cowr.model.PrepayCustomer;
|
||||||
import com.cowr.service.ssjygl.main.Config;
|
import com.cowr.service.ssjygl.main.Config;
|
||||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||||
import com.cowr.sms.AliyunSmsService;
|
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
|
@ -202,6 +201,7 @@ public class StatSmsJob implements Job {
|
||||||
c.add(Calendar.DAY_OF_MONTH, -1);
|
c.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
|
||||||
String predaytm = DateTimeUtil.sdf.get().format(c.getTime()); // 前一日
|
String predaytm = DateTimeUtil.sdf.get().format(c.getTime()); // 前一日
|
||||||
|
String daytm = DateTimeUtil.sdf.get().format(now); // 当日
|
||||||
String sendtmtext = DateTimeUtil.sdfymd.get().format(c.getTime());
|
String sendtmtext = DateTimeUtil.sdfymd.get().format(c.getTime());
|
||||||
String year_start = DateTimeUtil.year_start.get().format(now);
|
String year_start = DateTimeUtil.year_start.get().format(now);
|
||||||
|
|
||||||
|
|
@ -211,6 +211,7 @@ public class StatSmsJob implements Job {
|
||||||
String ordersql = "select count(t.sn) aggr_cnt, ifnull(sum(t.weight), 0) aggr_weight, ifnull(sum(t.total_price), 0) aggr_price \n" +
|
String ordersql = "select count(t.sn) aggr_cnt, ifnull(sum(t.weight), 0) aggr_weight, ifnull(sum(t.total_price), 0) aggr_price \n" +
|
||||||
" from order_temp t \n" +
|
" from order_temp t \n" +
|
||||||
" where t.create_time >= ? \n" +
|
" where t.create_time >= ? \n" +
|
||||||
|
" and t.create_time < ? \n" +
|
||||||
" and t.state = 5";
|
" and t.state = 5";
|
||||||
String cusmersql = "select ifnull(sum(t.surplus), 0) customer_total_surplus from prepay_customer t";
|
String cusmersql = "select ifnull(sum(t.surplus), 0) customer_total_surplus from prepay_customer t";
|
||||||
String daysql = "select count(t.sn) total_cnt, ifnull(sum(t.weight), 0) total_weight, ifnull(sum(t.total_price), 0) total_price from order_temp t\n" +
|
String daysql = "select count(t.sn) total_cnt, ifnull(sum(t.weight), 0) total_weight, ifnull(sum(t.total_price), 0) total_price from order_temp t\n" +
|
||||||
|
|
@ -223,11 +224,12 @@ public class StatSmsJob implements Job {
|
||||||
" or t.customer_id = 24\n" +
|
" or t.customer_id = 24\n" +
|
||||||
" or t.customer_id = 60\n" +
|
" or t.customer_id = 60\n" +
|
||||||
" or t.customer_id = 61)\n" +
|
" or t.customer_id = 61)\n" +
|
||||||
"and t.create_time >= ? ";
|
" and t.create_time >= ? \n" +
|
||||||
|
" and t.create_time < ?";
|
||||||
|
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
Record orderobj = Db.findFirst(ordersql, year_start);
|
Record orderobj = Db.findFirst(ordersql, year_start, daytm);
|
||||||
Record revenueobj = Db.findFirst(revenuesql, year_start);
|
Record revenueobj = Db.findFirst(revenuesql, year_start, daytm);
|
||||||
Record allorderobj = Db.findFirst(allordersql);
|
Record allorderobj = Db.findFirst(allordersql);
|
||||||
Record customerobj = Db.findFirst(cusmersql);
|
Record customerobj = Db.findFirst(cusmersql);
|
||||||
Record dayobj = Db.findFirst(daysql);
|
Record dayobj = Db.findFirst(daysql);
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,12 @@ public class AuthInterceptor implements Interceptor {
|
||||||
|
|
||||||
add("/customer/get");
|
add("/customer/get");
|
||||||
add("/customer/edit");
|
add("/customer/edit");
|
||||||
|
add("/customer/getCustomerAccountBalance");
|
||||||
|
|
||||||
add("/sysuser/edit");
|
add("/sysuser/edit");
|
||||||
add("/sysuser/modpwd");
|
add("/sysuser/modpwd");
|
||||||
|
add("/sysuser/modpwd");
|
||||||
|
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import com.cowr.service.ssjygl.order.ordertransfer.OrderTransferController;
|
||||||
import com.cowr.service.ssjygl.order.ordertrash.OrderTrashController;
|
import com.cowr.service.ssjygl.order.ordertrash.OrderTrashController;
|
||||||
import com.cowr.service.ssjygl.overall.OverallController;
|
import com.cowr.service.ssjygl.overall.OverallController;
|
||||||
import com.cowr.service.ssjygl.prepay.PrepayController;
|
import com.cowr.service.ssjygl.prepay.PrepayController;
|
||||||
|
import com.cowr.service.ssjygl.prepay.prepaycustomer.PrepayCustomerController;
|
||||||
import com.cowr.service.ssjygl.prepay.prepaydetail.PrepayDetailController;
|
import com.cowr.service.ssjygl.prepay.prepaydetail.PrepayDetailController;
|
||||||
import com.cowr.service.ssjygl.prepay.prepaytruck.PrepayTruckController;
|
import com.cowr.service.ssjygl.prepay.prepaytruck.PrepayTruckController;
|
||||||
import com.cowr.service.ssjygl.prepay.refunddetail.RefundDetailController;
|
import com.cowr.service.ssjygl.prepay.refunddetail.RefundDetailController;
|
||||||
|
|
@ -51,6 +52,9 @@ import com.cowr.service.ssjygl.supermarket.sandfarmdistance.SupermarketSandfarmD
|
||||||
import com.cowr.service.ssjygl.supermarket.stock.StockController;
|
import com.cowr.service.ssjygl.supermarket.stock.StockController;
|
||||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
import com.cowr.service.ssjygl.system.sysuser.SysuserController;
|
import com.cowr.service.ssjygl.system.sysuser.SysuserController;
|
||||||
|
import com.cowr.service.ssjygl.ticket.invalidverify.TicketInvalidVerifyController;
|
||||||
|
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.transport.TransportQueryController;
|
||||||
import com.cowr.service.ssjygl.transportcompany.TransportCompanyController;
|
import com.cowr.service.ssjygl.transportcompany.TransportCompanyController;
|
||||||
import com.cowr.service.ssjygl.truck.TruckController;
|
import com.cowr.service.ssjygl.truck.TruckController;
|
||||||
|
|
@ -78,13 +82,14 @@ import com.jfinal.plugin.druid.DruidStatViewHandler;
|
||||||
import com.jfinal.plugin.redis.RedisPlugin;
|
import com.jfinal.plugin.redis.RedisPlugin;
|
||||||
import com.jfinal.template.Engine;
|
import com.jfinal.template.Engine;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
||||||
public class Config extends JFinalConfig {
|
public class Config extends JFinalConfig {
|
||||||
private static Log log = Log.getLog(Config.class);
|
private static Log log = Log.getLog(Config.class);
|
||||||
public static String ENV = "dev";
|
public static String ENV = "dev";
|
||||||
public static Prop configprop = PropKit.use(ENV + "/config.properties", "UTF-8");
|
public static Prop configprop = PropKit.use(ENV + "/config.properties", "UTF-8");
|
||||||
public static Prop dbprop = PropKit.use(ENV + "/db.properties", "UTF-8");
|
public static Prop dbprop;
|
||||||
private WallFilter wallFilter;
|
private WallFilter wallFilter;
|
||||||
public static NettyServer nettyServer = null;
|
public static NettyServer nettyServer = null;
|
||||||
public static boolean server_run = true;
|
public static boolean server_run = true;
|
||||||
|
|
@ -110,8 +115,12 @@ public class Config extends JFinalConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPropConfig() {
|
private void initPropConfig() {
|
||||||
dbprop = PropKit.use(ENV + "/db.properties");
|
|
||||||
configprop = PropKit.use(ENV + "/config.properties", "UTF-8");
|
configprop = PropKit.use(ENV + "/config.properties", "UTF-8");
|
||||||
|
if ("prod".equals(ENV)) {
|
||||||
|
dbprop = PropKit.use(new File(configprop.get("dbconfpath")), "UTF-8");
|
||||||
|
} else {
|
||||||
|
dbprop = PropKit.use(ENV + "/db.properties");
|
||||||
|
}
|
||||||
|
|
||||||
CacheData.print_vendor = configprop.get("print.vendor");
|
CacheData.print_vendor = configprop.get("print.vendor");
|
||||||
CacheData.print_vendorTaxId = configprop.get("print.vendorTaxId");
|
CacheData.print_vendorTaxId = configprop.get("print.vendorTaxId");
|
||||||
|
|
@ -178,6 +187,7 @@ public class Config extends JFinalConfig {
|
||||||
|
|
||||||
// -- 预付费
|
// -- 预付费
|
||||||
me.add("/prepay", PrepayController.class);
|
me.add("/prepay", PrepayController.class);
|
||||||
|
me.add("/prepaycustomer", PrepayCustomerController.class);
|
||||||
me.add("/prepaydetail", PrepayDetailController.class);
|
me.add("/prepaydetail", PrepayDetailController.class);
|
||||||
me.add("/prepaytruck", PrepayTruckController.class);
|
me.add("/prepaytruck", PrepayTruckController.class);
|
||||||
me.add("/refunddetail", RefundDetailController.class);
|
me.add("/refunddetail", RefundDetailController.class);
|
||||||
|
|
@ -206,6 +216,11 @@ public class Config extends JFinalConfig {
|
||||||
me.add("/invoice/receive", InvoiceReceiveController.class);
|
me.add("/invoice/receive", InvoiceReceiveController.class);
|
||||||
me.add("/invoice/invalidverify", InvoiceInvalidVerifyController.class);
|
me.add("/invoice/invalidverify", InvoiceInvalidVerifyController.class);
|
||||||
|
|
||||||
|
// -- 结算单管理
|
||||||
|
me.add("/ticket/log", TicketLogController.class);
|
||||||
|
me.add("/ticket/receive", TicketReceiveController.class);
|
||||||
|
me.add("/ticket/invalidverify", TicketInvalidVerifyController.class);
|
||||||
|
|
||||||
// -- 日志
|
// -- 日志
|
||||||
me.add("/log/sms", SmsLogController.class);
|
me.add("/log/sms", SmsLogController.class);
|
||||||
me.add("/log/actioncmd", ActionCmdLogController.class);
|
me.add("/log/actioncmd", ActionCmdLogController.class);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,13 @@ package com.cowr.service.ssjygl.main;
|
||||||
import com.jfinal.kit.PathKit;
|
import com.jfinal.kit.PathKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
import com.jfinal.server.undertow.UndertowServer;
|
import com.jfinal.server.undertow.UndertowServer;
|
||||||
|
import io.undertow.server.HandlerWrapper;
|
||||||
|
import io.undertow.server.HttpHandler;
|
||||||
|
import io.undertow.server.handlers.DisallowedMethodsHandler;
|
||||||
|
import io.undertow.servlet.api.DeploymentInfo;
|
||||||
|
import io.undertow.util.HttpString;
|
||||||
|
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static Log log = Log.getLog(Main.class);
|
private static Log log = Log.getLog(Main.class);
|
||||||
|
|
@ -28,7 +35,21 @@ public class Main {
|
||||||
log.info("Running directory: " + path);
|
log.info("Running directory: " + path);
|
||||||
|
|
||||||
// 相关配置见 undertow.txt
|
// 相关配置见 undertow.txt
|
||||||
UndertowServer.create(Config.class, Config.ENV + "/undertow.txt").start();
|
UndertowServer
|
||||||
|
.create(Config.class, Config.ENV + "/undertow.txt")
|
||||||
|
.onDeploy(new BiConsumer<ClassLoader, DeploymentInfo>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ClassLoader classLoader, DeploymentInfo deploymentInfo) {
|
||||||
|
deploymentInfo.addInitialHandlerChainWrapper(new HandlerWrapper() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpHandler wrap(HttpHandler handler) {
|
||||||
|
HttpString[] disallowedHttpMethods = {HttpString.tryFromString("TRACE"), HttpString.tryFromString("TRACK")};
|
||||||
|
return new DisallowedMethodsHandler(handler, disallowedHttpMethods);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ public class OrderInvalidVerifyController extends Controller {
|
||||||
if (tokenuser == null) {
|
if (tokenuser == null) {
|
||||||
renderJson(Result.noauth());
|
renderJson(Result.noauth());
|
||||||
return;
|
return;
|
||||||
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能审核
|
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())
|
||||||
|
&& !SysuserSyncService.me.isPresident(tokenuser.getRole())) { // 财务、结算中心才能审核
|
||||||
renderJson(Result.permissionDenied());
|
renderJson(Result.permissionDenied());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -279,4 +279,10 @@ public class OrderclusterController extends BaseController {
|
||||||
|
|
||||||
renderJson(OrderclusterSyncService.me.forwardTemp(ordercluster_id, new BigDecimal(total_weight), cutoff_time, trucks, tokenuser));
|
renderJson(OrderclusterSyncService.me.forwardTemp(ordercluster_id, new BigDecimal(total_weight), cutoff_time, trucks, tokenuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getMaximumConfiguration(){
|
||||||
|
String unit_price = get("unit_price");
|
||||||
|
int customer_id=getInt("customer_id");
|
||||||
|
renderJson(OrderclusterSyncService.me.getMaximumConfiguration(customer_id, unit_price));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.cowr.common.utils.DateTimeUtil;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.model.*;
|
import com.cowr.model.*;
|
||||||
import com.cowr.service.ssjygl.base.BaseSyncService;
|
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||||
|
import com.cowr.service.ssjygl.main.Config;
|
||||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
|
|
@ -16,6 +17,7 @@ import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductSer
|
||||||
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||||
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||||
import com.cowr.ssjygl.prepay.prepaycustomer.PrepayCustomerService;
|
import com.cowr.ssjygl.prepay.prepaycustomer.PrepayCustomerService;
|
||||||
|
import com.cowr.ssjygl.prepay.refunddetail.RefundDetailService;
|
||||||
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
||||||
import com.cowr.ssjygl.supermarket.receiverdistance.SupermarketReceiverDistanceService;
|
import com.cowr.ssjygl.supermarket.receiverdistance.SupermarketReceiverDistanceService;
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
|
|
@ -82,6 +84,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
int supermarket_id = obj.getIntValue("supermarket_id");
|
int supermarket_id = obj.getIntValue("supermarket_id");
|
||||||
int time_interval = obj.getIntValue("time_interval");
|
int time_interval = obj.getIntValue("time_interval");
|
||||||
int mini_truck = obj.getIntValue("mini_truck");
|
int mini_truck = obj.getIntValue("mini_truck");
|
||||||
|
int max_truck = obj.getIntValue("max_truck");
|
||||||
double total_weight = obj.getDouble("total_weight");
|
double total_weight = obj.getDouble("total_weight");
|
||||||
|
|
||||||
Supermarket supermarket = SvrCacheData.SUP_CACHE.get(supermarket_id);
|
Supermarket supermarket = SvrCacheData.SUP_CACHE.get(supermarket_id);
|
||||||
|
|
@ -108,47 +111,38 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
if (mini_truck < 1) {
|
if (mini_truck < 1) {
|
||||||
return Result.failed("最低运输车辆数错误");
|
return Result.failed("最低运输车辆数错误");
|
||||||
}
|
}
|
||||||
|
if(max_truck<1){
|
||||||
|
return Result.failed("最高运输车辆数错误");
|
||||||
|
}
|
||||||
|
if(mini_truck>max_truck){
|
||||||
|
return Result.failed("最低运输车辆不能超过最高运输车辆数错误");
|
||||||
|
}
|
||||||
|
|
||||||
if (total_weight == 0) {
|
if (total_weight == 0) {
|
||||||
log.debug("重量为 0 的砂站(id:%s)跳过", supermarket_id);
|
log.debug("重量为 0 的砂站(id:%s)跳过", supermarket_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 当前配额指定的客户、超市、品类对应的单价
|
||||||
BigDecimal unitprice = CustomerSupermarketProductService.me.getUnitPrice(customer_id, supermarket_id, product.getId());
|
BigDecimal unitprice = CustomerSupermarketProductService.me.getUnitPrice(customer_id, supermarket_id, product.getId());
|
||||||
if (unitprice == null) {
|
if (unitprice == null) {
|
||||||
return Result.failed("未配置商品单价");
|
return Result.failed("未配置商品单价");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按客户查询未完成的订单量
|
// 本次配额总价不能超过余额
|
||||||
List<Record> undonlist = OrderclusterService.me.undonlist(supermarket_id, customer_id);
|
|
||||||
|
|
||||||
if (undonlist != null && !undonlist.isEmpty()) {
|
|
||||||
BigDecimal plan_total_weight = new BigDecimal(total_weight); // 本次配额重量
|
|
||||||
|
|
||||||
for (Record record : undonlist) {
|
|
||||||
Date record_cutoff_time = record.getDate("cutoff_time");
|
|
||||||
|
|
||||||
// 判断日期不是已经存在
|
|
||||||
if (record_cutoff_time.getTime() == cutoff_time.getTime()) {
|
|
||||||
return Result.failedstr("客户[%s][%s]在砂站[%s]还有未完成的配额", customerObj.getName(), DateTimeUtil.sdfymd.get().format(cutoff_time), SvrCacheData.SUP_CACHE.get(supermarket_id).getName());
|
|
||||||
} else {
|
|
||||||
// 累加总量
|
|
||||||
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 按客户统计已完成量
|
|
||||||
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(customer_id); // 按客户找集团订单已完成量
|
|
||||||
|
|
||||||
if (plan_total_weight.subtract(overweight).multiply(unitprice).compareTo(prepayCustomer.getSurplus()) > 0) {
|
|
||||||
return Result.failedstr("剩余总配额 %.2f,客户余额(%.2f)不足", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unitprice.multiply(new BigDecimal(total_weight)).compareTo(prepayCustomer.getSurplus()) > 0) {
|
if (unitprice.multiply(new BigDecimal(total_weight)).compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||||
return Result.failedstr("余额 %.2f 不足以购买 %.2f 吨", prepayCustomer.getSurplus(), total_weight);
|
return Result.failedstr("余额 %.2f 不足以购买 %.2f 吨", prepayCustomer.getSurplus(), total_weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 客户在所有砂站的未完成的配额中,未执行完成的总金额
|
||||||
|
BigDecimal undo_price = OrderclusterService.me.undoPrice(customer_id);
|
||||||
|
BigDecimal plan_total_price = new BigDecimal(total_weight).multiply(unitprice).add(undo_price); // 本次配额总价格
|
||||||
|
|
||||||
|
// 本次计划总额加上未完成的量,不能超过余额
|
||||||
|
if (plan_total_price.compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||||
|
return Result.failedstr("共计总配额达 %.2f元,客户余额(%.2f元)不足", plan_total_price, prepayCustomer.getSurplus());
|
||||||
|
}
|
||||||
|
|
||||||
Ordercluster model = new Ordercluster();
|
Ordercluster model = new Ordercluster();
|
||||||
model.setCustomerId(customerObj.getId());
|
model.setCustomerId(customerObj.getId());
|
||||||
model.setCustomerAddress(customerObj.getAddress());
|
model.setCustomerAddress(customerObj.getAddress());
|
||||||
|
|
@ -167,6 +161,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
model.setSupermarketId(supermarket_id);
|
model.setSupermarketId(supermarket_id);
|
||||||
model.setTimeInterval(time_interval);
|
model.setTimeInterval(time_interval);
|
||||||
model.setMiniTruck(mini_truck);
|
model.setMiniTruck(mini_truck);
|
||||||
|
model.setMaxTruck(max_truck);
|
||||||
|
|
||||||
model.setProductId(product.getId());
|
model.setProductId(product.getId());
|
||||||
model.setProductName(product.getName());
|
model.setProductName(product.getName());
|
||||||
|
|
@ -223,7 +218,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
});
|
});
|
||||||
|
|
||||||
// 保存成功后,发送配额提醒短信
|
// 保存成功后,发送配额提醒短信
|
||||||
if (ret) {
|
if (ret && !Config.isDev()) {
|
||||||
for (Ordercluster cluster : newlist) {
|
for (Ordercluster cluster : newlist) {
|
||||||
SmsService.me.sendPeiE(cluster);
|
SmsService.me.sendPeiE(cluster);
|
||||||
}
|
}
|
||||||
|
|
@ -720,37 +715,32 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
return Result.failed(false, "订单已完成,不能修改");
|
return Result.failed(false, "订单已完成,不能修改");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量
|
||||||
|
// BigDecimal surplus_weight = oldobj.getTotalWeight().subtract(overweight); // 剩余量
|
||||||
|
|
||||||
if (oldobj.getCustomerId() != null) {
|
if (oldobj.getCustomerId() != null) {
|
||||||
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(oldobj.getCustomerId());
|
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(oldobj.getCustomerId());
|
||||||
if (prepayCustomer == null) {
|
if (prepayCustomer == null) {
|
||||||
return Result.failed("不是预付费用户");
|
return Result.failed("不是预付费用户");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按客户查询未完成的订单量
|
// 客户在所有砂站的未完成的配额中,未执行完成的总金额
|
||||||
List<Record> undonlist = OrderclusterService.me.undonlist(oldobj.getCustomerId());
|
BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId());
|
||||||
|
BigDecimal plan_total_price;
|
||||||
if (undonlist != null && !undonlist.isEmpty()) {
|
if (model.getTotalWeight().compareTo(oldobj.getTotalWeight()) > 0) { // 修改后,比原来的大
|
||||||
BigDecimal plan_total_weight = model.getTotalWeight();
|
BigDecimal ofsset_weight = model.getTotalWeight().subtract(oldobj.getTotalWeight()); // 本次修改增加的重量
|
||||||
|
BigDecimal offset_total_price = ofsset_weight.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
|
||||||
for (Record record : undonlist) {
|
plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额
|
||||||
if (model.getId().equals(record.getInt("id"))) {
|
} else { // 修改后比原来的小
|
||||||
continue; // 当前修改的记录已经做为初始值了,不再累计
|
BigDecimal ofsset_weight = oldobj.getTotalWeight().subtract(model.getTotalWeight()); // 本次修改增加的重量
|
||||||
|
BigDecimal offset_total_price = ofsset_weight.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
|
||||||
|
plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额
|
||||||
}
|
}
|
||||||
|
|
||||||
// 累加总量
|
if (plan_total_price.compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||||
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
return Result.failedstr("共计总配额达 %.2f元,客户余额(%.2f元)不足", plan_total_price, prepayCustomer.getSurplus());
|
||||||
}
|
|
||||||
|
|
||||||
// 按客户统计已完成量
|
|
||||||
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(oldobj.getCustomerId()); // 按客户找集团订单已完成量
|
|
||||||
|
|
||||||
if (plan_total_weight.subtract(overweight).multiply(oldobj.getUnitPrice()).compareTo(prepayCustomer.getSurplus()) > 0) {
|
|
||||||
return Result.failedstr("计划总配额 %.2f,超过了客户余额(%.2f)", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量
|
|
||||||
|
|
||||||
if (model.getTotalWeight().compareTo(overweight) < 0) {
|
if (model.getTotalWeight().compareTo(overweight) < 0) {
|
||||||
return Result.failedstr("总量不能低于已运输量(%.2f)", overweight);
|
return Result.failedstr("总量不能低于已运输量(%.2f)", overweight);
|
||||||
|
|
@ -765,6 +755,9 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
if (model.getMiniTruck() != null) {
|
if (model.getMiniTruck() != null) {
|
||||||
oldobj.setMiniTruck(model.getMiniTruck());
|
oldobj.setMiniTruck(model.getMiniTruck());
|
||||||
}
|
}
|
||||||
|
if (model.getMaxTruck() != null) {
|
||||||
|
oldobj.setMaxTruck(model.getMaxTruck());
|
||||||
|
}
|
||||||
|
|
||||||
SyncTask synctask = new SyncTask();
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
|
|
@ -953,27 +946,10 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
return Result.failed("不是预付费用户");
|
return Result.failed("不是预付费用户");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按客户查询未完成的订单量
|
// 当前配额指定的客户、超市、品类对应的单价
|
||||||
List<Record> undonlist = OrderclusterService.me.undonlist(oldobj.getCustomerId());
|
BigDecimal unitprice = CustomerSupermarketProductService.me.getUnitPrice(oldobj.getCustomerId(), oldobj.getSupermarketId(), oldobj.getProductId());
|
||||||
|
if (unitprice == null) {
|
||||||
if (undonlist != null && !undonlist.isEmpty()) {
|
return Result.failed("未配置商品单价");
|
||||||
BigDecimal plan_total_weight = total_weight;
|
|
||||||
|
|
||||||
for (Record record : undonlist) {
|
|
||||||
if (oldobj.getId().equals(record.getInt("id"))) {
|
|
||||||
continue; // 当前修改的记录已经做为初始值了,不再累计
|
|
||||||
}
|
|
||||||
|
|
||||||
// 累加总量
|
|
||||||
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 按客户统计已完成量
|
|
||||||
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(oldobj.getCustomerId()); // 按客户找集团订单已完成量
|
|
||||||
|
|
||||||
if (plan_total_weight.subtract(overweight).multiply(oldobj.getUnitPrice()).compareTo(prepayCustomer.getSurplus()) > 0) {
|
|
||||||
return Result.failedstr("计划总配额 %.2f,超过了客户余额(%.2f)", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按客户统计已完成量
|
// 按客户统计已完成量
|
||||||
|
|
@ -991,13 +967,32 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
oldobj.setTotalWeight(over_weight.add(surplus_weight.subtract(total_weight))); // 结转不完的,要留下
|
oldobj.setTotalWeight(over_weight.add(surplus_weight.subtract(total_weight))); // 结转不完的,要留下
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 客户在所有砂站的未完成的配额中,未执行完成的总金额
|
||||||
|
BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId());
|
||||||
|
BigDecimal plan_total_price;
|
||||||
|
if (total_weight.compareTo(surplus_weight) > 0) { // 修改后,比原来的大
|
||||||
|
BigDecimal surplus_weight_1 = total_weight.subtract(surplus_weight); // 本次修改增加的重量
|
||||||
|
BigDecimal offset_total_price = surplus_weight_1.multiply(unitprice); // 本次修改增加的价格
|
||||||
|
plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额
|
||||||
|
} else { // 修改后比原来的小
|
||||||
|
BigDecimal surplus_weight_1 = surplus_weight.subtract(total_weight); // 本次修改增加的重量
|
||||||
|
BigDecimal offset_total_price = surplus_weight_1.multiply(unitprice); // 本次修改增加的价格
|
||||||
|
plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal availableBalance = RefundDetailService.me.getAvailableBalance(prepayCustomer.getCustomerId(), prepayCustomer.getSurplus());
|
||||||
|
|
||||||
|
if (plan_total_price.compareTo(availableBalance) > 0) {
|
||||||
|
return Result.failedstr("共计总配额达 %.2f元,客户可用余额(%.2f元)不足", plan_total_price, availableBalance);
|
||||||
|
}
|
||||||
|
|
||||||
List<OrderclusterTruck> octs = OrderclusterTruck.dao.find("select * from ordercluster_truck t where t.ordercluster_id = ?", ordercluster_id);
|
List<OrderclusterTruck> octs = OrderclusterTruck.dao.find("select * from ordercluster_truck t where t.ordercluster_id = ?", ordercluster_id);
|
||||||
|
|
||||||
if (!octs.isEmpty()) {
|
if (!octs.isEmpty()) {
|
||||||
// 已有车辆的,在结转前,需要将已经分配其他集团订单的车辆去掉
|
// 已有车辆的,在结转前,需要将已经分配其他集团订单的车辆去掉
|
||||||
List<Object> ts = new ArrayList<>();
|
List<Object> ts = new ArrayList<>();
|
||||||
List<String> tsql = new ArrayList<>();
|
List<String> tsql = new ArrayList<>();
|
||||||
Map<String, Integer> delmap = new HashMap<>();
|
Map<String, OrderclusterTruck> delmap = new HashMap<>();
|
||||||
|
|
||||||
// 检查提交上来的车辆字符串是否用重复的
|
// 检查提交上来的车辆字符串是否用重复的
|
||||||
for (int i = 0; i < octs.size(); i++) {
|
for (int i = 0; i < octs.size(); i++) {
|
||||||
|
|
@ -1005,7 +1000,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
ts.add(oct.getTruckLicense());
|
ts.add(oct.getTruckLicense());
|
||||||
tsql.add("?");
|
tsql.add("?");
|
||||||
|
|
||||||
delmap.put(oct.getTruckLicense(), i);
|
delmap.put(oct.getTruckLicense(), oct);
|
||||||
}
|
}
|
||||||
|
|
||||||
ts.add(0, cutoff_time); // 加到查询参数里面
|
ts.add(0, cutoff_time); // 加到查询参数里面
|
||||||
|
|
@ -1021,7 +1016,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
if (chkduk != null && !chkduk.isEmpty()) {
|
if (chkduk != null && !chkduk.isEmpty()) {
|
||||||
for (Record record : chkduk) {
|
for (Record record : chkduk) {
|
||||||
if (delmap.containsKey(record.getStr("truck_license"))) {
|
if (delmap.containsKey(record.getStr("truck_license"))) {
|
||||||
octs.remove(delmap.get(record.getStr("truck_license")).intValue());
|
octs.remove(delmap.get(record.getStr("truck_license")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1061,6 +1056,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
forwardoldobj[0] = oldobj.clone();
|
forwardoldobj[0] = oldobj.clone();
|
||||||
forwardoldobj[0].setId(null); // 等待数据库自增长
|
forwardoldobj[0].setId(null); // 等待数据库自增长
|
||||||
forwardoldobj[0].setUuid(StrKit.getRandomUUID());
|
forwardoldobj[0].setUuid(StrKit.getRandomUUID());
|
||||||
|
forwardoldobj[0].setUnitPrice(unitprice); // 用最新的单价更新
|
||||||
forwardoldobj[0].setTotalWeight(total_weight);
|
forwardoldobj[0].setTotalWeight(total_weight);
|
||||||
forwardoldobj[0].setCutoffTime(cutoff_time);
|
forwardoldobj[0].setCutoffTime(cutoff_time);
|
||||||
forwardoldobj[0].setCreateTime(now); // 当前系统时间
|
forwardoldobj[0].setCreateTime(now); // 当前系统时间
|
||||||
|
|
@ -1073,6 +1069,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
} else {
|
} else {
|
||||||
// 已有的,直接更新重量
|
// 已有的,直接更新重量
|
||||||
forwardoldobj[0].setTotalWeight(forwardoldobj[0].getTotalWeight().add(total_weight));
|
forwardoldobj[0].setTotalWeight(forwardoldobj[0].getTotalWeight().add(total_weight));
|
||||||
|
forwardoldobj[0].setUnitPrice(unitprice); // 用最新的单价更新
|
||||||
|
|
||||||
ret = forwardoldobj[0].update();
|
ret = forwardoldobj[0].update();
|
||||||
synctask.addUpdateData(forwardoldobj[0]);
|
synctask.addUpdateData(forwardoldobj[0]);
|
||||||
|
|
@ -1121,7 +1118,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
if (ret) {
|
if (ret) {
|
||||||
SyncTaskService.me.send(synctask);
|
SyncTaskService.me.send(synctask);
|
||||||
|
|
||||||
if (forwardoldobj[0] != null && !isAuto) {
|
if (forwardoldobj[0] != null && !isAuto && !Config.isDev()) {
|
||||||
SmsService.me.sendPeiE(forwardoldobj[0]);
|
SmsService.me.sendPeiE(forwardoldobj[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1151,6 +1148,12 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
return Result.failed("已经完结或者取消的,不能再修改");
|
return Result.failed("已经完结或者取消的,不能再修改");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 当前配额指定的客户、超市、品类对应的单价
|
||||||
|
BigDecimal unitprice = CustomerSupermarketProductService.me.getUnitPrice(oldobj.getCustomerId(), oldobj.getSupermarketId(), oldobj.getProductId());
|
||||||
|
if (unitprice == null) {
|
||||||
|
return Result.failed("未配置商品单价");
|
||||||
|
}
|
||||||
|
|
||||||
// 按客户统计已完成量
|
// 按客户统计已完成量
|
||||||
BigDecimal over_weight = OrderclusterService.me.getOverWeight(oldobj.getId()); // 按客户找集团订单已完成量
|
BigDecimal over_weight = OrderclusterService.me.getOverWeight(oldobj.getId()); // 按客户找集团订单已完成量
|
||||||
BigDecimal surplus_weight = oldobj.getTotalWeight().subtract(over_weight); // 剩余未完成量
|
BigDecimal surplus_weight = oldobj.getTotalWeight().subtract(over_weight); // 剩余未完成量
|
||||||
|
|
@ -1255,6 +1258,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
forwardoldobj = oldobj.clone();
|
forwardoldobj = oldobj.clone();
|
||||||
forwardoldobj.setId(null); // 等待数据库自增长
|
forwardoldobj.setId(null); // 等待数据库自增长
|
||||||
forwardoldobj.setUuid(StrKit.getRandomUUID());
|
forwardoldobj.setUuid(StrKit.getRandomUUID());
|
||||||
|
forwardoldobj.setUnitPrice(unitprice);
|
||||||
forwardoldobj.setTotalWeight(total_weight);
|
forwardoldobj.setTotalWeight(total_weight);
|
||||||
forwardoldobj.setCutoffTime(cutoff_time);
|
forwardoldobj.setCutoffTime(cutoff_time);
|
||||||
forwardoldobj.setCreateTime(now); // 当前系统时间
|
forwardoldobj.setCreateTime(now); // 当前系统时间
|
||||||
|
|
@ -1267,6 +1271,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
} else {
|
} else {
|
||||||
// 已有的,直接更新重量
|
// 已有的,直接更新重量
|
||||||
forwardoldobj.setTotalWeight(forwardoldobj.getTotalWeight().add(total_weight));
|
forwardoldobj.setTotalWeight(forwardoldobj.getTotalWeight().add(total_weight));
|
||||||
|
forwardoldobj.setUnitPrice(unitprice);
|
||||||
|
|
||||||
ret = forwardoldobj.update();
|
ret = forwardoldobj.update();
|
||||||
synctask.addUpdateData(forwardoldobj);
|
synctask.addUpdateData(forwardoldobj);
|
||||||
|
|
@ -1318,4 +1323,27 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
|
|
||||||
return ret ? Result.success() : Result.failed("操作失败");
|
return ret ? Result.success() : Result.failed("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取最大可购买重量
|
||||||
|
* @param customer_id 客户ID
|
||||||
|
* @param unit_price 单价
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map getMaximumConfiguration( int customer_id,String unit_price){
|
||||||
|
Map result=new HashMap();
|
||||||
|
Integer count = Db.queryInt("select count(distinct s.name) from ordercluster t \n" +
|
||||||
|
" join supermarket s on s.id = t.supermarket_id \n" +
|
||||||
|
" where t.state<5 and t.customer_id =?", customer_id);
|
||||||
|
result.put("count",count);
|
||||||
|
//当前用户如果只在一个沙场里面买沙,就计算最大可购买重量
|
||||||
|
if(count<=1){
|
||||||
|
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(customer_id);
|
||||||
|
BigDecimal availableBalance = RefundDetailService.me.getAvailableBalance(prepayCustomer.getCustomerId(), prepayCustomer.getSurplus());
|
||||||
|
BigDecimal maximumConfiguration=availableBalance.divide(new BigDecimal(unit_price),2,BigDecimal.ROUND_DOWN);
|
||||||
|
result.put("maximumConfiguration",maximumConfiguration);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ public class OrderTempController extends BaseController {
|
||||||
String sn = get("sn");
|
String sn = get("sn");
|
||||||
Integer state = getInt("state");
|
Integer state = getInt("state");
|
||||||
String invoice_code = get("invoice_code");
|
String invoice_code = get("invoice_code");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
Integer product_id = getInt("product_id");
|
Integer product_id = getInt("product_id");
|
||||||
Integer invoice_type = getInt("invoice_type");
|
Integer invoice_type = getInt("invoice_type");
|
||||||
Integer supermarket_id = getInt("supermarket_id");
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
|
@ -57,7 +58,7 @@ public class OrderTempController extends BaseController {
|
||||||
customer_id = tokenuser.getEntityId();
|
customer_id = tokenuser.getEntityId();
|
||||||
}
|
}
|
||||||
|
|
||||||
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)));
|
renderJson(Result.object(OrderTempService.me.find(pp, sn, truck_license, supermarket_id, customer_id, customer_name, stm, etm, isprepaid, state, invoice_code, invoice_type, ticket_code, product_id, invoice_code_is_null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before(StartAndEndIntervalValidator.class)
|
@Before(StartAndEndIntervalValidator.class)
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,31 @@ public class OrderTempSyncService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 开具过结算单的
|
||||||
|
if(order.getTicketCode() != null){
|
||||||
|
TicketLog ticketLog = TicketLog.dao.findFirst(
|
||||||
|
"select * from ticket_log t where ticket_code = ? limit 1 ",
|
||||||
|
order.getTicketCode());
|
||||||
|
|
||||||
|
if (ticketLog != null) {
|
||||||
|
ticketLog.setInvalidUserId(sysuser.getId());
|
||||||
|
ticketLog.setInvalidUserName(sysuser.getName());
|
||||||
|
ticketLog.setInvalidTime(new Date());
|
||||||
|
ticketLog.setInvalidMemo(invalid_memo);
|
||||||
|
ticketLog.setState(OrderStateEnum.INVALID.getStateid());
|
||||||
|
|
||||||
|
ret = ticketLog.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addUpdateData(ticketLog);
|
||||||
|
} else {
|
||||||
|
log.error("订单[%s]没有找到结算单记录", order.getSn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 是预付费订单
|
// 是预付费订单
|
||||||
if (order.getIsprepaid() == 1 && order.getCustomerId() != null) {
|
if (order.getIsprepaid() == 1 && order.getCustomerId() != null) {
|
||||||
Customer customer = Customer.dao.findById(order.getCustomerId());
|
Customer customer = Customer.dao.findById(order.getCustomerId());
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,8 @@ public class PrepayController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer supermarket_id = getInt("supermarket_id");
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
Integer invoice_type = getInt("invoice_type");
|
||||||
|
|
||||||
String stm = get("stm");
|
String stm = get("stm");
|
||||||
String etm = get("etm");
|
String etm = get("etm");
|
||||||
String truck_license = get("truck_license");
|
String truck_license = get("truck_license");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.cowr.service.ssjygl.prepay.prepaycustomer;
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CustomerIdValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
public class PrepayCustomerController extends Controller {
|
||||||
|
|
||||||
|
@Before(CustomerIdValidator.class)
|
||||||
|
public void pushPrepayCustomer() {
|
||||||
|
renderJson(Result.object(PrepayCustomerSyncService.me.pushPrepayCustomer(getInt("customer_id"))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,28 @@
|
||||||
package com.cowr.service.ssjygl.prepay.prepaycustomer;
|
package com.cowr.service.ssjygl.prepay.prepaycustomer;
|
||||||
|
|
||||||
public class PrepayCustomerSyncService {
|
import com.cowr.model.PrepayCustomer;
|
||||||
|
import com.cowr.model.SyncTask;
|
||||||
|
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||||
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
|
|
||||||
|
public class PrepayCustomerSyncService extends BaseSyncService {
|
||||||
|
public static PrepayCustomerSyncService me = new PrepayCustomerSyncService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将服务端的客户预付费信息推送到客户端
|
||||||
|
*
|
||||||
|
* @param customer_id
|
||||||
|
*/
|
||||||
|
public boolean pushPrepayCustomer(Integer customer_id) {
|
||||||
|
PrepayCustomer prepayCustomer = PrepayCustomer.dao.findFirst("select * from prepay_customer where customer_id = ? ", customer_id);
|
||||||
|
|
||||||
|
if (prepayCustomer == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.addUpdateData(prepayCustomer);
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,10 @@ public class PrepayDetailSyncService extends BaseSyncService {
|
||||||
return Result.failed("按客户 id 未找到对应客户信息");
|
return Result.failed("按客户 id 未找到对应客户信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.checkDuplicate("serialnum")) {
|
PrepayDetail chk = PrepayDetail.dao.findFirst("select * from prepay_detail t where t.serialnum = ? and t.state < 9 limit 1", model.getSerialnum());
|
||||||
return Result.failedstr("流水号【%s】已存在", model.getSerialnum());
|
|
||||||
|
if (chk != null) {
|
||||||
|
return Result.failedstr("流水号【%s】已使用", model.getSerialnum());
|
||||||
}
|
}
|
||||||
|
|
||||||
model.setId(StrKit.getRandomUUID());
|
model.setId(StrKit.getRandomUUID());
|
||||||
|
|
@ -90,7 +92,7 @@ public class PrepayDetailSyncService extends BaseSyncService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Result verify(String id, int state, String memo, Sysuser user) {
|
public Result verify(String id, int state, String memo, Sysuser user) {
|
||||||
if (!SysuserSyncService.me.isPresident(user.getRole())) { // 总经理审核预付费
|
if (!SysuserSyncService.me.isFinanceManager(user.getRole())) { // 财务经理审核预付费
|
||||||
return Result.permissionDenied();
|
return Result.permissionDenied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,23 @@ import com.cowr.common.enums.Enums;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.model.*;
|
import com.cowr.model.*;
|
||||||
import com.cowr.service.ssjygl.base.BaseSyncService;
|
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||||
|
import com.cowr.service.ssjygl.order.ordercluster.OrderclusterSyncService;
|
||||||
import com.cowr.service.ssjygl.sms.log.SmsService;
|
import com.cowr.service.ssjygl.sms.log.SmsService;
|
||||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||||
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||||
|
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||||
import com.cowr.ssjygl.prepay.prepaycustomer.PrepayCustomerService;
|
import com.cowr.ssjygl.prepay.prepaycustomer.PrepayCustomerService;
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
import com.jfinal.plugin.activerecord.IAtom;
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class RefundDetailSyncService extends BaseSyncService {
|
public class RefundDetailSyncService extends BaseSyncService {
|
||||||
public static RefundDetailSyncService me = new RefundDetailSyncService();
|
public static RefundDetailSyncService me = new RefundDetailSyncService();
|
||||||
|
|
@ -32,7 +36,8 @@ public class RefundDetailSyncService extends BaseSyncService {
|
||||||
if (customer == null) {
|
if (customer == null) {
|
||||||
return Result.failed("按客户 id 未找到对应客户信息");
|
return Result.failed("按客户 id 未找到对应客户信息");
|
||||||
}
|
}
|
||||||
|
//取消订单
|
||||||
|
cancelOrder( customer_id, user);
|
||||||
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(customer.getId());
|
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(customer.getId());
|
||||||
|
|
||||||
if (prepayCustomer == null) {
|
if (prepayCustomer == null) {
|
||||||
|
|
@ -95,6 +100,21 @@ public class RefundDetailSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消订单
|
||||||
|
* @param customer_id
|
||||||
|
*/
|
||||||
|
public void cancelOrder(Integer customer_id,Sysuser user){
|
||||||
|
List<Record> recordList = OrderclusterService.me.getUncompletedOrdersFromUsers(customer_id);
|
||||||
|
if (recordList!=null && !recordList.isEmpty()) {
|
||||||
|
for (Record record : recordList) {
|
||||||
|
Integer id = record.getInt("id");
|
||||||
|
OrderclusterSyncService.me.complete(id, user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核退费记录
|
* 审核退费记录
|
||||||
* 审核通过后,才由财务退款,财务退款后,才更新客户余额
|
* 审核通过后,才由财务退款,财务退款后,才更新客户余额
|
||||||
|
|
@ -106,7 +126,7 @@ public class RefundDetailSyncService extends BaseSyncService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Result verify(String id, int state, String memo, Sysuser user) {
|
public Result verify(String id, int state, String memo, Sysuser user) {
|
||||||
if (!SysuserSyncService.me.isPresident(user.getRole())) { // 总经理审核退费
|
if (!SysuserSyncService.me.isFinanceManager(user.getRole())) { // 财务审核退费
|
||||||
return Result.permissionDenied();
|
return Result.permissionDenied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,11 @@ import com.cowr.model.Sysuser;
|
||||||
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||||
import com.cowr.ssjygl.stat.sale.OrderStatService;
|
import com.cowr.ssjygl.stat.sale.OrderStatService;
|
||||||
import com.jfinal.aop.Before;
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class OrderStatController extends BaseController {
|
public class OrderStatController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -175,12 +178,13 @@ public class OrderStatController extends BaseController {
|
||||||
@Before(MonthValidator.class)
|
@Before(MonthValidator.class)
|
||||||
public void mdstat() {
|
public void mdstat() {
|
||||||
String tm = get("tm");
|
String tm = get("tm");
|
||||||
|
Integer supermarket_id=getInt("supermarket_id");
|
||||||
int export = getInt("export", 0);
|
int export = getInt("export", 0);
|
||||||
|
|
||||||
if (export == 0) {
|
if (export == 0) {
|
||||||
renderJson(Result.object(OrderStatService.me.mdstat(tm)));
|
renderJson(Result.object(OrderStatService.me.mdstat(tm,supermarket_id)));
|
||||||
} else {
|
} else {
|
||||||
Workbook wb = OrderStatService.me.mdstatExport(tm);
|
Workbook wb = OrderStatService.me.mdstatExport(tm,supermarket_id);
|
||||||
render(new ExcelRender(tm + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
render(new ExcelRender(tm + "_销售月逐日统计_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -391,4 +395,20 @@ public class OrderStatController extends BaseController {
|
||||||
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
render(new ExcelRender("按砂站总销售汇总表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 各砂站运输量统计表
|
||||||
|
*/
|
||||||
|
public void trafficStatisticsOfEachSandStation(){
|
||||||
|
String stm=get("stm");
|
||||||
|
String etm=get("etm");
|
||||||
|
Integer invoice_type=getInt("invoice_type");
|
||||||
|
int export = getInt("export", 0); // 是否导出为exce 0 不导出,1 导出
|
||||||
|
if (export == 0) {
|
||||||
|
renderJson(Result.object(OrderStatService.me.trafficStatisticsOfEachSandStation(stm, etm,invoice_type)));
|
||||||
|
}else {
|
||||||
|
Workbook wb = OrderStatService.me.trafficStatisticsOfEachSandStationExport(stm, etm,invoice_type);
|
||||||
|
render(new ExcelRender("各砂站运输量统计表_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.cowr.service.ssjygl.supermarket;
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
public class SupEditProductValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateRequired("supermarket_id", "supermarket_id", "supermarket_id 必填");
|
||||||
|
validateRequired("product_id", "product_id", "product_id 必填");
|
||||||
|
validateRequired("unit_price", "unit_price", "unit_price 必填");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -125,4 +125,21 @@ public class SupermarketController extends BaseController {
|
||||||
|
|
||||||
renderJson(SupermarketSyncService.me.removeProduct(supermarket_id, product_id, tokenuser));
|
renderJson(SupermarketSyncService.me.removeProduct(supermarket_id, product_id, tokenuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Before(SupEditProductValidator.class)
|
||||||
|
public void editUnitPrice() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int supermarket_id = getInt("supermarket_id");
|
||||||
|
int product_id = getInt("product_id");
|
||||||
|
Double unit_price = getParaToDouble("unit_price");
|
||||||
|
renderJson(SupermarketSyncService.me.editUnitPrice(supermarket_id, product_id,unit_price, tokenuser));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.cowr.service.ssjygl.supermarket;
|
package com.cowr.service.ssjygl.supermarket;
|
||||||
|
|
||||||
|
import com.cowr.common.base.BaseModel;
|
||||||
import com.cowr.common.enums.Enums;
|
import com.cowr.common.enums.Enums;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.model.*;
|
import com.cowr.model.*;
|
||||||
|
|
@ -14,6 +15,7 @@ import com.jfinal.plugin.activerecord.IAtom;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class SupermarketSyncService extends BaseSyncService {
|
public class SupermarketSyncService extends BaseSyncService {
|
||||||
private static Log log = Log.getLog(SupermarketSyncService.class);
|
private static Log log = Log.getLog(SupermarketSyncService.class);
|
||||||
|
|
@ -150,4 +152,74 @@ public class SupermarketSyncService extends BaseSyncService {
|
||||||
|
|
||||||
return Result.object(ret);
|
return Result.object(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Result editUnitPrice(int supermarket_id, int product_id,Double unit_price, Sysuser sysuser) {
|
||||||
|
SupermarketProduct sp = SupermarketProduct.dao.findByIds(supermarket_id, product_id);
|
||||||
|
BaseModel saveold = (BaseModel) sp.clone();
|
||||||
|
if (sp == null) {
|
||||||
|
return Result.failed("商品配置信息不存在");
|
||||||
|
}
|
||||||
|
if(unit_price==null ||unit_price<=0){
|
||||||
|
return Result.failed("商品单价不能小于0");
|
||||||
|
}
|
||||||
|
sp.setUnitPrice(BigDecimal.valueOf(unit_price));
|
||||||
|
String sql="select t.* from ordercluster t where t.state<5 and t.supermarket_id=? and product_id=? " +
|
||||||
|
"and t.id not in (select b.id from customer_supermarket_product a," +
|
||||||
|
"ordercluster b where a.customer_id=b.customer_id and a.supermarket_id=b.supermarket_id and a.product_id=b.product_id)";
|
||||||
|
List<Ordercluster> orderclusterList=Ordercluster.dao.find(sql,supermarket_id, product_id);
|
||||||
|
Map<Integer, SyncTask> map = new HashMap<>();
|
||||||
|
if (orderclusterList!=null &&!orderclusterList.isEmpty()) {
|
||||||
|
for (Ordercluster ordercluster : orderclusterList) {
|
||||||
|
ordercluster.setUnitPrice(BigDecimal.valueOf(unit_price));
|
||||||
|
if (!map.containsKey(ordercluster.getId())) {
|
||||||
|
map.put(ordercluster.getSupermarketId(), new SyncTask());
|
||||||
|
}
|
||||||
|
map.get(ordercluster.getSupermarketId()).addUpdateData(ordercluster);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = true;
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.addUpdateData(sp);
|
||||||
|
|
||||||
|
Stock stock = Stock.dao.findByIds(supermarket_id, product_id);
|
||||||
|
|
||||||
|
if (stock != null) {
|
||||||
|
stock.setStockWeight(new BigDecimal(0));
|
||||||
|
synctask.addUpdateData(stock);
|
||||||
|
|
||||||
|
ret = stock.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orderclusterList!=null &&!orderclusterList.isEmpty()) {
|
||||||
|
int[] editret = Db.batchUpdate(orderclusterList, orderclusterList.size());
|
||||||
|
for (int i : editret) {
|
||||||
|
// 必须是每条 sql 修改一条记录
|
||||||
|
if (i != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 将单价同步到不同的砂站
|
||||||
|
for (Map.Entry<Integer, SyncTask> entry : map.entrySet()) {
|
||||||
|
if (!SyncTaskService.me.save(entry.getValue(), entry.getKey())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret && sp.update()
|
||||||
|
&& SyncTaskService.me.save(synctask)
|
||||||
|
&& ModifyLogService.me.save(sp, saveold, Enums.DataOpType.UPDATE.getId(), sysuser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Result.object(ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.cowr.model.*;
|
||||||
import com.cowr.service.ssjygl.main.Config;
|
import com.cowr.service.ssjygl.main.Config;
|
||||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
import com.cowr.ssjygl.CacheData;
|
import com.cowr.ssjygl.CacheData;
|
||||||
|
import com.cowr.ssjygl.blacklist.BlacklistService;
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
|
@ -270,6 +271,8 @@ public class SyncTaskService {
|
||||||
try {
|
try {
|
||||||
JSONArray saveauthlics = new JSONArray(); // 授权车牌号需要推送更新到其他砂站
|
JSONArray saveauthlics = new JSONArray(); // 授权车牌号需要推送更新到其他砂站
|
||||||
JSONArray deleteauthlics = new JSONArray();
|
JSONArray deleteauthlics = new JSONArray();
|
||||||
|
List<SyncTask> sts = new ArrayList<>();
|
||||||
|
Date now = new Date();
|
||||||
|
|
||||||
if (save_data != null && !save_data.isEmpty()) {
|
if (save_data != null && !save_data.isEmpty()) {
|
||||||
for (String tablename : save_data.keySet()) {
|
for (String tablename : save_data.keySet()) {
|
||||||
|
|
@ -283,10 +286,38 @@ public class SyncTaskService {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.setCreateTime(now);
|
||||||
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
JSONObject obj = arr.getJSONObject(i);
|
JSONObject obj = arr.getJSONObject(i);
|
||||||
|
|
||||||
list.add(new Record().setColumns(obj.getInnerMap()));
|
list.add(new Record().setColumns(obj.getInnerMap()));
|
||||||
|
|
||||||
|
// 分发黑名单
|
||||||
|
if (Blacklist.dao.getTablename().equals(tablename)) {
|
||||||
|
synctask.addSaveData(BlacklistService.me.json2model(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分发黑名单
|
||||||
|
if (Blacklist.dao.getTablename().equals(tablename)) {
|
||||||
|
for (Map.Entry<Integer, Supermarket> entry : SvrCacheData.SUP_CACHE.entrySet()) {
|
||||||
|
Supermarket supermarket = entry.getValue();
|
||||||
|
|
||||||
|
// 只对已经部署了客户端的砂站同步数据
|
||||||
|
// 从下面上报的数据,再广播出去
|
||||||
|
if (supermarket.getIsdeploy() == 0 || supermarket.getId() == current_supermarket_id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncTask newsynctask = synctask.clone();
|
||||||
|
newsynctask.setId(StrKit.getRandomUUID());
|
||||||
|
newsynctask.setSupermarketId(supermarket.getId());
|
||||||
|
newsynctask.setJson();
|
||||||
|
|
||||||
|
sts.add(newsynctask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] ret = Db.batchSave(tablename, list, list.size());
|
int[] ret = Db.batchSave(tablename, list, list.size());
|
||||||
|
|
@ -320,10 +351,38 @@ public class SyncTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.setCreateTime(now);
|
||||||
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
JSONObject obj = arr.getJSONObject(i);
|
JSONObject obj = arr.getJSONObject(i);
|
||||||
|
|
||||||
list.add(new Record().setColumns(obj.getInnerMap()));
|
list.add(new Record().setColumns(obj.getInnerMap()));
|
||||||
|
|
||||||
|
// 分发黑名单
|
||||||
|
if (Blacklist.dao.getTablename().equals(tablename)) {
|
||||||
|
synctask.addUpdateData(BlacklistService.me.json2model(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分发黑名单
|
||||||
|
if (Blacklist.dao.getTablename().equals(tablename)) {
|
||||||
|
for (Map.Entry<Integer, Supermarket> entry : SvrCacheData.SUP_CACHE.entrySet()) {
|
||||||
|
Supermarket supermarket = entry.getValue();
|
||||||
|
|
||||||
|
// 只对已经部署了客户端的砂站同步数据
|
||||||
|
// 从下面上报的数据,再广播出去
|
||||||
|
if (supermarket.getIsdeploy() == 0 || supermarket.getId() == current_supermarket_id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncTask newsynctask = synctask.clone();
|
||||||
|
newsynctask.setId(StrKit.getRandomUUID());
|
||||||
|
newsynctask.setSupermarketId(supermarket.getId());
|
||||||
|
newsynctask.setJson();
|
||||||
|
|
||||||
|
sts.add(newsynctask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] ret = Db.batchUpdate(tablename, pks, list, list.size());
|
int[] ret = Db.batchUpdate(tablename, pks, list, list.size());
|
||||||
|
|
@ -368,8 +427,6 @@ public class SyncTaskService {
|
||||||
// 对指定表的固定字段进行 增加或者减少
|
// 对指定表的固定字段进行 增加或者减少
|
||||||
// 2020-10-10 只在修改 PrepayCustomer 中的余额时需要用到
|
// 2020-10-10 只在修改 PrepayCustomer 中的余额时需要用到
|
||||||
if (increment_data != null && !increment_data.isEmpty()) {
|
if (increment_data != null && !increment_data.isEmpty()) {
|
||||||
List<SyncTask> sts = new ArrayList<>();
|
|
||||||
Date now = new Date();
|
|
||||||
|
|
||||||
for (String tablename : increment_data.keySet()) {
|
for (String tablename : increment_data.keySet()) {
|
||||||
JSONObject data = increment_data.getJSONObject(tablename);
|
JSONObject data = increment_data.getJSONObject(tablename);
|
||||||
|
|
@ -429,9 +486,11 @@ public class SyncTaskService {
|
||||||
synctask.setIncrementData(recvdata.getString("increment_data"));
|
synctask.setIncrementData(recvdata.getString("increment_data"));
|
||||||
synctask.setSupermarketId(supermarket.getId());
|
synctask.setSupermarketId(supermarket.getId());
|
||||||
synctask.setCreateTime(now);
|
synctask.setCreateTime(now);
|
||||||
|
synctask.setJson();
|
||||||
|
|
||||||
sts.add(synctask);
|
sts.add(synctask);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!sts.isEmpty()) {
|
if (!sts.isEmpty()) {
|
||||||
int[] ret = Db.batchSave(sts, sts.size());
|
int[] ret = Db.batchSave(sts, sts.size());
|
||||||
|
|
@ -447,7 +506,6 @@ public class SyncTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!saveauthlics.isEmpty() || !deleteauthlics.isEmpty()) {
|
if (!saveauthlics.isEmpty() || !deleteauthlics.isEmpty()) {
|
||||||
return recvAuthLicense(saveauthlics, deleteauthlics, current_supermarket_id);
|
return recvAuthLicense(saveauthlics, deleteauthlics, current_supermarket_id);
|
||||||
|
|
@ -505,6 +563,12 @@ public class SyncTaskService {
|
||||||
synctask.setDeleteData(JSONObject.toJSONString(new JSONObject().put(AuthLicense.dao.getTablename(), deletearr)));
|
synctask.setDeleteData(JSONObject.toJSONString(new JSONObject().put(AuthLicense.dao.getTablename(), deletearr)));
|
||||||
synctask.setSupermarketId(supermarket.getId());
|
synctask.setSupermarketId(supermarket.getId());
|
||||||
synctask.setCreateTime(now);
|
synctask.setCreateTime(now);
|
||||||
|
synctask.setJson();
|
||||||
|
|
||||||
|
// 这里好像存在一个奇怪的bug
|
||||||
|
if (!StrKit.notBlank(synctask.getSaveData(), synctask.getDeleteData())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
sts.add(synctask);
|
sts.add(synctask);
|
||||||
}
|
}
|
||||||
|
|
@ -522,6 +586,7 @@ public class SyncTaskService {
|
||||||
* 过滤 transport 的数据更新
|
* 过滤 transport 的数据更新
|
||||||
* 1.如果传上来的数据中 state 是 5 ,表示记录已完成,可以直接更新
|
* 1.如果传上来的数据中 state 是 5 ,表示记录已完成,可以直接更新
|
||||||
* 2.如果传上来的数据中 state 不是 5,就需要查询数据库,看看数据库中是不是已经是 5 了,避免 state 被回退更新
|
* 2.如果传上来的数据中 state 不是 5,就需要查询数据库,看看数据库中是不是已经是 5 了,避免 state 被回退更新
|
||||||
|
*
|
||||||
* @param arr
|
* @param arr
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,17 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
return roleid.equals(RoleEnum.TRANCOADMIN.getRoleid());
|
return roleid.equals(RoleEnum.TRANCOADMIN.getRoleid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否财务经理
|
||||||
|
* 预付费审批、退费审批
|
||||||
|
* @param roleid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isFinanceManager(Integer roleid){
|
||||||
|
if (roleid == null) return false;
|
||||||
|
return roleid.equals(RoleEnum.FINANCEMANAGER.getRoleid());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是司机
|
* 是否是司机
|
||||||
*
|
*
|
||||||
|
|
@ -237,6 +248,7 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
&& !isConfigAdmin(model.getRole())
|
&& !isConfigAdmin(model.getRole())
|
||||||
&& !isChaisha(model.getRole())
|
&& !isChaisha(model.getRole())
|
||||||
&& !isPresidentView(model.getRole())
|
&& !isPresidentView(model.getRole())
|
||||||
|
&& !isFinanceManager(model.getRole())
|
||||||
) {
|
) {
|
||||||
// 不是财务、经理、采砂局的时候,按照原来的规则检查
|
// 不是财务、经理、采砂局的时候,按照原来的规则检查
|
||||||
if (checkEntityId(model) == null) {
|
if (checkEntityId(model) == null) {
|
||||||
|
|
@ -755,6 +767,7 @@ public class SysuserSyncService extends BaseSyncService {
|
||||||
&& !isTreasurer(sysuser.getRole())
|
&& !isTreasurer(sysuser.getRole())
|
||||||
&& !isCustomer(sysuser.getRole())
|
&& !isCustomer(sysuser.getRole())
|
||||||
&& !isChaisha(sysuser.getRole())
|
&& !isChaisha(sysuser.getRole())
|
||||||
|
&& !isFinanceManager(sysuser.getRole())
|
||||||
) {
|
) {
|
||||||
return Result.permissionDenied();
|
return Result.permissionDenied();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.cowr.service.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.Sysuser;
|
||||||
|
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||||
|
import com.cowr.ssjygl.ticket.invalidverify.TicketInvalidVerifyService;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
public class TicketInvalidVerifyController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查找 ticket_invalid_verify 结算单管理 - 结算单作废申请
|
||||||
|
*/
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
String order_sn = get("order_sn");
|
||||||
|
String create_user_name = get("create_user_name");
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
Integer state = getInt("state");
|
||||||
|
|
||||||
|
renderJson(Result.object(TicketInvalidVerifyService.me.find(pp, stm, etm, ticket_code, order_sn, create_user_name, supermarket_id, state)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before(TicketInvalidVerifyValidator.class)
|
||||||
|
public void verify() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能审核
|
||||||
|
renderJson(Result.permissionDenied());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = get("id");
|
||||||
|
int state = getInt("state", 0);
|
||||||
|
String memo = get("memo");
|
||||||
|
|
||||||
|
renderJson(TicketInvalidVerifySyncService.me.verify(id, state, memo, tokenuser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,198 @@
|
||||||
|
package com.cowr.service.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.enums.OrderStateEnum;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.*;
|
||||||
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TicketInvalidVerifySyncService {
|
||||||
|
private static Log log = Log.getLog(TicketInvalidVerifySyncService.class);
|
||||||
|
public static TicketInvalidVerifySyncService me = new TicketInvalidVerifySyncService();
|
||||||
|
|
||||||
|
public Result verify(String id, int state, String memo, Sysuser user) {
|
||||||
|
if (state != 2 && state != 9) {
|
||||||
|
return Result.failed("state 值错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketInvalidVerify model = TicketInvalidVerify.dao.findById(id);
|
||||||
|
|
||||||
|
if (model == null) {
|
||||||
|
return Result.failed("没有找到申请记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.getState() == 9) {
|
||||||
|
return Result.failed("申请已作废");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.getState() == state) {
|
||||||
|
return Result.failed("状态值没有变化");
|
||||||
|
}
|
||||||
|
|
||||||
|
model.setVerifyUserId(user.getId());
|
||||||
|
model.setVerifyUserName(user.getName());
|
||||||
|
model.setMemo(memo);
|
||||||
|
model.setState(state);
|
||||||
|
|
||||||
|
if (state == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return notPass(model);
|
||||||
|
} else if (state == 2) {
|
||||||
|
return pass(model, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.failed("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Result pass(TicketInvalidVerify model, Sysuser sysuser) {
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.addUpdateData(model);
|
||||||
|
|
||||||
|
// 先判断这张结算单有没有被领用
|
||||||
|
TicketReceive receive = TicketReceiveService.me.checkReceive(model.getSupermarketId(), model.getTicketCode());
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLog.dao.findFirst("select * from ticket_log t \n" +
|
||||||
|
" where t.ticket_code = ? limit 1 ", model.getTicketCode());
|
||||||
|
|
||||||
|
// 又多个地方可以修改 TicketLog 在同意之前,要先确认结算单是否已经取消
|
||||||
|
if (ticketLog != null) {
|
||||||
|
if (ticketLog.getState() == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return Result.failed("结算单已作废");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ticketLog = new TicketLog();
|
||||||
|
|
||||||
|
// 作废结算单时,结算单还没有使用,才需要去处理结算单领用记录里面的当前结算单号码
|
||||||
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
|
||||||
|
if (receive.getSurplus() == 0) {
|
||||||
|
// 作废最后一张结算单,当前结算单停再最后一个结算单号码上
|
||||||
|
receive.setCurrentCode(receive.getEndCode());
|
||||||
|
} else {
|
||||||
|
if (model.getTicketCode().equals(receive.getStartCode())) { // 作废第一张结算单
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getStartCode()) + 1));
|
||||||
|
} else if (model.getTicketCode().equals(receive.getCurrentCode())) { // 作废顺延的下一张结算单
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getCurrentCode()) + 1));
|
||||||
|
} else {
|
||||||
|
// 其他情况下不更新 current_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ticketLog.setInvalidUserId(sysuser.getId());
|
||||||
|
ticketLog.setInvalidUserName(sysuser.getName());
|
||||||
|
ticketLog.setInvalidTime(new Date());
|
||||||
|
ticketLog.setInvalidMemo(model.getInvalidMemo());
|
||||||
|
ticketLog.setState(OrderStateEnum.INVALID.getStateid());
|
||||||
|
ticketLog.setTicketCode(model.getTicketCode());
|
||||||
|
|
||||||
|
receive.setInvalidCount(receive.getInvalidCount() + 1); // 每次作废,作废数量加 1
|
||||||
|
synctask.addUpdateData(receive); // 更新领用记录
|
||||||
|
|
||||||
|
OrderTemp order = null;
|
||||||
|
|
||||||
|
if (StrKit.notBlank(model.getOrderSn())) {
|
||||||
|
order = OrderTemp.dao.findById(model.getOrderSn());
|
||||||
|
|
||||||
|
if (order == null) {
|
||||||
|
return Result.failedstr("按 %s 没有找到订单信息", model.getOrderSn());
|
||||||
|
}
|
||||||
|
|
||||||
|
order.setTicketCode(null);
|
||||||
|
|
||||||
|
synctask.addUpdateData(order); // 关联了订单的,要更新订单信息,清除开票信息
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog finalTicketLog = ticketLog;
|
||||||
|
OrderTemp finalOrder = order;
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = model.update() && receive.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalTicketLog.getId() == null) { // 结算单还没有使用,是新增使用日志
|
||||||
|
finalTicketLog.setId(StrKit.getRandomUUID());
|
||||||
|
finalTicketLog.setTicketReceiveId(model.getTicketReceiveId());
|
||||||
|
|
||||||
|
synctask.addSaveData(finalTicketLog);
|
||||||
|
|
||||||
|
ret = finalTicketLog.save();
|
||||||
|
} else { // 结算单已经使用的,有使用日志的,需要更新
|
||||||
|
synctask.addUpdateData(finalTicketLog);
|
||||||
|
|
||||||
|
ret = finalTicketLog.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(finalOrder != null){
|
||||||
|
ret = finalOrder.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask, model.getSupermarketId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 普票作废理解同步到砂站
|
||||||
|
if (ret) {
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret ? Result.success(model) : Result.failed(false, "处理失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Result notPass(TicketInvalidVerify model) {
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = model.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addUpdateData(model);
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask, model.getSupermarketId());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret ? Result.success() : Result.failed("修改失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.cowr.service.ssjygl.ticket.invalidverify;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Mon Feb 10 12:11:03 CST 2020
|
||||||
|
* TableName: prepay_detail
|
||||||
|
* Remarks: 预付费客户付费详情
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketInvalidVerifyValidator extends CrudParamValidator {
|
||||||
|
private static List<Integer> chkstate = new ArrayList<Integer>() {{
|
||||||
|
add(2);
|
||||||
|
add(9);
|
||||||
|
}};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateString("id", 32, 32, "id", "id 长度 32,必填");
|
||||||
|
validateInIntegerArray("state", chkstate, "state", "state 可选值 2、9");
|
||||||
|
validateString("memo", 0, 255, "memo", "memo 长度 0~255");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
package com.cowr.service.ssjygl.ticket.log;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import com.cowr.model.TicketLog;
|
||||||
|
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||||
|
import com.cowr.ssjygl.ticket.log.TicketLogPKValidator;
|
||||||
|
import com.cowr.ssjygl.ticket.log.TicketLogService;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Thu Aug 13 23:09:29 CST 2020
|
||||||
|
* TableName: ticket_log
|
||||||
|
* Remarks: 结算单管理 - 结算单使用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketLogController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键检查对象是否存在
|
||||||
|
* 返回 code = 200
|
||||||
|
* 存在时 data = true
|
||||||
|
* 不存在 data = false
|
||||||
|
*/
|
||||||
|
@Before(TicketLogPKValidator.class)
|
||||||
|
public void checkExistsByPk() {
|
||||||
|
TicketLog model = getModel(TicketLog.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketLogService.me.checkExistsByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查找 ticket_log 结算单管理 - 结算单使用记录
|
||||||
|
*/
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
Integer state = getInt("state");
|
||||||
|
String order_sn = get("order_sn");
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
renderJson(Result.object(TicketLogService.me.find(pp, supermarket_id, state, order_sn, stm, etm, ticket_code)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before(StartAndEndIntervalValidator.class)
|
||||||
|
public void export() {
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
Integer state = getInt("state");
|
||||||
|
String order_sn = get("order_sn");
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
|
||||||
|
Workbook wb = TicketLogService.me.export(supermarket_id, state, order_sn, stm, etm, ticket_code);
|
||||||
|
|
||||||
|
render(new ExcelRender("结算单使用日志_" + System.currentTimeMillis() + ".xlsx", wb));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查找单个对象 ticket_log 结算单管理 - 结算单使用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketLogPKValidator.class)
|
||||||
|
public void findByPk() {
|
||||||
|
TicketLog model = getModel(TicketLog.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketLogService.me.findByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查找单个对象 ticket_log 结算单管理 - 结算单使用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketLogPKValidator.class)
|
||||||
|
public void get() {
|
||||||
|
TicketLog model = getModel(TicketLog.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketLogService.me.findByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void invalid() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能作废结算单
|
||||||
|
renderJson(Result.permissionDenied());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer supermarket_id = getInt("supermarket_id", 0);
|
||||||
|
String ticket_code = get("ticket_code");
|
||||||
|
String invalid_memo = get("invalid_memo");
|
||||||
|
|
||||||
|
renderJson(TicketLogSyncService.me.invalid(supermarket_id, ticket_code, invalid_memo, tokenuser));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancel() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能作废结算单
|
||||||
|
renderJson(Result.permissionDenied());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = get("id");
|
||||||
|
String invalid_memo = get("invalid_memo");
|
||||||
|
|
||||||
|
renderJson(TicketLogSyncService.me.cancel(id, invalid_memo, tokenuser));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelByCode() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能作废结算单
|
||||||
|
renderJson(Result.permissionDenied());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String ticket_code = get("code");
|
||||||
|
String invalid_memo = get("invalid_memo");
|
||||||
|
|
||||||
|
renderJson(TicketLogSyncService.me.cancelByCode(ticket_code, invalid_memo, tokenuser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,267 @@
|
||||||
|
package com.cowr.service.ssjygl.ticket.log;
|
||||||
|
|
||||||
|
import com.cowr.common.enums.Enums;
|
||||||
|
import com.cowr.common.enums.OrderStateEnum;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.*;
|
||||||
|
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||||
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
|
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class TicketLogSyncService extends BaseSyncService {
|
||||||
|
private static Log log = Log.getLog(TicketLogSyncService.class);
|
||||||
|
public static TicketLogSyncService me = new TicketLogSyncService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作废结算单,未关联订单的(损毁等,不是正常开票使用的结算单)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Result invalid(int supermarket_id, String ticket_code, String invalid_memo, Sysuser sysuser) {
|
||||||
|
Supermarket supermarket = Supermarket.dao.findById(supermarket_id);
|
||||||
|
|
||||||
|
if (supermarket == null) {
|
||||||
|
return Result.failed("未找到砂站信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先判断这张结算单有没有被领用
|
||||||
|
TicketReceive receive = TicketReceiveService.me.checkSurplusReceive(supermarket_id, ticket_code);
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的结算单领用记录,或者结算单已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketLog ticketLog = TicketLog.dao.findFirst("select * from ticket_log t \n" +
|
||||||
|
" where t.ticket_code = ? limit 1 ", ticket_code);
|
||||||
|
|
||||||
|
if (ticketLog != null) {
|
||||||
|
// 再判断这张结算单是不是已经被取消了
|
||||||
|
if (ticketLog.getState() == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return Result.failed("结算单已作废");
|
||||||
|
} else {
|
||||||
|
// 还要判断这张结算单已经在订单上使用了
|
||||||
|
return Result.failed("结算单已使用,请使用“取消结算单”功能");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 然后就可以开始取消了
|
||||||
|
|
||||||
|
ticketLog = new TicketLog();
|
||||||
|
ticketLog.setId(StrKit.getRandomUUID());
|
||||||
|
ticketLog.setInvalidUserId(sysuser.getId());
|
||||||
|
ticketLog.setInvalidUserName(sysuser.getName());
|
||||||
|
ticketLog.setInvalidTime(new Date());
|
||||||
|
ticketLog.setInvalidMemo(invalid_memo);
|
||||||
|
ticketLog.setState(OrderStateEnum.INVALID.getStateid());
|
||||||
|
ticketLog.setTicketReceiveId(receive.getId());
|
||||||
|
ticketLog.setTicketCode(ticket_code);
|
||||||
|
|
||||||
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
receive.setInvalidCount(receive.getInvalidCount() + 1);
|
||||||
|
|
||||||
|
if (receive.getSurplus() < 0) {
|
||||||
|
return Result.failed("作废失败,减少剩余量时发生错误");
|
||||||
|
} else if (receive.getSurplus() == 0) {
|
||||||
|
// 作废最后一张结算单,当前结算单停再最后一个结算单号码上
|
||||||
|
receive.setCurrentCode(receive.getEndCode());
|
||||||
|
} else {
|
||||||
|
if (ticket_code.equals(receive.getStartCode())) { // 作废第一张结算单
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getStartCode()) + 1));
|
||||||
|
} else if (ticket_code.equals(receive.getCurrentCode())) { // 作废顺延的下一张结算单
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Long.parseLong(receive.getCurrentCode()) + 1));
|
||||||
|
} else {
|
||||||
|
// 其他情况下不更新 current_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
|
TicketLog finalTicketLog = ticketLog;
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
boolean ret = finalTicketLog.save();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addSaveData(finalTicketLog);
|
||||||
|
|
||||||
|
ret = receive.update();
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
synctask.addUpdateData(receive);
|
||||||
|
|
||||||
|
return SyncTaskService.me.save(synctask, supermarket_id)
|
||||||
|
&& ModifyLogService.me.save(finalTicketLog, null, Enums.DataOpType.SAVE.getId(), sysuser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 普票作废理解同步到砂站
|
||||||
|
if (ret) {
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret ? Result.success(ticketLog) : Result.failed(false, "处理失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result cancel(String id, String invalid_memo, Sysuser sysuser) {
|
||||||
|
TicketLog ticketLog = TicketLog.dao.findById(id);
|
||||||
|
|
||||||
|
if (ticketLog == null) {
|
||||||
|
return Result.failed("未找到结算单记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
return cancelType2(ticketLog, invalid_memo, sysuser);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result cancelByCode(String ticket_code, String invalid_memo, Sysuser sysuser) {
|
||||||
|
TicketLog ticketLog = TicketLog.dao.findFirst("select * from ticket_log t where ticket_code = ? limit 1 ", ticket_code);
|
||||||
|
|
||||||
|
if (ticketLog == null) {
|
||||||
|
return Result.failed("未找到结算单记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
return cancelType2(ticketLog, invalid_memo, sysuser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消专票
|
||||||
|
* 2020-09-29 一个专票可以关联多个订单,取消专票需要将关联的订单都取消结算单信息
|
||||||
|
*
|
||||||
|
* @param ticketLog
|
||||||
|
* @param invalid_memo
|
||||||
|
* @param sysuser
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Result cancelType2(TicketLog ticketLog, String invalid_memo, Sysuser sysuser) {
|
||||||
|
if (ticketLog.getState() == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return Result.failed("记录已作废");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OrderTemp> ordlist = OrderTemp.dao.find("select * from order_temp t \n" +
|
||||||
|
" where t.state = ? \n" +
|
||||||
|
" and t.ticket_code = ? ",
|
||||||
|
OrderStateEnum.RECEIVED.getStateid(),
|
||||||
|
ticketLog.getTicketCode()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ordlist.isEmpty()) {
|
||||||
|
return Result.failed("关联订单信息错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TicketLog> loglist = TicketLog.dao.find("select * from ticket_log t \n" +
|
||||||
|
" where t.state = ? \n" +
|
||||||
|
" and t.ticket_code = ? ",
|
||||||
|
OrderStateEnum.RECEIVED.getStateid(),
|
||||||
|
ticketLog.getTicketCode()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ordlist.isEmpty()) {
|
||||||
|
return Result.failed("结算单使用信息错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Integer, SyncTask> map = new HashMap<>();
|
||||||
|
Map<String, OrderTemp> ordmap = new HashMap<>();
|
||||||
|
Date now = new Date();
|
||||||
|
Record logrecord = new Record();
|
||||||
|
|
||||||
|
logrecord.set("state", OrderStateEnum.INVALID.getStateid());
|
||||||
|
logrecord.set("ticket_code", ticketLog.getTicketCode());
|
||||||
|
|
||||||
|
for (OrderTemp o : ordlist) {
|
||||||
|
if(o.getInvoiceType() == 2 && o.getInvoiceCode() != null){
|
||||||
|
return Result.failed("已经开专票的结算单不能取消");
|
||||||
|
}
|
||||||
|
|
||||||
|
o.setTicketCode(null);
|
||||||
|
|
||||||
|
int supermarket_id = o.getSupermarketId();
|
||||||
|
|
||||||
|
if (!map.containsKey(supermarket_id)) {
|
||||||
|
map.put(supermarket_id, new SyncTask());
|
||||||
|
}
|
||||||
|
|
||||||
|
map.get(supermarket_id).addUpdateData(o);
|
||||||
|
ordmap.put(o.getSn(), o);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TicketLog o : loglist) {
|
||||||
|
o.setInvalidMemo(invalid_memo);
|
||||||
|
o.setInvalidTime(now);
|
||||||
|
o.setInvalidUserId(sysuser.getId());
|
||||||
|
o.setInvalidUserName(sysuser.getName());
|
||||||
|
o.setState(OrderStateEnum.INVALID.getStateid());
|
||||||
|
|
||||||
|
if (!ordmap.containsKey(o.getOrderSn())) {
|
||||||
|
return Result.failedstr("结算单[%s]未找到订单信息", o.getTicketCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
int supermarket_id = ordmap.get(o.getOrderSn()).getSupermarketId();
|
||||||
|
|
||||||
|
if (!map.containsKey(supermarket_id)) {
|
||||||
|
map.put(supermarket_id, new SyncTask());
|
||||||
|
}
|
||||||
|
|
||||||
|
map.get(supermarket_id).addUpdateData(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
int[] editret = Db.batchUpdate(ordlist, ordlist.size());
|
||||||
|
|
||||||
|
for (int i : editret) {
|
||||||
|
// 必须是每条 sql 修改一条记录
|
||||||
|
if (i != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
editret = Db.batchUpdate(loglist, loglist.size());
|
||||||
|
|
||||||
|
for (int i : editret) {
|
||||||
|
// 必须是每条 sql 修改一条记录
|
||||||
|
if (i != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将订单同步到不同的砂站
|
||||||
|
for (Map.Entry<Integer, SyncTask> entry : map.entrySet()) {
|
||||||
|
if (!SyncTaskService.me.save(entry.getValue(), entry.getKey())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ModifyLogService.me.save(TicketLog.tablename, "id", logrecord.toJson(), Enums.DataOpType.SAVE.getId(), sysuser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return ret ? Result.success() : Result.failed("修改失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
package com.cowr.service.ssjygl.ticket.receive;
|
||||||
|
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketReceive;
|
||||||
|
import com.cowr.model.Sysuser;
|
||||||
|
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceivePKValidator;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveService;
|
||||||
|
import com.cowr.ssjygl.ticket.receive.TicketReceiveValidator;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Thu Aug 13 23:09:29 CST 2020
|
||||||
|
* TableName: ticket_receive
|
||||||
|
* Remarks: 结算单管理 - 领用记录
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class TicketReceiveController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键检查对象是否存在
|
||||||
|
* 返回 code = 200
|
||||||
|
* 存在时 data = true
|
||||||
|
* 不存在 data = false
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void checkExistsByPk() {
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveService.me.checkExistsByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增 ticket_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceiveValidator.class)
|
||||||
|
public void save() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveSyncService.me.save(model, tokenuser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 ticket_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void del() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveSyncService.me.delete(model, tokenuser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 恢复 ticket_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void restore() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveSyncService.me.restore(model, tokenuser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改 ticket_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceiveValidator.class)
|
||||||
|
public void edit() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveSyncService.me.update(model, tokenuser));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查找 ticket_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
Integer supermarket_id = getInt("supermarket_id");
|
||||||
|
String reveiver_user_name = get("reveiver_user_name");
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
renderJson(Result.object(TicketReceiveService.me.find(pp, supermarket_id, reveiver_user_name, stm, etm)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查找单个对象 ticket_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void findByPk() {
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveService.me.findByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按主键查找单个对象 ticket_receive 结算单管理 - 领用记录
|
||||||
|
*/
|
||||||
|
@Before(TicketReceivePKValidator.class)
|
||||||
|
public void get() {
|
||||||
|
TicketReceive model = getModel(TicketReceive.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(TicketReceiveService.me.findByPk(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nextTicket() {
|
||||||
|
Integer supermarket_id = getInt("supermarket_id", 0);
|
||||||
|
|
||||||
|
List<Record> receives = TicketReceiveService.me.nextTicketCodes(supermarket_id);
|
||||||
|
if (receives == null || receives.isEmpty()) {
|
||||||
|
renderJson(Result.failed("没有有效的结算单领用记录"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderJson(Result.success(receives));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.cowr.service.ssjygl.ticket.receive;
|
||||||
|
|
||||||
|
import com.cowr.common.enums.Enums;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.TicketReceive;
|
||||||
|
import com.cowr.model.Supermarket;
|
||||||
|
import com.cowr.model.SyncTask;
|
||||||
|
import com.cowr.model.Sysuser;
|
||||||
|
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||||
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
|
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TicketReceiveSyncService extends BaseSyncService {
|
||||||
|
private static Log log = Log.getLog(TicketReceiveSyncService.class);
|
||||||
|
public static TicketReceiveSyncService me = new TicketReceiveSyncService();
|
||||||
|
|
||||||
|
public Result save(TicketReceive receive, Sysuser user) {
|
||||||
|
Sysuser receive_user = Sysuser.dao.findById(receive.getReceiveUserId());
|
||||||
|
|
||||||
|
if (receive_user == null) {
|
||||||
|
return Result.failed("未找到关联用户信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
receive.setReceiveUserName(receive_user.getName());
|
||||||
|
|
||||||
|
Supermarket supermarket = SvrCacheData.SUP_CACHE.get(receive.getSupermarketId());
|
||||||
|
if (supermarket == null) {
|
||||||
|
return Result.failed("砂站信息无效");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (supermarket.getIsdeploy() == 0) {
|
||||||
|
return Result.failedstr("[%s]砂站还未部署", supermarket.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 十位或者更长的结算单号码要转 long,否则可能超过 Integer.MAX_VALUE 2147483647
|
||||||
|
Long start = Long.parseLong(receive.getStartCode());
|
||||||
|
Long end = Long.parseLong(receive.getEndCode());
|
||||||
|
|
||||||
|
List<TicketReceive> chklist = TicketReceive.dao.find("select * from ticket_receive t\n" +
|
||||||
|
" where (( t.start_code <= ? and t.end_code >= ? )\n" +
|
||||||
|
" or ( t.start_code <= ? and t.end_code >= ? ))", start, start, end, end);
|
||||||
|
|
||||||
|
if (!chklist.isEmpty()) {
|
||||||
|
return Result.failed("结算单段和已领用的记录冲突");
|
||||||
|
}
|
||||||
|
|
||||||
|
receive.setSurplus((int) (end - start) + 1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
|
||||||
|
return Result.failed("数据检查错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean ret = Db.tx(new IAtom() {
|
||||||
|
@Override
|
||||||
|
public boolean run() {
|
||||||
|
try {
|
||||||
|
return receive.save()
|
||||||
|
&& SyncTaskService.me.save(new SyncTask().addSaveData(receive), receive.getSupermarketId()) // 下发到指定的砂站
|
||||||
|
&& ModifyLogService.me.save(receive, null, Enums.DataOpType.SAVE.getId(), user);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return ret ? Result.object(receive) : Result.failed(false, "新增失败");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
if (e.getMessage().contains("PRIMARY")) {
|
||||||
|
return Result.failed(false, "主键冲突");
|
||||||
|
} else {
|
||||||
|
return Result.failed(false, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
public Result delete(Truck model, Sysuser sysuser) {
|
public Result delete(Truck model, Sysuser sysuser) {
|
||||||
try {
|
try {
|
||||||
// 注意这里有 !,找到后才做 update 操作
|
// 注意这里有 !,找到后才做 update 操作
|
||||||
BaseModel oldobj = (BaseModel) model.findByPk();
|
Truck oldobj = model.findByPk();
|
||||||
|
|
||||||
if (oldobj == null) {
|
if (oldobj == null) {
|
||||||
return Result.failed(false, "按主键未找到对应记录");
|
return Result.failed(false, "按主键未找到对应记录");
|
||||||
|
|
@ -97,10 +97,10 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
return Result.failed(false, "不存在逻辑删除字段");
|
return Result.failed(false, "不存在逻辑删除字段");
|
||||||
}
|
}
|
||||||
|
|
||||||
model.set(Const.LOGIC_DEL_KEY, Const.LOGIC_DEL_INVALID); // 逻辑删除字段统一用 del
|
oldobj.set(Const.LOGIC_DEL_KEY, Const.LOGIC_DEL_INVALID); // 逻辑删除字段统一用 del
|
||||||
|
|
||||||
SyncTask synctask = new SyncTask();
|
SyncTask synctask = new SyncTask();
|
||||||
synctask.addUpdateData(model);
|
synctask.addUpdateData(oldobj);
|
||||||
|
|
||||||
AuthLicense authlic = new AuthLicense();
|
AuthLicense authlic = new AuthLicense();
|
||||||
authlic.setTruckLicense(model.getLicense());
|
authlic.setTruckLicense(model.getLicense());
|
||||||
|
|
@ -111,7 +111,7 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
try {
|
try {
|
||||||
return model.update()
|
return oldobj.update()
|
||||||
&& SyncTaskService.me.save(synctask)
|
&& SyncTaskService.me.save(synctask)
|
||||||
&& ModifyLogService.me.save(model, oldobj, Enums.DataOpType.UPDATE.getId(), sysuser);
|
&& ModifyLogService.me.save(model, oldobj, Enums.DataOpType.UPDATE.getId(), sysuser);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -121,12 +121,6 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 将修改后的对象返回
|
|
||||||
String[] keys = model._getAttrNames();
|
|
||||||
for (String key : keys) {
|
|
||||||
oldobj.set(key, model.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret ? Result.object(oldobj) : Result.failed(false, "删除失败");
|
return ret ? Result.object(oldobj) : Result.failed(false, "删除失败");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
@ -137,7 +131,7 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
public Result restore(Truck model, Sysuser sysuser) {
|
public Result restore(Truck model, Sysuser sysuser) {
|
||||||
try {
|
try {
|
||||||
// 注意这里有 !,找到后才做 update 操作
|
// 注意这里有 !,找到后才做 update 操作
|
||||||
BaseModel oldobj = (BaseModel) model.findByPk();
|
Truck oldobj = model.findByPk();
|
||||||
|
|
||||||
if (oldobj == null) {
|
if (oldobj == null) {
|
||||||
return Result.failed(false, "按主键未找到对应记录");
|
return Result.failed(false, "按主键未找到对应记录");
|
||||||
|
|
@ -147,12 +141,12 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
return Result.failed(false, "不存在逻辑删除字段");
|
return Result.failed(false, "不存在逻辑删除字段");
|
||||||
}
|
}
|
||||||
|
|
||||||
model.set(Const.LOGIC_DEL_KEY, Const.LOGIC_DEL_VALID); // 逻辑删除字段统一用 del
|
oldobj.set(Const.LOGIC_DEL_KEY, Const.LOGIC_DEL_VALID); // 逻辑删除字段统一用 del
|
||||||
|
|
||||||
SyncTask synctask = new SyncTask();
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
AuthLicense authlic = new AuthLicense();
|
AuthLicense authlic = new AuthLicense();
|
||||||
authlic.setTruckLicense(model.getLicense());
|
authlic.setTruckLicense(oldobj.getLicense());
|
||||||
|
|
||||||
synctask.addSaveData(authlic); // 恢复车辆时,有效车牌要添加
|
synctask.addSaveData(authlic); // 恢复车辆时,有效车牌要添加
|
||||||
|
|
||||||
|
|
@ -160,9 +154,9 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
try {
|
try {
|
||||||
boolean ret = model.update();
|
boolean ret = oldobj.update();
|
||||||
|
|
||||||
synctask.addUpdateData(model);
|
synctask.addUpdateData(oldobj);
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
&& SyncTaskService.me.save(synctask)
|
&& SyncTaskService.me.save(synctask)
|
||||||
|
|
@ -174,12 +168,6 @@ public class TruckSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 将修改后的对象返回
|
|
||||||
String[] keys = model._getAttrNames();
|
|
||||||
for (String key : keys) {
|
|
||||||
oldobj.set(key, model.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret ? Result.object(oldobj) : Result.failed(false, "恢复失败");
|
return ret ? Result.object(oldobj) : Result.failed(false, "恢复失败");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# 日志级别
|
# 日志级别
|
||||||
log4j.rootLogger=DEBUG, console, fileDebug, fileInfo
|
log4j.rootLogger=DEBUG, console, fileDebug, fileError
|
||||||
log4j.rootLogger.encoding=UTF-8
|
log4j.rootLogger.encoding=UTF-8
|
||||||
log4j.logger.com.cowr=DEBUG
|
log4j.logger.com.cowr=DEBUG
|
||||||
log4j.logger.com.jfinal=DEBUG
|
log4j.logger.com.jfinal=DEBUG
|
||||||
|
|
@ -33,16 +33,16 @@ log4j.appender.fileDebug.MaxBackupIndex=1000
|
||||||
log4j.appender.fileDebug.layout=org.apache.log4j.PatternLayout
|
log4j.appender.fileDebug.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.fileDebug.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss.SSS} %p %t %F %L - %M %m %X{traceId}%n
|
log4j.appender.fileDebug.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss.SSS} %p %t %F %L - %M %m %X{traceId}%n
|
||||||
|
|
||||||
# 输出到文件 info
|
# 输出到文件 error
|
||||||
log4j.appender.fileInfo=org.apache.log4j.RollingFileAppender
|
log4j.appender.fileError=org.apache.log4j.RollingFileAppender
|
||||||
log4j.appender.fileInfo.encoding=UTF-8
|
log4j.appender.fileError.encoding=UTF-8
|
||||||
log4j.appender.fileInfo.Append=true
|
log4j.appender.fileError.Append=true
|
||||||
log4j.appender.fileInfo.Threshold=INFO
|
log4j.appender.fileError.Threshold=ERROR
|
||||||
log4j.appender.fileInfo.File=../logs/ssjygl.xsx.service.info.log
|
log4j.appender.fileError.File=../logs/ssjygl.xsx.service.error.log
|
||||||
log4j.appender.fileInfo.MaxFileSize=10MB
|
log4j.appender.fileError.MaxFileSize=10MB
|
||||||
log4j.appender.fileInfo.MaxBackupIndex=500
|
log4j.appender.fileError.MaxBackupIndex=500
|
||||||
log4j.appender.fileInfo.layout=org.apache.log4j.PatternLayout
|
log4j.appender.fileError.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.fileInfo.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss.SSS} %p %t %F %L - %M %m %n
|
log4j.appender.fileError.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss.SSS} %p %t %F %L - %M %m %n
|
||||||
|
|
||||||
# ConversionPattern参数的格式含义
|
# ConversionPattern参数的格式含义
|
||||||
# 格式名 含义
|
# 格式名 含义
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,6 @@ socketserver.port=21002
|
||||||
endpoint=oss-cn-shenzhen.aliyuncs.com
|
endpoint=oss-cn-shenzhen.aliyuncs.com
|
||||||
#清理备份用
|
#清理备份用
|
||||||
bucketName=shbak
|
bucketName=shbak
|
||||||
|
|
||||||
|
#读服务器磁盘上的配置文件
|
||||||
|
dbconfpath=/home/lisai/ssjygl-xsx/db.properties
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
# mysql
|
|
||||||
jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_service?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
|
||||||
user=ssjy_xsx
|
|
||||||
password=Ssjy_xs_890
|
|
||||||
|
|
||||||
# redis
|
|
||||||
redis.basekey=ssjcgl_xsx
|
|
||||||
redis.ip=r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
|
|
||||||
redis.port=6379
|
|
||||||
redis.pwd=CoWR1111
|
|
||||||
redis.db=13
|
|
||||||
Loading…
Reference in New Issue