he2802 %!s(int64=4) %!d(string=hai) anos
pai
achega
49458a7cca

+ 1 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/core/redis/RedisCache.java

@@ -245,7 +245,7 @@ public class RedisCache
         boolean locked = false;
         int tryCount = 3;
         while (!locked && tryCount > 0) {
-            locked = redisTemplate.opsForValue().setIfAbsent(redisLockEntity.getLockKey(), redisLockEntity.getRequestId(), 2, TimeUnit.MINUTES);
+            locked = redisTemplate.opsForValue().setIfAbsent(redisLockEntity.getLockKey(), redisLockEntity.getRequestId(), 5, TimeUnit.SECONDS);
             tryCount--;
             try {
                 Thread.sleep(400);

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/Printer.java

@@ -27,11 +27,14 @@ public class Printer implements Runnable {
             if(redisCache.lock(redisLockEntity)){
                 System.out.print("报数id" + id + ":"+num+"\n");
                 num++;
+
                 try {
                     Thread.sleep(400);
+
                 } catch (InterruptedException e) {
                     redisCache.unlockLua(redisLockEntity);
                 }
+
                 redisCache.unlockLua(redisLockEntity);
             }
 

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -512,7 +512,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             throw new CustomException("该学员已在此商品有效期内的班级,无法加入新的有效期班级,请查看该学员此商品下的班级");
         }
         //指定班级
-        if(gradeId>0){
+        if(gradeId!=null&&gradeId>0){
             ClassGradeVo classGradeVo = iClassGradeService.queryById(gradeId);
             if(classGradeVo==null){
                 throw new CustomException("班级不存在");
@@ -540,6 +540,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             //无指定班级
             ClassGradeQueryBo bo = new ClassGradeQueryBo();
             bo.setGoodsId(goodsId);
+            bo.setPastDue(1L);
             List<ClassGradeVo> classGradeVoList =  iClassGradeService.queryList(bo);
             for(int i = 0; i < classGradeVoList.size(); i++){
                 ClassGradeVo classGradeVo = classGradeVoList.get(i);