1、客户电子合同模板管理,2、客户合同签订日志新增、查询,查看
parent
c0d7eb0a9c
commit
aa372dea27
|
|
@ -72,6 +72,33 @@ public class OSSKit {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean putObject(String bucketName, String key, File file) throws Exception {
|
||||
if (_ossClient == null) {
|
||||
log.error("没有初始化 OSSMgrClient");
|
||||
|
||||
OSSKit.start();
|
||||
|
||||
if (_ossClient == null) {
|
||||
log.error("OSSMgrClient 初始化失败");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!StrKit.notBlank(key) || file == null || !file.exists() || file.isDirectory()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long st = System.currentTimeMillis();
|
||||
|
||||
ObjectMetadata meta = new ObjectMetadata();
|
||||
meta.setContentDisposition("attachment; filename=" + URLEncoder.encode(file.getName(), "UTF-8"));
|
||||
|
||||
_ossClient.putObject(bucketName, key, file, meta);
|
||||
|
||||
log.debug("oss put time: " + (System.currentTimeMillis() - st) + ", file size: " + file.length());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean delObject(String key) throws Exception {
|
||||
if (_ossClient == null) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.cowr.model;
|
||||
|
||||
import com.cowr.model.base.BaseCustomerContractSignedLog;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:45 CST 2021
|
||||
* TableName: customer_contract_signed_log
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CustomerContractSignedLog extends BaseCustomerContractSignedLog<CustomerContractSignedLog> {
|
||||
public static final CustomerContractSignedLog dao = new CustomerContractSignedLog().dao();
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.cowr.model;
|
||||
|
||||
import com.cowr.model.base.BaseCustomerContractTemplate;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:45 CST 2021
|
||||
* TableName: customer_contract_template
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CustomerContractTemplate extends BaseCustomerContractTemplate<CustomerContractTemplate> {
|
||||
public static final CustomerContractTemplate dao = new CustomerContractTemplate().dao();
|
||||
}
|
||||
|
|
@ -85,6 +85,8 @@ public class _MappingKit {
|
|||
arp.addMapping("stock", "supermarket_id,product_id", Stock.class);
|
||||
arp.addMapping("truck_weight_limit", "truck_license", TruckWeightLimit.class);
|
||||
arp.addMapping("truck_weight_limit_modify_log", "id", TruckWeightLimitModifyLog.class);
|
||||
arp.addMapping("customer_contract_signed_log", "id", CustomerContractSignedLog.class);
|
||||
arp.addMapping("customer_contract_template", "id", CustomerContractTemplate.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,200 @@
|
|||
package com.cowr.model.base;
|
||||
|
||||
import com.cowr.common.base.BaseModel;
|
||||
import com.jfinal.plugin.activerecord.IBean;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:45 CST 2021
|
||||
* TableName: customer_contract_signed_log
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class BaseCustomerContractSignedLog<M extends BaseCustomerContractSignedLog<M>> extends BaseModel<M> implements IBean {
|
||||
|
||||
public static final String tablename = "customer_contract_signed_log";
|
||||
|
||||
@JSONField(serialize=false)
|
||||
public String getTablename(){
|
||||
return tablename;
|
||||
}
|
||||
|
||||
/**
|
||||
* name: id
|
||||
* type: INT UNSIGNED(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: user_id
|
||||
* type: INT UNSIGNED(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@JSONField(name="user_id")
|
||||
public void setUserId(Integer userId) {
|
||||
set("user_id", userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return user_id 用户id
|
||||
*/
|
||||
@JSONField(name="user_id")
|
||||
public Integer getUserId() {
|
||||
return getInt("user_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: user_name
|
||||
* type: VARCHAR(20)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param userName 用户姓名
|
||||
*/
|
||||
@JSONField(name="user_name")
|
||||
public void setUserName(String userName) {
|
||||
set("user_name", userName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return user_name 用户姓名
|
||||
*/
|
||||
@JSONField(name="user_name")
|
||||
public String getUserName() {
|
||||
return getStr("user_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: customer_id
|
||||
* type: INT UNSIGNED(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param customerId 用户关联公司id
|
||||
*/
|
||||
@JSONField(name="customer_id")
|
||||
public void setCustomerId(Integer customerId) {
|
||||
set("customer_id", customerId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return customer_id 用户关联公司id
|
||||
*/
|
||||
@JSONField(name="customer_id")
|
||||
public Integer getCustomerId() {
|
||||
return getInt("customer_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: customer_name
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param customerName 用户关联公司名称
|
||||
*/
|
||||
@JSONField(name="customer_name")
|
||||
public void setCustomerName(String customerName) {
|
||||
set("customer_name", customerName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return customer_name 用户关联公司名称
|
||||
*/
|
||||
@JSONField(name="customer_name")
|
||||
public String getCustomerName() {
|
||||
return getStr("customer_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: sign_time
|
||||
* type: DATETIME(19)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param signTime
|
||||
*/
|
||||
@JSONField(name="sign_time")
|
||||
public void setSignTime(java.util.Date signTime) {
|
||||
set("sign_time", signTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return sign_time
|
||||
*/
|
||||
@JSONField(name="sign_time")
|
||||
public java.util.Date getSignTime() {
|
||||
return get("sign_time");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: contract_id
|
||||
* type: INT UNSIGNED(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param contractId 合同模板id
|
||||
*/
|
||||
@JSONField(name="contract_id")
|
||||
public void setContractId(Integer contractId) {
|
||||
set("contract_id", contractId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return contract_id 合同模板id
|
||||
*/
|
||||
@JSONField(name="contract_id")
|
||||
public Integer getContractId() {
|
||||
return getInt("contract_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: remark
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param remark 备注
|
||||
*/
|
||||
@JSONField(name="remark")
|
||||
public void setRemark(String remark) {
|
||||
set("remark", remark);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return remark 备注
|
||||
*/
|
||||
@JSONField(name="remark")
|
||||
public String getRemark() {
|
||||
return getStr("remark");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
package com.cowr.model.base;
|
||||
|
||||
import com.cowr.common.base.BaseModel;
|
||||
import com.jfinal.plugin.activerecord.IBean;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:45 CST 2021
|
||||
* TableName: customer_contract_template
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class BaseCustomerContractTemplate<M extends BaseCustomerContractTemplate<M>> extends BaseModel<M> implements IBean {
|
||||
|
||||
public static final String tablename = "customer_contract_template";
|
||||
|
||||
@JSONField(serialize=false)
|
||||
public String getTablename(){
|
||||
return tablename;
|
||||
}
|
||||
|
||||
/**
|
||||
* name: id
|
||||
* type: INT UNSIGNED(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: template_name
|
||||
* type: VARCHAR(50)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param templateName 模板名称
|
||||
*/
|
||||
@JSONField(name="template_name")
|
||||
public void setTemplateName(String templateName) {
|
||||
set("template_name", templateName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return template_name 模板名称
|
||||
*/
|
||||
@JSONField(name="template_name")
|
||||
public String getTemplateName() {
|
||||
return getStr("template_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_user_id
|
||||
* type: INT UNSIGNED(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(20)
|
||||
* 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: attachment
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param attachment 附件
|
||||
*/
|
||||
@JSONField(name="attachment")
|
||||
public void setAttachment(String attachment) {
|
||||
set("attachment", attachment);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return attachment 附件
|
||||
*/
|
||||
@JSONField(name="attachment")
|
||||
public String getAttachment() {
|
||||
return getStr("attachment");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: htmlstr
|
||||
* type: TEXT(65535)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param htmlstr word转成的html字符串
|
||||
*/
|
||||
@JSONField(name="htmlstr")
|
||||
public void setHtmlstr(String htmlstr) {
|
||||
set("htmlstr", htmlstr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return htmlstr word转成的html字符串
|
||||
*/
|
||||
@JSONField(name="htmlstr")
|
||||
public String getHtmlstr() {
|
||||
return getStr("htmlstr");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_time
|
||||
* type: DATETIME(19)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param createTime
|
||||
*/
|
||||
@JSONField(name="create_time")
|
||||
public void setCreateTime(java.util.Date createTime) {
|
||||
set("create_time", createTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_time
|
||||
*/
|
||||
@JSONField(name="create_time")
|
||||
public java.util.Date getCreateTime() {
|
||||
return get("create_time");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: del
|
||||
* type: INT(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 0
|
||||
* @param del 逻辑删除标记位
|
||||
*/
|
||||
@JSONField(name="del")
|
||||
public void setDel(Integer del) {
|
||||
set("del", del);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return del 逻辑删除标记位
|
||||
*/
|
||||
@JSONField(name="del")
|
||||
public Integer getDel() {
|
||||
return getInt("del");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -116,6 +116,24 @@
|
|||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>xdocreport</artifactId>
|
||||
<version>1.0.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>4.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
package com.cowr.service.ssjygl.customer.contractsignedlog;
|
||||
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.CustomerContractSignedLog;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||
import com.jfinal.aop.Before;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_signed_log
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractSignedLogController extends Controller {
|
||||
|
||||
/**
|
||||
* 新增 customer_contract_signed_log
|
||||
*/
|
||||
@Before(CustomerContractSignedLogValidator.class)
|
||||
public void save(){
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
}
|
||||
|
||||
CustomerContractSignedLog model = getModel(CustomerContractSignedLog.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(CustomerContractSignedLogService.me.save(model, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查找 customer_contract_signed_log
|
||||
*/
|
||||
public void find(){
|
||||
PageParam pp = getBean(PageParam.class, "", true);
|
||||
String userName = get("user_name");
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
|
||||
renderJson(Result.object(CustomerContractSignedLogService.me.find(pp, userName, stm, etm)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按主键查找单个对象 customer_contract_signed_log
|
||||
*/
|
||||
@Before(CustomerContractSignedLogPKValidator.class)
|
||||
public void get(){
|
||||
CustomerContractSignedLog model = getModel(CustomerContractSignedLog.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(CustomerContractSignedLogService.me.get(model));
|
||||
}
|
||||
/**
|
||||
* 按user_id查找单个对象 customer_contract_signed_log
|
||||
* 判断用户是否签订合同
|
||||
*/
|
||||
@Before(CustomerContractSignedLogPKValidator.class)
|
||||
public void getByUserId(){
|
||||
CustomerContractSignedLog model = getModel(CustomerContractSignedLog.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(CustomerContractSignedLogService.me.getByUserId(model));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回所有 customer_contract_signed_log
|
||||
*/
|
||||
public void list(){
|
||||
renderJson(Result.object(CustomerContractSignedLogService.me.list()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.cowr.service.ssjygl.customer.contractsignedlog;
|
||||
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.CustomerContractSignedLog;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_signed_log
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractSignedLogPKValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
validateLong("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
package com.cowr.service.ssjygl.customer.contractsignedlog;
|
||||
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.base.BaseModel;
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.enums.Enums;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.Customer;
|
||||
import com.cowr.model.CustomerContractSignedLog;
|
||||
import com.cowr.model.CustomerContractTemplate;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.service.ssjygl.customer.contracttemplate.CustomerContractTemplateService;
|
||||
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_signed_log
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractSignedLogService extends BaseService {
|
||||
private static final Log log = Log.getLog(CustomerContractSignedLogService.class);
|
||||
public static final CustomerContractSignedLogService me = new CustomerContractSignedLogService();
|
||||
|
||||
public Page<Record> find(PageParam pp, String userName, String stm, String etm) {
|
||||
String selectsql = "select t.*, c.template_name ";
|
||||
String fromsql = "from customer_contract_signed_log t left join customer_contract_template c on t.contract_id = c.id where 1=1 ";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (StrKit.notBlank(userName)) {
|
||||
fromsql += " and t.user_name like ? \n";
|
||||
paraList.add("%" + userName.trim() + "%");
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(stm)) {
|
||||
fromsql += " and t.sign_time >= ? \n";
|
||||
paraList.add(stm);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(etm)) {
|
||||
fromsql += " and t.sign_time <= ? \n";
|
||||
paraList.add(etm);
|
||||
}
|
||||
|
||||
String totalRowSql = "select count(*) " + fromsql;
|
||||
String findSql = selectsql + fromsql;
|
||||
|
||||
// 前端传了排序字段,并且排序字段存在相关表中
|
||||
if (StrKit.notBlank(pp.getSort_field()) && CustomerContractSignedLog.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.sign_time desc ";
|
||||
}
|
||||
|
||||
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||
}
|
||||
|
||||
public List<CustomerContractSignedLog> list() {
|
||||
return CustomerContractSignedLog.dao.find("select * from customer_contract_signed_log");
|
||||
}
|
||||
|
||||
public Result save(CustomerContractSignedLog model, Sysuser sysuser) {
|
||||
Integer customer_id = sysuser.getEntityId();
|
||||
if (customer_id == null) {
|
||||
return Result.failed(false, "未获取到关联的公司id");
|
||||
}
|
||||
Customer customer = Customer.dao.findById(customer_id);
|
||||
if (customer == null) {
|
||||
return Result.failed(false, "未获取到关联的公司信息");
|
||||
}
|
||||
model.setUserId(sysuser.getId());
|
||||
model.setUserName(sysuser.getName());
|
||||
model.setCustomerId(customer_id);
|
||||
model.setCustomerName(customer.getName());
|
||||
model.setSignTime(new Date());
|
||||
try {
|
||||
boolean ret = Db.tx(new IAtom() {
|
||||
@Override
|
||||
public boolean run() {
|
||||
try {
|
||||
boolean ret = model.save();
|
||||
|
||||
if (ret) {
|
||||
ret = ModifyLogService.me.save(model, null, Enums.DataOpType.SAVE.getId(), sysuser);
|
||||
}
|
||||
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return ret ? Result.object(model) : Result.failed(false, "新增失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
if (e.getMessage().contains("PRIMARY")) {
|
||||
return Result.failed(false, "主键冲突");
|
||||
} else {
|
||||
return Result.failed(false, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Result get(CustomerContractSignedLog model) {
|
||||
Integer cId = model.getId();
|
||||
if (cId == null) {
|
||||
return Result.failed(false, "未获取到关联的模板id");
|
||||
}
|
||||
CustomerContractTemplate template = CustomerContractTemplate.dao.findById(cId);
|
||||
if (template == null) {
|
||||
return Result.failed(false, "未获取到关联的模板");
|
||||
}
|
||||
String htmlstr = template.getHtmlstr();
|
||||
if (StrKit.isBlank(htmlstr)) {
|
||||
return Result.failed(false, "模板内容为空");
|
||||
}
|
||||
Record ret = new Record();
|
||||
ret.set("htmlstr", htmlstr);
|
||||
return Result.object(ret);
|
||||
}
|
||||
|
||||
public Result getByUserId(CustomerContractSignedLog model) {
|
||||
CustomerContractSignedLog signedLog = CustomerContractSignedLog.dao.findFirst("select * from customer_contract_signed_log where user_id = ?", model.getId());
|
||||
if (signedLog == null) {
|
||||
return Result.failed(false, "");
|
||||
}
|
||||
String htmlstr = "";
|
||||
CustomerContractTemplate template = CustomerContractTemplate.dao.findById(signedLog.getContractId());
|
||||
if (template != null) {
|
||||
htmlstr = template.getHtmlstr();
|
||||
}
|
||||
Record ret = signedLog.toRecord();
|
||||
ret.set("htmlstr", htmlstr);
|
||||
return Result.object(ret);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.cowr.service.ssjygl.customer.contractsignedlog;
|
||||
|
||||
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.CustomerContractSignedLog;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_signed_log
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractSignedLogValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
// 默认新增时,前端不需要传主键。若需要前端传主键,需要去掉这个判断
|
||||
if (!"save".equals(getActionMethodName())) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
|
||||
validateLong("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||
}
|
||||
|
||||
validateLong("contract_id", 1, 2147483647, "contract_id", "contract_id 范围 1~2147483647");
|
||||
|
||||
// 使用 model 更新时,model 不能只有主键有值
|
||||
// 这里用 getActionMethodName 写死,判断是 update 时,才做验证
|
||||
// 如果确实是需要将主键外的字段置为 null,可以在代码生成后删掉这段
|
||||
if ("edit".equals(getActionMethodName())) {
|
||||
validateUpdateModel(CustomerContractSignedLog.class, "", true); // 忽略不在model中的字段
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.cowr.service.ssjygl.customer.contracttemplate;
|
||||
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.CustomerContractTemplate;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.service.ssjygl.main.AuthInterceptor;
|
||||
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||
import com.jfinal.aop.Before;
|
||||
import com.jfinal.aop.Clear;
|
||||
import com.jfinal.core.Controller;
|
||||
import com.jfinal.upload.UploadFile;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_template
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractTemplateController extends Controller {
|
||||
|
||||
/**
|
||||
* 新增 customer_contract_template
|
||||
*/
|
||||
@Clear(AuthInterceptor.class)
|
||||
public void save(){
|
||||
|
||||
UploadFile uploadFile = this.getFile();
|
||||
if (uploadFile == null || !uploadFile.getFile().isFile()) {
|
||||
renderJson(Result.failed("文件不能为空"));
|
||||
return;
|
||||
}
|
||||
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
}
|
||||
|
||||
String templateName = get("template_name");
|
||||
|
||||
renderJson(CustomerContractTemplateService.me.save(uploadFile, templateName, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 customer_contract_template
|
||||
*/
|
||||
@Before(CustomerContractTemplatePKValidator.class)
|
||||
public void del(){
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
}
|
||||
CustomerContractTemplate model = getModel(CustomerContractTemplate.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(CustomerContractTemplateService.me.delete(model, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复 customer_contract_template
|
||||
*/
|
||||
@Before(CustomerContractTemplatePKValidator.class)
|
||||
public void restore(){
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
}
|
||||
CustomerContractTemplate model = getModel(CustomerContractTemplate.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(CustomerContractTemplateService.me.restore(model, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查找 customer_contract_template
|
||||
*/
|
||||
public void find(){
|
||||
PageParam pp = getBean(PageParam.class, "", true);
|
||||
String createUserName = get("template_name");
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
Integer del = getInt("del");
|
||||
|
||||
renderJson(Result.object(CustomerContractTemplateService.me.find(pp, createUserName, stm, etm, del)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回所有 customer_contract_template
|
||||
*/
|
||||
public void list(){
|
||||
renderJson(Result.object(CustomerContractTemplateService.me.list()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前有效的模板
|
||||
*/
|
||||
public void get() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
}
|
||||
renderJson(Result.object(CustomerContractTemplateService.me.get(tokenuser)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.cowr.service.ssjygl.customer.contracttemplate;
|
||||
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.CustomerContractTemplate;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_template
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractTemplatePKValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
validateLong("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
package com.cowr.service.ssjygl.customer.contracttemplate;
|
||||
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.base.BaseModel;
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.enums.Enums;
|
||||
import com.cowr.common.oss.OSSKit;
|
||||
import com.cowr.common.utils.DateTimeUtil;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.Customer;
|
||||
import com.cowr.model.CustomerContractTemplate;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
import com.jfinal.upload.UploadFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_template
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractTemplateService extends BaseService {
|
||||
private static final Log log = Log.getLog(CustomerContractTemplateService.class);
|
||||
public static final CustomerContractTemplateService me = new CustomerContractTemplateService();
|
||||
|
||||
public Page<Record> find(PageParam pp, String createUserName, String stm, String etm, Integer del) {
|
||||
String selectsql = "select * ";
|
||||
String fromsql = "from customer_contract_template t where 1=1 ";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (del != null && (del == Const.LOGIC_DEL_VALID || del == Const.LOGIC_DEL_INVALID)) {
|
||||
fromsql += " and t.del = ? \n";
|
||||
paraList.add(del);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(createUserName)) {
|
||||
fromsql += " and t.template_name like ? \n";
|
||||
paraList.add("%" + createUserName.trim() + "%");
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(stm)) {
|
||||
fromsql += " and t.create_time >= ? \n";
|
||||
paraList.add(stm);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(etm)) {
|
||||
fromsql += " and t.create_time <= ? \n";
|
||||
paraList.add(etm);
|
||||
}
|
||||
|
||||
String totalRowSql = "select count(*) " + fromsql;
|
||||
String findSql = selectsql + fromsql;
|
||||
|
||||
// 前端传了排序字段,并且排序字段存在相关表中
|
||||
if (StrKit.notBlank(pp.getSort_field()) && CustomerContractTemplate.dao.hasColunm(pp.getSort_field())) {
|
||||
findSql += " order by t." + pp.getSort_field() + " is null, t." + pp.getSort_field();
|
||||
|
||||
if (Const.ORDER_BY_ASC.equals(pp.getSort_order())) {
|
||||
findSql += " " + Const.ORDER_BY_ASC;
|
||||
} else {
|
||||
findSql += " " + Const.ORDER_BY_DESC;
|
||||
}
|
||||
} else {
|
||||
findSql += " order by t.create_time desc ";
|
||||
}
|
||||
|
||||
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||
}
|
||||
|
||||
public List<CustomerContractTemplate> list() {
|
||||
return CustomerContractTemplate.dao.find("select * from customer_contract_template");
|
||||
}
|
||||
|
||||
public Result save(UploadFile uploadFile, String templateName, Sysuser sysuser) {
|
||||
List<CustomerContractTemplate> templateList = CustomerContractTemplate.dao.find("select * from customer_contract_template where del = 0");
|
||||
if (templateList.size() > 0) {
|
||||
return Result.failed("模板已存在");
|
||||
}
|
||||
CustomerContractTemplate model = new CustomerContractTemplate();
|
||||
model.setTemplateName(templateName);
|
||||
model.setCreateUserId(sysuser.getId());
|
||||
model.setCreateUserName(sysuser.getName());
|
||||
model.setCreateTime(new Date());
|
||||
Record r = new Record();
|
||||
|
||||
File file = null;
|
||||
String fileName = "";
|
||||
boolean ret;
|
||||
try {
|
||||
String key = "attachment/" + DateTimeUtil.yMd.get().format(new Date()) + "/" + StrKit.getRandomUUID();
|
||||
file = uploadFile.getFile();
|
||||
|
||||
fileName = file.getName();
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."), fileName.length()).toLowerCase();
|
||||
OSSKit.putObject("ssjygl-xsx-static", key + suffix, file);
|
||||
|
||||
r.set("fileName", fileName);
|
||||
r.set("ossKey", key + suffix);
|
||||
r.set("tm", DateTimeUtil.sdfhms.get().format(new Date(file.lastModified())));
|
||||
model.setAttachment(r.toJson());
|
||||
String htmlStr = Word2HtmlStr.conver(file);
|
||||
if (htmlStr == null) {
|
||||
return Result.failed(fileName + "转html字符串失败");
|
||||
}
|
||||
model.setHtmlstr(htmlStr);
|
||||
try {
|
||||
ret = Db.tx(new IAtom() {
|
||||
@Override
|
||||
public boolean run() {
|
||||
try {
|
||||
boolean ret = model.save();
|
||||
if (ret) {
|
||||
model.remove("htmlstr");
|
||||
ret = ModifyLogService.me.save(model, null, Enums.DataOpType.SAVE.getId(), sysuser);
|
||||
}
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
if (e.getMessage().contains("PRIMARY")) {
|
||||
return Result.failed(false, "主键冲突");
|
||||
} else {
|
||||
return Result.failed(false, e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.failed(fileName + "上传失败");
|
||||
}finally {
|
||||
if (file != null) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
return ret ? Result.object(model) : Result.failed(false, "新增失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复被逻辑删除的数据
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
public Result restore(BaseModel model, Sysuser sysuser) {
|
||||
try {
|
||||
if (!model.hasDelKey()) {
|
||||
return Result.failed(false, "不存在逻辑删除字段");
|
||||
}
|
||||
List<CustomerContractTemplate> list = CustomerContractTemplate.dao.find("select * from customer_contract_template where del = 0");
|
||||
if (list.size() > 0) {
|
||||
return Result.failed(false, "存在有效模板");
|
||||
}
|
||||
|
||||
BaseModel old = (BaseModel) model.findByPk(); // 找到旧记录进行更新
|
||||
old.set(Const.LOGIC_DEL_KEY, Const.LOGIC_DEL_VALID); // 逻辑删除字段统一用 del
|
||||
|
||||
return update(old, sysuser);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.failed(false, "恢复失败");
|
||||
}
|
||||
}
|
||||
|
||||
public Result get(Sysuser tokenuser) {
|
||||
List<CustomerContractTemplate> list = CustomerContractTemplate.dao.find("select * from customer_contract_template where del = 0");
|
||||
if (list.size() == 0) {
|
||||
return Result.failed(false, "当前没有可用的模板");
|
||||
}
|
||||
if (list.size() > 1) {
|
||||
return Result.failed(false, "有多个模板");
|
||||
}
|
||||
String htmlstr = list.get(0).getHtmlstr();
|
||||
if (StrKit.isBlank(htmlstr)) {
|
||||
return Result.failed(false, "模板内容为空");
|
||||
}
|
||||
Integer customer_id = tokenuser.getEntityId();
|
||||
if (customer_id == null) {
|
||||
return Result.failed(false, "未获取到关联的公司id");
|
||||
}
|
||||
Customer customer = Customer.dao.findById(customer_id);
|
||||
if (customer == null) {
|
||||
return Result.failed(false, "未获取到关联的公司信息");
|
||||
}
|
||||
String customer_name = customer.getName();
|
||||
if (StrKit.isBlank(customer_name)) {
|
||||
return Result.failed(false, "未获取到关联的公司名称");
|
||||
}
|
||||
Record ret = new Record();
|
||||
ret.set("htmlstr", htmlstr);
|
||||
ret.set("customer_name", customer_name);
|
||||
ret.set("contract_id", list.get(0).getId());
|
||||
return Result.object(ret);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.cowr.service.ssjygl.customer.contracttemplate;
|
||||
|
||||
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.CustomerContractTemplate;
|
||||
|
||||
/**
|
||||
* Generated by COWR Wed Nov 17 15:39:50 CST 2021
|
||||
* TableName: customer_contract_template
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class CustomerContractTemplateValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
// 默认新增时,前端不需要传主键。若需要前端传主键,需要去掉这个判断
|
||||
if (!"save".equals(getActionMethodName())) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
|
||||
validateLong("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||
}
|
||||
|
||||
validateString("template_name", 1, 50, "template_name", "template_name 长度 1~50");
|
||||
|
||||
|
||||
// 使用 model 更新时,model 不能只有主键有值
|
||||
// 这里用 getActionMethodName 写死,判断是 update 时,才做验证
|
||||
// 如果确实是需要将主键外的字段置为 null,可以在代码生成后删掉这段
|
||||
if ("edit".equals(getActionMethodName())) {
|
||||
validateUpdateModel(CustomerContractTemplate.class, "", true); // 忽略不在model中的字段
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package com.cowr.service.ssjygl.customer.contracttemplate;
|
||||
|
||||
import org.apache.poi.hwpf.HWPFDocument;
|
||||
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
|
||||
import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.*;
|
||||
|
||||
public class Word2HtmlStr {
|
||||
public static String ENCODING = "utf-8";
|
||||
|
||||
public static String conver(File file) throws Exception {
|
||||
|
||||
return conver(file, ENCODING);
|
||||
}
|
||||
|
||||
public static String conver(File file, String encoding) throws Exception {
|
||||
if( file == null || !file.exists() || file.isDirectory() ){
|
||||
return null;
|
||||
}
|
||||
|
||||
String fileName = file.getName();
|
||||
String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
|
||||
|
||||
if( "doc".equals(type) || "wps".equals(type) ){
|
||||
return doc2Html(file, encoding);
|
||||
}else if( "docx".equals(type) ){
|
||||
return docx2Html(file);
|
||||
}else{
|
||||
throw new Exception(type + ",格式不正确!");
|
||||
}
|
||||
}
|
||||
|
||||
public static String doc2Html(File infile, String encoding){
|
||||
HWPFDocument wordDocument;
|
||||
FileInputStream fins = null;
|
||||
WordToHtmlConverter wordToHtmlConverter;
|
||||
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
|
||||
|
||||
try {
|
||||
fins = new FileInputStream(infile);
|
||||
wordDocument = new HWPFDocument(fins);
|
||||
|
||||
wordToHtmlConverter = new WordToHtmlConverter(
|
||||
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
|
||||
|
||||
|
||||
wordToHtmlConverter.processDocument(wordDocument);
|
||||
|
||||
Document htmlDocument = wordToHtmlConverter.getDocument();
|
||||
DOMSource domSource = new DOMSource(htmlDocument);
|
||||
StreamResult streamResult = new StreamResult(out);
|
||||
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer serializer = tf.newTransformer();
|
||||
serializer.setOutputProperty(OutputKeys.ENCODING, encoding);
|
||||
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
serializer.setOutputProperty(OutputKeys.METHOD, "html");
|
||||
serializer.transform(domSource, streamResult);
|
||||
|
||||
return new String(out.toByteArray());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} finally {
|
||||
try {
|
||||
out.close();
|
||||
if( fins != null ){
|
||||
fins.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static String docx2Html(File infile){
|
||||
InputStream fins = null;
|
||||
XWPFDocument document;
|
||||
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
|
||||
try {
|
||||
fins = new FileInputStream(infile);
|
||||
document = new XWPFDocument(fins);
|
||||
XHTMLConverter.getInstance().convert(document, out, null);
|
||||
return out.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} finally {
|
||||
try {
|
||||
out.close();
|
||||
if( fins != null ){
|
||||
fins.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -56,6 +56,10 @@ public class AuthInterceptor implements Interceptor {
|
|||
add("/sysuser/modpwd");
|
||||
add("/sysuser/modpwd");
|
||||
|
||||
add("/customer/contractsignedlog/getByUserId");
|
||||
add("/customer/contractsignedlog/save");
|
||||
add("/customer/contracttemplate/get");
|
||||
|
||||
}});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import com.cowr.service.ssjygl.blacklist.BlacklistController;
|
|||
import com.cowr.service.ssjygl.cache.CacheController;
|
||||
import com.cowr.service.ssjygl.customer.CustomerController;
|
||||
import com.cowr.service.ssjygl.customer.contact.CustomerContactController;
|
||||
import com.cowr.service.ssjygl.customer.contractsignedlog.CustomerContractSignedLogController;
|
||||
import com.cowr.service.ssjygl.customer.contracttemplate.CustomerContractTemplateController;
|
||||
import com.cowr.service.ssjygl.customer.pact.CustomerPactController;
|
||||
import com.cowr.service.ssjygl.customer.receiver.CustomerReceiverController;
|
||||
import com.cowr.service.ssjygl.customer.register.CustomerRegisterController;
|
||||
|
|
@ -22,7 +24,6 @@ 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.receive.InvoiceReceiveController;
|
||||
import com.cowr.service.ssjygl.jobs.LoadStatCacheJob;
|
||||
import com.cowr.service.ssjygl.netty.NettyServer;
|
||||
import com.cowr.service.ssjygl.order.invalidverify.OrderInvalidVerifyController;
|
||||
import com.cowr.service.ssjygl.order.ordercluster.OrderclusterController;
|
||||
|
|
@ -189,6 +190,8 @@ public class Config extends JFinalConfig {
|
|||
me.add("/customer/pact", CustomerPactController.class);
|
||||
me.add("/customer/csp", CustomerSupermarketProductController.class);
|
||||
me.add("/customer/type", CustomerTypeController.class);
|
||||
me.add("/customer/contracttemplate", CustomerContractTemplateController.class);
|
||||
me.add("/customer/contractsignedlog", CustomerContractSignedLogController.class);
|
||||
|
||||
// -- 预付费
|
||||
me.add("/prepay", PrepayController.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue