diff --git a/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java b/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java index 4418005c..e01eb8ac 100644 --- a/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java +++ b/mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java @@ -2,11 +2,13 @@ package com.ccsens.mt.api; import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.mt.bean.dto.CompeteDto; +import com.ccsens.mt.bean.dto.ScoreDto; import com.ccsens.mt.bean.vo.CompeteVo; import com.ccsens.mt.service.ICompeteService; import com.ccsens.util.JsonResponse; import com.ccsens.util.bean.dto.QueryDto; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; @@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.List; /** * @author 逗 @@ -38,6 +41,21 @@ public class CompeteScoreController { return JsonResponse.newInstance().ok(playerList); } - + @MustLogin + @ApiOperation(value = "花样赛提交分数", notes = "Mr.王----提交成绩到那个花样赛得表里面就行了,单表操作") + @RequestMapping(value = "/submitOrderList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse submitOrder(@ApiParam @Validated @RequestBody QueryDto params){ + log.info("花样赛提交分数:{}",params); + competeService.submitOrderList(params.getParam()); + return JsonResponse.newInstance().ok(); + } + @MustLogin + @ApiOperation(value = "花样赛成绩查看", notes = "Mr.王 -----从花样赛成绩表里面查看出这个人得成绩") + @RequestMapping(value = "/showResult", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse> showResult (@ApiParam @Validated @RequestBody QueryDto params){ + log.info("花样赛详细分数查看:{}",params); + List totalScoreDisplaysList= competeService.showResult(params.getParam()); + return JsonResponse.newInstance().ok(totalScoreDisplaysList); + } } diff --git a/mt/src/main/java/com/ccsens/mt/bean/dto/ScoreDto.java b/mt/src/main/java/com/ccsens/mt/bean/dto/ScoreDto.java index a2f4abec..1779f9e0 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/dto/ScoreDto.java +++ b/mt/src/main/java/com/ccsens/mt/bean/dto/ScoreDto.java @@ -4,7 +4,9 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.NonNull; +import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.util.List; @@ -89,30 +91,40 @@ public class ScoreDto { @Data @ApiModel public static class InformationSubmitted{ + @NotNull @ApiModelProperty("大赛id") private Long competeTimeId; + @NotNull @ApiModelProperty("项目Id") private Long projectId; + @NotNull @ApiModelProperty("场次id") - private BigDecimal siteOrderId; + private Long siteOrderId; + @NotNull @ApiModelProperty("裁判id") private Long judgmentId; -// @ApiModelProperty("几分") -// List + @NotNull + @ApiModelProperty("计分项目") + private List fractionsList; } @Data @ApiModel public static class Fraction{ @ApiModelProperty("分数") - private int score; + private BigDecimal score; @ApiModelProperty("分数类型") private String code; + } - - - + @Data + @ApiModel + public static class ShowResult{ + @NotNull + @ApiModelProperty("项目id") + private Long projectId; } + } diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScore.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScore.java index 1836bfad..d89e1feb 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScore.java +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScore.java @@ -4,9 +4,7 @@ import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; -public class CompeteCountScore implements Serializable { - private Long id; - +public class CompeteCountScore extends CompeteCountScoreKey implements Serializable { private Long competeTimeId; private Long projectId; @@ -19,9 +17,7 @@ public class CompeteCountScore implements Serializable { private BigDecimal judgmentBScore2; - private BigDecimal shouldTimes; - - private BigDecimal deductTimes; + private Integer deductTimes; private String deductCause; @@ -35,14 +31,6 @@ public class CompeteCountScore implements Serializable { private static final long serialVersionUID = 1L; - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - public Long getCompeteTimeId() { return competeTimeId; } @@ -91,19 +79,11 @@ public class CompeteCountScore implements Serializable { this.judgmentBScore2 = judgmentBScore2; } - public BigDecimal getShouldTimes() { - return shouldTimes; - } - - public void setShouldTimes(BigDecimal shouldTimes) { - this.shouldTimes = shouldTimes; - } - - public BigDecimal getDeductTimes() { + public Integer getDeductTimes() { return deductTimes; } - public void setDeductTimes(BigDecimal deductTimes) { + public void setDeductTimes(Integer deductTimes) { this.deductTimes = deductTimes; } @@ -153,14 +133,12 @@ public class CompeteCountScore implements Serializable { sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); - sb.append(", id=").append(id); sb.append(", competeTimeId=").append(competeTimeId); sb.append(", projectId=").append(projectId); sb.append(", siteOrderId=").append(siteOrderId); sb.append(", chiefJudgmentScore=").append(chiefJudgmentScore); sb.append(", judgmentAScore=").append(judgmentAScore); sb.append(", judgmentBScore2=").append(judgmentBScore2); - sb.append(", shouldTimes=").append(shouldTimes); sb.append(", deductTimes=").append(deductTimes); sb.append(", deductCause=").append(deductCause); sb.append(", finalScore=").append(finalScore); diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreExample.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreExample.java index 832f2f73..c72f3961 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreExample.java +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreExample.java @@ -166,6 +166,66 @@ public class CompeteCountScoreExample { return (Criteria) this; } + public Criteria andShouldTimesIsNull() { + addCriterion("should_times is null"); + return (Criteria) this; + } + + public Criteria andShouldTimesIsNotNull() { + addCriterion("should_times is not null"); + return (Criteria) this; + } + + public Criteria andShouldTimesEqualTo(Integer value) { + addCriterion("should_times =", value, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesNotEqualTo(Integer value) { + addCriterion("should_times <>", value, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesGreaterThan(Integer value) { + addCriterion("should_times >", value, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesGreaterThanOrEqualTo(Integer value) { + addCriterion("should_times >=", value, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesLessThan(Integer value) { + addCriterion("should_times <", value, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesLessThanOrEqualTo(Integer value) { + addCriterion("should_times <=", value, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesIn(List values) { + addCriterion("should_times in", values, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesNotIn(List values) { + addCriterion("should_times not in", values, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesBetween(Integer value1, Integer value2) { + addCriterion("should_times between", value1, value2, "shouldTimes"); + return (Criteria) this; + } + + public Criteria andShouldTimesNotBetween(Integer value1, Integer value2) { + addCriterion("should_times not between", value1, value2, "shouldTimes"); + return (Criteria) this; + } + public Criteria andCompeteTimeIdIsNull() { addCriterion("compete_time_id is null"); return (Criteria) this; @@ -526,66 +586,6 @@ public class CompeteCountScoreExample { return (Criteria) this; } - public Criteria andShouldTimesIsNull() { - addCriterion("should_times is null"); - return (Criteria) this; - } - - public Criteria andShouldTimesIsNotNull() { - addCriterion("should_times is not null"); - return (Criteria) this; - } - - public Criteria andShouldTimesEqualTo(BigDecimal value) { - addCriterion("should_times =", value, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesNotEqualTo(BigDecimal value) { - addCriterion("should_times <>", value, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesGreaterThan(BigDecimal value) { - addCriterion("should_times >", value, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesGreaterThanOrEqualTo(BigDecimal value) { - addCriterion("should_times >=", value, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesLessThan(BigDecimal value) { - addCriterion("should_times <", value, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesLessThanOrEqualTo(BigDecimal value) { - addCriterion("should_times <=", value, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesIn(List values) { - addCriterion("should_times in", values, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesNotIn(List values) { - addCriterion("should_times not in", values, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("should_times between", value1, value2, "shouldTimes"); - return (Criteria) this; - } - - public Criteria andShouldTimesNotBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("should_times not between", value1, value2, "shouldTimes"); - return (Criteria) this; - } - public Criteria andDeductTimesIsNull() { addCriterion("deduct_times is null"); return (Criteria) this; @@ -596,52 +596,52 @@ public class CompeteCountScoreExample { return (Criteria) this; } - public Criteria andDeductTimesEqualTo(BigDecimal value) { + public Criteria andDeductTimesEqualTo(Integer value) { addCriterion("deduct_times =", value, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesNotEqualTo(BigDecimal value) { + public Criteria andDeductTimesNotEqualTo(Integer value) { addCriterion("deduct_times <>", value, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesGreaterThan(BigDecimal value) { + public Criteria andDeductTimesGreaterThan(Integer value) { addCriterion("deduct_times >", value, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesGreaterThanOrEqualTo(BigDecimal value) { + public Criteria andDeductTimesGreaterThanOrEqualTo(Integer value) { addCriterion("deduct_times >=", value, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesLessThan(BigDecimal value) { + public Criteria andDeductTimesLessThan(Integer value) { addCriterion("deduct_times <", value, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesLessThanOrEqualTo(BigDecimal value) { + public Criteria andDeductTimesLessThanOrEqualTo(Integer value) { addCriterion("deduct_times <=", value, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesIn(List values) { + public Criteria andDeductTimesIn(List values) { addCriterion("deduct_times in", values, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesNotIn(List values) { + public Criteria andDeductTimesNotIn(List values) { addCriterion("deduct_times not in", values, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesBetween(BigDecimal value1, BigDecimal value2) { + public Criteria andDeductTimesBetween(Integer value1, Integer value2) { addCriterion("deduct_times between", value1, value2, "deductTimes"); return (Criteria) this; } - public Criteria andDeductTimesNotBetween(BigDecimal value1, BigDecimal value2) { + public Criteria andDeductTimesNotBetween(Integer value1, Integer value2) { addCriterion("deduct_times not between", value1, value2, "deductTimes"); return (Criteria) this; } diff --git a/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreKey.java b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreKey.java new file mode 100644 index 00000000..8eb52089 --- /dev/null +++ b/mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreKey.java @@ -0,0 +1,39 @@ +package com.ccsens.mt.bean.po; + +import java.io.Serializable; + +public class CompeteCountScoreKey implements Serializable { + private Long id; + + private Integer shouldTimes; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Integer getShouldTimes() { + return shouldTimes; + } + + public void setShouldTimes(Integer shouldTimes) { + this.shouldTimes = shouldTimes; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", shouldTimes=").append(shouldTimes); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteVo.java b/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteVo.java index 2c46dd01..0e675c2e 100644 --- a/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteVo.java +++ b/mt/src/main/java/com/ccsens/mt/bean/vo/CompeteVo.java @@ -14,6 +14,17 @@ import java.util.List; */ @Data public class CompeteVo { + + @Data + @ApiModel("教练和成绩") + public static class Result{ + @ApiModelProperty("教练号") + private byte chief; + @ApiModelProperty("分数") + private BigDecimal score; + } + + @Data @ApiModel("查找第几届") public static class CompeteTime{ @@ -452,4 +463,36 @@ public class CompeteVo { private String otherPlayerName; } + @Data + @ApiModel("花样赛总成绩") + public static class TotalScoreDisplay{ + @ApiModelProperty("项目名") + public String companyName; + @ApiModelProperty("参赛队员名") + public String peopleName; + @ApiModelProperty("裁判1") + public BigDecimal referee1; + @ApiModelProperty("裁判2") + public BigDecimal referee2; + @ApiModelProperty("裁判3") + public BigDecimal referee3; + @ApiModelProperty("1-3裁判得平均值") + public BigDecimal avg1To3; + @ApiModelProperty("裁判4") + public BigDecimal referee4; + @ApiModelProperty("裁判5") + public BigDecimal referee5; + @ApiModelProperty("裁判6") + public BigDecimal referee6; + @ApiModelProperty("4-6裁判得平均值") + public BigDecimal avg4To6; + @ApiModelProperty("主裁判") + public BigDecimal referee0; + @ApiModelProperty("最后得分") + public BigDecimal result; +// @ApiModelProperty("排名") +// public int order; + } + + } diff --git a/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteTimeDao.java b/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteTimeDao.java index fac2476c..5f820582 100644 --- a/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteTimeDao.java +++ b/mt/src/main/java/com/ccsens/mt/persist/dao/CompeteTimeDao.java @@ -12,6 +12,12 @@ import java.util.List; */ @Repository public interface CompeteTimeDao extends CompeteTimeMapper { + /** + * 查各个教练得成绩 + * @param siteId + * @return + */ + List selectJudgmentS(@Param("siteId") Long siteId ); /** * 通过类型查找第几届和时间 * @param type 类型 diff --git a/mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteCountScoreMapper.java b/mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteCountScoreMapper.java index faf0e354..5592b7ec 100644 --- a/mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteCountScoreMapper.java +++ b/mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteCountScoreMapper.java @@ -2,6 +2,7 @@ package com.ccsens.mt.persist.mapper; import com.ccsens.mt.bean.po.CompeteCountScore; import com.ccsens.mt.bean.po.CompeteCountScoreExample; +import com.ccsens.mt.bean.po.CompeteCountScoreKey; import java.util.List; import org.apache.ibatis.annotations.Param; @@ -10,7 +11,7 @@ public interface CompeteCountScoreMapper { int deleteByExample(CompeteCountScoreExample example); - int deleteByPrimaryKey(Long id); + int deleteByPrimaryKey(CompeteCountScoreKey key); int insert(CompeteCountScore record); @@ -18,7 +19,7 @@ public interface CompeteCountScoreMapper { List selectByExample(CompeteCountScoreExample example); - CompeteCountScore selectByPrimaryKey(Long id); + CompeteCountScore selectByPrimaryKey(CompeteCountScoreKey key); int updateByExampleSelective(@Param("record") CompeteCountScore record, @Param("example") CompeteCountScoreExample example); diff --git a/mt/src/main/java/com/ccsens/mt/service/CompeteService.java b/mt/src/main/java/com/ccsens/mt/service/CompeteService.java index c6f2ca97..ea8311d9 100644 --- a/mt/src/main/java/com/ccsens/mt/service/CompeteService.java +++ b/mt/src/main/java/com/ccsens/mt/service/CompeteService.java @@ -11,8 +11,10 @@ import com.ccsens.cloudutil.bean.tall.dto.WpsDto; import com.ccsens.cloudutil.feign.TallFeignClient; import com.ccsens.mt.bean.dto.CompeteDto; import com.ccsens.mt.bean.dto.LevelDto; +import com.ccsens.mt.bean.dto.ScoreDto; import com.ccsens.mt.bean.po.*; import com.ccsens.mt.bean.vo.CompeteVo; +import com.ccsens.mt.bean.vo.ScoreVo; import com.ccsens.mt.bean.vo.TableVo; import com.ccsens.mt.persist.dao.CompeteEnrollDao; import com.ccsens.mt.persist.dao.CompetePlayerDao; @@ -38,10 +40,8 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.math.BigDecimal; +import java.util.*; /** * @author 逗 @@ -82,6 +82,103 @@ public class CompeteService implements ICompeteService { private TallFeignClient tallFeignClient; @Resource private CommonFileMapper commonFileMapper; + @Resource + private CompeteStartOrderMapper competeStartOrderMapper; + @Resource + private CompeteVarietyScoreMapper competeVarietyScoreMapper; + + /** + * 花样赛总成绩展示 + * @param param + */ + @Override + public List showResult(ScoreDto.ShowResult param) { + List totalScoreDisplaysList=new ArrayList<>(); + CompeteStartOrderExample competeStartOrderExample =new CompeteStartOrderExample(); + competeStartOrderExample.createCriteria().andProjectIdEqualTo(param.getProjectId()); + List competeStartOrdersList = competeStartOrderMapper.selectByExample(competeStartOrderExample); + competeStartOrdersList.forEach(competeStartOrder -> { + //一个人或者一个团队得数据 + CompeteVo.TotalScoreDisplay totalScoreDisplay=new CompeteVo.TotalScoreDisplay(); + //项目名 + totalScoreDisplay.setCompanyName(competeProjectMapper.selectByPrimaryKey(competeStartOrder.getProjectId()).getName()); + + //名字 + if(competeStartOrder.getTeam().equals((byte) 0)){ + //个人 + totalScoreDisplay.setPeopleName( competePlayerDao.selectByPrimaryKey(competeStartOrder.getPlayerId()).getName()); + }else { + //团体 + CompeteTeamMemberExample competeTeamMemberExample =new CompeteTeamMemberExample(); + competeTeamMemberExample.createCriteria().andCompeteTeamIdEqualTo(competeStartOrder.getPlayerId()); + List competeTeamMembersList = competeTeamMemberMapper.selectByExample(competeTeamMemberExample); + StringBuilder stringBuilder=new StringBuilder(""); + competeTeamMembersList.forEach(competeTeamMember -> { + stringBuilder.append(competePlayerDao.selectByPrimaryKey(competeTeamMember.getPlayerId()).getName()+'、'); + }); + totalScoreDisplay.setPeopleName(stringBuilder.toString().substring(0,stringBuilder.length())); + } + List results = competeTimeDao.selectJudgmentS(competeStartOrder.getId()); + //7个教练成绩也上去了 + for (CompeteVo.Result r :results){ + if(r.getChief()==0){ + totalScoreDisplay.setReferee0(r.getScore()); + }else if(r.getChief()==1){ + totalScoreDisplay.setReferee1(r.getScore()); + }else if(r.getChief()==2){ + totalScoreDisplay.setReferee2(r.getScore()); + }else if(r.getChief()==3){ + totalScoreDisplay.setReferee3(r.getScore()); + }else if(r.getChief()==4){ + totalScoreDisplay.setReferee4(r.getScore()); + }else if(r.getChief()==5){ + totalScoreDisplay.setReferee5(r.getScore()); + }else if(r.getChief()==6){ + totalScoreDisplay.setReferee6(r.getScore()); + } + } + + BigDecimal bigDecimal1to3=new BigDecimal(0); + bigDecimal1to3.add(totalScoreDisplay.getReferee1()).add(totalScoreDisplay.getReferee2()).add(totalScoreDisplay.getReferee3()); + BigDecimal bigDecimalavg1to3=new BigDecimal(0); + BigDecimal bignum=new BigDecimal(3); + totalScoreDisplay.setAvg1To3(bigDecimalavg1to3.divide(bignum,2,BigDecimal.ROUND_HALF_UP)); + + BigDecimal bigDecimal4to6=new BigDecimal(0); + bigDecimal4to6.add(totalScoreDisplay.getReferee4()).add(totalScoreDisplay.getReferee5()).add(totalScoreDisplay.getReferee6()); + BigDecimal bigDecimalavg4to6=new BigDecimal(0); + BigDecimal bignum1=new BigDecimal(3); + totalScoreDisplay.setAvg4To6(bigDecimalavg4to6.divide(bignum1,2,BigDecimal.ROUND_HALF_UP)); + //总成绩也出来了 + BigDecimal re=new BigDecimal(0); + re.add(totalScoreDisplay.getAvg1To3()).add(totalScoreDisplay.getAvg4To6()).subtract(totalScoreDisplay.getReferee0()); + totalScoreDisplay.setResult(re); + totalScoreDisplaysList.add(totalScoreDisplay); + }); +// Collections.sort(totalScoreDisplaysList, new Comparator() { +// @Override +// public BigDecimal compare(CompeteVo.TotalScoreDisplay o1, CompeteVo.TotalScoreDisplay o2) { +// o1.getResult().subtract(o2.getResult()); +// return o1.getResult(); +// } +// }); + + for (int i = 0; i < totalScoreDisplaysList.size() - 1; i++) { + for (int j = 1; j < totalScoreDisplaysList.size() - i; j++) { + BigDecimal b1 = totalScoreDisplaysList.get(j - 1).getResult(); + BigDecimal b2 = totalScoreDisplaysList.get(j).getResult(); + + CompeteVo.TotalScoreDisplay a; + if (b1.compareTo(b2) < 0) { + a = totalScoreDisplaysList.get(j - 1); + totalScoreDisplaysList.set((j - 1), totalScoreDisplaysList.get(j)); + totalScoreDisplaysList.set(j, a); + } + } + } + + return null; + } /** * 查看第几届 @@ -894,6 +991,24 @@ public class CompeteService implements ICompeteService { } return failPlayerInfoList; } + @Override + public void submitOrderList(ScoreDto.InformationSubmitted param) { + param.getFractionsList().forEach(mes->{ + CompeteVarietyScore competeVarietyScore=new CompeteVarietyScore(); + competeVarietyScore.setId(snowflake.nextId()); + competeVarietyScore.setCompeteTimeId(param.getCompeteTimeId()); + competeVarietyScore.setProjectId(param.getProjectId()); + competeVarietyScore.setSiteOrderId(param.getSiteOrderId()); + competeVarietyScore.setCode(mes.getCode()); + competeVarietyScore.setScore(mes.getScore()); + competeVarietyScore.setJudgmentId(param.getJudgmentId()); + competeVarietyScoreMapper.insertSelective(competeVarietyScore); + }); + + } + + + /** diff --git a/mt/src/main/java/com/ccsens/mt/service/ICompeteService.java b/mt/src/main/java/com/ccsens/mt/service/ICompeteService.java index 84cf068a..419b3d74 100644 --- a/mt/src/main/java/com/ccsens/mt/service/ICompeteService.java +++ b/mt/src/main/java/com/ccsens/mt/service/ICompeteService.java @@ -1,6 +1,7 @@ package com.ccsens.mt.service; import com.ccsens.mt.bean.dto.CompeteDto; +import com.ccsens.mt.bean.dto.ScoreDto; import com.ccsens.mt.bean.vo.CompeteVo; import com.ccsens.util.bean.dto.QueryDto; @@ -149,6 +150,10 @@ public interface ICompeteService { List signupImport(String path) throws FileNotFoundException, Exception; + void submitOrderList(ScoreDto.InformationSubmitted param); + + + List showResult(ScoreDto.ShowResult param); } diff --git a/mt/src/main/resources/mapper_dao/CompeteTimeDao.xml b/mt/src/main/resources/mapper_dao/CompeteTimeDao.xml index 3bbe88b0..9f3d834e 100644 --- a/mt/src/main/resources/mapper_dao/CompeteTimeDao.xml +++ b/mt/src/main/resources/mapper_dao/CompeteTimeDao.xml @@ -120,4 +120,14 @@ and p.rec_status = 0 GROUP BY g.id + \ No newline at end of file diff --git a/mt/src/main/resources/mapper_raw/CompeteCountScoreMapper.xml b/mt/src/main/resources/mapper_raw/CompeteCountScoreMapper.xml index bf9b3dc5..6f586d68 100644 --- a/mt/src/main/resources/mapper_raw/CompeteCountScoreMapper.xml +++ b/mt/src/main/resources/mapper_raw/CompeteCountScoreMapper.xml @@ -3,14 +3,14 @@ + - - + @@ -76,8 +76,8 @@ - id, compete_time_id, project_id, site_order_id, chief_judgment_score, judgment_a_score, - judgment_b_score2, should_times, deduct_times, deduct_cause, final_score, created_at, + id, should_times, compete_time_id, project_id, site_order_id, chief_judgment_score, + judgment_a_score, judgment_b_score2, deduct_times, deduct_cause, final_score, created_at, updated_at, rec_status - select from t_compete_count_score where id = #{id,jdbcType=BIGINT} + and should_times = #{shouldTimes,jdbcType=INTEGER} - + delete from t_compete_count_score where id = #{id,jdbcType=BIGINT} + and should_times = #{shouldTimes,jdbcType=INTEGER} delete from t_compete_count_score @@ -111,14 +113,14 @@ - insert into t_compete_count_score (id, compete_time_id, project_id, - site_order_id, chief_judgment_score, judgment_a_score, - judgment_b_score2, should_times, deduct_times, + insert into t_compete_count_score (id, should_times, compete_time_id, + project_id, site_order_id, chief_judgment_score, + judgment_a_score, judgment_b_score2, deduct_times, deduct_cause, final_score, created_at, updated_at, rec_status) - values (#{id,jdbcType=BIGINT}, #{competeTimeId,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT}, - #{siteOrderId,jdbcType=BIGINT}, #{chiefJudgmentScore,jdbcType=DECIMAL}, #{judgmentAScore,jdbcType=DECIMAL}, - #{judgmentBScore2,jdbcType=DECIMAL}, #{shouldTimes,jdbcType=DECIMAL}, #{deductTimes,jdbcType=DECIMAL}, + values (#{id,jdbcType=BIGINT}, #{shouldTimes,jdbcType=INTEGER}, #{competeTimeId,jdbcType=BIGINT}, + #{projectId,jdbcType=BIGINT}, #{siteOrderId,jdbcType=BIGINT}, #{chiefJudgmentScore,jdbcType=DECIMAL}, + #{judgmentAScore,jdbcType=DECIMAL}, #{judgmentBScore2,jdbcType=DECIMAL}, #{deductTimes,jdbcType=INTEGER}, #{deductCause,jdbcType=VARCHAR}, #{finalScore,jdbcType=DECIMAL}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}) @@ -128,6 +130,9 @@ id, + + should_times, + compete_time_id, @@ -146,9 +151,6 @@ judgment_b_score2, - - should_times, - deduct_times, @@ -172,6 +174,9 @@ #{id,jdbcType=BIGINT}, + + #{shouldTimes,jdbcType=INTEGER}, + #{competeTimeId,jdbcType=BIGINT}, @@ -190,11 +195,8 @@ #{judgmentBScore2,jdbcType=DECIMAL}, - - #{shouldTimes,jdbcType=DECIMAL}, - - #{deductTimes,jdbcType=DECIMAL}, + #{deductTimes,jdbcType=INTEGER}, #{deductCause,jdbcType=VARCHAR}, @@ -225,6 +227,9 @@ id = #{record.id,jdbcType=BIGINT}, + + should_times = #{record.shouldTimes,jdbcType=INTEGER}, + compete_time_id = #{record.competeTimeId,jdbcType=BIGINT}, @@ -243,11 +248,8 @@ judgment_b_score2 = #{record.judgmentBScore2,jdbcType=DECIMAL}, - - should_times = #{record.shouldTimes,jdbcType=DECIMAL}, - - deduct_times = #{record.deductTimes,jdbcType=DECIMAL}, + deduct_times = #{record.deductTimes,jdbcType=INTEGER}, deduct_cause = #{record.deductCause,jdbcType=VARCHAR}, @@ -272,14 +274,14 @@ update t_compete_count_score set id = #{record.id,jdbcType=BIGINT}, + should_times = #{record.shouldTimes,jdbcType=INTEGER}, compete_time_id = #{record.competeTimeId,jdbcType=BIGINT}, project_id = #{record.projectId,jdbcType=BIGINT}, site_order_id = #{record.siteOrderId,jdbcType=BIGINT}, chief_judgment_score = #{record.chiefJudgmentScore,jdbcType=DECIMAL}, judgment_a_score = #{record.judgmentAScore,jdbcType=DECIMAL}, judgment_b_score2 = #{record.judgmentBScore2,jdbcType=DECIMAL}, - should_times = #{record.shouldTimes,jdbcType=DECIMAL}, - deduct_times = #{record.deductTimes,jdbcType=DECIMAL}, + deduct_times = #{record.deductTimes,jdbcType=INTEGER}, deduct_cause = #{record.deductCause,jdbcType=VARCHAR}, final_score = #{record.finalScore,jdbcType=DECIMAL}, created_at = #{record.createdAt,jdbcType=TIMESTAMP}, @@ -310,11 +312,8 @@ judgment_b_score2 = #{judgmentBScore2,jdbcType=DECIMAL}, - - should_times = #{shouldTimes,jdbcType=DECIMAL}, - - deduct_times = #{deductTimes,jdbcType=DECIMAL}, + deduct_times = #{deductTimes,jdbcType=INTEGER}, deduct_cause = #{deductCause,jdbcType=VARCHAR}, @@ -333,6 +332,7 @@ where id = #{id,jdbcType=BIGINT} + and should_times = #{shouldTimes,jdbcType=INTEGER} update t_compete_count_score @@ -342,13 +342,13 @@ chief_judgment_score = #{chiefJudgmentScore,jdbcType=DECIMAL}, judgment_a_score = #{judgmentAScore,jdbcType=DECIMAL}, judgment_b_score2 = #{judgmentBScore2,jdbcType=DECIMAL}, - should_times = #{shouldTimes,jdbcType=DECIMAL}, - deduct_times = #{deductTimes,jdbcType=DECIMAL}, + deduct_times = #{deductTimes,jdbcType=INTEGER}, deduct_cause = #{deductCause,jdbcType=VARCHAR}, final_score = #{finalScore,jdbcType=DECIMAL}, created_at = #{createdAt,jdbcType=TIMESTAMP}, updated_at = #{updatedAt,jdbcType=TIMESTAMP}, rec_status = #{recStatus,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} + and should_times = #{shouldTimes,jdbcType=INTEGER} \ No newline at end of file diff --git a/util/src/test/java/com/ccsens/util/ListSort.java b/util/src/test/java/com/ccsens/util/ListSort.java new file mode 100644 index 00000000..fc18c4fc --- /dev/null +++ b/util/src/test/java/com/ccsens/util/ListSort.java @@ -0,0 +1,33 @@ +package com.ccsens.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class ListSort { + public static void main(String[] args) { + List list = new ArrayList<>(); + list.add(new StuVO("AAA",90)); + list.add(new StuVO("BBB",150)); + list.add(new StuVO("CCC",12)); + list.add(new StuVO("DDD",64)); + list.add(new StuVO("EEE",5)); + for(int i = 0;i < list.size();i++){ + System.out.println(list.get(i).getName()+" "+list.get(i).getScore()); + } + System.out.println("--------"); + + Collections.sort(list, new Comparator() { + @Override + public int compare(StuVO o1, StuVO o2) { + int i = o1.getScore() - o2.getScore(); + return i; + } + }); + + for(int i = 0;i < list.size();i++){ + System.out.println(list.get(i).getName()+" "+list.get(i).getScore()); + } + } +} diff --git a/util/src/test/java/com/ccsens/util/StuVO.java b/util/src/test/java/com/ccsens/util/StuVO.java new file mode 100644 index 00000000..e59e7f36 --- /dev/null +++ b/util/src/test/java/com/ccsens/util/StuVO.java @@ -0,0 +1,27 @@ +package com.ccsens.util; + +public class StuVO { + private String name; + private int score; + + public StuVO(String name, int srore) { + this.name = name; + this.score = srore; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getScore() { + return score; + } + + public void setScore(int srore) { + this.score = srore; + } +}