数据资源统计修改
This commit is contained in:
parent
bf5628d97f
commit
f4d0001b85
|
@ -388,7 +388,7 @@ public class CensusControllerV2 {
|
|||
});
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", 0l);
|
||||
put("amount", 0L);
|
||||
put("type", "总申请次数");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -15,6 +15,8 @@ import io.renren.common.domain.Tsingtao_xhaProperties;
|
|||
import io.renren.common.service.impl.CrudServiceImpl;
|
||||
import io.renren.modules.resource.dao.AttrDao;
|
||||
import io.renren.modules.resource.dao.ResourceDao;
|
||||
import io.renren.modules.resource.dataResource.domain.TsingtaoDataResourceService;
|
||||
import io.renren.modules.resource.dto.GetDataResourceListDto;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.entity.AttrEntity;
|
||||
import io.renren.modules.resource.entity.ResourceEntity;
|
||||
|
@ -377,7 +379,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
logger.error("青岛西海岸失败", exception);
|
||||
}
|
||||
});
|
||||
CompletableFuture.allOf(cloud, local);
|
||||
CompletableFuture all = CompletableFuture.allOf(cloud, local);
|
||||
all.join();
|
||||
return result_.stream().filter(index -> index != null).findAny().orElse(0l);
|
||||
}).thenAccept(sum -> {
|
||||
re.add(new HashMap<String, Object>() {
|
||||
|
@ -387,8 +390,44 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
});
|
||||
});
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Long total = 0L;
|
||||
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
if (response.isSuccessful()) {
|
||||
JSONObject jsonObject = JSON.parseObject(response.body().string());
|
||||
if (jsonObject.containsKey("data")) {
|
||||
total = jsonObject.getJSONObject("data").getLongValue("total");
|
||||
Long finalTotal = total;
|
||||
re.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", finalTotal);
|
||||
put("type", "数据资源");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
logger.error("青岛西海岸获取失败");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("青岛西海岸失败", exception);
|
||||
}
|
||||
allAmount.join();
|
||||
}
|
||||
break;
|
||||
case TSINGTAO: {
|
||||
//青岛市局数据资源
|
||||
TsingtaoDataResourceService tsingtaoDataResourceService = new TsingtaoDataResourceService();
|
||||
GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto().setPageNum(1).setPageSize(5);
|
||||
HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto);
|
||||
re.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("count", dataResource.get("rows") + "");
|
||||
put("type", "数据资源");
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
resultMap.put("total", re);
|
||||
return resultMap;
|
||||
|
@ -873,11 +912,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
Object[] pas = {params.get("id"), params.get("id"), page, pageSize};
|
||||
|
||||
List<Map<String, Object>> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" +
|
||||
List<Map<String, Object>> 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 b.pids like CONCAT(CONCAT('%',?),'%'))\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" +
|
||||
"LIMIT ?,?", pas);
|
||||
|
@ -951,10 +990,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
Object[] pas = {params.get("id"), params.get("id"), page, pageSize};
|
||||
|
||||
List<Map<String, Object>> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
List<Map<String, Object>> 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" +
|
||||
"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" +
|
||||
"LIMIT ?,?", pas);
|
||||
|
@ -989,10 +1028,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
Object[] pas = {params.get("id"), params.get("id"), page, pageSize};
|
||||
|
||||
List<Map<String, Object>> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
List<Map<String, Object>> 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" +
|
||||
"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" +
|
||||
"LIMIT ?,?", pas);
|
||||
|
@ -1033,10 +1072,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
Object[] pas = {params.get("id"), params.get("id"), page, pageSize};
|
||||
|
||||
List<Map<String, Object>> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
List<Map<String, Object>> 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" +
|
||||
"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" +
|
||||
"LIMIT ?,?", pas);
|
||||
|
@ -1077,10 +1116,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
Object[] pas = {params.get("id"), params.get("id"), page, pageSize};
|
||||
|
||||
List<Map<String, Object>> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
List<Map<String, Object>> 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" +
|
||||
"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" +
|
||||
"LIMIT ?,?", pas);
|
||||
|
@ -1138,11 +1177,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
Object[] ps = {params.get("id"), params.get("resourceType"), (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()), Integer.parseInt(params.get("limit").toString())};
|
||||
result = jdbcTemplate.queryForList("\n" +
|
||||
"SELECT a.*,b.username,c.name as resourcename from tb_resource_car a inner join sys_user b on a.user_id = b.id \n" +
|
||||
"inner join tb_data_resource c on a.resource_id = c.id \n" +
|
||||
"where b.dept_id = ? and c.type = ?\n" +
|
||||
"order by a.create_date desc \n" +
|
||||
"limit ?,?\n",ps);
|
||||
"SELECT a.*,b.username,c.name AS resourcename FROM tb_resource_car a INNER JOIN sys_user b ON a.user_id = b.id \n" +
|
||||
"INNER JOIN tb_data_resource c ON a.resource_id = c.id \n" +
|
||||
"WHERE b.dept_id = ? AND c.type = ?\n" +
|
||||
"ORDER BY a.create_date DESC \n" +
|
||||
"LIMIT ?,?\n", ps);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue