Преглед изворни кода

可根据在职离职状态快速搜索人名;增加获取部门全路径信息接口;人员列表返回人员在职和禁用状态

lixing пре 4 година
родитељ
комит
728fc891cc

+ 8 - 0
fm-person/src/main/java/com/persagy/fm/department/controller/DepartmentController.java

@@ -8,6 +8,7 @@ import com.persagy.fm.common.utils.ResultHelper;
 import com.persagy.fm.department.model.ConvertDepartmentTool;
 import com.persagy.fm.department.model.Department;
 import com.persagy.fm.department.model.dto.*;
+import com.persagy.fm.department.model.vo.FullPathInfoVO;
 import com.persagy.fm.department.model.vo.ResponseDepartmentItemVO;
 import com.persagy.fm.department.model.vo.ResponseDepartmentListItemVO;
 import com.persagy.fm.department.model.vo.ResponseDepartmentTreeItemVO;
@@ -181,5 +182,12 @@ public class DepartmentController {
         Department groupDep = departmentService.getGroupDep();
         return ResultHelper.single(groupDep);
     }
+
+    @ApiOperation(value = "获取当前部门的全路径信息")
+    @PostMapping("/fullPathInfos/get")
+    public CommonResult<FullPathInfoVO> getFullPathInfo(@RequestBody @Valid GetFullPathInfoDTO getFullPathInfoDTO) {
+        FullPathInfoVO fullPathInfoVO = departmentService.getFullPathInfo(getFullPathInfoDTO.getDepId());
+        return ResultHelper.single(fullPathInfoVO);
+    }
 }
 

+ 19 - 0
fm-person/src/main/java/com/persagy/fm/department/model/dto/GetFullPathInfoDTO.java

@@ -0,0 +1,19 @@
+package com.persagy.fm.department.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @author lixing
+ * @version V1.0 2021/4/26 4:49 下午
+ **/
+@ApiModel("获取部门全路径信息入参")
+@Data
+public class GetFullPathInfoDTO {
+    @ApiModelProperty(value = "部门id", required = true)
+    @NotBlank(message = "部门id不能为空")
+    private String depId;
+}

+ 18 - 0
fm-person/src/main/java/com/persagy/fm/department/model/vo/FullPathInfoVO.java

@@ -0,0 +1,18 @@
+package com.persagy.fm.department.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author lixing
+ * @version V1.0 2021/4/26 4:47 下午
+ **/
+@ApiModel("部门全路径信息vo类")
+@Data
+public class FullPathInfoVO {
+    @ApiModelProperty("部门全路径中包含的部门列表")
+    private List<DepSimpleObjVO> fullPathInfo;
+}

+ 11 - 0
fm-person/src/main/java/com/persagy/fm/department/service/IDepartmentService.java

@@ -10,6 +10,7 @@ import com.persagy.fm.department.model.dto.PageQueryDepartmentDTO;
 import com.persagy.fm.department.model.dto.QueryDepartmentDTO;
 import com.persagy.fm.department.model.dto.UpdateDepartmentDTO;
 import com.persagy.fm.department.model.vo.DepSimpleObjVO;
+import com.persagy.fm.department.model.vo.FullPathInfoVO;
 
 /**
  * 部门(Department) service接口
@@ -153,4 +154,14 @@ public interface IDepartmentService {
      * @version V1.0 2021/4/25 10:54 上午
      */
     Department getGroupDep();
+
+    /**
+     * 获取部门的全路径信息
+     *
+     * @param depId 部门id
+     * @return 部门全路径中包含的部门信息列表
+     * @author lixing
+     * @version V1.0 2021/4/26 4:59 下午
+     */
+    FullPathInfoVO getFullPathInfo(String depId);
 }

+ 34 - 0
fm-person/src/main/java/com/persagy/fm/department/service/impl/DepartmentServiceImpl.java

@@ -25,6 +25,7 @@ import com.persagy.fm.department.model.dto.PageQueryDepartmentDTO;
 import com.persagy.fm.department.model.dto.QueryDepartmentDTO;
 import com.persagy.fm.department.model.dto.UpdateDepartmentDTO;
 import com.persagy.fm.department.model.vo.DepSimpleObjVO;
+import com.persagy.fm.department.model.vo.FullPathInfoVO;
 import com.persagy.fm.department.service.IDepartmentService;
 import com.persagy.fm.depproject.model.dto.AddDepProjectDTO;
 import com.persagy.fm.depproject.service.IDepProjectService;
@@ -40,6 +41,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -551,4 +553,36 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             throw new BusinessException(ResponseCode.B0300.getCode(), "无法获取当前登录人所在的集团部门");
         }
     }
+
+    @Override
+    public FullPathInfoVO getFullPathInfo(String depId) {
+        FullPathInfoVO fullPathInfoVO = new FullPathInfoVO();
+        List<DepSimpleObjVO> resultList = Lists.newArrayList();
+        getDepInfoListInFullPath(depId, resultList);
+        // 因为部门信息放入的顺序是从后往前,这里做一次反转
+        Collections.reverse(resultList);
+        fullPathInfoVO.setFullPathInfo(resultList);
+        return fullPathInfoVO;
+    }
+
+    /**
+     * 获取部门全路径中的部门信息列表
+     *
+     * @param depId 部门id
+     * @param resultList 最终要返回的结果
+     * @author lixing
+     * @version V1.0 2021/4/26 5:12 下午
+     */
+    private void getDepInfoListInFullPath(String depId, List<DepSimpleObjVO> resultList) {
+        if (StringUtils.isNotBlank(depId) && !DepConstants.NO_PARENT_ID.equals(depId)) {
+            Department department = getById(depId);
+            DepSimpleObjVO depSimpleObjVO = new DepSimpleObjVO();
+            depSimpleObjVO.setId(depId);
+            depSimpleObjVO.setName(department.getName());
+            resultList.add(depSimpleObjVO);
+
+            String parentId = department.getParentId();
+            getDepInfoListInFullPath(parentId, resultList);
+        }
+    }
 }

+ 5 - 3
fm-person/src/main/java/com/persagy/fm/person/model/dto/NameQuickSearchDTO.java

@@ -16,10 +16,12 @@ public class NameQuickSearchDTO {
     @ApiModelProperty(value = "姓名")
     private String name;
 
-//    @ApiModelProperty(value = "账号")
-//    private String username;
+    @ApiModelProperty(value = "在职状态", notes = "com.persagy.fm.workresume.constant.enums.WorkResumeHiredStateEnum")
+    private Integer hiredState;
+
+    @ApiModelProperty(value = "禁用状态", notes = "com.persagy.fm.workresume.constant.enums.WorkResumeEnableStateEnum")
+    private Integer enableState;
 
     @ApiModelProperty(value = "部门id")
     private String depId;
-
 }

+ 6 - 0
fm-person/src/main/resources/mapper/PersonMapper.xml

@@ -127,6 +127,12 @@
         <if test="name != null  and name != ''">
             and p.name like concat('%', #{name}, '%')
         </if>
+        <if test="hiredState != null and hiredState != '' or 0 == hiredState">
+            and w.hired_state = #{hiredState}
+        </if>
+        <if test="enableState != null and enableState != '' or 0 == enableState">
+            and w.enable_state = #{enableState}
+        </if>
         order by p.name_pinyin
         ) personInfo
     </select>