部门人员接口哟划
This commit is contained in:
parent
62bacf2dda
commit
8b51e6edfb
@ -4,10 +4,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.lz.modules.app.dto.DepartmentsDto;
|
import com.lz.modules.app.dto.DepartmentsDto;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.*;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiResponse;
|
|
||||||
import io.swagger.annotations.ApiResponses;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -36,14 +33,23 @@ public class DepartmentsController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
// @RequiresPermissions("staff:structure:list")
|
// @RequiresPermissions("staff:structure:list")
|
||||||
@ApiOperation("获取全部有效部门树列表")
|
|
||||||
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = DepartmentsDto.class)})
|
|
||||||
public List<DepartmentsDto> list() {
|
public List<DepartmentsDto> list() {
|
||||||
List<DepartmentsDto> departmentList = departmentsService.getDepartmentTree();
|
List<DepartmentsDto> departmentList = departmentsService.getDepartmentTree(0);
|
||||||
|
|
||||||
return departmentList;
|
return departmentList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/deplist")
|
||||||
|
// @RequiresPermissions("staff:structure:list")
|
||||||
|
@ApiOperation("获取全部有效部门树列表")
|
||||||
|
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = DepartmentsDto.class)})
|
||||||
|
public List<DepartmentsDto> deplist(@RequestParam @ApiParam(value = "请求类型0 请求部门不包含人员列表,1同时返回人员列表") int type) {
|
||||||
|
List<DepartmentsDto> departmentList = departmentsService.getDepartmentTree(1);
|
||||||
|
|
||||||
|
return departmentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 信息
|
* 信息
|
||||||
|
|||||||
@ -104,7 +104,7 @@ public class ReportResultController extends AbstractController{
|
|||||||
public R departmentTreeByStaffId(){
|
public R departmentTreeByStaffId(){
|
||||||
Long userId = getUserId();
|
Long userId = getUserId();
|
||||||
if(chartService.hrOrBoss(userId)){
|
if(chartService.hrOrBoss(userId)){
|
||||||
List<DepartmentsDto> data = departmentsService.getDepartmentTree();
|
List<DepartmentsDto> data = departmentsService.getDepartmentTree(0);
|
||||||
return R.ok().put("data",data);
|
return R.ok().put("data",data);
|
||||||
}
|
}
|
||||||
if(chartService.leader(getUserId())){
|
if(chartService.leader(getUserId())){
|
||||||
|
|||||||
@ -82,4 +82,6 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
|
|||||||
List<ReportProgressListDto> getPositionByStaffIds(@Param("req") ReportListReq req, @Param("staffIds") List<String> staffIds, @Param("page") IPage page);
|
List<ReportProgressListDto> getPositionByStaffIds(@Param("req") ReportListReq req, @Param("staffIds") List<String> staffIds, @Param("page") IPage page);
|
||||||
|
|
||||||
List<StaffSimpleDto> selectStaffSimpleInfoByIds(@Param("ids") List<Long> ids);
|
List<StaffSimpleDto> selectStaffSimpleInfoByIds(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
|
List<StaffDto> getDepatAllStaffInfos(@Param("departmentId") String departmentId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,12 +21,11 @@ import java.util.List;
|
|||||||
public class DepartmentsDto implements Serializable{
|
public class DepartmentsDto implements Serializable{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门id", name = "id")
|
|
||||||
private Integer id;
|
|
||||||
/**
|
/**
|
||||||
* 飞书部门id
|
* 飞书部门id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "钉钉,飞书部门id", name = "departmentId")
|
@ApiModelProperty(value = "部门id,钉钉,飞书部门id", name = "departmentId")
|
||||||
private String departmentId;
|
private String departmentId;
|
||||||
/**
|
/**
|
||||||
* 飞书上级部门id
|
* 飞书上级部门id
|
||||||
@ -53,5 +52,7 @@ public class DepartmentsDto implements Serializable{
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "部门id", name = "id")
|
@ApiModelProperty(value = "部门id", name = "id")
|
||||||
private List<?> list;
|
private List<?> list;
|
||||||
|
@ApiModelProperty(value = "部门人员集合", name = "staffDtos")
|
||||||
|
private List<StaffDto> staffDtos;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<DepartmentsDto> getDepartmentTree();
|
List<DepartmentsDto> getDepartmentTree(int type);
|
||||||
|
|
||||||
List<DepartmentsDto> selectByParentDepartmentId(String deparentId);
|
List<DepartmentsDto> selectByParentDepartmentId(String deparentId);
|
||||||
|
|
||||||
|
|||||||
@ -84,5 +84,7 @@ public interface StaffService extends IService<StaffEntity> {
|
|||||||
List<StaffEntity> selectAll();
|
List<StaffEntity> selectAll();
|
||||||
|
|
||||||
List<StaffSimpleDto> selectStaffSimpleInfoByIds(List<Long> ids);
|
List<StaffSimpleDto> selectStaffSimpleInfoByIds(List<Long> ids);
|
||||||
|
|
||||||
|
List<StaffDto> getDepatAllStaffInfos(String departmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,14 +13,17 @@ import com.lz.modules.app.dao.StaffDao;
|
|||||||
import com.lz.modules.app.dto.DepartmentInfos;
|
import com.lz.modules.app.dto.DepartmentInfos;
|
||||||
import com.lz.modules.app.dto.DepartmentsDto;
|
import com.lz.modules.app.dto.DepartmentsDto;
|
||||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||||
|
import com.lz.modules.app.dto.StaffDto;
|
||||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||||
import com.lz.modules.app.entity.StaffEntity;
|
import com.lz.modules.app.entity.StaffEntity;
|
||||||
import com.lz.modules.app.service.DepartmentsService;
|
import com.lz.modules.app.service.DepartmentsService;
|
||||||
|
import com.lz.modules.app.service.StaffService;
|
||||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -37,6 +40,9 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
|||||||
@Resource
|
@Resource
|
||||||
DepartmentsStaffRelateDao departmentsStaffRelateDao;
|
DepartmentsStaffRelateDao departmentsStaffRelateDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StaffService staffService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
IPage<DepartmentsEntity> page = this.page(
|
IPage<DepartmentsEntity> page = this.page(
|
||||||
@ -62,9 +68,17 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DepartmentsDto> getDepartmentTree() {
|
public List<DepartmentsDto> getDepartmentTree(int type) {
|
||||||
List<DepartmentsDto> departmentsParentsList = departmentsDao.getDepartmentsByparentId("1");
|
List<DepartmentsDto> departmentsParentsList = departmentsDao.getDepartmentsByparentId("1");
|
||||||
getDepartmentTreeList(departmentsParentsList);
|
if(type == 1){
|
||||||
|
for (DepartmentsDto dto: departmentsParentsList
|
||||||
|
) {
|
||||||
|
List<StaffDto> staffDtos = staffService.getDepatAllStaffInfos(dto.getDepartmentId());
|
||||||
|
dto.setStaffDtos(staffDtos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getDepartmentTreeList(departmentsParentsList, type);
|
||||||
return departmentsParentsList;
|
return departmentsParentsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,12 +112,17 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
|||||||
return staffDepartmentDto;
|
return staffDepartmentDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DepartmentsDto> getDepartmentTreeList(List<DepartmentsDto> departmentList) {
|
private List<DepartmentsDto> getDepartmentTreeList(List<DepartmentsDto> departmentList, int type) {
|
||||||
List<DepartmentsDto> DepartmentsList = Lists.newArrayList();
|
List<DepartmentsDto> DepartmentsList = Lists.newArrayList();
|
||||||
for (DepartmentsDto departmentsDto : departmentList) {
|
for (DepartmentsDto departmentsDto : departmentList) {
|
||||||
List<DepartmentsDto> departmentsChirdList = departmentsDao.getDepartmentsByparentId(departmentsDto.getDepartmentId());
|
List<DepartmentsDto> departmentsChirdList = departmentsDao.getDepartmentsByparentId(departmentsDto.getDepartmentId());
|
||||||
if (departmentsChirdList.size() > 0) {
|
if (departmentsChirdList.size() > 0) {
|
||||||
departmentsDto.setList(getDepartmentTreeList(departmentsChirdList));
|
departmentsDto.setList(getDepartmentTreeList(departmentsChirdList, type));
|
||||||
|
}
|
||||||
|
if(type == 1){
|
||||||
|
List<StaffDto> staffDtos = staffService.getDepatAllStaffInfos(departmentsDto.getDepartmentId());
|
||||||
|
departmentsDto.setStaffDtos(staffDtos);
|
||||||
|
|
||||||
}
|
}
|
||||||
DepartmentsList.add(departmentsDto);
|
DepartmentsList.add(departmentsDto);
|
||||||
}
|
}
|
||||||
@ -232,7 +251,7 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
|
|||||||
public List<DepartmentsDto> getDepartmentTreeByStaffId(String staffId,boolean containSelf) {
|
public List<DepartmentsDto> getDepartmentTreeByStaffId(String staffId,boolean containSelf) {
|
||||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateDao.selectByStaffId(Long.valueOf(staffId));
|
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateDao.selectByStaffId(Long.valueOf(staffId));
|
||||||
List<DepartmentsDto> departmentsParentsList = departmentsDao.getDepartmentsByparentId(departmentsStaffRelateEntity.getDepartmentId());
|
List<DepartmentsDto> departmentsParentsList = departmentsDao.getDepartmentsByparentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||||
getDepartmentTreeList(departmentsParentsList);
|
getDepartmentTreeList(departmentsParentsList, 0);
|
||||||
if(containSelf){
|
if(containSelf){
|
||||||
List<DepartmentsDto> result = new ArrayList<>();
|
List<DepartmentsDto> result = new ArrayList<>();
|
||||||
DepartmentsDto departmentsDto = new DepartmentsDto();
|
DepartmentsDto departmentsDto = new DepartmentsDto();
|
||||||
|
|||||||
@ -458,6 +458,11 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
|||||||
return staffDao.selectStaffSimpleInfoByIds(ids);
|
return staffDao.selectStaffSimpleInfoByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StaffDto> getDepatAllStaffInfos(String departmentId){
|
||||||
|
return staffDao.getDepatAllStaffInfos(departmentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package com.lz.modules.flow.service.impl;
|
package com.lz.modules.flow.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.lz.modules.flow.entity.ResultCalculate;
|
import com.lz.modules.flow.entity.ResultCalculate;
|
||||||
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.lz.modules.flow.dao.ResultCalculateMapper;
|
import com.lz.modules.flow.dao.ResultCalculateMapper;
|
||||||
import com.lz.modules.flow.entity.ResultCalculate;
|
import com.lz.modules.flow.entity.ResultCalculate;
|
||||||
import com.lz.modules.flow.model.ResultCalculateDto;
|
import com.lz.modules.flow.model.ResultCalculateDto;
|
||||||
import com.lz.modules.flow.service.impl.ResultCalculateService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
package com.lz.modules.performance.controller;
|
package com.lz.modules.performance.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.lz.common.utils.PageUtils;
|
|
||||||
import com.lz.common.utils.R;
|
import com.lz.common.utils.R;
|
||||||
import com.lz.common.utils.StringUtil;
|
|
||||||
import com.lz.modules.flow.entity.FlowChart;
|
|
||||||
import com.lz.modules.flow.entity.ResultCalculate;
|
import com.lz.modules.flow.entity.ResultCalculate;
|
||||||
import com.lz.modules.flow.model.ResultCalculateDto;
|
import com.lz.modules.flow.model.ResultCalculateDto;
|
||||||
import com.lz.modules.flow.service.impl.ResultCalculateService;
|
import com.lz.modules.flow.service.ResultCalculateService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiResponse;
|
import io.swagger.annotations.ApiResponse;
|
||||||
@ -19,9 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/resultCalculate")
|
@RequestMapping("/resultCalculate")
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.dto.DepartmentsDto">
|
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.dto.DepartmentsDto">
|
||||||
select department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId}
|
select id, department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateDepartment">
|
<update id="updateDepartment">
|
||||||
|
|||||||
@ -469,4 +469,14 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
) and occupation.staff_status=0
|
) and occupation.staff_status=0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDepatAllStaffInfos" resultType="com.lz.modules.app.dto.StaffDto">
|
||||||
|
select jj.staff_id, jj.name, jj.department_leader, occ.position as position,
|
||||||
|
case occ.staff_status when 0 then '在职' else '离职' end staff_status
|
||||||
|
from (select staff.id as staff_id, staff.name as name, relate.is_leader as department_leader
|
||||||
|
from lz_departments_staff_relate relate join lz_staff staff on staff.id = relate.staff_id
|
||||||
|
where relate.department_id = #{departmentId}) jj
|
||||||
|
join lz_staff_occupation occ on jj.staff_id=occ.staff_id where occ.staff_status=0
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user