附件赋值,生成loginID,修复httpUtils set方法
parent
63bf2a1642
commit
5216cfecd1
22
pom.xml
22
pom.xml
|
@ -64,7 +64,18 @@
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.12</version>
|
<version>4.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>eu.agno3.jcifs</groupId>-->
|
||||||
|
<!-- <artifactId>jcifs-ng</artifactId>-->
|
||||||
|
<!-- <version>2.1.9</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hierynomus</groupId>
|
||||||
|
<artifactId>smbj</artifactId>
|
||||||
|
<version>0.10.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- easy excel -->
|
<!-- easy excel -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -80,12 +91,11 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.rocketmq</groupId>
|
<groupId>org.apache.rocketmq</groupId>
|
||||||
<artifactId>rocketmq-client</artifactId>
|
<artifactId>rocketmq-client</artifactId>
|
||||||
<version>4.4.0</version>
|
<version>4.4.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -11,11 +11,11 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class DocImageInfo {
|
public class DocImageInfo {
|
||||||
|
|
||||||
private Integer docId;
|
private Integer docId;
|
||||||
private Integer imageFileId;
|
private Integer imageFileId;
|
||||||
private String imageFileName;
|
private String imageFileName;
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer detailId;
|
private Integer detailId;
|
||||||
private Integer fileSize;
|
private Integer fileSize;
|
||||||
|
private Integer docFileType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ package aiyh.utils.httpUtil;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONException;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
@ -133,7 +134,11 @@ public class ResponeVo implements HttpResponse {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
this.entityMap = mapper.readValue(this.getEntityString(), Map.class);
|
this.entityMap = mapper.readValue(this.getEntityString(), Map.class);
|
||||||
} catch (JsonProcessingException ignored) {
|
} catch (JsonProcessingException ignored) {
|
||||||
this.resultList = (List<Map>) JSONArray.parseArray(this.getEntityString(), Map.class);
|
try {
|
||||||
|
this.resultList = (List<Map>) JSONArray.parseArray(this.getEntityString(), Map.class);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Util.getLogger().error("Unable to convert the response result to array!" + Util.getErrString(e));
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Util.getLogger().error("Unable to convert the response result to map or array!" + Util.getErrString(e));
|
Util.getLogger().error("Unable to convert the response result to map or array!" + Util.getErrString(e));
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -61,10 +61,14 @@ public interface UtilMapper {
|
||||||
@Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid = #{docId}")
|
@Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid = #{docId}")
|
||||||
DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId);
|
DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId);
|
||||||
|
|
||||||
@Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in ($t{docIds})")
|
@Select("select id,docid doc_id," +
|
||||||
|
"imagefileid image_file_id, docfiletype doc_file_type," +
|
||||||
|
"imagefilename image_file_name from docimagefile where docid in ($t{docIds})")
|
||||||
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String docIds);
|
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String docIds);
|
||||||
|
|
||||||
@Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in (${docIds})")
|
@Select("select id,docid doc_id,imagefileid image_file_id," +
|
||||||
|
"docfiletype doc_file_type," +
|
||||||
|
"imagefilename image_file_name from docimagefile where docid in (${docIds})")
|
||||||
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String[] docIds);
|
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String[] docIds);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import aiyh.utils.Util;
|
||||||
import aiyh.utils.action.SafeCusBaseAction;
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
import aiyh.utils.annotation.*;
|
import aiyh.utils.annotation.*;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import ebu7common.youhong.ai.bean.Builder;
|
import ebu7common.youhong.ai.bean.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -12,6 +13,7 @@ import lombok.ToString;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.UpdateDetailRowDto;
|
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.UpdateDetailRowDto;
|
||||||
|
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity.ConditionsSetValueConfigMain;
|
||||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.service.WorkflowConditionsSetValueService;
|
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.service.WorkflowConditionsSetValueService;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -31,7 +33,7 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
@RequiredMark("流程条件赋值配置表唯一标识字段值")
|
@RequiredMark("流程条件赋值配置表唯一标识字段值")
|
||||||
@PrintParamMark
|
@PrintParamMark
|
||||||
@ActionDefaultTestValue("test")
|
@ActionDefaultTestValue("getdata")
|
||||||
private String onlyMark;
|
private String onlyMark;
|
||||||
|
|
||||||
@ActionOptionalParam(desc = "条件修改所在明细表,1-明细1,2-明细2", value = "")
|
@ActionOptionalParam(desc = "条件修改所在明细表,1-明细1,2-明细2", value = "")
|
||||||
|
@ -54,14 +56,15 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> workflowData = new HashMap<>(16);
|
Map<String, Object> workflowData = new HashMap<>(16);
|
||||||
Map<String, Object> workflowMainData = super.getObjMainTableValue(requestInfo);
|
Map<String, Object> workflowMainData = super.getObjMainTableValue(requestInfo);
|
||||||
|
ConditionsSetValueConfigMain conditionsSetValueConfigMain = service.getConditionConfigMain(onlyMark);
|
||||||
if (Strings.isNullOrEmpty(detailNo)) {
|
if (Strings.isNullOrEmpty(detailNo)) {
|
||||||
/* ******************* 数据修改主表 ******************* */
|
/* ******************* 数据修改主表 ******************* */
|
||||||
Map<String, Object> conditionsValue = service.getConditionsValue(onlyMark, workflowData).get(billTable);
|
Map<String, Object> conditionsValue = service.getConditionsValue(conditionsSetValueConfigMain, workflowData).get(billTable);
|
||||||
service.updateWorkflowData(conditionsValue, billTable, requestId);
|
service.updateWorkflowData(conditionsValue, billTable, requestId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* ******************* 明细表 ******************* */
|
/* ******************* 明细表 ******************* */
|
||||||
List<Map<String, Object>> detailData = super.getDetailTableObjValueByDetailNo(Integer.parseInt(detailNo), requestInfo);
|
List<Map<String, Object>> detailData = super.getDetailTableObjValueByDetailNo(Integer.parseInt(detailNo) - 1, requestInfo);
|
||||||
workflowData.put("main", workflowMainData);
|
workflowData.put("main", workflowMainData);
|
||||||
workflowData.put("_user_", user);
|
workflowData.put("_user_", user);
|
||||||
workflowData.put("_workflowId_", workflowId);
|
workflowData.put("_workflowId_", workflowId);
|
||||||
|
@ -71,7 +74,7 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
||||||
List<UpdateDetailRowDto> detail = new ArrayList<>();
|
List<UpdateDetailRowDto> detail = new ArrayList<>();
|
||||||
for (Map<String, Object> detailDatum : detailData) {
|
for (Map<String, Object> detailDatum : detailData) {
|
||||||
workflowData.put("detail_" + detailNo, detailDatum);
|
workflowData.put("detail_" + detailNo, detailDatum);
|
||||||
Map<String, Map<String, Object>> conditionsValues = service.getConditionsValue(onlyMark, workflowData);
|
Map<String, Map<String, Object>> conditionsValues = service.getConditionsValue(conditionsSetValueConfigMain, workflowData);
|
||||||
Map<String, Object> mainConditions = conditionsValues.get(billTable);
|
Map<String, Object> mainConditions = conditionsValues.get(billTable);
|
||||||
if (!Objects.isNull(mainConditions) && !mainConditions.isEmpty()) {
|
if (!Objects.isNull(mainConditions) && !mainConditions.isEmpty()) {
|
||||||
main.add(Builder.builder(UpdateDetailRowDto::new)
|
main.add(Builder.builder(UpdateDetailRowDto::new)
|
||||||
|
@ -89,6 +92,8 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("条件值: " + JSON.toJSONString(main));
|
||||||
|
log.info("条件值: " + JSON.toJSONString(detail));
|
||||||
service.updateWorkflowDetailData(main, billTable, null);
|
service.updateWorkflowDetailData(main, billTable, null);
|
||||||
service.updateWorkflowDetailData(detail, billTable + "_dt" + detailNo, detailNo);
|
service.updateWorkflowDetailData(detail, billTable + "_dt" + detailNo, detailNo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -101,6 +106,8 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitWorkflow(String requestId, Integer userId) {
|
public void submitWorkflow(String requestId, Integer userId) {
|
||||||
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "邮件发送附件提交流程!");
|
if (Boolean.parseBoolean(submitAction)) {
|
||||||
|
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "流程条件赋值提交流程!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package weaver.youhong.ai.pcn.actioin.conditionssetvalue.service;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.tool.Assert;
|
import aiyh.utils.tool.Assert;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.ConditionValueDto;
|
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.ConditionValueDto;
|
||||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.UpdateDetailRowDto;
|
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.UpdateDetailRowDto;
|
||||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity.ConditionItem;
|
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity.ConditionItem;
|
||||||
|
@ -28,17 +29,13 @@ public class WorkflowConditionsSetValueService {
|
||||||
/**
|
/**
|
||||||
* <h2>获取条件赋值映射规则处理后的字段值</h2>
|
* <h2>获取条件赋值映射规则处理后的字段值</h2>
|
||||||
*
|
*
|
||||||
* @param onlyMark 配置表唯一标识
|
* @param conditionsSetValueConfigMain 配置表信息
|
||||||
* @param workflowData 流程表数据
|
* @param workflowData 流程表数据
|
||||||
* @return 映射结果
|
* @return 映射结果
|
||||||
*/
|
*/
|
||||||
public Map<String, Map<String, Object>> getConditionsValue(String onlyMark, Map<String, Object> workflowData) {
|
public Map<String, Map<String, Object>> getConditionsValue(ConditionsSetValueConfigMain conditionsSetValueConfigMain, Map<String, Object> workflowData) {
|
||||||
|
|
||||||
/* ******************* 查询配置表 ******************* */
|
|
||||||
ConditionsSetValueConfigMain conditionsSetValueConfigMain = mapper.selectConfigByOnlyMark(onlyMark);
|
|
||||||
Assert.notNull(conditionsSetValueConfigMain, "can not query configuration by onlyMark [{}]", onlyMark);
|
|
||||||
List<ConditionItem> conditionItemList = conditionsSetValueConfigMain.getConditionItemList();
|
List<ConditionItem> conditionItemList = conditionsSetValueConfigMain.getConditionItemList();
|
||||||
Assert.notEmpty(conditionItemList, "can not query conditionItemList by onlyMark [{}]", onlyMark);
|
|
||||||
/* ******************* 映射规则处理 ,责任链初始化 ******************* */
|
/* ******************* 映射规则处理 ,责任链初始化 ******************* */
|
||||||
ConditionsTypeTreatment conditionsTypeTreatment = new ConditionsTypeTreatment(
|
ConditionsTypeTreatment conditionsTypeTreatment = new ConditionsTypeTreatment(
|
||||||
new ConditionsTreatment(
|
new ConditionsTreatment(
|
||||||
|
@ -68,6 +65,16 @@ public class WorkflowConditionsSetValueService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public ConditionsSetValueConfigMain getConditionConfigMain(String onlyMark) {
|
||||||
|
/* ******************* 查询配置表 ******************* */
|
||||||
|
ConditionsSetValueConfigMain conditionsSetValueConfigMain = mapper.selectConfigByOnlyMark(onlyMark);
|
||||||
|
Assert.notNull(conditionsSetValueConfigMain, "can not query configuration by onlyMark [{}]", onlyMark);
|
||||||
|
List<ConditionItem> conditionItemList = conditionsSetValueConfigMain.getConditionItemList();
|
||||||
|
Assert.notEmpty(conditionItemList, "can not query conditionItemList by onlyMark [{}]", onlyMark);
|
||||||
|
return conditionsSetValueConfigMain;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>更新明细表数据</h2>
|
* <h2>更新明细表数据</h2>
|
||||||
*
|
*
|
||||||
|
@ -94,6 +101,9 @@ public class WorkflowConditionsSetValueService {
|
||||||
StringBuilder sb = new StringBuilder("update ");
|
StringBuilder sb = new StringBuilder("update ");
|
||||||
sb.append(billTable).append(" set ");
|
sb.append(billTable).append(" set ");
|
||||||
for (Map.Entry<String, Object> entry : updateBatchData.get(0).entrySet()) {
|
for (Map.Entry<String, Object> entry : updateBatchData.get(0).entrySet()) {
|
||||||
|
if (entry.getKey().equals("_id_")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sb.append(entry.getKey())
|
sb.append(entry.getKey())
|
||||||
.append(" = #{item.")
|
.append(" = #{item.")
|
||||||
.append(entry.getKey())
|
.append(entry.getKey())
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class ValueSetRulesTreatment {
|
||||||
return Builder.builder(ConditionValueDto::new)
|
return Builder.builder(ConditionValueDto::new)
|
||||||
.with(ConditionValueDto::setFieldName, conditionItem.getTargetField().getFieldName())
|
.with(ConditionValueDto::setFieldName, conditionItem.getTargetField().getFieldName())
|
||||||
.with(ConditionValueDto::setValue, value)
|
.with(ConditionValueDto::setValue, value)
|
||||||
|
.with(ConditionValueDto::setTableName, conditionItem.getTargetField().getTableName())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.docfieltoattachment;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
|
import aiyh.utils.annotation.ActionDesc;
|
||||||
|
import aiyh.utils.annotation.ActionOptionalParam;
|
||||||
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import aiyh.utils.entity.DocImageInfo;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import weaver.file.ImageFileManager;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.youhong.ai.pcn.actioin.docfieltoattachment.mapper.CopyDocFileToAttachmentMapper;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>文档字段中附件复制到附件字段中</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/2/21 18:40</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@ActionDesc(value = "文档字段中附件复制到附件字段中", author = "youhong.ai")
|
||||||
|
public class CopyDocFileToAttachmentAction extends SafeCusBaseAction {
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionOptionalParam(value = "true", desc = "是否失败后阻断流程")
|
||||||
|
private String block = "true";
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@RequiredMark("字段映射配置字段: 文档字段:附件字段;文档字段:附件字段")
|
||||||
|
private String fieldMappings;
|
||||||
|
|
||||||
|
private final CopyDocFileToAttachmentMapper mapper = Util.getMapper(CopyDocFileToAttachmentMapper.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||||
|
try {
|
||||||
|
String[] fieldMappingArr = fieldMappings.split(";");
|
||||||
|
Map<String, String> mainTableValue = super.getMainTableValue(requestInfo);
|
||||||
|
Map<String, Object> sqlValue = new HashMap<>();
|
||||||
|
for (String fieldMapping : fieldMappingArr) {
|
||||||
|
copyFile(fieldMapping, mainTableValue, sqlValue, String.valueOf(workflowId), billTable, user.getUID());
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder("update ");
|
||||||
|
sb.append(billTable).append(" set ");
|
||||||
|
for (Map.Entry<String, Object> entry : sqlValue.entrySet()) {
|
||||||
|
sb.append(entry.getKey()).append(" = ").append("#{").append(entry.getKey()).append("},");
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length() - 1);
|
||||||
|
sb.append(" where requestid = ").append(requestId);
|
||||||
|
if (mapper.updateDocIds(sb.toString(), sqlValue)) {
|
||||||
|
Thread.sleep(500);
|
||||||
|
mapper.updateDocIds(sb.toString(), sqlValue);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (Boolean.parseBoolean(block)) {
|
||||||
|
throw new CustomerException(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyFile(String fieldMapping, Map<String, String> mainTableValue,
|
||||||
|
Map<String, Object> sqlValue, String workflowId,
|
||||||
|
String billTable, int userId) {
|
||||||
|
List<Integer> docIds = new ArrayList<>();
|
||||||
|
String[] split = fieldMapping.split(":");
|
||||||
|
String docField = split[0];
|
||||||
|
String fileField = split[1];
|
||||||
|
String docId = mainTableValue.get(docField);
|
||||||
|
List<DocImageInfo> docImageInfos = Util.selectImageInfoByDocIds(docId);
|
||||||
|
for (DocImageInfo docImageInfo : docImageInfos) {
|
||||||
|
if (docImageInfo.getDocFileType() != 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
InputStream inputStreamById = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
|
||||||
|
String docCategorysByTable = Util.getDocCategorysByTable(workflowId, fileField, billTable);
|
||||||
|
String[] categoryArr = docCategorysByTable.split(",");
|
||||||
|
String category = categoryArr[categoryArr.length - 1];
|
||||||
|
try {
|
||||||
|
int doc = Util.createDoc(docImageInfo.getImageFileName(), Integer.parseInt(category), inputStreamById, userId);
|
||||||
|
docIds.add(doc);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sqlValue.put(fileField, Util.intJoin(docIds, ","));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.docfieltoattachment.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlString;
|
||||||
|
import aiyh.utils.annotation.recordset.Update;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/2/21 19:13</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface CopyDocFileToAttachmentMapper {
|
||||||
|
|
||||||
|
@Update(custom = true)
|
||||||
|
boolean updateDocIds(@SqlString String sql,
|
||||||
|
Map<String, Object> map);
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.generateloginid;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
|
import aiyh.utils.annotation.ActionDesc;
|
||||||
|
import aiyh.utils.annotation.ActionOptionalParam;
|
||||||
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.youhong.ai.pcn.actioin.generateloginid.mapper.GenerateLoginIdMapper;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>生成loginid</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/2/21 19:46</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@ActionDesc(value = "根据分部生成对应的登录名", author = "youhong.ai")
|
||||||
|
public class GenerateLoginIdAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@RequiredMark("流程回写登录名字段名")
|
||||||
|
private String loginIdField;
|
||||||
|
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@RequiredMark("分部简称流程字段名")
|
||||||
|
private String subCompanyTextField;
|
||||||
|
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionOptionalParam(value = "4", desc = "登录名序列数字位长度,序列不足时前缀补0,如0001,默认长度4位")
|
||||||
|
private String numberFillQuantity = "4";
|
||||||
|
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionOptionalParam(value = "true", desc = "是否失败后阻断流程")
|
||||||
|
private String block = "true";
|
||||||
|
|
||||||
|
private final GenerateLoginIdMapper mapper = Util.getMapper(GenerateLoginIdMapper.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||||
|
try {
|
||||||
|
Map<String, String> mainTableValue = super.getMainTableValue(requestInfo);
|
||||||
|
String subCompanyName = mainTableValue.get(subCompanyTextField);
|
||||||
|
String subCompanyId = mapper.selectSubCompanyIdBySubCompanyName(subCompanyName);
|
||||||
|
Map<String, String> lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%");
|
||||||
|
String loginIdNo = lastLoginIdInfo.get("loginIdNo");
|
||||||
|
String loginId = prefixFill(loginIdNo, subCompanyName);
|
||||||
|
if (mapper.updateLoginId(billTable, requestId, loginId, loginIdField)) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
|
mapper.updateLoginId(billTable, requestId, loginId, loginIdField);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (Boolean.parseBoolean(block)) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>前缀补齐</h2>
|
||||||
|
*
|
||||||
|
* @param lastLoginIdNo 最后登录名编号
|
||||||
|
* @param prefix 前缀
|
||||||
|
* @return 登录名
|
||||||
|
*/
|
||||||
|
private String prefixFill(String lastLoginIdNo, String prefix) {
|
||||||
|
NumberFormat numberFormat = NumberFormat.getInstance();
|
||||||
|
// 禁用数字格式化分组。
|
||||||
|
numberFormat.setGroupingUsed(false);
|
||||||
|
// 保留最小位数
|
||||||
|
numberFormat.setMinimumIntegerDigits(Integer.parseInt(numberFillQuantity));
|
||||||
|
// 保留最大位数
|
||||||
|
numberFormat.setMaximumIntegerDigits(Integer.parseInt(numberFillQuantity));
|
||||||
|
int newLoginId = Integer.parseInt(lastLoginIdNo) + 1;
|
||||||
|
return prefix + numberFormat.format(newLoginId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.generateloginid.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Update;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/2/21 20:31</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface GenerateLoginIdMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>通过分部简称查询分部id</h2>
|
||||||
|
*
|
||||||
|
* @param subCompanyName 分部简称
|
||||||
|
* @return 分部id
|
||||||
|
*/
|
||||||
|
@Select("select id from hrmsubcompany where SUBCOMPANYNAME = #{subCompanyName}")
|
||||||
|
String selectSubCompanyIdBySubCompanyName(String subCompanyName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询当前分部的人员的登录名的最后一个编号</h2>
|
||||||
|
*
|
||||||
|
* @param loginIdPrefix 登录名前缀
|
||||||
|
* @param subCompanyId 分部id
|
||||||
|
* @param loginLike 登录名前缀+%
|
||||||
|
* @return 当前分部人员id和登录名编号
|
||||||
|
*/
|
||||||
|
@Select("select id,substring(LOGINID,length(#{loginIdPrefix}) + 1) login_id_no \n" +
|
||||||
|
"from hrmresource \n" +
|
||||||
|
"where SUBCOMPANYID1 = #{subCompanyId} and LOGINID like #{loginLike} \n" +
|
||||||
|
" order by cast(substring(LOGINID,length(#{loginIdPrefix}) + 1) as decimal) \n" +
|
||||||
|
" desc limit 1")
|
||||||
|
Map<String, String> selectLastLoginId(
|
||||||
|
@ParamMapper("loginIdPrefix") String loginIdPrefix,
|
||||||
|
@ParamMapper("subCompanyId") String subCompanyId,
|
||||||
|
@ParamMapper("loginLike") String loginLike
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>更新流程中的loginId字段</h2>
|
||||||
|
*
|
||||||
|
* @param billTable 流程表
|
||||||
|
* @param requestId 请求id
|
||||||
|
* @param loginId 登录id
|
||||||
|
* @param loginIdField 登录id所属字段
|
||||||
|
* @return 是否更新成功
|
||||||
|
*/
|
||||||
|
@Update("update $t{billTable} set $t{loginIdField} where requestid = #{requestId}")
|
||||||
|
boolean updateLoginId(@ParamMapper("billTable") String billTable,
|
||||||
|
@ParamMapper("requestId") String requestId,
|
||||||
|
@ParamMapper("loginId") String loginId,
|
||||||
|
@ParamMapper("loginIdField") String loginIdField);
|
||||||
|
}
|
|
@ -20,4 +20,10 @@ public class TestHaRiPiJiu extends BaseTest {
|
||||||
GenerateFileUtil.createActionDocument(VoucherPayableAction.class);
|
GenerateFileUtil.createActionDocument(VoucherPayableAction.class);
|
||||||
GenerateFileUtil.createActionDocument(ReceiptAndPaymentAction.class);
|
GenerateFileUtil.createActionDocument(ReceiptAndPaymentAction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test1() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.engine.hrm.service.impl.RolesMembersServiceImpl;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.WorkflowConditionsSetValueAction;
|
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.WorkflowConditionsSetValueAction;
|
||||||
|
import weaver.youhong.ai.pcn.actioin.generateloginid.GenerateLoginIdAction;
|
||||||
import weaver.youhong.ai.pcn.schedule.addrolebyhasundering.RegisterRoleMemberByHasUnderingCronJob;
|
import weaver.youhong.ai.pcn.schedule.addrolebyhasundering.RegisterRoleMemberByHasUnderingCronJob;
|
||||||
import weaver.youhong.ai.pcn.schedule.addrolemember.RegisterRoleMemberCronJob;
|
import weaver.youhong.ai.pcn.schedule.addrolemember.RegisterRoleMemberCronJob;
|
||||||
|
|
||||||
|
@ -75,6 +76,6 @@ public class RolesTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void generateFile() {
|
public void generateFile() {
|
||||||
GenerateFileUtil.createActionDocument(WorkflowConditionsSetValueAction.class);
|
GenerateFileUtil.createActionDocument(GenerateLoginIdAction.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- 流程类型视图,可用于数据集成或流览按钮
|
-- 流程类型视图,可用于数据集成或流览按钮
|
||||||
create
|
create
|
||||||
or replace view workflow_type_info_view as
|
or replace view workflow_type_info_view as
|
||||||
select wb.id,
|
select wb.id,
|
||||||
wb.workflowname,
|
wb.workflowname,
|
||||||
wt.typename,
|
wt.typename,
|
||||||
|
@ -11,7 +11,7 @@ from workflow_base wb
|
||||||
|
|
||||||
-- 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名
|
-- 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名
|
||||||
create
|
create
|
||||||
or replace view workflow_table_view as
|
or replace view workflow_table_view as
|
||||||
select base.id,
|
select base.id,
|
||||||
base.workflowname,
|
base.workflowname,
|
||||||
base.formid,
|
base.formid,
|
||||||
|
@ -22,7 +22,7 @@ from workflow_bill bill
|
||||||
|
|
||||||
-- 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框
|
-- 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框
|
||||||
create
|
create
|
||||||
or replace view workflow_detail_table_view as
|
or replace view workflow_detail_table_view as
|
||||||
select CONCAT(bill.id, '-', base.id) id,
|
select CONCAT(bill.id, '-', base.id) id,
|
||||||
bill.id bill_id,
|
bill.id bill_id,
|
||||||
base.id workflow_id,
|
base.id workflow_id,
|
||||||
|
@ -34,7 +34,7 @@ from workflow_billdetailtable bill
|
||||||
|
|
||||||
-- 流程和建模字段视图,更具流程和建模的billid可以查询流程和建模中的字段信息
|
-- 流程和建模字段视图,更具流程和建模的billid可以查询流程和建模中的字段信息
|
||||||
create
|
create
|
||||||
or replace view workflow_field_table_view as
|
or replace view workflow_field_table_view as
|
||||||
select wb.id,
|
select wb.id,
|
||||||
wb.fieldname,
|
wb.fieldname,
|
||||||
concat(ht.indexdesc, ':', wb.fieldname) indexdesc,
|
concat(ht.indexdesc, ':', wb.fieldname) indexdesc,
|
||||||
|
@ -59,13 +59,14 @@ select wb.id,
|
||||||
when wb.FIELDHTMLTYPE = '3' then '流览框'
|
when wb.FIELDHTMLTYPE = '3' then '流览框'
|
||||||
when wb.FIELDHTMLTYPE = '4' then 'check框'
|
when wb.FIELDHTMLTYPE = '4' then 'check框'
|
||||||
when wb.FIELDHTMLTYPE = '5' then '选择框'
|
when wb.FIELDHTMLTYPE = '5' then '选择框'
|
||||||
else '附件上传' end) fieldhtmltype
|
else '附件上传' end) fieldhtmltype,
|
||||||
|
wb.FIELDHTMLTYPE fieldtype
|
||||||
from workflow_billfield wb
|
from workflow_billfield wb
|
||||||
left join htmllabelindex ht on wb.fieldlabel = ht.id;
|
left join htmllabelindex ht on wb.fieldlabel = ht.id;
|
||||||
|
|
||||||
-- 建模表信息视图
|
-- 建模表信息视图
|
||||||
create
|
create
|
||||||
or replace view mode_bill_info_view as
|
or replace view mode_bill_info_view as
|
||||||
select bill.id, bill.tablename, hti.indexdesc
|
select bill.id, bill.tablename, hti.indexdesc
|
||||||
from workflow_bill bill
|
from workflow_bill bill
|
||||||
left join htmllabelindex hti on hti.id = bill.namelabel
|
left join htmllabelindex hti on hti.id = bill.namelabel
|
||||||
|
@ -74,7 +75,7 @@ where bill.id < 0
|
||||||
|
|
||||||
-- 流程节点信息视图
|
-- 流程节点信息视图
|
||||||
create
|
create
|
||||||
or replace view workflow_node_info_view as
|
or replace view workflow_node_info_view as
|
||||||
select distinct nb.id,
|
select distinct nb.id,
|
||||||
nb.nodename,
|
nb.nodename,
|
||||||
(case when wb.version is null then 1 else wb.version end) version,
|
(case when wb.version is null then 1 else wb.version end) version,
|
||||||
|
|
Loading…
Reference in New Issue