Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
2fa844d6fa
@ -41,4 +41,9 @@ public interface EvaluationStartStaffMapper extends BaseMapper<EvaluationStartSt
|
||||
|
||||
int existByStartIdAndEvaluationId(@Param("startId") Long startId,@Param("evaluationId")Long evaluationId);
|
||||
|
||||
int updateBatchToScore(@Param("startId") Long startId,@Param("evaluationId")Long evaluationId);
|
||||
|
||||
int deleteEvaluationStartStaffChangeAssess(@Param("startId") Long startId,@Param("staffIds") List<String> staffIds);
|
||||
|
||||
List<Long> selectStaffIdsByStart(@Param("startId") Long startId);
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.req.EvaluationGroupReq;
|
||||
import com.lz.modules.performance.dto.CheckStaffDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -48,4 +49,6 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
|
||||
List<StaffSimpleInfo> selectAllStaffSimpleInfoByGroupId(EvaluationGroup evaluationGroup);
|
||||
|
||||
void deleteByIds(List<Long> ids);
|
||||
|
||||
List<CheckStaffDto> checkStaff(EvaluationGroup evaluationGroup);
|
||||
}
|
||||
@ -38,4 +38,6 @@ public interface EvaluationStartStaffService extends IService<EvaluationStartSta
|
||||
|
||||
EvaluationStartStaff selectManagerEvaluationStartStaff(Long evaluationId, Long userId);
|
||||
|
||||
int updateBatchToScore(Long startId,Long evaluationId);
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.lz.modules.flow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.ISelect;
|
||||
@ -18,6 +19,8 @@ import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.req.EvaluationGroupReq;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.performance.dto.CheckStaffDto;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -139,6 +142,11 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
if(evaluationGroup ==null ){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
return getStaffIdsByGroup(evaluationGroup);
|
||||
}
|
||||
|
||||
|
||||
private List<String> getStaffIdsByGroup(EvaluationGroup evaluationGroup){
|
||||
String depIds = evaluationGroup.getDepIds();
|
||||
Set<String> allDeparmentIds = new HashSet<>();
|
||||
if(StringUtils.isNotBlank(depIds)){
|
||||
@ -165,7 +173,6 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
List<String> data = staffOccupationService.removeDimissionStaffByStaffIds(distDepStaffIds);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EvaluationGroup> selectEvaluationGroupByIds(List<Long> ids){
|
||||
return evaluationGroupMapper.selectEvaluationGroupByIds(ids);
|
||||
@ -251,4 +258,28 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
public void deleteByIds(List<Long> ids) {
|
||||
evaluationGroupMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CheckStaffDto> checkStaff(EvaluationGroup evaluationGroup) {
|
||||
List<CheckStaffDto> staffs= new ArrayList<>();
|
||||
//本次参加人员
|
||||
List<String> staffIdsByGroup = getStaffIdsByGroup(evaluationGroup);
|
||||
|
||||
//获取之前
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupMapper.selectList(new QueryWrapper<EvaluationGroup>()
|
||||
.eq("is_delete", 0).eq("copy_id", 0));
|
||||
|
||||
if(CollectionUtils.isEmpty(evaluationGroups)){
|
||||
return staffs;
|
||||
}
|
||||
evaluationGroups.stream().map(new Function<EvaluationGroup, CheckStaffDto>() {
|
||||
@Override
|
||||
public CheckStaffDto apply(EvaluationGroup evaluationGroup) {
|
||||
//evaluationGroupService.
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,4 +99,8 @@ public class EvaluationStartStaffServiceImpl extends ServiceImpl<EvaluationStart
|
||||
return evaluationStartStaffMapper.selectManagerEvaluationStartStaff(evaluationId,userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBatchToScore(Long startId,Long evaluationId) {
|
||||
return evaluationStartStaffMapper.updateBatchToScore(startId, evaluationId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,4 +188,15 @@ public class EvaluationGroupController {
|
||||
return evaluationGroupService.deleteEvaluationGroupById(id);
|
||||
//return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/checkStaff")
|
||||
@ApiOperation("校验是否有跨组人员")
|
||||
public R checkStaff(@RequestParam @RequestBody @ApiParam EvaluationGroup evaluationGroup) {
|
||||
|
||||
evaluationGroupService.checkStaff(evaluationGroup);
|
||||
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.lz.modules.performance.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
* @Desc:
|
||||
* @Date: 2020/10/30 10:04
|
||||
*/
|
||||
@Data
|
||||
public class CheckStaffDto {
|
||||
|
||||
private String staffName;
|
||||
|
||||
private Long evaluationId;
|
||||
|
||||
private Long staffId;
|
||||
}
|
||||
@ -1,16 +1,24 @@
|
||||
package com.lz.modules.performance.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dto.ApprovalDto;
|
||||
import com.lz.modules.app.dto.StaffSimpleDto;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.entity.EvaluationStartStaff;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.model.GroupStaffs;
|
||||
import com.lz.modules.flow.model.StartGroups;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
import com.lz.modules.flow.service.EvaluationStartStaffService;
|
||||
import com.lz.modules.flow.service.FlowRecordService;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.performance.req.AssessChangeReq;
|
||||
import com.lz.modules.performance.req.AssessDetailReq;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
@ -20,6 +28,7 @@ import com.lz.modules.performance.res.AssessManagerListRes;
|
||||
import com.lz.modules.performance.service.AssessManagerService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import com.sun.org.apache.regexp.internal.RE;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -49,6 +58,12 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
private EvaluationStartStaffService evaluationStartStaffService;
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
@Autowired
|
||||
private EvaluationStartStaffMapper evaluationStartStaffMapper;
|
||||
@Autowired
|
||||
private FlowStartService flowStartService;
|
||||
|
||||
@Override
|
||||
public PageUtils assessList(AssessListReq req) {
|
||||
@ -118,29 +133,60 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
List<String> strings = Arrays.asList(split);
|
||||
List<Long> ids = strings.stream().map(s -> Long.valueOf(s)).collect(toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
|
||||
Set<String> staffIds = new HashSet<>();
|
||||
//获取所有考核人员
|
||||
for(EvaluationGroup group:evaluationGroups){
|
||||
List<String> staff = evaluationGroupService.selectAllStaffIdsByGroupId(group.getId());
|
||||
staffIds.addAll(staff);
|
||||
}
|
||||
List<String> all = new ArrayList<>(staffIds);
|
||||
|
||||
//获取变更人员
|
||||
String[] changeStaffIds = req.getStaffIds().split(",");
|
||||
List<String> change = Arrays.asList(changeStaffIds);
|
||||
List<String> change = new ArrayList<>(Arrays.asList(changeStaffIds));
|
||||
|
||||
if(req.getChangeType() == 0){
|
||||
//获取不在考评组的人员
|
||||
//获取所有考核人员
|
||||
List<String> all = new ArrayList<>();
|
||||
|
||||
//根据组id成员分组
|
||||
Map<Long,List<String>> map = Maps.newHashMap();
|
||||
for(EvaluationGroup group:evaluationGroups){
|
||||
List<String> staff = evaluationGroupService.selectAllStaffIdsByGroupId(group.getId());
|
||||
all.addAll(staff);
|
||||
map.put(group.getId(),staff);
|
||||
}
|
||||
|
||||
//获取不在考核组成员
|
||||
List<String> notInGroup = change.stream().filter(item -> !all.contains(item)).collect(toList());
|
||||
|
||||
//获取不在考评组的人员
|
||||
if(CollectionUtils.isNotEmpty(notInGroup)){
|
||||
List<Long> collect = notInGroup.stream().map(s -> Long.valueOf(s)).collect(toList());
|
||||
List<Long> collect = notInGroup.stream().map(s -> Long.valueOf(s)).distinct().collect(toList());
|
||||
List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(collect);
|
||||
String notInGroupNames = StringUtil.EMPTY;
|
||||
for(StaffSimpleDto dto:staffSimpleDtos){
|
||||
notInGroupNames = notInGroupNames + dto.getName() + " ";
|
||||
}
|
||||
return notInGroupNames;
|
||||
return notInGroupNames + "已在其他类型为月度的考评组中,是否改为到此考评组中进行考核";
|
||||
}
|
||||
//初始化添加用户的数据 TODO
|
||||
|
||||
//初始化添加用户的数据
|
||||
List<GroupStaffs> groupS = new ArrayList<>();
|
||||
|
||||
//排除已发起过的
|
||||
List<Long> longs = evaluationStartStaffMapper.selectStaffIdsByStart(req.getStartId());
|
||||
|
||||
for(EvaluationGroup group:evaluationGroups){
|
||||
GroupStaffs groupStaffs = new GroupStaffs();
|
||||
groupStaffs.setEvaluationGroup(group);
|
||||
|
||||
List<String> staffs = map.get(group.getId());
|
||||
staffs.retainAll(notInGroup);
|
||||
|
||||
List<Long> collect = staffs.stream().map(s -> Long.valueOf(s)).collect(toList());
|
||||
collect.removeAll(longs);
|
||||
groupStaffs.setStaffIds(collect);
|
||||
groupS.add(groupStaffs);
|
||||
}
|
||||
|
||||
StartGroups startGroups = new StartGroups();
|
||||
startGroups.setStartId(req.getStartId());
|
||||
startGroups.setGroups(groupS);
|
||||
flowStartService.startStaffs(startGroups);
|
||||
return ok;
|
||||
|
||||
|
||||
@ -148,6 +194,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
if(req.getChangeType() == 1){
|
||||
//删除本次考核任务
|
||||
resultRecordMapper.batchDeleteByStartIdAndStaffId(req.getStartId(),change);
|
||||
evaluationStartStaffMapper.deleteEvaluationStartStaffChangeAssess(req.getStartId(),change);
|
||||
return ok;
|
||||
}
|
||||
return ok;
|
||||
@ -158,11 +205,23 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
@Override
|
||||
public void toScore(AssessToScoreReq req) {
|
||||
String[] split = req.getEvaluationIds().split(",");
|
||||
Arrays.asList(split);
|
||||
for(String s:split){
|
||||
Long evaluation = Long.valueOf(s);
|
||||
//更新评分
|
||||
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), evaluation);
|
||||
|
||||
/* evaluationStartStaffService.updateBatchById()
|
||||
evaluationStartStaffService.saveBatch()*/
|
||||
List<Long> longs = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
|
||||
|
||||
}
|
||||
List<String> strings = Arrays.asList(split);
|
||||
|
||||
//更新流程绩效
|
||||
ApprovalDto approvalDto = new ApprovalDto();
|
||||
try {
|
||||
resultRecordService.newApproval(approvalDto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -183,4 +242,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
return evaluationStartStaffs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -90,4 +90,6 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
List<ChartStatistical> countAssessNumByFlowProcess(@Param("req")AssessDetailReq req);
|
||||
|
||||
void batchDeleteByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);
|
||||
|
||||
List<Long> selectToScoreList(@Param("startId")Long startId,@Param("evaluationId")Long evaluationId);
|
||||
}
|
||||
@ -461,5 +461,12 @@
|
||||
)
|
||||
</update>
|
||||
|
||||
<select id="selectToScoreList" resultType="long">
|
||||
select id from lz_result_record where is_delete = 0
|
||||
and start_id = #{startId}
|
||||
and flow_process = 2
|
||||
and evaluation_id = #{evaluationId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -137,5 +137,35 @@
|
||||
select count(1) from lz_evaluation_start_staff where is_delete = 0 and evaluation_id=#{evaluationId}
|
||||
AND start_id =#{startId} and score = 1 limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateBatchToScore">
|
||||
update
|
||||
lz_evaluation_start_staff
|
||||
set
|
||||
score = 1,
|
||||
,gmt_modified = now()
|
||||
where is_delete = 0 and score = 0 and type = 0
|
||||
and evaluation_id = #{evaluationId} and start_id = #{startId}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="deleteEvaluationStartStaffChangeAssess">
|
||||
update
|
||||
lz_evaluation_start_staff
|
||||
set
|
||||
is_delete = 1,
|
||||
,gmt_modified = now()
|
||||
where is_delete = 0 and type = 0
|
||||
and start_id = #{startId}
|
||||
and staff_id in (
|
||||
<foreach collection="staffIds" item="staff_id" separator=",">
|
||||
#{staff_id}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
|
||||
<select id="selectStaffIdsByStart" resultType="long">
|
||||
select staff_id from lz_evaluation_start_staff where start_id=#{startId} and is_delete = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user