pull/371/head
wuyibo 2 years ago
parent 3daf7d5953
commit 2f769dc2ef

@ -195,5 +195,7 @@ public class Competition extends BaseEntity
/** 赞助商 */
@Excel(name = "赞助商")
private String sponsor;
@Excel(name = "图片库id")
private String orderId;
}

@ -161,7 +161,7 @@ public class CompetitionResultServiceImpl implements ICompetitionResultService
// entity.setCreatedBy(String.valueOf(user.getUserid()));
entity.setCreatedTime(new Date());
competitionResultMapper.insertCompetitionResult(entity);
this.calculateScore(entity,user);
//this.calculateScore(entity,user);
return true;
}
@ -278,7 +278,7 @@ public class CompetitionResultServiceImpl implements ICompetitionResultService
// entity.setModifiedBy(String.valueOf(user.getUserid()));
entity.setLastUpdatedTime(new Date());
competitionResultMapper.updateCompetitionResult(entity);
this.calculateScore(entity,user);
//this.calculateScore(entity,user);
return true;
}
}

@ -261,7 +261,14 @@ public class CompetitionTeamVsTeamServiceImpl implements ICompetitionTeamVsTeamS
@Override
public Boolean competitionScoreSubmit(List<CompetitionResult> request) {
CompetitionTeamVsTeamVo teamVsTeam = new CompetitionTeamVsTeamVo();
Optional<CompetitionResult> opt = request.stream().findFirst();
if(opt.isPresent()){
CompetitionResult result = opt.get();
teamVsTeam = competitionTeamVsTeamMapper.selectCompetitionTeamVsTeamById(result.getCompetitionVsId());
}
Integer mainTeamScore = 0;
Integer guestTeamScore = 0;
for(CompetitionResult competitionResult : request){
//小节分数可能为空
int oneNodeScore = competitionResult.getOneNodeScore()==null?0:competitionResult.getOneNodeScore();
@ -270,16 +277,20 @@ public class CompetitionTeamVsTeamServiceImpl implements ICompetitionTeamVsTeamS
int fourNodeScore = competitionResult.getFourNodeScore()==null?0:competitionResult.getFourNodeScore();
int fiveNodeScore = competitionResult.getFiveNodeScore()==null?0:competitionResult.getFiveNodeScore();
int sixNodeScore = competitionResult.getSixNodeScore()==null?0:competitionResult.getSixNodeScore();
int score = oneNodeScore+twoNodeScore+threeNodeScore+fourNodeScore+fiveNodeScore+sixNodeScore;
if(score>0&&competitionResult.getTotalScore()!=null){
if(score!=competitionResult.getTotalScore()){
throw new InvalidParameterException("总分和小节分之和 不等 请检查!");
}
} else if(score==0&&competitionResult.getTotalScore()!=null){
competitionResult.setOneNodeScore(competitionResult.getTotalScore());
competitionResult.setOneNodeScore(score);
}
//主队
if(teamVsTeam.getMainTeamId().equals(competitionResult.getCompetitionOfTeamId())){
mainTeamScore = score;
} else {//客队
guestTeamScore = score;
}
//新增
if(competitionResult.getId()==null){
competitionResultService.add(competitionResult);
@ -290,6 +301,13 @@ public class CompetitionTeamVsTeamServiceImpl implements ICompetitionTeamVsTeamS
competitionResultService.edit(competitionResult);
}
}
//todo 更新赛程数据的比分
CompetitionTeamVsTeam teamVs = new CompetitionTeamVsTeam();
teamVs.setId(teamVsTeam.getId());
teamVs.setMainTeamScore(mainTeamScore);
teamVs.setGuestTeamScore(guestTeamScore);
teamVs.setLastUpdatedTime(new Date());
competitionTeamVsTeamMapper.updateCompetitionTeamVsTeam(teamVs);
return true;
}

@ -46,10 +46,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="auditStatus" column="audit_status" />
<result property="heightHide" column="height_hide" />
<result property="sponsor" column="sponsor" />
<result property="orderId" column="order_id"/>
</resultMap>
<sql id="selectCompetitionVo">
select id, main_team_id, main_team_name, guest_team_id, guest_team_name, competition_code, competition_name, designated, competition_type, competition_time, building_id, building_name, competition_address, founder, status, city_code, city_name, max_player, created_time, last_updated_time, created_by, modified_by, is_deleted, longitude, latitude, remark, competition_nature, enroll_begin_time, enroll_end_time, contacts, contacts_area_code, contacts_tel, competition_begin_time, competition_end_time, organizer, undertake, competition_back_img, created_id, audit_status, height_hide, sponsor from competition
select id, main_team_id, main_team_name,order_id, guest_team_id, guest_team_name, competition_code, competition_name, designated, competition_type, competition_time, building_id, building_name, competition_address, founder, status, city_code, city_name, max_player, created_time, last_updated_time, created_by, modified_by, is_deleted, longitude, latitude, remark, competition_nature, enroll_begin_time, enroll_end_time, contacts, contacts_area_code, contacts_tel, competition_begin_time, competition_end_time, organizer, undertake, competition_back_img, created_id, audit_status, height_hide, sponsor from competition
</sql>
<select id="selectCompetitionList" parameterType="Competition" resultMap="CompetitionResult">
@ -308,6 +309,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="auditStatus != null">audit_status,</if>
<if test="heightHide != null">height_hide,</if>
<if test="sponsor != null">sponsor,</if>
<if test="orderId != null">order_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mainTeamId != null">#{mainTeamId},</if>
@ -350,6 +352,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="auditStatus != null">#{auditStatus},</if>
<if test="heightHide != null">#{heightHide},</if>
<if test="sponsor != null">#{sponsor},</if>
<if test="orderId != null">#{orderId},</if>
</trim>
</insert>
@ -396,6 +399,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="heightHide != null">height_hide = #{heightHide},</if>
<if test="sponsor != null">sponsor = #{sponsor},</if>
<if test="orderId != null">order_id = #{orderId},</if>
</trim>
where id = #{id}
</update>

Loading…
Cancel
Save