智慧保安后台管理项目备份
Administrator
2021-08-13 70ab81f5211897dc0733535a933631b59df9964f
src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -17,7 +17,6 @@
package org.springblade.modules.system.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -26,6 +25,8 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springblade.common.utils.InvestigateUtil;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.excel.util.ExcelUtil;
@@ -150,26 +151,17 @@
   public R submit(@Valid @RequestBody User user) {
      CacheUtil.clear(USER_CACHE);
      //资格审查
      String data = InvestigateUtil.httpGet(user.getCardid());
      JSONObject jsonObject = JSONObject.parseObject(data);
      Object data1 = jsonObject.get("data");
      JSONObject jsonObject1 = JSONObject.parseObject(data1.toString());
      List<Map<String,Object>> res = (List<Map<String,Object>>)jsonObject1.get("res");
      if(res.size()>0) {
         int count = (int) res.stream().filter(map -> map.get("zdxsfzqkry") != null).count();
         res.forEach(map -> {
            if (null != map.get("zdxsfzqkry")) {
               user.setExaminationMx(map.get("zdxsfzqkry").toString());
            }
         });
         if (count > 0) {
            user.setExaminationType("1");
         } else {
            user.setExaminationType("0");
         }
      }else {
      String body = InvestigateUtil.httpGet(user.getCardid());
      JSONObject jsonObject = new JSONObject(body);
      String data = jsonObject.get("data").toString();
      JSONObject jsonData = new JSONObject(data);
      JSONArray res = jsonData.getJSONArray("res");
      if (res.length()==0){
         //没有数据正常
         user.setExaminationType("0");
      }else {
         user.setExaminationType("1");
         user.setExaminationMx(res.getJSONObject(0).get("zdxsfzqkry").toString());
      }
      return R.status(userService.submit(user));
   }