Browse Source

game查询游戏规则

master
zhangye 6 years ago
parent
commit
d198cf078e
  1. 2
      cloudutil/src/main/resources/application-util-dev.yml
  2. 43
      game/src/main/java/com/ccsens/game/api/ClientController.java
  3. 2
      game/src/main/java/com/ccsens/game/bean/dto/ScreenDto.java
  4. 16
      game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java
  5. 8
      game/src/main/java/com/ccsens/game/persist/dao/GameUserJoinGroupDao.java
  6. 10
      game/src/main/java/com/ccsens/game/service/IScreenService.java
  7. 186
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  8. 4
      game/src/main/resources/application.yml
  9. 2
      tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java
  10. 1
      tall/src/main/java/com/ccsens/tall/config/TokenInterceptor.java
  11. 9
      tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java
  12. 15
      tall/src/main/java/com/ccsens/tall/service/WbsSubSheetService.java
  13. 2
      tall/src/main/java/com/ccsens/tall/util/TaskUtil.java
  14. 4
      tall/src/main/resources/mapper_dao/TaskDetailDao.xml

2
cloudutil/src/main/resources/application-util-dev.yml

@ -20,7 +20,7 @@ eureka:
service-url: service-url:
# 指定eureka server通信地址,注意/eureka/小尾巴不能少 # 指定eureka server通信地址,注意/eureka/小尾巴不能少
#defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/ #defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/
defaultZone: http://admin:admin@49.233.89.188:7010/eureka/ defaultZone: http://admin:admin@127.0.0.1:7010/eureka/
instance: instance:
# 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server # 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server
prefer-ip-address: true prefer-ip-address: true

43
game/src/main/java/com/ccsens/game/api/ClientController.java

@ -5,6 +5,7 @@ import com.ccsens.game.bean.dto.ClientDto;
import com.ccsens.game.bean.dto.ScreenDto; import com.ccsens.game.bean.dto.ScreenDto;
import com.ccsens.game.bean.vo.ClientVo; import com.ccsens.game.bean.vo.ClientVo;
import com.ccsens.game.service.IClientService; import com.ccsens.game.service.IClientService;
import com.ccsens.game.service.IScreenService;
import com.ccsens.util.JsonResponse; import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.util.bean.dto.QueryDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -14,10 +15,10 @@ import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import java.util.List;
import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
@Api(tags = "客户端相关api" , description = "ClientController") @Api(tags = "客户端相关api" , description = "ClientController")
@RestController @RestController
@ -25,6 +26,8 @@ import org.springframework.web.bind.annotation.RestController;
public class ClientController { public class ClientController {
@Autowired @Autowired
private IClientService clientService; private IClientService clientService;
@Autowired
private IScreenService screenService;
@ApiOperation(value = "查看全部排行榜", notes = "") @ApiOperation(value = "查看全部排行榜", notes = "")
@ApiImplicitParams({ @ApiImplicitParams({
@ -46,4 +49,36 @@ public class ClientController {
ClientVo.Join join = clientService.join(params.getParam(), params.getUserId()); ClientVo.Join join = clientService.join(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok(join); return JsonResponse.newInstance().ok(join);
} }
@ApiOperation(value = "查询游戏规则", notes = "")
@ApiImplicitParams({
})
@RequestMapping(value = "activityRule", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<String>> getGameActivityRule(@ApiParam @RequestParam Long recordId) throws Exception {
log.info("获取游戏规则:{}",recordId);
List<String> gameActivityRule = screenService.getGameActivityRule(screenService.getGameTypeId(recordId));
return JsonResponse.newInstance().ok(gameActivityRule);
}
@ApiOperation(value = "查询游戏奖品", notes = "")
@ApiImplicitParams({
})
@RequestMapping(value = "activityPrize", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<String>> getGameActivityPrize(@ApiParam @RequestParam Long recordId) throws Exception {
log.info("获取游戏规则:{}",recordId);
List<String> gameActivityRule = screenService.getGameActivityPrize(screenService.getGameTypeId(recordId));
return JsonResponse.newInstance().ok(gameActivityRule);
}
@ApiOperation(value = "查询奖券使用说明", notes = "")
@ApiImplicitParams({
})
@RequestMapping(value = "prizeInstructions", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<String>> getGamePrizeInstructions(@ApiParam @RequestParam Long recordId) throws Exception {
log.info("获取游戏规则:{}",recordId);
List<String> gameActivityRule = screenService.getGamePrizeInstructions(screenService.getGameTypeId(recordId));
return JsonResponse.newInstance().ok(gameActivityRule);
}
} }

2
game/src/main/java/com/ccsens/game/bean/dto/ScreenDto.java

@ -52,4 +52,6 @@ public class ScreenDto {
@ApiModelProperty("本地时间") @ApiModelProperty("本地时间")
private Long localTime; private Long localTime;
} }
} }

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

@ -111,7 +111,7 @@ public class ScreenVo {
@ApiModelProperty("准备中") @ApiModelProperty("准备中")
private PreparingData preparingData; private PreparingData preparingData;
@ApiModelProperty("进行中") @ApiModelProperty("进行中")
private ProcessingData processingData; private Object processingData;
@ApiModelProperty("已结束") @ApiModelProperty("已结束")
private CompletedData completedData; private CompletedData completedData;
@ -138,4 +138,18 @@ public class ScreenVo {
@ApiModelProperty("本地开始时间") @ApiModelProperty("本地开始时间")
private Long startLocalTime; private Long startLocalTime;
} }
@Data
@ApiModel("分组的信息")
public static class GroupVo{
@ApiModelProperty("分组的id")
private Long groupId;
@ApiModelProperty("分组的名称")
private String groupName;
@ApiModelProperty("该组的总分")
private int score;
@ApiModelProperty("该组总人数")
private int totalMembers;
}
} }

8
game/src/main/java/com/ccsens/game/persist/dao/GameUserJoinGroupDao.java

@ -0,0 +1,8 @@
package com.ccsens.game.persist.dao;
import com.ccsens.game.persist.mapper.GameUserJoinGroupMapper;
import org.springframework.stereotype.Repository;
@Repository
public interface GameUserJoinGroupDao extends GameUserJoinGroupMapper {
}

10
game/src/main/java/com/ccsens/game/service/IScreenService.java

@ -5,6 +5,8 @@ import com.ccsens.game.bean.po.GameRecord;
import com.ccsens.game.bean.vo.ScreenVo; import com.ccsens.game.bean.vo.ScreenVo;
import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.util.bean.dto.QueryDto;
import java.util.List;
public interface IScreenService { public interface IScreenService {
ScreenVo.UrlVo getScreenUrl(QueryDto<ScreenDto.MemberGame> params) throws Exception; ScreenVo.UrlVo getScreenUrl(QueryDto<ScreenDto.MemberGame> params) throws Exception;
@ -27,4 +29,12 @@ public interface IScreenService {
* @return * @return
*/ */
GameRecord getGameRecord(long gameRecordId); GameRecord getGameRecord(long gameRecordId);
List<String> getGameActivityRule(Long gameTypeId);
List<String> getGameActivityPrize(Long gameTypeId);
List<String> getGamePrizeInstructions(Long gameTypeId);
Long getGameTypeId(Long recordId);
} }

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

@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.websocket.OnClose;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
@ -50,6 +51,8 @@ public class ScreenService implements IScreenService{
@Autowired @Autowired
private GameGroupDao gameGroupDao; private GameGroupDao gameGroupDao;
@Autowired @Autowired
private GameUserJoinGroupDao gameUserJoinGroupDao;
@Autowired
private GameActivityRuleDao activityRuleDao; private GameActivityRuleDao activityRuleDao;
@Autowired @Autowired
private GameActivityPrizeDao activityPrizeDao; private GameActivityPrizeDao activityPrizeDao;
@ -232,7 +235,14 @@ public class ScreenService implements IScreenService{
case 2: case 2:
break; break;
case 3: case 3:
ScreenVo.CompletedData completedData = getCompletedData(memberRecord.getMemberRecord()); //查询游戏是否有分组
GameType gameType = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId());
ScreenVo.CompletedData completedData = null;
if(gameType.getIsGroup() == 0) {
completedData = getCompletedData(memberRecord.getMemberRecord());
}else {
completedData = getCompletedDataByWin(memberRecord.getMemberRecord());
}
gameInfoVo.setCompletedData(completedData); gameInfoVo.setCompletedData(completedData);
break; break;
default: default:
@ -253,6 +263,9 @@ public class ScreenService implements IScreenService{
long gameRecordId = memberRecord.getMemberRecord(); long gameRecordId = memberRecord.getMemberRecord();
GameRecord gameRecord = getGameRecord(gameRecordId); GameRecord gameRecord = getGameRecord(gameRecordId);
//获取游戏的购买记录和类型
GameUserPay gameUserPay = gameUserPayDao.selectByPrimaryKey(gameRecord.getUserPayId());
GameType gameType = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId());
gameStatusVo.setGameStatus(gameRecord.getGameStatus()); gameStatusVo.setGameStatus(gameRecord.getGameStatus());
@ -283,14 +296,27 @@ public class ScreenService implements IScreenService{
gameStatusVo.setPreparingData(preparingData); gameStatusVo.setPreparingData(preparingData);
break; break;
case 2: case 2:
ScreenVo.ProcessingData processingData = new ScreenVo.ProcessingData(); //查询游戏是否有分组
// 查询前十名(列表顺序即前十名顺序) if(gameType.getIsGroup() == 0) {
List<ScreenVo.TopUsers> tops = getTopUsers(gameRecordId); //普通游戏返回前十名的信息
processingData.setTopMembers(tops); ScreenVo.ProcessingData processingData = new ScreenVo.ProcessingData();
gameStatusVo.setProcessingData(processingData); // 查询前十名(列表顺序即前十名顺序)
List<ScreenVo.TopUsers> tops = getTopUsers(gameRecordId);
processingData.setTopMembers(tops);
gameStatusVo.setProcessingData(processingData);
}else {
//分组游戏则返回每个分组的信息
List<ScreenVo.GroupVo> groupVoList = getGroupScore(gameRecordId);
gameStatusVo.setProcessingData(groupVoList);
}
break; break;
case 3: case 3:
ScreenVo.CompletedData completedData = getCompletedData(gameRecordId); ScreenVo.CompletedData completedData = null;
if(gameType.getIsGroup() == 0) {
completedData = getCompletedData(memberRecord.getMemberRecord());
}else {
completedData = getCompletedDataByWin(memberRecord.getMemberRecord());
}
gameStatusVo.setCompletedData(completedData); gameStatusVo.setCompletedData(completedData);
break; break;
default: default:
@ -299,11 +325,36 @@ public class ScreenService implements IScreenService{
return gameStatusVo; return gameStatusVo;
} }
/**
* 进行中查询每个组的信息
*/
private List<ScreenVo.GroupVo> getGroupScore(Long gameRecordId){
List<ScreenVo.GroupVo> groupVoList = new ArrayList<>();
//查询分组信息
GameGroupExample gameGroupExample = new GameGroupExample();
gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecordId);
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample);
if(CollectionUtil.isNotEmpty(gameGroupList)){
for(GameGroup gameGroup : gameGroupList){
Map<String,Object> group = getGroupTotalScore(gameGroup.getId());
List<GameUserJoin> userJoinList = (List<GameUserJoin>) group.get("userJoinList");
ScreenVo.GroupVo groupVo = new ScreenVo.GroupVo();
groupVo.setGroupId(gameGroup.getId());
groupVo.setGroupName(gameGroup.getName());
groupVo.setScore((Integer) group.get("totalScore"));
groupVo.setTotalMembers(userJoinList.size());
groupVoList.add(groupVo);
}
}
return groupVoList;
}
/** /**
* 结束时查询胜利组的信息总分数总次数平均以及前十名 * 结束时查询胜利组的信息总分数总次数平均以及前十名
*/ */
private ScreenVo.CompletedData getCompletedDataByWin(Long gameRecordId) { private ScreenVo.CompletedData getCompletedDataByWin(Long gameRecordId) {
//1、分别查询redis内每个队伍的总分, ScreenVo.CompletedData completedData = new ScreenVo.CompletedData();
//TODO 1、分别查询redis内每个队伍的总分,
//2、查询获胜队伍的信息 //2、查询获胜队伍的信息
//3、redis内没有则查询数据库 //3、redis内没有则查询数据库
@ -312,15 +363,50 @@ public class ScreenService implements IScreenService{
gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecordId); gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecordId);
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample); List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample);
if(CollectionUtil.isNotEmpty(gameGroupList)){ if(CollectionUtil.isNotEmpty(gameGroupList)){
List<GameUserJoin> userJoinList = null;
//分别查找两个队伍的总分 //分别查找两个队伍的总分
Map<String,Object> group1 = getGroupTotalScore(gameGroupList.get(0).getId());
Map<String,Object> group2 = getGroupTotalScore(gameGroupList.get(1).getId());
if(CollectionUtil.isNotEmpty(group1) && CollectionUtil.isNotEmpty(group2)){
int score1 = (int) group1.get("totalScore");
int score2 = (int) group1.get("totalScore");
if(score1 > score2){
userJoinList = (List<GameUserJoin>) group1.get("userJoinList");
}else {
userJoinList = (List<GameUserJoin>) group2.get("userJoinList");
}
}
//5、获取获胜队伍的信息
completedData = getCompletedData(userJoinList);
} }
return completedData;
//4、分别查询每个队伍的总分 }
//5、获取获胜队伍的信息 /**
return null; * 获取队伍的总分
*/
private Map<String,Object> getGroupTotalScore(Long groupId){
Map<String,Object> groupMap = null;
//查找队伍的参赛人
GameUserJoinGroupExample joinGroupExample = new GameUserJoinGroupExample();
joinGroupExample.createCriteria().andGameGroupIdEqualTo(groupId);
List<GameUserJoinGroup> userJoinGroupList = gameUserJoinGroupDao.selectByExample(joinGroupExample);
if(CollectionUtil.isNotEmpty(userJoinGroupList)){
groupMap = new HashMap<>();
int totalScore = 0;
List<GameUserJoin> userJoinList = new ArrayList<>();
for (GameUserJoinGroup userJoinGroup : userJoinGroupList){
GameUserJoin userJoin = gameUserJoinDao.selectByPrimaryKey(userJoinGroup.getUserJoinId());
totalScore += userJoin.getScore();
userJoinList.add(userJoin);
}
groupMap.put("totalScore",totalScore);
groupMap.put("userJoinList",userJoinList);
}
return groupMap;
} }
/** /**
* 查询总分数总次数平均以及前十名 * 查询总分数总次数平均以及前十名
* @param gameRecordId * @param gameRecordId
@ -492,14 +578,18 @@ public class ScreenService implements IScreenService{
/** /**
* 查找活动规则 * 查找活动规则
*/ */
private List<String> getGameActivityRule(Long gameTypeId){ @Override
public List<String> getGameActivityRule(Long gameTypeId){
List<String> ruleList = new ArrayList<>(); List<String> ruleList = new ArrayList<>();
GameActivityRuleExample activityRuleExample = new GameActivityRuleExample();
activityRuleExample.createCriteria().andGameIdEqualTo(gameTypeId); if(ObjectUtil.isNotNull(gameTypeId)) {
List<GameActivityRule> gameActivityRuleList = activityRuleDao.selectByExample(activityRuleExample); GameActivityRuleExample activityRuleExample = new GameActivityRuleExample();
if(CollectionUtil.isNotEmpty(gameActivityRuleList)){ activityRuleExample.createCriteria().andGameIdEqualTo(gameTypeId);
for(GameActivityRule rule : gameActivityRuleList){ List<GameActivityRule> gameActivityRuleList = activityRuleDao.selectByExample(activityRuleExample);
ruleList.add(rule.getDescription()); if (CollectionUtil.isNotEmpty(gameActivityRuleList)) {
for (GameActivityRule rule : gameActivityRuleList) {
ruleList.add(rule.getDescription());
}
} }
} }
return ruleList; return ruleList;
@ -507,14 +597,18 @@ public class ScreenService implements IScreenService{
/** /**
* 查询活动奖品 * 查询活动奖品
*/ */
private List<String> getGameActivityPrize(Long gameTypeId){ @Override
public List<String> getGameActivityPrize(Long gameTypeId){
List<String> prizeList = new ArrayList<>(); List<String> prizeList = new ArrayList<>();
GameActivityPrizeExample activityPrizeExample = new GameActivityPrizeExample();
activityPrizeExample.createCriteria().andGameIdEqualTo(gameTypeId); if(ObjectUtil.isNotNull(gameTypeId)) {
List<GameActivityPrize> gameActivityPrizeList = activityPrizeDao.selectByExample(activityPrizeExample); GameActivityPrizeExample activityPrizeExample = new GameActivityPrizeExample();
if(CollectionUtil.isNotEmpty(gameActivityPrizeList)){ activityPrizeExample.createCriteria().andGameIdEqualTo(gameTypeId);
for(GameActivityPrize prize : gameActivityPrizeList){ List<GameActivityPrize> gameActivityPrizeList = activityPrizeDao.selectByExample(activityPrizeExample);
prizeList.add(prize.getDescription()); if (CollectionUtil.isNotEmpty(gameActivityPrizeList)) {
for (GameActivityPrize prize : gameActivityPrizeList) {
prizeList.add(prize.getDescription());
}
} }
} }
return prizeList; return prizeList;
@ -522,14 +616,18 @@ public class ScreenService implements IScreenService{
/** /**
* 奖券使用说明表 * 奖券使用说明表
*/ */
private List<String> getGamePrizeInstructions(Long gameTypeId){ @Override
public List<String> getGamePrizeInstructions(Long gameTypeId){
List<String> instructionsList = new ArrayList<>(); List<String> instructionsList = new ArrayList<>();
GamePrizeInstructionsExample prizeInstructionsExample = new GamePrizeInstructionsExample();
prizeInstructionsExample.createCriteria().andGameIdEqualTo(gameTypeId); if(ObjectUtil.isNotNull(gameTypeId)) {
List<GamePrizeInstructions> gamePrizeInstructionsList = prizeInstructionsDao.selectByExample(prizeInstructionsExample); GamePrizeInstructionsExample prizeInstructionsExample = new GamePrizeInstructionsExample();
if(CollectionUtil.isNotEmpty(gamePrizeInstructionsList)){ prizeInstructionsExample.createCriteria().andGameIdEqualTo(gameTypeId);
for(GamePrizeInstructions prizeInstructions : gamePrizeInstructionsList){ List<GamePrizeInstructions> gamePrizeInstructionsList = prizeInstructionsDao.selectByExample(prizeInstructionsExample);
instructionsList.add(prizeInstructions.getDescription()); if (CollectionUtil.isNotEmpty(gamePrizeInstructionsList)) {
for (GamePrizeInstructions prizeInstructions : gamePrizeInstructionsList) {
instructionsList.add(prizeInstructions.getDescription());
}
} }
} }
return instructionsList; return instructionsList;
@ -696,5 +794,23 @@ public class ScreenService implements IScreenService{
} }
/**
* 查询游戏类型id
*/
@Override
public Long getGameTypeId(Long recordId){
Long gameTypeId = null;
GameRecord gameRecord = gameRecordDao.selectByPrimaryKey(recordId);
if(ObjectUtil.isNotNull(gameRecord)){
//获取游戏的购买记录和类型
GameUserPay gameUserPay = gameUserPayDao.selectByPrimaryKey(gameRecord.getUserPayId());
if(ObjectUtil.isNotNull(gameUserPay)) {
GameType gameType = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId());
if(ObjectUtil.isNotNull(gameType)){
gameTypeId = gameType.getId();
}
}
}
return gameTypeId;
}
} }

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

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

2
tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java

@ -172,7 +172,7 @@ public class TaskDto {
@ApiModelProperty("任务id") @ApiModelProperty("任务id")
private Long id; private Long id;
@ApiModelProperty("任务完成状态0未完成 1进行中 2已完成") @ApiModelProperty("任务完成状态0未完成 1进行中 2已完成")
private int completedStatus; private Integer completedStatus;
} }
} }

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

@ -53,6 +53,7 @@ public class TokenInterceptor implements HandlerInterceptor {
return false; return false;
} }
//验证用户是否禁用 //验证用户是否禁用
SysUser user = userService.getUserById(Long.valueOf(claims.getSubject())); SysUser user = userService.getUserById(Long.valueOf(claims.getSubject()));
if(user.getRecStatus() == WebConstant.REC_STATUS.Disabled.value){ if(user.getRecStatus() == WebConstant.REC_STATUS.Disabled.value){

9
tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java

@ -75,6 +75,7 @@ public class TaskSubTimeService implements ITaskSubTimeService {
*/ */
@Override @Override
public TaskVo.NormalTask finishTask(Long currentUserId, TaskDto.TaskSubTimeId subTimeId) throws Exception { public TaskVo.NormalTask finishTask(Long currentUserId, TaskDto.TaskSubTimeId subTimeId) throws Exception {
int completedStatus = subTimeId.getCompletedStatus() == null ? 2 : subTimeId.getCompletedStatus();
//查找taskSubTime //查找taskSubTime
ProTaskSubTime taskSubTime = taskSubTimeDao.selectByPrimaryKey(subTimeId.getId()); ProTaskSubTime taskSubTime = taskSubTimeDao.selectByPrimaryKey(subTimeId.getId());
if(ObjectUtil.isNull(taskSubTime)){ if(ObjectUtil.isNull(taskSubTime)){
@ -133,26 +134,26 @@ public class TaskSubTimeService implements ITaskSubTimeService {
if(ObjectUtil.isNull(subTimeMember)){ if(ObjectUtil.isNull(subTimeMember)){
subTimeMember = new ProSubTimeMember(); subTimeMember = new ProSubTimeMember();
subTimeMember.setId(snowflake.nextId()); subTimeMember.setId(snowflake.nextId());
subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); subTimeMember.setComplatedStatus((byte) completedStatus);
subTimeMember.setMemberId(member.getId()); subTimeMember.setMemberId(member.getId());
subTimeMember.setTaskSubTimeId(subTimeId.getId()); subTimeMember.setTaskSubTimeId(subTimeId.getId());
subTimeMember.setRealFinishTime(System.currentTimeMillis()); subTimeMember.setRealFinishTime(System.currentTimeMillis());
proSubTimeMemberDao.insertSelective(subTimeMember); proSubTimeMemberDao.insertSelective(subTimeMember);
}else { }else {
subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); subTimeMember.setComplatedStatus((byte) completedStatus);
subTimeMember.setRealFinishTime(System.currentTimeMillis()); subTimeMember.setRealFinishTime(System.currentTimeMillis());
proSubTimeMemberDao.updateByPrimaryKeySelective(subTimeMember); proSubTimeMemberDao.updateByPrimaryKeySelective(subTimeMember);
} }
}else { }else {
ProSubTimeMember subTimeMember = isFinishTask(member.getId(),subTimeId.getId()); ProSubTimeMember subTimeMember = isFinishTask(member.getId(),subTimeId.getId());
if(ObjectUtil.isNotNull(subTimeMember)){ if(ObjectUtil.isNotNull(subTimeMember)){
subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); subTimeMember.setComplatedStatus((byte) completedStatus);
subTimeMember.setRealFinishTime(System.currentTimeMillis()); subTimeMember.setRealFinishTime(System.currentTimeMillis());
proSubTimeMemberDao.updateByPrimaryKeySelective(subTimeMember); proSubTimeMemberDao.updateByPrimaryKeySelective(subTimeMember);
}else { }else {
subTimeMember = new ProSubTimeMember(); subTimeMember = new ProSubTimeMember();
subTimeMember.setId(snowflake.nextId()); subTimeMember.setId(snowflake.nextId());
subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); subTimeMember.setComplatedStatus((byte) completedStatus);
subTimeMember.setTaskSubTimeId(subTimeId.getId()); subTimeMember.setTaskSubTimeId(subTimeId.getId());
subTimeMember.setMemberId(member.getId()); subTimeMember.setMemberId(member.getId());
subTimeMember.setRealFinishTime(System.currentTimeMillis()); subTimeMember.setRealFinishTime(System.currentTimeMillis());

15
tall/src/main/java/com/ccsens/tall/service/WbsSubSheetService.java

@ -167,12 +167,17 @@ public class WbsSubSheetService implements IWbsSubSheetService {
subTask.setId(snowflake.nextId()); subTask.setId(snowflake.nextId());
subTask.setName(nameCell); subTask.setName(nameCell);
subTask.setDescription(descriptionCell); subTask.setDescription(descriptionCell);
if (StrUtil.isNotEmpty(beginCell)) { if (StrUtil.isNotEmpty(repeatCell)) {
subTask.setBeginTime(Long.valueOf(beginCell)); subTask.setCycle(repeatCell);
} }else {
if (StrUtil.isNotEmpty(endCell)) { if (StrUtil.isNotEmpty(beginCell)) {
subTask.setEndTime(Long.valueOf(endCell)); subTask.setBeginTime(Long.valueOf(beginCell));
}
if (StrUtil.isNotEmpty(endCell)) {
subTask.setEndTime(Long.valueOf(endCell));
}
} }
subTask.setLevel((byte) 2); subTask.setLevel((byte) 2);
subTask.setHasGroup((byte) 0); subTask.setHasGroup((byte) 0);
if (StrUtil.isNotEmpty(memberCell)) { if (StrUtil.isNotEmpty(memberCell)) {

2
tall/src/main/java/com/ccsens/tall/util/TaskUtil.java

@ -56,7 +56,7 @@ public class TaskUtil {
detail.setBeginTime(subTask.getBeginTime()); detail.setBeginTime(subTask.getBeginTime());
detail.setEndTime(subTask.getEndTime()); detail.setEndTime(subTask.getEndTime());
} }
if (detail.getBeginTime() < start && detail.getEndTime() > end) { if (detail.getBeginTime() <= start && detail.getEndTime() > end) {
globalTask.add(detail); globalTask.add(detail);
} else if (detail.getBeginTime() == start && detail.getEndTime() == end){ } else if (detail.getBeginTime() == start && detail.getEndTime() == end){
globalTask.add(detail); globalTask.add(detail);

4
tall/src/main/resources/mapper_dao/TaskDetailDao.xml

@ -87,7 +87,7 @@
</if> </if>
<if test="endTime != null"> <if test="endTime != null">
AND AND
s.end_time &gt;= #{startTime} s.end_time &gt; #{startTime}
</if> </if>
AND AND
@ -138,7 +138,7 @@
AND AND
s.begin_time &lt; #{endTime} s.begin_time &lt; #{endTime}
AND AND
s.end_time &gt;= #{startTime} s.end_time &gt; #{startTime}
AND AND
d.Level in (2,3) d.Level in (2,3)

Loading…
Cancel
Save