|
@@ -74,7 +74,28 @@ public class UserConfigServiceImpl extends AbstractService<UserConfig> implement
|
|
|
PageHelper.startPage(page, size);
|
|
|
|
|
|
List<Map<String, Object>> list = userConfigMapper.list(params, order);
|
|
|
+
|
|
|
+ for(Map<String, Object> item : list){
|
|
|
+ String scaleStart = item.get("scaleStart") == null ? null : (String) item.get("scaleStart");
|
|
|
+ String scaleEnd = item.get("scaleEnd") == null ? null : (String) item.get("scaleEnd");
|
|
|
+ if (scaleStart != null && scaleEnd != null){
|
|
|
+ Calendar current = Calendar.getInstance();
|
|
|
+ Calendar calendarStart = Calendar.getInstance();
|
|
|
+ calendarStart.setTime(UtilFun.StringToDate(scaleStart, UtilFun.YYYYMMDDHHMMSS));
|
|
|
+ Calendar calendarEnd = Calendar.getInstance();
|
|
|
+ calendarEnd.setTime(UtilFun.StringToDate(scaleEnd, UtilFun.YYYYMMDDHHMMSS));
|
|
|
+ if (current.before(calendarStart)){
|
|
|
+ item.put("status", 0);
|
|
|
+ } else if (current.after(calendarEnd)){
|
|
|
+ item.put("status", 2);
|
|
|
+ } else if(current.after(calendarStart) && current.before(calendarEnd)){
|
|
|
+ item.put("status", 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(list);
|
|
|
+
|
|
|
return ResultGenerator.genSuccessResult(pageInfo);
|
|
|
}
|
|
|
|
|
@@ -111,6 +132,16 @@ public class UserConfigServiceImpl extends AbstractService<UserConfig> implement
|
|
|
|
|
|
config.setUserId(user.getId());
|
|
|
config.setGameCount(gameConfigs.size());
|
|
|
+
|
|
|
+ String end = config.getScaleEnd();
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(UtilFun.StringToDate(end, UtilFun.YYYYMMDDHHMMSS));
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
|
|
|
+ calendar.set(Calendar.MINUTE, 59);
|
|
|
+ calendar.set(Calendar.SECOND, 59);
|
|
|
+ calendar.set(Calendar.MILLISECOND, 999);
|
|
|
+ config.setScaleEnd(UtilFun.DateToString(calendar.getTime(), UtilFun.YYYYMMDDHHMMSS));
|
|
|
+
|
|
|
save(config);
|
|
|
return ResultGenerator.genSuccessResult();
|
|
|
}
|
|
@@ -127,10 +158,20 @@ public class UserConfigServiceImpl extends AbstractService<UserConfig> implement
|
|
|
@Override
|
|
|
public Result update(User user, UserConfig config, Long configId, String configs) {
|
|
|
User oldUser = userMapper.selectByPrimaryKey(user.getId());
|
|
|
+ UserConfig oldConfig = userConfigMapper.findByUid(user.getId());
|
|
|
//用戶開始測試後無法再修改用戶信息
|
|
|
- if (oldUser.getStatus() != ConstUser.STATUS_NORMAL) {
|
|
|
+ Calendar current = Calendar.getInstance();
|
|
|
+ Calendar calendarStart = Calendar.getInstance();
|
|
|
+ calendarStart.setTime(UtilFun.StringToDate(oldConfig.getScaleStart(), UtilFun.YYYYMMDDHHMMSS));
|
|
|
+ Calendar calendarEnd = Calendar.getInstance();
|
|
|
+ calendarEnd.setTime(UtilFun.StringToDate(oldConfig.getScaleEnd(), UtilFun.YYYYMMDDHHMMSS));
|
|
|
+ if(current.after(calendarStart) && current.before(calendarEnd)){
|
|
|
return ResultGenerator.genResult(USER_ING);
|
|
|
}
|
|
|
+
|
|
|
+// if (oldUser.getStatus() != ConstUser.STATUS_NORMAL) {
|
|
|
+// return ResultGenerator.genResult(USER_ING);
|
|
|
+// }
|
|
|
if (user.getOpenid() != null && user.getOpenid().equals("")) user.setOpenid(null);
|
|
|
//判斷嗎密碼是否發生變化,無變化不修改
|
|
|
if (!oldUser.getPassword().equals(user.getPassword())) {
|