diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js
index f99dbcc..cfa92e8 100644
--- a/javascript/youhong.ai/pcn/workflow_code_block.js
+++ b/javascript/youhong.ai/pcn/workflow_code_block.js
@@ -688,15 +688,15 @@ $(() => {
$(() => {
const config = [{
// 源字段
- sourceField: '',
+ sourceField: 'htksrq',
// 目标字段
- targetField: '',
+ targetField: 'htjsrq',
// 日期加月份字段
- numberField: ''
+ numberField: 'contractperiod'
}, {
- sourceField: '',
- targetField: '',
- numberField: ''
+ sourceField: 'syqksrq',
+ targetField: 'syqjsrq',
+ numberField: 'probationperiod'
}]
runJs();
@@ -711,22 +711,25 @@ $(() => {
let fieldId = WfForm.convertFieldNameToId(configItem.numberField)
WfForm.bindFieldChangeEvent(fieldId, (obj, id, value) => {
if ("" == value) {
- WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField, {value: ""}))
+ WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField), {value: ""})
return
}
let sourceValue = WfForm.getFieldValue(WfForm.convertFieldNameToId(configItem.sourceField));
+ if ("" == sourceValue) {
+ setTimeout(() => {
+ WfForm.changeFieldValue(fieldId, {value: ""})
+ }, 10)
+ }
let date = new Date(sourceValue)
date.setMonth(date.getMonth() + +value)
- let objectDate = new Date();
-
-
- let day = objectDate.getDate();
- let month = objectDate.getMonth() + 1;
- let year = objectDate.getFullYear();
- WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField, {
+ let day = date.getDate();
+ let month = date.getMonth() + 1;
+ let year = date.getFullYear();
+ WfForm.changeFieldValue(WfForm.convertFieldNameToId(configItem.targetField), {
value: `${year}-${fullNum(month)}-${fullNum(day)}`
- }))
+ })
})
+
}
function fullNum(i) {
diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java
index fd7046e..3034c62 100644
--- a/src/main/java/aiyh/utils/Util.java
+++ b/src/main/java/aiyh/utils/Util.java
@@ -4020,4 +4020,30 @@ public class Util extends weaver.general.Util {
return filePath;
}
+ public static String createTempFile(InputStream inputStream, String imageFileName) {
+ String filePath = getTempFilePath("ofd", imageFileName);
+ try {
+ writeToFile(inputStream, filePath);
+ } catch (IOException e) {
+ throw new CustomerException("create temp file error!", e);
+ }
+ return filePath;
+ }
+
+ public static void writeToFile(InputStream inputStream, String filePath) throws IOException {
+ Path path = Paths.get(filePath);
+ Path parentDir = path.getParent();
+ if (parentDir != null) {
+ Files.createDirectories(parentDir);
+ }
+ Files.createFile(path);
+
+ try (FileOutputStream outputStream = new FileOutputStream(filePath)) {
+ byte[] buffer = new byte[8192];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ }
+ }
}
diff --git a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java
index dbf0b05..92cdf9f 100644
--- a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java
+++ b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java
@@ -64,6 +64,7 @@ public abstract class SafeCusBaseAction implements Action {
}
try {
Util.verifyRequiredField(this);
+ log.info("action trigger by " + src);
if (!Strings.isNullOrEmpty(src)) {
src = "submit";
}
diff --git a/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java b/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java
index b6d62af..02180af 100644
--- a/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java
+++ b/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java
@@ -140,7 +140,7 @@ public class PdfUtil {
FileOutputStream outputStreamTem;
try {
outputStreamTem = new FileOutputStream(tempPath);
- } catch (FileNotFoundException e) {
+ } catch (Exception e) {
throw new CustomerException("创建临时文件流和路径转换失败!", e);
}
PdfStamper pdfStamper = null;
diff --git a/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java b/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java
index 8fdbd6f..e4f79e7 100644
--- a/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java
+++ b/src/main/java/com/api/youhong/ai/pcn/organization/orgchart/service/OrgChartService.java
@@ -27,258 +27,266 @@ import java.util.stream.Collectors;
*/
public class OrgChartService {
-
- private final OrgChartMapper mapper = Util.getMapper(OrgChartMapper.class);
-
- private final OrgChartMapStruct struct = OrgChartMapStruct.INSTANCE;
-
- /**
- *
获取人员组织架构图数据
- *
- * @param logInUser 当前登陆对象
- * @return 组织架构图数据
- * @author youHong.ai
- */
- public List getOrgChartTree(User logInUser) {
- int userId = logInUser.getUID();
- AtomicReference currentUser = new AtomicReference<>();
- List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
- /* ******************* 系统管理员默认全部展开哦 ******************* */
- if (userId == 1) {
- return systemAdminTree(hrmResourceDtoList);
- }
- filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
- /* ******************* 查询当前用户的是否全部展示或显示小红点的配置信息 ******************* */
- ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId);
- List orgChartNodeVoList = null;
- if (Objects.isNull(showPointOrAll)) {
- /* ******************* 转换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());
-
- }
- 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());
- }
-
-
- /**
- * getOrgChartTreeAll 获取所有的数据并默认展开
- * 2022/12/16 17:21
- * ************************************************************
- *
- * @param logInUser 当前登陆id
- * @return List 最终树
- * @author youHong.ai ******************************************
- */
- public List getOrgChartTreeAll(User logInUser) {
- int userId = logInUser.getUID();
- AtomicReference currentUser = new AtomicReference<>();
- List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
- /* ******************* 系统管理员默认全部展开哦 ******************* */
- if (userId == 1) {
- return systemAdminTree(hrmResourceDtoList);
- }
- filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
- List orgChartNodeVoList = null;
- /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
- orgChartNodeVoList = hrmResourceDtoList.stream()
- .map(struct::hrmResourceDtoToVo)
- .peek(item ->
- Builder.startSet(item)
- .with(OrgChartNodeVo::setShow, 1)
- .with(OrgChartNodeVo::setShowBrother, 1)
- .with(OrgChartNodeVo::setShowChildren, 1)
- .endSet()
- ).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());
- }
-
-
- /**
- * filterCurrentSubCom 过滤当前分部的人员,并且设置用户上级标识
- * 2022/12/16 17:16
- * ************************************************************
- *
- * @param hrmResourceDtoList 人力资源dtolist
- * @param currentUser 当前用户
- * @param logInUser 当前登陆用户
- * @author youHong.ai ******************************************
- */
- private void filterCurrentSubCom(List hrmResourceDtoList,
- AtomicReference currentUser,
- User logInUser) {
- Assert.notNull(currentUser.get(), "not find current login user info!");
- /* ******************* 根据当前登陆人的分部来过滤 ******************* */
- hrmResourceDtoList = hrmResourceDtoList.stream()
- .filter(item -> logInUser.getUserSubCompany1() == item.getSubCompanyId())
- .collect(Collectors.toList());
- /* ******************* 查找当前登陆人员的所有上级 ******************* */
- String currentUserManagerStr = currentUser.get().getManagerStr();
- if (Objects.isNull(currentUserManagerStr) || "".equals(currentUserManagerStr)) {
- currentUserManagerStr = "0";
- }
- currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ",");
- List 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());
-
- }
-
-
- /**
- * systemAdminTree 系统管理员返回全部展开的数据
- * 2022/12/16 17:15
- * ************************************************************
- *
- * @param hrmResourceDtoList 人力资源dtolist
- * @return List 树型list
- * @author youHong.ai ******************************************
- */
- private List systemAdminTree(List hrmResourceDtoList) {
- List collect = hrmResourceDtoList.stream()
- .map(struct::hrmResourceDtoToVo)
- .peek(item -> Builder.startSet(item)
- .with(OrgChartNodeVo::setShow, 1)
- .with(OrgChartNodeVo::setShowBrother, 1)
- .with(OrgChartNodeVo::setShowChildren, 1)
- .with(OrgChartNodeVo::setCurrent, true)
- .endSet())
- .collect(Collectors.toList());
- return Util.listToTree(collect, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId,
- OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren,
- parentId -> parentId == null || parentId <= 0)
- .stream().peek(item -> Builder.startSet(item)
- .with(OrgChartNodeVo::setIsRoot, true)
- .with(OrgChartNodeVo::setCurrent, true)
- .endSet())
- .peek(item -> recursionChildrenNums(item, 0))
- .collect(Collectors.toList());
- }
-
- /**
- * getHrmResourceDtoList 获取人力资源dto对象list
- * 2022/12/16 17:09
- * ************************************************************
- *
- * @param userId 当前登陆用户ID
- * @param currentUser 当前登陆用户对象
- * @return List 人力资源dto对象list
- * @author youHong.ai ******************************************
- */
- private List getHrmResourceDtoList(Integer userId, AtomicReference currentUser) {
- // 人员类型自定义字段
- String typeOfEmploymentField = Util.getCusConfigValue("typeOfEmploymentField");
- Assert.notBlank(typeOfEmploymentField, "config [typeOfEmploymentField] is null or blank!");
- // 英文自定义名称字段
- String lastNameEnField = Util.getCusConfigValue("lastNameEnField");
- Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!");
- // 人员类型id字段 建模表
- String typeOfEmploymentIdField = Util.getCusConfigValue("typeOfEmploymentIdField");
- Assert.notBlank(typeOfEmploymentIdField, "config [typeOfEmploymentIdField] is null or blank!");
- // 人员类型父级字段 建模表
- String parentField = Util.getCusConfigValue("parentField");
- Assert.notBlank(parentField, "config [parentField] is null or blank!");
- // 人员类型建模表表名
- String typeOfEmploymentTable = Util.getCusConfigValue("typeOfEmploymentTable");
- Assert.notBlank(typeOfEmploymentTable, "config [typeOfEmploymentTable] is null or blank!");
- // 查询所有人员信息
- List hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField,
- typeOfEmploymentTable, parentField, typeOfEmploymentIdField);
- if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) {
- throw new CustomerException("查询不到相关人员!");
- }
- //List hrmResourceDtoList = new ArrayList();
- /* ******************* 将pojo转换为Dto对象,对节点属性默认值赋值,找出当前用户并设置显示 ******************* */
- List 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()
- .peek(item -> {
- if (Objects.equals(item.getManagerId(), userId)) {
- item.setShow(1);
- }
- })
- .filter(item -> Objects.equals(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);
- });
- return hrmResourceDtoList;
- }
-
- /**
- * 计算节点所有子节点的数量
- * 2022/12/3 17:55
- * ******************************************
- *
- * @param chartNodeVo 节点对象
- * @return Integer 对应节点的所有子节点的数量
- * @author youHong.ai ******************************************
- */
- private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) {
- List children = chartNodeVo.getChildren();
- if (Objects.isNull(children) || children.size() == 0) {
- chartNodeVo.setChildrenNum(0);
- return 0;
- }
- n += children.size();
- for (OrgChartNodeVo child : children) {
- child.setChildrenNum(recursionChildrenNums(child, 0));
- n += child.getChildrenNum();
- }
- chartNodeVo.setChildrenNum(n);
- return n;
- }
-
+
+ private final OrgChartMapper mapper = Util.getMapper(OrgChartMapper.class);
+
+ private final OrgChartMapStruct struct = OrgChartMapStruct.INSTANCE;
+
+ /**
+ * 获取人员组织架构图数据
+ *
+ * @param logInUser 当前登陆对象
+ * @return 组织架构图数据
+ * @author youHong.ai
+ */
+ public List getOrgChartTree(User logInUser) {
+ int userId = logInUser.getUID();
+ AtomicReference currentUser = new AtomicReference<>();
+ List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
+ /* ******************* 系统管理员默认全部展开哦 ******************* */
+ if (userId == 1) {
+ return systemAdminTree(hrmResourceDtoList);
+ }
+ filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
+ /* ******************* 查询当前用户的是否全部展示或显示小红点的配置信息 ******************* */
+ ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId);
+ List orgChartNodeVoList = null;
+ if (Objects.isNull(showPointOrAll)) {
+ /* ******************* 转换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());
+
+ }
+ sortByNameFirstLetter(orgChartNodeVoList);
+ 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());
+ }
+
+ public static void sortByNameFirstLetter(List nodeList) {
+ nodeList.sort((node1, node2) -> {
+ String name1 = node1.getName();
+ String name2 = node2.getName();
+ return name1.compareToIgnoreCase(name2);
+ });
+ }
+
+ /**
+ * getOrgChartTreeAll 获取所有的数据并默认展开
+ * 2022/12/16 17:21
+ * ************************************************************
+ *
+ * @param logInUser 当前登陆id
+ * @return List 最终树
+ * @author youHong.ai ******************************************
+ */
+ public List getOrgChartTreeAll(User logInUser) {
+ int userId = logInUser.getUID();
+ AtomicReference currentUser = new AtomicReference<>();
+ List hrmResourceDtoList = getHrmResourceDtoList(userId, currentUser);
+ /* ******************* 系统管理员默认全部展开哦 ******************* */
+ if (userId == 1) {
+ return systemAdminTree(hrmResourceDtoList);
+ }
+ filterCurrentSubCom(hrmResourceDtoList, currentUser, logInUser);
+ List orgChartNodeVoList = null;
+ /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
+ orgChartNodeVoList = hrmResourceDtoList.stream()
+ .map(struct::hrmResourceDtoToVo)
+ .peek(item ->
+ Builder.startSet(item)
+ .with(OrgChartNodeVo::setShow, 1)
+ .with(OrgChartNodeVo::setShowBrother, 1)
+ .with(OrgChartNodeVo::setShowChildren, 1)
+ .endSet()
+ ).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());
+ }
+
+
+ /**
+ * filterCurrentSubCom 过滤当前分部的人员,并且设置用户上级标识
+ * 2022/12/16 17:16
+ * ************************************************************
+ *
+ * @param hrmResourceDtoList 人力资源dtolist
+ * @param currentUser 当前用户
+ * @param logInUser 当前登陆用户
+ * @author youHong.ai ******************************************
+ */
+ private void filterCurrentSubCom(List hrmResourceDtoList,
+ AtomicReference currentUser,
+ User logInUser) {
+ Assert.notNull(currentUser.get(), "not find current login user info!");
+ /* ******************* 根据当前登陆人的分部来过滤 ******************* */
+ hrmResourceDtoList = hrmResourceDtoList.stream()
+ .filter(item -> logInUser.getUserSubCompany1() == item.getSubCompanyId())
+ .collect(Collectors.toList());
+ /* ******************* 查找当前登陆人员的所有上级 ******************* */
+ String currentUserManagerStr = currentUser.get().getManagerStr();
+ if (Objects.isNull(currentUserManagerStr) || "".equals(currentUserManagerStr)) {
+ currentUserManagerStr = "0";
+ }
+ currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ",");
+ List 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());
+
+ }
+
+
+ /**
+ * systemAdminTree 系统管理员返回全部展开的数据
+ * 2022/12/16 17:15
+ * ************************************************************
+ *
+ * @param hrmResourceDtoList 人力资源dtolist
+ * @return List 树型list
+ * @author youHong.ai ******************************************
+ */
+ private List systemAdminTree(List hrmResourceDtoList) {
+ List collect = hrmResourceDtoList.stream()
+ .map(struct::hrmResourceDtoToVo)
+ .peek(item -> Builder.startSet(item)
+ .with(OrgChartNodeVo::setShow, 1)
+ .with(OrgChartNodeVo::setShowBrother, 1)
+ .with(OrgChartNodeVo::setShowChildren, 1)
+ .with(OrgChartNodeVo::setCurrent, true)
+ .endSet())
+ .collect(Collectors.toList());
+ return Util.listToTree(collect, OrgChartNodeVo::getId, OrgChartNodeVo::getManagerId,
+ OrgChartNodeVo::getChildren, OrgChartNodeVo::setChildren,
+ parentId -> parentId == null || parentId <= 0)
+ .stream().peek(item -> Builder.startSet(item)
+ .with(OrgChartNodeVo::setIsRoot, true)
+ .with(OrgChartNodeVo::setCurrent, true)
+ .endSet())
+ .peek(item -> recursionChildrenNums(item, 0))
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * getHrmResourceDtoList 获取人力资源dto对象list
+ * 2022/12/16 17:09
+ * ************************************************************
+ *
+ * @param userId 当前登陆用户ID
+ * @param currentUser 当前登陆用户对象
+ * @return List 人力资源dto对象list
+ * @author youHong.ai ******************************************
+ */
+ private List getHrmResourceDtoList(Integer userId, AtomicReference currentUser) {
+ // 人员类型自定义字段
+ String typeOfEmploymentField = Util.getCusConfigValue("typeOfEmploymentField");
+ Assert.notBlank(typeOfEmploymentField, "config [typeOfEmploymentField] is null or blank!");
+ // 英文自定义名称字段
+ String lastNameEnField = Util.getCusConfigValue("lastNameEnField");
+ Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!");
+ // 人员类型id字段 建模表
+ String typeOfEmploymentIdField = Util.getCusConfigValue("typeOfEmploymentIdField");
+ Assert.notBlank(typeOfEmploymentIdField, "config [typeOfEmploymentIdField] is null or blank!");
+ // 人员类型父级字段 建模表
+ String parentField = Util.getCusConfigValue("parentField");
+ Assert.notBlank(parentField, "config [parentField] is null or blank!");
+ // 人员类型建模表表名
+ String typeOfEmploymentTable = Util.getCusConfigValue("typeOfEmploymentTable");
+ Assert.notBlank(typeOfEmploymentTable, "config [typeOfEmploymentTable] is null or blank!");
+ // 查询所有人员信息
+ List hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField,
+ typeOfEmploymentTable, parentField, typeOfEmploymentIdField);
+ if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) {
+ throw new CustomerException("查询不到相关人员!");
+ }
+ // List hrmResourceDtoList = new ArrayList();
+ /* ******************* 将pojo转换为Dto对象,对节点属性默认值赋值,找出当前用户并设置显示 ******************* */
+ List 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()
+ .peek(item -> {
+ if (Objects.equals(item.getManagerId(), userId)) {
+ item.setShow(1);
+ }
+ })
+ .filter(item -> Objects.equals(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);
+ });
+ return hrmResourceDtoList;
+ }
+
+ /**
+ * 计算节点所有子节点的数量
+ * 2022/12/3 17:55
+ * ******************************************
+ *
+ * @param chartNodeVo 节点对象
+ * @return Integer 对应节点的所有子节点的数量
+ * @author youHong.ai ******************************************
+ */
+ private Integer recursionChildrenNums(OrgChartNodeVo chartNodeVo, int n) {
+ List children = chartNodeVo.getChildren();
+ if (Objects.isNull(children) || children.size() == 0) {
+ chartNodeVo.setChildrenNum(0);
+ return 0;
+ }
+ n += children.size();
+ for (OrgChartNodeVo child : children) {
+ child.setChildrenNum(recursionChildrenNums(child, 0));
+ n += child.getChildrenNum();
+ }
+ chartNodeVo.setChildrenNum(n);
+ return n;
+ }
+
}
diff --git a/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java b/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java
index f4720c2..b03a78f 100644
--- a/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java
+++ b/src/main/java/com/api/youhong/ai/yashilandai/openbill/service/OpenTheBillService.java
@@ -21,6 +21,7 @@ import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import weaver.conn.RecordSet;
import java.io.OutputStream;
import java.text.DateFormat;
@@ -46,6 +47,8 @@ public class OpenTheBillService {
private final Logger log = Util.getLogger();
+ private final RecordSet res = new RecordSet();
+
public Map getOpenBillListData(String startDate, String endDate, String orderNo) {
return getData(startDate, endDate, orderNo);
}
@@ -150,6 +153,7 @@ public class OpenTheBillService {
SXSSFCell cell,
SXSSFSheet sheet, Map singularLine, Map evenNumberLine) {
+
int columnWidth = sheet.getColumnWidth(colIndex);
String value = cell.getStringCellValue();
/** 计算字符串中中文字符的数量 */
@@ -160,27 +164,17 @@ public class OpenTheBillService {
if (length >= columnWidth && length < 256 * 256) {
sheet.setColumnWidth(colIndex, length);
}
- if (rowIndex % 2 == 1) {
- if (singularLine.containsKey(colIndex)) {
- return singularLine.get(colIndex);
- }
- CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet);
- singularLine.put(colIndex, cellStyle);
- return cellStyle;
- } else {
- if (evenNumberLine.containsKey(colIndex)) {
- return evenNumberLine.get(colIndex);
- }
- CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet);
- // 设置字体格式
- Font font = workbook.createFont();
- font.setFontName("微软雅黑");
- font.setFontHeightInPoints((short) 10);
-
- cellStyle.setFont(font);
- evenNumberLine.put(colIndex, cellStyle);
- return cellStyle;
+ if (singularLine.containsKey(-1)) {
+ return singularLine.get(-1);
}
+ // 设置字体格式
+ Font font = workbook.createFont();
+ font.setFontName("微软雅黑");
+ font.setFontHeightInPoints((short) 10);
+ CellStyle cellStyle = getCellStyle(workbook, rowIndex, colIndex, cell, sheet);
+ cellStyle.setFont(font);
+ singularLine.put(-1, cellStyle);
+ return cellStyle;
}
private CellStyle getCellStyle(SXSSFWorkbook workbook, Integer rowIndex, Integer colIndex, SXSSFCell cell, SXSSFSheet sheet) {
@@ -232,6 +226,16 @@ public class OpenTheBillService {
return count;
}
+ public Map findMapByField(String filterString, List