pdf合并数量限制,一个文件时,不做合并逻辑,修改日志级别

dev
IT-xiaoXiong 2021-11-23 11:05:14 +08:00
parent 2a3d8dae93
commit 3c57e87b7f
10 changed files with 76 additions and 51 deletions

View File

@ -89,7 +89,7 @@ public class FaDDContractMapping {
rs.executeQuery(query);
rs.next();
String mainTable = rs.getString(1);
toolUtil.writeErrorLog("mainTable:" + mainTable);
toolUtil.writeDebuggerLog("mainTable:" + mainTable);
return mainTable;
}
@ -103,7 +103,7 @@ public class FaDDContractMapping {
public String getDetailTable(String workflowId, int type) {
FaDaDaConfigDTO faDaDaConfigDTO = this.queryConfig(workflowId, type);
String detailTable = faDaDaConfigDTO.getCheckSource();
toolUtil.writeErrorLog("detailTable:" + detailTable);
toolUtil.writeDebuggerLog("detailTable:" + detailTable);
return detailTable;
}

View File

@ -52,20 +52,20 @@ public class FaDDServiceMapping {
public List<Map<String, Object>> queryDetailInfo(String requestId,String workflowId,int type) {
String mainTable = this.getMainTable(workflowId);
toolUtil.writeErrorLog("进入查询数据库方法");
toolUtil.writeDebuggerLog("进入查询数据库方法");
String query = "select id from " + mainTable + " where requestid = ?";
rs.executeQuery(query, requestId);
rs.next();
String mainId = rs.getString("id");
String detailTable = this.getDetailTable(workflowId, type);
query = "select * from " + detailTable + " where mainid = ? and ( contract_status in (1,6) or contract_status is null) ";
this.toolUtil.writeErrorLog(query);
this.toolUtil.writeDebuggerLog(query);
RecordSet rs = new RecordSet();
rs.executeQuery(query, mainId);
List<Map<String, Object>> maps = null;
try {
maps = Util.recordSet2MapList(rs);
toolUtil.writeErrorLog("查询到状态:" + maps);
toolUtil.writeDebuggerLog("查询到状态:" + maps);
} catch (Exception e) {
e.printStackTrace();
toolUtil.writeErrorLog("工具类出现异常:" + e);
@ -76,20 +76,20 @@ public class FaDDServiceMapping {
public List<Map<String, Object>> queryDetailDownInfo(String requestId,String workflowId,int type) {
String mainTable = this.getMainTable(workflowId);
toolUtil.writeErrorLog("进入查询数据库方法");
toolUtil.writeDebuggerLog("进入查询数据库方法");
String query = "select id from " + mainTable + " where requestid = ?";
rs.executeQuery(query, requestId);
rs.next();
String mainId = rs.getString("id");
String detailTable = this.getDetailTable(workflowId, type);
query = "select * from " + detailTable + " where mainid = ?";
this.toolUtil.writeErrorLog(query);
this.toolUtil.writeDebuggerLog(query);
RecordSet rs = new RecordSet();
rs.executeQuery(query, mainId);
List<Map<String, Object>> maps = null;
try {
maps = Util.recordSet2MapList(rs);
toolUtil.writeErrorLog("查询到状态:" + maps);
toolUtil.writeDebuggerLog("查询到状态:" + maps);
} catch (Exception e) {
e.printStackTrace();
toolUtil.writeErrorLog("工具类出现异常:" + e);
@ -129,14 +129,14 @@ public class FaDDServiceMapping {
rs.executeQuery(query);
rs.next();
String mainTable = rs.getString(1);
toolUtil.writeErrorLog("mainTable:" + mainTable);
toolUtil.writeDebuggerLog("mainTable:" + mainTable);
return mainTable;
}
public String getDetailTable(String workflowId, int type){
FaDaDaConfigDTO faDaDaConfigDTO = this.queryConfig(workflowId, type);
String detailTable = faDaDaConfigDTO.getCheckSource();
toolUtil.writeErrorLog("detailTable:" + detailTable);
toolUtil.writeDebuggerLog("detailTable:" + detailTable);
return detailTable;
}

View File

@ -389,7 +389,7 @@ public class FaDDContractService {
// 处理数据
List<Map<String, Object>> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr);
if (maps == null) {
toolUtil.writeErrorLog("service签署合同错误错误原因maps为null!");
toolUtil.writeDebuggerLog("service签署合同错误错误原因maps为null!");
throw new RuntimeException("service签署合同错误错误原因maps为null");
}
if (maps.size() == 0) {
@ -432,7 +432,7 @@ public class FaDDContractService {
e.printStackTrace();
}
if (!"200".equals(response.get("code"))) {
toolUtil.writeErrorLog("法大大接口签署合同失败!");
toolUtil.writeDebuggerLog("法大大接口签署合同失败!");
throw new RuntimeException("法大大接口签署合同失败!");
}
}
@ -450,11 +450,11 @@ public class FaDDContractService {
RecordSet rs = new RecordSet();
rs.executeQuery(query, requestId);
Map<String, Object> result = Util.recordSet2Map(rs);
this.toolUtil.writeErrorLog(result.toString());
this.toolUtil.writeDebuggerLog(result.toString());
boolean isAllSinged = false;
boolean isSingedOneself = false;
if (result == null) {
toolUtil.writeErrorLog("查询到状态为nullsql" + query + " ---> " + requestId);
toolUtil.writeDebuggerLog("查询到状态为nullsql" + query + " ---> " + requestId);
return ParaMap.create().put("isAllSinged", false)
.put("isSingedOneself", false);
}
@ -526,7 +526,7 @@ public class FaDDContractService {
update.put("contract_down_url", String.join(";",downloadUrlList));
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 获取流程中的合同字段的文档目录id
rs.executeQuery("select formid from workflow_base where id = ?",ufContractInfoDTO.getWorkflowType());
@ -552,12 +552,12 @@ public class FaDDContractService {
}catch (Exception e){
toolUtil.writeErrorLog("创建文档发生错误:" + e);
}
toolUtil.writeErrorLog("生成的文档的id" + docIds);
toolUtil.writeDebuggerLog("生成的文档的id" + docIds);
// 将id保存到流程字段中
sqlResult = Util.createSqlBuilder().updateSql(ufContractInfoDTO.getWorkflowMainTable(),
ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds),
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getMainId()));
toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs());
}
@ -597,10 +597,10 @@ public class FaDDContractService {
this.toolUtil.writeErrorLog(ufContractInfoDTO.toString());
String base64 = Base64Utils.encode(byteArray);
FileProcessor fileProcessor = new FileProcessor();
toolUtil.writeErrorLog("base64" + "base64:" + base64);
toolUtil.writeErrorLog("category" + category);
toolUtil.writeErrorLog("user" + JSON.toJSONString(user));
toolUtil.writeErrorLog("fileName" + ufContractInfoDTO.getFileName());
// toolUtil.writeDebuggerLog("base64" + "base64:" + base64);
toolUtil.writeDebuggerLog("category" + category);
// toolUtil.writeDebuggerLog("user" + JSON.toJSONString(user));
toolUtil.writeDebuggerLog("fileName" + ufContractInfoDTO.getFileName());
docIds.add(String.valueOf(fileProcessor.Process("base64:" + base64, category, user, ufContractInfoDTO.getFileName())));
}, apiConfigMainDTO.getApiUrl());
}
@ -643,7 +643,7 @@ public class FaDDContractService {
String fileNames = Util.null2String(ufContractInfoDTO.getFileName());
String[] contractNoArr = contractNos.split(",");
String[] fileNameArr = fileNames.split(",");
toolUtil.writeErrorLog("下载合同download4mFDD");
toolUtil.writeDebuggerLog("下载合同download4mFDD");
if(contractNoArr.length >= 2){
// 多个文件,需要下载压缩包
return outputStream -> {
@ -684,7 +684,7 @@ public class FaDDContractService {
};
}
return outputStream->{
toolUtil.writeErrorLog("download4mFDD单文件下载");
toolUtil.writeDebuggerLog("download4mFDD单文件下载");
// InputStream inputStream = downloadContract(contractNos,String.valueOf(ufContractInfoDTO.getWorkflowType()));
Map<String, Object> data = new HashMap<>();
data.put("contractNo", contractNos);

View File

@ -178,8 +178,8 @@ public class FaDDRequestUtils {
TOOL_UTIL.writeErrorLog("查询到的FDD_appKey为空");
appKey = "L7P59oqA2An0XgJ1LeMN0fRu1";
}
TOOL_UTIL.writeErrorLog("app签名" + appKey);
TOOL_UTIL.writeErrorLog("signStr" + signStr);
TOOL_UTIL.writeDebuggerLog("app签名" + appKey);
TOOL_UTIL.writeDebuggerLog("signStr" + signStr);
TOOL_UTIL.writeDebuggerLog("请求头信息:" + JSONObject.toJSONString(header));
// String appKey = "L7P59oqA2An0XgJ1LeMN0fRu1";
String sha256 = string2SHA256(signStr) + appKey;

View File

@ -504,6 +504,11 @@ public class SyncOrganizationUtils extends ToolUtil {
}
}
/**
*
* @param employee
* @return idid
*/
private Map<String, Object> getSubIdAndManagerId(Employee employee) {
Map<String, Object> map = new HashMap<>();
RecordSet rs = new RecordSet();
@ -594,6 +599,12 @@ public class SyncOrganizationUtils extends ToolUtil {
return map;
}
/**
* SQL
* @param insertFieldBuilder
* @param insertValueBuilder
* @param table
*/
private void executeInsertData(StringBuilder insertFieldBuilder, StringBuilder insertValueBuilder, String table) {
RecordSet rs = new RecordSet();
if (insertFieldBuilder.lastIndexOf(",") != -1 && insertValueBuilder.lastIndexOf(",") != -1) {
@ -611,6 +622,12 @@ public class SyncOrganizationUtils extends ToolUtil {
}
}
/**
*
* @param updateSqlBuilder SQL
* @param table
* @param conditions
*/
private void executeUpdateData(StringBuilder updateSqlBuilder, String table, String conditions) {
RecordSet rs = new RecordSet();
if (updateSqlBuilder.lastIndexOf(",") != -1) {
@ -647,6 +664,11 @@ public class SyncOrganizationUtils extends ToolUtil {
}
}
/**
*
* @param department
* @return
*/
private Map<String, Integer> subCompanyHandler(Department department) {
// 企业总部id
int companyid = 1;

View File

@ -37,7 +37,7 @@ public class ConvertPdfAction implements Action {
@Override
public String execute(RequestInfo requestInfo) {
ToolUtil toolUtil = new ToolUtil();
toolUtil.writeErrorLog("进入PDF转换action");
toolUtil.writeDebuggerLog("进入PDF转换action");
User user = requestInfo.getRequestManager().getUser();
String billTableName = requestInfo.getRequestManager().getBillTableName();
String requestId = requestInfo.getRequestid();
@ -56,17 +56,20 @@ public class ConvertPdfAction implements Action {
String query = "select * from " + billTableName + " where requestid = ?";
rs.executeQuery(query,requestId);
Map<String, Object> workflowData = Util.recordSet2Map(rs);
toolUtil.writeErrorLog("流程数据:" + workflowData);
toolUtil.writeDebuggerLog("流程数据:" + workflowData);
if(workflowData == null){
toolUtil.writeErrorLog("未查询到流程数据:" + query + " --> " + requestId);
return Action.SUCCESS;
}
// 获取文件id
String docIds = Util.null2String(workflowData.get(mergeField));
toolUtil.writeErrorLog("文件id" + docIds);
toolUtil.writeDebuggerLog("文件id" + docIds);
if(StringUtils.isNullOrEmpty(docIds)){
return Action.SUCCESS;
}
if(docIds.split(",").length <= 1){
return Action.SUCCESS;
}
// 查询字段的目录
String docCategorys = Util.getDocCategorys(workflowId, mergeField);
CreateDocForJSGJXT createDocForJSGJXT = new CreateDocForJSGJXT();
@ -103,10 +106,10 @@ public class ConvertPdfAction implements Action {
if(StringUtils.isNullOrEmpty(fileName)){
fileName = defaultFileName;
}
toolUtil.writeErrorLog("合并文件参数fileName" + fileName + " docCategory" + docCategory + " docIds" + docIds);
toolUtil.writeDebuggerLog("合并文件参数fileName" + fileName + " docCategory" + docCategory + " docIds" + docIds);
int fileId = createDocForJSGJXT.creatDoc(user, fileName, docCategory, docIds);
if(fileId <= 0){
toolUtil.writeErrorLog("文件合并错误!(-2:用户为空,-1:文档获取异常)、错误id" + fileId);
toolUtil.writeDebuggerLog("文件合并错误!(-2:用户为空,-1:文档获取异常)、错误id" + fileId);
// TODO 修改labelId
requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-88651,user.getLanguage(),"合并pdf错误请联系管理员"));
requestInfo.getRequestManager().setMessageid("1");
@ -115,7 +118,7 @@ public class ConvertPdfAction implements Action {
// 将合并的文件回写到流程中
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(billTableName, ParaMap.create().put(mergeToField, fileId),
Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId));
toolUtil.writeErrorLog("数据回写:" + sqlResult.getSqlStr() + " --> 参数: " + sqlResult.getArgs());
toolUtil.writeDebuggerLog("数据回写:" + sqlResult.getSqlStr() + " --> 参数: " + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs());
return Action.SUCCESS;
}

View File

@ -39,10 +39,10 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
RecordSet rs_1 = new RecordSet();
// 查询流程数据
String query = "select * from " + billTableName + " where requestid = ?";
toolUtil.writeErrorLog("进入保密协议action");
toolUtil.writeDebuggerLog("进入保密协议action");
rs_1.executeQuery(query, requestId);
Map<String, Object> requestData = Util.recordSet2Map(rs_1);
toolUtil.writeErrorLog(requestData.toString());
toolUtil.writeDebuggerLog(requestData.toString());
// 查询配置表,获取配置数据
String querySql = "select ufta.id,ufta.workflow_type,wftva.fieldname as template_field, " +
@ -108,24 +108,24 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
.attachmentTableName(attachmentTableName)
.attachmentFieldId(attachmentFieldId)
.builder();
toolUtil.writeErrorLog("保密协议数据:" + configEmpty.toString());
toolUtil.writeDebuggerLog("保密协议数据:" + configEmpty.toString());
// 如果不控制是否使用模板,那就默认不添加保密协议
if ("1".equals(isTemplateShow)) {
// 不使用模板
toolUtil.writeErrorLog("不使用安全协议数据!因为不控制模板的使用!");
toolUtil.writeDebuggerLog("不使用安全协议数据!因为不控制模板的使用!");
return Action.SUCCESS;
}
String showFieldValue = String.valueOf(requestData.get(configEmpty.getShowField()));
// 不使用保密协议模板
if (configEmpty.getShowValue() != Integer.parseInt(showFieldValue)) {
toolUtil.writeErrorLog("不使用安全协议数据!因为不使用保密协议!");
toolUtil.writeDebuggerLog("不使用安全协议数据!因为不使用保密协议!");
return Action.SUCCESS;
}
}
if(configEmpty != null){
// 使用保密协议模板
String docIds = copyFile(user, configEmpty,String.valueOf(requestData.get(configEmpty.getTemplateField())));
toolUtil.writeErrorLog("复制完成文件id" + docIds);
toolUtil.writeDebuggerLog("复制完成文件id" + docIds);
if (StringUtils.isNullOrEmpty(docIds)) {
requestInfo.getRequestManager().setMessageid("1");
// TODO 修改htmlLabel
@ -141,7 +141,7 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
// 修改流程数据将保密协议的docid更新到流程中
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(billTableName, ParaMap.create().put(configEmpty.getAttachmentField(), String.join(",", list)),
Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId));
toolUtil.writeErrorLog("sql " + sqlResult.getSqlStr() + " 参数: ---> " + sqlResult.getArgs());
toolUtil.writeDebuggerLog("sql " + sqlResult.getSqlStr() + " 参数: ---> " + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
}
}catch (Exception e){

View File

@ -114,7 +114,7 @@ public class FaddContractUtil {
.put("file_name", joinFileName);
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(this.mainTableName, updateMap,
Util.createPrepWhereImpl().whereAnd("id").whereEqual(mainMap.get("id")));
toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 将合同信息和流程表信息保存到自定义的建模表中
updateMap.put("workflow_type",workflowId);
@ -135,12 +135,12 @@ public class FaddContractUtil {
if(rs.next()){
sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable,updateMap,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 权限重构
ModeRightInfo mri = new ModeRightInfo();
int dataId = rs.getInt("id");
toolUtil.writeErrorLog("id" + dataId);
toolUtil.writeDebuggerLog("id" + dataId);
mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId);
}else{
ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance();
@ -150,7 +150,7 @@ public class FaddContractUtil {
TimeUtil.getOnlyCurrentTimeString());
sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateMap,
Util.createPrepWhereImpl().whereAnd("id").whereEqual(dataId));
toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
ModeRightInfo mri = new ModeRightInfo();
mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId);

View File

@ -60,7 +60,7 @@ public class AddCustomer_Action extends ToolUtil implements Action {
String requestid = Util.null2String(requestInfo.getRequestid());
//流程表单名称
this.tableName = requestInfo.getRequestManager().getBillTableName();
this.writeErrorLog("这个是创建者id:" + requestInfo.getRequestManager().getCreater());
this.writeDebuggerLog("这个是创建者id:" + requestInfo.getRequestManager().getCreater());
// 通过流程id查询表名
if ("".equals(this.tableName)) {
this.tableName = getBillTableNameByWorkflowId(workflowid);

View File

@ -179,11 +179,11 @@ public class CRM_Config extends ToolUtil {
}
}
this.writeErrorLog("configList "+configList.toString());
this.writeErrorLog("configList "+configMap.toString());
this.writeDebuggerLog("configList "+configList.toString());
this.writeDebuggerLog("configList "+configMap.toString());
// 获取客户基本信息
this.configResult.put("CRM_CustomerInfo",this.getCRM_CustomerInfoSqlMapList(configList,configMap));
this.writeErrorLog("configList "+this.configResult.toString());
this.writeDebuggerLog("configList "+this.configResult.toString());
// 判断是否需要创建外部用户
if (this.mainResult.getIsOutUser() == 0) {
// 需要创建外部用户,获取外部用户字段映射信息
@ -250,10 +250,10 @@ public class CRM_Config extends ToolUtil {
}
public List<Map<String,Object>> getSqlMapList(List<TableFieldRelation> configList, Set<String> set){
this.writeErrorLog("getSqlMapList: configList " + configList.toString());
this.writeErrorLog("getSqlMapList: set " + set.toString());
this.writeDebuggerLog("getSqlMapList: configList " + configList.toString());
this.writeDebuggerLog("getSqlMapList: set " + set.toString());
if(Objects.isNull(configList) || configList.size() == 0 || Objects.isNull(set) || set.size() == 0){
this.writeErrorLog("table mapping error,error args is configList = [" + configList + "] and set = [" + set + "]");
this.writeDebuggerLog("table mapping error,error args is configList = [" + configList + "] and set = [" + set + "]");
return null;
}
RecordSet rs = new RecordSet();
@ -296,7 +296,7 @@ public class CRM_Config extends ToolUtil {
customSql.contains("exec") || customSql.contains("drop") ||
customSql.contains("truncate")) {
// sql 不包含deleteupdateexecdroptruncate等危险关键字
writeErrorLog("warning sql: " + customSql);
writeDebuggerLog("warning sql: " + customSql);
} else if (customSql.contains("select")) {
// 包含查询关键词
try {
@ -355,7 +355,7 @@ public class CRM_Config extends ToolUtil {
sqlMapList.add(sqlMap);
}
}else{
writeErrorLog("select workflow date error, error sql is: "
writeDebuggerLog("select workflow date error, error sql is: "
+ selectSql + " args is: " + this.workflowId);
}
}