Compare commits
6 Commits
d5b0805ea5
...
e53858e7c6
Author | SHA1 | Date |
---|---|---|
youHong.ai | e53858e7c6 | |
youHong.ai | af35223154 | |
wangxuanran | b1340f0b8e | |
wangxuanran | 31286babb2 | |
youHong.ai | 6f1e24a274 | |
wangxuanran | 19e724b59d |
|
@ -30,7 +30,7 @@ public abstract class CusBaseAction implements Action {
|
|||
/**
|
||||
* 全局requestInfo对象
|
||||
*/
|
||||
protected RequestInfo requestInfo;
|
||||
protected RequestInfo globalRequestInfo;
|
||||
|
||||
/**
|
||||
* <h2>初始化流程默认的处理方法</h2>
|
||||
|
@ -49,7 +49,7 @@ public abstract class CusBaseAction implements Action {
|
|||
|
||||
@Override
|
||||
public final String execute(RequestInfo requestInfo) {
|
||||
this.requestInfo = requestInfo;
|
||||
this.globalRequestInfo = requestInfo;
|
||||
RequestManager requestManager = requestInfo.getRequestManager();
|
||||
String billTable = requestManager.getBillTableName();
|
||||
String requestId = requestInfo.getRequestid();
|
||||
|
@ -111,8 +111,6 @@ public abstract class CusBaseAction implements Action {
|
|||
return true;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
||||
/**
|
||||
* <h2>流程其他流转类型处理方法注册</h2>
|
||||
|
@ -199,9 +197,26 @@ public abstract class CusBaseAction implements Action {
|
|||
*
|
||||
* @return 流程主表数据
|
||||
*/
|
||||
@Deprecated
|
||||
protected Map<String, String> getMainTableValue() {
|
||||
// 获取主表数据
|
||||
Property[] propertyArr = globalRequestInfo.getMainTableInfo().getProperty();
|
||||
return getStringMap(propertyArr);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>获取流程主表数据</h2>
|
||||
*
|
||||
* @return 流程主表数据
|
||||
*/
|
||||
protected Map<String, String> getMainTableValue(RequestInfo requestInfo) {
|
||||
// 获取主表数据
|
||||
Property[] propertyArr = requestInfo.getMainTableInfo().getProperty();
|
||||
return getStringMap(propertyArr);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Map<String, String> getStringMap(Property[] propertyArr) {
|
||||
if (null == propertyArr) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
@ -220,8 +235,25 @@ public abstract class CusBaseAction implements Action {
|
|||
*
|
||||
* @return 以明细表需要为键,以明细表数据为值的键值对明细数据信息
|
||||
*/
|
||||
@Deprecated
|
||||
protected Map<String, List<Map<String, String>>> getDetailTableValue() {
|
||||
DetailTable[] detailTableArr = globalRequestInfo.getDetailTableInfo().getDetailTable();
|
||||
return getListMap(detailTableArr);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>获取所有明细数据</h2>
|
||||
*
|
||||
* @return 以明细表需要为键,以明细表数据为值的键值对明细数据信息
|
||||
*/
|
||||
protected Map<String, List<Map<String, String>>> getDetailTableValue(RequestInfo requestInfo) {
|
||||
DetailTable[] detailTableArr = requestInfo.getDetailTableInfo().getDetailTable();
|
||||
return getListMap(detailTableArr);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
private Map<String, List<Map<String, String>>> getListMap(DetailTable[] detailTableArr) {
|
||||
Map<String, List<Map<String, String>>> detailDataList = new HashMap<>((int) Math.ceil(detailTableArr.length * 1.4));
|
||||
for (DetailTable detailTable : detailTableArr) {
|
||||
List<Map<String, String>> detailData = getDetailValue(detailTable);
|
||||
|
@ -237,10 +269,21 @@ public abstract class CusBaseAction implements Action {
|
|||
* @param detailNo 明细表编号
|
||||
* @return 明细数据
|
||||
*/
|
||||
@Deprecated
|
||||
protected List<Map<String, String>> getDetailTableValueByDetailNo(int detailNo) {
|
||||
DetailTable detailTable = globalRequestInfo.getDetailTableInfo().getDetailTable(detailNo);
|
||||
return getDetailValue(detailTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>获取指定明细表的表数据</h2>
|
||||
*
|
||||
* @param detailNo 明细表编号
|
||||
* @return 明细数据
|
||||
*/
|
||||
protected List<Map<String, String>> getDetailTableValueByDetailNo(int detailNo, RequestInfo requestInfo) {
|
||||
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(detailNo);
|
||||
List<Map<String, String>> detailData = getDetailValue(detailTable);
|
||||
return detailData;
|
||||
return getDetailValue(detailTable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.api.youhong.ai.pcn.organization.orgchart.mapper;
|
||||
|
||||
import aiyh.utils.annotation.recordset.CaseConversion;
|
||||
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||
import aiyh.utils.annotation.recordset.Select;
|
||||
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||
|
@ -45,7 +44,7 @@ public interface OrgChartMapper {
|
|||
" inner join hrmjobtitles job on hrm.JOBTITLE = job.id " +
|
||||
" inner join cus_fielddata cus on cus.ID = hrm.ID " +
|
||||
" and cus.SCOPE = 'HrmCustomFieldByInfoType' " +
|
||||
" and cus.SCOPEID = -1 " +
|
||||
" and cus.SCOPEID = 1 " +
|
||||
" inner join hrmdepartment dept on dept.id = hrm.DEPARTMENTID " +
|
||||
"where hrm.status in (0, 1)")
|
||||
List<HrmResource> selectAll(@ParamMapper("typeOfEmploymentFiled") String typeOfEmploymentField,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.api.youhong.ai.pcn.organization.orgchart.service;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.api.youhong.ai.pcn.organization.orgchart.dto.HrmResourceDto;
|
||||
import com.api.youhong.ai.pcn.organization.orgchart.mapper.OrgChartMapper;
|
||||
|
@ -45,28 +46,17 @@ public class OrgChartService {
|
|||
String lastNameEnField = Util.getCusConfigValue("lastNameEnField");
|
||||
Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!");
|
||||
List<HrmResource> hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField);
|
||||
if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) {
|
||||
throw new CustomerException("查询不到相关人员!");
|
||||
}
|
||||
//List<HrmResourceDto> hrmResourceDtoList = new ArrayList();
|
||||
AtomicReference<HrmResourceDto> currentUser = new AtomicReference<>();
|
||||
/* ******************* 将pojo转换为Dto对象,对节点属性默认值赋值,找出当前用户并设置显示 ******************* */
|
||||
List<HrmResourceDto> hrmResourceDtoList = hrmResourceList.stream()
|
||||
.map(struct::hrmResourceToDto)
|
||||
.peek(item -> Builder.startSet(item)
|
||||
.with(HrmResourceDto::setShow, 0)
|
||||
.with(HrmResourceDto::setShowBrother, 0)
|
||||
.with(HrmResourceDto::setShowChildren, 0)
|
||||
.endSet())
|
||||
.collect(Collectors.toList());
|
||||
hrmResourceDtoList.stream()
|
||||
.filter(item -> item.getId() == userId)
|
||||
.forEach(item -> {
|
||||
Builder.startSet(item)
|
||||
.with(HrmResourceDto::setShow, 1)
|
||||
.with(HrmResourceDto::setShowBrother, 1)
|
||||
.with(HrmResourceDto::setShowChildren, 1)
|
||||
.with(HrmResourceDto::setCurrent, true)
|
||||
.endSet();
|
||||
currentUser.set(item);
|
||||
});
|
||||
List<HrmResourceDto> hrmResourceDtoList = hrmResourceList.stream().map(struct::hrmResourceToDto).peek(item -> Builder.startSet(item).with(HrmResourceDto::setShow, 0).with(HrmResourceDto::setShowBrother, 0).with(HrmResourceDto::setShowChildren, 0).endSet()).collect(Collectors.toList());
|
||||
hrmResourceDtoList.stream().filter(item -> item.getId() == userId).forEach(item -> {
|
||||
Builder.startSet(item).with(HrmResourceDto::setShow, 1).with(HrmResourceDto::setShowBrother, 1).with(HrmResourceDto::setShowChildren, 1).with(HrmResourceDto::setCurrent, true).endSet();
|
||||
currentUser.set(item);
|
||||
});
|
||||
Assert.notNull(currentUser, "not find current login user info!");
|
||||
/* ******************* 查找当前登陆人员的所有上级 ******************* */
|
||||
String currentUserManagerStr = currentUser.get().getManagerStr();
|
||||
|
@ -74,16 +64,9 @@ public class OrgChartService {
|
|||
currentUserManagerStr = "";
|
||||
}
|
||||
currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ",");
|
||||
List<Integer> currentUserManagerList = Arrays.stream(currentUserManagerStr.split(","))
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList());
|
||||
List<Integer> currentUserManagerList = Arrays.stream(currentUserManagerStr.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
/* ******************* 对当前用户的所有直接上级设置标识 ******************* */
|
||||
hrmResourceDtoList.stream()
|
||||
.filter(item -> currentUserManagerList.contains(item.getId()))
|
||||
.forEach(item -> Builder.startSet(item)
|
||||
.with(HrmResourceDto::setShowChildren, 1)
|
||||
.with(HrmResourceDto::setCurrentParent, true)
|
||||
.endSet());
|
||||
hrmResourceDtoList.stream().filter(item -> currentUserManagerList.contains(item.getId())).forEach(item -> Builder.startSet(item).with(HrmResourceDto::setShowChildren, 1).with(HrmResourceDto::setCurrentParent, true).endSet());
|
||||
|
||||
/* ******************* 查询当前用户的是否全部展示或显示小红点的配置信息 ******************* */
|
||||
ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId);
|
||||
|
@ -92,34 +75,21 @@ public class OrgChartService {
|
|||
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
||||
orgChartNodeVoList = hrmResourceDtoList.stream()
|
||||
.map(struct::hrmResourceDtoToVo)
|
||||
.peek(item -> item.setType(-1))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
|
||||
orgChartNodeVoList = hrmResourceDtoList.stream()
|
||||
.map(struct::hrmResourceDtoToVo)
|
||||
.peek(item -> {
|
||||
if (showPointOrAll.isShowAll()) {
|
||||
Builder.startSet(item)
|
||||
.with(OrgChartNodeVo::setShow, 1)
|
||||
.with(OrgChartNodeVo::setShowBrother, 1)
|
||||
.with(OrgChartNodeVo::setShowChildren, 1)
|
||||
.endSet();
|
||||
}
|
||||
if (!showPointOrAll.isShowType()) {
|
||||
item.setType(-1);
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
orgChartNodeVoList = hrmResourceDtoList.stream().map(struct::hrmResourceDtoToVo).peek(item -> {
|
||||
if (showPointOrAll.isShowAll()) {
|
||||
Builder.startSet(item).with(OrgChartNodeVo::setShow, 1).with(OrgChartNodeVo::setShowBrother, 1).with(OrgChartNodeVo::setShowChildren, 1).endSet();
|
||||
}
|
||||
if (!showPointOrAll.isShowType()) {
|
||||
item.setType(-1);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId,
|
||||
OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren,
|
||||
OrgChartNodeVo::setChildren,
|
||||
parentId -> parentId == null || parentId <= 0)
|
||||
.stream()
|
||||
.peek(item -> item.setIsRoot(true))
|
||||
.peek(item -> recursionChildrenNums(item, 0))
|
||||
.collect(Collectors.toList());
|
||||
return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId, OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren, parentId -> parentId == null || parentId <= 0).stream().peek(item -> item.setIsRoot(true)).peek(item -> recursionChildrenNums(item, 0)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,4 +34,14 @@ public class MultipartFile {
|
|||
* 文件大小
|
||||
*/
|
||||
Long fileSize;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Integer imageFileId;
|
||||
|
||||
/**
|
||||
* docId
|
||||
*/
|
||||
private Integer docId;
|
||||
}
|
||||
|
|
|
@ -537,7 +537,12 @@ public class DealWithMapping extends ToolUtil {
|
|||
* @param mainMap 主表数据结果集
|
||||
* @param detailMap 明细数据结果集
|
||||
* @param mappingDetail 配置节点信息
|
||||
* @return
|
||||
*
|
||||
* <h1>代码版本改动说明:</h1>
|
||||
* <p>
|
||||
* v2.0 xuanran.wang 转换类型是默认值时增加替换规则
|
||||
* 将自定义文本中的{?requestid}替换成requestid 以及将 ? 替换成选择的流程字段对应的值
|
||||
* <p>
|
||||
*/
|
||||
private Object normalValueDeal(Map<String, Object> mainMap, Map<String, Object> detailMap, MappingDetail mappingDetail) {
|
||||
|
||||
|
@ -563,7 +568,19 @@ public class DealWithMapping extends ToolUtil {
|
|||
break;
|
||||
// 默认值
|
||||
case DEFAULT_VALUE: {
|
||||
value = valueContext;
|
||||
FieldMessage fieldMassage = mappingDetail.getFieldMassage();
|
||||
String workFlowVal = "";
|
||||
if(fieldMassage != null){
|
||||
String fieldName = fieldMassage.getFieldName().toLowerCase();
|
||||
if ("1".equals(childSource)) {
|
||||
workFlowVal = Util.null2String(detailMap.get(fieldName));
|
||||
} else if ("0".equals(childSource)) {
|
||||
workFlowVal = Util.null2String(mainMap.get(fieldName));
|
||||
}
|
||||
}
|
||||
value = Util.null2String(valueContext)
|
||||
.replace("{?requestid}", String.valueOf(mainMap.get("requestid")))
|
||||
.replace("?", workFlowVal);
|
||||
}
|
||||
break;
|
||||
// 当前时间
|
||||
|
@ -778,7 +795,12 @@ public class DealWithMapping extends ToolUtil {
|
|||
* @param detailMap 明细数据结果集
|
||||
* @param mappingDetail 配置节点信息
|
||||
* @param relationRs 关联流程数据集合
|
||||
* @return
|
||||
*
|
||||
* <h1>代码版本改动说明:</h1>
|
||||
* <p>
|
||||
* v2.0 xuanran.wang 转换类型是默认值时增加替换规则
|
||||
* 将自定义文本中的{?requestid}替换成requestid 以及将 ? 替换成选择的流程字段对应的值
|
||||
* <p>
|
||||
*/
|
||||
private Object normalValueDeal(Map<String, Object> mainMap, Map<String, Object> detailMap, RecordSet relationRs, MappingDetail mappingDetail) {
|
||||
String paramType = mappingDetail.getParamType();
|
||||
|
@ -810,7 +832,24 @@ public class DealWithMapping extends ToolUtil {
|
|||
break;
|
||||
// 默认值
|
||||
case DEFAULT_VALUE: {
|
||||
value = valueContext;
|
||||
FieldMessage fieldMassage = mappingDetail.getFieldMassage();
|
||||
String workFlowVal = "";
|
||||
if(fieldMassage != null){
|
||||
String fieldName = fieldMassage.getFieldName().toLowerCase();
|
||||
if ("1".equals(childSource)) {
|
||||
workFlowVal = Util.null2String(detailMap.get(fieldName));
|
||||
} else if ("0".equals(childSource)) {
|
||||
workFlowVal = Util.null2String(mainMap.get(fieldName));
|
||||
} else {
|
||||
workFlowVal = Util.null2String(relationRs.getString(fieldName));
|
||||
}
|
||||
if ("rootNode".equals(mappingDetail.getBelongTo()) && "2".equals(childSource)) {
|
||||
workFlowVal = Util.null2String(tempRs.getString(fieldName));
|
||||
}
|
||||
}
|
||||
value = Util.null2String(valueContext)
|
||||
.replace("{?requestid}", String.valueOf(mainMap.get("requestid")))
|
||||
.replace("?", workFlowVal);
|
||||
}
|
||||
break;
|
||||
// 当前时间
|
||||
|
@ -893,6 +932,8 @@ public class DealWithMapping extends ToolUtil {
|
|||
MultipartFile multipartFile = new MultipartFile();
|
||||
InputStream fileInputStream = ImageFileManager.getInputStreamById(docImageFile.getImageFileId());
|
||||
multipartFile.setFileKey(paramName);
|
||||
multipartFile.setImageFileId(docImageFile.getImageFileId());
|
||||
multipartFile.setDocId(docImageFile.getDocId());
|
||||
multipartFile.setStream(fileInputStream);
|
||||
multipartFile.setFileName(docImageFile.getImageFileName());
|
||||
multipartFile.setFileSize(docImageFile.getFileSize() / 1024);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class PushSealTaskAction extends CusBaseAction {
|
|||
}
|
||||
}catch (Exception e){
|
||||
trans.rollback();
|
||||
throw new CustomerException(e.getMessage());
|
||||
throw new CustomerException(Util.logStr("执行提交方法异常:{}", e.getMessage()));
|
||||
}
|
||||
trans.commit();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
package weaver.xuanran.wang.schroeder.cus_field_value;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
|
||||
import weaver.zwl.common.ToolUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <h1></h1>
|
||||
|
@ -11,12 +20,52 @@ import java.util.Map;
|
|||
* @Date 2022/12/2 16:10
|
||||
*/
|
||||
public class PushSealTaskSealValue implements CusInterfaceGetValue {
|
||||
private final ToolUtil toolUtil = new ToolUtil();
|
||||
|
||||
private final Logger logger = Util.getLogger();
|
||||
|
||||
@Override
|
||||
public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) {
|
||||
logger.info(Util.logStr("路径参数:[{}]", JSONObject.toJSONString(pathParam)));
|
||||
// 接口字段
|
||||
String sealSnField = pathParam.get("sealSnField");
|
||||
String sealNumField = pathParam.get("sealNumField");
|
||||
return null;
|
||||
// 表单字段
|
||||
String workFlowSealNumField = pathParam.get("workFlowSealNumField");
|
||||
String workFlowSealSnField = pathParam.get("workFlowSealSnField");
|
||||
// 自定义sql业务印章类型
|
||||
String sealSnCusSql = pathParam.get("sealSnCusSql");
|
||||
// 使用次数
|
||||
String sealNumCusSql = pathParam.get("sealNumCusSql");
|
||||
// 非空校验
|
||||
if(checkBlank(sealSnField, sealNumField, sealSnCusSql, sealNumCusSql, workFlowSealNumField, workFlowSealSnField)){
|
||||
throw new CustomerException(Util.logStr("自定义类路径中必要参数为空,请检查!当前pathParam : {}", JSONObject.toJSONString(pathParam)));
|
||||
}
|
||||
// 表单印章使用类型值
|
||||
String sealSnVal = Util.null2String(String.valueOf(detailMap.get(sealSnField)),"");
|
||||
// 如果为空返回空集合
|
||||
if(StringUtils.isBlank(sealSnVal)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ArrayList<Map<String, Object>> list = new ArrayList<>();
|
||||
logger.info(Util.logStr("当前值 : {}", currentValue));
|
||||
int detailId = -1;
|
||||
if(MapUtils.isNotEmpty(detailMap)){
|
||||
detailId = Util.getIntValue(String.valueOf(detailMap.get("id")), -1);
|
||||
}
|
||||
for (String val : sealSnVal.split(",")) {
|
||||
// 印章类型转换执行自定义sql
|
||||
String inSealVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealSnCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),"");
|
||||
String inSealNumVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealNumCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),"");
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put(sealSnField, inSealVal);
|
||||
map.put(sealNumField, inSealNumVal);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean checkBlank(String ... args){
|
||||
return Arrays.stream(args).noneMatch(StringUtils::isBlank);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ public class SchroederQRCodeService {
|
|||
log.info(Util.logStr("this response is [{}]", responeVo.getEntityString()));
|
||||
try {
|
||||
response = responeVo.getEntityMap();
|
||||
log.info(Util.logStr("接口响应:{}", JSONObject.toJSONString(response)));
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error(Util.logStr("push data error, can not parse response to map," +
|
||||
"this response is [{}], url is [{}],request params is [{}], request heard is [{}];",
|
||||
|
|
|
@ -195,7 +195,7 @@ public class TestOrganization extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testOrgChart() {
|
||||
User user = new User(88);
|
||||
User user = new User(84);
|
||||
OrgChartService orgChartService = new OrgChartService();
|
||||
List<OrgChartNodeVo> orgChartTree = orgChartService.getOrgChartTree(user);
|
||||
System.out.println(JSON.toJSONString(orgChartTree));
|
||||
|
|
Loading…
Reference in New Issue