...
|
...
|
@@ -54,18 +54,18 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService { |
|
|
DrawlineActivity drawlineActivity = drawlineActivityDAO.selectByPrimaryKey(activityId);
|
|
|
if (null == drawlineActivity) {
|
|
|
logger.warn("addDrawlineUserQueue: drawlineActivity is not exists");
|
|
|
throw new ServiceException(500, "活动已不存在");
|
|
|
throw new ServiceException(900001003, "活动已不存在");
|
|
|
}
|
|
|
int beginTime = null == drawlineActivity.getBeginTime() ? 0 : drawlineActivity.getBeginTime().intValue();
|
|
|
int endTime = null == drawlineActivity.getEndTime() ? 0 : drawlineActivity.getEndTime().intValue();
|
|
|
int currentTime = (int) (System.currentTimeMillis() / 1000);
|
|
|
if (0 < beginTime && currentTime < beginTime) {
|
|
|
logger.warn("addDrawlineUserQueue: drawlineActivity is not begin");
|
|
|
throw new ServiceException(500, "活动尚未开始");
|
|
|
throw new ServiceException(900001004, "活动尚未开始");
|
|
|
}
|
|
|
if (0 < endTime && currentTime > endTime) {
|
|
|
logger.warn("addDrawlineUserQueue: drawlineActivity is already end");
|
|
|
throw new ServiceException(501, "OOPS!您来晚啦,下次早点哦!");
|
|
|
throw new ServiceException(900001005, "活动已结束");
|
|
|
}
|
|
|
|
|
|
// (4)判断是否已经参加排队
|
...
|
...
|
@@ -74,7 +74,7 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService { |
|
|
drawlineUserQueue);
|
|
|
if (null != drawlineUserQueue) {
|
|
|
logger.warn("addDrawlineUserQueue: drawlineUserQueue is exists already");
|
|
|
throw new ServiceException(500, "您已经参加过排队,无需再次排队");
|
|
|
throw new ServiceException(900001006, "您已经参加过排队,无需再次排队");
|
|
|
}
|
|
|
|
|
|
// (5)组装数据,新增排队
|
...
|
...
|
@@ -83,7 +83,7 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService { |
|
|
logger.debug("addDrawlineUserQueue: drawlineUserQueueDAO.insertAutoSort. drawlineUserQueue is {}, rows is {}", drawlineUserQueue, rows);
|
|
|
if (1 > rows) {
|
|
|
logger.warn("addDrawlineUserQueue: fail to addDrawlineUserQueue. uid is {}, activityId is {}, userType is {}", uid, activityId, userType);
|
|
|
throw new ServiceException(500, "参加活动排队失败");
|
|
|
throw new ServiceException(900001007, "参加活动排队失败");
|
|
|
}
|
|
|
|
|
|
// (6)查询排队序号
|
...
|
...
|
@@ -111,7 +111,7 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService { |
|
|
// (2)校验
|
|
|
if (1 > activityId) {
|
|
|
logger.warn("getDrawlineUserQueueList: param activityId is null.");
|
|
|
throw new ServiceException(500, "请传参activityId");
|
|
|
throw new ServiceException(900001002, "请传参activityId");
|
|
|
}
|
|
|
|
|
|
// (3)查询条件下,总记录数
|
...
|
...
|
@@ -126,7 +126,7 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService { |
|
|
logger.debug("getDrawlineUserQueueList: drawlineUserQueueDAO.selectBy. activityId is {}, sort is {}, limit is {}, drawlineUserQueueList is {}", activityId, sort, limit, drawlineUserQueueList);
|
|
|
if (null == drawlineUserQueueList || 0 == drawlineUserQueueList.size()) {
|
|
|
logger.warn("getDrawlineUserQueueList: drawlineUserQueueList is null.");
|
|
|
throw new ServiceException(500, "无人参与活动排队");
|
|
|
throw new ServiceException(900001008, "无人参与活动排队");
|
|
|
}
|
|
|
|
|
|
// (5)组装uids
|
...
|
...
|
@@ -165,11 +165,11 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService { |
|
|
private void validAddDrawlineUserQueue(int uid, int activityId) {
|
|
|
if (1 > uid) {
|
|
|
logger.warn("validAddDrawlineUserQueue: param uid is null.");
|
|
|
throw new ServiceException(500, "请传参uid");
|
|
|
throw new ServiceException(900001001, "请传参uid");
|
|
|
}
|
|
|
if (1 > activityId) {
|
|
|
logger.warn("validAddDrawlineUserQueue: param activityId is null.");
|
|
|
throw new ServiceException(500, "请传参activityId");
|
|
|
throw new ServiceException(900001002, "请传参activityId");
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|