Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into frx
This commit is contained in:
commit
80f91de677
@ -58,6 +58,10 @@ public class Constants {
|
||||
* yyyy-MM-dd格式
|
||||
*/
|
||||
public static final DateTimeFormatter REPO_DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
/**
|
||||
* 年月格式
|
||||
*/
|
||||
public static final DateTimeFormatter YEAR_MONTH_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
/**
|
||||
* yyyy-MM-dd HH:mm:ss格式
|
||||
*/
|
||||
|
@ -1018,7 +1018,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
public Integer getReplacementCardNum() {
|
||||
Long userId = getLoginUserId();
|
||||
Integer num = 0;
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.REPO_DATE_FORMAT);
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.YEAR_MONTH_FORMAT);
|
||||
String value = stringRedisTemplate.opsForValue().get(key);
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
// -- 获取当前用户
|
||||
@ -1064,7 +1064,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// -- 如果有报错的话 - 那么进行回滚操作 - 并且redis 中的补卡次数也要+1 (redis并不会回滚)
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.REPO_DATE_FORMAT);
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.YEAR_MONTH_FORMAT);
|
||||
stringRedisTemplate.opsForValue().increment(key, 1);
|
||||
throw exception(ABNORMAL_CARD_REPLENISHMENT);
|
||||
}
|
||||
@ -1121,7 +1121,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
||||
@Override
|
||||
public void useReplacementCardNum(Long userId) {
|
||||
userId = userId == null ? getLoginUserId() : userId;
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.REPO_DATE_FORMAT);
|
||||
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.YEAR_MONTH_FORMAT);
|
||||
String value = stringRedisTemplate.opsForValue().get(key);
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
if (Integer.parseInt(value) > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user