diff --git a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java index c78686e8..4f9d0e8a 100644 --- a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java +++ b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java @@ -1,12 +1,16 @@ package com.lz.modules.app.controller; import com.alibaba.fastjson.JSON; +import com.dingtalk.api.response.OapiDepartmentListResponse; import com.lz.common.utils.NumberUtil; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.modules.app.entity.DepartmentsEntity; +import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; +import com.lz.modules.app.resp.StaffRoleModel; import com.lz.modules.app.service.DepartmentsService; +import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.StaffService; import com.lz.modules.flow.entity.RecordRole; import com.lz.modules.flow.entity.StaffRole; @@ -22,6 +26,7 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -55,7 +60,8 @@ public class StaffRoleController { @Autowired private DepartmentsService departmentsService; - + @Autowired + private DepartmentsStaffRelateService departmentsStaffRelateService; /** * 列表 @@ -72,7 +78,21 @@ public class StaffRoleController { @ApiOperation(value="根据groupId获取管理员列表") @ApiImplicitParam(name = "groupId",value = "组id",defaultValue = "1",required = true, dataType = "Long",paramType = "query") public R listByGroupId( Long groupId ) { - List staffRoles = staffRoleService.selectByGroupId(groupId); + List staffRoleList = staffRoleService.selectByGroupId(groupId); + List staffRoles = new ArrayList<>(); + for(StaffRole staffRole:staffRoleList){ + StaffRoleModel staffRoleModel = new StaffRoleModel(); + BeanUtils.copyProperties(staffRole,staffRoleModel); + Long staffId = staffRole.getStaffId(); + DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId); + if(departmentsStaffRelateEntity !=null ){ + DepartmentsEntity departmentsEntity = departmentsService.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId()); + if(departmentsEntity !=null){ + staffRoleModel.setStaffName(staffRoleModel.getStaffName() + " "+departmentsEntity.getDepartmentName()); + } + } + staffRoles.add(staffRoleModel); + } return R.ok().put("staffRoles", staffRoles); } diff --git a/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java b/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java index 2cd353b1..c79cdb10 100644 --- a/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java +++ b/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java @@ -63,5 +63,5 @@ public interface DepartmentsStaffRelateDao extends BaseMapper getDepartmentNameByStaffIds(@Param("staffIds") List staffIds); - + List selectStaffIdsByDepartments(@Param("deparmentIds")List deparmentIds); } diff --git a/src/main/java/com/lz/modules/app/dao/StaffOccupationDao.java b/src/main/java/com/lz/modules/app/dao/StaffOccupationDao.java index 34f217a3..f0ce615e 100644 --- a/src/main/java/com/lz/modules/app/dao/StaffOccupationDao.java +++ b/src/main/java/com/lz/modules/app/dao/StaffOccupationDao.java @@ -31,4 +31,6 @@ public interface StaffOccupationDao extends BaseMapper { void updateAllOccupation(); void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo); + + List removeDimissionStaffByStaffIds(@Param("staffIds") List staffIds); } diff --git a/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java b/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java new file mode 100644 index 00000000..9e060205 --- /dev/null +++ b/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java @@ -0,0 +1,32 @@ +package com.lz.modules.app.resp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class StaffRoleModel { + + //员工 id + @ApiModelProperty(value = "员工 id", name = "staffId") + private Long staffId; + + //员工名称 + @ApiModelProperty(value = "员工名称", name = "staffName") + private String staffName; + //组id + @ApiModelProperty(value = "组id", name = "evaluationGroupId") + private Long evaluationGroupId; + + + + + + //是否是必选 + @ApiModelProperty(value = "是否是必选,0不是必选,1必选", name = "isSelect") + private Integer isSelect; + +} diff --git a/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java b/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java index c024b7eb..f2c7233a 100644 --- a/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java +++ b/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java @@ -40,5 +40,7 @@ public interface DepartmentsStaffRelateService extends IService selectStaffIdsByDepartments(List deparmentIds); } diff --git a/src/main/java/com/lz/modules/app/service/StaffOccupationService.java b/src/main/java/com/lz/modules/app/service/StaffOccupationService.java index b1a63333..61ab3b85 100644 --- a/src/main/java/com/lz/modules/app/service/StaffOccupationService.java +++ b/src/main/java/com/lz/modules/app/service/StaffOccupationService.java @@ -31,5 +31,7 @@ public interface StaffOccupationService extends IService void updateAllOccupation(); void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo); + + List removeDimissionStaffByStaffIds(List staffIds); } diff --git a/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java index 358d4aa4..b2b19b78 100644 --- a/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java @@ -3,8 +3,10 @@ package com.lz.modules.app.service.impl; import com.google.common.collect.Lists; import com.lz.common.utils.StringUtil; import com.lz.modules.job.model.responseBo.DepartmentStaffBo; +import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Service; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -90,4 +92,12 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl selectStaffIdsByDepartments(List deparmentIds) { + if(CollectionUtils.isEmpty(deparmentIds)){ + return Collections.EMPTY_LIST; + } + return departmentsStaffRelateDao.selectStaffIdsByDepartments(deparmentIds); + } } diff --git a/src/main/java/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.java index 112f331b..214bde65 100644 --- a/src/main/java/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/StaffOccupationServiceImpl.java @@ -10,9 +10,12 @@ import com.lz.modules.app.dao.StaffOccupationDao; import com.lz.modules.app.entity.StaffOccupationEntity; import com.lz.modules.app.service.StaffOccupationService; import com.lz.modules.job.model.responseBo.DepartmentStaffBo; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -62,4 +65,11 @@ public class StaffOccupationServiceImpl extends ServiceImpl removeDimissionStaffByStaffIds(List staffIds) { + if(CollectionUtils.isEmpty(staffIds)){ + return Collections.EMPTY_LIST; + } + return staffOccupationDao.removeDimissionStaffByStaffIds(staffIds); + } } diff --git a/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java index e59bd75e..580c4b69 100644 --- a/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java @@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -411,24 +412,13 @@ public class StaffServiceImpl extends ServiceImpl impleme return Lists.newArrayList(); } //获取所有人员 - List list = departmentsStaffRelateService.list(new QueryWrapper() - .select("staff_id") - .eq("is_delete", 0) - .in("department_id", deparmentIds)); + List list = departmentsStaffRelateService.selectStaffIdsByDepartments(deparmentIds); if(CollectionUtils.isEmpty(list)){ return Lists.newArrayList(); } - //获取人员个数去重 - List staffs = list.stream().map(e -> e.getStaffId() + "").collect(Collectors.toList()); - staffs.removeIf(s -> { - StaffOccupationInfoDto occupationByStaffId = staffOccupationService.getOccupationByStaffId(Long.valueOf(s)); - if(occupationByStaffId==null || "1".equals(occupationByStaffId.getStaffStatus())){ - return true; - } - return false; - }); - List staffdistincts = staffs.stream().distinct().collect(Collectors.toList()); - return staffdistincts; + //获取人员个数去重, 去除离职 + List data = staffOccupationService.removeDimissionStaffByStaffIds(list); + return new ArrayList<>(new HashSet(data)); } diff --git a/src/main/java/com/lz/modules/flow/entity/StaffRole.java b/src/main/java/com/lz/modules/flow/entity/StaffRole.java index 6c69ce93..d768e61a 100644 --- a/src/main/java/com/lz/modules/flow/entity/StaffRole.java +++ b/src/main/java/com/lz/modules/flow/entity/StaffRole.java @@ -44,6 +44,9 @@ public class StaffRole implements java.io.Serializable { //组id @ApiModelProperty(value = "组id", name = "evaluationGroupId") private Long evaluationGroupId; + //是否是必选 + @ApiModelProperty(value = "是否是必选", name = "isSelect") + private Integer isSelect; /** * * @return @@ -179,6 +182,21 @@ public class StaffRole implements java.io.Serializable { this.evaluationGroupId = evaluationGroupId; } + /** + * 是否是必选 + * @return + */ + public Integer getIsSelect() { + return isSelect; + } + /** + * 是否是必选 + * @param isSelect + */ + public void setIsSelect(Integer isSelect) { + this.isSelect = isSelect; + } + @Override public String toString() { return "StaffRole{" + @@ -191,6 +209,7 @@ public class StaffRole implements java.io.Serializable { ",typeRoleIds=" + typeRoleIds + ",staffName=" + staffName + ",evaluationGroupId=" + evaluationGroupId + + ",isSelect=" + isSelect + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java index a78c917a..325821e1 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/EvaluationGroupServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lz.common.utils.ISelect; import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; +import com.lz.modules.app.service.StaffOccupationService; import com.lz.modules.app.service.StaffService; import com.lz.modules.flow.dao.EvaluationGroupMapper; import com.lz.modules.flow.entity.EvaluationGroup; @@ -33,6 +34,8 @@ public class EvaluationGroupServiceImpl extends ServiceImpl(new HashSet(depStaffIds)); + List distDepStaffIds = new ArrayList<>(new HashSet(depStaffIds)); + //去除离职 + List data = staffOccupationService.removeDimissionStaffByStaffIds(distDepStaffIds); + return data; } @Override diff --git a/src/main/java/com/lz/modules/performance/res/AssessListRes.java b/src/main/java/com/lz/modules/performance/res/AssessListRes.java deleted file mode 100644 index 948511e4..00000000 --- a/src/main/java/com/lz/modules/performance/res/AssessListRes.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.lz.modules.performance.res; - -import lombok.Data; - -/** - * @Author: djc - * @Desc: - * @Date: 2020/10/20 15:54 - */ -@Data -public class AssessListRes { - //考核名称 - private String name; - //时间周期 - private String cycleTime; - //组人员 - private String groupNum; -} diff --git a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java index e7763d3a..a9f9a10e 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/ChartResultServiceImpl.java @@ -55,16 +55,19 @@ public class ChartResultServiceImpl implements ChartResultService { AssessListReq query = new AssessListReq(); ChartStatisticalRes res; BeanUtils.copyProperties(req,query); + List process = resultRecordService.countNumByFlowProcess(query); res = new ChartStatisticalRes(); res.setType(0); res.setData(process); data.add(res); + List scoreLevel = resultRecordService.countNumByScoreLevel(query); res = new ChartStatisticalRes(); res.setType(1); res.setData(scoreLevel); data.add(res); + List strings = evaluationGroupService.selectAllStaffIdsByGroupId(3L); List depstaff = this.countDepartmentAndStaffNum(strings); res = new ChartStatisticalRes(); @@ -80,10 +83,12 @@ public class ChartResultServiceImpl implements ChartResultService { if(CollectionUtils.isEmpty(staffIds)){ return Collections.EMPTY_LIST; } + List data = new ArrayList<>(); List list = departmentsStaffRelateService.list(new QueryWrapper() .eq("is_delete", 0) .in("staff_id", staffIds)); + Map map = Maps.newHashMap(); for(DepartmentsStaffRelateEntity entity:list){ String departmentId = entity.getDepartmentId(); diff --git a/src/main/resources/mapper/flow/StaffRoleMapper.xml b/src/main/resources/mapper/flow/StaffRoleMapper.xml index f0f10ec4..fd55ce3c 100644 --- a/src/main/resources/mapper/flow/StaffRoleMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleMapper.xml @@ -13,12 +13,13 @@ + - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, type_role_ids AS typeRoleIds, staff_name AS staffName, evaluation_group_id AS evaluationGroupId + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, type_role_ids AS typeRoleIds, staff_name AS staffName, evaluation_group_id AS evaluationGroupId, is_select AS isSelect @@ -36,6 +37,7 @@ type_role_ids, staff_name, evaluation_group_id, + is_select, is_delete, gmt_create, gmt_modified @@ -45,6 +47,7 @@ #{ typeRoleIds}, #{ staffName}, #{ evaluationGroupId}, + #{ isSelect}, 0, now(), now() @@ -62,7 +65,8 @@ department_level = #{departmentLevel}, type_role_ids = #{typeRoleIds}, staff_name = #{staffName}, - evaluation_group_id = #{evaluationGroupId} + evaluation_group_id = #{evaluationGroupId}, + is_select = #{isSelect} ,gmt_modified = now() where id = #{id} @@ -79,7 +83,8 @@ department_level = #{departmentLevel}, type_role_ids = #{typeRoleIds}, staff_name = #{staffName}, - evaluation_group_id = #{evaluationGroupId} + evaluation_group_id = #{evaluationGroupId}, + is_select = #{isSelect} ,gmt_modified = now() where id = #{id} diff --git a/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml b/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml index 74573101..cb8e442b 100644 --- a/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml +++ b/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml @@ -94,4 +94,13 @@ + + diff --git a/src/main/resources/mapper/generator/StaffOccupationDao.xml b/src/main/resources/mapper/generator/StaffOccupationDao.xml index fcbde85d..c5e70cfc 100644 --- a/src/main/resources/mapper/generator/StaffOccupationDao.xml +++ b/src/main/resources/mapper/generator/StaffOccupationDao.xml @@ -59,4 +59,13 @@ update lz_staff_occupation set staff_status=#{departmentStaffBo.status},resignation_time=null, position=#{departmentStaffBo.position}, staff_no=#{departmentStaffBo.employeeNo} where is_delete=0 and staff_id = #{staffId} + + diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index 6f770727..d2303851 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -73,7 +73,7 @@ public class MysqlMain { list.add(new TablesBean("lz_flow_chart_role")); list.add(new TablesBean("lz_flow_start")); list.add(new TablesBean("lz_result_calculate")); - list.add(new TablesBean("lz_result_dimension")); + list.add(new TablesBean("lz_result_dimension"));' list.add(new TablesBean("lz_result_grade"));*/ //list.add(new TablesBean("lz_result_model")); //list.add(new TablesBean("lz_result_score"));