|
@@ -3,11 +3,17 @@ package com.redxun.knowledge.album.service;
|
|
|
import com.redxun.common.base.db.BaseDao;
|
|
|
import com.redxun.common.base.db.BaseService;
|
|
|
import com.redxun.common.service.impl.SuperServiceImpl;
|
|
|
+import com.redxun.dto.user.OsUserDto;
|
|
|
import com.redxun.knowledge.album.entity.dao.AlbumApprovalNode;
|
|
|
import com.redxun.knowledge.album.mapper.AlbumApprovalNodeMapper;
|
|
|
+import com.redxun.knowledge.common.UserService;
|
|
|
+import com.redxun.knowledge.mapper.KnowledgeApprovalNodeFlowerMapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -22,6 +28,12 @@ public class AlbumApprovalNodeServiceImpl extends SuperServiceImpl<AlbumApproval
|
|
|
@Resource
|
|
|
private AlbumApprovalNodeMapper albumApprovalNodeMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KnowledgeApprovalNodeFlowerMapper knowledgeApprovalNodeFlowerMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDao<AlbumApprovalNode> getRepository() {
|
|
|
return albumApprovalNodeMapper;
|
|
@@ -40,9 +52,14 @@ public class AlbumApprovalNodeServiceImpl extends SuperServiceImpl<AlbumApproval
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> approvalTemplate() {
|
|
|
+ String userId = userService.queryLoginUser();
|
|
|
List<AlbumApprovalNode> albumApprovalNodeList =
|
|
|
albumApprovalNodeMapper.selectList(null);
|
|
|
List<Map<String, Object>> result = albumApprovalNodeList.parallelStream().map(e -> {
|
|
|
+ //如果是默认节点了,查询对应的审核人
|
|
|
+ if (e.getIsFinal() == -1){
|
|
|
+ e.setApproverName(approverLdName(userId).get("approverName"));
|
|
|
+ }
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("name", e.getName());
|
|
|
map.put("approverName", e.getApproverName());
|
|
@@ -53,4 +70,40 @@ public class AlbumApprovalNodeServiceImpl extends SuperServiceImpl<AlbumApproval
|
|
|
}).collect(Collectors.toList());
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取直属领导信息
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, String> approverLdName(String userId){
|
|
|
+ OsUserDto osUserDto = userService.queryOsUserDto(userId);
|
|
|
+ String approverId = null;
|
|
|
+ String parentUserIds = knowledgeApprovalNodeFlowerMapper.findParentUserIdList(osUserDto.getDeptId());
|
|
|
+ if (!StringUtils.isEmpty(parentUserIds)){
|
|
|
+ //审核人userId(员工工号)
|
|
|
+ List<String> parentUserIdList = Arrays.asList(parentUserIds.split(","));
|
|
|
+ approverId = String.join(",", parentUserIdList);
|
|
|
+ //如果查出来的直属部门领导包含了当前登陆人,去查询该登陆人的直属上司
|
|
|
+ if (approverId.contains(osUserDto.getUserId())) {
|
|
|
+ approverId = knowledgeApprovalNodeFlowerMapper.findParentUserId(osUserDto.getUserNo());
|
|
|
+ if (StringUtils.isEmpty(approverId)){
|
|
|
+ approverId = osUserDto.getUserId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ approverId = knowledgeApprovalNodeFlowerMapper.findParentUserId(osUserDto.getUserNo());
|
|
|
+ if (StringUtils.isEmpty(approverId)){
|
|
|
+ approverId = osUserDto.getUserId();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //审核人姓名
|
|
|
+ String approverName = Arrays.asList(approverId.split(",")).parallelStream().map(e -> userService.queryUser(e).getFullName()).
|
|
|
+ collect(Collectors.joining(","));
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("approverId",approverId);
|
|
|
+ map.put("approverName",approverName);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|