Procházet zdrojové kódy

获取人员代码提交

wangchangsheng před 1 rokem
rodič
revize
dc4d4cdf99

+ 14 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/controller/OrganizationStructureController.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -25,7 +26,8 @@ import java.util.List;
 public class OrganizationStructureController {
 
 
-
+	@Autowired
+	private HttpServletRequest request;
 
 	@Autowired
 	private IOrganizationStructureService organizationStructureService;
@@ -60,5 +62,16 @@ public class OrganizationStructureController {
 	}
 
 
+	@GetMapping(value = "getList")
+	public R getList(
+		@RequestParam(value = "likeParentId", required = false) String id,
+		@RequestParam(value = "parentId", required = false) String num,
+		@RequestParam(value = "name", required = false) String name,
+		@RequestParam(value = "type", required = false) String type) {
+		List<OrganizationStructure> list = organizationStructureService.getList(id,num,name,type, request);
+		return R.ok().data(list);
+	}
+
+
 
 }

+ 27 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/controller/UserController.java

@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -33,6 +34,10 @@ public class UserController {
 	@Autowired
 	private RemoteServiceBuilder remoteServiceBuilder;
 
+
+	@Autowired
+	private HttpServletRequest request;
+
 	/**
 	 * 更具code获取用户信息
 	 * @return
@@ -87,6 +92,28 @@ public class UserController {
 		return R.ok().data(json);
 	}
 
+	@GetMapping(value = "pageList")
+	public JSONObject pageList(
+		@RequestParam(value = "current", required = false) Integer current,
+		@RequestParam(value = "size", required = false) Integer size,
+		@RequestParam(value = "orgId", required = false) String orgId,
+		@RequestParam(value = "idCard", required = false) String idCard,
+		@RequestParam(value = "mobile", required = false) String mobile,
+		@RequestParam(value = "no", required = false) String no,
+		@RequestParam(value = "name", required = false) String name,
+		@RequestParam(value = "loginName", required = false) String loginName) {
+		JSONObject json = null;
+		try {
+			 json = userService.pageList( current,  size,  orgId,  idCard,  mobile,  no, name, loginName,request);
+		} catch (Exception e) {
+			log.error("错误",e);
+			return null;
+		}
+		return json;
+	}
+
+
+
 
 	/**
 	 * 退出登录

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/result/R.java

@@ -5,7 +5,7 @@ import lombok.Data;
 
 /**
  * @ClassName : R
- * @Author : xieshengjie
+ * @Author :
  * @Date: 2021/5/16 16:59
  * @Description : 结果集
  */

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/result/ResultCode.java

@@ -2,7 +2,7 @@ package com.ims.eval.entity.dto.result;
 
 /**
  * @ClassName : ResultCode
- * @Author : xieshengjie
+ * @Author :
  * @Date: 2021/5/16 17:01
  * @Description : 结果状态
  */

+ 28 - 3
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/result/ResultInfo.java

@@ -5,7 +5,7 @@ import lombok.Data;
 /**
  *@ClassName ResultInfo
  *@Description 返回结果类统一封装
- *@Author 谢生杰
+ *@Author
  *@Date 2020/9/25 18:53
  *@Version 1.0
  **/
@@ -18,7 +18,12 @@ public class ResultInfo {
     // 数据对象
     private Object result;
 
-    private Integer total;
+	private Object data;
+
+	private String msg;
+
+
+	private Integer total;
 
     /**
      * 无参构造器
@@ -38,7 +43,27 @@ public class ResultInfo {
         return this;
     }
 
-    public ResultInfo message(String message) {
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public Object getResult() {
+		return result;
+	}
+
+	public Object getData() {
+		return data;
+	}
+
+	public Integer getTotal() {
+		return total;
+	}
+
+	public ResultInfo message(String message) {
         this.message = message;
         return this;
     }

+ 3 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IOrganizationStructureService.java

@@ -3,6 +3,7 @@ package com.ims.eval.service;
 import com.ims.eval.entity.OrganizationStructure;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -16,4 +17,6 @@ import java.util.List;
 public interface IOrganizationStructureService extends IService<OrganizationStructure> {
 
 	List<OrganizationStructure> getTree(String id,Integer num,String type );
+
+	List<OrganizationStructure> getList(String likeParentId, String parentId, String name,String type, HttpServletRequest request);
 }

+ 14 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IUserService.java

@@ -73,5 +73,19 @@ public interface IUserService extends IService<Myuser> {
 	 */
 	JSONObject getbladeAuth(String tenantId, String username, String password, String grantType, String scope, String type);
 
+	/**
+	 * 分页获取用户
+	 * @param current
+	 * @param size
+	 * @param orgId
+	 * @param idCard
+	 * @param mobile
+	 * @param no
+	 * @param name
+	 * @param loginName
+	 * @return
+	 */
+	JSONObject pageList(Integer current, Integer size, String orgId, String idCard, String mobile, String no,String name,String loginName,HttpServletRequest request);
+
 
 }

+ 43 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationStructureServiceImpl.java

@@ -3,15 +3,23 @@ package com.ims.eval.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ims.common.utils.StringUtils;
+import com.ims.eval.config.ImaConfig;
 import com.ims.eval.entity.OrganizationStructure;
 import com.ims.eval.dao.OrganizationStructureMapper;
-import com.ims.eval.entity.custom.Menu;
 import com.ims.eval.feign.RemoteServiceBuilder;
 import com.ims.eval.service.IOrganizationStructureService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -26,6 +34,7 @@ import java.util.stream.Collectors;
  * @since 2023-03-01
  */
 @Service
+@Slf4j
 public class OrganizationStructureServiceImpl extends ServiceImpl<OrganizationStructureMapper, OrganizationStructure> implements IOrganizationStructureService {
 
 	private static Integer length = 0;
@@ -35,6 +44,12 @@ public class OrganizationStructureServiceImpl extends ServiceImpl<OrganizationSt
 	@Autowired
 	private RemoteServiceBuilder remoteServiceBuilder;
 
+	@Autowired
+	private RestTemplate restTemplate;
+
+	@Autowired
+	private ImaConfig imaConfig;
+
 	private List<OrganizationStructure> list = new ArrayList<>();
 
 	@Override
@@ -62,6 +77,33 @@ public class OrganizationStructureServiceImpl extends ServiceImpl<OrganizationSt
 		return tr;
 	}
 
+	@Override
+	public List<OrganizationStructure> getList(String likeParentId, String parentId, String name,String type, HttpServletRequest request) {
+
+
+		HttpHeaders headers = new HttpHeaders();
+		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
+		headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
+
+		HttpEntity<Map> param = new HttpEntity<>(null, headers);
+		ResponseEntity<String> responseEntity2 = restTemplate.postForEntity(imaConfig.getGatewayUrl() +"ims-iam-ext/sys/sysOrg/allDataNoControl?likeParentId={1}&parentId={2}&name={3}",
+			param, String.class, likeParentId, parentId,name);
+
+		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
+		if(200== responseEntity2.getStatusCodeValue()){
+
+			JSONArray arr = JSONArray.parseArray(responseEntity2.getBody());
+			List<OrganizationStructure> list = arr.toJavaList(OrganizationStructure.class);
+			if(StringUtils.isNotEmpty(type)){
+				list = list.stream().filter(OrganizationStructure -> OrganizationStructure.getType().equals(type))
+					.collect(Collectors.toList());
+			}
+			return list;
+
+		}
+		return null;
+	}
+
 	/**
 	 * 转换为有树形结构的列表
 	 *

+ 21 - 5
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/UserServiceImpl.java

@@ -9,14 +9,12 @@ import com.ims.eval.config.ImaConfig;
 import com.ims.eval.entity.Myuser;
 import com.ims.eval.dao.UserMapper;
 import com.ims.eval.entity.dto.response.MyuserResDTO;
-import com.ims.eval.entity.flow.FlowResult;
 import com.ims.eval.feign.RemoteServiceBuilder;
 import com.ims.eval.service.IUserService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
 import org.springframework.stereotype.Service;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
@@ -24,9 +22,7 @@ import org.springframework.web.client.RestTemplate;
 import springfox.documentation.annotations.Cacheable;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
@@ -141,4 +137,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, Myuser> implements
 		}
 		return null;
 	}
+
+	@Override
+	public JSONObject pageList(Integer current, Integer size, String orgId, String idCard, String mobile, String no, String name, String loginName,HttpServletRequest request) {
+
+		MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
+		headers.add("Blade-Auth", "bearer "+request.getHeader("Blade-Auth"));
+		HttpEntity<LinkedMultiValueMap<String, Object>> param = new HttpEntity<>(null, headers);
+
+		ResponseEntity<String> responseEntity2 = restTemplate.exchange(imaConfig.getGatewayUrl() + "ims-idms/sysuser/page?current={1}&size={2}&orgId={3}&idCard={4}&mobile={5}&no={6}&name={7}&loginName={8}",
+			HttpMethod.GET,param, String.class, current, size, orgId, idCard, mobile, no,name,loginName);
+
+		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
+		//
+		if (200 == responseEntity2.getStatusCodeValue()) {
+
+			return JSON.parseObject(responseEntity2.getBody());
+		}
+		return null;
+
+	}
 }