添加客户类型表、客户类型管理、客户分类树

dev
lisai17@sina.com 2021-07-26 17:37:07 +08:00
parent 01344e1a52
commit 3923de4ccf
21 changed files with 496 additions and 158 deletions

View File

@ -3,3 +3,5 @@
1. ssjygl-xs-common 本地和云端后端服务公用代码 1. ssjygl-xs-common 本地和云端后端服务公用代码
2. ssjygl-xs-local 本地后端服务 2. ssjygl-xs-local 本地后端服务
3. ssjygl-xs-service 云端后端服务 3. ssjygl-xs-service 云端后端服务
2021年7月改版开发分支

View File

@ -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();
}

View File

@ -3,7 +3,7 @@ package com.cowr.model;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin; 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> * <pre>
* Example: * Example:
* public void configPlugin(Plugins me) { * public void configPlugin(Plugins me) {
@ -39,6 +39,7 @@ public class _MappingKit {
arp.addMapping("purchase", "id", Purchase.class); arp.addMapping("purchase", "id", Purchase.class);
arp.addMapping("supermarket", "id", Supermarket.class); arp.addMapping("supermarket", "id", Supermarket.class);
arp.addMapping("customer", "id", Customer.class); arp.addMapping("customer", "id", Customer.class);
arp.addMapping("customer_type", "id", CustomerType.class);
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);

View File

@ -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 Thu Aug 20 11:16:08 CST 2020 * Generated by COWR Mon Jul 26 16:28:20 CST 2021
* TableName: customer * TableName: customer
* Remarks: - * Remarks: -
* PrimaryKey: id * PrimaryKey: id
@ -15,8 +15,8 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
public static final String tablename = "customer"; public static final String tablename = "customer";
@JSONField(serialize = false) @JSONField(serialize=false)
public String getTablename() { public String getTablename(){
return tablename; return tablename;
} }
@ -26,10 +26,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: NO * isNullable: NO
* isPrimaryKey: YES * isPrimaryKey: YES
* defaultValue: * defaultValue:
*
* @param id * @param id
*/ */
@JSONField(name = "id") @JSONField(name="id")
public void setId(Integer id) { public void setId(Integer id) {
set("id", id); set("id", id);
} }
@ -38,7 +37,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return id * @return id
*/ */
@JSONField(name = "id") @JSONField(name="id")
public Integer getId() { public Integer getId() {
return getInt("id"); return getInt("id");
} }
@ -49,10 +48,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: NO * isNullable: NO
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param name * @param name
*/ */
@JSONField(name = "name") @JSONField(name="name")
public void setName(String name) { public void setName(String name) {
set("name", name); set("name", name);
} }
@ -61,7 +59,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return name * @return name
*/ */
@JSONField(name = "name") @JSONField(name="name")
public String getName() { public String getName() {
return getStr("name"); return getStr("name");
} }
@ -72,10 +70,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: YES * isNullable: YES
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param address * @param address
*/ */
@JSONField(name = "address") @JSONField(name="address")
public void setAddress(String address) { public void setAddress(String address) {
set("address", address); set("address", address);
} }
@ -84,7 +81,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return address * @return address
*/ */
@JSONField(name = "address") @JSONField(name="address")
public String getAddress() { public String getAddress() {
return getStr("address"); return getStr("address");
} }
@ -95,10 +92,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: YES * isNullable: YES
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param phone * @param phone
*/ */
@JSONField(name = "phone") @JSONField(name="phone")
public void setPhone(String phone) { public void setPhone(String phone) {
set("phone", phone); set("phone", phone);
} }
@ -107,7 +103,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return phone * @return phone
*/ */
@JSONField(name = "phone") @JSONField(name="phone")
public String getPhone() { public String getPhone() {
return getStr("phone"); return getStr("phone");
} }
@ -118,10 +114,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: YES * isNullable: YES
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param texpayerName * @param texpayerName
*/ */
@JSONField(name = "texpayer_name") @JSONField(name="texpayer_name")
public void setTexpayerName(String texpayerName) { public void setTexpayerName(String texpayerName) {
set("texpayer_name", texpayerName); set("texpayer_name", texpayerName);
} }
@ -130,7 +125,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return texpayer_name * @return texpayer_name
*/ */
@JSONField(name = "texpayer_name") @JSONField(name="texpayer_name")
public String getTexpayerName() { public String getTexpayerName() {
return getStr("texpayer_name"); return getStr("texpayer_name");
} }
@ -141,10 +136,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: YES * isNullable: YES
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param texpayerNum * @param texpayerNum
*/ */
@JSONField(name = "texpayer_num") @JSONField(name="texpayer_num")
public void setTexpayerNum(String texpayerNum) { public void setTexpayerNum(String texpayerNum) {
set("texpayer_num", texpayerNum); set("texpayer_num", texpayerNum);
} }
@ -153,7 +147,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return texpayer_num * @return texpayer_num
*/ */
@JSONField(name = "texpayer_num") @JSONField(name="texpayer_num")
public String getTexpayerNum() { public String getTexpayerNum() {
return getStr("texpayer_num"); return getStr("texpayer_num");
} }
@ -164,10 +158,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: YES * isNullable: YES
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param bankName * @param bankName
*/ */
@JSONField(name = "bank_name") @JSONField(name="bank_name")
public void setBankName(String bankName) { public void setBankName(String bankName) {
set("bank_name", bankName); set("bank_name", bankName);
} }
@ -176,21 +169,20 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return bank_name * @return bank_name
*/ */
@JSONField(name = "bank_name") @JSONField(name="bank_name")
public String getBankName() { public String getBankName() {
return getStr("bank_name"); return getStr("bank_name");
} }
/** /**
* name: bank_account * name: bank_account
* type: VARCHAR(20) * type: VARCHAR(128)
* isNullable: YES * isNullable: YES
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param bankAccount * @param bankAccount
*/ */
@JSONField(name = "bank_account") @JSONField(name="bank_account")
public void setBankAccount(String bankAccount) { public void setBankAccount(String bankAccount) {
set("bank_account", bankAccount); set("bank_account", bankAccount);
} }
@ -199,7 +191,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return bank_account * @return bank_account
*/ */
@JSONField(name = "bank_account") @JSONField(name="bank_account")
public String getBankAccount() { public String getBankAccount() {
return getStr("bank_account"); return getStr("bank_account");
} }
@ -210,10 +202,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: YES * isNullable: YES
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: * defaultValue:
*
* @param memo * @param memo
*/ */
@JSONField(name = "memo") @JSONField(name="memo")
public void setMemo(String memo) { public void setMemo(String memo) {
set("memo", memo); set("memo", memo);
} }
@ -222,7 +213,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return memo * @return memo
*/ */
@JSONField(name = "memo") @JSONField(name="memo")
public String getMemo() { public String getMemo() {
return getStr("memo"); return getStr("memo");
} }
@ -233,10 +224,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: NO * isNullable: NO
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: 0 * defaultValue: 0
*
* @param del * @param del
*/ */
@JSONField(name = "del") @JSONField(name="del")
public void setDel(Integer del) { public void setDel(Integer del) {
set("del", del); set("del", del);
} }
@ -245,7 +235,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return del * @return del
*/ */
@JSONField(name = "del") @JSONField(name="del")
public Integer getDel() { public Integer getDel() {
return getInt("del"); return getInt("del");
} }
@ -256,10 +246,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: NO * isNullable: NO
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: 0 * defaultValue: 0
*
* @param type 0.1. * @param type 0.1.
*/ */
@JSONField(name = "type") @JSONField(name="type")
public void setType(Integer type) { public void setType(Integer type) {
set("type", type); set("type", type);
} }
@ -268,7 +257,7 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return type 0.1. * @return type 0.1.
*/ */
@JSONField(name = "type") @JSONField(name="type")
public Integer getType() { public Integer getType() {
return getInt("type"); return getInt("type");
} }
@ -279,10 +268,9 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
* isNullable: NO * isNullable: NO
* isPrimaryKey: NO * isPrimaryKey: NO
* defaultValue: 1 * defaultValue: 1
*
* @param invoiceType 1.2. * @param invoiceType 1.2.
*/ */
@JSONField(name = "invoice_type") @JSONField(name="invoice_type")
public void setInvoiceType(Integer invoiceType) { public void setInvoiceType(Integer invoiceType) {
set("invoice_type", invoiceType); set("invoice_type", invoiceType);
} }
@ -291,10 +279,54 @@ public abstract class BaseCustomer<M extends BaseCustomer<M>> extends BaseModel<
/** /**
* @return invoice_type 1.2. * @return invoice_type 1.2.
*/ */
@JSONField(name = "invoice_type") @JSONField(name="invoice_type")
public Integer getInvoiceType() { public Integer getInvoiceType() {
return getInt("invoice_type"); 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");
}
} }

View File

@ -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");
}
}

View File

@ -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()));
}
}

View File

@ -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()));
}
}

View File

@ -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");
}
}

View File

@ -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()));
}
}

View File

@ -83,6 +83,7 @@ public class Main {
"ticket_invalid_verify", "ticket_invalid_verify",
"ticket_log", "ticket_log",
"ticket_receive", "ticket_receive",
"customer_type",
}; };
PropKit.use("db.properties"); PropKit.use("db.properties");

View File

@ -20,7 +20,7 @@ public class Printer {
return; return;
} }
lock.lock(); lock.lock();
try { try (FileInputStream fis = new FileInputStream(file)) {
Socket socket = new Socket(); Socket socket = new Socket();
socket.setOOBInline(false); socket.setOOBInline(false);
socket.setTcpNoDelay(true); socket.setTcpNoDelay(true);
@ -30,8 +30,7 @@ public class Printer {
socket.setSoTimeout(15000); socket.setSoTimeout(15000);
socket.connect(new InetSocketAddress(ip, port), 5000); socket.connect(new InetSocketAddress(ip, port), 5000);
FileInputStream fis = new FileInputStream(file); try (OutputStream out = socket.getOutputStream()) {
OutputStream out = socket.getOutputStream();
int l1 = (int) (file.length() >> 56); int l1 = (int) (file.length() >> 56);
int l2 = (int) (file.length() >> 48); int l2 = (int) (file.length() >> 48);
int l3 = (int) (file.length() >> 40); int l3 = (int) (file.length() >> 40);
@ -40,6 +39,7 @@ public class Printer {
int l6 = (int) (file.length() >> 16); int l6 = (int) (file.length() >> 16);
int l7 = (int) (file.length() >> 8); int l7 = (int) (file.length() >> 8);
int l8 = (int) file.length(); int l8 = (int) file.length();
out.write(l1); out.write(l1);
out.write(l2); out.write(l2);
out.write(l3); out.write(l3);
@ -59,7 +59,6 @@ public class Printer {
out.write(buf, 0, read); out.write(buf, 0, read);
out.flush(); out.flush();
} }
fis.close();
InputStream in = socket.getInputStream(); InputStream in = socket.getInputStream();
while (true) { while (true) {
@ -69,6 +68,11 @@ public class Printer {
} }
} }
socket.close(); socket.close();
} catch (Exception e) {
throw e;
}
} catch (Exception e) {
throw e;
} finally { } finally {
lock.unlock(); lock.unlock();
} }

View File

@ -1,15 +1,15 @@
package com.cowr.local.ssjygl.devicectrl.printer; package com.cowr.local.ssjygl.devicectrl.printer;
import com.jfinal.log.Log; 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.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 org.apache.poi.xssf.usermodel.XSSFWorkbookFactory;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -20,14 +20,11 @@ public class ExcelHelper {
static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
public static Workbook genExcel(Map<String, Object> model, File tplFile) { public static Workbook genExcel(Map<String, Object> model, File tplFile) {
FileInputStream is = null; try (FileInputStream is = new FileInputStream(tplFile)) {
try {
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
Map<String, CellAddress> addrMap; Map<String, CellAddress> addrMap;
CellAddress datetimePrint; CellAddress datetimePrint;
is = new FileInputStream(tplFile);
Workbook workbook = XSSFWorkbookFactory.create(is); Workbook workbook = XSSFWorkbookFactory.create(is);
log.debug("读取模板耗时:" + (System.currentTimeMillis() - st)); log.debug("读取模板耗时:" + (System.currentTimeMillis() - st));
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
@ -70,15 +67,6 @@ public class ExcelHelper {
return workbook; return workbook;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), 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; return null;

View File

@ -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();
}
}

View File

@ -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.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.jobs.ClearTempFileJob;
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.invalidverify.OrderInvalidVerifyController;
@ -64,14 +65,10 @@ 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.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.overall.OverallController;
import com.cowr.ssjygl.modifylog.ModifyLogController; import com.cowr.ssjygl.modifylog.ModifyLogController;
import com.cowr.ssjygl.stat.invoice.InvoiceUseController; import com.cowr.ssjygl.stat.invoice.InvoiceUseController;
import com.cowr.ssjygl.stat.purchase.OrderPurchaseStatController; 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.ssjygl.stat.transfer.OrderTransferStatController;
import com.cowr.local.ssjygl.system.sysuser.SysuserController;
import com.cowr.ssjygl.transportcompany.TransportCompanyService; import com.cowr.ssjygl.transportcompany.TransportCompanyService;
import com.cowr.ssjygl.transprice.TransPriceService; import com.cowr.ssjygl.transprice.TransPriceService;
import com.jfinal.config.*; import com.jfinal.config.*;
@ -88,10 +85,6 @@ import com.jfinal.plugin.druid.DruidPlugin;
import com.jfinal.plugin.druid.DruidStatViewHandler; 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 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.io.File;
import java.sql.Connection; import java.sql.Connection;
@ -409,6 +402,8 @@ public class Config extends JFinalConfig {
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
new ClearTempFileJob().clear();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }

View File

@ -465,9 +465,7 @@ public class LocalOrderService {
return null; return null;
} }
FileOutputStream output = null;
Workbook wb = null; Workbook wb = null;
try { try {
Object invoice_type = data.get("invoice_type"); // 可能是 null Object invoice_type = data.get("invoice_type"); // 可能是 null
@ -491,7 +489,7 @@ public class LocalOrderService {
System.currentTimeMillis() System.currentTimeMillis()
)); ));
output = new FileOutputStream(out); try (FileOutputStream output = new FileOutputStream(out)) {
wb.write(output); wb.write(output);
log.debug("生成票据打印文件: %s", out.getAbsolutePath()); log.debug("生成票据打印文件: %s", out.getAbsolutePath());
@ -501,17 +499,11 @@ public class LocalOrderService {
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return null; return null;
} finally { }
if (output != null) { } catch (Exception e) {
try {
output.flush();
output.close();
output = null;
} catch (IOException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} return null;
} } finally {
if (wb != null) { if (wb != null) {
try { try {
wb.close(); wb.close();

View File

@ -7,3 +7,8 @@ synctask.enable=true
checkundonordercluster.job=com.cowr.local.ssjygl.jobs.CheckUndonOrderclusterJob checkundonordercluster.job=com.cowr.local.ssjygl.jobs.CheckUndonOrderclusterJob
checkundonordercluster.cron= 1 0 0 * * ? checkundonordercluster.cron= 1 0 0 * * ?
checkundonordercluster.enable=true checkundonordercluster.enable=true
# 删除超过2天的无用图片、打印生成的 excel
cleartempfile.job=com.cowr.local.ssjygl.jobs.ClearTempFileJob
cleartempfile.cron= 1 0 1 * * ?
cleartempfile.enable=true

View File

@ -24,7 +24,7 @@ default_scale_wait_time=8000
weigh.max=49 weigh.max=49
#集团订单剩余量在结算时的剩余量预警值 #集团订单剩余量在结算时的剩余量预警值
surplus.threshold=30 surplus.threshold=125
#打印用到的配置信息 #打印用到的配置信息
print.vendor=浠水县长投环保有限公司 print.vendor=浠水县长投环保有限公司

View File

@ -61,6 +61,7 @@ import com.cowr.service.ssjygl.truck.TruckController;
import com.cowr.ssjygl.CacheData; import com.cowr.ssjygl.CacheData;
import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController; import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController;
import com.cowr.ssjygl.cctv.CctvController; import com.cowr.ssjygl.cctv.CctvController;
import com.cowr.ssjygl.customer.type.CustomerTypeController;
import com.cowr.ssjygl.modifylog.ModifyLogController; import com.cowr.ssjygl.modifylog.ModifyLogController;
import com.cowr.ssjygl.stat.invoice.InvoiceUseController; import com.cowr.ssjygl.stat.invoice.InvoiceUseController;
import com.cowr.ssjygl.stat.purchase.OrderPurchaseStatController; 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/register", CustomerRegisterController.class);
me.add("/customer/pact", CustomerPactController.class); me.add("/customer/pact", CustomerPactController.class);
me.add("/customer/csp", CustomerSupermarketProductController.class); me.add("/customer/csp", CustomerSupermarketProductController.class);
me.add("/customer/type", CustomerTypeController.class);
// -- 预付费 // -- 预付费
me.add("/prepay", PrepayController.class); me.add("/prepay", PrepayController.class);

View File

@ -52,8 +52,6 @@ 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");

View File

@ -7,7 +7,6 @@ import com.cowr.common.view.Result;
import com.cowr.model.Customer; import com.cowr.model.Customer;
import com.cowr.model.CustomerReceiver; import com.cowr.model.CustomerReceiver;
import com.cowr.model.Sysuser; import com.cowr.model.Sysuser;
import com.cowr.service.ssjygl.customer.register.CustomerRegisterService;
import com.cowr.service.ssjygl.main.AuthInterceptor; import com.cowr.service.ssjygl.main.AuthInterceptor;
import com.cowr.ssjygl.system.sysuser.SysuserPKValidator; import com.cowr.ssjygl.system.sysuser.SysuserPKValidator;
import com.cowr.ssjygl.system.sysuser.SysuserValidator; import com.cowr.ssjygl.system.sysuser.SysuserValidator;
@ -71,8 +70,9 @@ public class SysuserController extends Controller {
String receiver_phone = get("receiver_phone"); String receiver_phone = get("receiver_phone");
String receiver_address = get("receiver_address"); String receiver_address = get("receiver_address");
Integer invoice_type = getInt("invoice_type", 1); 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_phone = get("receiver_phone");
String receiver_address = get("receiver_address"); String receiver_address = get("receiver_address");
Integer invoice_type = getInt("invoice_type", 1); Integer invoice_type = getInt("invoice_type", 1);
Integer customer_type_id = getInt("customer_type_id", 0);
Sysuser model = getModel(Sysuser.class, "", true); // 忽略不在model中的字段 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));
} }
/** /**

View File

@ -139,10 +139,11 @@ public class SysuserSyncService extends BaseSyncService {
/** /**
* *
* 退 * 退
*
* @param roleid * @param roleid
* @return * @return
*/ */
public boolean isFinanceManager(Integer roleid){ public boolean isFinanceManager(Integer roleid) {
if (roleid == null) return false; if (roleid == null) return false;
return roleid.equals(RoleEnum.FINANCEMANAGER.getRoleid()); return roleid.equals(RoleEnum.FINANCEMANAGER.getRoleid());
} }
@ -369,6 +370,7 @@ public class SysuserSyncService extends BaseSyncService {
String receiver_phone, String receiver_phone,
String receiver_address, String receiver_address,
Integer invoice_type, Integer invoice_type,
Integer customer_type_id,
Sysuser tokenuser Sysuser tokenuser
) { ) {
try { try {
@ -385,6 +387,7 @@ public class SysuserSyncService extends BaseSyncService {
customer.setName(texpayer_name); customer.setName(texpayer_name);
customer.setTexpayerName(texpayer_name); customer.setTexpayerName(texpayer_name);
customer.setInvoiceType(invoice_type); customer.setInvoiceType(invoice_type);
customer.setCustomerTypeId(customer_type_id);
if (customer.checkDuplicate("name")) { if (customer.checkDuplicate("name")) {
return Result.failed(false, "名称已存在"); return Result.failed(false, "名称已存在");
@ -464,6 +467,7 @@ public class SysuserSyncService extends BaseSyncService {
String receiver_phone, String receiver_phone,
String receiver_address, String receiver_address,
Integer invoice_type, Integer invoice_type,
Integer customer_type_id,
Sysuser tokenuser Sysuser tokenuser
) { ) {
try { try {
@ -504,6 +508,7 @@ public class SysuserSyncService extends BaseSyncService {
customer.setName(texpayer_name); customer.setName(texpayer_name);
customer.setTexpayerName(texpayer_name); customer.setTexpayerName(texpayer_name);
customer.setInvoiceType(invoice_type); customer.setInvoiceType(invoice_type);
customer.setCustomerTypeId(customer_type_id);
chkobj.setName(model.getName()); chkobj.setName(model.getName());
chkobj.setPhone(model.getPhone()); chkobj.setPhone(model.getPhone());