This commit is contained in:
parent
e602317a7a
commit
5b5ec4d05d
|
@ -88,12 +88,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
/**
|
||||
* 公共http客户端
|
||||
*/
|
||||
private static final OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.connectTimeout(1, TimeUnit.MINUTES)
|
||||
.readTimeout(1, TimeUnit.MINUTES)
|
||||
.connectionPool(new ConnectionPool(CPU_NUM * 2, 2, TimeUnit.MINUTES))
|
||||
.retryOnConnectionFailure(false)
|
||||
.build();
|
||||
private static final OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(1, TimeUnit.MINUTES).readTimeout(1, TimeUnit.MINUTES).connectionPool(new ConnectionPool(CPU_NUM * 2, 2, TimeUnit.MINUTES)).retryOnConnectionFailure(false).build();
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
|
||||
|
||||
|
@ -476,25 +471,19 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
case "DESC": // total 倒序
|
||||
ids = customThreadPool.submit(() -> {
|
||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
Map index = (Map) x;
|
||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
}
|
||||
).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x ->
|
||||
Long.valueOf(x.get("id").toString())
|
||||
).limit(pageSize).collect(Collectors.toList());
|
||||
Map index = (Map) x;
|
||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
}).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
return temp;
|
||||
}).get();
|
||||
break;
|
||||
case "ASC": // total 升序
|
||||
ids = customThreadPool.submit(() -> {
|
||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
String string = (x.get("total") == null) ? "0" : x.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
}
|
||||
)).skip((pageNum - 1) * pageSize).limit(pageSize).map(x ->
|
||||
Long.valueOf(x.get("id").toString())
|
||||
).limit(pageSize).collect(Collectors.toList());
|
||||
String string = (x.get("total") == null) ? "0" : x.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
})).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
return temp;
|
||||
}).get();
|
||||
break;
|
||||
|
@ -524,13 +513,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resultPage.setRecords(new ArrayList<>());
|
||||
resultPage.setTotal(0);
|
||||
} else {
|
||||
List<ResourceDTO> recordLists = resourceDTOS.stream()
|
||||
.skip((pageNum - 1) * pageSize).limit(pageSize)
|
||||
.map(dto_ -> {
|
||||
ResourceDTO get = this.selectWithAttrs(dto_.getId());
|
||||
BeanUtils.copyProperties(get, dto_);
|
||||
return dto_;
|
||||
}).collect(Collectors.toList());
|
||||
List<ResourceDTO> recordLists = resourceDTOS.stream().skip((pageNum - 1) * pageSize).limit(pageSize).map(dto_ -> {
|
||||
ResourceDTO get = this.selectWithAttrs(dto_.getId());
|
||||
BeanUtils.copyProperties(get, dto_);
|
||||
return dto_;
|
||||
}).collect(Collectors.toList());
|
||||
resultPage.setRecords(recordLists);
|
||||
resultPage.setTotal(resourceDTOS.size());
|
||||
}
|
||||
|
@ -541,9 +528,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
public List<AttrEntity> selectAttrsByResourceId(Long resourceId) {
|
||||
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("data_resource_id", resourceId)
|
||||
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
|
||||
.orderByDesc("attr_type");
|
||||
wrapper.eq("data_resource_id", resourceId).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderByDesc("attr_type");
|
||||
return attrDao.selectList(wrapper);
|
||||
}
|
||||
|
||||
|
@ -555,42 +540,40 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
case TSINGTAO_XHA: { // 青岛西海岸
|
||||
CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
|
||||
List<Long> result = new CopyOnWriteArrayList<>();
|
||||
CompletableFuture cloud =
|
||||
CompletableFuture.runAsync(() -> { // 云脑专网
|
||||
String url = tsingtao_xhaProperties.getCamCount();
|
||||
logger.info(url);
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
if (response.isSuccessful()) {
|
||||
JSONObject jsonObject = JSON.parseObject(response.body().string());
|
||||
if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
|
||||
result.add(jsonObject.getLongValue("body"));
|
||||
}
|
||||
} else {
|
||||
logger.error("青岛西海岸获取失败");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("青岛西海岸失败", exception);
|
||||
CompletableFuture cloud = CompletableFuture.runAsync(() -> { // 云脑专网
|
||||
String url = tsingtao_xhaProperties.getCamCount();
|
||||
logger.info(url);
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
if (response.isSuccessful()) {
|
||||
JSONObject jsonObject = JSON.parseObject(response.body().string());
|
||||
if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
|
||||
result.add(jsonObject.getLongValue("body"));
|
||||
}
|
||||
}, executor);
|
||||
CompletableFuture local =
|
||||
CompletableFuture.runAsync(() -> { // 金宏网
|
||||
String url = tsingtao_xhaProperties.getLocalcam();
|
||||
logger.info(url);
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
if (response.isSuccessful()) {
|
||||
JSONObject jsonObject = JSON.parseObject(response.body().string());
|
||||
if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
|
||||
result.add(jsonObject.getLongValue("body"));
|
||||
}
|
||||
} else {
|
||||
logger.error("青岛西海岸获取失败");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("青岛西海岸失败", exception);
|
||||
} else {
|
||||
logger.error("青岛西海岸获取失败");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("青岛西海岸失败", exception);
|
||||
}
|
||||
}, executor);
|
||||
CompletableFuture local = CompletableFuture.runAsync(() -> { // 金宏网
|
||||
String url = tsingtao_xhaProperties.getLocalcam();
|
||||
logger.info(url);
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
if (response.isSuccessful()) {
|
||||
JSONObject jsonObject = JSON.parseObject(response.body().string());
|
||||
if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
|
||||
result.add(jsonObject.getLongValue("body"));
|
||||
}
|
||||
}, executor);
|
||||
} else {
|
||||
logger.error("青岛西海岸获取失败");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("青岛西海岸失败", exception);
|
||||
}
|
||||
}, executor);
|
||||
CompletableFuture all = CompletableFuture.allOf(cloud, local);
|
||||
all.join();
|
||||
return result.stream().filter(Objects::nonNull).findAny().orElse(0L);
|
||||
|
@ -638,11 +621,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
re.add(new HashMap<String, Object>() {
|
||||
{
|
||||
QueryWrapper<CameraChannel> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("check_status", 1)
|
||||
.ne("gps_x", "")
|
||||
.ne("gps_y", "")
|
||||
.isNotNull("gps_x")
|
||||
.isNotNull("gps_y");
|
||||
queryWrapper.eq("check_status", 1).ne("gps_x", "").ne("gps_y", "").isNotNull("gps_x").isNotNull("gps_y");
|
||||
put("count", cameraChannelMapper.selectCount(queryWrapper) + "");
|
||||
put("type", "基础设施");
|
||||
}
|
||||
|
@ -699,8 +678,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
ResourceEntity entity = new ResourceEntity();
|
||||
entity.setVisits((resourceEntity.getVisits() == null ? 0 : resourceEntity.getVisits()) + 1);
|
||||
UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId())
|
||||
.eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
|
||||
updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId()).eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
|
||||
resourceDao.update(entity, updateWrapper);
|
||||
|
||||
Integer num = jdbcTemplate.queryForObject("SELECT round(tb_data_resource_assignmark.total) FROM tb_data_resource_assignmark WHERE id =" + id, Integer.class);
|
||||
|
@ -782,21 +760,20 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
|
||||
//区级要根据行政区划多加一层结构
|
||||
List<CompletableFuture> tasks =
|
||||
listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).map(item -> {
|
||||
CompletableFuture task = CompletableFuture.runAsync(() -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", item.getKey());
|
||||
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
|
||||
map.put("total", integer);
|
||||
item.getValue().forEach(item1 -> item1.remove("type"));
|
||||
map.put("dataList", item.getValue());
|
||||
if (integer != 0) {
|
||||
resultList.add(map);
|
||||
}
|
||||
}, executor);
|
||||
return task;
|
||||
}).collect(Collectors.toList());
|
||||
List<CompletableFuture> tasks = listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).map(item -> {
|
||||
CompletableFuture task = CompletableFuture.runAsync(() -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", item.getKey());
|
||||
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
|
||||
map.put("total", integer);
|
||||
item.getValue().forEach(item1 -> item1.remove("type"));
|
||||
map.put("dataList", item.getValue());
|
||||
if (integer != 0) {
|
||||
resultList.add(map);
|
||||
}
|
||||
}, executor);
|
||||
return task;
|
||||
}).collect(Collectors.toList());
|
||||
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
|
||||
|
||||
Optional<List<Map<String, Object>>> areaList = Optional.ofNullable(listMap.get("区级"));
|
||||
|
@ -1062,8 +1039,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
public Object getApplyCameraList(Long instanceId) {
|
||||
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("instance_id", instanceId)
|
||||
.eq("approve_status", "通过");
|
||||
queryWrapper.eq("instance_id", instanceId).eq("approve_status", "通过");
|
||||
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
|
||||
ArrayList cameraList = new ArrayList();
|
||||
applicationEntities.forEach(index -> {
|
||||
|
@ -1137,7 +1113,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
do {
|
||||
final long timestamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
|
||||
int page = pageIndex.getAndIncrement();
|
||||
logger.info("处理:{}分页{}", index, page);
|
||||
logger.info("处理:{} 分页{}", index, page);
|
||||
task.add(CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
logger.info("分页任务处理:{}分页{} 时间--> {}", index, page, timestamp);
|
||||
|
@ -1149,19 +1125,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
String bizContent = bizContentParam.toJSONString();
|
||||
logger.info("biz_content参数:{}", bizContent);
|
||||
// 通过FormBody对象构建Builder来添加表单参数
|
||||
FormBody.Builder signFormBody = new FormBody.Builder().add("app_id", appId)
|
||||
.add("interface_id", methodId).
|
||||
add("version", version).
|
||||
add("timestamp", String.valueOf(timestamp)).
|
||||
add("origin", origin).
|
||||
add("charset", charset).
|
||||
add("biz_content", bizContent);
|
||||
logger.info("{}分页{}对接知识库数据请求参数:{}", index, page, signFormBody.build().contentType().toString());
|
||||
FormBody.Builder signFormBody = new FormBody.Builder().add("app_id", appId).add("interface_id", methodId).add("version", version).add("timestamp", String.valueOf(timestamp)).add("origin", origin).add("charset", charset).add("biz_content", bizContent);
|
||||
logger.info("{} 分页 {} 对接知识库数据请求参数:{}", index, page, signFormBody.build().contentType().toString());
|
||||
|
||||
Request signRequest = new Request.Builder().url(sign).post(signFormBody.build()).build();
|
||||
Response signResponse = client.newCall(signRequest).execute();
|
||||
String signResult = signResponse.body().string();
|
||||
logger.info("{}分页signResult数据:{}", page, signResult);
|
||||
logger.info("{} 分页signResult数据:{}", page, signResult);
|
||||
JSONObject signJsonObject = JSON.parseObject(signResult);
|
||||
if (!signJsonObject.containsKey("data")) {
|
||||
logger.info("获取sign异常:{}", signResult);
|
||||
|
@ -1202,7 +1172,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
}, executor).thenAcceptAsync(list -> {
|
||||
logger.info("知识库数据量:{}", list.size());
|
||||
if (list.isEmpty()) {
|
||||
if (list.isEmpty() || list.size() < pageSize) {
|
||||
end.set(false);
|
||||
}
|
||||
customThreadPool.submit(() -> {
|
||||
|
@ -1258,9 +1228,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
customThreadPool.shutdown();
|
||||
}, executor));
|
||||
try {
|
||||
Thread.sleep(300L);
|
||||
Thread.sleep(100L); // 防止任务运行过快,无法跳出循环
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
logger.info("知识库同步异常", e);
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
} while (end.get() || pageIndex.get() < maxPage.get());
|
||||
return task;
|
||||
|
@ -1295,20 +1266,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
List<Map<String, Object>> result2;
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" +
|
||||
"SUM(a.visits) AS resourceVisits \n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '组件服务' AND a.del_flag = 0\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n");
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + "SUM(a.visits) AS resourceVisits \n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '组件服务' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
|
||||
} else {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" +
|
||||
"SUM(a.visits) AS resourceVisits \n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '组件服务' AND a.del_flag = 0\n" +
|
||||
"AND (b.ID = ? OR INSTR(b.pids,?))\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n", pas);
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + "SUM(a.visits) AS resourceVisits \n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '组件服务' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
|
||||
}
|
||||
|
||||
if (!result2.isEmpty()) {
|
||||
|
@ -1386,18 +1346,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
List<Map<String, Object>> result2;
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '应用资源' AND a.del_flag = 0\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n");
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '应用资源' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
|
||||
} else {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '应用资源' AND a.del_flag = 0\n" +
|
||||
"AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n", pas);
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '应用资源' AND a.del_flag = 0\n" + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
|
||||
}
|
||||
|
||||
if (!result2.isEmpty()) {
|
||||
|
@ -1487,18 +1438,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
List<Map<String, Object>> result2;
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '基础设施' AND a.del_flag = 0\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n");
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '基础设施' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
|
||||
} else {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '基础设施' AND a.del_flag = 0\n" +
|
||||
"AND (b.ID = ? OR INSTR(b.pids,?))\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n", pas);
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '基础设施' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
|
||||
}
|
||||
|
||||
if (!result2.isEmpty()) {
|
||||
|
@ -1544,18 +1486,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
List<Map<String, Object>> result2;
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '数据资源' AND a.del_flag = 0\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n");
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '数据资源' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
|
||||
} else {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '数据资源' AND a.del_flag = 0\n" +
|
||||
"AND (b.ID = ? OR INSTR(b.pids,?))\n" +
|
||||
"GROUP BY a.dept_id,b.name\n" +
|
||||
"ORDER BY a.dept_id,b.name\n", pas);
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '数据资源' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1601,20 +1534,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
Object[] pas = {params.get("id"), params.get("id")};
|
||||
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
result = jdbcTemplate.queryForList(
|
||||
"SELECT COUNT(a.id) AS resourceNum,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '知识库' AND a.del_flag = 0\n" +
|
||||
"GROUP BY b.name\n" +
|
||||
"ORDER BY b.name ");
|
||||
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '知识库' AND a.del_flag = 0\n" + "GROUP BY b.name\n" + "ORDER BY b.name ");
|
||||
} else {
|
||||
result = jdbcTemplate.queryForList(
|
||||
"SELECT COUNT(a.id) AS resourceNum,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
"WHERE a.type = '知识库' AND a.del_flag = 0\n" +
|
||||
"AND (b.ID = ? OR INSTR(b.pids,?))\n" +
|
||||
"GROUP BY b.name\n" +
|
||||
"ORDER BY b.name ", pas);
|
||||
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '知识库' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY b.name\n" + "ORDER BY b.name ", pas);
|
||||
}
|
||||
|
||||
List<List<Map<String, Object>>> partition = Lists.partition(result, pageSize);
|
||||
|
@ -1710,9 +1632,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
public List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params) {
|
||||
List<Map<String, Object>> result;
|
||||
Object[] ps = {params.get("resourceType"), params.get("id"), (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()), Integer.parseInt(params.get("limit").toString())};
|
||||
result = jdbcTemplate.queryForList("SELECT a.* FROM tb_resource_car a INNER JOIN sys_user b ON a.creator = b.id " +
|
||||
"INNER JOIN tb_data_resource d ON a.resource_id = d.id WHERE a.del_flag = 0 AND d.type = ? AND " +
|
||||
"d.dept_id = ? AND d.del_flag = 0 ORDER BY a.create_date DESC LIMIT ?,?", ps);
|
||||
result = jdbcTemplate.queryForList("SELECT a.* FROM tb_resource_car a INNER JOIN sys_user b ON a.creator = b.id " + "INNER JOIN tb_data_resource d ON a.resource_id = d.id WHERE a.del_flag = 0 AND d.type = ? AND " + "d.dept_id = ? AND d.del_flag = 0 ORDER BY a.create_date DESC LIMIT ?,?", ps);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1903,8 +1823,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resourceIds.add(Long.parseLong(abilityApplicationDTO1.getResourceId()));
|
||||
} else {
|
||||
TResourceMountApplyDTO resourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(his.getBusinessKey()));
|
||||
if (resourceMountApplyDTO != null && resourceMountApplyDTO.getResourceDTO() != null
|
||||
&& resourceMountApplyDTO.getResourceDTO().getId() != null) {
|
||||
if (resourceMountApplyDTO != null && resourceMountApplyDTO.getResourceDTO() != null && resourceMountApplyDTO.getResourceDTO().getId() != null) {
|
||||
resourceIds.add(resourceMountApplyDTO.getResourceDTO().getId());
|
||||
if (resourceMountApplyDTO.getResourceId() != null) {
|
||||
ResourceDTO resourceDTO = get(resourceMountApplyDTO.getResourceId());
|
||||
|
|
Loading…
Reference in New Issue