保密协议签署完成,保密协议附件添加和删除

dev
IT-xiaoXiong 2021-12-03 15:46:56 +08:00
parent cad7706a17
commit 86e95aad7b
5 changed files with 248 additions and 108 deletions

View File

@ -1,5 +1,5 @@
package com.api.aiyh_pcn.fadada.entity;
package com.api.aiyh_pcn.fadada.entity;
public class UfContractInfoDTO {
@ -22,149 +22,150 @@ public class UfContractInfoDTO {
private String workflowRequestId;
private String workflowDetailTable;
private String signedType;
private String userInfo;
private int mainId;
public void setId(int id){
public void setId(int id) {
this.id = id;
}
public void setRequestId(int requestId){
public void setRequestId(int requestId) {
this.requestId = requestId;
}
public void setWorkflowType(int workflowType){
public void setWorkflowType(int workflowType) {
this.workflowType = workflowType;
}
public void setContractNo(String contractNo){
public void setContractNo(String contractNo) {
this.contractNo = contractNo;
}
public void setFileNo(String fileNo){
public void setFileNo(String fileNo) {
this.fileNo = fileNo;
}
public void setFileName(String fileName){
public void setFileName(String fileName) {
this.fileName = fileName;
}
public void setSignedNum(int signedNum){
public void setSignedNum(int signedNum) {
this.signedNum = signedNum;
}
public void setShouldSignedNum(int shouldSignedNum){
public void setShouldSignedNum(int shouldSignedNum) {
this.shouldSignedNum = shouldSignedNum;
}
public void setContractStatus(int contractStatus){
public void setContractStatus(int contractStatus) {
this.contractStatus = contractStatus;
}
public void setContractViewUrl(String contractViewUrl){
public void setContractViewUrl(String contractViewUrl) {
this.contractViewUrl = contractViewUrl;
}
public void setContractDownUrl(String contractDownUrl){
public void setContractDownUrl(String contractDownUrl) {
this.contractDownUrl = contractDownUrl;
}
public void setWorkflowMainTable(String workflowMainTable){
public void setWorkflowMainTable(String workflowMainTable) {
this.workflowMainTable = workflowMainTable;
}
public void setQueueSigned(int queueSigned){
public void setQueueSigned(int queueSigned) {
this.queueSigned = queueSigned;
}
public void setSingleContractFileNum(int singleContractFileNum){
public void setSingleContractFileNum(int singleContractFileNum) {
this.singleContractFileNum = singleContractFileNum;
}
public void setSingleSignedNum(int singleSignedNum){
public void setSingleSignedNum(int singleSignedNum) {
this.singleSignedNum = singleSignedNum;
}
public void setWorkflowRequestId(String workflowRequestId){
public void setWorkflowRequestId(String workflowRequestId) {
this.workflowRequestId = workflowRequestId;
}
public void setWorkflowDetailTable(String workflowDetailTable){
public void setWorkflowDetailTable(String workflowDetailTable) {
this.workflowDetailTable = workflowDetailTable;
}
public void setMainId(int mainId){
public void setMainId(int mainId) {
this.mainId = mainId;
}
public int getId(){
public int getId() {
return this.id;
}
public int getRequestId(){
public int getRequestId() {
return this.requestId;
}
public int getWorkflowType(){
public int getWorkflowType() {
return this.workflowType;
}
public String getContractNo(){
public String getContractNo() {
return this.contractNo;
}
public String getFileNo(){
public String getFileNo() {
return this.fileNo;
}
public String getFileName(){
public String getFileName() {
return this.fileName;
}
public int getSignedNum(){
public int getSignedNum() {
return this.signedNum;
}
public int getShouldSignedNum(){
public int getShouldSignedNum() {
return this.shouldSignedNum;
}
public int getContractStatus(){
public int getContractStatus() {
return this.contractStatus;
}
public String getContractViewUrl(){
public String getContractViewUrl() {
return this.contractViewUrl;
}
public String getContractDownUrl(){
public String getContractDownUrl() {
return this.contractDownUrl;
}
public String getWorkflowMainTable(){
public String getWorkflowMainTable() {
return this.workflowMainTable;
}
public int getQueueSigned(){
public int getQueueSigned() {
return this.queueSigned;
}
public int getSingleContractFileNum(){
public int getSingleContractFileNum() {
return this.singleContractFileNum;
}
public int getSingleSignedNum(){
public int getSingleSignedNum() {
return this.singleSignedNum;
}
public String getWorkflowRequestId(){
public String getWorkflowRequestId() {
return this.workflowRequestId;
}
public String getWorkflowDetailTable(){
public String getWorkflowDetailTable() {
return this.workflowDetailTable;
}
public int getMainId(){
public int getMainId() {
return this.mainId;
}
@ -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 +
'}';
}

View File

@ -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,17 +313,58 @@ public class FaDDContractService {
if (ufContractInfoDTO.getSingleSignedNum() + 1 == ufContractInfoDTO.getSingleContractFileNum()) {
update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1);
// 查询下一位合同方并发起签署
nextContractSigned(ufContractInfoDTO);
if (ufContractInfoDTO.getSignedNum() + 1 < ufContractInfoDTO.getShouldSignedNum()) {
nextContractSigned(ufContractInfoDTO);
}
}
// 如果合同已签数量和应签数量相同,则状态为本方待签
if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum()) {
update.put("contract_status", 3);
// 判断是否控制签署规则 1-仅本方签署2-仅对方签署3-都签署
if("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){
if ("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
update.put("contract_status", 4);
}
if("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){
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 {
@ -336,11 +375,49 @@ 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()))){
if ("1".equals(Util.null2String(ufContractInfoDTO.getSignedType()))) {
update.put("contract_status", 4);
}
if("2".equals(Util.null2String(ufContractInfoDTO.getSignedType()))){
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());
}
}
}
@ -349,7 +426,7 @@ public class FaDDContractService {
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("uf_contract_info", update,
Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId()));
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());
// 查询合同状态,更新明细表
/* Map<String,Object> data = new HashMap<>();
@ -395,11 +472,11 @@ public class FaDDContractService {
List<Map<String, Object>> detailMaps = Util.recordSet2MapList(rs);
query = "select * from " + ufContractInfoDTO.getWorkflowMainTable() + " where requestid = ?";
RecordSet rs1 = new RecordSet();
rs1.executeQuery(query,ufContractInfoDTO.getRequestId());
rs1.executeQuery(query, ufContractInfoDTO.getRequestId());
Map<String, Object> mainMap = Util.recordSet2Map(rs1);
if(mainMap == null){
if (mainMap == null) {
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);
@ -421,11 +498,11 @@ 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 (faDaDaConfigDTO.getSignedType() == 1) {
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOther()) {
// 仅对方签署
if(maps.size() == 1){
map.put("signType",2);
if (maps.size() == 1) {
map.put("signType", 2);
}
}
}
@ -544,8 +621,8 @@ public class FaDDContractService {
if (!"200".equals(response.get("code"))) {
this.toolUtil.writeErrorLog("签署参数:" + responeVo.getEntityString());
throw new RuntimeException("本方签署失败!法大大请求接口错误!");
}else{
Map<String,Object> result = (Map<String, Object>) response.get("data");
} else {
Map<String, Object> result = (Map<String, Object>) response.get("data");
downloadUrlList.add(Util.null2String(result.get("downloadUrl")));
viewUrlList.add(Util.null2String(result.get("viewUrl")));
}
@ -554,25 +631,25 @@ public class FaDDContractService {
RecordSet rs = new RecordSet();
Map<String, Object> update = new HashMap<>();
update.put("contract_status", 4);
update.put("contract_view_url", String.join(";",viewUrlList));
update.put("contract_down_url", String.join(";",downloadUrlList));
update.put("contract_view_url", String.join(";", viewUrlList));
update.put("contract_down_url", String.join(";", downloadUrlList));
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update,
Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId));
toolUtil.writeDebuggerLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
// 获取流程中的合同字段的文档目录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 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)){
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.executeQuery(query, ufContractInfoDTO.getWorkflowType());
rs.next();
docCategorys = Util.null2String(rs.getString(1));
}
if(StringUtils.isNullOrEmpty(docCategorys)){
if (StringUtils.isNullOrEmpty(docCategorys)) {
docCategorys = ",,1";
}
// String[] docSplit = docCategorys.split(",");
@ -581,7 +658,7 @@ public class FaDDContractService {
String docIds = "";
try {
docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user);
}catch (Exception e){
} catch (Exception e) {
toolUtil.writeErrorLog("创建文档发生错误:" + e);
}
toolUtil.writeDebuggerLog("生成的文档的id" + docIds);
@ -590,7 +667,7 @@ public class FaDDContractService {
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());
rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
}
public String downloadContract2FileSystem(UfContractInfoDTO ufContractInfoDTO, String category, User user) {
@ -662,10 +739,11 @@ public class FaDDContractService {
/**
*
*
* @param ufContractInfoDTO
* @return
*/
public StreamingOutput download4mFDD(UfContractInfoDTO ufContractInfoDTO){
public StreamingOutput download4mFDD(UfContractInfoDTO ufContractInfoDTO) {
// 获取配置表信息
FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 5);
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig());
@ -676,7 +754,7 @@ public class FaDDContractService {
String[] contractNoArr = contractNos.split(",");
String[] fileNameArr = fileNames.split(",");
toolUtil.writeDebuggerLog("下载合同download4mFDD");
if(contractNoArr.length >= 2){
if (contractNoArr.length >= 2) {
// 多个文件,需要下载压缩包
return outputStream -> {
ZipOutputStream zipOut = new ZipOutputStream(outputStream);
@ -715,7 +793,7 @@ public class FaDDContractService {
outputStream.close();
};
}
return outputStream->{
return outputStream -> {
toolUtil.writeDebuggerLog("download4mFDD单文件下载");
// InputStream inputStream = downloadContract(contractNos,String.valueOf(ufContractInfoDTO.getWorkflowType()));
Map<String, Object> data = new HashMap<>();

View File

@ -25,16 +25,19 @@ import java.util.stream.Collectors;
public class CopyAttachmentSecretAction extends ToolUtil implements Action {
// 模板id
// 模板id
private String attachmentTemplateId;
// 是否属于浏览框
// 是否属于浏览框
private String isBrowseBox;
// 第一次添加附件标识字段
// 第一次添加附件标识字段
private String firstAddField;
// 第一次添加附件的值
// 第一次添加附件的值
private String firstAddValue;
// 第一次添加成功后的回写值
// 第一次添加成功后的回写值
private String addSuccessValue;
// 安全协议单独id字段
private String secretField;
@Override
public String execute(RequestInfo requestInfo) {
ToolUtil toolUtil = new ToolUtil();
@ -52,8 +55,10 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
Map<String, Object> requestData = Util.recordSet2Map(rs_1);
toolUtil.writeDebuggerLog(requestData.toString());
// 如果不是第一次添加,则直接返回 TODO 隐藏bug如果用户第一次选择添加后面被退回后将附件清空了重新上传然后又需要安全协议但是已经不是第一次添加了所以并不会生效
if(requestData.get(firstAddField) != null && !Util.null2String(firstAddValue).equals(String.valueOf(requestData.get(firstAddField)))){
return Action.SUCCESS;
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, " +
@ -72,7 +77,7 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
RecordSet rs = new RecordSet();
rs.executeQuery(querySql, workflowId, workflowId, 1);
ConfigEmpty configEmpty = null;
while(rs.next()){
while (rs.next()) {
// id
int id = Util.getIntValue(rs.getString("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)) {
@ -133,9 +159,9 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
return Action.SUCCESS;
}
}
if(configEmpty != null){
if (configEmpty != null) {
// 使用保密协议模板
String docIds = copyFile(user, configEmpty,String.valueOf(requestData.get(configEmpty.getTemplateField())));
String docIds = copyFile(user, configEmpty, String.valueOf(requestData.get(configEmpty.getTemplateField())));
toolUtil.writeDebuggerLog("复制完成文件id" + docIds);
if (StringUtils.isNullOrEmpty(docIds)) {
requestInfo.getRequestManager().setMessageid("1");
@ -143,27 +169,40 @@ 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());
}
}catch (Exception e){
} catch (Exception e) {
toolUtil.writeErrorLog("出现错误: " + e);
}
return Action.SUCCESS;
}
public String copyFile(User user, ConfigEmpty configEmpty,String browseBoxId){
public String copyFile(User user, ConfigEmpty configEmpty, String browseBoxId) {
ToolUtil toolUtil = new ToolUtil();
// 建模表名称 params.get("tableName")
String tableName = String.valueOf(configEmpty.getModelTableName());
@ -174,35 +213,35 @@ public class CopyAttachmentSecretAction extends ToolUtil implements Action {
// 配置id params.get("configId")
// String configId = String.valueOf(configEmpty.getId());
String configId;
if("true".equals(isBrowseBox)){
if ("true".equals(isBrowseBox)) {
// 如果是流程中的某个浏览框则读取配置文件的浏览框值否则直接赋值为action中配置的模板id
configId = browseBoxId;
}else {
} else {
configId = attachmentTemplateId;
}
// 流程id params.get("workflowId")
String workflowId = String.valueOf(configEmpty.getWorkflowType());
DocTemplateDao docTemplateDao = new DocTemplateDao();
int[] docIds = null;
try{
try {
docIds = docTemplateDao.copyFile(user.getUID(), tableName, fieldName, configId);
}catch(Exception e){
} catch (Exception e) {
toolUtil.writeErrorLog("复制文件出错: " + e);
return null;
}
if(docIds == null){
if (docIds == null) {
return null;
}
try{
docTemplateDao.updateFileInfo(workflowId,fileFieldId,docIds);
}catch(Exception e){
try {
docTemplateDao.updateFileInfo(workflowId, fileFieldId, docIds);
} catch (Exception e) {
toolUtil.writeErrorLog("复制文件更新权限和目录出错: " + e);
return null;
}
toolUtil.writeDebuggerLog("数据更新成功!" + Arrays.toString(docIds));
List<String> intList= Arrays.stream(docIds).boxed().collect(Collectors.toList())
List<String> intList = Arrays.stream(docIds).boxed().collect(Collectors.toList())
.stream().map(String::valueOf).collect(Collectors.toList());
return String.join(",",intList);
return String.join(",", intList);
}
public String getAttachmentTemplateId() {
@ -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;
}

View File

@ -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;
@ -23,17 +22,17 @@ import java.util.Map;
public class FaDDContractAction extends ToolUtil implements Action {
private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping();
private final ToolUtil toolUtil = new ToolUtil();
// 合同字段
// 合同字段
private String contractField;
// 客户编号字段
// 客户编号字段
private String customerNoField;
// 客户编号
// 客户编号
private String customerNo;
// 是否是顺序签订
// 是否是顺序签订
private String queueSigned;
// 签订字段,用于是否电子签
// 签订字段,用于是否电子签
private String signedField;
// 签订值
// 签订值
private String signedValue;
@ -67,19 +66,19 @@ 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) {
toolUtil.writeErrorLog("合同创建失败,失败原因:" + e);
// TODO 更换labelIndex
requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-87660,user.getLanguage(),"合同创建失败,未能正确创建法大大合同!"));
requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-87660, user.getLanguage(), "合同创建失败,未能正确创建法大大合同!"));
requestInfo.getRequestManager().setMessageid("1");
return Action.FAILURE_AND_CONTINUE;
}
if(faDaDaConfigDTO.getSignedType() == 1){
if (faDaDaConfigDTO.getSignedType() == 1) {
// 需要控制签署规则
if(Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOwn()){
if (Integer.parseInt(Util.null2String(mainMap.get(faDaDaConfigDTO.getFieldControl1()))) == faDaDaConfigDTO.getOnlyOwn()) {
// 只需要本方签署
return Action.SUCCESS;
}
@ -97,7 +96,7 @@ public class FaDDContractAction extends ToolUtil implements Action {
} catch (Exception e) {
toolUtil.writeErrorLog("合同已创建,但发起签署失败,失败原因:" + e);
// TODO 更换labelIndex
requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-87659,user.getLanguage(),"合同已创建,当合同发起签署时失败!"));
requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-87659, user.getLanguage(), "合同已创建,当合同发起签署时失败!"));
requestInfo.getRequestManager().setMessageid("2");
return Action.FAILURE_AND_CONTINUE;
}

View File

@ -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);
// 对方应该签署的数量