修改亢亢上传附件的实体类,添加附件docid和imagefileid

dev
youHong.ai 2022-12-06 17:01:48 +08:00
parent 6f1e24a274
commit af35223154
5 changed files with 35 additions and 54 deletions

View File

@ -1,6 +1,5 @@
package com.api.youhong.ai.pcn.organization.orgchart.mapper; 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.ParamMapper;
import aiyh.utils.annotation.recordset.Select; import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper; import aiyh.utils.annotation.recordset.SqlMapper;
@ -45,7 +44,7 @@ public interface OrgChartMapper {
" inner join hrmjobtitles job on hrm.JOBTITLE = job.id " + " inner join hrmjobtitles job on hrm.JOBTITLE = job.id " +
" inner join cus_fielddata cus on cus.ID = hrm.ID " + " inner join cus_fielddata cus on cus.ID = hrm.ID " +
" and cus.SCOPE = 'HrmCustomFieldByInfoType' " + " and cus.SCOPE = 'HrmCustomFieldByInfoType' " +
" and cus.SCOPEID = -1 " + " and cus.SCOPEID = 1 " +
" inner join hrmdepartment dept on dept.id = hrm.DEPARTMENTID " + " inner join hrmdepartment dept on dept.id = hrm.DEPARTMENTID " +
"where hrm.status in (0, 1)") "where hrm.status in (0, 1)")
List<HrmResource> selectAll(@ParamMapper("typeOfEmploymentFiled") String typeOfEmploymentField, List<HrmResource> selectAll(@ParamMapper("typeOfEmploymentFiled") String typeOfEmploymentField,

View File

@ -1,6 +1,7 @@
package com.api.youhong.ai.pcn.organization.orgchart.service; package com.api.youhong.ai.pcn.organization.orgchart.service;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import com.api.youhong.ai.pcn.organization.orgchart.dto.HrmResourceDto; import com.api.youhong.ai.pcn.organization.orgchart.dto.HrmResourceDto;
import com.api.youhong.ai.pcn.organization.orgchart.mapper.OrgChartMapper; import com.api.youhong.ai.pcn.organization.orgchart.mapper.OrgChartMapper;
@ -45,28 +46,17 @@ public class OrgChartService {
String lastNameEnField = Util.getCusConfigValue("lastNameEnField"); String lastNameEnField = Util.getCusConfigValue("lastNameEnField");
Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!"); Assert.notBlank(lastNameEnField, "config [lastNameEnField] is null or blank!");
List<HrmResource> hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField); List<HrmResource> hrmResourceList = mapper.selectAll(typeOfEmploymentField, lastNameEnField);
if (Objects.isNull(hrmResourceList) || hrmResourceList.isEmpty()) {
throw new CustomerException("查询不到相关人员!");
}
//List<HrmResourceDto> hrmResourceDtoList = new ArrayList(); //List<HrmResourceDto> hrmResourceDtoList = new ArrayList();
AtomicReference<HrmResourceDto> currentUser = new AtomicReference<>(); AtomicReference<HrmResourceDto> currentUser = new AtomicReference<>();
/* ******************* 将pojo转换为Dto对象对节点属性默认值赋值找出当前用户并设置显示 ******************* */ /* ******************* 将pojo转换为Dto对象对节点属性默认值赋值找出当前用户并设置显示 ******************* */
List<HrmResourceDto> hrmResourceDtoList = hrmResourceList.stream() 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());
.map(struct::hrmResourceToDto) hrmResourceDtoList.stream().filter(item -> item.getId() == userId).forEach(item -> {
.peek(item -> Builder.startSet(item) Builder.startSet(item).with(HrmResourceDto::setShow, 1).with(HrmResourceDto::setShowBrother, 1).with(HrmResourceDto::setShowChildren, 1).with(HrmResourceDto::setCurrent, true).endSet();
.with(HrmResourceDto::setShow, 0) currentUser.set(item);
.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!"); Assert.notNull(currentUser, "not find current login user info!");
/* ******************* 查找当前登陆人员的所有上级 ******************* */ /* ******************* 查找当前登陆人员的所有上级 ******************* */
String currentUserManagerStr = currentUser.get().getManagerStr(); String currentUserManagerStr = currentUser.get().getManagerStr();
@ -74,16 +64,9 @@ public class OrgChartService {
currentUserManagerStr = ""; currentUserManagerStr = "";
} }
currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ","); currentUserManagerStr = Util.removeSeparator(currentUserManagerStr, ",");
List<Integer> currentUserManagerList = Arrays.stream(currentUserManagerStr.split(",")) List<Integer> currentUserManagerList = Arrays.stream(currentUserManagerStr.split(",")).map(Integer::parseInt).collect(Collectors.toList());
.map(Integer::parseInt)
.collect(Collectors.toList());
/* ******************* 对当前用户的所有直接上级设置标识 ******************* */ /* ******************* 对当前用户的所有直接上级设置标识 ******************* */
hrmResourceDtoList.stream() hrmResourceDtoList.stream().filter(item -> currentUserManagerList.contains(item.getId())).forEach(item -> Builder.startSet(item).with(HrmResourceDto::setShowChildren, 1).with(HrmResourceDto::setCurrentParent, true).endSet());
.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); ShowPointOrAll showPointOrAll = mapper.selectShowPointOrAll(userId);
@ -92,34 +75,21 @@ public class OrgChartService {
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
orgChartNodeVoList = hrmResourceDtoList.stream() orgChartNodeVoList = hrmResourceDtoList.stream()
.map(struct::hrmResourceDtoToVo) .map(struct::hrmResourceDtoToVo)
.peek(item -> item.setType(-1))
.collect(Collectors.toList()); .collect(Collectors.toList());
} else { } else {
/* ******************* 转换dto为Vo并且设置根节点标识 ******************* */ /* ******************* 转换dto为Vo并且设置根节点标识 ******************* */
orgChartNodeVoList = hrmResourceDtoList.stream() orgChartNodeVoList = hrmResourceDtoList.stream().map(struct::hrmResourceDtoToVo).peek(item -> {
.map(struct::hrmResourceDtoToVo) if (showPointOrAll.isShowAll()) {
.peek(item -> { Builder.startSet(item).with(OrgChartNodeVo::setShow, 1).with(OrgChartNodeVo::setShowBrother, 1).with(OrgChartNodeVo::setShowChildren, 1).endSet();
if (showPointOrAll.isShowAll()) { }
Builder.startSet(item) if (!showPointOrAll.isShowType()) {
.with(OrgChartNodeVo::setShow, 1) item.setType(-1);
.with(OrgChartNodeVo::setShowBrother, 1) }
.with(OrgChartNodeVo::setShowChildren, 1) }).collect(Collectors.toList());
.endSet();
}
if (!showPointOrAll.isShowType()) {
item.setType(-1);
}
})
.collect(Collectors.toList());
} }
return Util.listToTree(orgChartNodeVoList, OrgChartNodeVo::getId, 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());
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());
} }

View File

@ -34,4 +34,14 @@ public class MultipartFile {
* *
*/ */
Long fileSize; Long fileSize;
/**
* id
*/
private Integer imageFileId;
/**
* docId
*/
private Integer docId;
} }

View File

@ -893,6 +893,8 @@ public class DealWithMapping extends ToolUtil {
MultipartFile multipartFile = new MultipartFile(); MultipartFile multipartFile = new MultipartFile();
InputStream fileInputStream = ImageFileManager.getInputStreamById(docImageFile.getImageFileId()); InputStream fileInputStream = ImageFileManager.getInputStreamById(docImageFile.getImageFileId());
multipartFile.setFileKey(paramName); multipartFile.setFileKey(paramName);
multipartFile.setImageFileId(docImageFile.getImageFileId());
multipartFile.setDocId(docImageFile.getDocId());
multipartFile.setStream(fileInputStream); multipartFile.setStream(fileInputStream);
multipartFile.setFileName(docImageFile.getImageFileName()); multipartFile.setFileName(docImageFile.getImageFileName());
multipartFile.setFileSize(docImageFile.getFileSize() / 1024); multipartFile.setFileSize(docImageFile.getFileSize() / 1024);

View File

@ -195,7 +195,7 @@ public class TestOrganization extends BaseTest {
@Test @Test
public void testOrgChart() { public void testOrgChart() {
User user = new User(88); User user = new User(84);
OrgChartService orgChartService = new OrgChartService(); OrgChartService orgChartService = new OrgChartService();
List<OrgChartNodeVo> orgChartTree = orgChartService.getOrgChartTree(user); List<OrgChartNodeVo> orgChartTree = orgChartService.getOrgChartTree(user);
System.out.println(JSON.toJSONString(orgChartTree)); System.out.println(JSON.toJSONString(orgChartTree));