Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-06-30 18:59:55 +08:00
commit 8cf701aeef
10 changed files with 68 additions and 31 deletions

View File

@ -28,8 +28,8 @@ public class RestTemplateConfig {
@Bean
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setReadTimeout(30000);//单位为ms
factory.setConnectTimeout(30000);//单位为ms
factory.setReadTimeout(2000);//单位为ms
factory.setConnectTimeout(500);//单位为ms
// SocketAddress address = new InetSocketAddress("127.0.0.1", 8888);
// Proxy proxy = new Proxy(Proxy.Type.HTTP, address);

View File

@ -91,8 +91,9 @@ public class CensusController {
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
CompletableFuture<Void> resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量
List<Map<String, Object>> dbAmount = resourceService.getAmountGroupByType();
Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
Map map = (Map) resourceService.selectTotal();
List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total");
Long sum = dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
return sum;
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {

View File

@ -249,9 +249,9 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(d.id) as num,d.attr_value FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN tb_data_resource c ON a.reference_id = c.id INNER JOIN tb_data_attr d ON c.id = d.data_resource_id\n" +
"WHERE a.del_flag = 0 AND b.dept_id = ? AND c.type = ? AND d.attr_type = '组件类型' \n" +
Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(d.id) as num,d.attr_value FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN tb_data_resource c ON a.reference_id = c.id INNER JOIN tb_data_attr d ON c.id = d.data_resource_id INNER JOIN sys_dept e ON b.dept_id = e.id\n" +
" WHERE a.del_flag = 0 AND (e.id = ? OR INSTR(e.pids,?)) AND c.type = ? AND d.attr_type = '组件类型' \n" +
"GROUP BY d.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
@ -297,10 +297,10 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select AVG(a.score) as score,b.name from tb_resource_score a inner join tb_data_resource b on a.resource_id = b.id\n" +
"inner join sys_user c on a.user_id = c.id \n" +
"where a.del_flag = 0 and b.type = ? and c.dept_id = ?\n" +
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT AVG(a.score) as score,b.name FROM tb_resource_score a INNER JOIN tb_data_resource b on a.resource_id = b.id\n" +
"INNER JOIN sys_dept c ON b.dept_id = c.id\n" +
"WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?))\n" +
"group by b.name order by score desc limit 5", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
@ -377,7 +377,7 @@ public class CensusControllerV3 {
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(distinct(a.key_id)) as appNum,c.attr_value FROM (\n" +
"SELECT a.key_id ,a.reference_id FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.key_id = b.id INNER JOIN sys_dept c on b.dept_id = c.id WHERE a.del_flag = 0 AND c.id = ? OR INSTR(c.pids,?) ORDER BY a.key_id \n" +
") a \n" +
"INNER JOIN tb_data_resource b ON a.reference_id = b.id INNER JOIN tb_data_attr c \tON a.reference_id = c.data_resource_id \n" +
"INNER JOIN tb_data_resource b ON a.reference_id = b.id INNER JOIN tb_data_attr c ON a.reference_id = c.data_resource_id \n" +
"WHERE c.attr_type = '组件类型' GROUP BY c.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);

View File

@ -54,6 +54,7 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
if (!params.containsKey("creator")) {
wrapper.eq("flag", 3); // 默认只出审核通过
}
wrapper.orderByDesc("create_date");
return wrapper;
}

View File

@ -543,4 +543,11 @@ public class ResourceController {
public Result selectDeptResourceByApplyNum(@ApiIgnore @RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectDeptResourceByApplyNum(params));
}
@GetMapping("/selectInfrastructureList")
@ApiOperation("共享门户-能力汇聚-查询基础设施列表")
@LogOperation("共享门户-能力汇聚-查询基础设施列表")
public Result selectInfrastructureList() {
return new Result().ok(resourceService.selectInfrastructureList());
}
}

View File

@ -125,4 +125,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object selectDayMax();
Object selectInfrastructureList();
}

View File

@ -16,7 +16,8 @@ import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.common.utils.DateUtils;
import io.renren.modules.activiti.dto.ProcessActivityDTO;
import io.renren.modules.monitor.entity.CameraChannel;
import io.renren.modules.monitor.mapper.CameraChannelMapper;
import io.renren.modules.processForm.dao.TAbilityApplicationDao;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
@ -39,7 +40,6 @@ import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dao.SysDeptDao;
import io.renren.modules.sys.dto.SysPostDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
@ -88,6 +88,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private static final String selectDeptListKey = "selectDeptList";
private static final String selectDTOPageSpecilTotalKey = "selectDTOPageSpecilTotal";
@Value("${system.startDay}")
private String systemDay;
@Value("${project.place}")
private Integer projectPlace;
@ -118,9 +121,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Value("${zsk.catalogIds}")
private String[] catalogIds;
@Value("${system.startDay}")
private String systemDay;
@Autowired
private ResourceDao resourceDao;
@ -142,6 +142,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private SysDeptDao sysDeptDao;
@Autowired
private CameraChannelMapper cameraChannelMapper;
@Autowired
private TAbilityApplicationDao tAbilityApplicationDao;
@ -391,7 +394,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Long> ids = new ArrayList<>();
switch (orderType) {
case "DESC": // total 倒序
ids = selectDTOPageSpecilTotal.parallelStream().map(index -> (Map) index).sorted(Comparator.comparing(x -> {
ids = 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);
@ -401,7 +404,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
).collect(Collectors.toList());
break;
case "ASC": // total 升序
ids = selectDTOPageSpecilTotal.parallelStream().map(index -> (Map) index).sorted(Comparator.comparing(x -> {
ids = 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);
}
@ -499,7 +502,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
});
CompletableFuture all = CompletableFuture.allOf(cloud, local);
all.join();
return result_.stream().filter(index -> index != null).findAny().orElse(0l);
return result_.stream().filter(Objects::nonNull).findAny().orElse(0l);
}).thenAccept(sum -> {
re.add(new HashMap<String, Object>() {
{
@ -544,6 +547,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
put("type", "数据资源");
}
});
re.add(new HashMap<String, Object>() {
{
QueryWrapper<CameraChannel> queryWrapper = new QueryWrapper<>();
put("count", cameraChannelMapper.selectCount(queryWrapper) + "");
put("type", "基础设施");
}
});
}
break;
}
@ -581,7 +593,8 @@ 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);
ResourceBrowseEntity browseEntity = new ResourceBrowseEntity();
browseEntity.setResourceId(id);
@ -1096,7 +1109,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
result.addAll(partition.get(page));
} else {
return new PageData<>(result2, result2.size());
return new PageData<>(result2, 0);
}
ConcurrentHashMap hashMap = new ConcurrentHashMap();
@ -1640,6 +1653,21 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return resourceDao.selectDayMax();
}
@Override
public Object selectInfrastructureList() {
return new HashMap<String, Object>() {{
Map map = (Map) selectTotal();
List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("total");
list.forEach(index ->{
if ("基础设施".equals(index.get("type").toString())) {
put("视频资源", Integer.parseInt(index.get("count").toString()));
}
});
put("感知资源", 0);
put("云资源", 0);
}};
}
private List<Long> getSourceIdsByProcess(List<HistoricProcessInstance> list) {
List<Long> resourceIds = new ArrayList<>();
for (HistoricProcessInstance his : list) {

View File

@ -50,11 +50,9 @@
<select id="countApplyAll" resultType="java.lang.Long">
SELECT
COUNT( id )
COUNT(*)
FROM
t_ability_application
WHERE
approve_status = '通过'
( SELECT DISTINCT instance_id FROM t_ability_application WHERE 1 = 1 ) temp
</select>
<select id="getAmountGroupByType" resultType="java.util.Map">

View File

@ -189,6 +189,7 @@
<if test="type != null and type != ''">
AND type = #{type}
</if>
AND type != '赋能案例'
GROUP BY type
ORDER BY type
</select>
@ -516,6 +517,7 @@
tb_data_resource
WHERE
del_flag = 0
AND type != '赋能案例'
GROUP BY
type
</select>
@ -1077,9 +1079,9 @@
COUNT( tdav.data_resource_id ) AS total
FROM
( select a.* from tb_data_attr a inner join tb_data_resource d on a.data_resource_id = d.id
inner join tb_data_resource_rel e on e.reference_id = d.id inner join sys_user f on e.creator = f.id where
d.type=#{resourceType}
and f.dept_id = #{id}
inner join tb_data_resource_rel e on e.reference_id = d.id inner join sys_user f on e.creator = f.id
inner join sys_dept g on f.dept_id = g.id
where d.type=#{resourceType} and (g.id = #{id} OR instr(g.pids,#{id}))
) tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 )

View File

@ -72,8 +72,6 @@
<select id="getApp4PartById" resultType="java.util.Map">
SELECT
tdrr.reference_id AS id,
tdr.name,
tdr.*
FROM
tb_data_resource_rel tdrr