人员考核结果按考核时间排序;解决评分保存未计算等级问题;解决未评分时考核任务清单中查看评分详情报错

master
wany 2024-09-13 13:16:10 +08:00
parent d090a638fd
commit 1a88af49dd
3 changed files with 38 additions and 21 deletions

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.db.dto.MonthRangeSo;
import com.gunshi.project.xyt.entity.so.AssessTaskPageSo;
import com.gunshi.project.xyt.entity.vo.AssessResultVo;
import com.gunshi.project.xyt.model.AssessIndicator;
import com.gunshi.project.xyt.model.AssessObject;
import com.gunshi.project.xyt.model.AssessTask;
import org.apache.ibatis.annotations.Mapper;
@ -23,11 +24,12 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
@Select("""
<script>
select t1.indicator_id from public.assess_template_indicator_rel t1
select t1.indicator_id,t2.standard_score from public.assess_template_indicator_rel t1
left join public.assess_indicator t2 on t1.indicator_id = t2.id
where t1.template_id = #{templateId}
</script>
""")
List<Long> queryIndicators(@Param("templateId") Long templateId);
List<AssessIndicator> queryIndicators(@Param("templateId") Long templateId);
@Select("""
<script>
@ -84,7 +86,8 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
@Select("""
<script>
select t.object_id,t.indicator_id,t.standard_score,t.assess_score,s.object_user_name,s.assess_score as resScore,m.indicator_name,n.name as categoryName from public.assess_object_rating t
select t.object_id,t.indicator_id,t.standard_score,t.assess_score,s.object_user_name,s.assess_score as resScore,m.indicator_name,n.name as categoryName
from public.assess_object_rating t
left join public.assess_object s on t.object_id = s.id
left join public.assess_indicator m on t.indicator_id = m.id
left join public.assess_category n on m.category_id = n.id
@ -108,6 +111,7 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
where t.status = 3
and date_trunc('MONTH', t.start_date) <![CDATA[>=]]> #{obj.start}
and date_trunc('MONTH', t.start_date) <![CDATA[<=]]> #{obj.end}
order by t.start_date
</script>
""")
List<AssessTask> resultStat(@Param("obj") MonthRangeSo monthRangeSo);

View File

@ -45,6 +45,9 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
@Autowired
private AssessObjectRatingMapper objectRatingMapper;
@Autowired
private AssessTeamRatingService teamRatingService;
public AssessTask saveData(AssessTask dto) {
dto.setId(IdWorker.getId());
dto.setStatus(0);
@ -116,6 +119,21 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
List<AssessTeam> teams = assessObjectService.getTeam(id);
teams.stream().forEach(o->o.setStatus(1));
assessObjectService.updateTeams(teams);
//考核指标
List<AssessTeamRating> ratings = new ArrayList<>();
List<AssessIndicator> indicatorIds = this.baseMapper.queryIndicators(task.getTemplateId());
for(AssessTeam team : teams){
for(AssessIndicator indicator : indicatorIds){
AssessTeamRating rating = new AssessTeamRating();
rating.setId(IdWorker.getId());
rating.setTeamId(team.getId());
rating.setIndicatorId(indicator.getId());
rating.setStandardScore(indicator.getStandardScore());
ratings.add(rating);
}
}
teamRatingService.saveBatch(ratings);
return "启动成功";
}

View File

@ -56,8 +56,11 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
@Autowired
private AssessIndicatorRatingService indicatorRatingService;
public Boolean saveScore(AssessScoreVo vo) {
return commonScore(vo,9);
}
public Boolean score(AssessScoreVo vo) {
private Boolean commonScore(AssessScoreVo vo,Integer status){
List<AssessTeamRating> ratings = vo.getRatings();
Long teamId = ratings.get(0).getTeamId();
this.delData(teamId);
@ -69,7 +72,7 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
AssessTask task = taskMapper.selectById(vo.getTaskId());
//更新该考核人员对考核对象的状态为已评分
AssessTeam assessTeam = teamMapper.selectById(teamId);
assessTeam.setStatus(2);
assessTeam.setStatus(status);
//获取模板信息
AssessTemplate template = templateMapper.selectById(task.getTemplateId());
//根据总得分计算等级
@ -78,10 +81,16 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
assessTeam.setAssessLevel(level);
teamMapper.updateById(assessTeam);
Boolean res = this.saveBatch(ratings);
updateObjectAndTask(assessTeam.getObjectId(),vo.getTaskId(),template,task);
if(status == 2){
updateObjectAndTask(assessTeam.getObjectId(),vo.getTaskId(),template,task);
}
return res;
}
public Boolean score(AssessScoreVo vo) {
return commonScore(vo,2);
}
private void delData(Long teamId) {
List<AssessTeamRating> teamRatings = this.list(new QueryWrapper<AssessTeamRating>().eq("team_id", teamId));
if(CollectionUtils.isNotEmpty(teamRatings)){
@ -176,21 +185,7 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
return list;
}
public Boolean saveScore(AssessScoreVo vo) {
List<AssessTeamRating> ratings = vo.getRatings();
for(AssessTeamRating rating : ratings){
rating.setId(IdWorker.getId());
rating.setRectifyStatus(0);
fileService.save(rating.getFiles(), rating.getId().toString(), getGroupId(),getScoreType());
}
Long teamId = ratings.get(0).getTeamId();
this.delData(teamId);
AssessTeam assessTeam = teamMapper.selectById(teamId);
assessTeam.setAssessScore(vo.getScore());
assessTeam.setStatus(9);
teamMapper.updateById(assessTeam);
return this.saveOrUpdateBatch(ratings);
}
public Map<Long,List<AssessRatingVo>> scoreDetail(Long objectId) {
List<AssessRatingVo> list = this.baseMapper.scoreByObjectId(objectId);