Browse Source

添加游戏分组code

master
zhangye 6 years ago
parent
commit
8e1c82026d
  1. 13
      cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java
  2. 4
      game/src/main/java/com/ccsens/game/bean/dto/ClientDto.java
  3. 1
      game/src/main/java/com/ccsens/game/bean/dto/message/ChangeStatusMessageDto.java
  4. 11
      game/src/main/java/com/ccsens/game/bean/po/GameGroup.java
  5. 70
      game/src/main/java/com/ccsens/game/bean/po/GameGroupExample.java
  6. 12
      game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java
  7. 15
      game/src/main/java/com/ccsens/game/service/ClientService.java
  8. 93
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  9. 11
      game/src/main/java/com/ccsens/game/util/GameConstant.java
  10. 31
      game/src/main/java/com/ccsens/game/util/SendMsg.java
  11. 29
      game/src/main/resources/mapper_raw/GameGroupMapper.xml
  12. 4
      game/src/main/resources/mbg.xml
  13. 11
      mt/src/main/java/com/ccsens/mt/bean/po/MtSigninBasic.java
  14. 60
      mt/src/main/java/com/ccsens/mt/bean/po/MtSigninBasicExample.java
  15. 7
      mt/src/main/java/com/ccsens/mt/service/SigninService.java
  16. 4
      mt/src/main/resources/application.yml
  17. 31
      mt/src/main/resources/mapper_raw/MtSigninBasicMapper.xml
  18. 1
      tall/src/main/java/com/ccsens/tall/config/SpringConfig.java
  19. 2
      tall/src/main/java/com/ccsens/tall/service/ISysPluginService.java
  20. 11
      tall/src/main/java/com/ccsens/tall/service/SysPluginService.java
  21. 12
      tall/src/main/java/com/ccsens/tall/web/PluginController.java
  22. 4
      util/src/main/java/com/ccsens/util/WebConstant.java

13
cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java

@ -85,7 +85,7 @@ public interface TallFeignClient {
JsonResponse log(LogDto logDto);
/**
* 通过任务id获得项目id
* 通过任务id获得任务信息
*
* @param taskId
* @return
@ -140,6 +140,12 @@ public interface TallFeignClient {
@GetMapping("/plugins/fuzzy")
List<String> getSignFuzzy(@RequestParam(name = "taskPluginId") Long taskPluginId, @RequestParam(name = "signinName") String signinName, @RequestParam(name = "key") String key);
/**
* 通过插件id获取签到字段和详细信息
*/
@GetMapping("/plugins/task")
Long getTaskIdByTaskPluginId(@RequestParam(name = "taskPluginId") Long taskPluginId);
}
@Slf4j
@ -217,6 +223,11 @@ class TallFeignClientFallBack implements FallbackFactory<TallFeignClient> {
public List<String> getSignFuzzy(Long taskPluginId, String signinName, String key) {
return null;
}
@Override
public Long getTaskIdByTaskPluginId(Long taskPluginId) {
return null;
}
};
}

4
game/src/main/java/com/ccsens/game/bean/dto/ClientDto.java

@ -43,8 +43,9 @@ public class ClientDto {
private Integer timeDifference;
private Long localStartTime;
private Long localEndTime;
private Long groupId;
public static RedisUser getInstance(GameUserJoin userJoin){
public static RedisUser getInstance(GameUserJoin userJoin,Long groupId){
ClientDto.RedisUser user = new ClientDto.RedisUser();
user.setId(userJoin.getId());
user.setAvatarUrl(userJoin.getAvatarUrl());
@ -53,6 +54,7 @@ public class ClientDto {
user.setTimeDifference(userJoin.getTimeDifference());
user.setLocalStartTime(userJoin.getLocalStartTime());
user.setLocalEndTime(userJoin.getLocalEndTime());
user.setGroupId(groupId);
return user;
}
}

1
game/src/main/java/com/ccsens/game/bean/dto/message/ChangeStatusMessageDto.java

@ -43,4 +43,5 @@ public class ChangeStatusMessageDto {
@ApiModelProperty("超过百分之多少人")
private Integer over;
}
}

11
game/src/main/java/com/ccsens/game/bean/po/GameGroup.java

@ -8,6 +8,8 @@ public class GameGroup implements Serializable {
private Long recordId;
private String code;
private String name;
private Date createdAt;
@ -34,6 +36,14 @@ public class GameGroup implements Serializable {
this.recordId = recordId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
public String getName() {
return name;
}
@ -74,6 +84,7 @@ public class GameGroup implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", recordId=").append(recordId);
sb.append(", code=").append(code);
sb.append(", name=").append(name);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);

70
game/src/main/java/com/ccsens/game/bean/po/GameGroupExample.java

@ -225,6 +225,76 @@ public class GameGroupExample {
return (Criteria) this;
}
public Criteria andCodeIsNull() {
addCriterion("code is null");
return (Criteria) this;
}
public Criteria andCodeIsNotNull() {
addCriterion("code is not null");
return (Criteria) this;
}
public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotEqualTo(String value) {
addCriterion("code <>", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThan(String value) {
addCriterion("code >", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code >=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThan(String value) {
addCriterion("code <", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code <=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLike(String value) {
addCriterion("code like", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotLike(String value) {
addCriterion("code not like", value, "code");
return (Criteria) this;
}
public Criteria andCodeIn(List<String> values) {
addCriterion("code in", values, "code");
return (Criteria) this;
}
public Criteria andCodeNotIn(List<String> values) {
addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;

12
game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java

@ -35,7 +35,7 @@ public class ScreenVo {
@ApiModelProperty("总人数")
private int totalMembers ;
@ApiModelProperty("分组信息")
private List<Group> groups ;
private List<GroupVo> groups ;
@ApiModelProperty("未开始")
private PendingData pendingData;
@ -55,6 +55,8 @@ public class ScreenVo {
private Long groupId ;
@ApiModelProperty("分组名称")
private String groupName ;
@ApiModelProperty("该组参赛总人数")
private int totalGroupMembers ;
}
@ -99,12 +101,14 @@ public class ScreenVo {
}
@Data
@ApiModel("进行中")
@ApiModel("游戏状态")
public static class GameStatusVo{
@ApiModelProperty("游戏状态 0未开始 1准备中 2进行中 3已结束")
private Byte gameStatus;
@ApiModelProperty("总人数")
private int totalMembers ;
@ApiModelProperty("分组信息")
private List<GroupVo> groups ;
@ApiModelProperty("未开始")
private PendingData pendingData;
@ -152,10 +156,12 @@ public class ScreenVo {
private int score;
@ApiModelProperty("该组总人数")
private int totalMembers;
@ApiModelProperty("该组总人数")
private String code;
}
@Data
@ApiModel("分组的信息")
@ApiModel
public static class RecordInfo{
@ApiModelProperty("游戏记录id")
private Long id;

15
game/src/main/java/com/ccsens/game/service/ClientService.java

@ -156,7 +156,7 @@ public class ClientService implements IClientService {
}
// 3.更新redis(sort set key:分数 value:头像,姓名)
if (prepare || processing) {
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin);
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin, join.getGroupId());
redisUtil.zsSet(GameConstant.generateGameKey(gameRecord.getId()), JSON.toJSONString(user), 0, GameConstant.REDIS_TIME);
}
@ -415,7 +415,8 @@ public class ClientService implements IClientService {
log.info("返回耗时:{},循环耗时:{}", t - a7, t - t5);
return gameMessageCountOut;
}
};
}
;
long t = System.currentTimeMillis();
log.info("总耗时:{}", t - t1);
@ -440,4 +441,14 @@ public class ClientService implements IClientService {
// }
return gameMessageCountOut;
}
/**
* 查询游戏是否是分组游戏
*/
public List<GameGroup> isGroupGame(Long recordId) {
GameGroupExample gameGroupExample = new GameGroupExample();
gameGroupExample.createCriteria().andRecordIdEqualTo(recordId);
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample);
return gameGroupList;
}
}

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

@ -42,6 +42,8 @@ import java.util.concurrent.*;
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ScreenService implements IScreenService {
@Autowired
private ClientService clientService;
@Autowired
private GameUserPayDao gameUserPayDao;
@Autowired
@ -74,6 +76,7 @@ public class ScreenService implements IScreenService{
/**
* 传入用户信息返回游戏大屏路径
*
* @return
*/
@Override
@ -127,8 +130,16 @@ public class ScreenService implements IScreenService{
gameRecord.setId(snowflake.nextId());
gameRecord.setUserPayId(gameUserPay.getId());
gameRecord.setTaskId(memberGame.getTaskId());
gameRecord.setUrl(WebConstant.TEST_URL_GAME + gameType.getScreenUrl() + "?id="+gameRecord.getId());
gameRecord.setQrCodeUrl(WebConstant.TEST_URL_GAME + gameRecord.getId() + File.separator + gameType.getClientUrl());
//添加路径
String gameUrl = WebConstant.TEST_URL_GAME_SQ;
switch (gameType.getCode()){
case GameConstant.GAME_TYPE_SQ: break;
case GameConstant.GAME_TYPE_SP: gameUrl = WebConstant.TEST_URL_GAME_SP; break;
case GameConstant.GAME_TYPE_BH: gameUrl = WebConstant.TEST_URL_GAME_BH; break;
default:break;
}
gameRecord.setUrl(gameUrl + gameType.getScreenUrl() + "?id=" + gameRecord.getId());
gameRecord.setQrCodeUrl(gameUrl + gameRecord.getId() + File.separator + gameType.getClientUrl());
gameRecordDao.insertSelective(gameRecord);
//4、 判断是否有分组,如果是分组游戏,添加两条分组信息
if (gameType.getIsGroup() == 1) {
@ -136,11 +147,13 @@ public class ScreenService implements IScreenService{
gameGroupRed.setId(snowflake.nextId());
gameGroupRed.setRecordId(gameRecord.getId());
gameGroupRed.setName(memberGame.getFirstTeam());
gameGroupRed.setCode(GameConstant.FIRST_GROUP);
gameGroupDao.insertSelective(gameGroupRed);
GameGroup gameGroupBlue = new GameGroup();
gameGroupBlue.setId(snowflake.nextId());
gameGroupBlue.setRecordId(gameRecord.getId());
gameGroupBlue.setName(memberGame.getSecondTeam());
gameGroupBlue.setCode(GameConstant.SECOND_GROUP);
gameGroupDao.insertSelective(gameGroupBlue);
}
@ -175,6 +188,7 @@ public class ScreenService implements IScreenService{
/**
* 获取游戏基本信息
*
* @return
*/
@Override
@ -204,22 +218,9 @@ public class ScreenService implements IScreenService{
}
//总人数
gameInfoVo.setTotalMembers(totalUsers == null ? 0 : totalUsers.intValue());
//获取分组信息
GameGroupExample gameGroupExample = new GameGroupExample();
gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecord.getId());
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample);
if(CollectionUtil.isNotEmpty(gameGroupList)){
List<ScreenVo.Group> groups = new ArrayList<>();
for(GameGroup gameGroup:gameGroupList){
ScreenVo.Group group = new ScreenVo.Group();
group.setGroupId(gameGroup.getId());
group.setGroupName(gameGroup.getName());
groups.add(group);
}
gameInfoVo.setGroups(groups);
}
//获取分组的信息
List<ScreenVo.GroupVo> groupVo = getGroupScore(gameRecord.getId());
gameInfoVo.setGroups(groupVo);
switch (gameInfoVo.getGameStatus()) {
case 0:
ScreenVo.PendingData pendingData = new ScreenVo.PendingData();
@ -268,7 +269,6 @@ public class ScreenService implements IScreenService{
}
/**
* 获取游戏状态
*/
@ -284,8 +284,9 @@ public class ScreenService implements IScreenService{
GameType gameType = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId());
gameStatusVo.setGameStatus(gameRecord.getGameStatus());
//获取分组的信息
List<ScreenVo.GroupVo> groupVo = getGroupScore(gameRecord.getId());
gameStatusVo.setGroups(groupVo);
// 查询总人数
Long total = redisUtil.zsGetSize(GameConstant.generateGameKey(gameRecord.getId()));
log.info("redis查询gameRecordID:{}总人数:{}", gameRecord.getId(), total);
@ -296,10 +297,11 @@ public class ScreenService implements IScreenService{
}
gameStatusVo.setTotalMembers(total == null ? 0 : total.intValue());
switch (gameStatusVo.getGameStatus()) {
case 0:
case GameConstant.GAME_PENDING:
break;
case 1:
case GameConstant.GAME_PREPARATION:
ScreenVo.PreparingData preparingData = new ScreenVo.PreparingData();
if (ObjectUtil.isNull(params.getUserId())) {
// 无userId,默认大屏,获取大屏的游戏开始时间
@ -311,7 +313,7 @@ public class ScreenService implements IScreenService{
}
gameStatusVo.setPreparingData(preparingData);
break;
case 2:
case GameConstant.GAME_PROCESSING:
//查询游戏是否有分组
if (gameType.getIsGroup() == 0) {
//普通游戏返回前十名的信息
@ -326,7 +328,7 @@ public class ScreenService implements IScreenService{
gameStatusVo.setProcessingData(groupVoList);
}
break;
case 3:
case GameConstant.GAME_COMPLETED:
ScreenVo.CompletedData completedData = null;
if (gameType.getIsGroup() == 0) {
completedData = getCompletedData(memberRecord.getMemberRecord());
@ -355,6 +357,7 @@ public class ScreenService implements IScreenService{
ScreenVo.GroupVo groupVo = new ScreenVo.GroupVo();
groupVo.setGroupId(gameGroup.getId());
groupVo.setGroupName(gameGroup.getName());
groupVo.setCode(gameGroup.getCode());
Map<String, Object> group = getGroupTotalScore(gameGroup.getId());
if (CollectionUtil.isNotEmpty(group)) {
@ -400,6 +403,7 @@ public class ScreenService implements IScreenService{
}
return completedData;
}
/**
* 获取队伍的总分
*/
@ -428,6 +432,7 @@ public class ScreenService implements IScreenService{
/**
* 查询总分数总次数平均以及前十名
*
* @param gameRecordId
* @return
*/
@ -471,6 +476,7 @@ public class ScreenService implements IScreenService{
/**
* 查询参加游戏的用户信息
*
* @param userId
* @param gameRecordId
* @return
@ -488,6 +494,7 @@ public class ScreenService implements IScreenService{
/**
* 查询游戏信息
*
* @param gameRecordId
* @return
*/
@ -508,6 +515,7 @@ public class ScreenService implements IScreenService{
/**
* 查询前十名
*
* @param gameRecordId
* @return
*/
@ -563,8 +571,16 @@ public class ScreenService implements IScreenService{
gameRecordNew = new GameRecord();
gameRecordNew.setId(snowflake.nextId());
gameRecordNew.setUserPayId(gameUserPay.getId());
gameRecordNew.setUrl(WebConstant.TEST_URL_GAME + gameType.getScreenUrl() + "?id="+gameRecordNew.getId());
gameRecordNew.setQrCodeUrl(WebConstant.TEST_URL_GAME + gameRecordNew.getId() + File.separator + gameType.getClientUrl());
//添加路径
String gameUrl = WebConstant.TEST_URL_GAME_SQ;
switch (gameType.getCode()){
case GameConstant.GAME_TYPE_SQ: break;
case GameConstant.GAME_TYPE_SP: gameUrl = WebConstant.TEST_URL_GAME_SP ; break;
case GameConstant.GAME_TYPE_BH: gameUrl = WebConstant.TEST_URL_GAME_BH; break;
default:break;
}
gameRecordNew.setUrl(gameUrl + gameType.getScreenUrl() + "?id=" + gameRecordNew.getId());
gameRecordNew.setQrCodeUrl(gameUrl+ gameRecordNew.getId() + File.separator + gameType.getClientUrl());
gameRecordDao.insertSelective(gameRecordNew);
//修改购买的游戏的使用次数
gameUserPay.setUsedCount(gameUserPay.getUsedCount() + 1);
@ -613,6 +629,7 @@ public class ScreenService implements IScreenService{
}
return ruleList;
}
/**
* 查询活动奖品
*/
@ -632,6 +649,7 @@ public class ScreenService implements IScreenService{
}
return prizeList;
}
/**
* 奖券使用说明表
*/
@ -683,11 +701,9 @@ public class ScreenService implements IScreenService{
}
/**
* 开始游戏
*
* @param start
* @return
*/
@ -704,8 +720,10 @@ public class ScreenService implements IScreenService{
}
//判断游戏状态,仅未开始允许操作开始
switch (gameRecord.getGameStatus().byteValue()) {
case GameConstant.GAME_PREPARATION: throw new BaseException(CodeEnum.GAME_PREPARATION);
case GameConstant.GAME_PROCESSING: throw new BaseException(CodeEnum.GAME_PROCESSING);
case GameConstant.GAME_PREPARATION:
throw new BaseException(CodeEnum.GAME_PREPARATION);
case GameConstant.GAME_PROCESSING:
throw new BaseException(CodeEnum.GAME_PROCESSING);
case GameConstant.GAME_COMPLETED:
if (start.getStartStatus() == null || start.getStartStatus().byteValue() != GameConstant.GAME_RESTART_STATUS) {
throw new BaseException(CodeEnum.GAME_COMPLETED);
@ -779,7 +797,14 @@ public class ScreenService implements IScreenService{
if (CollectionUtil.isNotEmpty(userJoins)) {
userJoins.forEach(userJoin -> {
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin);
Long groupId = null;
GameUserJoinGroupExample joinGroupExample = new GameUserJoinGroupExample();
joinGroupExample.createCriteria().andUserJoinIdEqualTo(userJoin.getId());
List<GameUserJoinGroup> gameUserJoinGroups = gameUserJoinGroupDao.selectByExample(joinGroupExample);
if (CollectionUtil.isNotEmpty(gameUserJoinGroups)) {
groupId = gameUserJoinGroups.get(0).getGameGroupId();
}
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin, groupId);
redisUtil.zsSet(GameConstant.generateGameKey(gameRecord.getId()), JSON.toJSONString(user), 0, GameConstant.REDIS_TIME);
});
}
@ -791,9 +816,9 @@ public class ScreenService implements IScreenService{
}
/**
* 推送客户端状态
*
* @param gameRecord
* @param executor
*/

11
game/src/main/java/com/ccsens/game/util/GameConstant.java

@ -6,6 +6,17 @@ package com.ccsens.game.util;
* @create: 2019/12/26 17:32
*/
public class GameConstant {
/**游戏类型:数钱*/
public static final String GAME_TYPE_SQ = "SQ";
/**游戏类型:赛跑*/
public static final String GAME_TYPE_SP = "SP";
/**游戏类型:拔河*/
public static final String GAME_TYPE_BH = "BH";
/**游戏类型:第一个队伍*/
public static final String FIRST_GROUP = "firstGroup";
/**游戏类型:第一个队伍*/
public static final String SECOND_GROUP = "secondGroup";
/**游戏状态:未开始*/
public static final byte GAME_PENDING = 0;

31
game/src/main/java/com/ccsens/game/util/SendMsg.java

@ -1,6 +1,7 @@
package com.ccsens.game.util;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.ccsens.game.bean.dto.ClientDto;
import com.ccsens.game.bean.dto.message.ChangeStatusMessageDto;
@ -10,10 +11,12 @@ import com.ccsens.game.bean.po.GameGroupExample;
import com.ccsens.game.bean.po.GameRecord;
import com.ccsens.game.persist.dao.GameGroupDao;
import com.ccsens.game.persist.dao.GameUserJoinDao;
import com.ccsens.game.service.ClientService;
import com.ccsens.util.JacksonUtil;
import com.ccsens.util.RedisUtil;
import com.ccsens.util.config.RabbitMQConfig;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@ -35,6 +38,8 @@ import java.util.concurrent.TimeUnit;
@Service
@Slf4j
public class SendMsg {
@Autowired
private ClientService clientService;
@Autowired
private GameUserJoinDao gameUserJoinDao;
@Autowired
@ -52,7 +57,7 @@ public class SendMsg {
return;
}
userJoins.forEach(join -> {
outs.add(getMsg(gameRecord, join, status));
outs.add(getMsg(userJoins, gameRecord, join, status));
});
if (CollectionUtil.isNotEmpty(outs)) {
rabbitTemplate.convertAndSend(RabbitMQConfig.GAME_STATUS, JacksonUtil.beanToJson(outs));
@ -61,7 +66,7 @@ public class SendMsg {
}
}
public GameMessageWithChangeStatusOut getMsg(GameRecord gameRecord, ClientDto.RedisUser join, byte gameStatus) {
public GameMessageWithChangeStatusOut getMsg(List<ClientDto.RedisUser> userJoins, GameRecord gameRecord, ClientDto.RedisUser join, byte gameStatus) {
GameMessageWithChangeStatusOut out = new GameMessageWithChangeStatusOut();
GameMessageWithChangeStatusOut.Data data = new GameMessageWithChangeStatusOut.Data();
@ -71,12 +76,32 @@ public class SendMsg {
ChangeStatusMessageDto dtos = new ChangeStatusMessageDto();
switch (gameStatus) {
case GameConstant.GAME_COMPLETED:
if (ObjectUtil.isNotNull(join.getGroupId())) {
Integer times = 0;
Integer score = 0;
Integer sort = 1;
for (ClientDto.RedisUser user : userJoins) {
if (user.getGroupId().longValue() == join.getGroupId().longValue()) {
times += user.getTimes();
score += user.getScore();
if(user.getScore() > join.getScore()){
sort++;
}
}
}
ChangeStatusMessageDto.CompletedData completedData = new ChangeStatusMessageDto.CompletedData();
completedData.setTimes(times);
completedData.setScore(score);
completedData.setSort(sort);
dtos.setCompletedData(completedData);
} else {
ChangeStatusMessageDto.CompletedData completedData = new ChangeStatusMessageDto.CompletedData();
completedData.setTimes(join.getTimes());
completedData.setScore(join.getScore());
completedData.setSort(join.getSort());
completedData.setOver(join.getOver());
dtos.setCompletedData(completedData);
}
break;
case GameConstant.GAME_PREPARATION:
//preparingData
@ -134,4 +159,6 @@ public class SendMsg {
}
return null;
}
}

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

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.ccsens.game.bean.po.GameGroup">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="record_id" jdbcType="BIGINT" property="recordId" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
@ -68,7 +69,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, record_id, name, created_at, updated_at, rec_status
id, record_id, code, name, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.game.bean.po.GameGroupExample" resultMap="BaseResultMap">
select
@ -101,12 +102,12 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.game.bean.po.GameGroup">
insert into t_game_group (id, record_id, name,
created_at, updated_at, rec_status
)
values (#{id,jdbcType=BIGINT}, #{recordId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
insert into t_game_group (id, record_id, code,
name, created_at, updated_at,
rec_status)
values (#{id,jdbcType=BIGINT}, #{recordId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.game.bean.po.GameGroup">
insert into t_game_group
@ -117,6 +118,9 @@
<if test="recordId != null">
record_id,
</if>
<if test="code != null">
code,
</if>
<if test="name != null">
name,
</if>
@ -137,6 +141,9 @@
<if test="recordId != null">
#{recordId,jdbcType=BIGINT},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
@ -166,6 +173,9 @@
<if test="record.recordId != null">
record_id = #{record.recordId,jdbcType=BIGINT},
</if>
<if test="record.code != null">
code = #{record.code,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
@ -187,6 +197,7 @@
update t_game_group
set id = #{record.id,jdbcType=BIGINT},
record_id = #{record.recordId,jdbcType=BIGINT},
code = #{record.code,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
@ -201,6 +212,9 @@
<if test="recordId != null">
record_id = #{recordId,jdbcType=BIGINT},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
@ -219,6 +233,7 @@
<update id="updateByPrimaryKey" parameterType="com.ccsens.game.bean.po.GameGroup">
update t_game_group
set record_id = #{recordId,jdbcType=BIGINT},
code = #{code,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},

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

@ -57,14 +57,14 @@
</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>-->
<!--<table tableName="t_game_activity_prize" domainObjectName="GameActivityPrize"></table>-->
<!--<table tableName="t_game_prize_instructions" domainObjectName="GamePrizeInstructions"></table>-->
<!-- <table tableName="t_game_user_join_group" domainObjectName="GameUserJoinGroup"></table>-->
<!-- <table tableName="t_game_group" domainObjectName="GameGroup"></table>-->
<table tableName="t_game_group" domainObjectName="GameGroup"></table>
<!-- 有些表的字段需要指定java类型

11
mt/src/main/java/com/ccsens/mt/bean/po/MtSigninBasic.java

@ -10,6 +10,8 @@ public class MtSigninBasic implements Serializable {
private Long taskPluginId;
private Long taskId;
private Long signinTime;
private Integer sequence;
@ -48,6 +50,14 @@ public class MtSigninBasic implements Serializable {
this.taskPluginId = taskPluginId;
}
public Long getTaskId() {
return taskId;
}
public void setTaskId(Long taskId) {
this.taskId = taskId;
}
public Long getSigninTime() {
return signinTime;
}
@ -105,6 +115,7 @@ public class MtSigninBasic implements Serializable {
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", taskPluginId=").append(taskPluginId);
sb.append(", taskId=").append(taskId);
sb.append(", signinTime=").append(signinTime);
sb.append(", sequence=").append(sequence);
sb.append(", isSign=").append(isSign);

60
mt/src/main/java/com/ccsens/mt/bean/po/MtSigninBasicExample.java

@ -285,6 +285,66 @@ public class MtSigninBasicExample {
return (Criteria) this;
}
public Criteria andTaskIdIsNull() {
addCriterion("task_id is null");
return (Criteria) this;
}
public Criteria andTaskIdIsNotNull() {
addCriterion("task_id is not null");
return (Criteria) this;
}
public Criteria andTaskIdEqualTo(Long value) {
addCriterion("task_id =", value, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdNotEqualTo(Long value) {
addCriterion("task_id <>", value, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdGreaterThan(Long value) {
addCriterion("task_id >", value, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdGreaterThanOrEqualTo(Long value) {
addCriterion("task_id >=", value, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdLessThan(Long value) {
addCriterion("task_id <", value, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdLessThanOrEqualTo(Long value) {
addCriterion("task_id <=", value, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdIn(List<Long> values) {
addCriterion("task_id in", values, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdNotIn(List<Long> values) {
addCriterion("task_id not in", values, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdBetween(Long value1, Long value2) {
addCriterion("task_id between", value1, value2, "taskId");
return (Criteria) this;
}
public Criteria andTaskIdNotBetween(Long value1, Long value2) {
addCriterion("task_id not between", value1, value2, "taskId");
return (Criteria) this;
}
public Criteria andSigninTimeIsNull() {
addCriterion("signin_time is null");
return (Criteria) this;

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

@ -202,10 +202,12 @@ public class SigninService implements ISigninService{
@Override
public List<SigninVo.GetSignInfoVo> getSignVoAllByTaskId(Long taskPluginId, Long userId) {
List<SigninVo.GetSignInfoVo> getSignInfoVoList = new ArrayList<>();
//根据pluginId查询任务id
Long taskId = tallFeignClient.getTaskIdByTaskPluginId(taskPluginId);
if(ObjectUtil.isNotNull(taskId)){
//1.查找所有签到的用户
MtSigninBasicExample signinBasicExample = new MtSigninBasicExample();
signinBasicExample.createCriteria().andTaskPluginIdEqualTo(taskPluginId);
signinBasicExample.createCriteria().andTaskIdEqualTo(taskId);
List<MtSigninBasic> signinBasicList = signinBasicDao.selectByExample(signinBasicExample);
if(CollectionUtil.isNotEmpty(signinBasicList)){
for(MtSigninBasic mtSigninBasic : signinBasicList){
@ -230,6 +232,7 @@ public class SigninService implements ISigninService{
getSignInfoVoList.add(signInfoVo);
}
}
}
return getSignInfoVoList;
}

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

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: common, util-test
active: dev
include: common, util-dev

31
mt/src/main/resources/mapper_raw/MtSigninBasicMapper.xml

@ -5,6 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="task_plugin_id" jdbcType="BIGINT" property="taskPluginId" />
<result column="task_id" jdbcType="BIGINT" property="taskId" />
<result column="signin_time" jdbcType="BIGINT" property="signinTime" />
<result column="sequence" jdbcType="INTEGER" property="sequence" />
<result column="is_sign" jdbcType="TINYINT" property="isSign" />
@ -71,8 +72,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, task_plugin_id, signin_time, sequence, is_sign, created_at, updated_at,
rec_status
id, user_id, task_plugin_id, task_id, signin_time, sequence, is_sign, created_at,
updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.mt.bean.po.MtSigninBasicExample" resultMap="BaseResultMap">
select
@ -106,13 +107,13 @@
</delete>
<insert id="insert" parameterType="com.ccsens.mt.bean.po.MtSigninBasic">
insert into t_mt_signin_basic (id, user_id, task_plugin_id,
signin_time, sequence, is_sign,
created_at, updated_at, rec_status
)
task_id, signin_time, sequence,
is_sign, created_at, updated_at,
rec_status)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{taskPluginId,jdbcType=BIGINT},
#{signinTime,jdbcType=BIGINT}, #{sequence,jdbcType=INTEGER}, #{isSign,jdbcType=TINYINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
#{taskId,jdbcType=BIGINT}, #{signinTime,jdbcType=BIGINT}, #{sequence,jdbcType=INTEGER},
#{isSign,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.mt.bean.po.MtSigninBasic">
insert into t_mt_signin_basic
@ -126,6 +127,9 @@
<if test="taskPluginId != null">
task_plugin_id,
</if>
<if test="taskId != null">
task_id,
</if>
<if test="signinTime != null">
signin_time,
</if>
@ -155,6 +159,9 @@
<if test="taskPluginId != null">
#{taskPluginId,jdbcType=BIGINT},
</if>
<if test="taskId != null">
#{taskId,jdbcType=BIGINT},
</if>
<if test="signinTime != null">
#{signinTime,jdbcType=BIGINT},
</if>
@ -193,6 +200,9 @@
<if test="record.taskPluginId != null">
task_plugin_id = #{record.taskPluginId,jdbcType=BIGINT},
</if>
<if test="record.taskId != null">
task_id = #{record.taskId,jdbcType=BIGINT},
</if>
<if test="record.signinTime != null">
signin_time = #{record.signinTime,jdbcType=BIGINT},
</if>
@ -221,6 +231,7 @@
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
task_plugin_id = #{record.taskPluginId,jdbcType=BIGINT},
task_id = #{record.taskId,jdbcType=BIGINT},
signin_time = #{record.signinTime,jdbcType=BIGINT},
sequence = #{record.sequence,jdbcType=INTEGER},
is_sign = #{record.isSign,jdbcType=TINYINT},
@ -240,6 +251,9 @@
<if test="taskPluginId != null">
task_plugin_id = #{taskPluginId,jdbcType=BIGINT},
</if>
<if test="taskId != null">
task_id = #{taskId,jdbcType=BIGINT},
</if>
<if test="signinTime != null">
signin_time = #{signinTime,jdbcType=BIGINT},
</if>
@ -265,6 +279,7 @@
update t_mt_signin_basic
set user_id = #{userId,jdbcType=BIGINT},
task_plugin_id = #{taskPluginId,jdbcType=BIGINT},
task_id = #{taskId,jdbcType=BIGINT},
signin_time = #{signinTime,jdbcType=BIGINT},
sequence = #{sequence,jdbcType=INTEGER},
is_sign = #{isSign,jdbcType=TINYINT},

1
tall/src/main/java/com/ccsens/tall/config/SpringConfig.java

@ -145,6 +145,7 @@ public class SpringConfig implements WebMvcConfigurer {
.addPathPatterns("/plugins/**")
.excludePathPatterns("/plugins/sign")
.excludePathPatterns("/plugins/fuzzy")
.excludePathPatterns("/plugins/task")
.addPathPatterns("/delivers/**")
.addPathPatterns("/tasks/**")
.excludePathPatterns("/tasks/projectId")

2
tall/src/main/java/com/ccsens/tall/service/ISysPluginService.java

@ -10,4 +10,6 @@ public interface ISysPluginService {
List<PluginVo.PluginSignField> getSignByPlugin(Long taskPluginId);
List<String> getSignFuzzy(Long taskPluginId, String signinName, String key);
Long getTaskDetailIdByPlugin(Long taskPluginId);
}

11
tall/src/main/java/com/ccsens/tall/service/SysPluginService.java

@ -105,4 +105,15 @@ public class SysPluginService implements ISysPluginService{
}
return keys;
}
@Override
public Long getTaskDetailIdByPlugin(Long taskPluginId) {
Long taskDetailId = null;
ProTaskPlugin taskPlugin = taskPluginDao.selectByPrimaryKey(taskPluginId);
if(ObjectUtil.isNotNull(taskPlugin)){
taskDetailId = taskPlugin.getTaskDetailId();
}
return taskDetailId;
}
}

12
tall/src/main/java/com/ccsens/tall/web/PluginController.java

@ -57,4 +57,16 @@ public class PluginController {
return keys;
}
/**
* 通过插件id查询签到的信息
*/
@RequestMapping(value = "/task", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public Long getTaskDetailIdByPlugin(Long taskPluginId) throws Exception {
Long taskDetailId = sysPluginService.getTaskDetailIdByPlugin(taskPluginId);
return taskDetailId;
}
}

4
util/src/main/java/com/ccsens/util/WebConstant.java

@ -74,7 +74,9 @@ public class WebConstant {
public static final String UPLOAD_PROJECT_WBS = UPLOAD_PATH_BASE + File.separator + "project";
public static final String URL_BASE = "https://api.ccsens.com/ptpro/uploads/";
public static final String TEST_URL = "https://test.tall.wiki/";
public static final String TEST_URL_GAME = TEST_URL + "game-dev/";
public static final String TEST_URL_GAME_SQ = TEST_URL + "game-dev/";
public static final String TEST_URL_GAME_SP = TEST_URL + "game-sp/";
public static final String TEST_URL_GAME_BH = TEST_URL + "game-bh/";
public static final String TEST_URL_BASE = TEST_URL + "gateway/tall/v1.0/uploads/";
public static final Integer Expired_Verify_Code_In_Seconds = 120;

Loading…
Cancel
Save