he2802 2 سال پیش
والد
کامیت
371d817685

+ 11 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
@@ -48,6 +49,7 @@ import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -90,6 +92,9 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
     @Autowired
     private IOrderGoodsService iOrderGoodsService;
 
+    @Autowired
+    private RedisCache redisCache;
+
     private static Logger log = LoggerFactory.getLogger(UserBankRecordServiceImpl.class);
 
 
@@ -225,6 +230,12 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
                 if (Validator.isEmpty(recordPhoto)) {
                     throw new CustomException("拍照次数不达标", 559);
                 }
+                String key = "PERIOD_EXAM_Record:"+userBankRecordVo.getOrderGoodsId()+"-"+userBankRecordVo.getExamId();
+                Long keyStatus = redisCache.getCacheObject(key);
+                if(Validator.isNotEmpty(keyStatus)&&keyStatus==100L){
+                    throw new CustomException("禁止频繁提交",667);
+                }
+                redisCache.setCacheObject(key, 100L,2, TimeUnit.SECONDS);
                 //增加一条审核记录
                 UserPeriod userPeriod = new UserPeriod();
                 userPeriod.setUserId(userBankRecordVo.getUserId());

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -1407,6 +1407,12 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         if(!businessFullName.contains("继续教育")||!businessFullName.contains("施工现场专业人员")){
             bakStudyRecord.setOrderGoodsId(null);
         }
+        String key = "PERIOD_VIDEO_Record:"+entity.getOrderGoodsId()+"-"+entity.getSectionId();
+        Long keyStatus = redisCache.getCacheObject(key);
+        if(Validator.isNotEmpty(keyStatus)&&keyStatus==100L){
+           throw new CustomException("禁止频繁提交",667);
+        }
+        redisCache.setCacheObject(key, 100L,2, TimeUnit.SECONDS);
         // 学习无记录加一条学时审核记录
         if ( baseMapper.selectStudyRecord(bakStudyRecord) < 1) {
             UserPeriod userPeriod = new UserPeriod();