瀏覽代碼

空指针错误

zhuhao 3 年之前
父節點
當前提交
7321ac73d6

+ 6 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/classSchedule/ScheduleFrequencyController.java

@@ -69,7 +69,12 @@ public class ScheduleFrequencyController extends SuperController<ScheduleFrequen
     public void query(PageParams<ScheduleFrequencyPageDTO> params, IPage<ScheduleFrequency> page, Long defSize) {
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
-        String jsonParam = redisTemplate.opsForValue().get("testParam").toString();
+        String jsonParam = "";
+        Object obj = redisTemplate.opsForValue().get("testParam");
+        if(obj != null){
+            jsonParam = redisTemplate.opsForValue().get("testParam").toString();
+        }
+
         HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam,headers);
         //调用接口
         String returnData = restTemplate.postForObject(url, formEntity, String.class);