Browse Source

0818_2.0

master
zy_Java 5 years ago
parent
commit
459e245178
  1. 12
      game/src/main/java/com/ccsens/game/bean/po/GameRecord.java
  2. 48
      game/src/main/java/com/ccsens/game/bean/po/GameRecordExample.java
  3. 22
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  4. 29
      game/src/main/resources/mapper_raw/GameRecordMapper.xml
  5. 2
      game/src/main/resources/mbg.xml

12
game/src/main/java/com/ccsens/game/bean/po/GameRecord.java

@ -28,7 +28,7 @@ public class GameRecord implements Serializable {
private Byte recStatus;
private Byte group;
private Byte gameGroup;
private Integer duration;
@ -134,12 +134,12 @@ public class GameRecord implements Serializable {
this.recStatus = recStatus;
}
public Byte getGroup() {
return group;
public Byte getGameGroup() {
return gameGroup;
}
public void setGroup(Byte group) {
this.group = group;
public void setGameGroup(Byte gameGroup) {
this.gameGroup = gameGroup;
}
public Integer getDuration() {
@ -184,7 +184,7 @@ public class GameRecord implements Serializable {
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", group=").append(group);
sb.append(", gameGroup=").append(gameGroup);
sb.append(", duration=").append(duration);
sb.append(", memberLimit=").append(memberLimit);
sb.append(", rankRule=").append(rankRule);

48
game/src/main/java/com/ccsens/game/bean/po/GameRecordExample.java

@ -845,63 +845,63 @@ public class GameRecordExample {
return (Criteria) this;
}
public Criteria andGroupIsNull() {
addCriterion("group is null");
public Criteria andGameGroupIsNull() {
addCriterion("game_group is null");
return (Criteria) this;
}
public Criteria andGroupIsNotNull() {
addCriterion("group is not null");
public Criteria andGameGroupIsNotNull() {
addCriterion("game_group is not null");
return (Criteria) this;
}
public Criteria andGroupEqualTo(Byte value) {
addCriterion("group =", value, "group");
public Criteria andGameGroupEqualTo(Byte value) {
addCriterion("game_group =", value, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupNotEqualTo(Byte value) {
addCriterion("group <>", value, "group");
public Criteria andGameGroupNotEqualTo(Byte value) {
addCriterion("game_group <>", value, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupGreaterThan(Byte value) {
addCriterion("group >", value, "group");
public Criteria andGameGroupGreaterThan(Byte value) {
addCriterion("game_group >", value, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupGreaterThanOrEqualTo(Byte value) {
addCriterion("group >=", value, "group");
public Criteria andGameGroupGreaterThanOrEqualTo(Byte value) {
addCriterion("game_group >=", value, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupLessThan(Byte value) {
addCriterion("group <", value, "group");
public Criteria andGameGroupLessThan(Byte value) {
addCriterion("game_group <", value, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupLessThanOrEqualTo(Byte value) {
addCriterion("group <=", value, "group");
public Criteria andGameGroupLessThanOrEqualTo(Byte value) {
addCriterion("game_group <=", value, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupIn(List<Byte> values) {
addCriterion("group in", values, "group");
public Criteria andGameGroupIn(List<Byte> values) {
addCriterion("game_group in", values, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupNotIn(List<Byte> values) {
addCriterion("group not in", values, "group");
public Criteria andGameGroupNotIn(List<Byte> values) {
addCriterion("game_group not in", values, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupBetween(Byte value1, Byte value2) {
addCriterion("group between", value1, value2, "group");
public Criteria andGameGroupBetween(Byte value1, Byte value2) {
addCriterion("game_group between", value1, value2, "gameGroup");
return (Criteria) this;
}
public Criteria andGroupNotBetween(Byte value1, Byte value2) {
addCriterion("group not between", value1, value2, "group");
public Criteria andGameGroupNotBetween(Byte value1, Byte value2) {
addCriterion("game_group not between", value1, value2, "gameGroup");
return (Criteria) this;
}

22
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -1,5 +1,6 @@
package com.ccsens.game.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Snowflake;
@ -83,8 +84,10 @@ public class ScreenService implements IScreenService {
*/
@Override
public ScreenVo.UrlVo getScreenUrl(QueryDto<ScreenDto.MemberGame> params) throws Exception {
log.info("创建游戏:{}",params);
ScreenDto.MemberGame memberGame = params.getParam();
Long userId = params.getUserId();
//查找游戏
GameTypeExample gameTypeExample = new GameTypeExample();
gameTypeExample.createCriteria().andCodeEqualTo(memberGame.getGameType());
@ -193,7 +196,7 @@ public class ScreenService implements IScreenService {
if(ObjectUtil.isNotNull(gamePatternRow)){
String gamePattern = ExcelUtil.getCellValue(gamePatternRow.getCell(1));
if(gamePattern.equalsIgnoreCase(GameConstant.GAME_GROUP)){
gameRecord.setGroup((byte) 1);
gameRecord.setGameGroup((byte) 1);
}
}
//比赛时长
@ -217,7 +220,7 @@ public class ScreenService implements IScreenService {
}
}
//添加分组信息
if(gameRecord.getGroup() == 1){
if(gameRecord.getGameGroup() == 1){
for (int i = 8; i < sheet.getLastRowNum(); i++){
XSSFRow groupRow = sheet.getRow(1);
if(ObjectUtil.isNotNull(groupRow)){
@ -794,6 +797,7 @@ public class ScreenService implements IScreenService {
GameRecord gameRecordNew;
//添加一场新的游戏记录
gameRecordNew = new GameRecord();
BeanUtil.copyProperties(gameRecord,gameRecordNew);
gameRecordNew.setId(snowflake.nextId());
gameRecordNew.setUserPayId(gameUserPay.getId());
//添加路径
@ -810,6 +814,20 @@ public class ScreenService implements IScreenService {
//修改购买的游戏的使用次数
gameUserPay.setUsedCount(gameUserPay.getUsedCount() + 1);
gameUserPayDao.updateByPrimaryKeySelective(gameUserPay);
if(gameRecord.getGameGroup() == 1){
//复制分组信息
GameGroupExample gameGroupExample = new GameGroupExample();
gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecord.getId());
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample);
if(CollectionUtil.isNotEmpty(gameGroupList)){
gameGroupList.forEach(gameGroup -> {
GameGroup gameGroupNew = new GameGroup();
BeanUtil.copyProperties(gameGroup,gameGroupNew);
gameGroupNew.setId(snowflake.nextId());
gameGroupDao.insertSelective(gameGroupNew);
});
}
}
//路径(添加项目id)
String url = gameRecord.getUrl() + "&projectId=" + memberRecord.getProjectId();

29
game/src/main/resources/mapper_raw/GameRecordMapper.xml

@ -14,7 +14,7 @@
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="group" jdbcType="TINYINT" property="group" />
<result column="game_group" jdbcType="TINYINT" property="gameGroup" />
<result column="duration" jdbcType="INTEGER" property="duration" />
<result column="member_limit" jdbcType="INTEGER" property="memberLimit" />
<result column="rank_rule" jdbcType="TINYINT" property="rankRule" />
@ -79,7 +79,8 @@
</sql>
<sql id="Base_Column_List">
id, user_pay_id, task_id, url, QR_code_url, time_difference, start_time, end_time,
game_status, created_at, updated_at, rec_status, group, duration, member_limit, rank_rule
game_status, created_at, updated_at, rec_status, game_group, duration, member_limit,
rank_rule
</sql>
<select id="selectByExample" parameterType="com.ccsens.game.bean.po.GameRecordExample" resultMap="BaseResultMap">
select
@ -116,13 +117,13 @@
url, QR_code_url, time_difference,
start_time, end_time, game_status,
created_at, updated_at, rec_status,
group, duration, member_limit,
game_group, duration, member_limit,
rank_rule)
values (#{id,jdbcType=BIGINT}, #{userPayId,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT},
#{url,jdbcType=VARCHAR}, #{qrCodeUrl,jdbcType=VARCHAR}, #{timeDifference,jdbcType=INTEGER},
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{gameStatus,jdbcType=TINYINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT},
#{group,jdbcType=TINYINT}, #{duration,jdbcType=INTEGER}, #{memberLimit,jdbcType=INTEGER},
#{gameGroup,jdbcType=TINYINT}, #{duration,jdbcType=INTEGER}, #{memberLimit,jdbcType=INTEGER},
#{rankRule,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.game.bean.po.GameRecord">
@ -164,8 +165,8 @@
<if test="recStatus != null">
rec_status,
</if>
<if test="group != null">
group,
<if test="gameGroup != null">
game_group,
</if>
<if test="duration != null">
duration,
@ -214,8 +215,8 @@
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="group != null">
#{group,jdbcType=TINYINT},
<if test="gameGroup != null">
#{gameGroup,jdbcType=TINYINT},
</if>
<if test="duration != null">
#{duration,jdbcType=INTEGER},
@ -273,8 +274,8 @@
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
<if test="record.group != null">
group = #{record.group,jdbcType=TINYINT},
<if test="record.gameGroup != null">
game_group = #{record.gameGroup,jdbcType=TINYINT},
</if>
<if test="record.duration != null">
duration = #{record.duration,jdbcType=INTEGER},
@ -304,7 +305,7 @@
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT},
group = #{record.group,jdbcType=TINYINT},
game_group = #{record.gameGroup,jdbcType=TINYINT},
duration = #{record.duration,jdbcType=INTEGER},
member_limit = #{record.memberLimit,jdbcType=INTEGER},
rank_rule = #{record.rankRule,jdbcType=TINYINT}
@ -348,8 +349,8 @@
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
<if test="group != null">
group = #{group,jdbcType=TINYINT},
<if test="gameGroup != null">
game_group = #{gameGroup,jdbcType=TINYINT},
</if>
<if test="duration != null">
duration = #{duration,jdbcType=INTEGER},
@ -376,7 +377,7 @@
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT},
group = #{group,jdbcType=TINYINT},
game_group = #{gameGroup,jdbcType=TINYINT},
duration = #{duration,jdbcType=INTEGER},
member_limit = #{memberLimit,jdbcType=INTEGER},
rank_rule = #{rankRule,jdbcType=TINYINT}

2
game/src/main/resources/mbg.xml

@ -57,7 +57,7 @@
</javaClientGenerator>
<!-- <table tableName="t_game_type" domainObjectName="GameType"></table>-->
<!--<table tableName="t_game_user_pay" domainObjectName="GameUserPay"></table>-->
<!-- <table tableName="t_game_record" domainObjectName="GameRecord"></table>-->
<table tableName="t_game_record" domainObjectName="GameRecord"></table>
<!-- <table tableName="t_game_user_join" domainObjectName="GameUserJoin"></table>-->
<!--<table tableName="t_game_score_log" domainObjectName="GameScoreLog"></table>-->
<!--<table tableName="t_game_activity_rule" domainObjectName="GameActivityRule"></table>-->

Loading…
Cancel
Save