Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java
This commit is contained in:
commit
8efd7866aa
|
@ -412,7 +412,6 @@ public class CensusControllerV3 {
|
|||
if(keywords != null){
|
||||
treeMatch(result,keywords);
|
||||
}
|
||||
System.out.println("部门树--》"+result.size());
|
||||
return new Result<List<SysDeptDTO>>().ok(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
@Param("orderField") String orderField,
|
||||
@Param("orderType") String orderType);
|
||||
|
||||
Long selectDTOPageCount(@Param("dto") ResourceDTO resourceDTO);
|
||||
|
||||
List<Map> selectApplyArea(Long userId);
|
||||
|
||||
/**
|
||||
|
@ -49,6 +51,7 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
|
||||
/**
|
||||
* 介入部门数目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long countAllDept();
|
||||
|
@ -113,15 +116,21 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
List<Map> selectResourceNumAsType(Map<String, Object> params);
|
||||
|
||||
Integer selectResourceCarNum(Map params);
|
||||
|
||||
Integer selectResourceCollectionNum(Map params);
|
||||
|
||||
Integer selectResourceBrowseNum(Map params);
|
||||
|
||||
Integer selectResourceRelNum(Map params);
|
||||
|
||||
Integer selectResourceShare(Map params);
|
||||
// List<Map<String,Object>> selectDeptList(Map params);
|
||||
List<Map<String,Object>> selectResurceCarDetails(Map params);
|
||||
List<Map<String,Object>> applicationAreaCapabilityList(Map params);
|
||||
List<Map<String,Object>> applicationUsedAreaCapabilityList(Map params);
|
||||
List<Map<String,Object>> applicationAreaCapabilityUseList(Map params);
|
||||
Map<String,Object> assemblyCarByDept(Map params);
|
||||
Map<String,Object> assemblyUseByDept(Map params);
|
||||
|
||||
// List<Map<String,Object>> selectDeptList(Map params);
|
||||
List<Map<String, Object>> selectResurceCarDetails(Map params);
|
||||
|
||||
List<Map<String, Object>> applicationAreaCapabilityList(Map params);
|
||||
|
||||
List<Map<String, Object>> applicationUsedAreaCapabilityList(Map params);
|
||||
|
||||
List<Map<String, Object>> applicationAreaCapabilityUseList(Map params);
|
||||
}
|
|
@ -27,11 +27,11 @@ public class TbDataResourceRelEntity {
|
|||
private Long referenceId;
|
||||
/**
|
||||
* 删除标志:
|
||||
0:正常;
|
||||
1:已删除;
|
||||
2:待审核;
|
||||
3:审核中;
|
||||
9其他
|
||||
0:正常;
|
||||
1:已删除;
|
||||
2:待审核;
|
||||
3:审核中;
|
||||
9其他
|
||||
*/
|
||||
private Integer delFlag;
|
||||
/**
|
||||
|
|
|
@ -143,10 +143,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
break;
|
||||
}
|
||||
});
|
||||
if (params.containsKey("selectType") && "1" .equals(params.get("selectType").toString())) { // 创建者查询时
|
||||
if (params.containsKey("selectType") && "1".equals(params.get("selectType").toString())) { // 创建者查询时
|
||||
wrapper.ne("del_flag", 1);
|
||||
} else if (params.containsKey("selectType") && "0" .equals(params.get("selectType").toString())) {
|
||||
if (params.containsKey("delFlag") && !"" .equals(params.get("delFlag").toString())) {
|
||||
} else if (params.containsKey("selectType") && "0".equals(params.get("selectType").toString())) {
|
||||
if (params.containsKey("delFlag") && !"".equals(params.get("delFlag").toString())) {
|
||||
wrapper.eq("del_flag", params.get("delFlag"));
|
||||
} else {
|
||||
wrapper.in(true, "del_flag", 0, 5);
|
||||
|
@ -247,7 +247,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if (resourceDTO.getInfoList().isEmpty()) {
|
||||
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType);
|
||||
resultPage.setRecords(resourceDTOS);
|
||||
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size());
|
||||
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
|
||||
} else {
|
||||
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
|
||||
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
|
||||
|
@ -255,10 +255,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resultPage.setRecords(null);
|
||||
resultPage.setTotal(0);
|
||||
} else {
|
||||
ArrayList<ResourceDTO> recordLists = new ArrayList<>();
|
||||
for (int i = (pageNum - 1) * pageSize; i < j; i++) {
|
||||
recordLists.add(resourceDTOS.get(i));
|
||||
}
|
||||
List<ResourceDTO> recordLists = resourceDTOS.stream()
|
||||
.skip((pageNum - 1) * pageSize).limit(pageSize)
|
||||
.map(dto_ -> {
|
||||
ResourceDTO temp = dto_;
|
||||
ResourceDTO get = this.get(dto_.getId());
|
||||
BeanUtils.copyProperties(get, dto_);
|
||||
dto_.setInfoList(temp.getInfoList());
|
||||
return dto_;
|
||||
}).collect(Collectors.toList());
|
||||
resultPage.setRecords(recordLists);
|
||||
resultPage.setTotal(resourceDTOS.size());
|
||||
}
|
||||
|
@ -266,7 +271,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
break;
|
||||
case TSINGTAO_XHA: {
|
||||
if ("基础设施" .equals(resourceDTO.getType())) { // 基础设施
|
||||
if ("基础设施".equals(resourceDTO.getType())) { // 基础设施
|
||||
logger.info("西海岸基础设施");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
@ -313,7 +318,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if (resourceDTO.getInfoList().isEmpty()) {
|
||||
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType);
|
||||
resultPage.setRecords(resourceDTOS);
|
||||
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size());
|
||||
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
|
||||
} else {
|
||||
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
|
||||
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
|
||||
|
@ -321,10 +326,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resultPage.setRecords(null);
|
||||
resultPage.setTotal(0);
|
||||
} else {
|
||||
ArrayList<ResourceDTO> recordLists = new ArrayList<>();
|
||||
for (int i = (pageNum - 1) * pageSize; i < j; i++) {
|
||||
recordLists.add(resourceDTOS.get(i));
|
||||
}
|
||||
List<ResourceDTO> recordLists = resourceDTOS.stream()
|
||||
.skip((pageNum - 1) * pageSize).limit(pageSize)
|
||||
.map(dto_ -> {
|
||||
ResourceDTO temp = dto_;
|
||||
ResourceDTO get = this.get(dto_.getId());
|
||||
BeanUtils.copyProperties(get, dto_);
|
||||
dto_.setInfoList(temp.getInfoList());
|
||||
return dto_;
|
||||
}).collect(Collectors.toList());
|
||||
resultPage.setRecords(recordLists);
|
||||
resultPage.setTotal(resourceDTOS.size());
|
||||
}
|
||||
|
@ -551,7 +561,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
|
||||
//区级要根据行政区划多加一层结构
|
||||
listMap.entrySet().stream().filter(index -> !"区级" .equals(index.getKey())).forEach(item -> {
|
||||
listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).forEach(item -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", item.getKey());
|
||||
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
|
||||
|
@ -750,7 +760,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> applicationAreaCapabilityUseList(Map params){
|
||||
public List<Map<String, Object>> applicationAreaCapabilityUseList(Map params) {
|
||||
return resourceDao.applicationAreaCapabilityUseList(params);
|
||||
}
|
||||
|
||||
|
@ -882,7 +892,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
AttrEntity attrEntity = new AttrEntity();
|
||||
attrEntity.setDelFlag(0);
|
||||
attrEntity.setAttrType("文件类型");
|
||||
if ("f49561afc7204f008c4bb3cd821eb6ba" .equals(index)) {
|
||||
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(index)) {
|
||||
attrEntity.setAttrValue("政府公报");
|
||||
} else {
|
||||
attrEntity.setAttrValue("政策解读");
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -73,7 +73,6 @@ public class SysDeptController {
|
|||
if(keywords != null){
|
||||
treeMatch(result,keywords);
|
||||
}
|
||||
|
||||
return new Result<List<SysDeptDTO>>().ok(result);
|
||||
}
|
||||
/** ytl 2022-06-23 新增 end **/
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -6,9 +6,10 @@ spring:
|
|||
#MySQL
|
||||
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
|
||||
#url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
|
||||
url: jdbc:mysql://15.2.21.221:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
|
||||
username: root
|
||||
password: Hisense2019
|
||||
password: Liwen073898!
|
||||
#Hisense2019
|
||||
# #Oracle
|
||||
# driver-class-name: oracle.jdbc.OracleDriver
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
<select id="selectWithAttrs" resultMap="resourceDTO">
|
||||
SELECT
|
||||
DISTINCT tdr.*,
|
||||
DISTINCT tdr.id,
|
||||
IFNULL(taa2.approve_status, '未申请') AS "applyState",
|
||||
IFNULL(trs.score, 0 ) AS "score",
|
||||
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
||||
|
@ -193,7 +193,36 @@
|
|||
|
||||
<select id="selectMostPopular" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
||||
SELECT
|
||||
tdr.*,
|
||||
tdr.id,
|
||||
tdr.`type`,
|
||||
tdr.`name`,
|
||||
tdr.description,
|
||||
tdr.link,
|
||||
tdr.api_method_type,
|
||||
tdr.api_url,
|
||||
tdr.group_id,
|
||||
tdr.dept_id,
|
||||
tdr.dept_contacts,
|
||||
tdr.dept_phone,
|
||||
tdr.share_type,
|
||||
tdr.share_mode,
|
||||
tdr.share_condition,
|
||||
tdr.district_id,
|
||||
tdr.visits,
|
||||
tdr.del_flag,
|
||||
tdr.creator,
|
||||
tdr.create_date,
|
||||
tdr.updater,
|
||||
tdr.update_date,
|
||||
tdr.note1,
|
||||
tdr.note2,
|
||||
tdr.note3,
|
||||
tdr.note4,
|
||||
tdr.note5,
|
||||
tdr.enclosure,
|
||||
tdr.undercarriage_reason,
|
||||
tdr.undercarriage_user_name,
|
||||
tdr.info_list,
|
||||
IFNULL(trs.score, 0 ) AS "score",
|
||||
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
||||
IFNULL(trc.collectCount, 0) AS "collectCount",
|
||||
|
@ -252,7 +281,36 @@
|
|||
<!-- AND tdr.id = #{id}-->
|
||||
|
||||
SELECT
|
||||
tdr.*,
|
||||
tdr.id,
|
||||
tdr.`type`,
|
||||
tdr.`name`,
|
||||
tdr.description,
|
||||
tdr.link,
|
||||
tdr.api_method_type,
|
||||
tdr.api_url,
|
||||
tdr.group_id,
|
||||
tdr.dept_id,
|
||||
tdr.dept_contacts,
|
||||
tdr.dept_phone,
|
||||
tdr.share_type,
|
||||
tdr.share_mode,
|
||||
tdr.share_condition,
|
||||
tdr.district_id,
|
||||
tdr.visits,
|
||||
tdr.del_flag,
|
||||
tdr.creator,
|
||||
tdr.create_date,
|
||||
tdr.updater,
|
||||
tdr.update_date,
|
||||
tdr.note1,
|
||||
tdr.note2,
|
||||
tdr.note3,
|
||||
tdr.note4,
|
||||
tdr.note5,
|
||||
tdr.enclosure,
|
||||
tdr.undercarriage_reason,
|
||||
tdr.undercarriage_user_name,
|
||||
tdr.info_list,
|
||||
IFNULL( trs.score, 0 ) AS "score",
|
||||
IFNULL( taa.applyCount, 0 ) AS "applyCount",
|
||||
IFNULL( trc.collectCount, 0 ) AS "collectCount",
|
||||
|
@ -292,7 +350,36 @@
|
|||
|
||||
<select id="selectDTOPage" resultType="io.renren.modules.resource.dto.ResourceDTO">
|
||||
SELECT
|
||||
tdr.*,
|
||||
tdr.id,
|
||||
tdr.`type`,
|
||||
tdr.`name`,
|
||||
tdr.description,
|
||||
tdr.link,
|
||||
tdr.api_method_type,
|
||||
tdr.api_url,
|
||||
tdr.group_id,
|
||||
tdr.dept_id,
|
||||
tdr.dept_contacts,
|
||||
tdr.dept_phone,
|
||||
tdr.share_type,
|
||||
tdr.share_mode,
|
||||
tdr.share_condition,
|
||||
tdr.district_id,
|
||||
tdr.visits,
|
||||
tdr.del_flag,
|
||||
tdr.creator,
|
||||
tdr.create_date,
|
||||
tdr.updater,
|
||||
tdr.update_date,
|
||||
tdr.note1,
|
||||
tdr.note2,
|
||||
tdr.note3,
|
||||
tdr.note4,
|
||||
tdr.note5,
|
||||
tdr.enclosure,
|
||||
tdr.undercarriage_reason,
|
||||
tdr.undercarriage_user_name,
|
||||
tdr.info_list,
|
||||
IFNULL(trs.score, 0 ) AS "score",
|
||||
IFNULL(taa.applyCount, 0 ) AS "applyCount",
|
||||
IFNULL(trc.collectCount, 0) AS "collectCount",
|
||||
|
@ -342,6 +429,37 @@
|
|||
ORDER BY ${orderField} ${orderType}
|
||||
LIMIT ${pageNum}, ${pageSize}
|
||||
</select>
|
||||
<select id="selectDTOPageCount" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(DISTINCT tdr.id)
|
||||
FROM
|
||||
tb_data_resource tdr
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
<if test="dto.name != null and dto.name != ''">
|
||||
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
|
||||
<!--AND tdr.name LIKE CONCAT('%',#{dto.name},'%') -->
|
||||
</if>
|
||||
<if test="dto.type != null and dto.type != ''">
|
||||
AND tdr.type = #{dto.type}
|
||||
</if>
|
||||
<if test="dto.districtId != null and dto.districtId != ''">
|
||||
AND tdr.district_id = #{dto.districtId}
|
||||
</if>
|
||||
<if test="null != dto.deptIds and dto.deptIds.size > 0">
|
||||
AND tdr.dept_id IN
|
||||
<foreach collection="dto.deptIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.shareCondition != null and dto.shareCondition != ''">
|
||||
AND tdr.share_condition = #{dto.shareCondition}
|
||||
</if>
|
||||
<if test="dto.deptId != null and dto.deptId != ''">
|
||||
AND tdr.dept_id = #{dto.deptId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectApplyArea" resultType="java.util.Map">
|
||||
SELECT
|
||||
|
|
|
@ -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>
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue