shiqian 3 жил өмнө
parent
commit
dd1c22f77e

+ 7 - 1
boman-web-core/src/main/java/com/boman/web/core/controller/AnkangMaController.java

@@ -1,5 +1,6 @@
 package com.boman.web.core.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -28,7 +29,12 @@ public class AnkangMaController {
      */
     @GetMapping("/info/{idCard}")
     public AjaxResult getByIdCard(@PathVariable("idCard") String idCard) {
-        return AjaxResult.success("成功", vaccineInfoService.getByIdCard(idCard));
+        final JSONObject info = vaccineInfoService.getByIdCard(idCard);
+        if (info == null) {
+            return AjaxResult.error("档案库中无此人,身份证:" + idCard);
+        }
+
+        return AjaxResult.success("成功", info);
     }
 
 

+ 4 - 0
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -1022,6 +1022,10 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
     public JSONObject getByIdCard(String idCard) {
         VaccineInfoOperation info = vaccineInfoMapper.getByIdCard(idCard);
         JSONObject result = new JSONObject(2);
+        if (info == null) {
+            return result;
+        }
+
         // 姓名
         result.put("userName", info.getUserName());
         // 家庭住址