| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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)); |
| | | } |