1.共享门户和能力统计对资源等信息统计逻辑修改

2.需求中心按时间倒序
This commit is contained in:
dinggang 2022-06-30 18:41:44 +08:00
parent f67de9cf52
commit 87cc41c22b
9 changed files with 57 additions and 20 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

@ -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>

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