团队赛队员积分计算方法修改

main
zhc077 3 months ago
parent 43a483ed64
commit 7484625f08
  1. 9
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualCompPoint/controller/AnnualCompPointController.java
  2. 46
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualScore/service/impl/PersonalCompScoreServiceImpl.java
  3. 2
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompetitionprojectregistration/entity/TeamManagement.java
  4. 8
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/service/impl/TeamSeqServiceImpl.java
  5. 80
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/vo/TeamSeqVo.java

@ -51,6 +51,7 @@ import org.jeecg.modules.demo.scorepersion.entity.ScorePersion;
import org.jeecg.modules.demo.scorepersion.service.IScorePersionService; import org.jeecg.modules.demo.scorepersion.service.IScorePersionService;
import org.jeecg.modules.demo.teamseq.entity.TeamSeq; import org.jeecg.modules.demo.teamseq.entity.TeamSeq;
import org.jeecg.modules.demo.teamseq.service.ITeamSeqService; import org.jeecg.modules.demo.teamseq.service.ITeamSeqService;
import org.jeecg.modules.demo.teamseq.vo.TeamSeqVo;
import org.jeecg.modules.demo.upfile_persion.entity.UpfilePersion; import org.jeecg.modules.demo.upfile_persion.entity.UpfilePersion;
import org.jeecg.modules.demo.upfile_persion.service.IUpfilePersionService; import org.jeecg.modules.demo.upfile_persion.service.IUpfilePersionService;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
@ -188,7 +189,9 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint,
Optional.ofNullable(records).orElse(new LinkedList<>()).stream().forEach(point -> { Optional.ofNullable(records).orElse(new LinkedList<>()).stream().forEach(point -> {
TeamSeq teamSeq = iTeamSeqService.getOne(new LambdaQueryWrapper<TeamSeq>().eq(TeamSeq::getPointId, point.getId())); TeamSeq teamSeq = iTeamSeqService.getOne(new LambdaQueryWrapper<TeamSeq>().eq(TeamSeq::getPointId, point.getId()));
if (!ObjectUtils.isEmpty(teamSeq)) { if (!ObjectUtils.isEmpty(teamSeq)) {
BeanUtils.copyProperties(teamSeq, point); TeamSeqVo teamSeqVo = new TeamSeqVo();
BeanUtils.copyProperties(teamSeq, teamSeqVo);
BeanUtils.copyProperties(teamSeqVo, point);
} }
}); });
return Result.OK(pageList); return Result.OK(pageList);
@ -402,12 +405,12 @@ public class AnnualCompPointController extends JeecgController<AnnualCompPoint,
isUpdate = annualCompPointService.updateById(annualCompPoint); isUpdate = annualCompPointService.updateById(annualCompPoint);
//更新团队赛队员积分计算配置 add by zhc 8.22 //更新团队赛队员积分计算配置 add by zhc 8.22
iTeamSeqService.saveOrUpdate4TeamSeq(annualCompPoint); iTeamSeqService.saveOrUpdate4TeamSeq(annualCompPoint);
} /*else { } else {
return Result.error("当前状态不可修改"); return Result.error("当前状态不可修改");
} }
if (!isUpdate){ if (!isUpdate){
return Result.error("编辑失败!"); return Result.error("编辑失败!");
}*/ }
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }

@ -21,10 +21,10 @@ import org.jeecg.modules.demo.awardpersion.entity.AwardPersion;
import org.jeecg.modules.demo.awardpersion.service.IAwardPersionService; import org.jeecg.modules.demo.awardpersion.service.IAwardPersionService;
import org.jeecg.modules.demo.comp.entity.Comp; import org.jeecg.modules.demo.comp.entity.Comp;
import org.jeecg.modules.demo.comp.service.ICompService; import org.jeecg.modules.demo.comp.service.ICompService;
import org.jeecg.modules.demo.comptype.entity.CompType;
import org.jeecg.modules.demo.comptype.service.ICompTypeService;
import org.jeecg.modules.demo.projectlevel.entity.Projectlevel; import org.jeecg.modules.demo.projectlevel.entity.Projectlevel;
import org.jeecg.modules.demo.projectlevel.service.IProjectlevelService; import org.jeecg.modules.demo.projectlevel.service.IProjectlevelService;
import org.jeecg.modules.demo.teamseq.entity.TeamSeq;
import org.jeecg.modules.demo.teamseq.service.ITeamSeqService;
import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysDepartService;
@ -165,14 +165,16 @@ public class PersonalCompScoreServiceImpl extends ServiceImpl<PersonalCompScoreM
AtomicReference<Double> score = new AtomicReference<>((double) 0); AtomicReference<Double> score = new AtomicReference<>((double) 0);
if (StringUtils.equals("Y", entryForm)) { //团队赛 if (StringUtils.equals("Y", entryForm)) { //团队赛
Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> { Optional.ofNullable(managementList).orElse(new ArrayList<>()).forEach(e -> {
// 参与形式是团队时,队长积分*0.5,职员积分*0.2 /*// 参与形式是团队时,队长积分*0.5,职员积分*0.2
//captain 是否队长 //captain 是否队长
if (StringUtils.equals("0", e.getCaptain())) { if (StringUtils.equals("0", e.getCaptain())) {
score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_FIVE)); score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_FIVE));
} else { } else {
score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_TWO)); score.set(ComputeUtils.mul2(baseScore, ZERO_POINT_TWO));
} }*/
//modify by zhc 8.23
score.set(ComputeUtils.mul2(baseScore, this.covertVal(annualCompPoint, e)));
PersonalCompScore bean = new PersonalCompScore(); PersonalCompScore bean = new PersonalCompScore();
bean.setAnnualCompId(annualCompId); bean.setAnnualCompId(annualCompId);
bean.setAnnualCompP(annualCompPoint.getId()); bean.setAnnualCompP(annualCompPoint.getId());
@ -215,4 +217,40 @@ public class PersonalCompScoreServiceImpl extends ServiceImpl<PersonalCompScoreM
.set(AnnualCompPoint::getAnnualCompState, 10) .set(AnnualCompPoint::getAnnualCompState, 10)
.update(); .update();
} }
@Autowired
private ITeamSeqService iTeamSeqService;
/**
* @description: 根据队员在团队中报名先后顺序计算比率
* @param: [annualCompPoint, en]
* @return: double
* @author: z.h.c
* @date: 24/8/23 10:00
*/
double covertVal(AnnualCompPoint annualCompPoint, TeamManagement en) {
TeamSeq teamSeq = iTeamSeqService.getById(annualCompPoint.getId());
Integer weightVal = 100;
if (!ObjectUtils.isEmpty(teamSeq)) {
switch (en.getTeamSeq()) {
case 1:
weightVal = teamSeq.getTeamSeqFifthVal();
break;
case 2:
weightVal = teamSeq.getTeamSeqSecondVal();
break;
case 3:
weightVal = teamSeq.getTeamSeqThirdVal();
break;
case 4:
weightVal = teamSeq.getTeamSeqFourthVal();
break;
case 5:
weightVal = teamSeq.getTeamSeqFifthVal();
break;
}
}
double val = ComputeUtils.div2(new Double(weightVal), ONE_HUNDRED);
return val;
}
} }

@ -64,5 +64,5 @@ public class TeamManagement implements Serializable {
/**团队赛队员序号*/ /**团队赛队员序号*/
@Excel(name = "团队赛队员序号", width = 2) @Excel(name = "团队赛队员序号", width = 2)
@ApiModelProperty(value = "团队赛队员序号") @ApiModelProperty(value = "团队赛队员序号")
private String teamSeq; private Integer teamSeq;
} }

@ -5,6 +5,7 @@ import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint;
import org.jeecg.modules.demo.teamseq.entity.TeamSeq; import org.jeecg.modules.demo.teamseq.entity.TeamSeq;
import org.jeecg.modules.demo.teamseq.mapper.TeamSeqMapper; import org.jeecg.modules.demo.teamseq.mapper.TeamSeqMapper;
import org.jeecg.modules.demo.teamseq.service.ITeamSeqService; import org.jeecg.modules.demo.teamseq.service.ITeamSeqService;
import org.jeecg.modules.demo.teamseq.vo.TeamSeqVo;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -22,10 +23,11 @@ public class TeamSeqServiceImpl extends ServiceImpl<TeamSeqMapper, TeamSeq> impl
@Override @Override
public void saveOrUpdate4TeamSeq(AnnualCompPoint point) { public void saveOrUpdate4TeamSeq(AnnualCompPoint point) {
this.remove(new LambdaQueryWrapper<TeamSeq>().eq(TeamSeq::getPointId,point.getId())); this.remove(new LambdaQueryWrapper<TeamSeq>().eq(TeamSeq::getPointId,point.getId()));
TeamSeqVo vo = new TeamSeqVo();
BeanUtils.copyProperties(point,vo);
vo.setPointId(point.getId());
TeamSeq teamSeq = new TeamSeq(); TeamSeq teamSeq = new TeamSeq();
BeanUtils.copyProperties(point,teamSeq); BeanUtils.copyProperties(vo,teamSeq);
teamSeq.setId(null);
teamSeq.setPointId(point.getId());
this.save(teamSeq); this.save(teamSeq);
} }
} }

@ -0,0 +1,80 @@
package org.jeecg.modules.demo.teamseq.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Description: TODO
* @Author: Z.H.C
* @CreateTime: 2024-08-23 09:24
* @Version: 1.0
*/
@Data
public class TeamSeqVo {
/**
* 年度比赛项目id
*/
@Excel(name = "年度比赛项目id", width = 15)
@ApiModelProperty(value = "年度比赛项目id")
private String pointId;
/**
* 第1序号
*/
@Excel(name = "第1序号", width = 15)
@ApiModelProperty(value = "第1序号")
private Integer teamSeqFirst;
/**
* 第1序号比值
*/
@Excel(name = "第1序号比值", width = 15)
@ApiModelProperty(value = "第1序号比值")
private Integer teamSeqFirstVal;
/**
* 第2序号
*/
@ApiModelProperty(value = "第1序号")
private Integer teamSeqSecond;
/**
* 第2序号比值
*/
@ApiModelProperty(value = "第2序号比值")
private Integer teamSeqSecondVal;
/**
* 第3序号
*/
@ApiModelProperty(value = "第3序号")
private Integer teamSeqThird;
/**
* 第3序号比值
*/
@ApiModelProperty(value = "第3序号比值")
private Integer teamSeqThirdVal;
/**
* 第4序号
*/
@ApiModelProperty(value = "第4序号")
private Integer teamSeqFourth;
/**
* 第4序号比值
*/
@ApiModelProperty(value = "第4序号比值")
private Integer teamSeqFourthVal;
/**
* 第5序号
*/
@ApiModelProperty(value = "第5序号")
private Integer teamSeqFifth;
/**
* 第5序号比值
*/
@ApiModelProperty(value = "第5序号比值")
private Integer teamSeqFifthVal;
}
Loading…
Cancel
Save