1.申购车分页查询修改

2.删除system.out代码
This commit is contained in:
dinggang 2022-06-27 18:05:44 +08:00
parent f4670d45cd
commit cb134396b3
10 changed files with 112 additions and 56 deletions

View File

@ -384,7 +384,6 @@ public class CensusControllerV3 {
if(keywords != null){
treeMatch(result,keywords);
}
System.out.println("部门树--》"+result.size());
return new Result<List<SysDeptDTO>>().ok(result);
}

View File

@ -27,11 +27,11 @@ public class TbDataResourceRelEntity {
private Long referenceId;
/**
* 删除标志
0:正常
1:已删除
2:待审核
3:审核中
9其他
0:正常
1:已删除
2:待审核
3:审核中
9其他
*/
private Integer delFlag;
/**

View File

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

View File

@ -25,4 +25,16 @@ public interface ResourceCarDao extends BaseDao<ResourceCarEntity> {
@Param("pageSize") Integer pageSize);
Integer delete4Resource(@Param("resourceIds") List<Long> idList);
List<Map> selectResourceCarGroupByDept(@Param("userId") Long userId,
@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize,
@Param("name") String name);
List<Map> 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);
}

View File

@ -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<ResourceCarEntity, Resou
IPage<ResourceCarDTO> selectPage(Map<String, Object> params);
Object total();
Object selectResourceCarGroupByDept(String name, Integer pageNum, Integer pageSize);
Object selectResourceListByDept(Long deptId, Integer pageNum, Integer pageSize);
}

View File

@ -100,4 +100,20 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
resultMap.put("count", count);
return resultMap;
}
@Override
public Object selectResourceCarGroupByDept(String name, Integer pageNum, Integer pageSize) {
Long userId = SecurityUser.getUserId();
HashMap<Object, Object> resultMap = new HashMap<>();
List<Map> 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);
}
}

View File

@ -62,7 +62,6 @@ public class SysDeptController {
if(keywords != null){
treeMatch(result,keywords);
}
System.out.println("部门树--》"+result.size());
return new Result<List<SysDeptDTO>>().ok(result);
}
/** ytl 2022-06-23 新增 end **/

View File

@ -346,7 +346,6 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
deptNew.setDistrict(Long.valueOf(list.get("district").toString()));
deptNew.setType(Integer.parseInt(list.get("type").toString()));
if(dept == null){
System.out.println("deptname->"+deptNew.getName());
sysDeptDao.insert(deptNew);
}
});

View File

@ -60,4 +60,61 @@
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="selectResourceCarGroupByDept" resultType="java.util.Map">
SELECT
res.dept_id AS "deptId",
dept.name AS "deptName",
COUNT(car.id) AS "count"
FROM
tb_resource_car car,
tb_data_resource res,
sys_dept dept
WHERE car.user_id = #{userId}
AND car.resource_id = res.id
AND res.dept_id = dept.id
<if test="name != null and name != ''">
AND res.name LIKE CONCAT('%',#{name},'%')
</if>
GROUP BY res.dept_id
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="selectResourceListByDept" resultType="java.util.Map">
SELECT
res.id AS "resourceId",
res.NAME AS "resourceName",
res.description,
res.type,
res.del_flag AS "delFlag"
FROM
tb_resource_car car,
tb_data_resource res
WHERE 1 = 1
AND car.resource_id = res.id
AND car.user_id = #{userId}
AND res.dept_id = #{deptId}
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="selectProvideDeptCount" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
(
SELECT
tdr.dept_id
FROM
tb_resource_car trc
LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id
WHERE
1 = 1
AND trc.user_id = #{userId}
<if test="name != null and name != ''">
AND tdr.name LIKE CONCAT('%',#{name},'%')
</if>
GROUP BY
tdr.dept_id
) temp
</select>
</mapper>

View File

@ -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<Map> readLdap(LdapContext ctx){//OU=即墨区,
List<Map> lm=new ArrayList<Map>(1000);
byte[] cookie = null;
byte[] cookie;
try {
if(ctx!=null) {
@ -89,33 +86,21 @@ public class JhlDAPTool {
do {
NamingEnumeration<SearchResult> answer = ctx.search("", "sAMAccountType=805306368", searchControls);
//NamingEnumeration<SearchResult> answer = ctx.search("", "objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=gov,DC=cn", searchControls);
while (answer.hasMore()) {
SearchResult result = (SearchResult) answer.next();
NamingEnumeration<? extends Attribute> attrs = result.getAttributes().getAll();
//System.out.println("getNameInNamespace-》"+result.getNameInNamespace());//CN=李平先,OU=抬三,OU=即墨普东中心社区,OU=即墨中心社区,OU=即墨区,DC=qd,DC=gov,DC=cn
Map<String,Object> 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<SearchResult> answer = ctx.search("", filter, searchControls);
//NamingEnumeration<SearchResult> answer = ctx.search("", "objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=gov,DC=cn", searchControls);
//<SearchResult> answer = ctx.search("",filter.toString(),searchControls);
while (answer.hasMore()) {
SearchResult result = (SearchResult) answer.next();
NamingEnumeration<? extends Attribute> 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<String,Object> 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");
}
}
}