diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationController.java index 5b718d29..c6dd13cd 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/controller/PersonalAbilityEvaluationController.java @@ -68,6 +68,13 @@ public class PersonalAbilityEvaluationController extends JeecgController personalAbilityEvaluation(@RequestBody PersonalAbilityEvaluation personalAbilityEvaluation) { + personalAbilityEvaluationService.personalAbilityEvaluation(personalAbilityEvaluation); + return Result.OK("操作成功!"); + } + /** * 编辑 * diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluation.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluation.java index 72d3fdbd..02bf5686 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluation.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/entity/PersonalAbilityEvaluation.java @@ -1,6 +1,7 @@ package org.jeecg.modules.demo.abilityEvaluation.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -79,7 +80,7 @@ public class PersonalAbilityEvaluation implements Serializable { */ @Excel(name = "年度比赛", width = 15) @ApiModelProperty(value = "年度比赛") - @Dict(dictTable = "annual_comp",dicCode = "id",dicText = "name") + @Dict(dictTable = "annual_comp", dicCode = "id", dicText = "name") private String annualCompId; /** * 年度比赛项目 @@ -88,6 +89,15 @@ public class PersonalAbilityEvaluation implements Serializable { @Dict(dictTable = "annual_comp_point", dicText = "obj_name", dicCode = "id") @ApiModelProperty(value = "年度比赛项目") private String annualCompP; + + + /** + * 报名编号 + */ + @TableField(exist = false) + private String enrollCode; + + /** * 学号 */ diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationService.java index e934a785..06dc6a9f 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationService.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/IPersonalAbilityEvaluationService.java @@ -11,4 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IPersonalAbilityEvaluationService extends IService { + void personalAbilityEvaluation(PersonalAbilityEvaluation personalAbilityEvaluation); + } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java index 0d09f182..725356bc 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/abilityEvaluation/service/impl/PersonalAbilityEvaluationServiceImpl.java @@ -1,19 +1,180 @@ 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; 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.util.Assert; +import org.springframework.util.ObjectUtils; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; /** * @Description: 个人能力评价 * @Author: jeecg-boot - * @Date: 2023-11-07 + * @Date: 2023-11-07 * @Version: V1.0 */ @Service public class PersonalAbilityEvaluationServiceImpl extends ServiceImpl 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() + .eq(TeamManagement::getEnrollCode, enrollCode)); + if (ObjectUtils.isEmpty(management)) return; + + + //根据年度比赛项目和报名编号查询 查询个人获奖表 + AwardPersion awardPersion = iAwardPersionService.getOne(new LambdaQueryWrapper() + .eq(AwardPersion::getAnnualCompP, projectId) + .eq(AwardPersion::getEnrollCode, enrollCode) + .last("limit 1")); + + if (ObjectUtils.isEmpty(awardPersion)) return; + + //查询获奖个人对应的分数 + ScorePersion scorePersion = iScorePersionService.getOne(new LambdaQueryWrapper() + .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 compskillList = iCompskillService.list(new LambdaQueryWrapper().eq(Compskill::getAnnucompid, projectId)); + if (!ObjectUtils.isEmpty(compskillList)) { + //计算能力量化各类指标 能力量化值 = 直接按项目的能力权值和项目奖项得分算 + //能力量化值 = 项目得分*项目的能力权值/100 + this.convertScore(compskillList, person, score_d); + } + this.save(person); + } + + PersonalAbilityEvaluation convertScore(List 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; + } } diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java index 73567fc0..286069a0 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompTotalScoreServiceImpl.java @@ -34,7 +34,7 @@ public class PersonalCompTotalScoreServiceImpl extends ServiceImpl()).forEach(e -> { PersonalCompTotalScore p = this.getOne(new LambdaQueryWrapper() .eq(PersonalCompTotalScore::getWorkOn, e.getWorkOn()) - .apply("limit 1")); + .last("limit 1")); //为空则为首次累计,新增操作 if ((ObjectUtils.isEmpty(p))) { PersonalCompTotalScore p2 = new PersonalCompTotalScore(); diff --git a/jeecgboot-vue3-master/src/views/awardpersion/AwardPersion.api.ts b/jeecgboot-vue3-master/src/views/awardpersion/AwardPersion.api.ts index 20447dd1..be5c1edb 100644 --- a/jeecgboot-vue3-master/src/views/awardpersion/AwardPersion.api.ts +++ b/jeecgboot-vue3-master/src/views/awardpersion/AwardPersion.api.ts @@ -15,6 +15,7 @@ enum Api { exportXlsMb = '/awardpersion/awardPersion/exportXlsMb', queryCompId = '/annualcompgroup/annualCompGroup/queryCompId', queryOptions = '/awardpersion/awardPersion/queryOptions', + personalAbilityEvaluation = '/abilityEvaluation/personalAbilityEvaluation/personalAbilityEvaluation', } @@ -88,3 +89,19 @@ export const saveOrUpdate1 = (params, isUpdate) => { let url = isUpdate ? Api.edit : Api.save1; return defHttp.post({ url: url, params }, { isTransformResponse: false }); } + +// 个人能力量化 +export const personalAbilityEvaluation = (params,handleSuccess) => { + createConfirm({ + iconType: 'warning', + title: '确认操作', + content: '确认发送请求吗', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.post({url: Api.personalAbilityEvaluation,params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} diff --git a/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue b/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue index e4d40e6c..d40b79e0 100644 --- a/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue +++ b/jeecgboot-vue3-master/src/views/awardpersion/AwardPersionList.vue @@ -80,12 +80,21 @@ import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { useListPage } from '/@/hooks/system/useListPage'; import { columns } from './AwardPersion.data'; - import { list, deleteOne, batchDelete, getImportUrl, getExportUrl,getExportUrlMb } from './AwardPersion.api'; + import { + list, + deleteOne, + batchDelete, + getImportUrl, + getExportUrl, + getExportUrlMb, + personalAbilityEvaluation + } from './AwardPersion.api'; import { downloadFile } from '/@/utils/common/renderUtils'; import AwardPersionModal from './components/AwardPersionModal.vue' import AwardPersionModal1 from './components/AwardPersionModal1.vue' import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; + import {collectScore} from "/@/views/annualCompPoint/committee/AnnualCompPoint.api"; const formRef = ref(); const queryParam = reactive({}); @@ -101,7 +110,7 @@ canResize:false, useSearchForm: false, actionColumn: { - width: 120, + width: 230, fixed: 'right', }, beforeFetch: (params) => { @@ -186,6 +195,13 @@ (selectedRowKeys.value = []) && reload(); } + /** + * 个人能力量化 + */ + function handlePersonalAbilityEvaluation(record: Recordable) { + personalAbilityEvaluation({annualCompP: record.annualCompP, enrollCode: record.enrollCode}, handleSuccess); + } + /** * 操作栏 */ @@ -195,6 +211,10 @@ label: '编辑', onClick: handleEdit.bind(null, record), }, + { + label: '个人能力量化', + onClick: handlePersonalAbilityEvaluation.bind(null, record), + }, ]; }