Pārlūkot izejas kodu

update findInfoByStudentId 自主预约全局开关

deason 1 mēnesi atpakaļ
vecāks
revīzija
0a41c92f38

+ 3 - 0
src/main/java/com/qmth/exam/reserve/service/SystemPropertyService.java

@@ -7,5 +7,8 @@ public interface SystemPropertyService extends IService<SystemPropertyEntity> {
 
 
     SystemPropertyEntity findByPropKey(Long orgId, String propKey);
     SystemPropertyEntity findByPropKey(Long orgId, String propKey);
 
 
+    boolean existPropValue(Long orgId, String propKey, String propValue);
+
     void enableSwitch(Long userId, Boolean status);
     void enableSwitch(Long userId, Boolean status);
+
 }
 }

+ 7 - 2
src/main/java/com/qmth/exam/reserve/service/impl/StudentServiceImpl.java

@@ -15,7 +15,6 @@ import com.qmth.exam.reserve.bean.org.OrgInfo;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.student.*;
 import com.qmth.exam.reserve.bean.student.*;
 import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
-import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
 import com.qmth.exam.reserve.cache.impl.OrgCacheService;
 import com.qmth.exam.reserve.cache.impl.OrgCacheService;
 import com.qmth.exam.reserve.config.SysProperty;
 import com.qmth.exam.reserve.config.SysProperty;
 import com.qmth.exam.reserve.dao.StudentDao;
 import com.qmth.exam.reserve.dao.StudentDao;
@@ -55,7 +54,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
     private static final Logger log = LoggerFactory.getLogger(StudentServiceImpl.class);
     private static final Logger log = LoggerFactory.getLogger(StudentServiceImpl.class);
 
 
     @Autowired
     @Autowired
-    private CategoryCacheService categoryCacheService;
+    private SystemPropertyService systemPropertyService;
 
 
     @Autowired
     @Autowired
     private StudentApplyService studentApplyService;
     private StudentApplyService studentApplyService;
@@ -152,6 +151,12 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
             throw new StatusException("学生信息不存在");
             throw new StatusException("学生信息不存在");
         }
         }
 
 
+        // 自主预约全局开关
+        boolean globalOpen = systemPropertyService.existPropValue(info.getOrgId(), Constants.APPLY_SWITCH, Constants.APPLY_SWITCH_OPEN);
+        if (!globalOpen) {
+            info.setSelfApplyEnable(false);
+        }
+
         return info;
         return info;
     }
     }
 
 

+ 9 - 1
src/main/java/com/qmth/exam/reserve/service/impl/SystemPropertyServiceImpl.java

@@ -37,6 +37,15 @@ public class SystemPropertyServiceImpl extends ServiceImpl<SystemPropertyDao, Sy
         return baseMapper.selectOne(wrapper);
         return baseMapper.selectOne(wrapper);
     }
     }
 
 
+    @Override
+    public boolean existPropValue(Long orgId, String propKey, String propValue) {
+        LambdaQueryWrapper<SystemPropertyEntity> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SystemPropertyEntity::getOrgId, orgId);
+        wrapper.eq(SystemPropertyEntity::getPropKey, propKey);
+        wrapper.eq(SystemPropertyEntity::getPropValue, propValue);
+        return baseMapper.selectCount(wrapper) > 0;
+    }
+
     @Override
     @Override
     public void enableSwitch(Long userId, Boolean status) {
     public void enableSwitch(Long userId, Boolean status) {
         if (status == null) {
         if (status == null) {
@@ -88,5 +97,4 @@ public class SystemPropertyServiceImpl extends ServiceImpl<SystemPropertyDao, Sy
     }
     }
 
 
 
 
-
 }
 }