61 lines
2.0 KiB
Java
61 lines
2.0 KiB
Java
|
|
package com.gunshi.project.xyt.service;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||
|
|
import com.gunshi.project.xyt.mapper.AssessTeamMapper;
|
||
|
|
import com.gunshi.project.xyt.mapper.AssessTeamRatingMapper;
|
||
|
|
import com.gunshi.project.xyt.model.AssessTeam;
|
||
|
|
import com.gunshi.project.xyt.model.AssessTeamRating;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
import org.springframework.transaction.annotation.Transactional;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 描述: 考核评分详情
|
||
|
|
* author: xusan
|
||
|
|
* date: 2024-09-05 14:20:04
|
||
|
|
*/
|
||
|
|
@Service
|
||
|
|
@Slf4j
|
||
|
|
@Transactional(rollbackFor = Exception.class)
|
||
|
|
public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper, AssessTeamRating>
|
||
|
|
{
|
||
|
|
@Autowired
|
||
|
|
private FileAssociationsService fileService;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private AssessTeamMapper teamMapper;
|
||
|
|
|
||
|
|
|
||
|
|
public Boolean score(List<AssessTeamRating> dto) {
|
||
|
|
for(AssessTeamRating rating : dto){
|
||
|
|
rating.setId(IdWorker.getId());
|
||
|
|
fileService.saveFile(rating.getFiles(), getGroupId(), rating.getId().toString());
|
||
|
|
}
|
||
|
|
//更新该考核人员对考核对象的状态为已评分
|
||
|
|
Long teamId = dto.get(0).getTeamId();
|
||
|
|
AssessTeam assessTeam = teamMapper.selectById(teamId);
|
||
|
|
assessTeam.setStatus(2);
|
||
|
|
teamMapper.updateById(assessTeam);
|
||
|
|
updateObjectAndTask(assessTeam.getObjectId(),assessTeam.getTaskId());
|
||
|
|
return this.saveBatch(dto);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void updateObjectAndTask(Long objectId, Long taskId) {
|
||
|
|
//先判断该次评分是否是该考核对象的最后一次评分
|
||
|
|
//todo
|
||
|
|
// 如果为最后一次评分,就要计算该考核对象的最终得分
|
||
|
|
teamMapper.selectCount(new QueryWrapper<AssessTeam>().eq("object_id",objectId));
|
||
|
|
}
|
||
|
|
|
||
|
|
public String getGroupId() {
|
||
|
|
return "assessTeamRating";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|