parent
b58cbeeba8
commit
2ec98d5157
7 changed files with 223 additions and 6 deletions
@ -1,19 +1,180 @@ |
|||||||
package org.jeecg.modules.demo.abilityEvaluation.service.impl; |
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.entity.PersonalAbilityEvaluation; |
||||||
import org.jeecg.modules.demo.abilityEvaluation.mapper.PersonalAbilityEvaluationMapper; |
import org.jeecg.modules.demo.abilityEvaluation.mapper.PersonalAbilityEvaluationMapper; |
||||||
import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationService; |
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.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.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.stereotype.Service; |
||||||
|
import org.springframework.util.Assert; |
||||||
|
import org.springframework.util.ObjectUtils; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
import java.util.List; |
||||||
|
|
||||||
/** |
/** |
||||||
* @Description: 个人能力评价 |
* @Description: 个人能力评价 |
||||||
* @Author: jeecg-boot |
* @Author: jeecg-boot |
||||||
* @Date: 2023-11-07 |
* @Date: 2023-11-07 |
||||||
* @Version: V1.0 |
* @Version: V1.0 |
||||||
*/ |
*/ |
||||||
@Service |
@Service |
||||||
public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAbilityEvaluationMapper, PersonalAbilityEvaluation> implements IPersonalAbilityEvaluationService { |
public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl<PersonalAbilityEvaluationMapper, PersonalAbilityEvaluation> implements IPersonalAbilityEvaluationService { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IAnnualCompPointService iAnnualCompPointService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IAwardPersionService iAwardPersionService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IScorePersionService iScorePersionService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ICompskillService iCompskillService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ISysDepartService iSysDepartService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ISysUserService iSysUserService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ITeamManagementService iTeamManagementService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IAnnualCompService iAnnualCompService; |
||||||
|
|
||||||
|
private static final Integer ONE_HUNDRED = 100; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* @description: 只统计已获奖的个人能力,依赖获奖管理数据列表 |
||||||
|
* @param: [param] |
||||||
|
* @return: void |
||||||
|
* @author: z.h.c |
||||||
|
* @date: 23/11/8 16:02 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public void personalAbilityEvaluation(PersonalAbilityEvaluation param) { |
||||||
|
|
||||||
|
//年度比赛项目id
|
||||||
|
String projectId = param.getAnnualCompP(); |
||||||
|
String enrollCode = param.getEnrollCode(); |
||||||
|
Assert.notNull(projectId, "年度比赛项目id为空"); |
||||||
|
Assert.notNull(enrollCode, "报名编号为空"); |
||||||
|
|
||||||
|
//年度比赛项目
|
||||||
|
AnnualCompPoint annualCompPoint = iAnnualCompPointService.getById(projectId); |
||||||
|
Assert.notNull(annualCompPoint, "年度比赛项目不存在"); |
||||||
|
|
||||||
|
//年度比赛
|
||||||
|
AnnualComp annualComp = iAnnualCompService.getById(annualCompPoint.getAnnualCompId()); |
||||||
|
if (ObjectUtils.isEmpty(annualComp)) return; |
||||||
|
|
||||||
|
TeamManagement management = iTeamManagementService.getOne(new LambdaQueryWrapper<TeamManagement>() |
||||||
|
.eq(TeamManagement::getEnrollCode, enrollCode)); |
||||||
|
if (ObjectUtils.isEmpty(management)) return; |
||||||
|
|
||||||
|
|
||||||
|
//根据年度比赛项目和报名编号查询 查询个人获奖表
|
||||||
|
AwardPersion awardPersion = iAwardPersionService.getOne(new LambdaQueryWrapper<AwardPersion>() |
||||||
|
.eq(AwardPersion::getAnnualCompP, projectId) |
||||||
|
.eq(AwardPersion::getEnrollCode, enrollCode) |
||||||
|
.last("limit 1")); |
||||||
|
|
||||||
|
if (ObjectUtils.isEmpty(awardPersion)) return; |
||||||
|
|
||||||
|
//查询获奖个人对应的分数
|
||||||
|
ScorePersion scorePersion = iScorePersionService.getOne(new LambdaQueryWrapper<ScorePersion>() |
||||||
|
.eq(ScorePersion::getEnrollCode, enrollCode) |
||||||
|
.eq(ScorePersion::getAnnualCompP, projectId) |
||||||
|
.last("limit 1")); |
||||||
|
if (ObjectUtils.isEmpty(scorePersion)) return; |
||||||
|
|
||||||
|
String score = scorePersion.getScore(); |
||||||
|
if (StringUtils.isBlank(score)) return; |
||||||
|
|
||||||
|
Double score_d = Double.valueOf(score); |
||||||
|
|
||||||
|
PersonalAbilityEvaluation person = new PersonalAbilityEvaluation(); |
||||||
|
person.setAnnualId(annualComp.getAnnualid()); |
||||||
|
person.setAnnualCompId(annualCompPoint.getAnnualCompId()); |
||||||
|
person.setAnnualCompP(projectId); |
||||||
|
SysUser sysUser = iSysUserService.getById(management.getUserId()); |
||||||
|
person.setWorkOn(sysUser.getWorkNo()); |
||||||
|
person.setName(sysUser.getRealname()); |
||||||
|
SysDepart sysDepart = iSysDepartService.getById(sysUser.getOrgCode()); |
||||||
|
person.setDepetId(sysDepart.getId()); |
||||||
|
|
||||||
|
//查询项目各能力权值
|
||||||
|
List<Compskill> compskillList = iCompskillService.list(new LambdaQueryWrapper<Compskill>().eq(Compskill::getAnnucompid, projectId)); |
||||||
|
if (!ObjectUtils.isEmpty(compskillList)) { |
||||||
|
//计算能力量化各类指标 能力量化值 = 直接按项目的能力权值和项目奖项得分算
|
||||||
|
//能力量化值 = 项目得分*项目的能力权值/100
|
||||||
|
this.convertScore(compskillList, person, score_d); |
||||||
|
} |
||||||
|
this.save(person); |
||||||
|
} |
||||||
|
|
||||||
|
PersonalAbilityEvaluation convertScore(List<Compskill> compskillList, PersonalAbilityEvaluation person, final double score_d) { |
||||||
|
|
||||||
|
for (int i = 1; i <= compskillList.size(); i++) { |
||||||
|
if (i == 1) { |
||||||
|
person.setSoc1(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 2) { |
||||||
|
person.setSoc2(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 3) { |
||||||
|
person.setSoc3(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 4) { |
||||||
|
person.setSoc4(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 5) { |
||||||
|
person.setSoc5(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 6) { |
||||||
|
person.setSoc6(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 7) { |
||||||
|
person.setSoc7(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 8) { |
||||||
|
person.setSoc8(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 9) { |
||||||
|
person.setSoc9(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 10) { |
||||||
|
person.setSoc10(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 11) { |
||||||
|
person.setSoc11(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
if (i == 12) { |
||||||
|
person.setSoc12(ComputeUtils.mul(score_d, ComputeUtils.div2(compskillList.get(i - 1).getWeight().doubleValue(), ONE_HUNDRED))); |
||||||
|
} |
||||||
|
} |
||||||
|
return person; |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue