修复当考评组人员全部删除时,删除考评组对应的start里面的组信息
This commit is contained in:
parent
4acdb4ec07
commit
ba6c3fd372
@ -0,0 +1,31 @@
|
||||
package com.lz.modules.flow.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* </p>*业绩记录表
|
||||
* @author quyixiao
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("lz_result_record")
|
||||
@ApiModel(value = "一次业绩中一个组内人员个数")
|
||||
public class GroupResultRecordStaffsCount implements java.io.Serializable {
|
||||
|
||||
//当前是目标确认还是评分,0,目标制定,1,目标确认,2执行中,3,结果值录入,4,评分,5考核结束
|
||||
@ApiModelProperty(value = "本次绩效考核已经发起人员个数", name = "count")
|
||||
private Integer count;
|
||||
//考核组id
|
||||
@ApiModelProperty(value = "考核组id", name = "evaluationId")
|
||||
private Long evaluationId;
|
||||
}
|
||||
@ -20,6 +20,7 @@ import com.lz.modules.flow.dao.FlowRecordMapper;
|
||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.entity.GroupResultRecordStaffsCount;
|
||||
import com.lz.modules.flow.model.GroupStaffs;
|
||||
import com.lz.modules.flow.model.StartGroups;
|
||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
||||
@ -44,6 +45,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
@ -207,9 +210,9 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
String[] changeStaffIds = req.getStaffIds().split(",");
|
||||
List<String> change = new ArrayList<>(Arrays.asList(changeStaffIds));
|
||||
|
||||
if(req.getChangeType() == 0){
|
||||
//获取所有考核人员
|
||||
List<String> all = Lists.newArrayList();
|
||||
if(req.getChangeType() == 0){//添加人员
|
||||
|
||||
List<String> all = Lists.newArrayList();//获取所有考核人员
|
||||
|
||||
//根据组id成员分组
|
||||
Map<Long,List<String>> map = Maps.newHashMap();
|
||||
@ -270,12 +273,50 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
if(req.getChangeType() == 1 && CollectionUtils.isNotEmpty(change)){
|
||||
//删除钉钉任务
|
||||
try {
|
||||
List<Long> recordIds = resultRecordMapper.selectIdsByStartIdAndStaffIds(req.getStartId(),change);
|
||||
List<ResultRecord> resultRecords = resultRecordMapper.selectResultRecordsByStartIdAndStaffIds(req.getStartId(),change);
|
||||
Map<Long, Map<Long, Long>> rIdAndStaffIds = new HashMap<>();
|
||||
List<Long> recordIds = resultRecords.stream().map(new Function<ResultRecord, Long>() {
|
||||
@Override
|
||||
public Long apply(ResultRecord resultRecord) {
|
||||
Map<Long, Long> staffIds = rIdAndStaffIds.get(resultRecord.getEvaluationId());
|
||||
if(staffIds == null){
|
||||
staffIds = new HashMap<>();
|
||||
rIdAndStaffIds.put(resultRecord.getEvaluationId(), staffIds);
|
||||
}
|
||||
Long staffId = staffIds.get(resultRecord.getStaffId());
|
||||
if(staffId == null){
|
||||
staffIds.put(resultRecord.getStaffId(), resultRecord.getStaffId());
|
||||
}
|
||||
return resultRecord.getId();
|
||||
}
|
||||
}).collect(toList());
|
||||
|
||||
if(!CollectionUtils.isEmpty(recordIds)){
|
||||
log.info("删除resultRecordIds: " + JSON.toJSONString(recordIds));
|
||||
String s = dingtalkBusiness.delWorkMSGWithStart(recordIds);
|
||||
log.info("清除钉钉任务响应,res: " +s);
|
||||
}
|
||||
List<GroupResultRecordStaffsCount> groupResultRecordStaffsCounts =
|
||||
resultRecordMapper.selectGroupResultRecordsStaffsCountByStartId(req.getStartId());
|
||||
for (GroupResultRecordStaffsCount groupResultRecordStaffsCount:groupResultRecordStaffsCounts
|
||||
) {
|
||||
//从flowstart中删除全部删完的考核组信息
|
||||
Map<Long, Long> staffIds = rIdAndStaffIds.get(groupResultRecordStaffsCount.getEvaluationId());
|
||||
if(staffIds != null && staffIds.size() == groupResultRecordStaffsCount.getCount()){
|
||||
//这次全部删除了该考评组下面的人,那么删除考评组对应的start里面的信息
|
||||
for (Long id:ids
|
||||
) {
|
||||
if(id == groupResultRecordStaffsCount.getEvaluationId()){
|
||||
ids.remove(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ids.size() != split.length){//更新考核组信息
|
||||
flowStart.setGroupIds(String.join(",", ids.toString()));
|
||||
flowStartService.updateFlowStartById(flowStart);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("调用钉钉清除任务异常,e:" ,e);
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import com.lz.modules.app.dto.ReportProgressListDto;
|
||||
import com.lz.modules.app.req.ReportListReq;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.flow.entity.GroupResultRecordStaffsCount;
|
||||
import com.lz.modules.flow.model.ResultRecordDto;
|
||||
import com.lz.modules.performance.dto.LevelDetailExportDto;
|
||||
import com.lz.modules.performance.dto.ToScoreDingTalkDto;
|
||||
@ -117,4 +118,10 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
List<ResultRecord> selectStaffIdsByStartIdAndFlowProcess(@Param("startId") Long startId, @Param("flowProcess") Long flowProcess);
|
||||
|
||||
List<Long> selectIdsByStartIdAndStaffIds(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);
|
||||
List<ResultRecord> selectResultRecordsByStartIdAndStaffIds(@Param("startId")Long startId,
|
||||
@Param("staffIds") List<String> staffIds);
|
||||
|
||||
List<GroupResultRecordStaffsCount> selectGroupResultRecordsStaffsCountByStartId(@Param("startId") Long startId);
|
||||
|
||||
List<ResultRecord> selectResultRecordByGroupIds(@Param("groupIds") List<Long> groupIds);
|
||||
}
|
||||
@ -138,4 +138,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
List<Long> selectStaffIdsByFlowProcess(List<Integer> flowProcess);
|
||||
|
||||
R saveDetail(Long userId, ResultRecordDetailDto dto);
|
||||
|
||||
List<ResultRecord> selectResultRecordByGroupIds(List<Long> groupIds);
|
||||
}
|
||||
@ -1930,4 +1930,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
return R.ok().put("commentId", commentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResultRecord> selectResultRecordByGroupIds(List<Long> groupIds){
|
||||
return resultRecordMapper.selectResultRecordByGroupIds(groupIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,11 @@ import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.flow.model.ResultTagetLibDto;
|
||||
import com.lz.modules.flow.req.FlowReSendDingTalkMsgReq;
|
||||
import com.lz.modules.flow.service.FlowStartService;
|
||||
import com.lz.modules.job.business.DingtalkBusiness;
|
||||
import com.lz.modules.performance.service.ResultTagetLibService;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import com.lz.modules.third.entity.ThirdAppConfig;
|
||||
@ -50,6 +52,9 @@ public class ThirdAppConfigController {
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
|
||||
@Autowired
|
||||
private ResultTagetLibService resultTagetLibService;
|
||||
|
||||
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestBody String body) {
|
||||
@ -61,12 +66,24 @@ public class ThirdAppConfigController {
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
//同步人员信息
|
||||
@GetMapping("/syn")
|
||||
public R syn(@RequestParam String appid) {
|
||||
dingtalkBusiness.getDingTalkepartmentsIntoData(appid);
|
||||
return R.ok();
|
||||
}
|
||||
//重新生成绩效详情
|
||||
@PostMapping("/reStartFlow")
|
||||
public R reStartFlow(@RequestBody List<Long> groupIds) {
|
||||
List<ResultRecord> resultRecordList = resultRecordService.selectResultRecordByGroupIds(groupIds);
|
||||
for (ResultRecord resultRecord:resultRecordList
|
||||
) {
|
||||
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(resultRecord.getId());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
//从新发送钉钉消息
|
||||
@PostMapping("/reSendDingTalkMst")
|
||||
public R reSendDingTalkMst(@RequestBody FlowReSendDingTalkMsgReq flowReSendDingTalkMsgReq) {
|
||||
|
||||
|
||||
@ -663,5 +663,31 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectResultRecordsByStartIdAndStaffIds" resultType="java.lang.Long">
|
||||
select * from lz_result_record where is_delete = 0
|
||||
and start_id = #{startId}
|
||||
and staff_id in (
|
||||
<foreach collection="staffIds" item="staff_id" separator=",">
|
||||
#{staff_id}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectGroupResultRecordsStaffsCountByStartId" resultType="java.lang.Long">
|
||||
select evaluation_id, count(evaluation_id) as count from lz_result_record where is_delete = 0
|
||||
and start_id = #{startId}
|
||||
group by evaluation_id
|
||||
</select>
|
||||
|
||||
<select id="selectResultRecordByGroupIds" resultType="java.lang.Long">
|
||||
select * from lz_result_record where is_delete = 0
|
||||
and evaluation_id in (
|
||||
<foreach collection="groupIds" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user