保密协议集成法大大适配

dev
IT-xiaoXiong 2021-12-02 10:51:11 +08:00
parent b9dac47eb9
commit 1d57854bdb
9 changed files with 184 additions and 47 deletions

View File

@ -30,16 +30,24 @@ public class FaDDContractMapping {
*/
public FaDaDaConfigDTO queryConfig(String workflowId, int type) {
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId);
String query = "select main.id,main.workflow_type,main.api_type, main.params_config, " +
String query = "select main.id,main.workflow_type,main.api_type, main.params_config," +
"main.signed_type,wf2.fieldname field_control1," +
"wf.fieldname field_control, wf1.fieldname contract_doc, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.only_own)) only_own, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.only_other)) only_other, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.both_all)) both_all, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.check_personal)) check_personal, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " +
"where FIND_IN_SET(id,main.check_enterprise)) check_enterprise," +
"main.check_source_type,wdt.tablename check_source " +
"from uf_contract_config main " +
"left join workflow_field_table_view wf on wf.id = main.field_control " +
"left join workflow_field_table_view wf1 on wf1.id = main.contract_doc " +
"left join workflow_field_table_view wf2 on wf2.id = main.field_control1 " +
"left join workflow_detail_table_view wdt on wdt.id = main.check_source and " +
"wdt.workflow_id = main.workflow_type " +
"where main.workflow_type in ( " + versionStringByWfid + ") and api_type = ?";
@ -68,9 +76,9 @@ public class FaDDContractMapping {
* @param markOnly
* @return
*/
public String getNodes(String versionStringByWfid, String markOnly) {
String query = "select workflow_nodes from uf_node_config where workflow_type in (" + versionStringByWfid + ") and mark_only = ?";
rs.executeQuery(query, markOnly);
public String getNodes(String versionStringByWfid) {
String query = "select workflow_nodes from uf_node_config where workflow_type in (" + versionStringByWfid + ") and enable_nodes = ?";
rs.executeQuery(query, 1);
rs.next();
return rs.getString(1);
}

View File

@ -12,6 +12,12 @@ public class FaDaDaConfigDTO {
private int checkSourceType;
private String checkSource;
private String contractDoc;
private int signedType;
private String fieldControl1;
private int onlyOwn;
private int onlyOther;
private int bothAll;
public void setId(int id){
this.id = id;
@ -77,6 +83,46 @@ public class FaDaDaConfigDTO {
this.contractDoc = contractDoc;
}
public int getSignedType() {
return signedType;
}
public void setSignedType(int signedType) {
this.signedType = signedType;
}
public String getFieldControl1() {
return fieldControl1;
}
public void setFieldControl1(String fieldControl1) {
this.fieldControl1 = fieldControl1;
}
public int getOnlyOwn() {
return onlyOwn;
}
public void setOnlyOwn(int onlyOwn) {
this.onlyOwn = onlyOwn;
}
public int getOnlyOther() {
return onlyOther;
}
public void setOnlyOther(int onlyOther) {
this.onlyOther = onlyOther;
}
public int getBothAll() {
return bothAll;
}
public void setBothAll(int bothAll) {
this.bothAll = bothAll;
}
@Override
public String toString() {
return "FaDaDaConfigDTO{" +
@ -88,6 +134,11 @@ public class FaDaDaConfigDTO {
", checkSourceType=" + checkSourceType +
", checkSource='" + checkSource + '\'' +
", contractDoc='" + contractDoc + '\'' +
", signedType=" + signedType +
", fieldControl1='" + fieldControl1 + '\'' +
", onlyOwn=" + onlyOwn +
", onlyOther=" + onlyOther +
", bothAll=" + bothAll +
'}';
}
}

View File

@ -21,6 +21,7 @@ public class UfContractInfoDTO {
private int singleSignedNum;
private String workflowRequestId;
private String workflowDetailTable;
private String signedType;
private int mainId;
public void setId(int id){
@ -167,27 +168,36 @@ public class UfContractInfoDTO {
return this.mainId;
}
public String getSignedType() {
return signedType;
}
public void setSignedType(String signedType) {
this.signedType = signedType;
}
@Override
public String toString() {
return "UfContractInfoDTO{" +
"id='" + id + '\'' +
", requestId='" + requestId + '\'' +
", workflowType='" + workflowType + '\'' +
"id=" + id +
", requestId=" + requestId +
", workflowType=" + workflowType +
", contractNo='" + contractNo + '\'' +
", fileNo='" + fileNo + '\'' +
", fileName='" + fileName + '\'' +
", signedNum='" + signedNum + '\'' +
", shouldSignedNum='" + shouldSignedNum + '\'' +
", contractStatus='" + contractStatus + '\'' +
", signedNum=" + signedNum +
", shouldSignedNum=" + shouldSignedNum +
", contractStatus=" + contractStatus +
", contractViewUrl='" + contractViewUrl + '\'' +
", contractDownUrl='" + contractDownUrl + '\'' +
", workflowMainTable='" + workflowMainTable + '\'' +
", queueSigned='" + queueSigned + '\'' +
", singleContractFileNum='" + singleContractFileNum + '\'' +
", singleSignedNum='" + singleSignedNum + '\'' +
", queueSigned=" + queueSigned +
", singleContractFileNum=" + singleContractFileNum +
", singleSignedNum=" + singleSignedNum +
", workflowRequestId='" + workflowRequestId + '\'' +
", workflowDetailTable='" + workflowDetailTable + '\'' +
", mainId='" + mainId + '\'' +
", signedType='" + signedType + '\'' +
", mainId=" + mainId +
'}';
}
}

View File

@ -52,10 +52,9 @@ public class FaDDContractService {
* idid
*
* @param workflowId
* @param markOnly
* @return
*/
public Map<String, Object> getAllVersion(String workflowId, String markOnly) {
public Map<String, Object> getAllVersion(String workflowId) {
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId);
String newWorkflowId = faDDContractMapping.getAllVersion(versionStringByWfid);
String allVersion = WorkflowVersion.getVersionStringByWfid(newWorkflowId);
@ -64,7 +63,7 @@ public class FaDDContractService {
}
String[] split = allVersion.split(",");
Map<String, Object> data = new HashMap<>();
String[] nodes = this.getNodes(workflowId, markOnly);
String[] nodes = this.getNodes(workflowId);
data.put("workflowIds", split);
data.put("nodeIds", nodes);
return data;
@ -74,12 +73,11 @@ public class FaDDContractService {
* id
*
* @param workflowId
* @param markOnly
* @return
*/
public String[] getNodes(String workflowId, String markOnly) {
public String[] getNodes(String workflowId) {
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId);
String nods = faDDContractMapping.getNodes(versionStringByWfid, markOnly);
String nods = faDDContractMapping.getNodes(versionStringByWfid);
if (nods == null) {
nods = "";
}
@ -321,6 +319,10 @@ public class FaDDContractService {
// 如果合同已签数量和应签数量相同,则状态为本方待签
if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum()) {
update.put("contract_status", 3);
// 判断是否控制签署规则 1-仅本方签署2-仅对方签署3-都签署
if("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){
update.put("contract_status", 4);
}
}
} else {
// 全部合同一起发送的签署信息
@ -329,8 +331,13 @@ public class FaDDContractService {
// 如果已签文件数等于需要签署的合同数乘以合同文件数相等,则代表对方已经签署完毕
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);
}
}
}
// 更新状态
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("uf_contract_info", update,
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId()));
@ -378,6 +385,14 @@ public class FaDDContractService {
RecordSet rs = new RecordSet();
rs.executeQuery(query, ufContractInfoDTO.getMainId());
List<Map<String, Object>> detailMaps = Util.recordSet2MapList(rs);
query = "select * from " + ufContractInfoDTO.getWorkflowMainTable() + " where requestid = ?";
RecordSet rs1 = new RecordSet();
rs1.executeQuery(query,ufContractInfoDTO.getRequestId());
Map<String, Object> mainMap = Util.recordSet2Map(rs1);
if(mainMap == null){
toolUtil.writeErrorLog("mainMap 查询到null -------> " + JSON.toJSONString(ufContractInfoDTO));
throw new RuntimeException("mainMap查询到null!");
}
// 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 3);
// 查询接口配置树形结构
@ -397,6 +412,15 @@ public class FaDDContractService {
}
Map<String, Object> updateData = new HashMap<>();
Map<String, Object> map = maps.get(0);
// 如果进行控制签署规则
if(faDaDaConfigDTO.getSignedType() == 1){
if(Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()){
// 仅对方签署
if(maps.size() == 1){
map.put("signType",2);
}
}
}
signedRequest(map, apiConfigMainDTO);
// 将合同签署信息更新到合同信息表中
updateData.put("single_signed_num", 0);

View File

@ -16,9 +16,6 @@ import org.h2.util.StringUtils;
import weaver.aiyh_pcn.fadada.entity.FileInfo;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@ -42,19 +39,20 @@ public class FaDDRequestUtils {
static {
String appId = TOOL_UTIL.getSystemParamValue("FDD_appId");
if(StringUtils.isNullOrEmpty(appId)){
if (StringUtils.isNullOrEmpty(appId)) {
appId = "100001";
TOOL_UTIL.writeErrorLog("查询到的FDD_appId为空");
}
header.put("appId", appId);
header.put("signType", "SHA256");
String apiKey = TOOL_UTIL.getSystemParamValue("FDD_apiKey");
if(StringUtils.isNullOrEmpty(apiKey)){
if (StringUtils.isNullOrEmpty(apiKey)) {
apiKey = "TulQxnZSRKeHoQfmeZzOUzGn6KpTDkDK";
TOOL_UTIL.writeErrorLog("查询到的FDD_apiKey为空");
}
header.put("apikey", apiKey);
header.put("Content-Type", HttpArgsType.APPLICATION_JSON);
TOOL_UTIL.writeErrorLog(JSONObject.toJSONString(header));
}
// 查询企业认证状态
@ -78,7 +76,7 @@ public class FaDDRequestUtils {
// 创建合同
public static ResponeVo createContract(FileInfo fileInfo,String url) {
public static ResponeVo createContract(FileInfo fileInfo, String url) {
Map<String, Object> data = new HashMap<>();
data.put("contractExtension", fileInfo.getContractExtension());
data.put("contractTitle", fileInfo.getContractTitle());
@ -121,7 +119,7 @@ public class FaDDRequestUtils {
return responeVo;
}
public static void downContract(Map<String, Object> data, Consumer<CloseableHttpResponse> consumer,String url) {
public static void downContract(Map<String, Object> data, Consumer<CloseableHttpResponse> consumer, String url) {
header.put("sign", builderSign(data));
header.put("Content-Type", "application/json");
System.out.println(JSONObject.toJSONString(data));
@ -174,7 +172,7 @@ public class FaDDRequestUtils {
"&timestamp=" + header.get("timestamp");
// System.out.println(signStr);
String appKey = TOOL_UTIL.getSystemParamValue("FDD_appKey");
if(StringUtils.isNullOrEmpty(appKey)){
if (StringUtils.isNullOrEmpty(appKey)) {
TOOL_UTIL.writeErrorLog("查询到的FDD_appKey为空");
appKey = "L7P59oqA2An0XgJ1LeMN0fRu1";
}
@ -190,7 +188,7 @@ public class FaDDRequestUtils {
public static String builderBizContent(Map<String, Object> data) {
String jsonString = JSONUtil.toJsonStr(data);
TOOL_UTIL.writeDebuggerLog("bizContent进行JSON编码" + jsonString);
String encode = null;
String encode;
// encode = URLEncoder.encode(jsonString, "UTF-8");
encode = URLUtil.encodeAll(jsonString, StandardCharsets.UTF_8);
TOOL_UTIL.writeDebuggerLog("bizContent进行JSON编码后URLEncoder编码" + encode);

View File

@ -48,7 +48,7 @@ public class FaDDContractController {
@Consumes(MediaType.APPLICATION_JSON)
public String getAllVersion(@PathParam("workflowId") String workflowId, @PathParam("markOnly") String markOnly) {
try {
Map<String, Object> allVersion = faDDService.getAllVersion(workflowId, markOnly);
Map<String, Object> allVersion = faDDService.getAllVersion(workflowId);
return ApiResult.success(allVersion);
} catch (Exception e) {
toolUtil.writeErrorLog("错误:" + e.toString());

View File

@ -2,6 +2,7 @@ package customization.test;
import aiyh.utils.Util;
import aiyh.utils.fileUtil.ProperUtil;
import cn.hutool.core.util.URLUtil;
import com.alibaba.fastjson.JSON;
import com.api.aiyh_pcn.patentWall.service.PatentWallService;
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
@ -13,6 +14,8 @@ import weaver.common.util.string.StringUtil;
import weaver.general.GCONST;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -265,7 +268,7 @@ public class NewUtilTest {
}
public Object prop2MapPutValue(Object value) {
if(value == null){
if (value == null) {
return null;
}
String valueStr = String.valueOf(value).trim();
@ -291,24 +294,24 @@ public class NewUtilTest {
System.out.println(Arrays.toString(data));
String[] split = str.split("(?<!\\\\),");
System.out.println(Arrays.toString(split));
for (int i = 0; i < split.length; i ++){
split[i] = split[i].replaceAll("\\\\,",",");
for (int i = 0; i < split.length; i++) {
split[i] = split[i].replaceAll("\\\\,", ",");
}
for (String s : split){
for (String s : split) {
System.out.println(s);
}
}
@Test
public void testLanguage(){
public void testLanguage() {
String selectName = "~`~`7 其它 不知道 管他呢,阿斯顿发的`~`8 other`~`9 其它`~`~";
String showName = selectName;
if(selectName.startsWith("~`~`") && selectName.endsWith("`~`~")){
if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) {
String pattern = "(`~`7 )(?<lable>(\\w*|\\W*|[\\u4e00-\\u9fa5]*))(`~`)";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(selectName);
if(matcher.find()){
if (matcher.find()) {
showName = matcher.group("lable");
}
}
@ -316,7 +319,7 @@ public class NewUtilTest {
}
@Test
public void testPatentServer(){
public void testPatentServer() {
PatentWallService patentWallService = new PatentWallService();
List<SearchInputVO> inputList = patentWallService.getSearchList("patentWall", 8);
System.out.println(JSON.toJSONString(inputList));
@ -325,12 +328,19 @@ public class NewUtilTest {
}
@Test
public void testRegx(){
public void testRegx() {
String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher("${id}");
if (matcher.find()){
if (matcher.find()) {
System.out.println(matcher.group("field"));
}
}
@Test
public void test() {
String bizContent = "{\"contractExtension\":\".pdf\",\"contractTitle\":\"PCN Template - Non-Disclosure Agreement (Corporate).pdf\",\"uploadType\":1,\"customerNo\":\"ecef845ba95a409393cb66271a41b0a6\"}";
System.out.println(cn.hutool.core.util.URLUtil.encodeAll(bizContent, Charset.forName("UTF-8")));
}
}

View File

@ -31,7 +31,7 @@ public class FaDDContractAction extends ToolUtil implements Action {
private String customerNo;
// 是否是顺序签订
private String queueSigned;
// 签订字段
// 签订字段,用于是否电子签
private String signedField;
// 签订值
private String signedValue;
@ -69,7 +69,7 @@ public class FaDDContractAction extends ToolUtil implements Action {
FaddContractUtil faddContractUtil = new FaddContractUtil(workflowId, requestId, mainTableName, tableName,
customerNo, customerNoField, contractField, queueSigned, detailMaps, mainMap);
try {
faddContractUtil.createContract();
faddContractUtil.createContract(mainMap);
} catch (Exception e) {
toolUtil.writeErrorLog("合同创建失败,失败原因:" + e);
// TODO 更换labelIndex
@ -77,6 +77,21 @@ public class FaDDContractAction extends ToolUtil implements Action {
requestInfo.getRequestManager().setMessageid("1");
return Action.FAILURE_AND_CONTINUE;
}
if(faDaDaConfigDTO.getSignedType() == 1){
// 需要控制签署规则
if(Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOwn()){
// 只需要本方签署
return Action.SUCCESS;
}
/*
if(Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()){
// 只需要对方签署
}
// 双方签署
*/
}
try {
faddContractUtil.signedContract();
} catch (Exception e) {

View File

@ -68,7 +68,7 @@ public class FaddContractUtil {
/**
*
*/
public void createContract() {
public void createContract(Map<String, Object> mainMap) {
// 查询配置参数
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 2);
// 查询api配置参数
@ -123,11 +123,32 @@ public class FaddContractUtil {
updateMap.put("workflow_detail_table",tableName);
// 1表示创建 2表示等待对方签署3表示等待本方签署4表示完成
updateMap.put("contract_status",1);
// 对方应该签署的数量
updateMap.put("should_signed_num",detailMaps.size());
// 现在已经签署的数量
updateMap.put("signed_num",0);
updateMap.put("signed_type",3);
updateMap.put("main_id",String.valueOf(mainMap.get("id")));
updateMap.put("queue_signed","true".equals(queueSigned) ? 1 : 0);
updateMap.put("single_contract_file_num",contractNoIds.size());
// 如果需要控制签署规则
if (faDaDaConfigDTO.getSignedType() == 1) {
// 需要控制签署规则
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOwn()) {
// 只需要本方签署
updateMap.put("contract_status",3);
// 对方应该签署的数量
updateMap.put("should_signed_num",0);
// 现在已经签署的数量
updateMap.put("signed_num",0);
updateMap.put("queue_signed",0);
updateMap.put("signed_type",1);
}
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) {
updateMap.put("signed_type",2);
}
}
// 查询合同信息中,是否存在该信息,如果存在着更新,不存在则插入
String query = "select * from " + contractInfoTable + " where workflow_request_id = ?";
rs.executeQuery(query,requestId);
@ -222,7 +243,7 @@ public class FaddContractUtil {
signedRequest(map,apiConfigMainDTO);
// 将合同签署信息更新到合同信息表中
update.put("contract_status",2);
update.put("single_signed_num",0);
// update.put("single_signed_num",0);
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs());
@ -235,9 +256,9 @@ public class FaddContractUtil {
rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs());
return;
}
// 不是顺序签署
for (Map<String, Object> map : maps) {
signedRequest(map,apiConfigMainDTO);
}
// 将合同签署信息更新到合同信息表中
update.put("contract_status",2);
@ -255,7 +276,7 @@ public class FaddContractUtil {
private void signedRequest(Map<String, Object> map, ApiConfigMainDTO apiConfigMainDTO){
String contractNos = Util.null2String(map.get("contractNo"));
String[] split = contractNos.split(",");
RecordSet rs = new RecordSet();
// RecordSet rs = new RecordSet();
for (String s : split) {
map.put("contractNo", s);
ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl());