Administrator
2021-08-16 3432fad3ebcecd73d3d50fa8dfb7934cc61cfd06
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;
@@ -134,10 +135,10 @@
    * 自定义用户列表(只有保安员)
    */
   @GetMapping("/page-security")
   public R<IPage<UserVO>> pageSecurity(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) {
   public R<IPage<UserVO>> pageSecurity(@ApiIgnore UserVO user, Query query, Long deptId, BladeUser bladeUser) {
      user.setAccount("admin");
      IPage<User> pages = userService.selectUserPageSecurity(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId()));
      return R.data(UserWrapper.build().pageVO(pages));
      IPage<UserVO> pages = userService.selectUserPageSecurity(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId()));
      return R.data(pages);
   }
   /**
@@ -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));
   }