From cb134396b3a1d4d4d4d76194a3df5035381d45ca Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Mon, 27 Jun 2022 18:05:44 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=94=B3=E8=B4=AD=E8=BD=A6=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9=202.=E5=88=A0=E9=99=A4syst?= =?UTF-8?q?em.out=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusControllerV3.java | 1 - .../entity/TbDataResourceRelEntity.java | 10 ++-- .../controller/ResourceCarController.java | 16 ++++++ .../resourceCar/dao/ResourceCarDao.java | 12 ++++ .../service/ResourceCarService.java | 5 ++ .../service/impl/ResourceCarServiceImpl.java | 16 ++++++ .../sys/controller/SysDeptController.java | 1 - .../sys/service/impl/SysUserServiceImpl.java | 1 - .../mapper/resourceCar/ResourceCarDao.xml | 57 +++++++++++++++++++ .../io/renren/common/utils/JhlDAPTool.java | 49 +--------------- 10 files changed, 112 insertions(+), 56 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java index 7dbb1408..01110bc2 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java @@ -384,7 +384,6 @@ public class CensusControllerV3 { if(keywords != null){ treeMatch(result,keywords); } - System.out.println("部门树--》"+result.size()); return new Result>().ok(result); } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java index a948fc39..6353ffe2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java @@ -27,11 +27,11 @@ public class TbDataResourceRelEntity { private Long referenceId; /** * 删除标志: -0:正常; -1:已删除; -2:待审核; -3:审核中; -9其他 + 0:正常; + 1:已删除; + 2:待审核; + 3:审核中; + 9其他 */ private Integer delFlag; /** diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java index d9bca9e2..8f8a233a 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java @@ -88,4 +88,20 @@ public class ResourceCarController { return new Result(); } + @GetMapping("/selectResourceCarGroupByDept") + @ApiOperation("查询申购车资源所属部门列表") + @LogOperation("查询申购车资源所属部门列表") + public Result selectResourceCarGroupByDept(@RequestParam String name, + @RequestParam Integer pageNum, + @RequestParam Integer pageSize) { + return new Result().ok(resourceCarService.selectResourceCarGroupByDept(name, pageNum, pageSize)); + } + + @GetMapping("/selectResourceListByDept") + @ApiOperation("根据部门查询申购车资源列表") + @LogOperation("根据部门查询申购车资源列表") + public Result selectResourceListByDept(@RequestParam Long deptId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) { + return new Result().ok(resourceCarService.selectResourceListByDept(deptId, pageNum, pageSize)); + } + } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java index 5f28383d..7dcd919a 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java @@ -25,4 +25,16 @@ public interface ResourceCarDao extends BaseDao { @Param("pageSize") Integer pageSize); Integer delete4Resource(@Param("resourceIds") List idList); + + List selectResourceCarGroupByDept(@Param("userId") Long userId, + @Param("pageNum") Integer pageNum, + @Param("pageSize") Integer pageSize, + @Param("name") String name); + + List selectResourceListByDept(@Param("userId") Long userId, + @Param("deptId") Long deptId, + @Param("pageNum") Integer pageNum, + @Param("pageSize") Integer pageSize); + + Integer selectProvideDeptCount(@Param("userId") Long userId, @Param("name") String name); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java index f17bc06e..bf339fbc 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java @@ -3,6 +3,7 @@ package io.renren.modules.resourceCar.service; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import io.renren.common.service.CrudService; +import io.renren.common.utils.Result; import io.renren.modules.resourceCar.dto.ResourceCarDTO; import io.renren.modules.resourceCar.entity.ResourceCarEntity; @@ -23,4 +24,8 @@ public interface ResourceCarService extends CrudService selectPage(Map params); Object total(); + + Object selectResourceCarGroupByDept(String name, Integer pageNum, Integer pageSize); + + Object selectResourceListByDept(Long deptId, Integer pageNum, Integer pageSize); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java index d7f6d22d..4fd695c5 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java @@ -100,4 +100,20 @@ public class ResourceCarServiceImpl extends CrudServiceImpl resultMap = new HashMap<>(); + List maps = resourceCarDao.selectResourceCarGroupByDept(userId, (pageNum - 1 ) * pageSize, pageSize, name); + resultMap.put("list", maps); + resultMap.put("deptCount", resourceCarDao.selectProvideDeptCount(userId, name)); + return resultMap; + } + + @Override + public Object selectResourceListByDept(Long deptId, Integer pageNum, Integer pageSize) { + Long userId = SecurityUser.getUserId(); + return resourceCarDao.selectResourceListByDept(userId, deptId, (pageNum - 1 ) * pageSize, pageSize); + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java index b3985ddb..4e4d2956 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java @@ -62,7 +62,6 @@ public class SysDeptController { if(keywords != null){ treeMatch(result,keywords); } - System.out.println("部门树--》"+result.size()); return new Result>().ok(result); } /** ytl 2022-06-23 新增 end **/ diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java index b52d59b7..993fd7a8 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java @@ -346,7 +346,6 @@ public class SysUserServiceImpl extends BaseServiceImpl"+deptNew.getName()); sysDeptDao.insert(deptNew); } }); diff --git a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml index 5016b4a0..8c0a2e86 100644 --- a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml @@ -60,4 +60,61 @@ LIMIT ${pageNum}, ${pageSize} + + + + + + \ No newline at end of file diff --git a/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java b/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java index 7041aae3..999485dd 100644 --- a/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java +++ b/renren-common/src/main/java/io/renren/common/utils/JhlDAPTool.java @@ -44,13 +44,10 @@ public class JhlDAPTool { env.put("java.naming.ldap.attributes.binary","objectGUID"); try { ctx = new InitialLdapContext(env, connCtls); - System.out.println( "连接成功" ); return ctx; } catch (javax.naming.AuthenticationException e) { - System.out.println("连接失败:"); e.printStackTrace(); } catch (Exception e) { - System.out.println("连接出错:"+e.getMessage()); e.printStackTrace(); } return null; @@ -76,7 +73,7 @@ public class JhlDAPTool { public List readLdap(LdapContext ctx){//OU=即墨区, List lm=new ArrayList(1000); - byte[] cookie = null; + byte[] cookie; try { if(ctx!=null) { @@ -89,33 +86,21 @@ public class JhlDAPTool { do { NamingEnumeration answer = ctx.search("", "sAMAccountType=805306368", searchControls); - //NamingEnumeration answer = ctx.search("", "objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=gov,DC=cn", searchControls); while (answer.hasMore()) { SearchResult result = (SearchResult) answer.next(); NamingEnumeration attrs = result.getAttributes().getAll(); - //System.out.println("getNameInNamespace-》"+result.getNameInNamespace());//CN=李平先,OU=抬三,OU=即墨普东中心社区,OU=即墨中心社区,OU=即墨区,DC=qd,DC=gov,DC=cn Map user = new HashMap<>(); while (attrs.hasMore()) { Attribute next = attrs.next(); - //System.out.println(next); - if ("displayName".equals(next.getID())) { user.put("real_name",next.get().toString()); - //user.setDisplayName(next.get().toString()); }else if("sAMAccountName".equals(next.getID())){ user.put("username",next.get().toString()); - //user.setSamaccountName(next.get().toString()); }else if("userPrincipalName".equals(next.getID())){ user.put("email",next.get().toString()); - //user.setUserPrincipalName(next.get().toString()); }else if("telephoneNumber".equals(next.getID())){ user.put("mobile",next.get().toString()); - //user.setTelephoneNumber(next.get().toString()); }else if("distinguishedName".equals(next.getID())){ - //CN=葛琳,OU=城阳区疾病预防控制中心,OU=城阳区卫生健康局,OU=区属机关,OU=城阳区,DC=qd,DC=gov,DC=cn -// String distinguishedName = next.get().toString(); -// String[] distinguishedNames = distinguishedName.split(","); -// String deptName = distinguishedNames[1].split("=")[1]; user.put("distinguishedName",next.get().toString()); }else if("objectGUID".equals(next.getID())){ String guidStr = next.getID().toString(); @@ -126,7 +111,6 @@ public class JhlDAPTool { } } lm.add(user); - } cookie = parseControls(ctx.getResponseControls()); ctx.setRequestControls(new Control[]{new PagedResultsControl(2, cookie, Control.CRITICAL)}); @@ -134,12 +118,10 @@ public class JhlDAPTool { } }catch (Exception e) { - System.out.println("获取用户信息异常:"); e.printStackTrace(); }finally { closeContext(); } - System.out.println(lm.size()); return lm; } @@ -156,45 +138,20 @@ public class JhlDAPTool { try { if(ctx!=null) { - - //过滤条件 - //String filter = "(&(objectClass=*)(uid=*))"; - //String filter = "(&(userAccountControl=66048)(sAMAccountType=805306368))"; - //String[] attrPersonArray = {"sAMAccountName", "distinguishedName", "displayName"}; - //String[] attrPersonArray = { "uid", "userPassword", "displayName", "cn", "sn", "mail", "description","uidNumber","gidNumber" }; - - //2. 设置查询的属性 SearchControls searchControls = new SearchControls();//搜索控件 searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);//搜索范围,1只搜索指定命名对象的一个级别,这是缺省值,2以指定命名对象为根结点的整棵树 SearchControls.SUBTREE_SCOPE - //searchControls.setReturningAttributes(attrPersonArray); - //分页 ctx.setRequestControls(new Control[]{new PagedResultsControl(2, Control.CRITICAL)}); - - //IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator(); do { - //3.(1)要搜索的上下文或对象的名称;(2).过滤条件,可为null,默认搜索所有信息;(3).搜索控件,可为null,使用默认的搜索控件 - //objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=gov,DC=cn - //sAMAccountType=805306368 - NamingEnumeration answer = ctx.search("", filter, searchControls); - //NamingEnumeration answer = ctx.search("", "objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=gov,DC=cn", searchControls); - - // answer = ctx.search("",filter.toString(),searchControls); while (answer.hasMore()) { SearchResult result = (SearchResult) answer.next(); NamingEnumeration attrs = result.getAttributes().getAll(); - //System.out.println(result.getName());//CN=李平先,OU=抬三,OU=即墨普东中心社区,OU=即墨中心社区 - //System.out.println(result.getClass()); - System.out.println("getNameInNamespace-》"+result.getNameInNamespace());//CN=李平先,OU=抬三,OU=即墨普东中心社区,OU=即墨中心社区,OU=即墨区,DC=qd,DC=gov,DC=cn Map dept = new HashMap<>(); while (attrs.hasMore()) { Attribute next = attrs.next(); - //System.out.println(next); - if ("name".equals(next.getID())) { String name = next.get().toString(); dept.put("name",name); - //dept.put("id",SingleID.getSingleID(name)); }else if("distinguishedName".equals(next.getID())){ //OU=事业发展中心,OU=办公厅,OU=人大常委会,DC=qd,DC=gov,DC=cn dept.put("namespace",next.get()); @@ -216,7 +173,6 @@ public class JhlDAPTool { if(!dept.get("name").toString().contains("停用") && !dept.get("name").toString().contains("删除") && !dept.get("name").toString().contains("人员") && !dept.get("name").toString().contains("临时")){ lm.add(dept); } - //System.out.println("-----------------------------------------------"); } cookie = parseControls(ctx.getResponseControls()); ctx.setRequestControls(new Control[]{new PagedResultsControl(2, cookie, Control.CRITICAL)}); @@ -224,12 +180,10 @@ public class JhlDAPTool { } }catch (Exception e) { - System.out.println("获取区域信息异常:"); e.printStackTrace(); }finally { closeContext(); } - System.out.println(lm.size()); return lm; } @@ -282,7 +236,6 @@ public class JhlDAPTool { if (controls[i] instanceof PagedResultsResponseControl) { PagedResultsResponseControl prrc = (PagedResultsResponseControl) controls[i]; cookie = prrc.getCookie(); - System.out.println(">>Next Page \n"); } } }