GST002精简

gst2base
Gitea 2 days ago
parent aa87f67627
commit e8fd957c60
  1. 67
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java

@ -13,10 +13,6 @@ import org.jeecg.modules.demo.annualScore.entity.PersonalCompScore;
import org.jeecg.modules.demo.annualScore.service.IPersonalCompScoreService;
import org.jeecg.modules.demo.annualcomp.entity.AnnualComp;
import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService;
import org.jeecg.modules.demo.basicsskill.entity.Basicsskill;
import org.jeecg.modules.demo.basicsskill.service.IBasicsskillService;
import org.jeecg.modules.demo.compskill.entity.Compskill;
import org.jeecg.modules.demo.compskill.service.ICompskillService;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
@ -48,11 +44,6 @@ public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAb
// @Autowired
// private IScorePersionService iScorePersionService;
@Autowired
private ICompskillService iCompskillService;
@Autowired
private IBasicsskillService iBasicsskillService;
@Autowired
private IPersonalCompScoreService iPersonalCompScoreService;
@ -85,64 +76,6 @@ public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAb
@Override
public void personalAbilityEvaluation2(PersonalAbilityEvaluation param) {
//年度比赛id
String annualCompId = param.getAnnualCompId();
//年度比赛项目id
String projectId = param.getId();
//年度比赛
AnnualComp annualComp = iAnnualCompService.getById(annualCompId);
if (ObjectUtils.isEmpty(annualComp)) return;
//年度比赛项目,状态为已评奖时才能进行能力评价
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(projectId);
if (ObjectUtils.isEmpty(annualCompPoint)) return;
//查询项目各能力权值
List<Compskill> compskillList = iCompskillService.list(new LambdaQueryWrapper<Compskill>().eq(Compskill::getAnnucompid, projectId));
if (ObjectUtils.isEmpty(compskillList)) return;
List<PersonalCompScore> personalCompScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper<PersonalCompScore>().eq(PersonalCompScore::getAnnualCompP, projectId));
List<PersonalAbilityEvaluation> saveList = new LinkedList<>();
Optional.ofNullable(personalCompScoreList).orElse(new LinkedList<>()).stream().forEach(en -> {
//在lambda中,使用return时并不会直接返回,而是进行相当于普通for里的continue操作。所以直接使用return即可。
//分数为空时,继续下一条
if (ObjectUtils.isEmpty(en.getScore())) return;
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getWorkNo, en.getWorkOn()));
//遍历每一类能力指标
compskillList.forEach(compskill -> {
PersonalAbilityEvaluation person = new PersonalAbilityEvaluation();
person.setAnnualId(annualComp.getAnnualid());
person.setAnnualCompId(annualCompPoint.getAnnualCompId());
person.setAnnualCompP(projectId);
person.setWorkOn(en.getWorkOn());
person.setName(sysUser.getRealname());
person.setDepetId(en.getDepet());
Basicsskill basicsskill = iBasicsskillService.getById(compskill.getCapacityid());
person.setCapacityId(compskill.getCapacityid());
person.setCapacityName(basicsskill.getName());
//计算能力量化各类指标 能力量化值 = 直接按项目的能力权值和项目奖项得分算
//能力量化值 = 个人积分*项目的能力权值/100
this.convertScore(compskill.getWeight(), person, en.getScore());
saveList.add(person);
});
});
//删除该项目下所有人的能力量化数据
this.remove(new LambdaQueryWrapper<PersonalAbilityEvaluation>()
.eq(PersonalAbilityEvaluation::getAnnualCompP, projectId));
//新增个人能力量化
this.saveBatch(saveList);
//新增个人能力量化汇总
iPersonalAbilityEvaluationCollectService.batchSave(projectId);
}

Loading…
Cancel
Save