From d198cf078eaf04ed9f3d5407986e57c6bf0ef505 Mon Sep 17 00:00:00 2001 From: zhangye <654600784@qq.com> Date: Tue, 11 Feb 2020 14:33:07 +0800 Subject: [PATCH] =?UTF-8?q?game=E6=9F=A5=E8=AF=A2=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/application-util-dev.yml | 2 +- .../com/ccsens/game/api/ClientController.java | 43 +++- .../com/ccsens/game/bean/dto/ScreenDto.java | 2 + .../com/ccsens/game/bean/vo/ScreenVo.java | 16 +- .../persist/dao/GameUserJoinGroupDao.java | 8 + .../ccsens/game/service/IScreenService.java | 10 + .../ccsens/game/service/ScreenService.java | 186 ++++++++++++++---- game/src/main/resources/application.yml | 4 +- .../com/ccsens/tall/bean/dto/TaskDto.java | 2 +- .../ccsens/tall/config/TokenInterceptor.java | 1 + .../tall/service/TaskSubTimeService.java | 9 +- .../tall/service/WbsSubSheetService.java | 15 +- .../java/com/ccsens/tall/util/TaskUtil.java | 2 +- .../resources/mapper_dao/TaskDetailDao.xml | 4 +- 14 files changed, 248 insertions(+), 56 deletions(-) create mode 100644 game/src/main/java/com/ccsens/game/persist/dao/GameUserJoinGroupDao.java diff --git a/cloudutil/src/main/resources/application-util-dev.yml b/cloudutil/src/main/resources/application-util-dev.yml index e0fce3e8..997b9a7d 100644 --- a/cloudutil/src/main/resources/application-util-dev.yml +++ b/cloudutil/src/main/resources/application-util-dev.yml @@ -20,7 +20,7 @@ eureka: service-url: # 指定eureka server通信地址,注意/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: # 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server prefer-ip-address: true diff --git a/game/src/main/java/com/ccsens/game/api/ClientController.java b/game/src/main/java/com/ccsens/game/api/ClientController.java index 108bdb19..0c582349 100644 --- a/game/src/main/java/com/ccsens/game/api/ClientController.java +++ b/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.vo.ClientVo; import com.ccsens.game.service.IClientService; +import com.ccsens.game.service.IScreenService; import com.ccsens.util.JsonResponse; import com.ccsens.util.bean.dto.QueryDto; import io.swagger.annotations.Api; @@ -14,10 +15,10 @@ import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + @Slf4j @Api(tags = "客户端相关api" , description = "ClientController") @RestController @@ -25,6 +26,8 @@ import org.springframework.web.bind.annotation.RestController; public class ClientController { @Autowired private IClientService clientService; + @Autowired + private IScreenService screenService; @ApiOperation(value = "查看全部排行榜", notes = "") @ApiImplicitParams({ @@ -46,4 +49,36 @@ public class ClientController { ClientVo.Join join = clientService.join(params.getParam(), params.getUserId()); return JsonResponse.newInstance().ok(join); } + + @ApiOperation(value = "查询游戏规则", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "activityRule", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) + public JsonResponse> getGameActivityRule(@ApiParam @RequestParam Long recordId) throws Exception { + log.info("获取游戏规则:{}",recordId); + + List 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> getGameActivityPrize(@ApiParam @RequestParam Long recordId) throws Exception { + log.info("获取游戏规则:{}",recordId); + List 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> getGamePrizeInstructions(@ApiParam @RequestParam Long recordId) throws Exception { + log.info("获取游戏规则:{}",recordId); + List gameActivityRule = screenService.getGamePrizeInstructions(screenService.getGameTypeId(recordId)); + return JsonResponse.newInstance().ok(gameActivityRule); + } + } diff --git a/game/src/main/java/com/ccsens/game/bean/dto/ScreenDto.java b/game/src/main/java/com/ccsens/game/bean/dto/ScreenDto.java index 9715cd1a..ec5579a9 100644 --- a/game/src/main/java/com/ccsens/game/bean/dto/ScreenDto.java +++ b/game/src/main/java/com/ccsens/game/bean/dto/ScreenDto.java @@ -52,4 +52,6 @@ public class ScreenDto { @ApiModelProperty("本地时间") private Long localTime; } + + } diff --git a/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java b/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java index 8c1e8f8b..557e34ad 100644 --- a/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java +++ b/game/src/main/java/com/ccsens/game/bean/vo/ScreenVo.java @@ -111,7 +111,7 @@ public class ScreenVo { @ApiModelProperty("准备中") private PreparingData preparingData; @ApiModelProperty("进行中") - private ProcessingData processingData; + private Object processingData; @ApiModelProperty("已结束") private CompletedData completedData; @@ -138,4 +138,18 @@ public class ScreenVo { @ApiModelProperty("本地开始时间") 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; + } + } diff --git a/game/src/main/java/com/ccsens/game/persist/dao/GameUserJoinGroupDao.java b/game/src/main/java/com/ccsens/game/persist/dao/GameUserJoinGroupDao.java new file mode 100644 index 00000000..d29c5b67 --- /dev/null +++ b/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 { +} diff --git a/game/src/main/java/com/ccsens/game/service/IScreenService.java b/game/src/main/java/com/ccsens/game/service/IScreenService.java index 9a14435a..5d483045 100644 --- a/game/src/main/java/com/ccsens/game/service/IScreenService.java +++ b/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.util.bean.dto.QueryDto; +import java.util.List; + public interface IScreenService { ScreenVo.UrlVo getScreenUrl(QueryDto params) throws Exception; @@ -27,4 +29,12 @@ public interface IScreenService { * @return */ GameRecord getGameRecord(long gameRecordId); + + List getGameActivityRule(Long gameTypeId); + + List getGameActivityPrize(Long gameTypeId); + + List getGamePrizeInstructions(Long gameTypeId); + + Long getGameTypeId(Long recordId); } diff --git a/game/src/main/java/com/ccsens/game/service/ScreenService.java b/game/src/main/java/com/ccsens/game/service/ScreenService.java index 12667484..95d1d18f 100644 --- a/game/src/main/java/com/ccsens/game/service/ScreenService.java +++ b/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.Transactional; +import javax.websocket.OnClose; import java.io.File; import java.util.*; import java.util.concurrent.*; @@ -50,6 +51,8 @@ public class ScreenService implements IScreenService{ @Autowired private GameGroupDao gameGroupDao; @Autowired + private GameUserJoinGroupDao gameUserJoinGroupDao; + @Autowired private GameActivityRuleDao activityRuleDao; @Autowired private GameActivityPrizeDao activityPrizeDao; @@ -232,7 +235,14 @@ public class ScreenService implements IScreenService{ case 2: break; 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); break; default: @@ -253,6 +263,9 @@ public class ScreenService implements IScreenService{ long gameRecordId = memberRecord.getMemberRecord(); GameRecord gameRecord = getGameRecord(gameRecordId); + //获取游戏的购买记录和类型 + GameUserPay gameUserPay = gameUserPayDao.selectByPrimaryKey(gameRecord.getUserPayId()); + GameType gameType = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId()); gameStatusVo.setGameStatus(gameRecord.getGameStatus()); @@ -283,14 +296,27 @@ public class ScreenService implements IScreenService{ gameStatusVo.setPreparingData(preparingData); break; case 2: - ScreenVo.ProcessingData processingData = new ScreenVo.ProcessingData(); - // 查询前十名(列表顺序即前十名顺序) - List tops = getTopUsers(gameRecordId); - processingData.setTopMembers(tops); - gameStatusVo.setProcessingData(processingData); + //查询游戏是否有分组 + if(gameType.getIsGroup() == 0) { + //普通游戏返回前十名的信息 + ScreenVo.ProcessingData processingData = new ScreenVo.ProcessingData(); + // 查询前十名(列表顺序即前十名顺序) + List tops = getTopUsers(gameRecordId); + processingData.setTopMembers(tops); + gameStatusVo.setProcessingData(processingData); + }else { + //分组游戏则返回每个分组的信息 + List groupVoList = getGroupScore(gameRecordId); + gameStatusVo.setProcessingData(groupVoList); + } break; 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); break; default: @@ -299,11 +325,36 @@ public class ScreenService implements IScreenService{ return gameStatusVo; } + /** + * 进行中查询每个组的信息 + */ + private List getGroupScore(Long gameRecordId){ + List groupVoList = new ArrayList<>(); + //查询分组信息 + GameGroupExample gameGroupExample = new GameGroupExample(); + gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecordId); + List gameGroupList = gameGroupDao.selectByExample(gameGroupExample); + if(CollectionUtil.isNotEmpty(gameGroupList)){ + for(GameGroup gameGroup : gameGroupList){ + Map group = getGroupTotalScore(gameGroup.getId()); + List userJoinList = (List) 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) { - //1、分别查询redis内每个队伍的总分, + ScreenVo.CompletedData completedData = new ScreenVo.CompletedData(); + //TODO 1、分别查询redis内每个队伍的总分, //2、查询获胜队伍的信息 //3、redis内没有则查询数据库 @@ -312,15 +363,50 @@ public class ScreenService implements IScreenService{ gameGroupExample.createCriteria().andRecordIdEqualTo(gameRecordId); List gameGroupList = gameGroupDao.selectByExample(gameGroupExample); if(CollectionUtil.isNotEmpty(gameGroupList)){ + List userJoinList = null; //分别查找两个队伍的总分 - + Map group1 = getGroupTotalScore(gameGroupList.get(0).getId()); + Map 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) group1.get("userJoinList"); + }else { + userJoinList = (List) group2.get("userJoinList"); + } + } + //5、获取获胜队伍的信息 + completedData = getCompletedData(userJoinList); } - - //4、分别查询每个队伍的总分 - //5、获取获胜队伍的信息 - return null; + return completedData; + } + /** + * 获取队伍的总分 + */ + private Map getGroupTotalScore(Long groupId){ + Map groupMap = null; + + //查找队伍的参赛人 + GameUserJoinGroupExample joinGroupExample = new GameUserJoinGroupExample(); + joinGroupExample.createCriteria().andGameGroupIdEqualTo(groupId); + List userJoinGroupList = gameUserJoinGroupDao.selectByExample(joinGroupExample); + if(CollectionUtil.isNotEmpty(userJoinGroupList)){ + groupMap = new HashMap<>(); + int totalScore = 0; + List 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 @@ -492,14 +578,18 @@ public class ScreenService implements IScreenService{ /** * 查找活动规则 */ - private List getGameActivityRule(Long gameTypeId){ + @Override + public List getGameActivityRule(Long gameTypeId){ List ruleList = new ArrayList<>(); - GameActivityRuleExample activityRuleExample = new GameActivityRuleExample(); - activityRuleExample.createCriteria().andGameIdEqualTo(gameTypeId); - List gameActivityRuleList = activityRuleDao.selectByExample(activityRuleExample); - if(CollectionUtil.isNotEmpty(gameActivityRuleList)){ - for(GameActivityRule rule : gameActivityRuleList){ - ruleList.add(rule.getDescription()); + + if(ObjectUtil.isNotNull(gameTypeId)) { + GameActivityRuleExample activityRuleExample = new GameActivityRuleExample(); + activityRuleExample.createCriteria().andGameIdEqualTo(gameTypeId); + List gameActivityRuleList = activityRuleDao.selectByExample(activityRuleExample); + if (CollectionUtil.isNotEmpty(gameActivityRuleList)) { + for (GameActivityRule rule : gameActivityRuleList) { + ruleList.add(rule.getDescription()); + } } } return ruleList; @@ -507,14 +597,18 @@ public class ScreenService implements IScreenService{ /** * 查询活动奖品 */ - private List getGameActivityPrize(Long gameTypeId){ + @Override + public List getGameActivityPrize(Long gameTypeId){ List prizeList = new ArrayList<>(); - GameActivityPrizeExample activityPrizeExample = new GameActivityPrizeExample(); - activityPrizeExample.createCriteria().andGameIdEqualTo(gameTypeId); - List gameActivityPrizeList = activityPrizeDao.selectByExample(activityPrizeExample); - if(CollectionUtil.isNotEmpty(gameActivityPrizeList)){ - for(GameActivityPrize prize : gameActivityPrizeList){ - prizeList.add(prize.getDescription()); + + if(ObjectUtil.isNotNull(gameTypeId)) { + GameActivityPrizeExample activityPrizeExample = new GameActivityPrizeExample(); + activityPrizeExample.createCriteria().andGameIdEqualTo(gameTypeId); + List gameActivityPrizeList = activityPrizeDao.selectByExample(activityPrizeExample); + if (CollectionUtil.isNotEmpty(gameActivityPrizeList)) { + for (GameActivityPrize prize : gameActivityPrizeList) { + prizeList.add(prize.getDescription()); + } } } return prizeList; @@ -522,14 +616,18 @@ public class ScreenService implements IScreenService{ /** * 奖券使用说明表 */ - private List getGamePrizeInstructions(Long gameTypeId){ + @Override + public List getGamePrizeInstructions(Long gameTypeId){ List instructionsList = new ArrayList<>(); - GamePrizeInstructionsExample prizeInstructionsExample = new GamePrizeInstructionsExample(); - prizeInstructionsExample.createCriteria().andGameIdEqualTo(gameTypeId); - List gamePrizeInstructionsList = prizeInstructionsDao.selectByExample(prizeInstructionsExample); - if(CollectionUtil.isNotEmpty(gamePrizeInstructionsList)){ - for(GamePrizeInstructions prizeInstructions : gamePrizeInstructionsList){ - instructionsList.add(prizeInstructions.getDescription()); + + if(ObjectUtil.isNotNull(gameTypeId)) { + GamePrizeInstructionsExample prizeInstructionsExample = new GamePrizeInstructionsExample(); + prizeInstructionsExample.createCriteria().andGameIdEqualTo(gameTypeId); + List gamePrizeInstructionsList = prizeInstructionsDao.selectByExample(prizeInstructionsExample); + if (CollectionUtil.isNotEmpty(gamePrizeInstructionsList)) { + for (GamePrizeInstructions prizeInstructions : gamePrizeInstructionsList) { + instructionsList.add(prizeInstructions.getDescription()); + } } } 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; + } } diff --git a/game/src/main/resources/application.yml b/game/src/main/resources/application.yml index 5889ff7f..5c2cd5c4 100644 --- a/game/src/main/resources/application.yml +++ b/game/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: common, util-test \ No newline at end of file + active: dev + include: common, util-dev \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java b/tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java index 68e9a89b..26270cc3 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java +++ b/tall/src/main/java/com/ccsens/tall/bean/dto/TaskDto.java @@ -172,7 +172,7 @@ public class TaskDto { @ApiModelProperty("任务id") private Long id; @ApiModelProperty("任务完成状态0未完成 1进行中 2已完成") - private int completedStatus; + private Integer completedStatus; } } diff --git a/tall/src/main/java/com/ccsens/tall/config/TokenInterceptor.java b/tall/src/main/java/com/ccsens/tall/config/TokenInterceptor.java index cc0735fd..f2bad690 100644 --- a/tall/src/main/java/com/ccsens/tall/config/TokenInterceptor.java +++ b/tall/src/main/java/com/ccsens/tall/config/TokenInterceptor.java @@ -53,6 +53,7 @@ public class TokenInterceptor implements HandlerInterceptor { return false; } + //验证用户是否禁用 SysUser user = userService.getUserById(Long.valueOf(claims.getSubject())); if(user.getRecStatus() == WebConstant.REC_STATUS.Disabled.value){ diff --git a/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java b/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java index 8db425f4..6cce7527 100644 --- a/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java +++ b/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java @@ -75,6 +75,7 @@ public class TaskSubTimeService implements ITaskSubTimeService { */ @Override public TaskVo.NormalTask finishTask(Long currentUserId, TaskDto.TaskSubTimeId subTimeId) throws Exception { + int completedStatus = subTimeId.getCompletedStatus() == null ? 2 : subTimeId.getCompletedStatus(); //查找taskSubTime ProTaskSubTime taskSubTime = taskSubTimeDao.selectByPrimaryKey(subTimeId.getId()); if(ObjectUtil.isNull(taskSubTime)){ @@ -133,26 +134,26 @@ public class TaskSubTimeService implements ITaskSubTimeService { if(ObjectUtil.isNull(subTimeMember)){ subTimeMember = new ProSubTimeMember(); subTimeMember.setId(snowflake.nextId()); - subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); + subTimeMember.setComplatedStatus((byte) completedStatus); subTimeMember.setMemberId(member.getId()); subTimeMember.setTaskSubTimeId(subTimeId.getId()); subTimeMember.setRealFinishTime(System.currentTimeMillis()); proSubTimeMemberDao.insertSelective(subTimeMember); }else { - subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); + subTimeMember.setComplatedStatus((byte) completedStatus); subTimeMember.setRealFinishTime(System.currentTimeMillis()); proSubTimeMemberDao.updateByPrimaryKeySelective(subTimeMember); } }else { ProSubTimeMember subTimeMember = isFinishTask(member.getId(),subTimeId.getId()); if(ObjectUtil.isNotNull(subTimeMember)){ - subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); + subTimeMember.setComplatedStatus((byte) completedStatus); subTimeMember.setRealFinishTime(System.currentTimeMillis()); proSubTimeMemberDao.updateByPrimaryKeySelective(subTimeMember); }else { subTimeMember = new ProSubTimeMember(); subTimeMember.setId(snowflake.nextId()); - subTimeMember.setComplatedStatus((byte) subTimeId.getCompletedStatus()); + subTimeMember.setComplatedStatus((byte) completedStatus); subTimeMember.setTaskSubTimeId(subTimeId.getId()); subTimeMember.setMemberId(member.getId()); subTimeMember.setRealFinishTime(System.currentTimeMillis()); diff --git a/tall/src/main/java/com/ccsens/tall/service/WbsSubSheetService.java b/tall/src/main/java/com/ccsens/tall/service/WbsSubSheetService.java index e54fa5de..0d2315f8 100644 --- a/tall/src/main/java/com/ccsens/tall/service/WbsSubSheetService.java +++ b/tall/src/main/java/com/ccsens/tall/service/WbsSubSheetService.java @@ -167,12 +167,17 @@ public class WbsSubSheetService implements IWbsSubSheetService { subTask.setId(snowflake.nextId()); subTask.setName(nameCell); subTask.setDescription(descriptionCell); - if (StrUtil.isNotEmpty(beginCell)) { - subTask.setBeginTime(Long.valueOf(beginCell)); - } - if (StrUtil.isNotEmpty(endCell)) { - subTask.setEndTime(Long.valueOf(endCell)); + if (StrUtil.isNotEmpty(repeatCell)) { + subTask.setCycle(repeatCell); + }else { + if (StrUtil.isNotEmpty(beginCell)) { + subTask.setBeginTime(Long.valueOf(beginCell)); + } + if (StrUtil.isNotEmpty(endCell)) { + subTask.setEndTime(Long.valueOf(endCell)); + } } + subTask.setLevel((byte) 2); subTask.setHasGroup((byte) 0); if (StrUtil.isNotEmpty(memberCell)) { diff --git a/tall/src/main/java/com/ccsens/tall/util/TaskUtil.java b/tall/src/main/java/com/ccsens/tall/util/TaskUtil.java index 11791213..a71ddecd 100644 --- a/tall/src/main/java/com/ccsens/tall/util/TaskUtil.java +++ b/tall/src/main/java/com/ccsens/tall/util/TaskUtil.java @@ -56,7 +56,7 @@ public class TaskUtil { detail.setBeginTime(subTask.getBeginTime()); detail.setEndTime(subTask.getEndTime()); } - if (detail.getBeginTime() < start && detail.getEndTime() > end) { + if (detail.getBeginTime() <= start && detail.getEndTime() > end) { globalTask.add(detail); } else if (detail.getBeginTime() == start && detail.getEndTime() == end){ globalTask.add(detail); diff --git a/tall/src/main/resources/mapper_dao/TaskDetailDao.xml b/tall/src/main/resources/mapper_dao/TaskDetailDao.xml index 133faa72..44fa3f29 100644 --- a/tall/src/main/resources/mapper_dao/TaskDetailDao.xml +++ b/tall/src/main/resources/mapper_dao/TaskDetailDao.xml @@ -87,7 +87,7 @@ AND - s.end_time >= #{startTime} + s.end_time > #{startTime} AND @@ -138,7 +138,7 @@ AND s.begin_time < #{endTime} AND - s.end_time >= #{startTime} + s.end_time > #{startTime} AND d.Level in (2,3)