增加获取考核组详情接口

This commit is contained in:
wulin 2020-10-20 11:06:25 +08:00
parent b1d4be8f67
commit be1b6d3610
7 changed files with 149 additions and 87 deletions

View File

@ -0,0 +1,37 @@
package com.lz.modules.app.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 部门表
*
* @author fumeiai
* @email fumeiai@linzikg.com
* @date 2020-04-30 16:59:50
*/
@Data
@ApiModel("部门简单信息Dto")
public class DepartmentsSimpleDto implements Serializable{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "部门id", name = "id")
private Integer id;
/**
* 飞书显示部门人数
*/
@ApiModelProperty(value = "部门人数", name = "memberCount")
private Integer memberCount;
/**
* 组织架构名称/部门名称
*/
@ApiModelProperty(value = "部门名称", name = "departmentName")
private String departmentName;
}

View File

@ -8,6 +8,7 @@ package com.lz.modules.flow.dao;
* @since 2020-08-18
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.app.dto.DepartmentsSimpleDto;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -42,4 +43,6 @@ public interface StaffRoleDepartmentMapper extends BaseMapper<StaffRoleDepartmen
void deleteStaffRoleDepartment(@Param("id") Long id);
List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleIdDepartments(@Param("staffRoleId") Long staffRoleId, @Param("departments") List<String> departments);
List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(@Param("ids") List<Long> ids);
}

View File

@ -1,7 +1,12 @@
package com.lz.modules.flow.model;
import com.lz.modules.app.dto.DepartmentsSimpleDto;
import com.lz.modules.app.dto.StaffSimpleDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* <p>
* </p>*考评组表
@ -19,20 +24,18 @@ public class EvaluationGroupDto {
@ApiModelProperty(value = "", name = "name")
private String name;
//绩效管理员IDsystem_user,id逗号隔开
@ApiModelProperty(value = "绩效管理员IDsystem_user,id逗号隔开", name = "managerIds")
private Long managerIds;
@ApiModelProperty(value = "绩效管理员集合,如果人员离职不会返回", name = "managerIds")
private List<StaffSimpleDto> managers;
//参与部门id逗号隔开
@ApiModelProperty(value = "参与部门id逗号隔开", name = "depIds")
private Long depIds;
@ApiModelProperty(value = "参与部门集合,如果部门不存在不会返回", name = "deps")
private List<DepartmentsSimpleDto> deps;
//参与考核员工staff_id逗号隔开
@ApiModelProperty(value = "参与考核员工staff_id逗号隔开", name = "staffIds")
private Long staffIds;
@ApiModelProperty(value = "参与考核员集合,如果人员离职不会返回", name = "staffs")
private List<StaffSimpleDto> staffs;
//0部门1人员
@ApiModelProperty(value = "0部门1人员", name = "inType")
private Integer inType;
//排除人员ids逗号隔开
@ApiModelProperty(value = "排除人员ids逗号隔开", name = "outIds")
private Long outIds;
@ApiModelProperty(value = "排除人员集合,如果人员离职不会返回", name = "outs")
private List<StaffSimpleDto> outs;
/**
*
* @return
@ -63,91 +66,18 @@ public class EvaluationGroupDto {
this.name = name;
}
/**
* 绩效管理员IDsystem_user,id逗号隔开
* @return
*/
public Long getManagerIds() {
return managerIds;
}
/**
* 绩效管理员IDsystem_user,id逗号隔开
* @param managerIds
*/
public void setManagerIds(Long managerIds) {
this.managerIds = managerIds;
}
/**
* 参与部门id逗号隔开
* @return
*/
public Long getDepIds() {
return depIds;
}
/**
* 参与部门id逗号隔开
* @param depIds
*/
public void setDepIds(Long depIds) {
this.depIds = depIds;
}
/**
* 参与考核员工staff_id逗号隔开
* @return
*/
public Long getStaffIds() {
return staffIds;
}
/**
* 参与考核员工staff_id逗号隔开
* @param staffIds
*/
public void setStaffIds(Long staffIds) {
this.staffIds = staffIds;
}
/**
* 0部门1人员
* @return
*/
public Integer getInType() {
return inType;
}
/**
* 0部门1人员
* @param inType
*/
public void setInType(Integer inType) {
this.inType = inType;
}
/**
* 排除人员ids逗号隔开
* @return
*/
public Long getOutIds() {
return outIds;
}
/**
* 排除人员ids逗号隔开
* @param outIds
*/
public void setOutIds(Long outIds) {
this.outIds = outIds;
}
@Override
public String toString() {
return "EvaluationGroup{" +
",id=" + id +
",name=" + name +
",managerIds=" + managerIds +
",depIds=" + depIds +
",staffIds=" + staffIds +
",inType=" + inType +
",outIds=" + outIds +
"}";
}
}

View File

@ -1,6 +1,7 @@
package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.app.dto.DepartmentsSimpleDto;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import java.util.List;
@ -39,4 +40,6 @@ public interface StaffRoleDepartmentService extends IService<StaffRoleDepartment
StaffRoleDepartment selectStaffRoleDepartmentByDepartmentIdRoleIds(Long menuId, List<Long> ids);
void deleteStaffRoleDepartment(Long id);
List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(List<Long> ids);
}

View File

@ -1,6 +1,7 @@
package com.lz.modules.flow.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.modules.app.dto.DepartmentsSimpleDto;
import com.lz.modules.flow.dao.StaffRoleDepartmentMapper;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import com.lz.modules.flow.service.StaffRoleDepartmentService;
@ -80,5 +81,10 @@ public class StaffRoleDepartmentServiceImpl extends ServiceImpl<StaffRoleDepartm
staffRoleDepartmentMapper.deleteStaffRoleDepartment(id);
}
@Override
public List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(List<Long> ids){
return staffRoleDepartmentMapper.selectDepartmentSimpleInfos(ids);
}
}

View File

@ -5,20 +5,29 @@ import com.alibaba.fastjson.JSONObject;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dto.DepartmentsSimpleDto;
import com.lz.modules.app.dto.StaffSimpleDto;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.entity.FlowManager;
import com.lz.modules.flow.entity.ResultModel;
import com.lz.modules.flow.model.EvaluationGroupDto;
import com.lz.modules.flow.req.EvaluationGroupReq;
import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.FlowManagerService;
import com.lz.modules.flow.service.ResultModelService;
import com.lz.modules.flow.service.StaffRoleDepartmentService;
import io.swagger.annotations.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/evaluationGroup")
@ -34,14 +43,79 @@ public class EvaluationGroupController {
@Autowired
private ResultModelService resultModelService;
@Autowired
private StaffService staffService;
@Autowired
private StaffRoleDepartmentService staffRoleDepartmentService;
@PostMapping("/getById")
@GetMapping("/getById")
@ApiOperation("获取考核组详情")
@ApiResponses({@ApiResponse(code=200,message = "成功", response= EvaluationGroupDto.class)})
public R getById(@RequestParam @ApiParam("考核组id") Long id) {
EvaluationGroup evaluationGroup = evaluationGroupService.selectEvaluationGroupById(id);
EvaluationGroupDto evaluationGroupDto = new EvaluationGroupDto();
if(evaluationGroup.getDepIds() != null && evaluationGroup.getDepIds().length() > 0){
List<Long> ids = Arrays.stream(evaluationGroup.getDepIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
List<DepartmentsSimpleDto> departmentsSimpleDtos = staffRoleDepartmentService.selectDepartmentSimpleInfos(ids);
evaluationGroupDto.setDeps(departmentsSimpleDtos);
}
if(evaluationGroup.getStaffIds() != null && evaluationGroup.getStaffIds().length() > 0){
List<Long> ids = Arrays.stream(evaluationGroup.getStaffIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
//指定人员搜索人员信息
List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(ids);
evaluationGroupDto.setStaffs(staffSimpleDtos);
}
if(evaluationGroup.getManagerIds() != null && evaluationGroup.getManagerIds().length() > 0){
List<Long> ids = Arrays.stream(evaluationGroup.getManagerIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
//指定人员搜索人员信息
List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(ids);
evaluationGroupDto.setManagers(staffSimpleDtos);
}
if(evaluationGroup.getOutIds() != null && evaluationGroup.getOutIds().length() > 0){
List<Long> ids = Arrays.stream(evaluationGroup.getOutIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
//指定人员搜索人员信息
List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(ids);
evaluationGroupDto.setOuts(staffSimpleDtos);
}
BeanUtils.copyProperties(evaluationGroup, evaluationGroupDto);
return R.ok().put("data",evaluationGroupDto);
}
@PostMapping("/getGroups")
@ApiOperation("获取考核组列表")
@ApiResponses({@ApiResponse(code=200,message = "成功", response=EvaluationGroup.class)})
public R getById(@RequestBody @ApiParam EvaluationGroupReq req) {
public R getGroups(@RequestBody @ApiParam EvaluationGroupReq req) {
PageUtils pageUtils = evaluationGroupService.selectEvaluationGroupByReq(req);
return R.ok().put("data",pageUtils);
}

View File

@ -111,5 +111,14 @@
</foreach>
</select>
<select id="selectDepartmentSimpleInfos"
resultType="com.lz.modules.app.dto.DepartmentsSimpleDto">
select id, member_count, department_name from lz_departments where is_delete = 0
and id in
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>