Browse Source

成绩排序

tiaosheng
wang0018 5 years ago
parent
commit
8bcf7fce0a
  1. 20
      mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java
  2. 26
      mt/src/main/java/com/ccsens/mt/bean/dto/ScoreDto.java
  3. 30
      mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScore.java
  4. 140
      mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreExample.java
  5. 39
      mt/src/main/java/com/ccsens/mt/bean/po/CompeteCountScoreKey.java
  6. 43
      mt/src/main/java/com/ccsens/mt/bean/vo/CompeteVo.java
  7. 6
      mt/src/main/java/com/ccsens/mt/persist/dao/CompeteTimeDao.java
  8. 5
      mt/src/main/java/com/ccsens/mt/persist/mapper/CompeteCountScoreMapper.java
  9. 123
      mt/src/main/java/com/ccsens/mt/service/CompeteService.java
  10. 5
      mt/src/main/java/com/ccsens/mt/service/ICompeteService.java
  11. 10
      mt/src/main/resources/mapper_dao/CompeteTimeDao.xml
  12. 62
      mt/src/main/resources/mapper_raw/CompeteCountScoreMapper.xml
  13. 33
      util/src/test/java/com/ccsens/util/ListSort.java
  14. 27
      util/src/test/java/com/ccsens/util/StuVO.java

20
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<ScoreDto.InformationSubmitted> 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<List<CompeteVo.TotalScoreDisplay>> showResult (@ApiParam @Validated @RequestBody QueryDto<ScoreDto.ShowResult> params){
log.info("花样赛详细分数查看:{}",params);
List<CompeteVo.TotalScoreDisplay> totalScoreDisplaysList= competeService.showResult(params.getParam());
return JsonResponse.newInstance().ok(totalScoreDisplaysList);
}
}

26
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<Fraction>
@NotNull
@ApiModelProperty("计分项目")
private List<Fraction> 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;
}
}

30
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);

140
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<Integer> values) {
addCriterion("should_times in", values, "shouldTimes");
return (Criteria) this;
}
public Criteria andShouldTimesNotIn(List<Integer> 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<BigDecimal> values) {
addCriterion("should_times in", values, "shouldTimes");
return (Criteria) this;
}
public Criteria andShouldTimesNotIn(List<BigDecimal> 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<BigDecimal> values) {
public Criteria andDeductTimesIn(List<Integer> values) {
addCriterion("deduct_times in", values, "deductTimes");
return (Criteria) this;
}
public Criteria andDeductTimesNotIn(List<BigDecimal> values) {
public Criteria andDeductTimesNotIn(List<Integer> 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;
}

39
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();
}
}

43
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;
}
}

6
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<CompeteVo.Result> selectJudgmentS(@Param("siteId") Long siteId );
/**
* 通过类型查找第几届和时间
* @param type 类型

5
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<CompeteCountScore> selectByExample(CompeteCountScoreExample example);
CompeteCountScore selectByPrimaryKey(Long id);
CompeteCountScore selectByPrimaryKey(CompeteCountScoreKey key);
int updateByExampleSelective(@Param("record") CompeteCountScore record, @Param("example") CompeteCountScoreExample example);

123
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<CompeteVo.TotalScoreDisplay> showResult(ScoreDto.ShowResult param) {
List<CompeteVo.TotalScoreDisplay> totalScoreDisplaysList=new ArrayList<>();
CompeteStartOrderExample competeStartOrderExample =new CompeteStartOrderExample();
competeStartOrderExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
List<CompeteStartOrder> 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<CompeteTeamMember> 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<CompeteVo.Result> 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<CompeteVo.TotalScoreDisplay>() {
// @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);
});
}
/**

5
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<CompeteVo.FailPlayerInfo> signupImport(String path) throws FileNotFoundException, Exception;
void submitOrderList(ScoreDto.InformationSubmitted param);
List<CompeteVo.TotalScoreDisplay> showResult(ScoreDto.ShowResult param);
}

10
mt/src/main/resources/mapper_dao/CompeteTimeDao.xml

@ -120,4 +120,14 @@
and p.rec_status = 0
GROUP BY g.id
</select>
<select id="selectJudgmentS" resultType="com.ccsens.mt.bean.vo.CompeteVo$Result">
SELECT
sum(tcvs.score) as `score`,
tcj.`chief_judgment` as `chief`
FROM t_compete_variety_score tcvs
LEFT JOIN t_compete_judgment tcj on tcvs.judgment_id=tcj.id
WHERE site_order_id=#{siteId}
GROUP BY tcvs.`judgment_id`
</select>
</mapper>

62
mt/src/main/resources/mapper_raw/CompeteCountScoreMapper.xml

@ -3,14 +3,14 @@
<mapper namespace="com.ccsens.mt.persist.mapper.CompeteCountScoreMapper">
<resultMap id="BaseResultMap" type="com.ccsens.mt.bean.po.CompeteCountScore">
<id column="id" jdbcType="BIGINT" property="id" />
<id column="should_times" jdbcType="INTEGER" property="shouldTimes" />
<result column="compete_time_id" jdbcType="BIGINT" property="competeTimeId" />
<result column="project_id" jdbcType="BIGINT" property="projectId" />
<result column="site_order_id" jdbcType="BIGINT" property="siteOrderId" />
<result column="chief_judgment_score" jdbcType="DECIMAL" property="chiefJudgmentScore" />
<result column="judgment_a_score" jdbcType="DECIMAL" property="judgmentAScore" />
<result column="judgment_b_score2" jdbcType="DECIMAL" property="judgmentBScore2" />
<result column="should_times" jdbcType="DECIMAL" property="shouldTimes" />
<result column="deduct_times" jdbcType="DECIMAL" property="deductTimes" />
<result column="deduct_times" jdbcType="INTEGER" property="deductTimes" />
<result column="deduct_cause" jdbcType="VARCHAR" property="deductCause" />
<result column="final_score" jdbcType="DECIMAL" property="finalScore" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
@ -76,8 +76,8 @@
</where>
</sql>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByExample" parameterType="com.ccsens.mt.bean.po.CompeteCountScoreExample" resultMap="BaseResultMap">
@ -94,15 +94,17 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="com.ccsens.mt.bean.po.CompeteCountScoreKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_compete_count_score
where id = #{id,jdbcType=BIGINT}
and should_times = #{shouldTimes,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<delete id="deleteByPrimaryKey" parameterType="com.ccsens.mt.bean.po.CompeteCountScoreKey">
delete from t_compete_count_score
where id = #{id,jdbcType=BIGINT}
and should_times = #{shouldTimes,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.mt.bean.po.CompeteCountScoreExample">
delete from t_compete_count_score
@ -111,14 +113,14 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.mt.bean.po.CompeteCountScore">
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})
</insert>
@ -128,6 +130,9 @@
<if test="id != null">
id,
</if>
<if test="shouldTimes != null">
should_times,
</if>
<if test="competeTimeId != null">
compete_time_id,
</if>
@ -146,9 +151,6 @@
<if test="judgmentBScore2 != null">
judgment_b_score2,
</if>
<if test="shouldTimes != null">
should_times,
</if>
<if test="deductTimes != null">
deduct_times,
</if>
@ -172,6 +174,9 @@
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="shouldTimes != null">
#{shouldTimes,jdbcType=INTEGER},
</if>
<if test="competeTimeId != null">
#{competeTimeId,jdbcType=BIGINT},
</if>
@ -190,11 +195,8 @@
<if test="judgmentBScore2 != null">
#{judgmentBScore2,jdbcType=DECIMAL},
</if>
<if test="shouldTimes != null">
#{shouldTimes,jdbcType=DECIMAL},
</if>
<if test="deductTimes != null">
#{deductTimes,jdbcType=DECIMAL},
#{deductTimes,jdbcType=INTEGER},
</if>
<if test="deductCause != null">
#{deductCause,jdbcType=VARCHAR},
@ -225,6 +227,9 @@
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.shouldTimes != null">
should_times = #{record.shouldTimes,jdbcType=INTEGER},
</if>
<if test="record.competeTimeId != null">
compete_time_id = #{record.competeTimeId,jdbcType=BIGINT},
</if>
@ -243,11 +248,8 @@
<if test="record.judgmentBScore2 != null">
judgment_b_score2 = #{record.judgmentBScore2,jdbcType=DECIMAL},
</if>
<if test="record.shouldTimes != null">
should_times = #{record.shouldTimes,jdbcType=DECIMAL},
</if>
<if test="record.deductTimes != null">
deduct_times = #{record.deductTimes,jdbcType=DECIMAL},
deduct_times = #{record.deductTimes,jdbcType=INTEGER},
</if>
<if test="record.deductCause != null">
deduct_cause = #{record.deductCause,jdbcType=VARCHAR},
@ -272,14 +274,14 @@
<update id="updateByExample" parameterType="map">
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 @@
<if test="judgmentBScore2 != null">
judgment_b_score2 = #{judgmentBScore2,jdbcType=DECIMAL},
</if>
<if test="shouldTimes != null">
should_times = #{shouldTimes,jdbcType=DECIMAL},
</if>
<if test="deductTimes != null">
deduct_times = #{deductTimes,jdbcType=DECIMAL},
deduct_times = #{deductTimes,jdbcType=INTEGER},
</if>
<if test="deductCause != null">
deduct_cause = #{deductCause,jdbcType=VARCHAR},
@ -333,6 +332,7 @@
</if>
</set>
where id = #{id,jdbcType=BIGINT}
and should_times = #{shouldTimes,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.mt.bean.po.CompeteCountScore">
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}
</update>
</mapper>

33
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<StuVO> 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<StuVO>() {
@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());
}
}
}

27
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;
}
}
Loading…
Cancel
Save