添加客户类型表、客户类型管理、客户分类树
parent
01344e1a52
commit
3923de4ccf
|
|
@ -3,3 +3,5 @@
|
|||
1. ssjygl-xs-common 本地和云端后端服务公用代码
|
||||
2. ssjygl-xs-local 本地后端服务
|
||||
3. ssjygl-xs-service 云端后端服务
|
||||
|
||||
2021年7月改版开发分支
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.cowr.model;
|
||||
|
||||
import com.cowr.model.base.BaseCustomerType;
|
||||
|
||||
/**
|
||||
* Generated by COWR Mon Jul 26 16:28:20 CST 2021
|
||||
* TableName: customer_type
|
||||
* Remarks: 客户相关 - 客户分类定义
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CustomerType extends BaseCustomerType<CustomerType> {
|
||||
public static final CustomerType dao = new CustomerType().dao();
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ package com.cowr.model;
|
|||
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Feb 26 16:03:22 CST 2021
|
||||
* Generated by COWR Mon Jul 26 16:28:20 CST 2021
|
||||
* <pre>
|
||||
* Example:
|
||||
* public void configPlugin(Plugins me) {
|
||||
|
|
@ -39,6 +39,7 @@ public class _MappingKit {
|
|||
arp.addMapping("purchase", "id", Purchase.class);
|
||||
arp.addMapping("supermarket", "id", Supermarket.class);
|
||||
arp.addMapping("customer", "id", Customer.class);
|
||||
arp.addMapping("customer_type", "id", CustomerType.class);
|
||||
arp.addMapping("customer_receiver", "id", CustomerReceiver.class);
|
||||
arp.addMapping("customer_register", "id", CustomerRegister.class);
|
||||
arp.addMapping("customer_contact", "id", CustomerContact.class);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.jfinal.plugin.activerecord.IBean;
|
|||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Aug 20 11:16:08 CST 2020
|
||||
* Generated by COWR Mon Jul 26 16:28:20 CST 2021
|
||||
* TableName: customer
|
||||
* Remarks: 客户相关 - 客户
|
||||
* PrimaryKey: id
|
||||
|
|
@ -15,8 +15,8 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
|
||||
public static final String tablename = "customer";
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public String getTablename() {
|
||||
@JSONField(serialize=false)
|
||||
public String getTablename(){
|
||||
return tablename;
|
||||
}
|
||||
|
||||
|
|
@ -26,10 +26,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: YES
|
||||
* defaultValue:
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@JSONField(name = "id")
|
||||
@JSONField(name="id")
|
||||
public void setId(Integer id) {
|
||||
set("id", id);
|
||||
}
|
||||
|
|
@ -38,7 +37,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return id
|
||||
*/
|
||||
@JSONField(name = "id")
|
||||
@JSONField(name="id")
|
||||
public Integer getId() {
|
||||
return getInt("id");
|
||||
}
|
||||
|
|
@ -49,10 +48,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
@JSONField(name = "name")
|
||||
@JSONField(name="name")
|
||||
public void setName(String name) {
|
||||
set("name", name);
|
||||
}
|
||||
|
|
@ -61,7 +59,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return name
|
||||
*/
|
||||
@JSONField(name = "name")
|
||||
@JSONField(name="name")
|
||||
public String getName() {
|
||||
return getStr("name");
|
||||
}
|
||||
|
|
@ -72,10 +70,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param address 开票地址
|
||||
*/
|
||||
@JSONField(name = "address")
|
||||
@JSONField(name="address")
|
||||
public void setAddress(String address) {
|
||||
set("address", address);
|
||||
}
|
||||
|
|
@ -84,7 +81,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return address 开票地址
|
||||
*/
|
||||
@JSONField(name = "address")
|
||||
@JSONField(name="address")
|
||||
public String getAddress() {
|
||||
return getStr("address");
|
||||
}
|
||||
|
|
@ -95,10 +92,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param phone 开票电话(可以是座机)
|
||||
*/
|
||||
@JSONField(name = "phone")
|
||||
@JSONField(name="phone")
|
||||
public void setPhone(String phone) {
|
||||
set("phone", phone);
|
||||
}
|
||||
|
|
@ -107,7 +103,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return phone 开票电话(可以是座机)
|
||||
*/
|
||||
@JSONField(name = "phone")
|
||||
@JSONField(name="phone")
|
||||
public String getPhone() {
|
||||
return getStr("phone");
|
||||
}
|
||||
|
|
@ -118,10 +114,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param texpayerName 开票公司名称
|
||||
*/
|
||||
@JSONField(name = "texpayer_name")
|
||||
@JSONField(name="texpayer_name")
|
||||
public void setTexpayerName(String texpayerName) {
|
||||
set("texpayer_name", texpayerName);
|
||||
}
|
||||
|
|
@ -130,7 +125,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return texpayer_name 开票公司名称
|
||||
*/
|
||||
@JSONField(name = "texpayer_name")
|
||||
@JSONField(name="texpayer_name")
|
||||
public String getTexpayerName() {
|
||||
return getStr("texpayer_name");
|
||||
}
|
||||
|
|
@ -141,10 +136,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param texpayerNum 税号
|
||||
*/
|
||||
@JSONField(name = "texpayer_num")
|
||||
@JSONField(name="texpayer_num")
|
||||
public void setTexpayerNum(String texpayerNum) {
|
||||
set("texpayer_num", texpayerNum);
|
||||
}
|
||||
|
|
@ -153,7 +147,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return texpayer_num 税号
|
||||
*/
|
||||
@JSONField(name = "texpayer_num")
|
||||
@JSONField(name="texpayer_num")
|
||||
public String getTexpayerNum() {
|
||||
return getStr("texpayer_num");
|
||||
}
|
||||
|
|
@ -164,10 +158,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param bankName 开户行名称
|
||||
*/
|
||||
@JSONField(name = "bank_name")
|
||||
@JSONField(name="bank_name")
|
||||
public void setBankName(String bankName) {
|
||||
set("bank_name", bankName);
|
||||
}
|
||||
|
|
@ -176,21 +169,20 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return bank_name 开户行名称
|
||||
*/
|
||||
@JSONField(name = "bank_name")
|
||||
@JSONField(name="bank_name")
|
||||
public String getBankName() {
|
||||
return getStr("bank_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: bank_account
|
||||
* type: VARCHAR(20)
|
||||
* type: VARCHAR(128)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param bankAccount 开户行账号
|
||||
*/
|
||||
@JSONField(name = "bank_account")
|
||||
@JSONField(name="bank_account")
|
||||
public void setBankAccount(String bankAccount) {
|
||||
set("bank_account", bankAccount);
|
||||
}
|
||||
|
|
@ -199,7 +191,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return bank_account 开户行账号
|
||||
*/
|
||||
@JSONField(name = "bank_account")
|
||||
@JSONField(name="bank_account")
|
||||
public String getBankAccount() {
|
||||
return getStr("bank_account");
|
||||
}
|
||||
|
|
@ -210,10 +202,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
*
|
||||
* @param memo
|
||||
*/
|
||||
@JSONField(name = "memo")
|
||||
@JSONField(name="memo")
|
||||
public void setMemo(String memo) {
|
||||
set("memo", memo);
|
||||
}
|
||||
|
|
@ -222,7 +213,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return memo
|
||||
*/
|
||||
@JSONField(name = "memo")
|
||||
@JSONField(name="memo")
|
||||
public String getMemo() {
|
||||
return getStr("memo");
|
||||
}
|
||||
|
|
@ -233,10 +224,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 0
|
||||
*
|
||||
* @param del
|
||||
*/
|
||||
@JSONField(name = "del")
|
||||
@JSONField(name="del")
|
||||
public void setDel(Integer del) {
|
||||
set("del", del);
|
||||
}
|
||||
|
|
@ -245,7 +235,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return del
|
||||
*/
|
||||
@JSONField(name = "del")
|
||||
@JSONField(name="del")
|
||||
public Integer getDel() {
|
||||
return getInt("del");
|
||||
}
|
||||
|
|
@ -256,10 +246,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 0
|
||||
*
|
||||
* @param type 是否预付费客户,0.不是,1.是
|
||||
*/
|
||||
@JSONField(name = "type")
|
||||
@JSONField(name="type")
|
||||
public void setType(Integer type) {
|
||||
set("type", type);
|
||||
}
|
||||
|
|
@ -268,7 +257,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return type 是否预付费客户,0.不是,1.是
|
||||
*/
|
||||
@JSONField(name = "type")
|
||||
@JSONField(name="type")
|
||||
public Integer getType() {
|
||||
return getInt("type");
|
||||
}
|
||||
|
|
@ -279,10 +268,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 1
|
||||
*
|
||||
* @param invoiceType 1.普票,2.专票
|
||||
*/
|
||||
@JSONField(name = "invoice_type")
|
||||
@JSONField(name="invoice_type")
|
||||
public void setInvoiceType(Integer invoiceType) {
|
||||
set("invoice_type", invoiceType);
|
||||
}
|
||||
|
|
@ -291,10 +279,54 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
|
|||
/**
|
||||
* @return invoice_type 1.普票,2.专票
|
||||
*/
|
||||
@JSONField(name = "invoice_type")
|
||||
@JSONField(name="invoice_type")
|
||||
public Integer getInvoiceType() {
|
||||
return getInt("invoice_type");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: weight_discount
|
||||
* type: DECIMAL(6,4)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 1.0000
|
||||
* @param weightDiscount 重量折扣系数
|
||||
*/
|
||||
@JSONField(name="weight_discount")
|
||||
public void setWeightDiscount(java.math.BigDecimal weightDiscount) {
|
||||
set("weight_discount", weightDiscount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return weight_discount 重量折扣系数
|
||||
*/
|
||||
@JSONField(name="weight_discount")
|
||||
public java.math.BigDecimal getWeightDiscount() {
|
||||
return get("weight_discount");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: customer_type_id
|
||||
* type: INT(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 0
|
||||
* @param customerTypeId 客户分类id
|
||||
*/
|
||||
@JSONField(name="customer_type_id")
|
||||
public void setCustomerTypeId(Integer customerTypeId) {
|
||||
set("customer_type_id", customerTypeId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return customer_type_id 客户分类id
|
||||
*/
|
||||
@JSONField(name="customer_type_id")
|
||||
public Integer getCustomerTypeId() {
|
||||
return getInt("customer_type_id");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
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 Jul 26 16:28:20 CST 2021
|
||||
* TableName: customer_type
|
||||
* Remarks: 客户相关 - 客户分类定义
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class BaseCustomerType<M extends BaseCustomerType<M>> extends BaseModel<M> implements IBean {
|
||||
|
||||
public static final String tablename = "customer_type";
|
||||
|
||||
@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: name
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param name 类型名称
|
||||
*/
|
||||
@JSONField(name="name")
|
||||
public void setName(String name) {
|
||||
set("name", name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return name 类型名称
|
||||
*/
|
||||
@JSONField(name="name")
|
||||
public String getName() {
|
||||
return getStr("name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: desc
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param desc 类型描述
|
||||
*/
|
||||
@JSONField(name="desc")
|
||||
public void setDesc(String desc) {
|
||||
set("desc", desc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return desc 类型描述
|
||||
*/
|
||||
@JSONField(name="desc")
|
||||
public String getDesc() {
|
||||
return getStr("desc");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.cowr.ssjygl.customer.type;
|
||||
|
||||
import com.cowr.common.view.Result;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Mon Jul 26 16:28:29 CST 2021
|
||||
* TableName: customer_type
|
||||
* Remarks: 客户相关 - 客户分类定义
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerTypeController extends Controller {
|
||||
|
||||
/**
|
||||
* 返回所有 customer_type 客户相关 - 客户分类定义
|
||||
*/
|
||||
public void list() {
|
||||
renderJson(Result.object(CustomerTypeService.me.list()));
|
||||
}
|
||||
|
||||
public void treedata() {
|
||||
renderJson(Result.object(CustomerTypeService.me.treedata()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.cowr.ssjygl.customer.type;
|
||||
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.CustomerType;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Mon Jul 26 16:28:30 CST 2021
|
||||
* TableName: customer_type
|
||||
* Remarks: 客户相关 - 客户分类定义
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerTypePKValidator 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,52 @@
|
|||
package com.cowr.ssjygl.customer.type;
|
||||
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.utils.DataUtil;
|
||||
import com.cowr.model.CustomerType;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generated by COWR Mon Jul 26 16:28:30 CST 2021
|
||||
* TableName: customer_type
|
||||
* Remarks: 客户相关 - 客户分类定义
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerTypeService extends BaseService {
|
||||
private static final Log log = Log.getLog(CustomerTypeService.class);
|
||||
public static final CustomerTypeService me = new CustomerTypeService();
|
||||
|
||||
public List<Record> treedata() {
|
||||
List<Record> list = Db.find("select id, name, -1 pid from customer_type ");
|
||||
List<Record> cus = Db.find("select concat('customer_id_', id) id, name, customer_type_id pid, id customer_id from customer ");
|
||||
|
||||
list.addAll(cus);
|
||||
|
||||
List<Record> out = DataUtil.transformToTreeFormat(list);
|
||||
|
||||
out.sort(new Comparator<Record>() {
|
||||
@Override
|
||||
public int compare(Record o1, Record o2) {
|
||||
if (o1.getInt("id") == 0 || o2.getInt("id") == 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return o1.getInt("id") - o2.getInt("id");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
List<Record> root = new ArrayList<>();
|
||||
root.add(new Record().set("id", -1).set("name", "全部").set("children", out));
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
public List<CustomerType> list() {
|
||||
return CustomerType.dao.find("select * from customer_type");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.cowr.ssjygl.customer.type;
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.CustomerType;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Mon Jul 26 16:28:30 CST 2021
|
||||
* TableName: customer_type
|
||||
* Remarks: 客户相关 - 客户分类定义
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerTypeValidator 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("name", 1, 255, "name", "name 长度 0~255");
|
||||
validateString("desc", 0, 255, "desc", "desc 长度 0~255");
|
||||
|
||||
// 使用 model 更新时,model 不能只有主键有值
|
||||
// 这里用 getActionMethodName 写死,判断是 update 时,才做验证
|
||||
// 如果确实是需要将主键外的字段置为 null,可以在代码生成后删掉这段
|
||||
if ("edit".equals(getActionMethodName())) {
|
||||
validateUpdateModel(CustomerType.class, "", true); // 忽略不在model中的字段
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -83,6 +83,7 @@ public class Main {
|
|||
"ticket_invalid_verify",
|
||||
"ticket_log",
|
||||
"ticket_receive",
|
||||
"customer_type",
|
||||
};
|
||||
|
||||
PropKit.use("db.properties");
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class Printer {
|
|||
return;
|
||||
}
|
||||
lock.lock();
|
||||
try {
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
Socket socket = new Socket();
|
||||
socket.setOOBInline(false);
|
||||
socket.setTcpNoDelay(true);
|
||||
|
|
@ -30,45 +30,49 @@ public class Printer {
|
|||
socket.setSoTimeout(15000);
|
||||
socket.connect(new InetSocketAddress(ip, port), 5000);
|
||||
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
OutputStream out = socket.getOutputStream();
|
||||
int l1 = (int) (file.length() >> 56);
|
||||
int l2 = (int) (file.length() >> 48);
|
||||
int l3 = (int) (file.length() >> 40);
|
||||
int l4 = (int) (file.length() >> 32);
|
||||
int l5 = (int) (file.length() >> 24);
|
||||
int l6 = (int) (file.length() >> 16);
|
||||
int l7 = (int) (file.length() >> 8);
|
||||
int l8 = (int) file.length();
|
||||
out.write(l1);
|
||||
out.write(l2);
|
||||
out.write(l3);
|
||||
out.write(l4);
|
||||
out.write(l5);
|
||||
out.write(l6);
|
||||
out.write(l7);
|
||||
out.write(l8);
|
||||
out.flush();
|
||||
byte[] buf = new byte[1024];
|
||||
try (OutputStream out = socket.getOutputStream()) {
|
||||
int l1 = (int) (file.length() >> 56);
|
||||
int l2 = (int) (file.length() >> 48);
|
||||
int l3 = (int) (file.length() >> 40);
|
||||
int l4 = (int) (file.length() >> 32);
|
||||
int l5 = (int) (file.length() >> 24);
|
||||
int l6 = (int) (file.length() >> 16);
|
||||
int l7 = (int) (file.length() >> 8);
|
||||
int l8 = (int) file.length();
|
||||
|
||||
while (true) {
|
||||
int read = fis.read(buf);
|
||||
if (read == -1) {
|
||||
break;
|
||||
}
|
||||
out.write(buf, 0, read);
|
||||
out.write(l1);
|
||||
out.write(l2);
|
||||
out.write(l3);
|
||||
out.write(l4);
|
||||
out.write(l5);
|
||||
out.write(l6);
|
||||
out.write(l7);
|
||||
out.write(l8);
|
||||
out.flush();
|
||||
}
|
||||
fis.close();
|
||||
byte[] buf = new byte[1024];
|
||||
|
||||
InputStream in = socket.getInputStream();
|
||||
while (true) {
|
||||
int i = in.read();
|
||||
if (i != 0) {
|
||||
break;
|
||||
while (true) {
|
||||
int read = fis.read(buf);
|
||||
if (read == -1) {
|
||||
break;
|
||||
}
|
||||
out.write(buf, 0, read);
|
||||
out.flush();
|
||||
}
|
||||
|
||||
InputStream in = socket.getInputStream();
|
||||
while (true) {
|
||||
int i = in.read();
|
||||
if (i != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
package com.cowr.local.ssjygl.devicectrl.printer;
|
||||
|
||||
import com.jfinal.log.Log;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbookFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
|
@ -20,14 +20,11 @@ public class ExcelHelper {
|
|||
static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
|
||||
public static Workbook genExcel(Map<String, Object> model, File tplFile) {
|
||||
FileInputStream is = null;
|
||||
try {
|
||||
try (FileInputStream is = new FileInputStream(tplFile)) {
|
||||
long st = System.currentTimeMillis();
|
||||
Map<String, CellAddress> addrMap;
|
||||
CellAddress datetimePrint;
|
||||
|
||||
is = new FileInputStream(tplFile);
|
||||
|
||||
Workbook workbook = XSSFWorkbookFactory.create(is);
|
||||
log.debug("读取模板耗时:" + (System.currentTimeMillis() - st));
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
|
@ -70,15 +67,6 @@ public class ExcelHelper {
|
|||
return workbook;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
is = null;
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.cowr.local.ssjygl.jobs;
|
||||
|
||||
import com.cowr.local.ssjygl.devicectrl.common.Const;
|
||||
import com.cowr.local.ssjygl.main.Config;
|
||||
import com.jfinal.log.Log;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ClearTempFileJob implements Job {
|
||||
private static Log log = Log.getLog(ClearTempFileJob.class);
|
||||
|
||||
private void clearImg() {
|
||||
long now = System.currentTimeMillis();
|
||||
String dir = Config.getRootPath() + File.separator + Const.LicenseImgTmpFolder;
|
||||
|
||||
File baseDir = new File(dir);
|
||||
File[] files = baseDir.listFiles();
|
||||
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
File img = files[i];
|
||||
long st = img.lastModified();
|
||||
|
||||
// 缩略图 名称带 _ , 原图名称带 - ,超过2天后,都删掉
|
||||
if (img.getName().contains("_") || img.getName().contains("-")) {
|
||||
if (now - st > 2 * 24 * 60 * 60 * 1000) {
|
||||
img.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearXlsx() {
|
||||
long now = System.currentTimeMillis();
|
||||
String dir = Config.getRootPath() + File.separator + Const.PringExcelTmpFolder;
|
||||
|
||||
File baseDir = new File(dir);
|
||||
File[] files = baseDir.listFiles();
|
||||
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
File xlsx = files[i];
|
||||
long st = xlsx.lastModified();
|
||||
if (now - st > 2 * 24 * 60 * 60 * 1000) {
|
||||
xlsx.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
try {
|
||||
clearImg();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
try {
|
||||
clearXlsx();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ 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.receive.InvoiceReceiveController;
|
||||
import com.cowr.local.ssjygl.jobs.ClearTempFileJob;
|
||||
import com.cowr.local.ssjygl.netty.NettyClient;
|
||||
import com.cowr.local.ssjygl.netty.SocketIOService;
|
||||
import com.cowr.local.ssjygl.order.invalidverify.OrderInvalidVerifyController;
|
||||
|
|
@ -64,14 +65,10 @@ import com.cowr.model._MappingKit;
|
|||
import com.cowr.ssjygl.CacheData;
|
||||
import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController;
|
||||
import com.cowr.ssjygl.cctv.CctvController;
|
||||
import com.cowr.local.ssjygl.prepay.PrepayController;
|
||||
import com.cowr.local.ssjygl.overall.OverallController;
|
||||
import com.cowr.ssjygl.modifylog.ModifyLogController;
|
||||
import com.cowr.ssjygl.stat.invoice.InvoiceUseController;
|
||||
import com.cowr.ssjygl.stat.purchase.OrderPurchaseStatController;
|
||||
import com.cowr.local.ssjygl.stat.sale.OrderStatController;
|
||||
import com.cowr.ssjygl.stat.transfer.OrderTransferStatController;
|
||||
import com.cowr.local.ssjygl.system.sysuser.SysuserController;
|
||||
import com.cowr.ssjygl.transportcompany.TransportCompanyService;
|
||||
import com.cowr.ssjygl.transprice.TransPriceService;
|
||||
import com.jfinal.config.*;
|
||||
|
|
@ -88,10 +85,6 @@ import com.jfinal.plugin.druid.DruidPlugin;
|
|||
import com.jfinal.plugin.druid.DruidStatViewHandler;
|
||||
import com.jfinal.plugin.redis.RedisPlugin;
|
||||
import com.jfinal.template.Engine;
|
||||
import com.cowr.common.Interceptor.ReporterInterceptor;
|
||||
import com.cowr.common.handler.GlobalHandler;
|
||||
import com.cowr.common.view.JsonRenderFactory;
|
||||
import com.cowr.model._MappingKit;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
|
|
@ -409,6 +402,8 @@ public class Config extends JFinalConfig {
|
|||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
new ClearTempFileJob().clear();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,9 +465,7 @@ public class LocalOrderService {
|
|||
return null;
|
||||
}
|
||||
|
||||
FileOutputStream output = null;
|
||||
Workbook wb = null;
|
||||
|
||||
Workbook wb = null;
|
||||
try {
|
||||
Object invoice_type = data.get("invoice_type"); // 可能是 null
|
||||
|
||||
|
|
@ -491,27 +489,21 @@ public class LocalOrderService {
|
|||
System.currentTimeMillis()
|
||||
));
|
||||
|
||||
output = new FileOutputStream(out);
|
||||
wb.write(output);
|
||||
try (FileOutputStream output = new FileOutputStream(out)) {
|
||||
wb.write(output);
|
||||
|
||||
log.debug("生成票据打印文件: %s", out.getAbsolutePath());
|
||||
log.debug("生成文件耗时2:%s", System.currentTimeMillis() - st);
|
||||
log.debug("生成票据打印文件: %s", out.getAbsolutePath());
|
||||
log.debug("生成文件耗时2:%s", System.currentTimeMillis() - st);
|
||||
|
||||
return out;
|
||||
return out;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
} finally {
|
||||
if (output != null) {
|
||||
try {
|
||||
output.flush();
|
||||
output.close();
|
||||
output = null;
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
if (wb != null) {
|
||||
try {
|
||||
wb.close();
|
||||
|
|
|
|||
|
|
@ -7,3 +7,8 @@ synctask.enable=true
|
|||
checkundonordercluster.job=com.cowr.local.ssjygl.jobs.CheckUndonOrderclusterJob
|
||||
checkundonordercluster.cron= 1 0 0 * * ?
|
||||
checkundonordercluster.enable=true
|
||||
|
||||
# 删除超过2天的无用图片、打印生成的 excel
|
||||
cleartempfile.job=com.cowr.local.ssjygl.jobs.ClearTempFileJob
|
||||
cleartempfile.cron= 1 0 1 * * ?
|
||||
cleartempfile.enable=true
|
||||
|
|
@ -24,7 +24,7 @@ default_scale_wait_time=8000
|
|||
weigh.max=49
|
||||
|
||||
#集团订单剩余量在结算时的剩余量预警值
|
||||
surplus.threshold=30
|
||||
surplus.threshold=125
|
||||
|
||||
#打印用到的配置信息
|
||||
print.vendor=浠水县长投环保有限公司
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ import com.cowr.service.ssjygl.truck.TruckController;
|
|||
import com.cowr.ssjygl.CacheData;
|
||||
import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController;
|
||||
import com.cowr.ssjygl.cctv.CctvController;
|
||||
import com.cowr.ssjygl.customer.type.CustomerTypeController;
|
||||
import com.cowr.ssjygl.modifylog.ModifyLogController;
|
||||
import com.cowr.ssjygl.stat.invoice.InvoiceUseController;
|
||||
import com.cowr.ssjygl.stat.purchase.OrderPurchaseStatController;
|
||||
|
|
@ -184,6 +185,7 @@ public class Config extends JFinalConfig {
|
|||
me.add("/customer/register", CustomerRegisterController.class);
|
||||
me.add("/customer/pact", CustomerPactController.class);
|
||||
me.add("/customer/csp", CustomerSupermarketProductController.class);
|
||||
me.add("/customer/type", CustomerTypeController.class);
|
||||
|
||||
// -- 预付费
|
||||
me.add("/prepay", PrepayController.class);
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ public class PrepayController extends BaseController {
|
|||
}
|
||||
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
Integer invoice_type = getInt("invoice_type");
|
||||
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
String truck_license = get("truck_license");
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import com.cowr.common.view.Result;
|
|||
import com.cowr.model.Customer;
|
||||
import com.cowr.model.CustomerReceiver;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.service.ssjygl.customer.register.CustomerRegisterService;
|
||||
import com.cowr.service.ssjygl.main.AuthInterceptor;
|
||||
import com.cowr.ssjygl.system.sysuser.SysuserPKValidator;
|
||||
import com.cowr.ssjygl.system.sysuser.SysuserValidator;
|
||||
|
|
@ -71,8 +70,9 @@ public class SysuserController extends Controller {
|
|||
String receiver_phone = get("receiver_phone");
|
||||
String receiver_address = get("receiver_address");
|
||||
Integer invoice_type = getInt("invoice_type", 1);
|
||||
Integer customer_type_id = getInt("customer_type_id", 1);
|
||||
|
||||
renderJson(SysuserSyncService.me.saveCustomer(model, texpayer_name, receiver_name, receiver_phone, receiver_address, invoice_type, tokenuser));
|
||||
renderJson(SysuserSyncService.me.saveCustomer(model, texpayer_name, receiver_name, receiver_phone, receiver_address, invoice_type, customer_type_id, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -137,9 +137,10 @@ public class SysuserController extends Controller {
|
|||
String receiver_phone = get("receiver_phone");
|
||||
String receiver_address = get("receiver_address");
|
||||
Integer invoice_type = getInt("invoice_type", 1);
|
||||
Integer customer_type_id = getInt("customer_type_id", 0);
|
||||
|
||||
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(SysuserSyncService.me.updateCustomer(model, texpayer_name, receiver_name, receiver_phone, receiver_address, invoice_type, tokenuser));
|
||||
renderJson(SysuserSyncService.me.updateCustomer(model, texpayer_name, receiver_name, receiver_phone, receiver_address, invoice_type, customer_type_id, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -139,10 +139,11 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
/**
|
||||
* 是否财务经理
|
||||
* 预付费审批、退费审批
|
||||
*
|
||||
* @param roleid
|
||||
* @return
|
||||
*/
|
||||
public boolean isFinanceManager(Integer roleid){
|
||||
public boolean isFinanceManager(Integer roleid) {
|
||||
if (roleid == null) return false;
|
||||
return roleid.equals(RoleEnum.FINANCEMANAGER.getRoleid());
|
||||
}
|
||||
|
|
@ -369,6 +370,7 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
String receiver_phone,
|
||||
String receiver_address,
|
||||
Integer invoice_type,
|
||||
Integer customer_type_id,
|
||||
Sysuser tokenuser
|
||||
) {
|
||||
try {
|
||||
|
|
@ -385,6 +387,7 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
customer.setName(texpayer_name);
|
||||
customer.setTexpayerName(texpayer_name);
|
||||
customer.setInvoiceType(invoice_type);
|
||||
customer.setCustomerTypeId(customer_type_id);
|
||||
|
||||
if (customer.checkDuplicate("name")) {
|
||||
return Result.failed(false, "名称已存在");
|
||||
|
|
@ -464,6 +467,7 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
String receiver_phone,
|
||||
String receiver_address,
|
||||
Integer invoice_type,
|
||||
Integer customer_type_id,
|
||||
Sysuser tokenuser
|
||||
) {
|
||||
try {
|
||||
|
|
@ -504,6 +508,7 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
customer.setName(texpayer_name);
|
||||
customer.setTexpayerName(texpayer_name);
|
||||
customer.setInvoiceType(invoice_type);
|
||||
customer.setCustomerTypeId(customer_type_id);
|
||||
|
||||
chkobj.setName(model.getName());
|
||||
chkobj.setPhone(model.getPhone());
|
||||
|
|
|
|||
Loading…
Reference in New Issue