bug修改

dev
IT-xiaoXiong 2021-12-09 22:14:48 +08:00
parent 79c79d1218
commit 7efbec9808
8 changed files with 3077 additions and 2966 deletions

Binary file not shown.

View File

@ -38,14 +38,11 @@ import java.util.zip.ZipOutputStream;
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021/11/3 0003 14:51 * @create 2021/11/3 0003 14:51
*/ */
public class FaDDContractService { public class FaDDContractService {
private final ToolUtil toolUtil = new ToolUtil(); private final ToolUtil toolUtil = new ToolUtil();
private final String contractInfoTable = "uf_contract_info"; private final String contractInfoTable = "uf_contract_info";
private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping(); private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping();
/** /**
* idid * idid
* *
@ -82,7 +79,6 @@ public class FaDDContractService {
return nods.split(","); return nods.split(",");
} }
/** /**
* SQL * SQL
* *
@ -92,21 +88,31 @@ public class FaDDContractService {
* @param tableName * @param tableName
* @return * @return
*/ */
public List<Map<String, Object>> getDataArr(String requestId, String workflowId, String mainTableName, String tableName) { public List<Map<String, Object>> getDataArr(
String requestId, String workflowId, String mainTableName, String tableName) {
Map<String, Object> mainMap = faDDContractMapping.queryMainMap(requestId, mainTableName); Map<String, Object> mainMap = faDDContractMapping.queryMainMap(requestId, mainTableName);
String mainId = Util.null2String(mainMap.get("id")); String mainId = Util.null2String(mainMap.get("id"));
List<Map<String, Object>> detailMaps = faDDContractMapping.queryDetailMaps(mainId, tableName); List<Map<String, Object>> detailMaps = faDDContractMapping.queryDetailMaps(mainId, tableName);
return getDataArr(requestId, workflowId, tableName, mainMap, detailMaps); return getDataArr(requestId, workflowId, tableName, mainMap, detailMaps);
} }
public List<Map<String, Object>> getDataArr(String requestId, String workflowId, String mainTableName, String tableName, List<Map<String, Object>> detailMaps) { public List<Map<String, Object>> getDataArr(
String requestId,
String workflowId,
String mainTableName,
String tableName,
List<Map<String, Object>> detailMaps) {
Map<String, Object> mainMap = faDDContractMapping.queryMainMap(requestId, mainTableName); Map<String, Object> mainMap = faDDContractMapping.queryMainMap(requestId, mainTableName);
String mainId = Util.null2String(mainMap.get("id")); String mainId = Util.null2String(mainMap.get("id"));
return getDataArr(requestId, workflowId, tableName, mainMap, detailMaps); return getDataArr(requestId, workflowId, tableName, mainMap, detailMaps);
} }
public List<Map<String, Object>> getDataArr(String requestId, String workflowId, String tableName, public List<Map<String, Object>> getDataArr(
Map<String, Object> mainMap, List<Map<String, Object>> detailMaps) { String requestId,
String workflowId,
String tableName,
Map<String, Object> mainMap,
List<Map<String, Object>> detailMaps) {
List<Map<String, Object>> dataArr = new ArrayList<>(); List<Map<String, Object>> dataArr = new ArrayList<>();
String dt = tableName.substring(tableName.indexOf("_dt") + 3); String dt = tableName.substring(tableName.indexOf("_dt") + 3);
String main = "main."; String main = "main.";
@ -133,7 +139,8 @@ public class FaDDContractService {
* @param dataArr * @param dataArr
* @return * @return
*/ */
public List<Map<String, Object>> objectAndListHandle(List<ApiConfigDetailDTO> treeList, List<Map<String, Object>> dataArr) { public List<Map<String, Object>> objectAndListHandle(
List<ApiConfigDetailDTO> treeList, List<Map<String, Object>> dataArr) {
List<Map<String, Object>> params = new ArrayList<>(); List<Map<String, Object>> params = new ArrayList<>();
for (Map<String, Object> dataMap : dataArr) { for (Map<String, Object> dataMap : dataArr) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
@ -141,10 +148,10 @@ public class FaDDContractService {
Object value; Object value;
if (apiConfigDetailDTO.getParamType() == 3) { if (apiConfigDetailDTO.getParamType() == 3) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
// object类型 // object类型
for (ApiConfigDetailDTO child : apiConfigDetailDTO.getChildren()) { for (ApiConfigDetailDTO child : apiConfigDetailDTO.getChildren()) {
if (child.getChildren() == null || child.getChildren().size() == 0) { if (child.getChildren() == null || child.getChildren().size() == 0) {
// handleChild(child.getChildren(), dataMap) // handleChild(child.getChildren(), dataMap)
map.put(child.getParamName(), changeRuleHandle(child, dataMap)); map.put(child.getParamName(), changeRuleHandle(child, dataMap));
} else { } else {
map.put(child.getParamName(), handleChild(child.getChildren(), dataMap)); map.put(child.getParamName(), handleChild(child.getChildren(), dataMap));
@ -154,14 +161,18 @@ public class FaDDContractService {
} else if (apiConfigDetailDTO.getParamType() == 4) { } else if (apiConfigDetailDTO.getParamType() == 4) {
String sql = apiConfigDetailDTO.getArraySql(); String sql = apiConfigDetailDTO.getArraySql();
String parsingSq = aiyh.utils.Util.parsingSq(sql, dataMap); String parsingSq = aiyh.utils.Util.parsingSq(sql, dataMap);
// list类型 // list类型
if (parsingSq.contains("delete") || parsingSq.contains("update") || if (parsingSq.contains("delete")
parsingSq.contains("exec") || parsingSq.contains("drop") || || parsingSq.contains("update")
parsingSq.contains("truncate")) { || parsingSq.contains("exec")
|| parsingSq.contains("drop")
|| parsingSq.contains("truncate")) {
value = new ArrayList<>(); value = new ArrayList<>();
} else { } else {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String replace = parsingSq.replace(" ", "select ") String replace =
parsingSq
.replace(" ", "select ")
.replaceAll(" ", " and ") .replaceAll(" ", " and ")
.replaceAll(" ", " or ") .replaceAll(" ", " or ")
.replaceAll(" ", " join ") .replaceAll(" ", " join ")
@ -207,58 +218,63 @@ public class FaDDContractService {
* @param dataMap * @param dataMap
* @return * @return
*/ */
private Object changeRuleHandle(ApiConfigDetailDTO apiConfigDetailDTO, Map<String, Object> dataMap) { private Object changeRuleHandle(
ApiConfigDetailDTO apiConfigDetailDTO, Map<String, Object> dataMap) {
Object value; Object value;
String tableName; String tableName;
String table; String table;
String sql; String sql;
String resultSql; String resultSql;
// 判断参数的转换规则 // 判断参数的转换规则
switch (apiConfigDetailDTO.getChangeRule()) { switch (apiConfigDetailDTO.getChangeRule()) {
case 0: case 0:
// 不转换 // 不转换
case 2: case 2:
// 流程字段值 // 流程字段值
table = apiConfigDetailDTO.getTablename(); table = apiConfigDetailDTO.getTablename();
if (!table.contains("_dt")) { if (!table.contains("_dt")) {
// 表示字段属于主表 // 表示字段属于主表
tableName = "main"; tableName = "main";
} else { } else {
// 字段属于明细表 // 字段属于明细表
String dt = table.substring(table.indexOf("_dt") + 3); String dt = table.substring(table.indexOf("_dt") + 3);
tableName = "detail_" + dt; tableName = "detail_" + dt;
} }
value = dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField()); value = dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField());
break; break;
case 1: case 1:
// 固定值 // 固定值
value = apiConfigDetailDTO.getParamValue(); value = apiConfigDetailDTO.getParamValue();
break; break;
case 3: case 3:
// 系统日期 // 系统日期
value = aiyh.utils.Util.getTime("yyyy-MM-dd"); value = aiyh.utils.Util.getTime("yyyy-MM-dd");
break; break;
case 4: case 4:
// 系统时间 // 系统时间
value = aiyh.utils.Util.getTime("HH:mm:ss"); value = aiyh.utils.Util.getTime("HH:mm:ss");
break; break;
case 5: case 5:
// 系统日期-时间 // 系统日期-时间
value = aiyh.utils.Util.getTime("yyyy-MM-dd HH:mm:ss"); value = aiyh.utils.Util.getTime("yyyy-MM-dd HH:mm:ss");
break; break;
case 6: case 6:
// 自定义SQL // 自定义SQL
case 7: case 7:
// 流程字段转SQL // 流程字段转SQL
sql = apiConfigDetailDTO.getParamValue(); sql = apiConfigDetailDTO.getParamValue();
resultSql = aiyh.utils.Util.parsingSq(sql, dataMap); resultSql = aiyh.utils.Util.parsingSq(sql, dataMap);
if (resultSql.contains("delete ") || resultSql.contains("update ") || if (resultSql.contains("delete ")
resultSql.contains("exec ") || resultSql.contains("drop ") || || resultSql.contains("update ")
resultSql.contains("truncate ")) { || resultSql.contains("exec ")
|| resultSql.contains("drop ")
|| resultSql.contains("truncate ")) {
value = null; value = null;
} else { } else {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String replace = resultSql.replace(" ", "select ") String replace =
resultSql
.replace(" ", "select ")
.replaceAll(" ", " and ") .replaceAll(" ", " and ")
.replaceAll(" ", " or ") .replaceAll(" ", " or ")
.replaceAll(" ", " join ") .replaceAll(" ", " join ")
@ -269,17 +285,17 @@ public class FaDDContractService {
} }
break; break;
case 8: case 8:
// //
// 流程名称 // 流程名称
value = aiyh.utils.Util.getWorkflowNameById(String.valueOf(dataMap.get("workflowid"))); value = aiyh.utils.Util.getWorkflowNameById(String.valueOf(dataMap.get("workflowid")));
break; break;
case 9: case 9:
// //
// 请求标题 // 请求标题
value = aiyh.utils.Util.getRequestTitleById(String.valueOf(dataMap.get("requestid"))); value = aiyh.utils.Util.getRequestTitleById(String.valueOf(dataMap.get("requestid")));
break; break;
case 10: case 10:
// 流程requestId // 流程requestId
value = dataMap.get("requestid"); value = dataMap.get("requestid");
break; break;
default: default:
@ -287,10 +303,10 @@ public class FaDDContractService {
break; break;
} }
if (apiConfigDetailDTO.getParamType() == 1) { if (apiConfigDetailDTO.getParamType() == 1) {
// Integer // Integer
value = Integer.parseInt(String.valueOf(value)); value = Integer.parseInt(String.valueOf(value));
} else if (apiConfigDetailDTO.getParamType() == 2) { } else if (apiConfigDetailDTO.getParamType() == 2) {
// Boolean // Boolean
value = Boolean.parseBoolean(String.valueOf(value)); value = Boolean.parseBoolean(String.valueOf(value));
} }
return value; return value;
@ -302,26 +318,28 @@ public class FaDDContractService {
* @param contractNo * @param contractNo
*/ */
public void signedCallBack(String contractNo) { public void signedCallBack(String contractNo) {
// 查询合同信息表中的数据 // 查询合同信息表中的数据
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfo(contractNo); UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfo(contractNo);
toolUtil.writeDebuggerLog("回调,获取到合同信息参数:" + JSON.toJSONString(ufContractInfoDTO)); toolUtil.writeDebuggerLog("回调,获取到合同信息参数:" + JSON.toJSONString(ufContractInfoDTO));
Map<String, Object> update = new HashMap<>(); Map<String, Object> update = new HashMap<>();
if (ufContractInfoDTO.getQueueSigned() == 1) { if (ufContractInfoDTO.getQueueSigned() == 1) {
// 属于顺序签署合同,更新单份合同已签蜀几个文件 // 属于顺序签署合同,更新单份合同已签蜀几个文件
update.put("single_signed_num", ufContractInfoDTO.getSingleSignedNum() + 1); update.put("single_signed_num", ufContractInfoDTO.getSingleSignedNum() + 1);
toolUtil.writeDebuggerLog("单份合同签署成功"); toolUtil.writeDebuggerLog("单份合同签署成功");
// 如果单份合同签署数量等于合同文件数量,表示已经签署完成 // 如果单份合同签署数量等于合同文件数量,表示已经签署完成
if (ufContractInfoDTO.getSingleSignedNum() + 1 == ufContractInfoDTO.getSingleContractFileNum()) { if (ufContractInfoDTO.getSingleSignedNum() + 1
== ufContractInfoDTO.getSingleContractFileNum()) {
toolUtil.writeDebuggerLog("单份合同全部签署成功"); toolUtil.writeDebuggerLog("单份合同全部签署成功");
update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1); update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1);
// 查询下一位合同方并发起签署 // 查询下一位合同方并发起签署
if (ufContractInfoDTO.getSignedNum() + 1 < ufContractInfoDTO.getShouldSignedNum()) { if (ufContractInfoDTO.getSignedNum() + 1 < ufContractInfoDTO.getShouldSignedNum()) {
toolUtil.writeDebuggerLog("应签署合同比签署合同数量多,需要再次签署!" + (ufContractInfoDTO.getSignedNum() + 1)); toolUtil.writeDebuggerLog(
"应签署合同比签署合同数量多,需要再次签署!" + (ufContractInfoDTO.getSignedNum() + 1));
update.put("single_signed_num", 0); update.put("single_signed_num", 0);
nextContractSigned(ufContractInfoDTO); nextContractSigned(ufContractInfoDTO);
} }
} }
// 如果合同已签数量和应签数量相同,则状态为本方待签 // 如果合同已签数量和应签数量相同,则状态为本方待签
if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum()) { if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum()) {
update.put("contract_status", 3); update.put("contract_status", 3);
// 判断是否控制签署规则 1-仅本方签署2-仅对方签署3-都签署 // 判断是否控制签署规则 1-仅本方签署2-仅对方签署3-都签署
@ -330,71 +348,20 @@ public class FaDDContractService {
} }
if ("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) { if ("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
update.put("contract_status", 4); update.put("contract_status", 4);
// 仅对方签署完成后,添加用户信息
// 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
RecordSet rs = new RecordSet();
String userInfo = ufContractInfoDTO.getUserInfo();
User user = JSON.parseObject(userInfo, new TypeReference<User>() {
});
// 获取流程中的合同字段的文档目录id
rs.executeQuery("select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
String formId = Util.recordeSet2Entity(rs, String.class);
String query = "select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)";
rs.executeQuery(query, faDaDaConfigDTO.getContractDoc(), formId);
String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class));
if (StringUtils.isNullOrEmpty(docCategorys)) {
query = "select doccategory from workflow_base where id = ?";
rs.executeQuery(query, ufContractInfoDTO.getWorkflowType());
rs.next();
docCategorys = Util.null2String(rs.getString(1));
}
if (StringUtils.isNullOrEmpty(docCategorys)) {
docCategorys = ",,1";
}
// String[] docSplit = docCategorys.split(",");
// String category = docSplit[docSplit.length - 1];
// 下载合同到文件服务器中
String docIds = "";
try {
docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user);
} catch (Exception e) {
toolUtil.writeErrorLog("创建文档发生错误:" + e);
}
toolUtil.writeDebuggerLog("生成的文档的id" + docIds);
// 将id保存到流程字段中
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(ufContractInfoDTO.getWorkflowMainTable(),
ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds),
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getMainId()));
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
}
}
} else {
// 全部合同一起发送的签署信息
// 直接合同已签署+1
update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1);
// 如果已签文件数等于需要签署的合同数乘以合同文件数相等,则代表对方已经签署完毕
if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum() * ufContractInfoDTO.getSingleContractFileNum()) {
update.put("contract_status", 3);
// 判断是否控制签署规则 1-仅本方签署2-仅对方签署3-都签署
if ("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
update.put("contract_status", 4);
}
if ("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
update.put("contract_status", 4);
// 仅对方签署完成后,添加用户信息 // 仅对方签署完成后,添加用户信息
// 获取配置表信息 // 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 4); FaDaDaConfigDTO faDaDaConfigDTO =
faDDContractMapping.queryConfig(
String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String userInfo = ufContractInfoDTO.getUserInfo(); String userInfo = ufContractInfoDTO.getUserInfo();
User user = JSON.parseObject(userInfo, new TypeReference<User>() { User user = JSON.parseObject(userInfo, new TypeReference<User>() {});
});
// 获取流程中的合同字段的文档目录id // 获取流程中的合同字段的文档目录id
rs.executeQuery("select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType()); rs.executeQuery(
"select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
String formId = Util.recordeSet2Entity(rs, String.class); String formId = Util.recordeSet2Entity(rs, String.class);
String query = "select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)"; String query =
"select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)";
rs.executeQuery(query, faDaDaConfigDTO.getContractDoc(), formId); rs.executeQuery(query, faDaDaConfigDTO.getContractDoc(), formId);
String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class)); String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class));
if (StringUtils.isNullOrEmpty(docCategorys)) { if (StringUtils.isNullOrEmpty(docCategorys)) {
@ -406,9 +373,9 @@ public class FaDDContractService {
if (StringUtils.isNullOrEmpty(docCategorys)) { if (StringUtils.isNullOrEmpty(docCategorys)) {
docCategorys = ",,1"; docCategorys = ",,1";
} }
// String[] docSplit = docCategorys.split(","); // String[] docSplit = docCategorys.split(",");
// String category = docSplit[docSplit.length - 1]; // String category = docSplit[docSplit.length - 1];
// 下载合同到文件服务器中 // 下载合同到文件服务器中
String docIds = ""; String docIds = "";
try { try {
docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user); docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user);
@ -416,23 +383,97 @@ public class FaDDContractService {
toolUtil.writeErrorLog("创建文档发生错误:" + e); toolUtil.writeErrorLog("创建文档发生错误:" + e);
} }
toolUtil.writeDebuggerLog("生成的文档的id" + docIds); toolUtil.writeDebuggerLog("生成的文档的id" + docIds);
// 将id保存到流程字段中 // 将id保存到流程字段中
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(ufContractInfoDTO.getWorkflowMainTable(), PrepSqlResultImpl sqlResult =
Util.createSqlBuilder()
.updateSql(
ufContractInfoDTO.getWorkflowMainTable(),
ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds), ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds),
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getMainId())); Util.createPrepWhereImpl()
.whereAnd("id")
.whereEqual(ufContractInfoDTO.getMainId()));
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
}
}
} else {
// 全部合同一起发送的签署信息
// 直接合同已签署+1
update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1);
// 如果已签文件数等于需要签署的合同数乘以合同文件数相等,则代表对方已经签署完毕
if (ufContractInfoDTO.getSignedNum() + 1
== ufContractInfoDTO.getShouldSignedNum()
* ufContractInfoDTO.getSingleContractFileNum()) {
update.put("contract_status", 3);
// 判断是否控制签署规则 1-仅本方签署2-仅对方签署3-都签署
if ("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
update.put("contract_status", 4);
}
if ("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
update.put("contract_status", 4);
// 仅对方签署完成后,添加用户信息
// 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO =
faDDContractMapping.queryConfig(
String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
RecordSet rs = new RecordSet();
String userInfo = ufContractInfoDTO.getUserInfo();
User user = JSON.parseObject(userInfo, new TypeReference<User>() {});
// 获取流程中的合同字段的文档目录id
rs.executeQuery(
"select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
String formId = Util.recordeSet2Entity(rs, String.class);
String query =
"select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)";
rs.executeQuery(query, faDaDaConfigDTO.getContractDoc(), formId);
String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class));
if (StringUtils.isNullOrEmpty(docCategorys)) {
query = "select doccategory from workflow_base where id = ?";
rs.executeQuery(query, ufContractInfoDTO.getWorkflowType());
rs.next();
docCategorys = Util.null2String(rs.getString(1));
}
if (StringUtils.isNullOrEmpty(docCategorys)) {
docCategorys = ",,1";
}
// String[] docSplit = docCategorys.split(",");
// String category = docSplit[docSplit.length - 1];
// 下载合同到文件服务器中
String docIds = "";
try {
docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user);
} catch (Exception e) {
toolUtil.writeErrorLog("创建文档发生错误:" + e);
}
toolUtil.writeDebuggerLog("生成的文档的id" + docIds);
// 将id保存到流程字段中
PrepSqlResultImpl sqlResult =
Util.createSqlBuilder()
.updateSql(
ufContractInfoDTO.getWorkflowMainTable(),
ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds),
Util.createPrepWhereImpl()
.whereAnd("id")
.whereEqual(ufContractInfoDTO.getMainId()));
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
} }
} }
} }
// 更新状态 // 更新状态
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("uf_contract_info", update, PrepSqlResultImpl sqlResult =
Util.createSqlBuilder()
.updateSql(
"uf_contract_info",
update,
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId())); Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId()));
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
toolUtil.writeDebuggerLog(String.format("合同签署回调,更新合同状态,更新语句{%s},更新参数{%s}", sqlResult.getSqlStr(), sqlResult.getArgs())); toolUtil.writeDebuggerLog(
String.format(
"合同签署回调,更新合同状态,更新语句{%s},更新参数{%s}", sqlResult.getSqlStr(), sqlResult.getArgs()));
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 查询合同状态,更新明细表 // 查询合同状态,更新明细表
/* Map<String,Object> data = new HashMap<>(); /* Map<String,Object> data = new HashMap<>();
data.put("contractNo","6a265befb3944d93a7a8b32b8d5ca33d"); data.put("contractNo","6a265befb3944d93a7a8b32b8d5ca33d");
Map<String, Object> faResult = null; Map<String, Object> faResult = null;
@ -453,10 +494,10 @@ public class FaDDContractService {
if(!"1".equals(signStatus)){ if(!"1".equals(signStatus)){
continue; continue;
} }
// 更新数据库 // 更新数据库
update.clear(); update.clear();
update.put("signed_status",2); update.put("signed_status",2);
// 查询明细表id // 查询明细表id
} }
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); e.printStackTrace();
@ -470,7 +511,10 @@ public class FaDDContractService {
* @param ufContractInfoDTO * @param ufContractInfoDTO
*/ */
private void nextContractSigned(UfContractInfoDTO ufContractInfoDTO) { private void nextContractSigned(UfContractInfoDTO ufContractInfoDTO) {
String query = "select * from " + ufContractInfoDTO.getWorkflowDetailTable() + " where mainid = ? and signed_status is null"; String query =
"select * from "
+ ufContractInfoDTO.getWorkflowDetailTable()
+ " where mainid = ? and signed_status is null";
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
rs.executeQuery(query, ufContractInfoDTO.getMainId()); rs.executeQuery(query, ufContractInfoDTO.getMainId());
List<Map<String, Object>> detailMaps = Util.recordSet2MapList(rs); List<Map<String, Object>> detailMaps = Util.recordSet2MapList(rs);
@ -483,15 +527,20 @@ public class FaDDContractService {
toolUtil.writeErrorLog("mainMap 查询到null -------> " + JSON.toJSONString(ufContractInfoDTO)); toolUtil.writeErrorLog("mainMap 查询到null -------> " + JSON.toJSONString(ufContractInfoDTO));
throw new RuntimeException("mainMap查询到null!"); throw new RuntimeException("mainMap查询到null!");
} }
// 获取配置表信息 // 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 3); FaDaDaConfigDTO faDaDaConfigDTO =
// 查询接口配置树形结构 faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 3);
// 查询接口配置树形结构
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig());
// 查询签署数据 // 查询签署数据
List<Map<String, Object>> dataArr = getDataArr(ufContractInfoDTO.getWorkflowRequestId(), List<Map<String, Object>> dataArr =
String.valueOf(ufContractInfoDTO.getWorkflowType()), ufContractInfoDTO.getWorkflowMainTable(), getDataArr(
ufContractInfoDTO.getWorkflowDetailTable(), detailMaps); ufContractInfoDTO.getWorkflowRequestId(),
// 处理数据 String.valueOf(ufContractInfoDTO.getWorkflowType()),
ufContractInfoDTO.getWorkflowMainTable(),
ufContractInfoDTO.getWorkflowDetailTable(),
detailMaps);
// 处理数据
List<Map<String, Object>> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); List<Map<String, Object>> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr);
if (maps == null) { if (maps == null) {
toolUtil.writeDebuggerLog("service签署合同错误错误原因maps为null!"); toolUtil.writeDebuggerLog("service签署合同错误错误原因maps为null!");
@ -502,39 +551,52 @@ public class FaDDContractService {
} }
Map<String, Object> updateData = new HashMap<>(); Map<String, Object> updateData = new HashMap<>();
Map<String, Object> map = maps.get(1); Map<String, Object> map = maps.get(1);
// 如果进行控制签署规则 // 如果进行控制签署规则
if (faDaDaConfigDTO.getSignedType() == 1) { if (faDaDaConfigDTO.getSignedType() == 1) {
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) { if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1())))
// 仅对方签署 == faDaDaConfigDTO.getOnlyOther()) {
// 仅对方签署
if (maps.size() == 1) { if (maps.size() == 1) {
// map.put("signType", 1); // map.put("signType", 1);
// 如果是最后一个人了,就直接归档 // 如果是最后一个人了,就直接归档
map.put("autoArchive", 1); map.put("autoArchive", 1);
} }
} }
} }
/* if (faDaDaConfigDTO.getSignedType() == 1) { /* if (faDaDaConfigDTO.getSignedType() == 1) {
// 需要控制签署规则 // 需要控制签署规则
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) { if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) {
// 只需要对方签署 // 只需要对方签署
map.put("autoArchive", 1); map.put("autoArchive", 1);
} }
// 双方签署 // 双方签署
}*/ }*/
// 签署下一次 // 签署下一次
toolUtil.writeDebuggerLog("下一个供应商签署合同,签署数据:" + JSON.toJSONString(map)); toolUtil.writeDebuggerLog("下一个供应商签署合同,签署数据:" + JSON.toJSONString(map));
signedRequest(map, apiConfigMainDTO); signedRequest(map, apiConfigMainDTO);
// 将合同签署信息更新到合同信息表中 // 将合同签署信息更新到合同信息表中
updateData.put("single_signed_num", 0); updateData.put("single_signed_num", 0);
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateData, PrepSqlResultImpl sqlResult =
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(ufContractInfoDTO.getWorkflowRequestId())); Util.createSqlBuilder()
.updateSql(
contractInfoTable,
updateData,
Util.createPrepWhereImpl()
.whereAnd("workflow_request_id")
.whereEqual(ufContractInfoDTO.getWorkflowRequestId()));
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
updateData.clear(); updateData.clear();
// 更新明细表合同信息 明细表添加字段signed_status合同方签署状态 // 更新明细表合同信息 明细表添加字段signed_status合同方签署状态
// 签署状态1 已发送待签署2 已签蜀 // 签署状态1 已发送待签署2 已签蜀
updateData.put("signed_status", 1); updateData.put("signed_status", 1);
sqlResult = Util.createSqlBuilder().updateSql(ufContractInfoDTO.getWorkflowDetailTable(), updateData, sqlResult =
Util.createPrepWhereImpl().whereAnd("id").whereEqual(String.valueOf(map.get("id")))); Util.createSqlBuilder()
.updateSql(
ufContractInfoDTO.getWorkflowDetailTable(),
updateData,
Util.createPrepWhereImpl()
.whereAnd("id")
.whereEqual(String.valueOf(map.get("id"))));
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
} }
@ -547,7 +609,7 @@ public class FaDDContractService {
private void signedRequest(Map<String, Object> map, ApiConfigMainDTO apiConfigMainDTO) { private void signedRequest(Map<String, Object> map, ApiConfigMainDTO apiConfigMainDTO) {
String contractNos = Util.null2String(map.get("contractNo")); String contractNos = Util.null2String(map.get("contractNo"));
String[] split = contractNos.split(","); String[] split = contractNos.split(",");
// RecordSet rs = new RecordSet(); // RecordSet rs = new RecordSet();
for (String s : split) { for (String s : split) {
map.put("contractNo", s); map.put("contractNo", s);
ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl()); ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl());
@ -571,7 +633,7 @@ public class FaDDContractService {
* @return * @return
*/ */
public Map<String, Object> querySignedStatus(String requestId) { public Map<String, Object> querySignedStatus(String requestId) {
// 查询合同状态 // 查询合同状态
String query = "select * from " + contractInfoTable + " where workflow_request_id = ?"; String query = "select * from " + contractInfoTable + " where workflow_request_id = ?";
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
rs.executeQuery(query, requestId); rs.executeQuery(query, requestId);
@ -581,38 +643,41 @@ public class FaDDContractService {
boolean isSingedOneself = false; boolean isSingedOneself = false;
if (result == null) { if (result == null) {
toolUtil.writeDebuggerLog("查询到状态为nullsql" + query + " ---> " + requestId); toolUtil.writeDebuggerLog("查询到状态为nullsql" + query + " ---> " + requestId);
return ParaMap.create().put("isAllSinged", false) return ParaMap.create().put("isAllSinged", false).put("isSingedOneself", false);
.put("isSingedOneself", false);
} }
// 等待对方签署 // 等待对方签署
/* if("2".equals(result.get("contract_status"))){ /* if("2".equals(result.get("contract_status"))){
isAllSinged = false; isAllSinged = false;
}*/ }*/
// 等待我方签署 // 等待我方签署
if ("3".equals(Util.null2String(result.get("contract_status")))) { if ("3".equals(Util.null2String(result.get("contract_status")))) {
isAllSinged = true; isAllSinged = true;
} }
// 签署完毕 // 签署完毕
if ("4".equals(Util.null2String(result.get("contract_status")))) { if ("4".equals(Util.null2String(result.get("contract_status")))) {
isAllSinged = true; isAllSinged = true;
isSingedOneself = true; isSingedOneself = true;
} }
return ParaMap.create().put("isAllSinged", isAllSinged) return ParaMap.create().put("isAllSinged", isAllSinged).put("isSingedOneself", isSingedOneself);
.put("isSingedOneself", isSingedOneself);
} }
public void signedContractOwn(String requestId, User user) { public void signedContractOwn(String requestId, User user) {
// 查询合同信息 // 查询合同信息
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); UfContractInfoDTO ufContractInfoDTO =
// 获取配置表信息 faDDContractMapping.queryContractInfoByRequestId(requestId);
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 4); // 获取配置表信息
// 查询接口配置树形结构 FaDaDaConfigDTO faDaDaConfigDTO =
faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
// 查询接口配置树形结构
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig());
// 查询签署数据 // 查询签署数据
List<Map<String, Object>> dataArr = getDataArr(ufContractInfoDTO.getWorkflowRequestId(), List<Map<String, Object>> dataArr =
String.valueOf(ufContractInfoDTO.getWorkflowType()), ufContractInfoDTO.getWorkflowMainTable(), getDataArr(
ufContractInfoDTO.getWorkflowRequestId(),
String.valueOf(ufContractInfoDTO.getWorkflowType()),
ufContractInfoDTO.getWorkflowMainTable(),
ufContractInfoDTO.getWorkflowDetailTable()); ufContractInfoDTO.getWorkflowDetailTable());
// 处理数据 // 处理数据
List<Map<String, Object>> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); List<Map<String, Object>> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr);
if (maps == null) { if (maps == null) {
toolUtil.writeErrorLog("service签署合同错误错误原因maps为null!"); toolUtil.writeErrorLog("service签署合同错误错误原因maps为null!");
@ -644,20 +709,26 @@ public class FaDDContractService {
viewUrlList.add(Util.null2String(result.get("viewUrl"))); viewUrlList.add(Util.null2String(result.get("viewUrl")));
} }
} }
// 更新合同状态 // 更新合同状态
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
Map<String, Object> update = new HashMap<>(); Map<String, Object> update = new HashMap<>();
update.put("contract_status", 4); update.put("contract_status", 4);
update.put("contract_view_url", String.join(";", viewUrlList)); update.put("contract_view_url", String.join(";", viewUrlList));
update.put("contract_down_url", String.join(";", downloadUrlList)); update.put("contract_down_url", String.join(";", downloadUrlList));
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update, PrepSqlResultImpl sqlResult =
Util.createSqlBuilder()
.updateSql(
contractInfoTable,
update,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 获取流程中的合同字段的文档目录id // 获取流程中的合同字段的文档目录id
rs.executeQuery("select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType()); rs.executeQuery(
"select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
String formId = Util.recordeSet2Entity(rs, String.class); String formId = Util.recordeSet2Entity(rs, String.class);
String query = "select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)"; String query =
"select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)";
rs.executeQuery(query, faDaDaConfigDTO.getContractDoc(), formId); rs.executeQuery(query, faDaDaConfigDTO.getContractDoc(), formId);
String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class)); String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class));
if (StringUtils.isNullOrEmpty(docCategorys)) { if (StringUtils.isNullOrEmpty(docCategorys)) {
@ -669,9 +740,9 @@ public class FaDDContractService {
if (StringUtils.isNullOrEmpty(docCategorys)) { if (StringUtils.isNullOrEmpty(docCategorys)) {
docCategorys = ",,1"; docCategorys = ",,1";
} }
// String[] docSplit = docCategorys.split(","); // String[] docSplit = docCategorys.split(",");
// String category = docSplit[docSplit.length - 1]; // String category = docSplit[docSplit.length - 1];
// 下载合同到文件服务器中 // 下载合同到文件服务器中
String docIds = ""; String docIds = "";
try { try {
docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user); docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user);
@ -679,31 +750,41 @@ public class FaDDContractService {
toolUtil.writeErrorLog("创建文档发生错误:" + e); toolUtil.writeErrorLog("创建文档发生错误:" + e);
} }
toolUtil.writeDebuggerLog("生成的文档的id" + docIds); toolUtil.writeDebuggerLog("生成的文档的id" + docIds);
// 将id保存到流程字段中 // 将id保存到流程字段中
sqlResult = Util.createSqlBuilder().updateSql(ufContractInfoDTO.getWorkflowMainTable(), sqlResult =
Util.createSqlBuilder()
.updateSql(
ufContractInfoDTO.getWorkflowMainTable(),
ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds), ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds),
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getMainId())); Util.createPrepWhereImpl()
.whereAnd("id")
.whereEqual(ufContractInfoDTO.getMainId()));
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
} }
public String downloadContract2FileSystem(UfContractInfoDTO ufContractInfoDTO, String category, User user) { public String downloadContract2FileSystem(
UfContractInfoDTO ufContractInfoDTO, String category, User user) {
/* ImageFileManager fileManager = new ImageFileManager(); /* ImageFileManager fileManager = new ImageFileManager();
int fileId = fileManager.saveImageFileByInputStream(downloadContract(ufContractInfoDTO.getContractNo(), int fileId = fileManager.saveImageFileByInputStream(downloadContract(ufContractInfoDTO.getContractNo(),
String.valueOf(ufContractInfoDTO.getWorkflowType())), ufContractInfoDTO.getFileName());*/ String.valueOf(ufContractInfoDTO.getWorkflowType())), ufContractInfoDTO.getFileName());*/
// 获取配置表信息 // 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 5); FaDaDaConfigDTO faDaDaConfigDTO =
faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 5);
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig());
String contractNos = Util.null2String(ufContractInfoDTO.getContractNo()); String contractNos = Util.null2String(ufContractInfoDTO.getContractNo());
String[] split = contractNos.split(","); String[] split = contractNos.split(",");
List<String> docIds = new ArrayList<>(); List<String> docIds = new ArrayList<>();
for (String contractNo : split) { for (String contractNo : split) {
// InputStream inputStream = downloadContract(s, String.valueOf(ufContractInfoDTO.getWorkflowType())); // InputStream inputStream = downloadContract(s,
// String.valueOf(ufContractInfoDTO.getWorkflowType()));
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("contractNo", contractNo); data.put("contractNo", contractNo);
AtomicReference<InputStream> content = new AtomicReference<>(); AtomicReference<InputStream> content = new AtomicReference<>();
FaDDRequestUtils.downContract(data, response -> { FaDDRequestUtils.downContract(
data,
response -> {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (response.getStatusLine().getStatusCode() != 200) { if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("法大大请求接口错误!"); throw new RuntimeException("法大大请求接口错误!");
@ -723,24 +804,30 @@ public class FaDDContractService {
this.toolUtil.writeErrorLog(ufContractInfoDTO.toString()); this.toolUtil.writeErrorLog(ufContractInfoDTO.toString());
String base64 = Base64Utils.encode(byteArray); String base64 = Base64Utils.encode(byteArray);
FileProcessor fileProcessor = new FileProcessor(); FileProcessor fileProcessor = new FileProcessor();
// toolUtil.writeDebuggerLog("base64" + "base64:" + base64); // toolUtil.writeDebuggerLog("base64" + "base64:" + base64);
toolUtil.writeDebuggerLog("category" + category); toolUtil.writeDebuggerLog("category" + category);
// toolUtil.writeDebuggerLog("user" + JSON.toJSONString(user)); // toolUtil.writeDebuggerLog("user" + JSON.toJSONString(user));
toolUtil.writeDebuggerLog("fileName" + ufContractInfoDTO.getFileName()); toolUtil.writeDebuggerLog("fileName" + ufContractInfoDTO.getFileName());
docIds.add(String.valueOf(fileProcessor.Process("base64:" + base64, category, user, ufContractInfoDTO.getFileName()))); docIds.add(
}, apiConfigMainDTO.getApiUrl()); String.valueOf(
fileProcessor.Process(
"base64:" + base64, category, user, ufContractInfoDTO.getFileName())));
},
apiConfigMainDTO.getApiUrl());
} }
return String.join(",", docIds); return String.join(",", docIds);
} }
public InputStream downloadContract(String contractNo, String workflowId) { public InputStream downloadContract(String contractNo, String workflowId) {
// 获取配置表信息 // 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 5); FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 5);
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig());
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("contractNo", contractNo); data.put("contractNo", contractNo);
AtomicReference<InputStream> content = new AtomicReference<>(); AtomicReference<InputStream> content = new AtomicReference<>();
FaDDRequestUtils.downContract(data, response -> { FaDDRequestUtils.downContract(
data,
response -> {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (response.getStatusLine().getStatusCode() != 200) { if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("法大大请求接口错误!"); throw new RuntimeException("法大大请求接口错误!");
@ -750,7 +837,8 @@ public class FaDDContractService {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}, apiConfigMainDTO.getApiUrl()); },
apiConfigMainDTO.getApiUrl());
return content.get(); return content.get();
} }
@ -762,27 +850,32 @@ public class FaDDContractService {
*/ */
public StreamingOutput download4mFDD(UfContractInfoDTO ufContractInfoDTO) { public StreamingOutput download4mFDD(UfContractInfoDTO ufContractInfoDTO) {
// 获取配置表信息 // 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 5); FaDaDaConfigDTO faDaDaConfigDTO =
faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 5);
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig());
// 查询合同信息 // 查询合同信息
// UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); // UfContractInfoDTO ufContractInfoDTO =
// faDDContractMapping.queryContractInfoByRequestId(requestId);
String contractNos = Util.null2String(ufContractInfoDTO.getContractNo()); String contractNos = Util.null2String(ufContractInfoDTO.getContractNo());
String fileNames = Util.null2String(ufContractInfoDTO.getFileName()); String fileNames = Util.null2String(ufContractInfoDTO.getFileName());
String[] contractNoArr = contractNos.split(","); String[] contractNoArr = contractNos.split(",");
String[] fileNameArr = fileNames.split(","); String[] fileNameArr = fileNames.split(",");
toolUtil.writeDebuggerLog("下载合同download4mFDD"); toolUtil.writeDebuggerLog("下载合同download4mFDD");
if (contractNoArr.length >= 2) { if (contractNoArr.length >= 2) {
// 多个文件,需要下载压缩包 // 多个文件,需要下载压缩包
return outputStream -> { return outputStream -> {
ZipOutputStream zipOut = new ZipOutputStream(outputStream); ZipOutputStream zipOut = new ZipOutputStream(outputStream);
int catchLen = 10 * 1024; int catchLen = 10 * 1024;
for (int i = 0; i < contractNoArr.length; i++) { for (int i = 0; i < contractNoArr.length; i++) {
// InputStream inputStream = downloadContract(contractNoArr[i], String.valueOf(ufContractInfoDTO.getWorkflowType())); // InputStream inputStream = downloadContract(contractNoArr[i],
// String.valueOf(ufContractInfoDTO.getWorkflowType()));
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("contractNo", contractNoArr[i]); data.put("contractNo", contractNoArr[i]);
AtomicReference<InputStream> content = new AtomicReference<>(); AtomicReference<InputStream> content = new AtomicReference<>();
int finalI = i; int finalI = i;
FaDDRequestUtils.downContract(data, response -> { FaDDRequestUtils.downContract(
data,
response -> {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (response.getStatusLine().getStatusCode() != 200) { if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("法大大请求接口错误!"); throw new RuntimeException("法大大请求接口错误!");
@ -801,8 +894,8 @@ public class FaDDContractService {
e.printStackTrace(); e.printStackTrace();
toolUtil.writeErrorLog("文件压缩处理出现问题!" + e); toolUtil.writeErrorLog("文件压缩处理出现问题!" + e);
} }
}, apiConfigMainDTO.getApiUrl()); },
apiConfigMainDTO.getApiUrl());
} }
zipOut.flush(); zipOut.flush();
zipOut.close(); zipOut.close();
@ -812,11 +905,14 @@ public class FaDDContractService {
} }
return outputStream -> { return outputStream -> {
toolUtil.writeDebuggerLog("download4mFDD单文件下载"); toolUtil.writeDebuggerLog("download4mFDD单文件下载");
// InputStream inputStream = downloadContract(contractNos,String.valueOf(ufContractInfoDTO.getWorkflowType())); // InputStream inputStream =
// downloadContract(contractNos,String.valueOf(ufContractInfoDTO.getWorkflowType()));
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("contractNo", contractNos); data.put("contractNo", contractNos);
AtomicReference<InputStream> content = new AtomicReference<>(); AtomicReference<InputStream> content = new AtomicReference<>();
FaDDRequestUtils.downContract(data, response -> { FaDDRequestUtils.downContract(
data,
response -> {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (response.getStatusLine().getStatusCode() != 200) { if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("法大大请求接口错误!"); throw new RuntimeException("法大大请求接口错误!");
@ -836,8 +932,8 @@ public class FaDDContractService {
e.printStackTrace(); e.printStackTrace();
toolUtil.writeErrorLog("单文件下载处理出现问题!" + e); toolUtil.writeErrorLog("单文件下载处理出现问题!" + e);
} }
}, apiConfigMainDTO.getApiUrl()); },
apiConfigMainDTO.getApiUrl());
}; };
} }
} }

View File

@ -1,25 +1,5 @@
package com.api.aiyh_pcn.fadada.service.impl; package com.api.aiyh_pcn.fadada.service.impl;
import aiyh.utils.Util;
import aiyh.utils.entity.ApiConfigDetailDTO;
import aiyh.utils.entity.ApiConfigMainDTO;
import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.zwl.common.ToolUtil;
import com.alibaba.fastjson.JSONObject;
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO;
import com.api.aiyh_pcn.fadada.service.IFaDDService;
import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils;
import com.api.aiyh_pcn.fadada.vo.TableFieldMappingVO;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import weaver.conn.RecordSet;
import weaver.workflow.workflow.WorkflowVersion;
import javax.ws.rs.core.StreamingOutput;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
@ -29,18 +9,37 @@ import java.util.Map;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import javax.ws.rs.core.StreamingOutput;
import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import com.alibaba.fastjson.JSONObject;
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO;
import com.api.aiyh_pcn.fadada.service.IFaDDService;
import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils;
import com.api.aiyh_pcn.fadada.vo.TableFieldMappingVO;
import com.fasterxml.jackson.core.JsonProcessingException;
import aiyh.utils.Util;
import aiyh.utils.entity.ApiConfigDetailDTO;
import aiyh.utils.entity.ApiConfigMainDTO;
import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.zwl.common.ToolUtil;
import weaver.conn.RecordSet;
import weaver.workflow.workflow.WorkflowVersion;
/** /**
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021/9/30 0030 11:12 * @create 2021/9/30 0030 11:12 service
* service
*/ */
public class FaDDServiceImpl implements IFaDDService { public class FaDDServiceImpl implements IFaDDService {
private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping();
private final ToolUtil toolUtil = new ToolUtil(); private final ToolUtil toolUtil = new ToolUtil();
// private final String MAIN_TABLE = "formtable_main_17"; // private final String MAIN_TABLE = "formtable_main_17";
@Override @Override
public Map<String, Object> getConfigParam(String workflowId) { public Map<String, Object> getConfigParam(String workflowId) {
@ -55,10 +54,10 @@ public class FaDDServiceImpl implements IFaDDService {
int id = detail.getId(); int id = detail.getId();
String table = detail.getTablename(); String table = detail.getTablename();
if (!table.contains("_dt")) { if (!table.contains("_dt")) {
// 表示字段属于主表 // 表示字段属于主表
tableName = "main"; tableName = "main";
} else { } else {
// 字段属于明细表 // 字段属于明细表
String dt = table.substring(table.indexOf("_dt") + 3); String dt = table.substring(table.indexOf("_dt") + 3);
tableName = "detail_" + dt; tableName = "detail_" + dt;
} }
@ -66,21 +65,21 @@ public class FaDDServiceImpl implements IFaDDService {
tableFieldMappingVO.setId(id); tableFieldMappingVO.setId(id);
int changeRule = detail.getChangeRule(); int changeRule = detail.getChangeRule();
if (changeRule == 0) { if (changeRule == 0) {
// 不转换,需要获取到流程字段,前端获取流程字段对应的值 // 不转换,需要获取到流程字段,前端获取流程字段对应的值
fieldName = detail.getWorkflowField(); fieldName = detail.getWorkflowField();
tableFieldMappingVO.setField(fieldName); tableFieldMappingVO.setField(fieldName);
tableFieldMappingVOS.add(tableFieldMappingVO); tableFieldMappingVOS.add(tableFieldMappingVO);
} else if (changeRule == 2) { } else if (changeRule == 2) {
// 流程字段值,与不转换一至 // 流程字段值,与不转换一至
fieldName = detail.getWorkflowField(); fieldName = detail.getWorkflowField();
tableFieldMappingVO.setField(fieldName); tableFieldMappingVO.setField(fieldName);
tableFieldMappingVOS.add(tableFieldMappingVO); tableFieldMappingVOS.add(tableFieldMappingVO);
} }
if (changeRule == 7 || changeRule == 6) { if (changeRule == 7 || changeRule == 6) {
// 7 自定义SQL与流程转SQL一样 // 7 自定义SQL与流程转SQL一样
List<TableFieldMappingVO> tableFieldMappingVOList = new ArrayList<>(); List<TableFieldMappingVO> tableFieldMappingVOList = new ArrayList<>();
// 6 流程字段转SQL需要获取SQL中的字段变量前端通过字段变量获取值 // 6 流程字段转SQL需要获取SQL中的字段变量前端通过字段变量获取值
// 解析SQL // 解析SQL
Map<String, List<String>> result = Util.parsingSq2Map(detail.getParamValue()); Map<String, List<String>> result = Util.parsingSq2Map(detail.getParamValue());
for (Map.Entry<String, List<String>> entry : result.entrySet()) { for (Map.Entry<String, List<String>> entry : result.entrySet()) {
for (String field : entry.getValue()) { for (String field : entry.getValue()) {
@ -94,7 +93,7 @@ public class FaDDServiceImpl implements IFaDDService {
tableFieldMappingVOS.addAll(tableFieldMappingVOList); tableFieldMappingVOS.addAll(tableFieldMappingVOList);
} }
if (detail.getParamType() == 4) { if (detail.getParamType() == 4) {
// 数组类型的需要解析数组sql // 数组类型的需要解析数组sql
List<TableFieldMappingVO> tableFieldMappingVOList = new ArrayList<>(); List<TableFieldMappingVO> tableFieldMappingVOList = new ArrayList<>();
Map<String, List<String>> result = Util.parsingSq2Map(detail.getArraySql()); Map<String, List<String>> result = Util.parsingSq2Map(detail.getArraySql());
for (Map.Entry<String, List<String>> entry : result.entrySet()) { for (Map.Entry<String, List<String>> entry : result.entrySet()) {
@ -109,17 +108,18 @@ public class FaDDServiceImpl implements IFaDDService {
tableFieldMappingVOS.addAll(tableFieldMappingVOList); tableFieldMappingVOS.addAll(tableFieldMappingVOList);
} }
} }
List<TableFieldMappingVO> doDeWeight = Util.deWeight(tableFieldMappingVOS, e -> e.getTableName() + e.getField()); List<TableFieldMappingVO> doDeWeight =
Util.deWeight(tableFieldMappingVOS, e -> e.getTableName() + e.getField());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("tableFieldMappings", doDeWeight); map.put("tableFieldMappings", doDeWeight);
String checkSource = faDaDaConfigDTO.getCheckSource(); String checkSource = faDaDaConfigDTO.getCheckSource();
String sourceTable; String sourceTable;
if (!checkSource.contains("_dt")) { if (!checkSource.contains("_dt")) {
// 表示字段属于主表 // 表示字段属于主表
sourceTable = "main"; sourceTable = "main";
map.put("isMain", true); map.put("isMain", true);
} else { } else {
// 字段属于明细表 // 字段属于明细表
String dt = checkSource.substring(checkSource.indexOf("_dt") + 3); String dt = checkSource.substring(checkSource.indexOf("_dt") + 3);
sourceTable = "detail_" + dt; sourceTable = "detail_" + dt;
map.put("isMain", false); map.put("isMain", false);
@ -134,7 +134,7 @@ public class FaDDServiceImpl implements IFaDDService {
String workflowId = String.valueOf(params.get("workflowId")); String workflowId = String.valueOf(params.get("workflowId"));
FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 0); FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 0);
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig());
List<Map<String, Object>> dataArr = (List<Map<String, Object>>) params.get("dataArr"); List<Map<String, Object>> dataArr = (List<Map<String, Object>>)params.get("dataArr");
List<ApiConfigDetailDTO> details = apiConfigMainDTO.getDetails(); List<ApiConfigDetailDTO> details = apiConfigMainDTO.getDetails();
List<Map<String, Object>> datas = objectAndListHandle(details, dataArr); List<Map<String, Object>> datas = objectAndListHandle(details, dataArr);
List<Map<String, Object>> errorList = new ArrayList<>(); List<Map<String, Object>> errorList = new ArrayList<>();
@ -143,17 +143,18 @@ public class FaDDServiceImpl implements IFaDDService {
System.out.println(JSONObject.toJSONString(data)); System.out.println(JSONObject.toJSONString(data));
Map<String, Object> result = FaDDRequestUtils.checkCompanyInfo(data); Map<String, Object> result = FaDDRequestUtils.checkCompanyInfo(data);
if (result == null) { if (result == null) {
// 未查询到数据 // 未查询到数据
errorList.add(data); errorList.add(data);
} else { } else {
if ("1001005".equals(String.valueOf(result.get("code"))) || !"200".equals(String.valueOf(result.get("code")))) { if ("1001005".equals(String.valueOf(result.get("code")))
// 企业信息不存在或者未认证 || !"200".equals(String.valueOf(result.get("code")))) {
// 企业信息不存在或者未认证
nonsupportList.add(data); nonsupportList.add(data);
} }
} }
} }
if (errorList.size() == 0 && nonsupportList.size() == 0) { if (errorList.size() == 0 && nonsupportList.size() == 0) {
// 所有的都通过 // 所有的都通过
resultMap.put("allPass", true); resultMap.put("allPass", true);
} else { } else {
resultMap.put("allPass", false); resultMap.put("allPass", false);
@ -163,7 +164,8 @@ public class FaDDServiceImpl implements IFaDDService {
return resultMap; return resultMap;
} }
private List<Map<String, Object>> objectAndListHandle(List<ApiConfigDetailDTO> treeList, List<Map<String, Object>> dataArr) { private List<Map<String, Object>> objectAndListHandle(List<ApiConfigDetailDTO> treeList,
List<Map<String, Object>> dataArr) {
List<Map<String, Object>> params = new ArrayList<>(); List<Map<String, Object>> params = new ArrayList<>();
for (Map<String, Object> dataMap : dataArr) { for (Map<String, Object> dataMap : dataArr) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
@ -171,10 +173,10 @@ public class FaDDServiceImpl implements IFaDDService {
Object value; Object value;
if (apiConfigDetailDTO.getParamType() == 3) { if (apiConfigDetailDTO.getParamType() == 3) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
// object类型 // object类型
for (ApiConfigDetailDTO child : apiConfigDetailDTO.getChildren()) { for (ApiConfigDetailDTO child : apiConfigDetailDTO.getChildren()) {
if (child.getChildren() == null || child.getChildren().size() == 0) { if (child.getChildren() == null || child.getChildren().size() == 0) {
// handleChild(child.getChildren(), dataMap) // handleChild(child.getChildren(), dataMap)
map.put(child.getParamName(), changeRuleHandle(child, dataMap)); map.put(child.getParamName(), changeRuleHandle(child, dataMap));
} else { } else {
map.put(child.getParamName(), handleChild(child.getChildren(), dataMap)); map.put(child.getParamName(), handleChild(child.getChildren(), dataMap));
@ -184,10 +186,9 @@ public class FaDDServiceImpl implements IFaDDService {
} else if (apiConfigDetailDTO.getParamType() == 4) { } else if (apiConfigDetailDTO.getParamType() == 4) {
String sql = apiConfigDetailDTO.getArraySql(); String sql = apiConfigDetailDTO.getArraySql();
String parsingSq = Util.parsingSq(sql, dataMap); String parsingSq = Util.parsingSq(sql, dataMap);
// list类型 // list类型
if (parsingSq.contains("delete") || parsingSq.contains("update") || if (parsingSq.contains("delete") || parsingSq.contains("update") || parsingSq.contains("exec")
parsingSq.contains("exec") || parsingSq.contains("drop") || || parsingSq.contains("drop") || parsingSq.contains("truncate")) {
parsingSq.contains("truncate")) {
value = new ArrayList<>(); value = new ArrayList<>();
} else { } else {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
@ -224,49 +225,48 @@ public class FaDDServiceImpl implements IFaDDService {
String table; String table;
String sql; String sql;
String resultSql; String resultSql;
// 判断参数的转换规则 // 判断参数的转换规则
switch (apiConfigDetailDTO.getChangeRule()) { switch (apiConfigDetailDTO.getChangeRule()) {
case 0: case 0:
// 不转换 // 不转换
case 2: case 2:
// 流程字段值 // 流程字段值
table = apiConfigDetailDTO.getTablename(); table = apiConfigDetailDTO.getTablename();
if (!table.contains("_dt")) { if (!table.contains("_dt")) {
// 表示字段属于主表 // 表示字段属于主表
tableName = "main"; tableName = "main";
} else { } else {
// 字段属于明细表 // 字段属于明细表
String dt = table.substring(table.indexOf("_dt") + 3); String dt = table.substring(table.indexOf("_dt") + 3);
tableName = "detail_" + dt; tableName = "detail_" + dt;
} }
value = dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField()); value = dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField());
break; break;
case 1: case 1:
// 固定值 // 固定值
value = apiConfigDetailDTO.getParamValue(); value = apiConfigDetailDTO.getParamValue();
break; break;
case 3: case 3:
// 系统日期 // 系统日期
value = Util.getTime("yyyy-MM-dd"); value = Util.getTime("yyyy-MM-dd");
break; break;
case 4: case 4:
// 系统时间 // 系统时间
value = Util.getTime("HH:mm:ss"); value = Util.getTime("HH:mm:ss");
break; break;
case 5: case 5:
// 系统日期-时间 // 系统日期-时间
value = Util.getTime("yyyy-MM-dd HH:mm:ss"); value = Util.getTime("yyyy-MM-dd HH:mm:ss");
break; break;
case 6: case 6:
// 自定义SQL // 自定义SQL
case 7: case 7:
// 流程字段转SQL // 流程字段转SQL
sql = apiConfigDetailDTO.getParamValue(); sql = apiConfigDetailDTO.getParamValue();
resultSql = Util.parsingSq(sql, dataMap); resultSql = Util.parsingSq(sql, dataMap);
toolUtil.writeErrorLog(dataMap.toString()); toolUtil.writeErrorLog(dataMap.toString());
if (resultSql.contains("delete ") || resultSql.contains("update ") || if (resultSql.contains("delete ") || resultSql.contains("update ") || resultSql.contains("exec ")
resultSql.contains("exec ") || resultSql.contains("drop ") || || resultSql.contains("drop ") || resultSql.contains("truncate ")) {
resultSql.contains("truncate ")) {
value = null; value = null;
} else { } else {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
@ -278,18 +278,18 @@ public class FaDDServiceImpl implements IFaDDService {
} }
break; break;
case 8: case 8:
// //
// 流程名称 // 流程名称
value = Util.getWorkflowNameById(String.valueOf(dataMap.get("workflowid"))); value = Util.getWorkflowNameById(String.valueOf(dataMap.get("workflowid")));
break; break;
case 9: case 9:
// //
// 请求标题 // 请求标题
value = Util.getRequestTitleById(String.valueOf(dataMap.get("requestid"))); value = Util.getRequestTitleById(String.valueOf(dataMap.get("requestid")));
break; break;
case 10: case 10:
// //
// 流程requestId // 流程requestId
value = dataMap.get("requestid"); value = dataMap.get("requestid");
break; break;
default: default:
@ -297,23 +297,22 @@ public class FaDDServiceImpl implements IFaDDService {
break; break;
} }
if (apiConfigDetailDTO.getParamType() == 1) { if (apiConfigDetailDTO.getParamType() == 1) {
// Integer // Integer
value = Integer.parseInt(String.valueOf(value)); value = Integer.parseInt(String.valueOf(value));
} else if (apiConfigDetailDTO.getParamType() == 2) { } else if (apiConfigDetailDTO.getParamType() == 2) {
// Boolean // Boolean
value = Boolean.parseBoolean(String.valueOf(value)); value = Boolean.parseBoolean(String.valueOf(value));
} }
return value; return value;
} }
public void queryContractStatus(String workflowId, String requestId, int type) { public void queryContractStatus(String workflowId, String requestId, int type) {
List<Map<String, Object>> maps = faDDServiceMapping.queryDetailInfo(requestId, workflowId, 2); List<Map<String, Object>> maps = faDDServiceMapping.queryDetailInfo(requestId, workflowId, 2);
toolUtil.writeErrorLog("maps+:" + maps); toolUtil.writeErrorLog("maps+:" + maps);
List<Map<String, Object>> notSignedContracts = new ArrayList<>(); List<Map<String, Object>> notSignedContracts = new ArrayList<>();
// 查询是是否签署 // 查询是是否签署
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
// 发送请求查询合同信息 // 发送请求查询合同信息
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
String contracts = String.valueOf(map.get("contract_no")); String contracts = String.valueOf(map.get("contract_no"));
if (contracts == null) { if (contracts == null) {
@ -324,13 +323,13 @@ public class FaDDServiceImpl implements IFaDDService {
toolUtil.writeErrorLog(s); toolUtil.writeErrorLog(s);
data.put("contractNo", s); data.put("contractNo", s);
Map<String, Object> result = null; Map<String, Object> result = null;
// List<String> statusList = new ArrayList<>(); // List<String> statusList = new ArrayList<>();
try { try {
Map<String, Object> response = FaDDRequestUtils.queryContractStatus(data); Map<String, Object> response = FaDDRequestUtils.queryContractStatus(data);
if (!"200".equals(response.get("code"))) { if (!"200".equals(response.get("code"))) {
throw new RuntimeException("法大大请求接口错误!"); throw new RuntimeException("法大大请求接口错误!");
} }
result = (Map<String, Object>) response.get("data"); result = (Map<String, Object>)response.get("data");
this.toolUtil.writeErrorLog("催一催:" + result); this.toolUtil.writeErrorLog("催一催:" + result);
} catch (RuntimeException e) { } catch (RuntimeException e) {
e.printStackTrace(); e.printStackTrace();
@ -338,17 +337,17 @@ public class FaDDServiceImpl implements IFaDDService {
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
toolUtil.writeDebuggerLog("转换错误:" + e); toolUtil.writeDebuggerLog("转换错误:" + e);
} }
if ("1".equals(String.valueOf(result.get("status"))) || "6".equals(String.valueOf(result.get("status")))) { if ("1".equals(String.valueOf(result.get("status")))
// 发送请求催一下 签署合同 || "6".equals(String.valueOf(result.get("status")))) {
// 发送请求催一下 签署合同
notSignedContracts.add(map); notSignedContracts.add(map);
} else { } else {
// 合同状态发生改变,需要修改数据库中的状态信息 百分百会出问题 // 合同状态发生改变,需要修改数据库中的状态信息 百分百会出问题
map.put("contract_status", result.get("status")); map.put("contract_status", result.get("status"));
// statusList.add() // statusList.add()
faDDServiceMapping.updateContractStatus(map, workflowId, 3); faDDServiceMapping.updateContractStatus(map, workflowId, 3);
} }
} }
} }
if (type == 0) { if (type == 0) {
signedContract(workflowId, requestId, notSignedContracts); signedContract(workflowId, requestId, notSignedContracts);
@ -417,7 +416,7 @@ public class FaDDServiceImpl implements IFaDDService {
public StreamingOutput contractDownload(String requestId, String workflowId) { public StreamingOutput contractDownload(String requestId, String workflowId) {
toolUtil.writeErrorLog("进入service方法"); toolUtil.writeErrorLog("进入service方法");
List<Map<String, Object>> maps = null; List<Map<String, Object>> maps = null;
// 查询合同信息 // 查询合同信息
try { try {
maps = faDDServiceMapping.queryDetailDownInfo(requestId, workflowId, 2); maps = faDDServiceMapping.queryDetailDownInfo(requestId, workflowId, 2);
} catch (Exception e) { } catch (Exception e) {
@ -429,7 +428,9 @@ public class FaDDServiceImpl implements IFaDDService {
List<Map<String, Object>> finalMaps = maps; List<Map<String, Object>> finalMaps = maps;
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId);
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_contract_config where workflow_type in ( " + versionStringByWfid + " ) and api_type = ?", 5); rs.executeQuery(
"select * from uf_contract_config where workflow_type in ( " + versionStringByWfid + " ) and api_type = ?",
5);
rs.next(); rs.next();
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(rs.getString("params_config")); ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(rs.getString("params_config"));
return outputStream -> { return outputStream -> {
@ -439,7 +440,7 @@ public class FaDDServiceImpl implements IFaDDService {
String base = ""; String base = "";
for (Map<String, Object> map : finalMaps) { for (Map<String, Object> map : finalMaps) {
base = base + map.get("gyshtfmczw") + "/"; base = base + map.get("gyshtfmczw") + "/";
// 获取合同id // 获取合同id
String contractNoStr = String.valueOf(map.get("contract_no")); String contractNoStr = String.valueOf(map.get("contract_no"));
String contractNameStr = String.valueOf(map.get("file_name")); String contractNameStr = String.valueOf(map.get("file_name"));
String[] contractNos = contractNoStr.split(","); String[] contractNos = contractNoStr.split(",");
@ -449,7 +450,7 @@ public class FaDDServiceImpl implements IFaDDService {
String contractName = contractNames[i]; String contractName = contractNames[i];
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("contractNo", contractNo); data.put("contractNo", contractNo);
// 下载合同 // 下载合同
String finalBase = base; String finalBase = base;
FaDDRequestUtils.downContract(data, response -> { FaDDRequestUtils.downContract(data, response -> {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
@ -477,7 +478,7 @@ public class FaDDServiceImpl implements IFaDDService {
e.printStackTrace(); e.printStackTrace();
toolUtil.writeErrorLog("压缩错误!" + e + "\n"); toolUtil.writeErrorLog("压缩错误!" + e + "\n");
} }
},apiConfigMainDTO.getApiUrl()); }, apiConfigMainDTO.getApiUrl());
} }
} }
zipOut.flush(); zipOut.flush();
@ -485,7 +486,6 @@ public class FaDDServiceImpl implements IFaDDService {
}; };
} }
public boolean isAllSinged(String requestId, String workflowId) { public boolean isAllSinged(String requestId, String workflowId) {
List<Map<String, Object>> maps = faDDServiceMapping.queryDetailInfo(requestId, workflowId, 2); List<Map<String, Object>> maps = faDDServiceMapping.queryDetailInfo(requestId, workflowId, 2);
if (maps == null || maps.size() == 0) { if (maps == null || maps.size() == 0) {
@ -550,7 +550,7 @@ public class FaDDServiceImpl implements IFaDDService {
String[] split = contractNos.split(","); String[] split = contractNos.split(",");
for (String s : split) { for (String s : split) {
map.put("contractNo", s); map.put("contractNo", s);
ResponeVo responeVo = FaDDRequestUtils.signedContract(map,apiConfigMainDTO.getApiUrl()); ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl());
Map<String, Object> response = null; Map<String, Object> response = null;
try { try {
response = responeVo.getEntityMap(); response = responeVo.getEntityMap();
@ -558,7 +558,7 @@ public class FaDDServiceImpl implements IFaDDService {
e.printStackTrace(); e.printStackTrace();
} }
if (!"200".equals(response.get("code"))) { if (!"200".equals(response.get("code"))) {
// throw new RuntimeException("法大大请求接口错误!"); // throw new RuntimeException("法大大请求接口错误!");
this.toolUtil.writeErrorLog("签署参数:" + responeVo.getEntityString()); this.toolUtil.writeErrorLog("签署参数:" + responeVo.getEntityString());
} }
} }
@ -589,7 +589,3 @@ public class FaDDServiceImpl implements IFaDDService {
return nods.split(","); return nods.split(",");
} }
} }

View File

@ -1,17 +1,7 @@
package com.api.aiyh_pcn.fadada.web; package com.api.aiyh_pcn.fadada.web;
import aiyh.utils.ApiResult; import java.util.HashMap;
import aiyh.utils.Util; import java.util.Map;
import aiyh.utils.zwl.common.ToolUtil;
import com.alibaba.fastjson.JSON;
import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping;
import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO;
import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.h2.util.StringUtils;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -20,26 +10,36 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput; import javax.ws.rs.core.StreamingOutput;
import java.util.HashMap;
import java.util.Map; import org.h2.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping;
import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO;
import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService;
import aiyh.utils.ApiResult;
import aiyh.utils.Util;
import aiyh.utils.zwl.common.ToolUtil;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
/** /**
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021/11/3 0003 14:49 * @create 2021/11/3 0003 14:49 fadada
* fadada
*/ */
@Path("/v2/fadada") @Path("/v2/fadada")
public class FaDDContractController { public class FaDDContractController {
private final FaDDContractService faDDService = new FaDDContractService(); private final FaDDContractService faDDService = new FaDDContractService();
private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping(); private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping();
private final ToolUtil toolUtil = new ToolUtil(); private final ToolUtil toolUtil = new ToolUtil();
/** /**
* *
* *
* @param workflowId id * @param workflowId
* id
* @return id * @return id
*/ */
@Path("/getAllVersion/{workflowId}/{markOnly}") @Path("/getAllVersion/{workflowId}/{markOnly}")
@ -56,9 +56,9 @@ public class FaDDContractController {
} }
} }
/** /**
* *
*
* @param params * @param params
* @return * @return
*/ */
@ -72,8 +72,8 @@ public class FaDDContractController {
result.put("code", 200); result.put("code", 200);
result.put("msg", "操作成功!"); result.put("msg", "操作成功!");
String resultCode = String.valueOf(params.get("resultCode")); String resultCode = String.valueOf(params.get("resultCode"));
if(!"1".equals(resultCode)){ if (!"1".equals(resultCode)) {
// 签署失败 // 签署失败
toolUtil.writeErrorLog("合同回调:签署失败,失败信息:" + JSON.toJSONString(params)); toolUtil.writeErrorLog("合同回调:签署失败,失败信息:" + JSON.toJSONString(params));
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
@ -82,9 +82,9 @@ public class FaDDContractController {
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
/** /**
* *
*
* @param requestId * @param requestId
* @param workflowId * @param workflowId
* @return * @return
@ -93,17 +93,19 @@ public class FaDDContractController {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public String querySignedStatus(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId){ public String querySignedStatus(@PathParam("requestId") String requestId,
@PathParam("workflowId") String workflowId) {
Map<String, Object> result = faDDService.querySignedStatus(requestId); Map<String, Object> result = faDDService.querySignedStatus(requestId);
return ApiResult.success(result); return ApiResult.success(result);
} }
/** /**
* *
* *
* @param workflowId id * @param workflowId
* @param requestId id * id
* @param requestId
* id
* @return * @return
*/ */
@Path("/signedContract/own/{requestId}/{workflowId}") @Path("/signedContract/own/{requestId}/{workflowId}")
@ -112,21 +114,21 @@ public class FaDDContractController {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response, public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response,
@PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId) { @PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId) {
// TODO 更换labelIndex // TODO 更换labelIndex
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
try { try {
faDDService.signedContractOwn(requestId, user); faDDService.signedContractOwn(requestId, user);
}catch (Exception e){ } catch (Exception e) {
return ApiResult.error(Util.getHtmlLabelName(-87658,user.getLanguage(),"合同签署失败!")); return ApiResult.error(Util.getHtmlLabelName(-87658, user.getLanguage(), "合同签署失败!"));
} }
return ApiResult.success(Util.getHtmlLabelName(-87657,user.getLanguage(),"本方签署成功!")); return ApiResult.success(Util.getHtmlLabelName(-87657, user.getLanguage(), "本方签署成功!"));
} }
/** /**
* *
* *
* @param requestId id * @param requestId
* id
* @return * @return
*/ */
@Path("/signedContract/{requestId}") @Path("/signedContract/{requestId}")
@ -138,11 +140,11 @@ public class FaDDContractController {
return ApiResult.success("没有催一催接口还点!淦!等法大大调整,额。。。具体啥时候好我也不知道,反正不关我的事!"); return ApiResult.success("没有催一催接口还点!淦!等法大大调整,额。。。具体啥时候好我也不知道,反正不关我的事!");
} }
/** /**
* *
* *
* @param requestId id * @param requestId
* id
* @return * @return
*/ */
@Path("/contract/download/{requestId}") @Path("/contract/download/{requestId}")
@ -153,20 +155,20 @@ public class FaDDContractController {
try { try {
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId);
StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO); StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO);
String requestTitle = Util.null2String(Util.getRequestTitleById(String.valueOf(requestId))); // String requestTitle =
if(StringUtils.isNullOrEmpty(requestTitle)){ // Util.null2String(Util.getRequestTitleById(String.valueOf(requestId)));
requestTitle = "contracts"; String requestTitle = ufContractInfoDTO.getFileName();
if (StringUtils.isNullOrEmpty(requestTitle)) {
requestTitle = "contracts.pdf";
} }
if(Util.null2String(ufContractInfoDTO.getContractNo()).split(",").length >= 2){ if (Util.null2String(ufContractInfoDTO.getContractNo()).split(",").length >= 2) {
// 多文件 // 多文件
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM) return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM).type("application/zip")
.type("application/zip")
.header("Content-Disposition", "attachment;filename=" + requestTitle + ".zip").build(); .header("Content-Disposition", "attachment;filename=" + requestTitle + ".zip").build();
}else{ } else {
// 单文件 // 单文件
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM) return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM).type("application/pdf")
.type("application/pdf") .header("Content-Disposition", "attachment;filename=" + requestTitle).build();
.header("Content-Disposition", "attachment;filename=" + requestTitle + ".pdf").build();
} }
} catch (Exception e) { } catch (Exception e) {
toolUtil.writeErrorLog("文件流转换失败," + e); toolUtil.writeErrorLog("文件流转换失败," + e);

View File

@ -1,19 +1,11 @@
package com.api.aiyh_pcn.fadada.web; package com.api.aiyh_pcn.fadada.web;
import aiyh.utils.ApiResult; import java.io.UnsupportedEncodingException;
import aiyh.utils.Util; import java.net.URLDecoder;
import aiyh.utils.mapUtil.ParaMap; import java.nio.charset.StandardCharsets;
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; import java.util.Base64;
import aiyh.utils.zwl.common.ToolUtil; import java.util.HashMap;
import com.alibaba.fastjson.JSON; import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
import com.api.aiyh_pcn.fadada.service.impl.FaDDServiceImpl;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.h2.util.StringUtils;
import weaver.conn.RecordSet;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -22,20 +14,28 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput; import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import org.h2.util.StringUtils;
import java.nio.charset.StandardCharsets;
import java.util.Base64; import com.alibaba.fastjson.JSON;
import java.util.HashMap; import com.alibaba.fastjson.JSONObject;
import java.util.Map; import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
import com.api.aiyh_pcn.fadada.service.impl.FaDDServiceImpl;
import aiyh.utils.ApiResult;
import aiyh.utils.Util;
import aiyh.utils.mapUtil.ParaMap;
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
import aiyh.utils.zwl.common.ToolUtil;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.conn.RecordSet;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
/** /**
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021/9/28 0028 16:05 * @create 2021/9/28 0028 16:05
*
*/ */
@Path("/fadada") @Path("/fadada")
public class FaDDController { public class FaDDController {
private final FaDDServiceImpl faDDService = new FaDDServiceImpl(); private final FaDDServiceImpl faDDService = new FaDDServiceImpl();
@ -45,7 +45,8 @@ public class FaDDController {
/** /**
* *
* *
* @param workflowId id * @param workflowId
* id
* @return * @return
*/ */
@GET @GET
@ -62,7 +63,8 @@ public class FaDDController {
/** /**
* *
* *
* @param params * @param params
*
* @return * @return
*/ */
@Path("/signature") @Path("/signature")
@ -81,8 +83,10 @@ public class FaDDController {
/** /**
* *
* *
* @param workflowId id * @param workflowId
* @param requestId id * id
* @param requestId
* id
* @return * @return
*/ */
@Path("/signedContract/{languageGroupId}/{requestId}/{workflowId}") @Path("/signedContract/{languageGroupId}/{requestId}/{workflowId}")
@ -94,7 +98,7 @@ public class FaDDController {
@PathParam("languageGroupId") int languageGroupId) { @PathParam("languageGroupId") int languageGroupId) {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
try { try {
faDDService.queryContractStatus(workflowId, requestId,0); faDDService.queryContractStatus(workflowId, requestId, 0);
Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage()); Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage());
String info = language.get("rushInfo"); String info = language.get("rushInfo");
return ApiResult.success(info); return ApiResult.success(info);
@ -107,8 +111,10 @@ public class FaDDController {
/** /**
* *
* *
* @param workflowId id * @param workflowId
* @param requestId id * id
* @param requestId
* id
* @return * @return
*/ */
@Path("/signedContract/own/{languageGroupId}/{requestId}/{workflowId}") @Path("/signedContract/own/{languageGroupId}/{requestId}/{workflowId}")
@ -122,9 +128,10 @@ public class FaDDController {
try { try {
faDDService.signedContractOwn(workflowId, requestId); faDDService.signedContractOwn(workflowId, requestId);
String mainTable = faDDServiceMapping.getMainTable(workflowId); String mainTable = faDDServiceMapping.getMainTable(workflowId);
// TODO 更新本方签署 // TODO 更新本方签署
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(mainTable, ParaMap.create() PrepSqlResultImpl sqlResult =
.put("signed_oneself", 1), Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId)); Util.createSqlBuilder().updateSql(mainTable, ParaMap.create().put("signed_oneself", 1),
Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId));
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage()); Map<String, String> language = Util.queryLanguage(languageGroupId, user.getLanguage());
@ -139,29 +146,31 @@ public class FaDDController {
/** /**
* *
* *
* @param requestId id * @param requestId
* id
* @return * @return
*/ */
@Path("/contract/download/{workflowId}/{requestId}") @Path("/contract/download/{workflowId}/{requestId}")
@GET @GET
@Produces(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response contractDownload(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) { public Response contractDownload(@PathParam("requestId") String requestId,
@PathParam("workflowId") String workflowId) {
toolUtil.writeErrorLog("进入请求方法获取到请求id" + requestId); toolUtil.writeErrorLog("进入请求方法获取到请求id" + requestId);
try { try {
StreamingOutput contractZipStream = faDDService.contractDownload(requestId, workflowId); StreamingOutput contractZipStream = faDDService.contractDownload(requestId, workflowId);
return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM) return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM).type("application/zip")
.type("application/zip")
.header("Content-Disposition", "attachment;filename=contracts.zip").build(); .header("Content-Disposition", "attachment;filename=contracts.zip").build();
} catch (Exception e) { } catch (Exception e) {
toolUtil.writeErrorLog("转换失败," + e.toString()); toolUtil.writeErrorLog("转换失败," + e.toString());
return Response.ok(ApiResult.error("出现错误,错误原因: " + e),MediaType.APPLICATION_JSON).build(); return Response.ok(ApiResult.error("出现错误,错误原因: " + e), MediaType.APPLICATION_JSON).build();
} }
} }
/** /**
* *
* *
* @param workflowId id * @param workflowId
* id
* @return id * @return id
*/ */
@Path("/getAllVersion/{workflowId}/{markOnly}") @Path("/getAllVersion/{workflowId}/{markOnly}")
@ -178,11 +187,11 @@ public class FaDDController {
} }
} }
/** /**
* *
* *
* @param requestId id * @param requestId
* id
* @return * @return
*/ */
@Path("/isAllSigned/{workflowId}/{requestId}") @Path("/isAllSigned/{workflowId}/{requestId}")
@ -191,11 +200,11 @@ public class FaDDController {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public String isAllSinged(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) { public String isAllSinged(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) {
try { try {
faDDService.queryContractStatus(workflowId,requestId,1); faDDService.queryContractStatus(workflowId, requestId, 1);
boolean isAllSinged = faDDService.isAllSinged(requestId, workflowId); boolean isAllSinged = faDDService.isAllSinged(requestId, workflowId);
boolean isSingedOneself = faDDService.isSingedOneself(requestId, workflowId); boolean isSingedOneself = faDDService.isSingedOneself(requestId, workflowId);
Map<String, Object> result = ParaMap.create().put("isAllSinged", isAllSinged) Map<String, Object> result =
.put("isSingedOneself", isSingedOneself); ParaMap.create().put("isAllSinged", isAllSinged).put("isSingedOneself", isSingedOneself);
return ApiResult.success(result); return ApiResult.success(result);
} catch (Exception e) { } catch (Exception e) {
toolUtil.writeErrorLog("错误:" + e); toolUtil.writeErrorLog("错误:" + e);
@ -203,7 +212,6 @@ public class FaDDController {
} }
} }
@Path("/getLanguage/{languageGroupId}") @Path("/getLanguage/{languageGroupId}")
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@ -218,20 +226,20 @@ public class FaDDController {
@POST @POST
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public String callBackSigned(@RequestBody Map<String, Object> params){ public String callBackSigned(@RequestBody Map<String, Object> params) {
toolUtil.writeErrorLog("回调方法:" + JSONObject.toJSONString(params)); toolUtil.writeErrorLog("回调方法:" + JSONObject.toJSONString(params));
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
String bizContent = String.valueOf(params.get("bizContent")); String bizContent = String.valueOf(params.get("bizContent"));
if(StringUtils.isNullOrEmpty(bizContent)){ if (StringUtils.isNullOrEmpty(bizContent)) {
toolUtil.writeErrorLog("参数没获取到!"); toolUtil.writeErrorLog("参数没获取到!");
result.put("code","200"); result.put("code", "200");
result.put("msg","操作失败!"); result.put("msg", "操作失败!");
return JSONObject.toJSONString(result); return JSONObject.toJSONString(result);
} }
byte[] decode = Base64.getDecoder().decode(bizContent.getBytes(StandardCharsets.UTF_8)); byte[] decode = Base64.getDecoder().decode(bizContent.getBytes(StandardCharsets.UTF_8));
String decodeStr = null; String decodeStr = null;
try { try {
decodeStr = new String(decode,"UTF-8"); decodeStr = new String(decode, "UTF-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -244,14 +252,14 @@ public class FaDDController {
JSONObject jsonObject = JSON.parseObject(jsonStr); JSONObject jsonObject = JSON.parseObject(jsonStr);
String resultCode = String.valueOf(jsonObject.getString("resultCode")); String resultCode = String.valueOf(jsonObject.getString("resultCode"));
String docNo = String.valueOf(jsonObject.getString("docNo")); String docNo = String.valueOf(jsonObject.getString("docNo"));
if(!"1".equals(resultCode)){ if (!"1".equals(resultCode)) {
toolUtil.writeErrorLog("重复签署合同!" + docNo); toolUtil.writeErrorLog("重复签署合同!" + docNo);
} }
// Util.createSqlBuilder().updateSql() // Util.createSqlBuilder().updateSql()
this.toolUtil.writeErrorLog(jsonObject.toJSONString()); this.toolUtil.writeErrorLog(jsonObject.toJSONString());
result.put("code","200"); result.put("code", "200");
result.put("msg","操作成功!"); result.put("msg", "操作成功!");
return JSONObject.toJSONString(result); return JSONObject.toJSONString(result);
} }
} }

View File

@ -1,49 +1,44 @@
package com.api.aiyh_pcn.patentWall.dao; package com.api.aiyh_pcn.patentWall.dao;
import java.util.List;
import java.util.Map;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.zwl.common.ToolUtil; import aiyh.utils.zwl.common.ToolUtil;
import com.api.aiyh_pcn.patentWall.dto.FilterWhere;
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021/11/25 0025 15:28 * @create 2021/11/25 0025 15:28
*/ */
public class PatentWallMapping { public class PatentWallMapping {
private final ToolUtil toolUtil = new ToolUtil(); private final ToolUtil toolUtil = new ToolUtil();
public List<Map<String, Object>> getAllList(String tableName){ public List<Map<String, Object>> getAllList(String tableName) {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String query = "select * from " + tableName; String query = "select * from " + tableName;
rs.executeQuery(query); rs.executeQuery(query);
return Util.recordSet2MapList(rs); return Util.recordSet2MapList(rs);
} }
public List<Map<String,Object>> getListByFilterWhere(StringBuilder whereBuilder,List<String> args, String tableName) { public List<Map<String, Object>> getListByFilterWhere(StringBuilder whereBuilder, List<String> args,
String tableName) {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String query = "select * from " + tableName + whereBuilder.toString().replace(" where add "," where "); String query = "select * from " + tableName + whereBuilder.toString().replace(" where add ", " where ");
rs.executeQuery(query,args); rs.executeQuery(query, args);
toolUtil.writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}",query,args)); toolUtil.writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}", query, args));
return Util.recordSet2MapList(rs); return Util.recordSet2MapList(rs);
} }
public List<Map<String,Object>> getSelectOptions(String dataResource, String dbFieldName) { public List<Map<String, Object>> getSelectOptions(String dataResource, String dbFieldName) {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String query = "select wbf.id,wbf.fieldname,wbf.fieldlabel,wb.tablename, " + String query = "select wbf.id,wbf.fieldname,wbf.fieldlabel,wb.tablename, " + "ws.selectname,ws.selectvalue "
"ws.selectname,ws.selectvalue " + + "from workflow_billfield wbf " + "left join workflow_bill wb on wbf.billid = wb.id "
"from workflow_billfield wbf " + + "left join workflow_selectitem ws on ws.fieldid = wbf.id " + "where wb.tablename = ? and fieldname = ? ";
"left join workflow_bill wb on wbf.billid = wb.id " + rs.executeQuery(query, dataResource, dbFieldName);
"left join workflow_selectitem ws on ws.fieldid = wbf.id " + toolUtil
"where wb.tablename = ? and fieldname = ? "; .writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}", query, dataResource + " -- " + dbFieldName));
rs.executeQuery(query,dataResource,dbFieldName);
toolUtil.writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}",query,dataResource + " -- " + dbFieldName));
return Util.recordSet2MapList(rs); return Util.recordSet2MapList(rs);
} }
} }

View File

@ -27,8 +27,6 @@ import java.util.regex.Pattern;
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021/11/25 0025 15:23 * @create 2021/11/25 0025 15:23
*/ */
public class PatentWallService { public class PatentWallService {
private final PatentWallMapping patentWallMapping = new PatentWallMapping(); private final PatentWallMapping patentWallMapping = new PatentWallMapping();
private final ToolUtil toolUtil = new ToolUtil(); private final ToolUtil toolUtil = new ToolUtil();
@ -36,17 +34,17 @@ public class PatentWallService {
private Map<String, Object> patentWallSearchConf; private Map<String, Object> patentWallSearchConf;
private final RecordSet rs = new RecordSet(); private final RecordSet rs = new RecordSet();
/** /**
* *
* *
* @param prefix * @param prefix
* @return * @return
*/ */
public List<SearchInputVO> getSearchList(String prefix,int languageId) { public List<SearchInputVO> getSearchList(String prefix, int languageId) {
Map<String, Object> patentWallSearchConf = getPatentWallSearchConf(prefix + ".search"); Map<String, Object> patentWallSearchConf = getPatentWallSearchConf(prefix + ".search");
String dataResource = String.valueOf(patentWallSearchConf.get("dataResource")); String dataResource = String.valueOf(patentWallSearchConf.get("dataResource"));
List<Map<String, Object>> inputs = (List<Map<String, Object>>) patentWallSearchConf.get("inputs"); List<Map<String, Object>> inputs =
(List<Map<String, Object>>) patentWallSearchConf.get("inputs");
List<SearchInputVO> searchInputList = new ArrayList<>(); List<SearchInputVO> searchInputList = new ArrayList<>();
for (Map<String, Object> input : inputs) { for (Map<String, Object> input : inputs) {
SearchInputVO searchInputVO = new SearchInputVO(); SearchInputVO searchInputVO = new SearchInputVO();
@ -54,9 +52,9 @@ public class PatentWallService {
String dbFieldName = Util.null2String(input.get("dbFieldName")); String dbFieldName = Util.null2String(input.get("dbFieldName"));
String value = Util.null2String(input.get("value")); String value = Util.null2String(input.get("value"));
String labelName = Util.null2String(input.get("labelName")); String labelName = Util.null2String(input.get("labelName"));
Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"),"0")); Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"), "0"));
Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"),"0")); Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"), "0"));
Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"),"false")); Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"), "false"));
searchInputVO.setType(type); searchInputVO.setType(type);
searchInputVO.setLabelName(labelName); searchInputVO.setLabelName(labelName);
searchInputVO.setSearchType(searchType); searchInputVO.setSearchType(searchType);
@ -68,25 +66,26 @@ public class PatentWallService {
searchInputList.add(searchInputVO); searchInputList.add(searchInputVO);
switch (type) { switch (type) {
case 1: case 1:
// 下拉框 查询options // 下拉框 查询options
List<SelectOptionsVo> optionsVos = getSelectOptions(dataResource, dbFieldName,languageId); List<SelectOptionsVo> optionsVos =
getSelectOptions(dataResource, dbFieldName, languageId);
searchInputVO.setSelectOptions(optionsVos); searchInputVO.setSelectOptions(optionsVos);
case 2: case 2:
// 单行文本 // 单行文本
break; break;
case 3: case 3:
// 日期 // 日期
case 4: case 4:
// 单人力资源 // 单人力资源
break; break;
case 5: case 5:
// 多人力资源 // 多人力资源
break; break;
case 6: case 6:
// 流程路径 // 流程路径
break; break;
case 7: case 7:
// 多流程路径 // 多流程路径
break; break;
default: default:
toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!"); toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!");
@ -96,8 +95,10 @@ public class PatentWallService {
return searchInputList; return searchInputList;
} }
private List<SelectOptionsVo> getSelectOptions(String dataResource, String dbFieldName, int languageId) { private List<SelectOptionsVo> getSelectOptions(
List<Map<String, Object>> selectOptions = patentWallMapping.getSelectOptions(dataResource, dbFieldName); String dataResource, String dbFieldName, int languageId) {
List<Map<String, Object>> selectOptions =
patentWallMapping.getSelectOptions(dataResource, dbFieldName);
List<SelectOptionsVo> optionsVos = new ArrayList<>(); List<SelectOptionsVo> optionsVos = new ArrayList<>();
SelectOptionsVo optionsDefault = new SelectOptionsVo(); SelectOptionsVo optionsDefault = new SelectOptionsVo();
optionsDefault.setSelected(true); optionsDefault.setSelected(true);
@ -107,7 +108,7 @@ public class PatentWallService {
for (Map<String, Object> selectOption : selectOptions) { for (Map<String, Object> selectOption : selectOptions) {
SelectOptionsVo optionsVo = new SelectOptionsVo(); SelectOptionsVo optionsVo = new SelectOptionsVo();
optionsVo.setSelected(false); optionsVo.setSelected(false);
optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"),"")); optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"), ""));
String selectName = Util.null2DefaultStr(selectOption.get("selectname"), ""); String selectName = Util.null2DefaultStr(selectOption.get("selectname"), "");
String showName = selectName; String showName = selectName;
if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) { if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) {
@ -136,12 +137,12 @@ public class PatentWallService {
List<Map<String, Object>> dataList; List<Map<String, Object>> dataList;
toolUtil.writeDebuggerLog(String.format("查询数据,接收到的过滤信息为: %s", JSON.toJSONString(filterWheres))); toolUtil.writeDebuggerLog(String.format("查询数据,接收到的过滤信息为: %s", JSON.toJSONString(filterWheres)));
if (filterWheres == null || filterWheres.isEmpty()) { if (filterWheres == null || filterWheres.isEmpty()) {
// 查询全部 // 查询全部
dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource"))); dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource")));
} else { } else {
// 筛选查询 // 筛选查询
dataList = handleFilterWhere(filterWheres dataList =
, Util.null2String(patentWallConf.get("dataResource"))); handleFilterWhere(filterWheres, Util.null2String(patentWallConf.get("dataResource")));
} }
List<PatentVO> list = new ArrayList<>(); List<PatentVO> list = new ArrayList<>();
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
@ -150,12 +151,12 @@ public class PatentWallService {
Map<String, Object> config = new HashMap<>(patentWallConf); Map<String, Object> config = new HashMap<>(patentWallConf);
for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) { for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) {
String patentVoField = entry.getKey(); String patentVoField = entry.getKey();
// linkList // linkList
String parsing = null; String parsing = null;
// 值解析 // 值解析
if("linkList".equals(patentVoField)){ if ("linkList".equals(patentVoField)) {
List<LinkUrlVO> linkUrlVOS = new ArrayList<>(); List<LinkUrlVO> linkUrlVOS = new ArrayList<>();
List<Map<String,Object>> linkUrlList = (List<Map<String, Object>>) entry.getValue(); List<Map<String, Object>> linkUrlList = (List<Map<String, Object>>) entry.getValue();
for (Map<String, Object> linkUrlMap : linkUrlList) { for (Map<String, Object> linkUrlMap : linkUrlList) {
LinkUrlVO linkUrlVO = new LinkUrlVO(); LinkUrlVO linkUrlVO = new LinkUrlVO();
BeanInfo beanInfo = null; BeanInfo beanInfo = null;
@ -170,19 +171,21 @@ public class PatentWallService {
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
String keyName = propertyDescriptor.getName(); String keyName = propertyDescriptor.getName();
String parsingValue = String.valueOf(linkUrlMap.get(keyName)); String parsingValue = String.valueOf(linkUrlMap.get(keyName));
parsingValue = handleParsingConf(parsingValue,data,args); parsingValue = handleParsingConf(parsingValue, data, args);
// 清除参数信息 // 清除参数信息
args.clear(); args.clear();
if(propertyDescriptor.getPropertyType().equals(Integer.class)){ if (propertyDescriptor.getPropertyType().equals(Integer.class)) {
try { try {
propertyDescriptor.getWriteMethod().invoke(linkUrlVO,Integer.valueOf(parsingValue)); propertyDescriptor
.getWriteMethod()
.invoke(linkUrlVO, Integer.valueOf(parsingValue));
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误"); toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误");
e.printStackTrace(); e.printStackTrace();
} }
}else { } else {
try { try {
propertyDescriptor.getWriteMethod().invoke(linkUrlVO,parsingValue); propertyDescriptor.getWriteMethod().invoke(linkUrlVO, parsingValue);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace(); e.printStackTrace();
toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误"); toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误");
@ -192,15 +195,14 @@ public class PatentWallService {
linkUrlVOS.add(linkUrlVO); linkUrlVOS.add(linkUrlVO);
} }
config.replace(patentVoField, linkUrlVOS); config.replace(patentVoField, linkUrlVOS);
}else{ } else {
parsing = String.valueOf(entry.getValue()); parsing = String.valueOf(entry.getValue());
parsing = handleParsingConf(parsing,data,args); parsing = handleParsingConf(parsing, data, args);
// 修改数据 // 修改数据
config.replace(patentVoField, parsing); config.replace(patentVoField, parsing);
// 清除参数信息 // 清除参数信息
args.clear(); args.clear();
} }
} }
PatentVO patentVO = null; PatentVO patentVO = null;
try { try {
@ -214,16 +216,16 @@ public class PatentWallService {
return list; return list;
} }
public String handleParsingConf(String parsing, Map<String, Object> data,List<String> args){ public String handleParsingConf(String parsing, Map<String, Object> data, List<String> args) {
// 值解析 // 值解析
// 解析 ${}类型的参数,直接替换 // 解析 ${}类型的参数,直接替换
String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}"; String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}";
Pattern compile = Pattern.compile(pattern); Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(parsing); Matcher matcher = compile.matcher(parsing);
while (matcher.find()) { while (matcher.find()) {
parsing = parsing.replaceFirst(pattern, Util.null2String(data.get(matcher.group("field")))); parsing = parsing.replaceFirst(pattern, Util.null2String(data.get(matcher.group("field"))));
} }
// 解析#{}类型的参数,替换为?并按照顺序收集args // 解析#{}类型的参数,替换为?并按照顺序收集args
pattern = "#\\{(?<field>(\\s|\\S)+?)}"; pattern = "#\\{(?<field>(\\s|\\S)+?)}";
compile = Pattern.compile(pattern); compile = Pattern.compile(pattern);
matcher = compile.matcher(parsing); matcher = compile.matcher(parsing);
@ -231,7 +233,7 @@ public class PatentWallService {
parsing = parsing.replaceFirst(pattern, "?"); parsing = parsing.replaceFirst(pattern, "?");
args.add(Util.null2String(data.get(matcher.group("field")))); args.add(Util.null2String(data.get(matcher.group("field"))));
} }
// 解析#sql{}类型的参数并执行SQL获取到SQL的值 // 解析#sql{}类型的参数并执行SQL获取到SQL的值
pattern = "#sql\\{(?<sqlStr>([\\s\\S])+?)}"; pattern = "#sql\\{(?<sqlStr>([\\s\\S])+?)}";
compile = Pattern.compile(pattern); compile = Pattern.compile(pattern);
matcher = compile.matcher(parsing); matcher = compile.matcher(parsing);
@ -240,49 +242,49 @@ public class PatentWallService {
toolUtil.writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}", sqlStr, args)); toolUtil.writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}", sqlStr, args));
rs.executeQuery(sqlStr, args); rs.executeQuery(sqlStr, args);
rs.next(); rs.next();
parsing = parsing.replaceFirst(pattern, Util.null2String(rs.getString(1)));; parsing = parsing.replaceFirst(pattern, Util.null2String(rs.getString(1)));
;
} }
return parsing; return parsing;
} }
public List<Map<String, Object>> handleFilterWhere(
public List<Map<String, Object>> handleFilterWhere(List<FilterWhere> filterWheres, String tableName) { List<FilterWhere> filterWheres, String tableName) {
StringBuilder whereBuilder = new StringBuilder(" where "); StringBuilder whereBuilder = new StringBuilder(" where ");
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
for (FilterWhere filterWhere : filterWheres) { for (FilterWhere filterWhere : filterWheres) {
whereBuilder.append(" add "); whereBuilder.append(" add ");
if (filterWhere.getSearchType() == 1) { if (filterWhere.getSearchType() == 1) {
// 等于 // 等于
whereBuilder.append(filterWhere.getDbField()) whereBuilder.append(filterWhere.getDbField()).append(" = ? ");
.append(" = ? ");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 2) { if (filterWhere.getSearchType() == 2) {
// 大于 // 大于
whereBuilder.append(filterWhere.getDbField()) whereBuilder.append(filterWhere.getDbField()).append(" > ?");
.append(" > ?");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 3) { if (filterWhere.getSearchType() == 3) {
// 小于 // 小于
whereBuilder.append(filterWhere.getDbField()) whereBuilder.append(filterWhere.getDbField()).append(" < ?");
.append(" < ?");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 4) { if (filterWhere.getSearchType() == 4) {
// in // in
whereBuilder.append(filterWhere.getDbField()) whereBuilder
.append(filterWhere.getDbField())
.append(" in ( ") .append(" in ( ")
.append(filterWhere.getValue()) .append(filterWhere.getValue())
.append(") "); .append(") ");
continue; continue;
} }
if (filterWhere.getSearchType() == 5) { if (filterWhere.getSearchType() == 5) {
// 日期大于 // 日期大于
whereBuilder.append(" DATE_FORMAT(") whereBuilder
.append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') > ") .append(",'%y-%m-%d') > ")
.append("DATE_FORMAT(?,'%y-%m-%d')"); .append("DATE_FORMAT(?,'%y-%m-%d')");
@ -290,8 +292,9 @@ public class PatentWallService {
continue; continue;
} }
if (filterWhere.getSearchType() == 6) { if (filterWhere.getSearchType() == 6) {
// 日期小于 // 日期小于
whereBuilder.append(" DATE_FORMAT(") whereBuilder
.append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') < ") .append(",'%y-%m-%d') < ")
.append("DATE_FORMAT(?,'%y-%m-%d')"); .append("DATE_FORMAT(?,'%y-%m-%d')");
@ -299,8 +302,9 @@ public class PatentWallService {
continue; continue;
} }
if (filterWhere.getSearchType() == 7) { if (filterWhere.getSearchType() == 7) {
// 日期等于 // 日期等于
whereBuilder.append(" DATE_FORMAT(") whereBuilder
.append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') = ") .append(",'%y-%m-%d') = ")
.append("DATE_FORMAT(?,'%y-%m-%d')"); .append("DATE_FORMAT(?,'%y-%m-%d')");
@ -308,8 +312,9 @@ public class PatentWallService {
continue; continue;
} }
if (filterWhere.getSearchType() == 8) { if (filterWhere.getSearchType() == 8) {
// 日期范围 // 日期范围
whereBuilder.append(" DATE_FORMAT(") whereBuilder
.append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') between ") .append(",'%y-%m-%d') between ")
.append("DATE_FORMAT(?,'%y-%m-%d')") .append("DATE_FORMAT(?,'%y-%m-%d')")
@ -363,5 +368,4 @@ public class PatentWallService {
public void clearPatentWallSerachConf() { public void clearPatentWallSerachConf() {
this.patentWallSearchConf = null; this.patentWallSearchConf = null;
} }
} }

View File

@ -32,7 +32,11 @@ import java.util.concurrent.atomic.AtomicReference;
/** /**
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021-08-05 09:33 * @create 2021-08-05 09:33
* * <p>
*
* 西
* 使
* <p/>
*/ */
public class AddCustomer_Action extends ToolUtil implements Action { public class AddCustomer_Action extends ToolUtil implements Action {
//当前类名称 //当前类名称
@ -119,6 +123,8 @@ public class AddCustomer_Action extends ToolUtil implements Action {
} catch (Exception e) { } catch (Exception e) {
this.writeDebuggerLog("insert customer error!"); this.writeDebuggerLog("insert customer error!");
this.writeDebuggerLog(e + "\n"); this.writeDebuggerLog(e + "\n");
this.request.getRequestManager().setMessagecontent("生成外部用户错误,请联系管理员!");
this.request.getRequestManager().setMessageid("2");
} finally { } finally {
this.writeDebuggerLog(className, "------------" + className + " End -----------------"); this.writeDebuggerLog(className, "------------" + className + " End -----------------");
} }
@ -459,11 +465,11 @@ public class AddCustomer_Action extends ToolUtil implements Action {
CrmCommonUtil crmCommonUtil = new CrmCommonUtil(); CrmCommonUtil crmCommonUtil = new CrmCommonUtil();
mapList.forEach(item -> { mapList.forEach(item -> {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String hrmid; // String hrmid;
// 获取人员id //// 获取人员id
rs.executeProc("HrmResourceMaxId_Get", ""); // rs.executeProc("HrmResourceMaxId_Get", "");
rs.next(); // rs.next();
hrmid = rs.getString(1); // hrmid = rs.getString(1);
// 整理数据 // 整理数据
item.put("createdate", Utils.getTime("yyyy-MM-dd")); item.put("createdate", Utils.getTime("yyyy-MM-dd"));
// item.put("id", hrmid); // item.put("id", hrmid);
@ -539,7 +545,7 @@ public class AddCustomer_Action extends ToolUtil implements Action {
param.put("seclevel", Util.null2String(item.get("seclevel"))); param.put("seclevel", Util.null2String(item.get("seclevel")));
param.put("mobile", Util.null2String(item.get("mobile"))); param.put("mobile", Util.null2String(item.get("mobile")));
param.put("email", Util.null2String(item.get("email"))); param.put("email", Util.null2String(item.get("email")));
param.put("isoutmanager", Util.null2s(Util.null2String(item.get("isoutmanager")),"1")); param.put("isoutmanager", Util.null2s(Util.null2String(item.get("isoutmanager")), "1"));
param.put("wxname", Util.null2String(item.get("wxname"))); param.put("wxname", Util.null2String(item.get("wxname")));
param.put("wxopenid", Util.null2String(item.get("wxopenid"))); param.put("wxopenid", Util.null2String(item.get("wxopenid")));
param.put("wxuuid", Util.null2String(item.get("wxuuid"))); param.put("wxuuid", Util.null2String(item.get("wxuuid")));
@ -549,6 +555,10 @@ public class AddCustomer_Action extends ToolUtil implements Action {
param.put("customfrom", Util.null2String(item.get("customfrom"))); param.put("customfrom", Util.null2String(item.get("customfrom")));
Map<String, String> returnObj = hrmOutInterface.createResource4Card(param); Map<String, String> returnObj = hrmOutInterface.createResource4Card(param);
String resourceid = returnObj.get("resourceid"); String resourceid = returnObj.get("resourceid");
String errorinfo = returnObj.get("errorinfo");
if (!"".equals(errorinfo)) {
throw new RuntimeException(errorinfo);
}
String sql = "INSERT INTO CRM_ShareInfo (relateditemid, sharetype, seclevel, sharelevel, crmid, contents, deleted, seclevelMax, jobtitleid, joblevel, scopeid) VALUES (?, '1', '10','1','0',?, '0', '100', ?, '0', ',0,')"; String sql = "INSERT INTO CRM_ShareInfo (relateditemid, sharetype, seclevel, sharelevel, crmid, contents, deleted, seclevelMax, jobtitleid, joblevel, scopeid) VALUES (?, '1', '10','1','0',?, '0', '100', ?, '0', ',0,')";
rs.executeUpdate(sql, customer.get("customerId"), resourceid, resourceid); rs.executeUpdate(sql, customer.get("customerId"), resourceid, resourceid);
this.resourceid = resourceid; this.resourceid = resourceid;