This commit is contained in:
杜建超 2020-10-21 11:16:08 +08:00
parent e1f1b4eeb7
commit 53ed800463
12 changed files with 58 additions and 37 deletions

View File

@ -63,5 +63,5 @@ public interface DepartmentsStaffRelateDao extends BaseMapper<DepartmentsStaffRe
List<ReportProgressListDto> getDepartmentNameByStaffIds(@Param("staffIds") List<String> staffIds);
List<String> selectStaffIdsByDepartments(@Param("deparmentIds")List<String> deparmentIds);
}

View File

@ -31,4 +31,6 @@ public interface StaffOccupationDao extends BaseMapper<StaffOccupationEntity> {
void updateAllOccupation();
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
List<String> removeDimissionStaffByStaffIds(@Param("staffIds") List<String> staffIds);
}

View File

@ -40,5 +40,7 @@ public interface DepartmentsStaffRelateService extends IService<DepartmentsStaff
DepartmentsStaffRelateEntity selectDepartmentByDepartmentId(String departmentId);
DepartmentsStaffRelateEntity selectByStaffId(Long staffId);
List<String> selectStaffIdsByDepartments(List<String> deparmentIds);
}

View File

@ -31,5 +31,7 @@ public interface StaffOccupationService extends IService<StaffOccupationEntity>
void updateAllOccupation();
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
List<String> removeDimissionStaffByStaffIds(List<String> staffIds);
}

View File

@ -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<DepartmentsSt
public DepartmentsStaffRelateEntity selectByStaffId(Long staffId) {
return departmentsStaffRelateDao.selectByStaffId(staffId);
}
@Override
public List<String> selectStaffIdsByDepartments(List<String> deparmentIds) {
if(CollectionUtils.isEmpty(deparmentIds)){
return Collections.EMPTY_LIST;
}
return departmentsStaffRelateDao.selectStaffIdsByDepartments(deparmentIds);
}
}

View File

@ -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<StaffOccupationDao,
staffOccupationDao.updateStatusByStaff(staffId, departmentStaffBo);
}
@Override
public List<String> removeDimissionStaffByStaffIds(List<String> staffIds) {
if(CollectionUtils.isEmpty(staffIds)){
return Collections.EMPTY_LIST;
}
return staffOccupationDao.removeDimissionStaffByStaffIds(staffIds);
}
}

View File

@ -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<StaffDao, StaffEntity> impleme
return Lists.newArrayList();
}
//获取所有人员
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
.select("staff_id")
.eq("is_delete", 0)
.in("department_id", deparmentIds));
List<String> list = departmentsStaffRelateService.selectStaffIdsByDepartments(deparmentIds);
if(CollectionUtils.isEmpty(list)){
return Lists.newArrayList();
}
//获取人员个数去重
List<String> 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<String> staffdistincts = staffs.stream().distinct().collect(Collectors.toList());
return staffdistincts;
//获取人员个数去重, 去除离职
List<String> data = staffOccupationService.removeDimissionStaffByStaffIds(list);
return new ArrayList<>(new HashSet(data));
}

View File

@ -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<EvaluationGroupMappe
private EvaluationGroupMapper evaluationGroupMapper;
@Autowired
private StaffService staffService;
@Autowired
private StaffOccupationService staffOccupationService;
@ -102,7 +105,9 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
String[] split = outIds.split(",");
depStaffIds.removeAll(Arrays.asList(split));
}
//去重
return new ArrayList<>(new HashSet(depStaffIds));
List<String> distDepStaffIds = new ArrayList<>(new HashSet(depStaffIds));
//去除离职
List<String> data = staffOccupationService.removeDimissionStaffByStaffIds(distDepStaffIds);
return data;
}
}

View File

@ -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;
}

View File

@ -343,7 +343,7 @@
</select>
<select id="countNumByScoreLevel" resultType="com.lz.modules.performance.res.ChartStatistical">
SELECT count(score_level) num,score_level as 'desc' from lz_result_record where is_delete=0 GROUP BY score_level
SELECT count(score_level) num,CASE score_level WHEN '0' THEN '无等级' ELSE score_level END as 'desc' from lz_result_record where is_delete=0 GROUP BY score_level
</select>
<select id="selectResultRankList" resultType="com.lz.modules.performance.res.ResultRankListRes">

View File

@ -94,4 +94,13 @@
</foreach>
</select>
<select id="selectStaffIdsByDepartments" resultType="String">
SELECT staff_id from lz_departments_staff_relate where is_delete = 0 and
department_id in
<foreach collection="deparmentIds" item="department_id" open="(" close=")"
separator=",">
#{department_id}
</foreach>
</select>
</mapper>

View File

@ -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}
</update>
<select id="removeDimissionStaffByStaffIds" resultType="String">
SELECT staff_id from lz_staff_occupation where staff_status = 0 and
staff_id in
<foreach collection="staffIds" item="staff_id" open="(" close=")"
separator=",">
#{staff_id}
</foreach>
</select>
</mapper>