保密协议签署完成,保密协议附件添加和删除
parent
cad7706a17
commit
86e95aad7b
|
@ -22,6 +22,7 @@ public class UfContractInfoDTO {
|
|||
private String workflowRequestId;
|
||||
private String workflowDetailTable;
|
||||
private String signedType;
|
||||
private String userInfo;
|
||||
private int mainId;
|
||||
|
||||
public void setId(int id) {
|
||||
|
@ -176,6 +177,14 @@ public class UfContractInfoDTO {
|
|||
this.signedType = signedType;
|
||||
}
|
||||
|
||||
public String getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public void setUserInfo(String userInfo) {
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UfContractInfoDTO{" +
|
||||
|
@ -197,6 +206,7 @@ public class UfContractInfoDTO {
|
|||
", workflowRequestId='" + workflowRequestId + '\'' +
|
||||
", workflowDetailTable='" + workflowDetailTable + '\'' +
|
||||
", signedType='" + signedType + '\'' +
|
||||
", userInfo='" + userInfo + '\'' +
|
||||
", mainId=" + mainId +
|
||||
'}';
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import aiyh.utils.mapUtil.ParaMap;
|
|||
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
|
||||
import aiyh.utils.zwl.common.ToolUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping;
|
||||
import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO;
|
||||
import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO;
|
||||
|
@ -22,12 +23,9 @@ import weaver.hrm.User;
|
|||
import weaver.soa.workflow.FileProcessor;
|
||||
import weaver.workflow.workflow.WorkflowVersion;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -315,8 +313,10 @@ public class FaDDContractService {
|
|||
if (ufContractInfoDTO.getSingleSignedNum() + 1 == ufContractInfoDTO.getSingleContractFileNum()) {
|
||||
update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1);
|
||||
// 查询下一位合同方并发起签署
|
||||
if (ufContractInfoDTO.getSignedNum() + 1 < ufContractInfoDTO.getShouldSignedNum()) {
|
||||
nextContractSigned(ufContractInfoDTO);
|
||||
}
|
||||
}
|
||||
// 如果合同已签数量和应签数量相同,则状态为本方待签
|
||||
if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum()) {
|
||||
update.put("contract_status", 3);
|
||||
|
@ -326,6 +326,45 @@ public class FaDDContractService {
|
|||
}
|
||||
if ("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
|
||||
update.put("contract_status", 4);
|
||||
// TODO 仅对方签署完成后,添加用户信息
|
||||
// 获取配置表信息
|
||||
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 {
|
||||
|
@ -341,6 +380,44 @@ public class FaDDContractService {
|
|||
}
|
||||
if ("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
|
||||
update.put("contract_status", 4);
|
||||
// TODO 仅对方签署完成后,添加用户信息
|
||||
// 获取配置表信息
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -662,6 +739,7 @@ public class FaDDContractService {
|
|||
|
||||
/**
|
||||
* 直接从法大大系统下载文件
|
||||
*
|
||||
* @param ufContractInfoDTO 合同相关信息
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -35,6 +35,9 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
|
|||
private String firstAddValue;
|
||||
// 第一次添加成功后的回写值
|
||||
private String addSuccessValue;
|
||||
// 安全协议单独id字段
|
||||
private String secretField;
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
ToolUtil toolUtil = new ToolUtil();
|
||||
|
@ -52,9 +55,11 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
|
|||
Map<String, Object> requestData = Util.recordSet2Map(rs_1);
|
||||
toolUtil.writeDebuggerLog(requestData.toString());
|
||||
// 如果不是第一次添加,则直接返回 TODO 隐藏bug,如果用户第一次选择添加,后面被退回后,将附件清空了,重新上传,然后又需要安全协议,但是已经不是第一次添加了,所以并不会生效
|
||||
if (StringUtils.isNullOrEmpty(secretField)) {
|
||||
if (requestData.get(firstAddField) != null && !Util.null2String(firstAddValue).equals(String.valueOf(requestData.get(firstAddField)))) {
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
}
|
||||
// 查询配置表,获取配置数据
|
||||
String querySql = "select ufta.id,ufta.workflow_type,wftva.fieldname as template_field, " +
|
||||
"wftvb.fieldname as attachment_field,wftv.fieldname as show_field, wftvb.id as attachment_field_id, " +
|
||||
|
@ -119,6 +124,27 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
|
|||
.attachmentTableName(attachmentTableName)
|
||||
.attachmentFieldId(attachmentFieldId)
|
||||
.builder();
|
||||
if (!StringUtils.isNullOrEmpty(secretField)) {
|
||||
// 原字段的文件id
|
||||
String fileIds = Util.null2String(rs_1.getString(configEmpty.getAttachmentField()));
|
||||
String[] split = fileIds.split(",");
|
||||
// 转为list
|
||||
List<String> list = Arrays.stream(split).collect(Collectors.toList());
|
||||
// 如果配置了secretField字段
|
||||
if (!StringUtils.isNullOrEmpty(secretField)) {
|
||||
String secretIds = Util.null2String(rs_1.getString(secretField));
|
||||
String[] secretIdArr = secretIds.split(",");
|
||||
List<String> secretFieldList = Arrays.stream(secretIdArr).collect(Collectors.toList());
|
||||
list.removeAll(secretFieldList);
|
||||
}
|
||||
Map<String, Object> data = ParaMap.create().put(configEmpty.getAttachmentField(), String.join(",", list));
|
||||
// 修改流程数据,将保密协议的docid更新到流程中
|
||||
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(billTableName,
|
||||
data,
|
||||
Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId));
|
||||
toolUtil.writeDebuggerLog("sql : " + sqlResult.getSqlStr() + " 参数: ---> " + sqlResult.getArgs());
|
||||
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
|
||||
}
|
||||
toolUtil.writeDebuggerLog("保密协议数据:" + configEmpty.toString());
|
||||
// 如果不控制是否使用模板,那就默认不添加保密协议
|
||||
if ("1".equals(isTemplateShow)) {
|
||||
|
@ -143,16 +169,29 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
|
|||
requestInfo.getRequestManager().setMessagecontent(aiyh.utils.Util.getHtmlLabelName(-87783, user.getLanguage(), "保密协议复制失败,未能正确复制保密协议!"));
|
||||
return Action.FAILURE_AND_CONTINUE;
|
||||
}
|
||||
// 原字段的文件id
|
||||
String fileIds = Util.null2String(rs_1.getString(configEmpty.getAttachmentField()));
|
||||
String[] split = fileIds.split(",");
|
||||
// 转为list
|
||||
List<String> list = Arrays.stream(split).collect(Collectors.toList());
|
||||
String[] split1 = docIds.split(",");
|
||||
list.addAll(Arrays.stream(split1).collect(Collectors.toList()));
|
||||
|
||||
// 如果配置了secretField字段
|
||||
if (!StringUtils.isNullOrEmpty(secretField)) {
|
||||
String secretIds = Util.null2String(rs_1.getString(secretField));
|
||||
String[] secretIdArr = secretIds.split(",");
|
||||
List<String> secretFieldList = Arrays.stream(secretIdArr).collect(Collectors.toList());
|
||||
list.removeAll(secretFieldList);
|
||||
}
|
||||
String[] docList = docIds.split(",");
|
||||
list.addAll(Arrays.stream(docList).collect(Collectors.toList()));
|
||||
Map<String, Object> data = ParaMap.create().put(configEmpty.getAttachmentField(), String.join(",", list));
|
||||
if (!StringUtils.isNullOrEmpty(secretField)) {
|
||||
data.put(secretField, docIds);
|
||||
} else {
|
||||
data.put(firstAddField, addSuccessValue);
|
||||
}
|
||||
// 修改流程数据,将保密协议的docid更新到流程中
|
||||
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(billTableName,
|
||||
ParaMap.create().put(configEmpty.getAttachmentField(), String.join(",", list))
|
||||
.put(firstAddField,addSuccessValue),
|
||||
data,
|
||||
Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId));
|
||||
toolUtil.writeDebuggerLog("sql : " + sqlResult.getSqlStr() + " 参数: ---> " + sqlResult.getArgs());
|
||||
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
|
||||
|
@ -237,6 +276,14 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
|
|||
this.firstAddValue = firstAddValue;
|
||||
}
|
||||
|
||||
public String getSecretField() {
|
||||
return secretField;
|
||||
}
|
||||
|
||||
public void setSecretField(String secretField) {
|
||||
this.secretField = secretField;
|
||||
}
|
||||
|
||||
public String getAddSuccessValue() {
|
||||
return addSuccessValue;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import weaver.aiyh_pcn.fadada.util.FaddContractUtil;
|
|||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -67,7 +66,7 @@ public class FaDDContractAction extends ToolUtil implements Action {
|
|||
List<Map<String, Object>> detailMaps = faDDContractMapping.queryDetailMaps(mainId, tableName);
|
||||
// 开始签署合同
|
||||
FaddContractUtil faddContractUtil = new FaddContractUtil(workflowId, requestId, mainTableName, tableName,
|
||||
customerNo, customerNoField, contractField, queueSigned, detailMaps, mainMap);
|
||||
customerNo, customerNoField, contractField, queueSigned, detailMaps, mainMap, user);
|
||||
try {
|
||||
faddContractUtil.createContract(mainMap);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import aiyh.utils.httpUtil.ResponeVo;
|
|||
import aiyh.utils.mapUtil.ParaMap;
|
||||
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
|
||||
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.FaDaDaConfigDTO;
|
||||
import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService;
|
||||
|
@ -18,6 +19,7 @@ import weaver.conn.RecordSet;
|
|||
import weaver.file.ImageFileManager;
|
||||
import weaver.formmode.data.ModeDataIdUpdate;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
@ -47,12 +49,14 @@ public class FaddContractUtil {
|
|||
private FaDDContractMapping faDDContractMapping = new FaDDContractMapping();
|
||||
private FaDDContractService faDDContractService = new FaDDContractService();
|
||||
private final ToolUtil toolUtil = new ToolUtil();
|
||||
private User user;
|
||||
|
||||
public FaddContractUtil() {
|
||||
}
|
||||
|
||||
public FaddContractUtil(String workflowId, String requestId, String mainTableName, String tableName, String customerNo,
|
||||
String customerNoField, String contractField, String queueSigned, List<Map<String, Object>> detailMaps, Map<String, Object> mainMap) {
|
||||
String customerNoField, String contractField, String queueSigned, List<Map<String, Object>> detailMaps, Map<String, Object> mainMap,
|
||||
User user) {
|
||||
this.workflowId = workflowId;
|
||||
this.requestId = requestId;
|
||||
this.mainTableName = mainTableName;
|
||||
|
@ -63,6 +67,7 @@ public class FaddContractUtil {
|
|||
this.queueSigned = queueSigned;
|
||||
this.detailMaps = detailMaps;
|
||||
this.mainMap = mainMap;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,6 +127,7 @@ public class FaddContractUtil {
|
|||
updateMap.put("workflow_request_id", requestId);
|
||||
updateMap.put("workflow_main_table", mainTableName);
|
||||
updateMap.put("workflow_detail_table", tableName);
|
||||
updateMap.put("user_info", JSON.toJSONString(user));
|
||||
// 1表示创建 2表示等待对方签署,3表示等待本方签署,4表示完成
|
||||
updateMap.put("contract_status", 1);
|
||||
// 对方应该签署的数量
|
||||
|
|
Loading…
Reference in New Issue