Compare commits

...

2 Commits

15 changed files with 1622 additions and 1289 deletions

22
pom.xml
View File

@ -64,7 +64,18 @@
<artifactId>junit</artifactId>
<version>4.12</version>
</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 -->
<dependency>
@ -80,12 +91,11 @@
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.4.0</version>
</dependency>
</dependencies>

View File

@ -10,12 +10,12 @@ import lombok.Data;
*/
@Data
public class DocImageInfo {
private Integer docId;
private Integer imageFileId;
private String imageFileName;
private Integer id;
private Integer detailId;
private Integer fileSize;
private Integer docId;
private Integer imageFileId;
private String imageFileName;
private Integer id;
private Integer detailId;
private Integer fileSize;
private Integer docFileType;
}

View File

@ -4,6 +4,7 @@ package aiyh.utils.httpUtil;
import aiyh.utils.Util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -133,7 +134,11 @@ public class ResponeVo implements HttpResponse {
ObjectMapper mapper = new ObjectMapper();
this.entityMap = mapper.readValue(this.getEntityString(), Map.class);
} 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) {
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

View File

@ -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}")
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);
@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);

View File

@ -4,6 +4,7 @@ import aiyh.utils.Util;
import aiyh.utils.action.SafeCusBaseAction;
import aiyh.utils.annotation.*;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Strings;
import ebu7common.youhong.ai.bean.Builder;
import lombok.Getter;
@ -12,6 +13,7 @@ import lombok.ToString;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
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 java.util.*;
@ -31,7 +33,7 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
@RequiredMark("流程条件赋值配置表唯一标识字段值")
@PrintParamMark
@ActionDefaultTestValue("test")
@ActionDefaultTestValue("getdata")
private String onlyMark;
@ActionOptionalParam(desc = "条件修改所在明细表,1-明细12-明细2", value = "")
@ -54,14 +56,15 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
try {
Map<String, Object> workflowData = new HashMap<>(16);
Map<String, Object> workflowMainData = super.getObjMainTableValue(requestInfo);
ConditionsSetValueConfigMain conditionsSetValueConfigMain = service.getConditionConfigMain(onlyMark);
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);
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("_user_", user);
workflowData.put("_workflowId_", workflowId);
@ -71,7 +74,7 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
List<UpdateDetailRowDto> detail = new ArrayList<>();
for (Map<String, Object> detailDatum : detailData) {
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);
if (!Objects.isNull(mainConditions) && !mainConditions.isEmpty()) {
main.add(Builder.builder(UpdateDetailRowDto::new)
@ -89,6 +92,8 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
.build());
}
}
log.info("条件值: " + JSON.toJSONString(main));
log.info("条件值: " + JSON.toJSONString(detail));
service.updateWorkflowDetailData(main, billTable, null);
service.updateWorkflowDetailData(detail, billTable + "_dt" + detailNo, detailNo);
} catch (Exception e) {
@ -101,6 +106,8 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
}
public void submitWorkflow(String requestId, Integer userId) {
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "邮件发送附件提交流程!");
if (Boolean.parseBoolean(submitAction)) {
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "流程条件赋值提交流程!");
}
}
}

View File

@ -2,6 +2,7 @@ package weaver.youhong.ai.pcn.actioin.conditionssetvalue.service;
import aiyh.utils.Util;
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.UpdateDetailRowDto;
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity.ConditionItem;
@ -28,17 +29,13 @@ public class WorkflowConditionsSetValueService {
/**
* <h2></h2>
*
* @param onlyMark
* @param workflowData
* @param conditionsSetValueConfigMain
* @param workflowData
* @return
*/
public Map<String, Map<String, Object>> getConditionsValue(String onlyMark, Map<String, Object> workflowData) {
/* ******************* 查询配置表 ******************* */
ConditionsSetValueConfigMain conditionsSetValueConfigMain = mapper.selectConfigByOnlyMark(onlyMark);
Assert.notNull(conditionsSetValueConfigMain, "can not query configuration by onlyMark [{}]", onlyMark);
public Map<String, Map<String, Object>> getConditionsValue(ConditionsSetValueConfigMain conditionsSetValueConfigMain, Map<String, Object> workflowData) {
List<ConditionItem> conditionItemList = conditionsSetValueConfigMain.getConditionItemList();
Assert.notEmpty(conditionItemList, "can not query conditionItemList by onlyMark [{}]", onlyMark);
/* ******************* 映射规则处理 ,责任链初始化 ******************* */
ConditionsTypeTreatment conditionsTypeTreatment = new ConditionsTypeTreatment(
new ConditionsTreatment(
@ -68,6 +65,16 @@ public class WorkflowConditionsSetValueService {
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>
*
@ -94,6 +101,9 @@ public class WorkflowConditionsSetValueService {
StringBuilder sb = new StringBuilder("update ");
sb.append(billTable).append(" set ");
for (Map.Entry<String, Object> entry : updateBatchData.get(0).entrySet()) {
if (entry.getKey().equals("_id_")) {
continue;
}
sb.append(entry.getKey())
.append(" = #{item.")
.append(entry.getKey())

View File

@ -51,6 +51,7 @@ public class ValueSetRulesTreatment {
return Builder.builder(ConditionValueDto::new)
.with(ConditionValueDto::setFieldName, conditionItem.getTargetField().getFieldName())
.with(ConditionValueDto::setValue, value)
.with(ConditionValueDto::setTableName, conditionItem.getTargetField().getTableName())
.build();
}

View File

@ -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, ","));
}
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -20,4 +20,10 @@ public class TestHaRiPiJiu extends BaseTest {
GenerateFileUtil.createActionDocument(VoucherPayableAction.class);
GenerateFileUtil.createActionDocument(ReceiptAndPaymentAction.class);
}
@Test
public void test1() {
}
}

View File

@ -8,6 +8,7 @@ import com.engine.hrm.service.impl.RolesMembersServiceImpl;
import org.junit.Test;
import weaver.hrm.User;
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.addrolemember.RegisterRoleMemberCronJob;
@ -75,6 +76,6 @@ public class RolesTest extends BaseTest {
@Test
public void generateFile() {
GenerateFileUtil.createActionDocument(WorkflowConditionsSetValueAction.class);
GenerateFileUtil.createActionDocument(GenerateLoginIdAction.class);
}
}

View File

@ -1,6 +1,6 @@
-- 流程类型视图,可用于数据集成或流览按钮
create
or replace view workflow_type_info_view as
or replace view workflow_type_info_view as
select wb.id,
wb.workflowname,
wt.typename,
@ -11,7 +11,7 @@ from workflow_base wb
-- 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名
create
or replace view workflow_table_view as
or replace view workflow_table_view as
select base.id,
base.workflowname,
base.formid,
@ -22,7 +22,7 @@ from workflow_bill bill
-- 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框
create
or replace view workflow_detail_table_view as
or replace view workflow_detail_table_view as
select CONCAT(bill.id, '-', base.id) id,
bill.id bill_id,
base.id workflow_id,
@ -34,7 +34,7 @@ from workflow_billdetailtable bill
-- 流程和建模字段视图更具流程和建模的billid可以查询流程和建模中的字段信息
create
or replace view workflow_field_table_view as
or replace view workflow_field_table_view as
select wb.id,
wb.fieldname,
concat(ht.indexdesc, '', wb.fieldname) indexdesc,
@ -59,13 +59,14 @@ select wb.id,
when wb.FIELDHTMLTYPE = '3' then '流览框'
when wb.FIELDHTMLTYPE = '4' then 'check框'
when wb.FIELDHTMLTYPE = '5' then '选择框'
else '附件上传' end) fieldhtmltype
else '附件上传' end) fieldhtmltype,
wb.FIELDHTMLTYPE fieldtype
from workflow_billfield wb
left join htmllabelindex ht on wb.fieldlabel = ht.id;
-- 建模表信息视图
create
or replace view mode_bill_info_view as
or replace view mode_bill_info_view as
select bill.id, bill.tablename, hti.indexdesc
from workflow_bill bill
left join htmllabelindex hti on hti.id = bill.namelabel
@ -74,7 +75,7 @@ where bill.id < 0
-- 流程节点信息视图
create
or replace view workflow_node_info_view as
or replace view workflow_node_info_view as
select distinct nb.id,
nb.nodename,
(case when wb.version is null then 1 else wb.version end) version,