添加发票作废申请
parent
371583720b
commit
b9d6503f32
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.cowr.model;
|
||||||
|
|
||||||
|
import com.cowr.model.base.BaseInvoiceInvalidVerify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Thu Oct 22 14:32:48 CST 2020
|
||||||
|
* TableName: invoice_invalid_verify
|
||||||
|
* Remarks: 发票管理 - 发票作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class InvoiceInvalidVerify extends BaseInvoiceInvalidVerify<InvoiceInvalidVerify> {
|
||||||
|
public static final InvoiceInvalidVerify dao = new InvoiceInvalidVerify().dao();
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ public class _MappingKit {
|
||||||
arp.addMapping("auth_license", "truck_license", AuthLicense.class);
|
arp.addMapping("auth_license", "truck_license", AuthLicense.class);
|
||||||
arp.addMapping("transport", "id", Transport.class);
|
arp.addMapping("transport", "id", Transport.class);
|
||||||
arp.addMapping("device_config", "supermarket_id", DeviceConfig.class);
|
arp.addMapping("device_config", "supermarket_id", DeviceConfig.class);
|
||||||
|
arp.addMapping("invoice_invalid_verify", "id", InvoiceInvalidVerify.class);
|
||||||
arp.addMapping("invoice_log", "id", InvoiceLog.class);
|
arp.addMapping("invoice_log", "id", InvoiceLog.class);
|
||||||
arp.addMapping("invoice_receive", "id", InvoiceReceive.class);
|
arp.addMapping("invoice_receive", "id", InvoiceReceive.class);
|
||||||
arp.addMapping("driver", "id", Driver.class);
|
arp.addMapping("driver", "id", Driver.class);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,404 @@
|
||||||
|
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 Thu Oct 22 15:44:06 CST 2020
|
||||||
|
* TableName: invoice_invalid_verify
|
||||||
|
* Remarks: 发票管理 - 发票作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public abstract class BaseInvoiceInvalidVerify<M extends BaseInvoiceInvalidVerify<M>> extends BaseModel<M> implements IBean {
|
||||||
|
|
||||||
|
public static final String tablename = "invoice_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: invoice_type
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: NO
|
||||||
|
* 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_number
|
||||||
|
* type: VARCHAR(20)
|
||||||
|
* isNullable: NO
|
||||||
|
* 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: NO
|
||||||
|
* 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: 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: 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: invoice_receive_id
|
||||||
|
* type: INT(10)
|
||||||
|
* isNullable: YES
|
||||||
|
* isPrimaryKey: NO
|
||||||
|
* defaultValue:
|
||||||
|
* @param invoiceReceiveId 领用记录id
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_receive_id")
|
||||||
|
public void setInvoiceReceiveId(Integer invoiceReceiveId) {
|
||||||
|
set("invoice_receive_id", invoiceReceiveId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return invoice_receive_id 领用记录id
|
||||||
|
*/
|
||||||
|
@JSONField(name="invoice_receive_id")
|
||||||
|
public Integer getInvoiceReceiveId() {
|
||||||
|
return getInt("invoice_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,23 @@
|
||||||
|
package com.cowr.ssjygl.invoice.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Thu Oct 22 14:51:55 CST 2020
|
||||||
|
* TableName: invoice_invalid_verify
|
||||||
|
* Remarks: 发票管理 - 发票作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class InvoiceInvalidBySnVerifyValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateString("order_sn", 16, 16, "order_sn", "order_sn 长度 16");
|
||||||
|
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.invoice.invalidverify;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cowr.common.validator.CrudParamValidator;
|
||||||
|
import com.cowr.common.view.Result;
|
||||||
|
import com.cowr.model.InvoiceInvalidVerify;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Thu Oct 22 14:32:54 CST 2020
|
||||||
|
* TableName: invoice_invalid_verify
|
||||||
|
* Remarks: 发票管理 - 发票作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class InvoiceInvalidVerifyPKValidator 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,103 @@
|
||||||
|
package com.cowr.ssjygl.invoice.invalidverify;
|
||||||
|
|
||||||
|
import com.cowr.common.Const;
|
||||||
|
import com.cowr.common.base.BaseService;
|
||||||
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.model.InvoiceInvalidVerify;
|
||||||
|
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 Thu Oct 22 14:32:54 CST 2020
|
||||||
|
* TableName: invoice_invalid_verify
|
||||||
|
* Remarks: 发票管理 - 发票作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class InvoiceInvalidVerifyService extends BaseService {
|
||||||
|
public static final InvoiceInvalidVerifyService me = new InvoiceInvalidVerifyService();
|
||||||
|
|
||||||
|
public Page<Record> find(
|
||||||
|
PageParam pp,
|
||||||
|
String stm,
|
||||||
|
String etm,
|
||||||
|
Integer invoice_type,
|
||||||
|
String invoice_number,
|
||||||
|
String invoice_code,
|
||||||
|
String order_sn,
|
||||||
|
String create_user_name,
|
||||||
|
Integer supermarket_id,
|
||||||
|
Integer state
|
||||||
|
) {
|
||||||
|
String selectsql = "select * ";
|
||||||
|
String fromsql = "from invoice_invalid_verify t 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 (invoice_type != null) {
|
||||||
|
fromsql += " and t.invoice_type = ? \n";
|
||||||
|
paraList.add(invoice_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(invoice_number)) {
|
||||||
|
fromsql += " and t.invoice_number like ? \n";
|
||||||
|
paraList.add("%" + invoice_number.trim() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrKit.notBlank(invoice_code)) {
|
||||||
|
fromsql += " and t.invoice_code like ? \n";
|
||||||
|
paraList.add("%" + invoice_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()) && InvoiceInvalidVerify.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,26 @@
|
||||||
|
package com.cowr.ssjygl.invoice.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.InvoiceInvalidVerify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated by COWR Thu Oct 22 14:51:55 CST 2020
|
||||||
|
* TableName: invoice_invalid_verify
|
||||||
|
* Remarks: 发票管理 - 发票作废申请
|
||||||
|
* PrimaryKey: id
|
||||||
|
*/
|
||||||
|
public class InvoiceInvalidVerifyValidator extends CrudParamValidator {
|
||||||
|
@Override
|
||||||
|
protected void validate(Controller c) {
|
||||||
|
validateString("invoice_number", 1, 20, "invoice_number", "invoice_number 长度 1~20");
|
||||||
|
validateString("invoice_code", 1, 20, "invoice_code", "invoice_code 长度 1~20");
|
||||||
|
validateString("invalid_memo", 1, 255, "invalid_memo", "invalid_memo 长度 1~255");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleError(Controller c) {
|
||||||
|
c.renderJson(Result.failed(getErrmsg()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -76,6 +76,7 @@ public class Main {
|
||||||
"ossfile_log",
|
"ossfile_log",
|
||||||
"customer_pact",
|
"customer_pact",
|
||||||
"customer_supermarket_product",
|
"customer_supermarket_product",
|
||||||
|
"invoice_invalid_verify",
|
||||||
};
|
};
|
||||||
|
|
||||||
PropKit.use("db.properties");
|
PropKit.use("db.properties");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.cowr.local.ssjygl.invoice.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.InvoiceInvalidVerify;
|
||||||
|
import com.cowr.model.Sysuser;
|
||||||
|
import com.cowr.ssjygl.invoice.invalidverify.InvoiceInvalidBySnVerifyValidator;
|
||||||
|
import com.cowr.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyService;
|
||||||
|
import com.cowr.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyValidator;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
public class InvoiceInvalidVerifyController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查找 invoice_invalid_verify 发票管理 - 发票作废申请
|
||||||
|
*/
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
Integer invoice_type = getInt("invoice_type");
|
||||||
|
String invoice_number = get("invoice_number");
|
||||||
|
String invoice_code = get("invoice_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(InvoiceInvalidVerifyService.me.find(pp, stm, etm, invoice_type, invoice_number, invoice_code, order_sn, create_user_name, supermarket_id, state)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增 invoice_invalid_verify 发票管理 - 发票作废申请
|
||||||
|
*/
|
||||||
|
@Before(InvoiceInvalidVerifyValidator.class)
|
||||||
|
public void save() {
|
||||||
|
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||||
|
|
||||||
|
if (tokenuser == null) {
|
||||||
|
renderJson(Result.noauth());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceInvalidVerify model = getModel(InvoiceInvalidVerify.class, "", true); // 忽略不在model中的字段
|
||||||
|
renderJson(InvoiceInvalidVerifySyncService.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(InvoiceInvalidVerifySyncService.me.save(order_sn, invalid_memo, tokenuser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,136 @@
|
||||||
|
package com.cowr.local.ssjygl.invoice.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.invoice.receive.InvoiceReceiveService;
|
||||||
|
import com.jfinal.kit.StrKit;
|
||||||
|
import com.jfinal.log.Log;
|
||||||
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class InvoiceInvalidVerifySyncService {
|
||||||
|
private static Log log = Log.getLog(InvoiceInvalidVerifySyncService.class);
|
||||||
|
public static InvoiceInvalidVerifySyncService me = new InvoiceInvalidVerifySyncService();
|
||||||
|
|
||||||
|
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){
|
||||||
|
return Result.failed("专票作废只能由财务处理");
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(CliCacheData.SUP.getId(), order.getInvoiceNumber(), order.getInvoiceCode());
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的发票领用记录,或者订单没有开具有效的发票");
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceInvalidVerify model = new InvoiceInvalidVerify();
|
||||||
|
model.setId(StrKit.getRandomUUID());
|
||||||
|
model.setSupermarketId(CliCacheData.SUP.getId());
|
||||||
|
model.setCreateTime(new Date());
|
||||||
|
model.setCreateUserId(sysuser.getId());
|
||||||
|
model.setCreateUserName(sysuser.getName());
|
||||||
|
model.setInvoiceReceiveId(receive.getId());
|
||||||
|
model.setOrderSn(order.getSn());
|
||||||
|
model.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||||
|
|
||||||
|
model.setInvalidMemo(invalid_memo);
|
||||||
|
model.setInvoiceNumber(order.getInvoiceNumber());
|
||||||
|
model.setInvoiceCode(order.getInvoiceCode());
|
||||||
|
|
||||||
|
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(InvoiceInvalidVerify model, Sysuser sysuser) {
|
||||||
|
// 先判断这张发票有没有被领用
|
||||||
|
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(CliCacheData.SUP.getId(), model.getInvoiceNumber(), model.getInvoiceCode());
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceLog invoiceLog = InvoiceLog.dao.findFirst("select * from invoice_log t \n" +
|
||||||
|
" where t.invoice_number = ? and t.code = ? limit 1 ", model.getInvoiceNumber(), model.getInvoiceCode());
|
||||||
|
|
||||||
|
if (invoiceLog != null) {
|
||||||
|
// 再判断这张发票是不是已经被取消了
|
||||||
|
if (invoiceLog.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.setInvoiceReceiveId(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("保存失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import com.cowr.common.ctrl.HomeController;
|
||||||
import com.cowr.common.oss.OSSKit;
|
import com.cowr.common.oss.OSSKit;
|
||||||
import com.cowr.local.ssjygl.customer.pact.CustomerPactController;
|
import com.cowr.local.ssjygl.customer.pact.CustomerPactController;
|
||||||
import com.cowr.local.ssjygl.customer.supermarketproduct.CustomerSupermarketProductController;
|
import com.cowr.local.ssjygl.customer.supermarketproduct.CustomerSupermarketProductController;
|
||||||
|
import com.cowr.local.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyController;
|
||||||
import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController;
|
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;
|
||||||
|
|
@ -92,7 +93,7 @@ public class Config extends JFinalConfig {
|
||||||
public static DeviceThread deviceThread = new DeviceThread();
|
public static DeviceThread deviceThread = new DeviceThread();
|
||||||
public static SocketIOService socketio = null;
|
public static SocketIOService socketio = null;
|
||||||
private static boolean client_run = true;
|
private static boolean client_run = true;
|
||||||
public static final String CLINET_VERSION = "20201021";
|
public static final String CLINET_VERSION = "20201022";
|
||||||
|
|
||||||
public static String getRootPath() {
|
public static String getRootPath() {
|
||||||
return PathKit.getWebRootPath()
|
return PathKit.getWebRootPath()
|
||||||
|
|
@ -226,6 +227,7 @@ public class Config extends JFinalConfig {
|
||||||
// -- 发票管理
|
// -- 发票管理
|
||||||
me.add("/invoice/log", InvoiceLogController.class);
|
me.add("/invoice/log", InvoiceLogController.class);
|
||||||
me.add("/invoice/receive", InvoiceReceiveController.class);
|
me.add("/invoice/receive", InvoiceReceiveController.class);
|
||||||
|
me.add("/invoice/invalidverify", InvoiceInvalidVerifyController.class);
|
||||||
|
|
||||||
// -- 日志
|
// -- 日志
|
||||||
me.add("/log/sms", SmsLogController.class);
|
me.add("/log/sms", SmsLogController.class);
|
||||||
|
|
@ -341,7 +343,7 @@ public class Config extends JFinalConfig {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
} else {
|
} else {
|
||||||
log.info("====================================================");
|
log.info("====================================================");
|
||||||
log.info("============= 启动 %s %s 服务 =================", CliCacheData.SUP.getId(), CliCacheData.SUP.getName());
|
log.info("============= 启动 %s %s 服务 ================", CliCacheData.SUP.getId(), CliCacheData.SUP.getName());
|
||||||
log.info("====================================================");
|
log.info("====================================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.cowr.service.ssjygl.invoice.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.invoice.invalidverify.InvoiceInvalidVerifyService;
|
||||||
|
import com.jfinal.aop.Before;
|
||||||
|
import com.jfinal.core.Controller;
|
||||||
|
|
||||||
|
public class InvoiceInvalidVerifyController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查找 invoice_invalid_verify 发票管理 - 发票作废申请
|
||||||
|
*/
|
||||||
|
public void find() {
|
||||||
|
PageParam pp = getBean(PageParam.class, "", true);
|
||||||
|
|
||||||
|
String stm = get("stm");
|
||||||
|
String etm = get("etm");
|
||||||
|
Integer invoice_type = getInt("invoice_type");
|
||||||
|
String invoice_number = get("invoice_number");
|
||||||
|
String invoice_code = get("invoice_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(InvoiceInvalidVerifyService.me.find(pp, stm, etm, invoice_type, invoice_number, invoice_code, order_sn, create_user_name, supermarket_id, state)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before(InvoiceInvalidVerifyValidator.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(InvoiceInvalidVerifySyncService.me.verify(id, state, memo, tokenuser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,197 @@
|
||||||
|
package com.cowr.service.ssjygl.invoice.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.invoice.receive.InvoiceReceiveService;
|
||||||
|
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 InvoiceInvalidVerifySyncService {
|
||||||
|
private static Log log = Log.getLog(InvoiceInvalidVerifySyncService.class);
|
||||||
|
public static InvoiceInvalidVerifySyncService me = new InvoiceInvalidVerifySyncService();
|
||||||
|
|
||||||
|
public Result verify(String id, int state, String memo, Sysuser user) {
|
||||||
|
if (state != 2 && state != 9) {
|
||||||
|
return Result.failed("state 值错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceInvalidVerify model = InvoiceInvalidVerify.dao.findById(id);
|
||||||
|
|
||||||
|
if (model == null) {
|
||||||
|
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(InvoiceInvalidVerify model, Sysuser sysuser) {
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
synctask.addUpdateData(model);
|
||||||
|
|
||||||
|
// 先判断这张发票有没有被领用
|
||||||
|
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(model.getSupermarketId(), model.getInvoiceNumber(), model.getInvoiceCode());
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的发票领用记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceLog invoiceLog = InvoiceLog.dao.findFirst("select * from invoice_log t \n" +
|
||||||
|
" where t.invoice_number = ? and t.code = ? limit 1 ", model.getInvoiceNumber(), model.getInvoiceCode());
|
||||||
|
|
||||||
|
// 又多个地方可以修改 InvoiceLog 在同意之前,要先确认发票是否已经取消
|
||||||
|
if (invoiceLog != null) {
|
||||||
|
if (invoiceLog.getState() == OrderStateEnum.INVALID.getStateid()) {
|
||||||
|
return Result.failed("发票已作废");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
invoiceLog = new InvoiceLog();
|
||||||
|
|
||||||
|
// 作废发票时,发票还没有使用,才需要去处理发票领用记录里面的当前发票号码
|
||||||
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
|
||||||
|
if (receive.getSurplus() == 0) {
|
||||||
|
// 作废最后一张发票,当前发票停再最后一个发票号码上
|
||||||
|
receive.setCurrentCode(receive.getEndCode());
|
||||||
|
} else {
|
||||||
|
if (model.getInvoiceCode().equals(receive.getStartCode())) { // 作废第一张发票
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getStartCode()) + 1));
|
||||||
|
} else if (model.getInvoiceCode().equals(receive.getCurrentCode())) { // 作废顺延的下一张发票
|
||||||
|
receive.setCurrentCode(String.format("%0" + receive.getStartCode().length() + "d", Integer.parseInt(receive.getCurrentCode()) + 1));
|
||||||
|
} else {
|
||||||
|
// 其他情况下不更新 current_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
invoiceLog.setInvalidUserId(sysuser.getId());
|
||||||
|
invoiceLog.setInvalidUserName(sysuser.getName());
|
||||||
|
invoiceLog.setInvalidTime(new Date());
|
||||||
|
invoiceLog.setInvalidMemo(model.getInvalidMemo());
|
||||||
|
invoiceLog.setState(OrderStateEnum.INVALID.getStateid());
|
||||||
|
invoiceLog.setCode(model.getInvoiceCode());
|
||||||
|
invoiceLog.setInvoiceNumber(model.getInvoiceNumber());
|
||||||
|
|
||||||
|
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.setInvoiceCode(null);
|
||||||
|
order.setInvoiceNumber(null);
|
||||||
|
order.setInvoiceSite(null);
|
||||||
|
|
||||||
|
synctask.addUpdateData(order); // 关联了订单的,要更新订单信息,清除开票信息
|
||||||
|
}
|
||||||
|
|
||||||
|
InvoiceLog finalInvoiceLog = invoiceLog;
|
||||||
|
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 (finalInvoiceLog.getId() == null) { // 发票还没有使用,是新增使用日志
|
||||||
|
finalInvoiceLog.setId(StrKit.getRandomUUID());
|
||||||
|
finalInvoiceLog.setInvoiceReceiveId(model.getInvoiceReceiveId());
|
||||||
|
|
||||||
|
synctask.addSaveData(finalInvoiceLog);
|
||||||
|
|
||||||
|
ret = finalInvoiceLog.save();
|
||||||
|
} else { // 发票已经使用的,有使用日志的,需要更新
|
||||||
|
synctask.addUpdateData(finalInvoiceLog);
|
||||||
|
|
||||||
|
ret = finalInvoiceLog.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(InvoiceInvalidVerify 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.invoice.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 InvoiceInvalidVerifyValidator 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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,6 +12,7 @@ import com.cowr.service.ssjygl.customer.receiver.CustomerReceiverController;
|
||||||
import com.cowr.service.ssjygl.customer.register.CustomerRegisterController;
|
import com.cowr.service.ssjygl.customer.register.CustomerRegisterController;
|
||||||
import com.cowr.service.ssjygl.customer.supermarketproduct.CustomerSupermarketProductController;
|
import com.cowr.service.ssjygl.customer.supermarketproduct.CustomerSupermarketProductController;
|
||||||
import com.cowr.service.ssjygl.driver.DriverController;
|
import com.cowr.service.ssjygl.driver.DriverController;
|
||||||
|
import com.cowr.service.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyController;
|
||||||
import com.cowr.service.ssjygl.invoice.log.InvoiceLogController;
|
import com.cowr.service.ssjygl.invoice.log.InvoiceLogController;
|
||||||
import com.cowr.service.ssjygl.invoice.receive.InvoiceReceiveController;
|
import com.cowr.service.ssjygl.invoice.receive.InvoiceReceiveController;
|
||||||
import com.cowr.service.ssjygl.netty.NettyServer;
|
import com.cowr.service.ssjygl.netty.NettyServer;
|
||||||
|
|
@ -193,6 +194,7 @@ public class Config extends JFinalConfig {
|
||||||
// -- 发票管理
|
// -- 发票管理
|
||||||
me.add("/invoice/log", InvoiceLogController.class);
|
me.add("/invoice/log", InvoiceLogController.class);
|
||||||
me.add("/invoice/receive", InvoiceReceiveController.class);
|
me.add("/invoice/receive", InvoiceReceiveController.class);
|
||||||
|
me.add("/invoice/invalidverify", InvoiceInvalidVerifyController.class);
|
||||||
|
|
||||||
// -- 日志
|
// -- 日志
|
||||||
me.add("/log/sms", SmsLogController.class);
|
me.add("/log/sms", SmsLogController.class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue