Browse Source

res

tiaosheng
wang0018 5 years ago
parent
commit
1664402b18
  1. 8
      mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java
  2. 11
      mt/src/main/java/com/ccsens/mt/bean/dto/ScoreDto.java
  3. 32
      mt/src/main/java/com/ccsens/mt/bean/vo/CompeteVo.java
  4. 22
      mt/src/main/java/com/ccsens/mt/bean/vo/TableVo.java
  5. 8
      mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java
  6. 6
      mt/src/main/java/com/ccsens/mt/service/CompeteService.java
  7. 58
      mt/src/main/java/com/ccsens/mt/service/ExcelService.java
  8. 7
      mt/src/main/java/com/ccsens/mt/service/ICompeteService.java
  9. 2
      mt/src/main/resources/application-dev.yml
  10. 1
      mt/src/main/resources/application.yml
  11. 45
      mt/src/main/resources/mapper_dao/CompeteCompanyDao.xml
  12. 2
      mt/src/main/resources/mapper_dao/CompeteProjectDao.xml
  13. 33
      mt/src/main/resources/mapper_dao/CompeteScoreDao.xml
  14. 25
      util/src/main/java/com/ccsens/util/PoiUtil.java

8
mt/src/main/java/com/ccsens/mt/api/CompeteScoreController.java

@ -75,6 +75,14 @@ public class CompeteScoreController {
return JsonResponse.newInstance().ok(totalScoreDisplaysList);
}
@ApiOperation(value = "查看花样赛某一场次的成绩", notes = "whj -----查看花样赛某一场次的成绩")
@RequestMapping(value = "/getResult", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<CompeteVo.OneScore> getResult (@ApiParam @Validated @RequestBody QueryDto<ScoreDto.OneScore> params){
log.info("花样赛详细分数查看:{}",params);
CompeteVo.OneScore score= competeService.getResult(params.getParam());
return JsonResponse.newInstance().ok(score);
}
@ApiOperation(value = "项目状态", notes = "")
@RequestMapping(value = "/countScore", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})

11
mt/src/main/java/com/ccsens/mt/bean/dto/ScoreDto.java

@ -165,6 +165,17 @@ public class ScoreDto {
@Max(value=100)
private int pageSize = 10;
}
@Data
@ApiModel("某一场次的成绩查询-请求")
public static class OneScore {
@NotNull
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("场次ID")
@NotNull
private Long siteOrderId;
}
@Data
@ApiModel
public static class ShowResultNoPage {

32
mt/src/main/java/com/ccsens/mt/bean/vo/CompeteVo.java

@ -497,7 +497,37 @@ public class CompeteVo {
// @ApiModelProperty("排名")
// public int order;
@ApiModelProperty("备注")
public Byte remark;
public String remark;
}
@ApiModel("某一场次的成绩查询-响应")
public static class OneScore{
@ApiModelProperty("单位名")
public String companyName;
@ApiModelProperty("参赛队员名")
public String peopleName;
@ApiModelProperty("裁判1")
public BigDecimal referee1 = new BigDecimal(0);
@ApiModelProperty("裁判2")
public BigDecimal referee2 = new BigDecimal(0);
@ApiModelProperty("裁判3")
public BigDecimal referee3 = new BigDecimal(0);
@ApiModelProperty("1-3裁判得平均值")
public BigDecimal avg1To3 = new BigDecimal(0);
@ApiModelProperty("裁判4")
public BigDecimal referee4 = new BigDecimal(0);
@ApiModelProperty("裁判5")
public BigDecimal referee5 = new BigDecimal(0);
@ApiModelProperty("裁判6")
public BigDecimal referee6 = new BigDecimal(0);
@ApiModelProperty("4-6裁判得平均值")
public BigDecimal avg4To6 = new BigDecimal(0);
@ApiModelProperty("主裁判")
public BigDecimal referee0 = new BigDecimal(0);
@ApiModelProperty("最后得分")
public BigDecimal result = new BigDecimal(0);
@ApiModelProperty("备注")
public String remark;
}
@Data

22
mt/src/main/java/com/ccsens/mt/bean/vo/TableVo.java

@ -146,19 +146,19 @@ public class TableVo {
public List<String> getNums(){
List<String> nums = new ArrayList<>();
if(CollectionUtil.isNotEmpty(joinNum)){
if(certificate == 0){
joinNum.forEach(joinGroupNum -> {
nums.add(joinGroupNum.getNum());
});
}else {
int i = 0;
for(JoinGroupNum joinGroupNum : joinNum){
if(!"/".equalsIgnoreCase(joinGroupNum.getNum())){
i += Integer.parseInt(joinGroupNum.getNum());
if (certificate == 0) {
joinNum.forEach(joinGroupNum -> {
nums.add(joinGroupNum.getNum());
});
} else {
int i = 0;
for (JoinGroupNum joinGroupNum : joinNum) {
if (!"/".equalsIgnoreCase(joinGroupNum.getNum())) {
i += Integer.parseInt(joinGroupNum.getNum());
}
}
nums.add(String.valueOf(i));
}
nums.add(String.valueOf(i));
}
}
return nums;
}

8
mt/src/main/java/com/ccsens/mt/persist/dao/CompeteScoreDao.java

@ -97,6 +97,14 @@ public interface CompeteScoreDao {
*/
List<CompeteVo.TotalScoreDisplay> queryVarietyScore(@Param("projectId") Long projectId);
/**
* 查询花样赛某一场的成绩
* @param projectId 项目ID
* @param siteOrderId 场次ID
* @return 成绩
*/
CompeteVo.OneScore getVarietyScore(@Param("projectId") Long projectId, @Param("siteOrderId")Long siteOrderId);
List<CompeteVo.DaiBiaoDUi> selAllDaiBiaoDui(@Param("identity") byte identity);
/**

6
mt/src/main/java/com/ccsens/mt/service/CompeteService.java

@ -1858,6 +1858,12 @@ public class CompeteService implements ICompeteService {
return new PageInfo<>(list);
}
@Override
public CompeteVo.OneScore getResult(ScoreDto.OneScore param) {
CompeteVo.OneScore score = competeScoreDao.getVarietyScore(param.getProjectId(), param.getSiteOrderId());
return score;
}
@Override
public String speedPassOut(CompeteDto.CompeteTimeAndProjectId params) throws IOException {

58
mt/src/main/java/com/ccsens/mt/service/ExcelService.java

@ -524,8 +524,7 @@ public class ExcelService implements IExcelService {
@Override
public String
competeJoinCount(CompeteDto.CompeteTime params) throws IOException {
public String competeJoinCount(CompeteDto.CompeteTime params) throws IOException {
List<TableVo.CompeteOverview> competeOverviewList = competeJoinCountList(params);
return getExcelFilePathForCompeteJoinCount(competeOverviewList);
}
@ -708,14 +707,14 @@ public class ExcelService implements IExcelService {
List<TableVo.CompeteAllCount1> competeAllCountList = new ArrayList<>();
if(ObjectUtil.isNotNull(competeTime)){
//查询个人赛的数量统计
// List<TableVo.CompeteAllCount1> nums = competePlayerDao.getJoinNumByType(competeTime.getType());
// competeAllCountList.addAll(nums);
List<TableVo.CompeteAllCount1> nums = competePlayerDao.getJoinNumByType(competeTime.getType());
competeAllCountList.addAll(nums);
//查询限制组别的团体赛的统计
List<TableVo.CompeteAllCount1> groupRuleNum = competePlayerDao.getJoinRuleTeamNumByType(competeTime.getType());
competeAllCountList.addAll(groupRuleNum);
//查询团体赛的数量统计
// List<TableVo.CompeteAllCount1> groupNum = competePlayerDao.getJoinTeamNumByType(competeTime.getType());
// competeAllCountList.addAll(groupNum);
List<TableVo.CompeteAllCount1> groupNum = competePlayerDao.getJoinTeamNumByType(competeTime.getType());
competeAllCountList.addAll(groupNum);
}
CollectionUtil.sort(competeAllCountList,(t1,t2)-> (int)(t1.getProjectId() - t2.getProjectId()));
return competeAllCountList;
@ -750,6 +749,7 @@ public class ExcelService implements IExcelService {
//创建整个excel表格对象
Workbook workbook = new XSSFWorkbook();
int i = 1;
int a = 2;
for (TableVo.CompeteAllCount1 competeAllCount : arrayList) {
//行对象
List<PoiUtil.PoiUtilCell> cells = new ArrayList<>();
@ -766,38 +766,13 @@ public class ExcelService implements IExcelService {
cells.add(poiUtilCel);
}
}
// PoiUtil.PoiUtilCell poiUtilCel = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(0)));
// cells.add(poiUtilCel);
// PoiUtil.PoiUtilCell poiUtilCell = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(1)));
// cells.add(poiUtilCell);
// PoiUtil.PoiUtilCell poiUtilCel2 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(2)));
// cells.add(poiUtilCel2);
// PoiUtil.PoiUtilCell poiUtilCel3 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(3)));
// cells.add(poiUtilCel3);
// PoiUtil.PoiUtilCell poiUtilCel4 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(4)));
// cells.add(poiUtilCel4);
// PoiUtil.PoiUtilCell poiUtilCel5 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(5)));
// cells.add(poiUtilCel5);
// PoiUtil.PoiUtilCell poiUtilCel6 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(6)));
// cells.add(poiUtilCel6);
// PoiUtil.PoiUtilCell poiUtilCel7 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(7)));
// cells.add(poiUtilCel7);
// PoiUtil.PoiUtilCell poiUtilCel8 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(8)));
// cells.add(poiUtilCel8);
// PoiUtil.PoiUtilCell poiUtilCel9 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(9)));
// cells.add(poiUtilCel9);
// PoiUtil.PoiUtilCell poiUtilCel10 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(10)));
// cells.add(poiUtilCel10);
// PoiUtil.PoiUtilCell poiUtilCel11 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(11)));
// cells.add(poiUtilCel11);
// PoiUtil.PoiUtilCell poiUtilCel12 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(12)));
// cells.add(poiUtilCel12);
// PoiUtil.PoiUtilCell poiUtilCel13 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(13)));
// cells.add(poiUtilCel13);
// PoiUtil.PoiUtilCell poiUtilCel14 = new PoiUtil.PoiUtilCell(String.valueOf(competeAllCount.getNums().get(14)));
// cells.add(poiUtilCel14);
PoiUtil.PoiUtilCell poiUtilCell = new PoiUtil.PoiUtilCell();
poiUtilCell.setValue("");
poiUtilCell.setFunction("sum(C"+a+":Q"+a+")");
cells.add(poiUtilCell);
list.add(cells);
i++;
a++;
}
//生成excel表格对象,并将数据放入
Workbook wbs = PoiUtil.exportWB("比赛报名汇总表", list, workbook);
@ -1242,11 +1217,12 @@ public class ExcelService implements IExcelService {
PoiUtil.PoiUtilCell threeThir=new PoiUtil.PoiUtilCell((StringUtil.valueOf(mes.getResult())),1,1);
PoiUtil.PoiUtilCell threeFour=new PoiUtil.PoiUtilCell("",1,1);
PoiUtil.PoiUtilCell threeFif=new PoiUtil.PoiUtilCell(WebConstant.CELL_NULL,1,1);
if(mes.getRemark()==(byte)1){
threeFif.setValue("弃权");
}else {
threeFif.setValue("取消比赛资格");
}
// if(mes.getRemark()==(byte)1){
// threeFif.setValue("弃权");
// }else {
// threeFif.setValue("取消比赛资格");
// }
threeFif.setValue(mes.getRemark());
three.add(threeThree);
three.add(threeFive);
three.add(threeSix);

7
mt/src/main/java/com/ccsens/mt/service/ICompeteService.java

@ -221,6 +221,13 @@ public interface ICompeteService {
* @return 成绩
*/
PageInfo<ScoreVo.CountScorePublicity> queryCountScore(ScoreDto.ShowResult param);
/**
* 查看花样赛某一场次的成绩
* @param param
* @return
*/
CompeteVo.OneScore getResult(ScoreDto.OneScore param);
}

2
mt/src/main/resources/application-dev.yml

@ -31,3 +31,5 @@ file:
signUpUrl: https://test.tall.wiki/compete/
domain: https://test.tall.wiki/gateway/mt/
imgDomain: https://test.tall.wiki/gateway/mt/uploads/
logging:
path:

1
mt/src/main/resources/application.yml

@ -3,3 +3,4 @@ spring:
active: dev
include: common, util-dev

45
mt/src/main/resources/mapper_dao/CompeteCompanyDao.xml

@ -401,22 +401,41 @@
<select id="selectCompeteJoinCountList" resultType="com.ccsens.mt.bean.vo.TableVo$CompeteOverview">
SELECT *,
(coachNum+guideNum+playerNum) as sum
FROM
select t3.companyId,t3.companyName as companyName , t1.coachNum, t2.guideNum, t3.playerNum , IFNULL(t1.coachNum,0) + IFNULL(t2.guideNum,0) + IFNULL(t3.playerNum,0) as sum from
(select t.companyId, t.companyName,count(t.id) as playerNum from
(SELECT
tcc.`name` as companyName,
tcc.id,
(SELECT count(tcca.id) FROM t_compete_coach tcca WHERE tcc.id = tcca.company_id and identity = 1 and rec_status = 0) as coachNum,
(SELECT count(tcca.id) FROM t_compete_coach tcca WHERE tcc.id = tcca.company_id and identity = 0 and rec_status = 0) as guideNum,
((SELECT COUNT(tcpp.id) FROM t_compete_project_player tcpp LEFT JOIN t_compete_player tcp on tcp.id = tcpp.player_id WHERE tcp.company_id = tcc.id and tcp.rec_status = 0 and tcpp.rec_status = 0 and tcp.rec_status = 0) +
(SELECT COUNT(tctm.id) FROM t_compete_team_member tctm LEFT JOIN t_compete_team tct on tctm.compete_team_id = tct.id WHERE tct.company_id = tcc.id and tct.rec_status = 0 and tctm.rec_status = 0 ))as playerNum
DISTINCT(tcp.id) as id, tcc.id as companyId,tcc.`name` as companyName
FROM
t_compete_company tcc
left join
t_compete_player tcp on tcc.id = tcp.company_id
LEFT JOIN t_compete_project_player tcpp ON tcp.id = tcpp.player_id
WHERE
tcc.type = 0
AND tcp.company_id = tcc.id
AND tcc.rec_status = 0
AND tcp.rec_status = 0
AND tcpp.rec_status = 0
UNION
SELECT
DISTINCT(tcp.id) as id,tcc.id as companyId,tcc.`name` as companyName
FROM
t_compete_company tcc
LEFT JOIN t_compete_team tct ON tcc.id = tct.company_id
LEFT JOIN t_compete_team_member tctm on tct.id = tctm.compete_team_id
LEFT JOIN t_compete_player tcp ON tctm.player_id = tcp.id
WHERE
tcc.rec_status =0
and tcc.compete_time_id = #{competeTimeId}
) c
WHERE c.playerNum &lt;&gt; 0
tcc.type = 0
AND tct.rec_status = 0
AND tctm.rec_status = 0
And tcc.rec_status = 0
AND tcp.rec_status = 0) t
group by t.companyId
having count(t.id) > 0
) t3
left join
(SELECT tcc.id as companyId,tcc.`name` as companyName ,count(tcca.id) as coachNum FROM t_compete_company tcc left join (select * from t_compete_coach where rec_status = 0) tcca on tcc.id = tcca.company_id where tcc.type = 0 AND identity = 1 and tcc.rec_status = 0 GROUP BY tcc.id) t1 on t1.companyId = t3.companyId
left join
(SELECT tcc.id as companyId,tcc.`name` as companyName , count(tcca.id) as guideNum FROM t_compete_company tcc left join (select * from t_compete_coach where rec_status = 0) tcca on tcc.id = tcca.company_id where tcc.type = 0 AND identity = 0 and tcc.rec_status = 0 GROUP BY tcc.id) t2 on t2.companyId = t3.companyId
</select>
</mapper>

2
mt/src/main/resources/mapper_dao/CompeteProjectDao.xml

@ -15,7 +15,7 @@
tcg.group_name as competeGroup,
tcc.`name` as joinTeam,
tcp.`name` as name,
tcp.gender as gender,
if(tcp.gender = 1,'男','女') as gender,
tcp.id_card as idCard,
(2020 - SUBSTR(tcp.id_card FROM 7 FOR 4)) as age
from t_compete_project tcpro

33
mt/src/main/resources/mapper_dao/CompeteScoreDao.xml

@ -705,6 +705,7 @@
select s.*, c.name as companyName, GROUP_CONCAT(p.name) as peopleName, (ifnull(s.referee1,0)+ifnull(s.referee2,0)+ifnull(s.referee3,0))/3 as avg1To3,
(ifnull(s.referee4,0)+ifnull(s.referee5,0)+ifnull(s.referee6,0))/3 as avg4To6,
(ifnull(s.referee1,0)+ifnull(s.referee2,0)+ifnull(s.referee3,0))/3 + (ifnull(s.referee4,0)+ifnull(s.referee5,0)+ifnull(s.referee6,0))/3 - s.referee0 as result,
case o.waiver when 1 then '弃权' when 2 then '取消比赛资格' end as remark,
@rownum := @rownum + 1 AS rownum
from
(select site_order_id, max(if(chief_judgment = 0, score, null)) as referee0, max(if(chief_judgment = 1, score, null)) as referee1,
@ -742,8 +743,13 @@
IF
(
(
<<<<<<< HEAD
( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player where t_compete_project_player.rec_status=0) )
OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member where t_compete_team_member.rec_status=0 ) )
=======
( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player WHERE rec_status = 0) )
OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member WHERE rec_status = 0) )
>>>>>>> 4adc089d09a6c4afde0f4ad70b88920c167d5e7a
),
1,
0
@ -838,8 +844,13 @@
IF
(
(
( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player where t_compete_project_player.rec_status=0 ) )
OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member where t_compete_team_member.rec_status=0 ) )
-- =======
-- ( tcp.id IN ( SELECT t_compete_project_player.player_id FROM t_compete_project_player WHERE rec_status = 0) )
-- OR ( tcp.id IN ( SELECT t_compete_team_member.player_id FROM t_compete_team_member WHERE rec_status = 0) )
-- >>>>>>> 4adc089d09a6c4afde0f4ad70b88920c167d5e7a
),
1,
0
@ -862,6 +873,28 @@
ORDER BY
tt.id
</select>
<select id="getVarietyScore" resultType="com.ccsens.mt.bean.vo.CompeteVo$OneScore">
select s.*, c.name as companyName, GROUP_CONCAT(p.name) as peopleName, (ifnull(s.referee1,0)+ifnull(s.referee2,0)+ifnull(s.referee3,0))/3 as avg1To3,
(ifnull(s.referee4,0)+ifnull(s.referee5,0)+ifnull(s.referee6,0))/3 as avg4To6,
(ifnull(s.referee1,0)+ifnull(s.referee2,0)+ifnull(s.referee3,0))/3 + (ifnull(s.referee4,0)+ifnull(s.referee5,0)+ifnull(s.referee6,0))/3 - s.referee0 as result,
case o.waiver when 1 then '弃权' when 2 then '取消比赛资格' end as remark
from
(select site_order_id, max(if(chief_judgment = 0, score, null)) as referee0, max(if(chief_judgment = 1, score, null)) as referee1,
max(if(chief_judgment = 2, score, null)) as referee2, max(if(chief_judgment = 3, score, null)) as referee3,
max(if(chief_judgment = 4, score, null)) as referee4, max(if(chief_judgment = 5, score, null)) as referee5,
max(if(chief_judgment = 6, score, null)) as referee6, max(if(chief_judgment = 7, score, null)) as referee7
from
(select s.site_order_id, j.chief_judgment, sum(s.score) as score from t_compete_variety_score s, t_compete_judgment j where s.judgment_id = j.id and s.project_id = #{projectId} and s.site_order_id = #{siteOrderId} and s.rec_status = 0 and j.rec_status = 0 group by s.site_order_id,j.chief_judgment) t
group by t.site_order_id) s,
t_compete_start_order o,
t_compete_team t,
t_compete_team_member m,
t_compete_player p,
t_compete_company c
where s.site_order_id = o.id and o.player_id = t.id and t.id = m.compete_team_id and m.player_id = p.id and p.company_id = c.id
and o.rec_status = 0 and t.rec_status = 0 and m.rec_status = 0 and p.rec_status = 0 and c.rec_status = 0
group by s.site_order_id
</select>
<resultMap id="selAllOrder" type="com.ccsens.mt.bean.vo.CompeteExcelVo$Project">
<id column="projectId" property="projectId"></id>
<result column="projectName" property="projectName" />

25
util/src/main/java/com/ccsens/util/PoiUtil.java

@ -178,9 +178,14 @@ public class PoiUtil {
CellStyle style = wb.createCellStyle();
//设置内容
if (!WebConstant.CELL_NULL.equals(cell.value)){
if(cell.num == 1){
newCell.setCellValue(Integer.parseInt(cell.value));
}else {
// if(cell.num == 1){
// newCell.setCellValue(Integer.parseInt(cell.value));
// }else {
// newCell.setCellValue(cell.value);
// }
if (cell.value.length() <= 14 && cell.value.matches("\\d+")) {
newCell.setCellValue(Long.parseLong(cell.value));
} else {
newCell.setCellValue(cell.value);
}
}
@ -623,17 +628,19 @@ public class PoiUtil {
PoiUtilCell poiUtilCell = new PoiUtilCell();
poiUtilCell.setValue("111222333");
poiUtilCell.setColspan(3);
PoiUtilCell poiUtilCella = new PoiUtilCell();
PoiUtilCell poiUtilCellb = new PoiUtilCell();
poiUtilCell.setColspan(1);
PoiUtilCell poiUtilCell1 = new PoiUtilCell();
poiUtilCell1.setValue("aaadddfffersdfsdfasftargadfgergsdfhasfgasfgaertagaergafdhsfgjfyk");
poiUtilCell1.setValue("123");
PoiUtilCell poiUtilCell2 = new PoiUtilCell();
poiUtilCell2.setValue("");
poiUtilCell2.setFunction("SUM(A1:B1)");
List<PoiUtilCell> cells = new ArrayList<>();
cells.add(poiUtilCell);
cells.add(poiUtilCella);
cells.add(poiUtilCellb);
cells.add(poiUtilCell1);
cells.add(poiUtilCell2);
List<List<PoiUtilCell>> list = new ArrayList<>();
list.add(cells);

Loading…
Cancel
Save