记得上下班打卡 | git大法好,push需谨慎

Commit 86d7db1d authored by 张国柄's avatar 张国柄

fix:入场人+限制[10,20];

parent cb279533
...@@ -106,7 +106,7 @@ public class AdamEntersController { ...@@ -106,7 +106,7 @@ public class AdamEntersController {
} }
} }
int userEntersOprNo = adamRdmService.getUserEntersOprNo(); int userEntersOprNo = adamRdmService.getUserEntersOprNo(currentUid);
if (reviewLimitEntersOpr > 0 && userEntersOprNo >= reviewLimitEntersOpr) { if (reviewLimitEntersOpr > 0 && userEntersOprNo >= reviewLimitEntersOpr) {
return ResponseDto.failure(ErrorMapping.get("10026")); return ResponseDto.failure(ErrorMapping.get("10026"));
} }
...@@ -114,9 +114,9 @@ public class AdamEntersController { ...@@ -114,9 +114,9 @@ public class AdamEntersController {
String entersId = adamEntersService.add(parameter, currentUid, vos); String entersId = adamEntersService.add(parameter, currentUid, vos);
if (userEntersOprNo == -1) { if (userEntersOprNo == -1) {
adamRdmService.setUserEntersOprNo(1); adamRdmService.setUserEntersOprNo(currentUid);
} else { } else {
adamRdmService.incrUserEntersOprNo(); adamRdmService.incrUserEntersOprNo(currentUid);
} }
return ResponseDto.success(entersId); return ResponseDto.success(entersId);
} }
...@@ -166,11 +166,12 @@ public class AdamEntersController { ...@@ -166,11 +166,12 @@ public class AdamEntersController {
if (StringUtils.isBlank(parameter.getEntersId())) { if (StringUtils.isBlank(parameter.getEntersId())) {
return ResponseDto.failure(ErrorMapping.get("10015")); return ResponseDto.failure(ErrorMapping.get("10015"));
} }
if (null == adamRdmService.getEntersVoByUidEntersId(CurrentUtil.getCurrentUid(), parameter.getEntersId())) { String currentUid = CurrentUtil.getCurrentUid();
if (null == adamRdmService.getEntersVoByUidEntersId(currentUid, parameter.getEntersId())) {
return ResponseDto.failure(ErrorMapping.get("10105")); return ResponseDto.failure(ErrorMapping.get("10105"));
} }
int userEntersOprNo = adamRdmService.getUserEntersOprNo(); int userEntersOprNo = adamRdmService.getUserEntersOprNo(currentUid);
if (reviewLimitEntersOpr > 0 && userEntersOprNo >= reviewLimitEntersOpr) { if (reviewLimitEntersOpr > 0 && userEntersOprNo >= reviewLimitEntersOpr) {
return ResponseDto.failure(ErrorMapping.get("10026")); return ResponseDto.failure(ErrorMapping.get("10026"));
} }
...@@ -178,9 +179,9 @@ public class AdamEntersController { ...@@ -178,9 +179,9 @@ public class AdamEntersController {
adamEntersService.edit(parameter); adamEntersService.edit(parameter);
if (userEntersOprNo == -1) { if (userEntersOprNo == -1) {
adamRdmService.setUserEntersOprNo(1); adamRdmService.setUserEntersOprNo(currentUid);
} else { } else {
adamRdmService.incrUserEntersOprNo(); adamRdmService.incrUserEntersOprNo(currentUid);
} }
return ResponseDto.success(); return ResponseDto.success();
} }
......
...@@ -915,18 +915,18 @@ public class AdamRdmService { ...@@ -915,18 +915,18 @@ public class AdamRdmService {
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
public boolean setUserEntersOprNo(int val) { public boolean setUserEntersOprNo(String uid) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
return redisUtil.set(AdamRedisConst.INCR_USER_ENTERS, val, return redisUtil.set(AdamRedisConst.INCR_USER_ENTERS.concat(uid), 1,
ChronoUnit.SECONDS.between(now, LocalDateTime.of(now.getYear(), now.getMonth(), now.getDayOfMonth(), 23, 59, 59))); ChronoUnit.SECONDS.between(now, LocalDateTime.of(now.getYear(), now.getMonth(), now.getDayOfMonth(), 23, 59, 59)));
} }
public long incrUserEntersOprNo() { public long incrUserEntersOprNo(String uid) {
return redisUtil.incr(AdamRedisConst.INCR_USER_ENTERS, 1); return redisUtil.incr(AdamRedisConst.INCR_USER_ENTERS.concat(uid), 1);
} }
public int getUserEntersOprNo() { public int getUserEntersOprNo(String uid) {
Object o = redisUtil.get(AdamRedisConst.INCR_USER_ENTERS); Object o = redisUtil.get(AdamRedisConst.INCR_USER_ENTERS.concat(uid));
return null == o ? -1 : (int) o; return null == o ? -1 : (int) o;
} }
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment