|
@@ -146,22 +146,23 @@ public class PushLogServiceImpl extends AbstractService<PushLog> implements Push
|
|
|
|
|
|
//量表逻辑处理
|
|
|
Calendar startDate = Calendar.getInstance();
|
|
|
- startDate.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- startDate.set(Calendar.MINUTE, 0);
|
|
|
- startDate.set(Calendar.SECOND, 0);
|
|
|
- startDate.set(Calendar.MILLISECOND, 0);
|
|
|
+ startDate.add(Calendar.HOUR_OF_DAY, -2);
|
|
|
Calendar endDate = Calendar.getInstance();
|
|
|
List<GamePlayTime> gamePlayTime = gamePlayTimeMapper.getScalePlayTime(userId, simpleDateFormatScale.format(startDate.getTime()), simpleDateFormatScale.format(endDate.getTime()));
|
|
|
if (gamePlayTime != null && gamePlayTime.size() > 0){
|
|
|
GamePlayTime playTime = gamePlayTime.get(0);
|
|
|
- if (pushedThreeTimes(playTime.getId()))
|
|
|
+ if (playTime.getDelay() > 3)
|
|
|
return ResultGenerator.genSuccessResult(result);
|
|
|
|
|
|
System.out.println(userId + "此用户需要做量表");
|
|
|
|
|
|
+ result.delay = playTime.getDelay();
|
|
|
result.needDoGame = true;
|
|
|
result.playGameType = 1;
|
|
|
result.playGameId = playTime.getId();
|
|
|
+ Calendar today = Calendar.getInstance();
|
|
|
+ today.add(Calendar.DATE, -1);
|
|
|
+ result.date = UtilFun.DateToString(today.getTime(), UtilFun.YYYYMMDDHHMMSS);
|
|
|
|
|
|
return ResultGenerator.genSuccessResult(result);
|
|
|
}
|
|
@@ -177,46 +178,44 @@ public class PushLogServiceImpl extends AbstractService<PushLog> implements Push
|
|
|
@Override
|
|
|
public Result delayScale(Long gamePlayTimeId, int delayMin, String deviceId) {
|
|
|
if (gamePlayTimeId != null){
|
|
|
- if (pushedThreeTimes(gamePlayTimeId)){
|
|
|
- return new Result("已經推遲過三次,請盡快完成量表");
|
|
|
- }else{
|
|
|
- GamePlayTime gamePlayTime = gamePlayTimeMapper.selectByPrimaryKey(gamePlayTimeId);
|
|
|
-
|
|
|
- Calendar playCalendar = Calendar.getInstance();
|
|
|
- Date playDate = UtilFun.StringToDate(gamePlayTime.getGameTime(), UtilFun.YYYYMMDDHHMMSS);
|
|
|
- if (playDate != null) {
|
|
|
- playCalendar.setTime(playDate);
|
|
|
- Calendar newTime = Calendar.getInstance();
|
|
|
- newTime.add(Calendar.MINUTE, delayMin);
|
|
|
- if (newTime.get(Calendar.DAY_OF_YEAR) != playCalendar.get(Calendar.DAY_OF_YEAR)){
|
|
|
- return new Result("無法推遲相應時間,請盡快完成量表");
|
|
|
- }else{
|
|
|
- PushLog pushLog = new PushLog();
|
|
|
+ GamePlayTime gamePlayTime = gamePlayTimeMapper.selectByPrimaryKey(gamePlayTimeId);
|
|
|
+
|
|
|
+ Calendar playCalendar = Calendar.getInstance();
|
|
|
+ Date playDate = UtilFun.StringToDate(gamePlayTime.getGameTime(), UtilFun.YYYYMMDDHHMMSS);
|
|
|
+ if (playDate != null) {
|
|
|
+ playCalendar.setTime(playDate);
|
|
|
+ Calendar newTime = Calendar.getInstance();
|
|
|
+ newTime.add(Calendar.MINUTE, delayMin);
|
|
|
+ if (newTime.get(Calendar.DAY_OF_YEAR) != playCalendar.get(Calendar.DAY_OF_YEAR) && delayMin != 0){
|
|
|
+ return new Result("無法推遲相應時間,請盡快完成量表");
|
|
|
+ }else{
|
|
|
+ PushLog pushLog = new PushLog();
|
|
|
+ pushLog.setPushTime(new Date());
|
|
|
+ pushLog.setUid(gamePlayTime.getUid());
|
|
|
+ pushLog.setType(2);
|
|
|
+ pushLog.setDeviceId(deviceId);
|
|
|
+ pushLog.setMsgId(gamePlayTimeId + "");
|
|
|
+ pushLog.setStatus(ConstUser.PUSH_DELAY);
|
|
|
+ pushLogMapper.insert(pushLog);
|
|
|
+ gamePlayTime.setGameTime(UtilFun.DateToString(newTime.getTime(), UtilFun.YYYYMMDDHHMMSS));
|
|
|
+ gamePlayTime.setDelay(gamePlayTime.getDelay() + 1);
|
|
|
+ gamePlayTimeMapper.updateByPrimaryKey(gamePlayTime);
|
|
|
+
|
|
|
+ if (gamePlayTime.getDelay() > 3){
|
|
|
+ pushLog = new PushLog();
|
|
|
pushLog.setPushTime(new Date());
|
|
|
pushLog.setUid(gamePlayTime.getUid());
|
|
|
pushLog.setType(2);
|
|
|
pushLog.setDeviceId(deviceId);
|
|
|
pushLog.setMsgId(gamePlayTimeId + "");
|
|
|
- pushLog.setStatus(ConstUser.PUSH_DELAY);
|
|
|
+ pushLog.setStatus(ConstUser.PUSH_NO);
|
|
|
pushLogMapper.insert(pushLog);
|
|
|
- gamePlayTime.setGameTime(UtilFun.DateToString(newTime.getTime(), UtilFun.YYYYMMDDHHMMSS));
|
|
|
- gamePlayTimeMapper.updateByPrimaryKey(gamePlayTime);
|
|
|
-
|
|
|
- if (pushedThreeTimes(gamePlayTimeId)){
|
|
|
- pushLog = new PushLog();
|
|
|
- pushLog.setPushTime(new Date());
|
|
|
- pushLog.setUid(gamePlayTime.getUid());
|
|
|
- pushLog.setType(2);
|
|
|
- pushLog.setDeviceId(deviceId);
|
|
|
- pushLog.setMsgId(gamePlayTimeId + "");
|
|
|
- pushLog.setStatus(ConstUser.PUSH_NO);
|
|
|
- pushLogMapper.insert(pushLog);
|
|
|
- }
|
|
|
-
|
|
|
- return ResultGenerator.genSuccessResult();
|
|
|
}
|
|
|
+
|
|
|
+ return ResultGenerator.genSuccessResult();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return ResultGenerator.genFailResult();
|
|
@@ -237,7 +236,7 @@ public class PushLogServiceImpl extends AbstractService<PushLog> implements Push
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result delayGame(Long gamePlayTimeId, Long gameConfigId, int delayMin, String deviceId) {
|
|
|
+ public Result delayGame(Long gamePlayTimeId, Long gameConfigId, int delayMin, String deviceId, Boolean trueDelay) {
|
|
|
if (gamePlayTimeId != null && gameConfigId != null){
|
|
|
GamePlayTime gamePlayTime = gamePlayTimeMapper.selectByPrimaryKey(gamePlayTimeId);
|
|
|
GameConfig gameConfig = gameConfigMapper.selectByPrimaryKey(gameConfigId);
|
|
@@ -267,16 +266,20 @@ public class PushLogServiceImpl extends AbstractService<PushLog> implements Push
|
|
|
gamePlayTimeMapper.updateByPrimaryKey(gamePlayTime);
|
|
|
return ResultGenerator.genSuccessResult();
|
|
|
}else {
|
|
|
- PushLog pushLog = new PushLog();
|
|
|
- pushLog.setPushTime(new Date());
|
|
|
- pushLog.setUid(gameConfig.getUid());
|
|
|
- pushLog.setType(1);
|
|
|
- pushLog.setDeviceId(deviceId);
|
|
|
- pushLog.setMsgId(gamePlayTimeId + "");
|
|
|
- pushLog.setStatus(ConstUser.PUSH_NO);
|
|
|
- pushLogMapper.insert(pushLog);
|
|
|
- gamePlayTimeMapper.deleteByPrimaryKey(gamePlayTime.getId());
|
|
|
- return new Result("你選擇的延遲的時間點已超過該時間段結束前10分鐘,該時間段結束前10分鐘,將停止推送,無法進入該時間段的測試");
|
|
|
+ if(trueDelay) {
|
|
|
+ PushLog pushLog = new PushLog();
|
|
|
+ pushLog.setPushTime(new Date());
|
|
|
+ pushLog.setUid(gameConfig.getUid());
|
|
|
+ pushLog.setType(1);
|
|
|
+ pushLog.setDeviceId(deviceId);
|
|
|
+ pushLog.setMsgId(gamePlayTimeId + "");
|
|
|
+ pushLog.setStatus(ConstUser.PUSH_NO);
|
|
|
+ pushLogMapper.insert(pushLog);
|
|
|
+ gamePlayTimeMapper.deleteByPrimaryKey(gamePlayTime.getId());
|
|
|
+ return ResultGenerator.genSuccessResult();
|
|
|
+ }else{
|
|
|
+ return new Result("1");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|