|
|
|
@ -2,7 +2,6 @@ package org.jeecg.modules.demo.abilityEvaluation.service.impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.jeecg.common.util.ComputeUtils; |
|
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation; |
|
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.mapper.PersonalAbilityEvaluationMapper; |
|
|
|
@ -10,27 +9,23 @@ import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluati |
|
|
|
|
import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationService; |
|
|
|
|
import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint; |
|
|
|
|
import org.jeecg.modules.demo.annualCompPoint.service.IAnnualCompPointService; |
|
|
|
|
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.annualcompetitionprojectregistration.entity.TeamManagement; |
|
|
|
|
import org.jeecg.modules.demo.annualcompetitionprojectregistration.service.ITeamManagementService; |
|
|
|
|
import org.jeecg.modules.demo.awardpersion.entity.AwardPersion; |
|
|
|
|
import org.jeecg.modules.demo.awardpersion.service.IAwardPersionService; |
|
|
|
|
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.demo.scorepersion.entity.ScorePersion; |
|
|
|
|
import org.jeecg.modules.demo.scorepersion.service.IScorePersionService; |
|
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
|
import org.jeecg.modules.system.service.ISysDepartService; |
|
|
|
|
import org.jeecg.modules.system.service.ISysUserService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.text.DecimalFormat; |
|
|
|
|
import java.util.LinkedList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Optional; |
|
|
|
@ -47,11 +42,11 @@ public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAb |
|
|
|
|
@Autowired |
|
|
|
|
private IAnnualCompPointService iAnnualCompPointService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IAwardPersionService iAwardPersionService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IScorePersionService iScorePersionService; |
|
|
|
|
// @Autowired
|
|
|
|
|
// private IAwardPersionService iAwardPersionService;
|
|
|
|
|
//
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private IScorePersionService iScorePersionService;
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ICompskillService iCompskillService; |
|
|
|
@ -60,13 +55,13 @@ public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAb |
|
|
|
|
private IBasicsskillService iBasicsskillService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ISysDepartService iSysDepartService; |
|
|
|
|
private IPersonalCompScoreService iPersonalCompScoreService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ISysUserService iSysUserService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ITeamManagementService iTeamManagementService; |
|
|
|
|
// @Autowired
|
|
|
|
|
// private ITeamManagementService iTeamManagementService;
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IAnnualCompService iAnnualCompService; |
|
|
|
@ -107,44 +102,36 @@ public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAb |
|
|
|
|
List<Compskill> compskillList = iCompskillService.list(new LambdaQueryWrapper<Compskill>().eq(Compskill::getAnnucompid, projectId)); |
|
|
|
|
if (ObjectUtils.isEmpty(compskillList)) return; |
|
|
|
|
|
|
|
|
|
//根据年度比赛项目查询个人获奖表
|
|
|
|
|
List<AwardPersion> awardPersionList = iAwardPersionService.list(new LambdaQueryWrapper<AwardPersion>().eq(AwardPersion::getAnnualCompP, projectId)); |
|
|
|
|
List<PersonalCompScore> personalCompScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper<PersonalCompScore>().eq(PersonalCompScore::getAnnualCompP, projectId)); |
|
|
|
|
|
|
|
|
|
List<PersonalAbilityEvaluation> saveList = new LinkedList<>(); |
|
|
|
|
Optional.ofNullable(awardPersionList).orElse(new LinkedList<>()).forEach(e -> { |
|
|
|
|
//查询获奖个人对应的分数
|
|
|
|
|
ScorePersion scorePersion = iScorePersionService.getOne(new LambdaQueryWrapper<ScorePersion>() |
|
|
|
|
.eq(ScorePersion::getEnrollCode, e.getEnrollCode()) |
|
|
|
|
.eq(ScorePersion::getAnnualCompP, projectId) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(scorePersion) && StringUtils.isNotBlank(scorePersion.getScore())) { |
|
|
|
|
|
|
|
|
|
TeamManagement management = iTeamManagementService.getOne(new LambdaQueryWrapper<TeamManagement>() |
|
|
|
|
.eq(TeamManagement::getEnrollCode, e.getEnrollCode())); |
|
|
|
|
SysUser sysUser = iSysUserService.getById(management.getUserId()); |
|
|
|
|
// SysDepart sysDepart = iSysDepartService.getDepartByOrgCode(sysUser.getOrgCode());
|
|
|
|
|
|
|
|
|
|
//遍历每一类能力指标
|
|
|
|
|
compskillList.forEach(compskill -> { |
|
|
|
|
PersonalAbilityEvaluation person = new PersonalAbilityEvaluation(); |
|
|
|
|
person.setAnnualId(annualComp.getAnnualid()); |
|
|
|
|
person.setAnnualCompId(annualCompPoint.getAnnualCompId()); |
|
|
|
|
person.setAnnualCompP(projectId); |
|
|
|
|
person.setWorkOn(sysUser.getWorkNo()); |
|
|
|
|
person.setName(sysUser.getRealname()); |
|
|
|
|
person.setDepetId(sysUser.getDepartIds()); |
|
|
|
|
|
|
|
|
|
Basicsskill basicsskill = iBasicsskillService.getById(compskill.getCapacityid()); |
|
|
|
|
person.setCapacityId(compskill.getCapacityid()); |
|
|
|
|
person.setCapacityName(basicsskill.getName()); |
|
|
|
|
|
|
|
|
|
//计算能力量化各类指标 能力量化值 = 直接按项目的能力权值和项目奖项得分算
|
|
|
|
|
//能力量化值 = 项目得分*项目的能力权值/100
|
|
|
|
|
this.convertScore(compskill.getWeight(), person, Double.valueOf(scorePersion.getScore())); |
|
|
|
|
saveList.add(person); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//删除该项目下所有人的能力量化数据
|
|
|
|
@ -153,13 +140,18 @@ public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAb |
|
|
|
|
|
|
|
|
|
//新增个人能力量化
|
|
|
|
|
this.saveBatch(saveList); |
|
|
|
|
|
|
|
|
|
//新增个人能力量化汇总
|
|
|
|
|
iPersonalAbilityEvaluationCollectService.batchSave(projectId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PersonalAbilityEvaluation convertScore(double weight, PersonalAbilityEvaluation person, final double score_d) { |
|
|
|
|
person.setValue(ComputeUtils.mul(score_d, ComputeUtils.div2(weight, ONE_HUNDRED))); |
|
|
|
|
DecimalFormat decimalFormat = new DecimalFormat(); |
|
|
|
|
decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
|
|
|
|
|
decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
|
|
|
|
|
double val = ComputeUtils.mul2(score_d, ComputeUtils.div2(weight, ONE_HUNDRED)); |
|
|
|
|
person.setValue(Double.valueOf(decimalFormat.format(val))); |
|
|
|
|
return person; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|