This commit is contained in:
dinggang 2022-07-29 10:43:29 +08:00
parent 0ccdf069f8
commit 52c4715b8f
6 changed files with 134 additions and 176 deletions

View File

@ -29,7 +29,6 @@ import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
/** /**
* 通知管理 * 通知管理
* *
@ -50,10 +49,10 @@ public class SysNoticeController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:notice:all") // @RequiresPermissions("sys:notice:all")
public Result<PageData<SysNoticeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) { public Result<PageData<SysNoticeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
@ -165,7 +164,7 @@ public class SysNoticeController {
@DeleteMapping @DeleteMapping
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
// @RequiresPermissions("sys:notice:all") //@RequiresPermissions("sys:notice:all")
public Result delete(@RequestBody Long[] ids) { public Result delete(@RequestBody Long[] ids) {
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");

View File

@ -237,7 +237,7 @@ public class ResourceController {
//@RequiresPermissions("resource:resource:save") //@RequiresPermissions("resource:resource:save")
public Result save(@RequestBody ResourceDTO dto, @RequestParam String source) { public Result save(@RequestBody ResourceDTO dto, @RequestParam String source) {
// 效验数据 // 效验数据
logger.info("source:" + source); logger.info("source:{}", source);
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
if ("f".equals(source)) { if ("f".equals(source)) {
dto.setDelFlag(2); // 来自前端页面 走审批流程 dto.setDelFlag(2); // 来自前端页面 走审批流程
@ -257,7 +257,7 @@ public class ResourceController {
public Result importResource(@RequestParam("file") MultipartFile uploadFile, HttpServletRequest request) { public Result importResource(@RequestParam("file") MultipartFile uploadFile, HttpServletRequest request) {
List<Map<String, Object>> dept = List<Map<String, Object>> dept =
jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept"); jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept");
logger.info("上传文件:" + uploadFile.getOriginalFilename()); logger.info("上传文件:{}" , uploadFile.getOriginalFilename());
String format = sdf.format(new Date()); String format = sdf.format(new Date());
File folder = new File(uploadPath + "upload" + File.separator + format); File folder = new File(uploadPath + "upload" + File.separator + format);
logger.info(folder.getPath()); logger.info(folder.getPath());
@ -266,29 +266,20 @@ public class ResourceController {
} }
// 对上传的文件重命名避免文件重名 // 对上传的文件重命名避免文件重名
String oldName = uploadFile.getOriginalFilename(); String oldName = uploadFile.getOriginalFilename();
String newName = UUID.randomUUID().toString() String newName = UUID.randomUUID() + oldName.substring(oldName.lastIndexOf("."));
+ oldName.substring(oldName.lastIndexOf("."));
try { try {
// 文件保存 // 文件保存
File file = new File(folder, newName); File file = new File(folder, newName);
uploadFile.transferTo(file); uploadFile.transferTo(file);
Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(0, dept, resourceService, deptDTO.get().getId())).sheet(0).headRowNumber(1).doReadSync(), executor);
EasyExcel.read(file, new ResourceExcelImportListener(0, dept, resourceService, deptDTO.get().getId())).sheet(0).headRowNumber(1).doReadSync(); CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(1, dept, resourceService, deptDTO.get().getId())).sheet(1).headRowNumber(1).doReadSync(), executor);
}, executor); CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(2, dept, resourceService, deptDTO.get().getId())).sheet(2).headRowNumber(1).doReadSync(), executor);
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(3, dept, resourceService, deptDTO.get().getId())).sheet(3).headRowNumber(1).doReadSync(), executor);
EasyExcel.read(file, new ResourceExcelImportListener(1, dept, resourceService, deptDTO.get().getId())).sheet(1).headRowNumber(1).doReadSync();
}, executor);
CompletableFuture.runAsync(() -> {
EasyExcel.read(file, new ResourceExcelImportListener(2, dept, resourceService, deptDTO.get().getId())).sheet(2).headRowNumber(1).doReadSync();
}, executor);
CompletableFuture.runAsync(() -> {
EasyExcel.read(file, new ResourceExcelImportListener(3, dept, resourceService, deptDTO.get().getId())).sheet(3).headRowNumber(1).doReadSync();
}, executor);
} catch (IOException e) { } catch (IOException e) {
return new Result<String>().error(e.getMessage()); return new Result<String>().error(e.getMessage());
} }
return new Result().ok(LocalDateTime.now().toString()); return new Result<String>().ok(LocalDateTime.now().toString());
} }
@PutMapping("/update") @PutMapping("/update")
@ -318,7 +309,7 @@ public class ResourceController {
@LogOperation("资源转发") @LogOperation("资源转发")
public Result ZywMessage() { public Result ZywMessage() {
String url = "http://15.72.158.81/zyjk/ZywMessage.asmx"; String url = "http://15.72.158.81/zyjk/ZywMessage.asmx";
String parame = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + String param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" + "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
" <soap:Body>\n" + " <soap:Body>\n" +
" </soap:Body>\n" + " </soap:Body>\n" +
@ -326,11 +317,11 @@ public class ResourceController {
HttpHeaders requestHeaders = new HttpHeaders(); HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort"); requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort");
requestHeaders.setContentType(MediaType.TEXT_XML); requestHeaders.setContentType(MediaType.TEXT_XML);
HttpEntity<String> requestEntity = new HttpEntity(parame, requestHeaders); HttpEntity<String> requestEntity = new HttpEntity<>(param, requestHeaders);
try { try {
String body = restTemplate.postForEntity(url, requestEntity, String.class).getBody(); String body = restTemplate.postForEntity(url, requestEntity, String.class).getBody();
String json = body.substring(body.indexOf("{"), body.indexOf("}") + 1); String json = body.substring(body.indexOf("{"), body.indexOf("}") + 1);
HashMap map = JSONObject.parseObject(json, HashMap.class); HashMap map = JSON.parseObject(json, HashMap.class);
return new Result().ok(map); return new Result().ok(map);
} catch (Exception e) { } catch (Exception e) {
return new Result().ok(new HashMap<String, Object>() {{ return new Result().ok(new HashMap<String, Object>() {{
@ -372,13 +363,13 @@ public class ResourceController {
HttpHeaders requestHeaders = new HttpHeaders(); HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.set("SOAPAction", "http://tempuri.org/ZWCJ_mainPort"); requestHeaders.set("SOAPAction", "http://tempuri.org/ZWCJ_mainPort");
requestHeaders.setContentType(new MediaType("text", "xml", Charset.forName("utf-8"))); requestHeaders.setContentType(new MediaType("text", "xml", Charset.forName("utf-8")));
HttpEntity<String> requestEntity = new HttpEntity(parame, requestHeaders); HttpEntity<String> requestEntity = new HttpEntity<>(parame, requestHeaders);
try { try {
String body = restTemplate.postForEntity(url, requestEntity, String.class).getBody(); String body = restTemplate.postForEntity(url, requestEntity, String.class).getBody();
String startTag = "<ZWCJ_mainPortResult>"; String startTag = "<ZWCJ_mainPortResult>";
String endTag = "</ZWCJ_mainPortResult>"; String endTag = "</ZWCJ_mainPortResult>";
String json = body.substring(body.indexOf(startTag) + startTag.length(), body.indexOf(endTag)); String json = body.substring(body.indexOf(startTag) + startTag.length(), body.indexOf(endTag));
HashMap result = JSONObject.parseObject(json, HashMap.class); HashMap result = JSON.parseObject(json, HashMap.class);
List<Map> rows = (List<Map>) result.get("data"); List<Map> rows = (List<Map>) result.get("data");
List<Object> objects = rows.stream() List<Object> objects = rows.stream()
@ -520,8 +511,8 @@ public class ResourceController {
@GetMapping("/selectTotalByDept") @GetMapping("/selectTotalByDept")
@ApiOperation("按照资源类型统计本部门发布的资源") @ApiOperation("按照资源类型统计本部门发布的资源")
@LogOperation("按照资源类型统计本部门发布的资源") @LogOperation("按照资源类型统计本部门发布的资源")
public Result selectTotalByDept() { public Result<Map<String, Object>> selectTotalByDept() {
return new Result().ok(resourceService.selectTotalByDept()); return new Result<Map<String, Object>>().ok(resourceService.selectTotalByDept());
} }
@GetMapping("/getApplyByDept") @GetMapping("/getApplyByDept")

View File

@ -7,6 +7,7 @@ import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.AttrEntity; import io.renren.modules.resource.entity.AttrEntity;
import io.renren.modules.resource.entity.ResourceEntity; import io.renren.modules.resource.entity.ResourceEntity;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -111,7 +112,7 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object getByDept(Map<String, Object> params); Object getByDept(Map<String, Object> params);
Object selectTotalByDept(); HashMap<String, Object> selectTotalByDept();
Object getApplyByDept(Map<String, Object> params); Object getApplyByDept(Map<String, Object> params);

View File

@ -81,8 +81,8 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEntity, ResourceDTO> implements ResourceService { public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEntity, ResourceDTO> implements ResourceService {
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors(); private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newWorkStealingPool(cpuNUm * 3); private static final ExecutorService executor = Executors.newWorkStealingPool(CPU_NUM * 3);
/** /**
* 公共http客户端 * 公共http客户端
@ -90,14 +90,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private static final OkHttpClient client = new OkHttpClient().newBuilder() private static final OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(1, TimeUnit.MINUTES) .connectTimeout(1, TimeUnit.MINUTES)
.readTimeout(1, TimeUnit.MINUTES) .readTimeout(1, TimeUnit.MINUTES)
.connectionPool(new ConnectionPool(cpuNUm * 2, 2, TimeUnit.MINUTES)) .connectionPool(new ConnectionPool(CPU_NUM * 2, 2, TimeUnit.MINUTES))
.retryOnConnectionFailure(false) .retryOnConnectionFailure(false)
.build(); .build();
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
private static final String selectDeptListKey = "selectDeptList"; private static final String SELECT_DEPT_LIST_KEY = "selectDeptList";
private static final String selectDTOPageSpecilTotalKey = "selectDTOPageSpecilTotal"; private static final String SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY = "selectDTOPageSpecilTotal";
@Value("${system.startDay}") @Value("${system.startDay}")
private String systemDay; private String systemDay;
@ -201,6 +201,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
case "creator": case "creator":
wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString()); wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString());
break; break;
default:
break;
} }
}); });
if (params.containsKey("selectType") && "1".equals(params.get("selectType").toString())) { // 创建者查询时 if (params.containsKey("selectType") && "1".equals(params.get("selectType").toString())) { // 创建者查询时
@ -218,7 +220,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY}, allEntries = true)
public void insertWithAttrs(ResourceDTO dto) { public void insertWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity(); ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity); BeanUtils.copyProperties(dto, resourceEntity);
@ -282,7 +284,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY}, allEntries = true)
public void createMixAbility(ResourceDTO dto) { public void createMixAbility(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity(); ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity); BeanUtils.copyProperties(dto, resourceEntity);
@ -326,7 +328,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY}, allEntries = true)
public void deleteWithAttrs(JSONObject jsonObject) { public void deleteWithAttrs(JSONObject jsonObject) {
JSONArray jsonArray = jsonObject.getJSONArray("ids"); JSONArray jsonArray = jsonObject.getJSONArray("ids");
List<Long> idList = jsonArray.toJavaList(Long.class); List<Long> idList = jsonArray.toJavaList(Long.class);
@ -340,7 +342,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY}, allEntries = true)
public void updateWithAttrs(ResourceDTO dto) { public void updateWithAttrs(ResourceDTO dto) {
ResourceEntity resourceEntity = new ResourceEntity(); ResourceEntity resourceEntity = new ResourceEntity();
BeanUtils.copyProperties(dto, resourceEntity); BeanUtils.copyProperties(dto, resourceEntity);
@ -451,9 +453,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
/** /**
* 从本库内查询 * 从本库内查询
*
* @param resultPage
* @return
*/ */
private Page<ResourceDTO> common(Page<ResourceDTO> resultPage, List<Map> selectDTOPageSpecilTotal, ResourceDTO resourceDTO, String orderField, String orderType, Integer pageNum, Integer pageSize) { private Page<ResourceDTO> common(Page<ResourceDTO> resultPage, List<Map> selectDTOPageSpecilTotal, ResourceDTO resourceDTO, String orderField, String orderType, Integer pageNum, Integer pageSize) {
if (resourceDTO.getInfoList().isEmpty()) { if (resourceDTO.getInfoList().isEmpty()) {
@ -533,15 +532,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectTotal() { public Object selectTotal() {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<Map> re = resourceDao.selectTypeCount(null); List<Map> re = resourceDao.selectTypeCount(null);
/*//2022-07-05,ytl修改 start
re.removeIf(r -> {
return org.apache.commons.lang3.StringUtils.equals(r.get("type").toString(), "基础设施");
});
//2022-07-05,ytl修改 end*/
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO_XHA: { // 青岛西海岸 case TSINGTAO_XHA: { // 青岛西海岸
CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
List<Long> result_ = new CopyOnWriteArrayList<>(); List<Long> result = new CopyOnWriteArrayList<>();
CompletableFuture cloud = CompletableFuture cloud =
CompletableFuture.runAsync(() -> { // 云脑专网 CompletableFuture.runAsync(() -> { // 云脑专网
String url = tsingtao_xhaProperties.getCloudcam(); String url = tsingtao_xhaProperties.getCloudcam();
@ -551,7 +545,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (response.isSuccessful()) { if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string()); JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) { if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
result_.add(jsonObject.getLongValue("body")); result.add(jsonObject.getLongValue("body"));
} }
} else { } else {
logger.error("青岛西海岸获取失败"); logger.error("青岛西海岸获取失败");
@ -568,11 +562,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
try (Response response = client.newCall(request).execute()) { try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string()); JSONObject jsonObject = JSON.parseObject(response.body().string());
//if (jsonObject.containsKey("data")) {
// result_.add(jsonObject.getJSONObject("data").getLongValue("total"));
//}
if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) { if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) {
result_.add(jsonObject.getLongValue("body")); result.add(jsonObject.getLongValue("body"));
} }
} else { } else {
logger.error("青岛西海岸获取失败"); logger.error("青岛西海岸获取失败");
@ -583,16 +574,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}, executor); }, executor);
CompletableFuture all = CompletableFuture.allOf(cloud, local); CompletableFuture all = CompletableFuture.allOf(cloud, local);
all.join(); all.join();
return result_.stream().filter(Objects::nonNull).findAny().orElse(0l); return result.stream().filter(Objects::nonNull).findAny().orElse(0L);
}).thenAccept(sum -> { }).thenAccept(sum -> re.add(new HashMap<String, Object>() {
re.add(new HashMap<String, Object>() { {
{ put("count", sum + "");
put("count", sum + ""); put("type", "基础设施");
put("type", "基础设施"); }
} }));
}); Long total;
});
Long total = 0L;
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build(); Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build();
try (Response response = client.newCall(request).execute()) { try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
@ -642,6 +631,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
break; break;
default:
break;
} }
List<String> temp = new ArrayList<>(); List<String> temp = new ArrayList<>();
re.forEach(map -> temp.add(map.get("type").toString())); re.forEach(map -> temp.add(map.get("type").toString()));
@ -730,13 +721,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (page.getRecords().size() < 9) { if (page.getRecords().size() < 9) {
Page<ResourceDTO> resultPage = (Page<ResourceDTO>) this.selectMostPopular(object); Page<ResourceDTO> resultPage = (Page<ResourceDTO>) this.selectMostPopular(object);
do { do {
resultPage.getRecords().forEach(p->{ resultPage.getRecords().forEach(p -> {
//如果集合中不存在则进行添加 //如果集合中不存在则进行添加
if (!page.getRecords().contains(p)){ if (!page.getRecords().contains(p)) {
page.getRecords().add(p); page.getRecords().add(p);
} }
}); });
}while (page.getRecords().size() < 9); } while (page.getRecords().size() < 9);
//for (int i = 0; page.getRecords().size() < 9; i++) { //for (int i = 0; page.getRecords().size() < 9; i++) {
// for (int j = 0; j < page.getRecords().size(); j++) { // for (int j = 0; j < page.getRecords().size(); j++) {
// if (!page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) { // if (!page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) {
@ -763,7 +754,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
@Override @Override
@Cacheable(value = selectDeptListKey, key = "#p1") @Cacheable(value = SELECT_DEPT_LIST_KEY, key = "#p1")
public Object selectDeptList(JSONObject jsonObject, String type) { public Object selectDeptList(JSONObject jsonObject, String type) {
List<Map> resultList = new CopyOnWriteArrayList<>(); List<Map> resultList = new CopyOnWriteArrayList<>();
HashMap<String, Object> resourceMap = new HashMap<>(); HashMap<String, Object> resourceMap = new HashMap<>();
@ -1054,7 +1045,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
@Override @Override
@Cacheable(value = selectDTOPageSpecilTotalKey, key = "#p0") @Cacheable(value = SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY, key = "#p0")
public List<Map> selectDTOPageSpecilTotal(ResourceDTO resourceDTO) { public List<Map> selectDTOPageSpecilTotal(ResourceDTO resourceDTO) {
return resourceDao.selectDTOPageSpecilTotal(resourceDTO); return resourceDao.selectDTOPageSpecilTotal(resourceDTO);
} }
@ -1126,12 +1117,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
* 同步知识库 * 同步知识库
*/ */
@Override @Override
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true) @CacheEvict(cacheNames = {SELECT_DEPT_LIST_KEY, SELECT_DTO_PAGE_SPECIAL_TOTAL_KEY}, allEntries = true)
public void KnowledgeBase() { public void KnowledgeBase() {
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList()); final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
final int pageSize = cpuNUm * 10; final int pageSize = CPU_NUM * 10;
Arrays.stream(catalogIds).map(index -> { Arrays.stream(catalogIds).map(index -> {
logger.info("处理:" + index); logger.info("处理:{}", index);
CopyOnWriteArrayList<CompletableFuture> task = new CopyOnWriteArrayList<>(); CopyOnWriteArrayList<CompletableFuture> task = new CopyOnWriteArrayList<>();
AtomicBoolean end = new AtomicBoolean(true); AtomicBoolean end = new AtomicBoolean(true);
AtomicInteger pageIndex = new AtomicInteger(1); AtomicInteger pageIndex = new AtomicInteger(1);
@ -1139,33 +1130,39 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
do { do {
final long timestamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli(); final long timestamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
int page = pageIndex.getAndIncrement(); int page = pageIndex.getAndIncrement();
logger.info("处理:" + index + " 分页{}", page); logger.info("处理:{}分页{}", index, page);
task.add(CompletableFuture.supplyAsync(() -> { task.add(CompletableFuture.supplyAsync(() -> {
try { try {
logger.info("分页任务处理:" + index + " 分页{} 时间 -->" + timestamp, page); logger.info("分页任务处理:{}分页{} 时间--> {}", index, page, timestamp);
JSONObject bizContentParam = new JSONObject(); JSONObject bizContentParam = new JSONObject();
bizContentParam.put("appkey", appKey); bizContentParam.put("appkey", appKey);
bizContentParam.put("catalogId", index); bizContentParam.put("catalogId", index);
bizContentParam.put("pageIndex", page); bizContentParam.put("pageIndex", page);
bizContentParam.put("pageSize", pageSize); bizContentParam.put("pageSize", pageSize);
String bizContent_ = bizContentParam.toJSONString(); String bizContent = bizContentParam.toJSONString();
logger.info("biz_content参数{}", bizContent_); logger.info("biz_content参数{}", bizContent);
// 通过FormBody对象构建Builder来添加表单参数 // 通过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_); FormBody.Builder signFormBody = new FormBody.Builder().add("app_id", appId)
logger.info(index + "分页{}对接知识库数据请求参数:" + signFormBody.build().contentType().toString(), page); .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(); Request signRequest = new Request.Builder().url(sign).post(signFormBody.build()).build();
Response signResponse = client.newCall(signRequest).execute(); Response signResponse = client.newCall(signRequest).execute();
String signResult = signResponse.body().string(); String signResult = signResponse.body().string();
logger.info("{}分页signResult数据" + signResult, page); logger.info("{}分页signResult数据{}", page, signResult);
JSONObject signJsonObject = JSON.parseObject(signResult); JSONObject signJsonObject = JSON.parseObject(signResult);
if (!signJsonObject.containsKey("data")) { if (!signJsonObject.containsKey("data")) {
logger.info("获取sign异常" + signResult); logger.info("获取sign异常{}", signResult);
end.set(false); end.set(false);
throw new RuntimeException("获取sign异常"); throw new RuntimeException("获取sign异常");
} }
if (signJsonObject.get("data") == null) { if (signJsonObject.get("data") == null) {
logger.info("获取sign异常" + signResult); logger.info("获取sign异常{}", signResult);
end.set(false); end.set(false);
throw new RuntimeException("获取sign异常"); throw new RuntimeException("获取sign异常");
} }
@ -1247,7 +1244,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
infoList.add(attrEntity); infoList.add(attrEntity);
dto.setInfoList(infoList); dto.setInfoList(infoList);
this.insertWithAttrs(dto); this.insertWithAttrs(dto);
logger.info("插入:" + dto.getName()); logger.info("插入:{}", dto.getName());
}); });
}, executor)); }, executor));
try { try {
@ -1431,12 +1428,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public PageData<Map<String, Object>> resourceInfrastructureDetails(Map<String, Object> params) { public PageData<Map<String, Object>> resourceInfrastructureDetails(Map<String, Object> params) {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result;
Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString()); Integer pageSize = Integer.parseInt(params.get("limit").toString());
Object[] pas = {params.get("id"), params.get("id")}; Object[] pas = {params.get("id"), params.get("id")};
List<Map<String, Object>> result2 = new ArrayList<>(); List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) { 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" + 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" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
@ -1452,11 +1449,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
"ORDER BY a.dept_id,b.name\n", pas); "ORDER BY a.dept_id,b.name\n", pas);
} }
if (result2.size() > 0) { if (!result2.isEmpty()) {
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize); List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
result.addAll(partition.get(page)); result = new CopyOnWriteArrayList<>(partition.get(page));
} else { } else {
return new PageData<>(result2, result2.size()); return new PageData<>(result2, 0);
} }
CompletableFuture<Void> resourceCollectionNum01 = CompletableFuture.runAsync(() -> {//被申请数量 resourceCarNum CompletableFuture<Void> resourceCollectionNum01 = CompletableFuture.runAsync(() -> {//被申请数量 resourceCarNum
@ -1483,8 +1480,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> all = CompletableFuture.allOf(resourceCollectionNum01, resourceCollectionNum02, resourceCollectionNum03); CompletableFuture<Void> all = CompletableFuture.allOf(resourceCollectionNum01, resourceCollectionNum02, resourceCollectionNum03);
all.join(); all.join();
PageData<Map<String, Object>> pageData = new PageData<>(result, result2.size()); return new PageData<>(result, result2.size());
return pageData;
} }
@Override @Override
@ -1494,7 +1490,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Integer pageSize = Integer.parseInt(params.get("limit").toString()); Integer pageSize = Integer.parseInt(params.get("limit").toString());
Object[] pas = {params.get("id"), params.get("id")}; Object[] pas = {params.get("id"), params.get("id")};
List<Map<String, Object>> result2 = new ArrayList<>(); List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) { 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" + 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" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
@ -1511,7 +1507,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
if (result2.size() > 0) { if (!result2.isEmpty()) {
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize); List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
result.addAll(partition.get(page)); result.addAll(partition.get(page));
} else { } else {
@ -1542,13 +1538,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> all = CompletableFuture.allOf(resourceCarNum, resourceBrowseNum, resourceCollectionNum); CompletableFuture<Void> all = CompletableFuture.allOf(resourceCarNum, resourceBrowseNum, resourceCollectionNum);
all.join(); all.join();
PageData<Map<String, Object>> pageData = new PageData<>(result, result2.size()); return new PageData<>(result, result2.size());
return pageData;
} }
@Override @Override
public PageData<Map<String, Object>> resourceKnowledgeDetails(Map<String, Object> params) { public PageData<Map<String, Object>> resourceKnowledgeDetails(Map<String, Object> params) {
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result;
Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString()); Integer pageSize = Integer.parseInt(params.get("limit").toString());
Object[] pas = {params.get("id"), params.get("id")}; Object[] pas = {params.get("id"), params.get("id")};
@ -1571,100 +1566,77 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
List<List<Map<String, Object>>> partition = Lists.partition(result, pageSize); List<List<Map<String, Object>>> partition = Lists.partition(result, pageSize);
if (result.size() > 0) { if (!result.isEmpty()) {
PageData<Map<String, Object>> pageData = new PageData<>(partition.get(page), result.size()); return new PageData<>(partition.get(page), result.size());
return pageData;
} else { } else {
return new PageData<>(result, result.size()); return new PageData<>(result, 0);
} }
} }
@Override @Override
public PageData<Map<String, Object>> resourceBusinessUseDetails(Map<String, Object> params) { public PageData<Map<String, Object>> resourceBusinessUseDetails(Map<String, Object> params) {
List<Map<String, Object>> maps = new CopyOnWriteArrayList<>(); List<Map<String, Object>> maps;
Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString()); Integer pageSize = Integer.parseInt(params.get("limit").toString());
Object[] ps = {params.get("id"), params.get("id")}; Object[] ps = {params.get("id"), params.get("id")};
//获取部门列表 //获取部门列表
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list;
if (Long.parseLong(params.get("id").toString()) == 0) { if (Long.parseLong(params.get("id").toString()) == 0) {
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept"); list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept");
} else { } else {
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps); list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps);
} }
if (list.size() > 0) { if (!list.isEmpty()) {
List<List<Map<String, Object>>> partition = Lists.partition(list, pageSize); List<List<Map<String, Object>>> partition = Lists.partition(list, pageSize);
maps.addAll(partition.get(page)); maps = new CopyOnWriteArrayList<>(partition.get(page));
} else { } else {
return new PageData<>(list, list.size()); return new PageData<>(list, 0);
} }
Map<String, Object> paraMap = new ConcurrentHashMap<>(); Map<String, Object> paraMap = new ConcurrentHashMap<>();
paraMap.put("resourceType", params.get("resourceType")); paraMap.put("resourceType", params.get("resourceType"));
//分别根据部门获取组件使用总数和调用数
//申请数
// CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
// maps.forEach(m -> {
// paraMap.put("id", m.get("deptId"));
// Map<String, Object> maps1 = new HashMap<>();
// maps1 = baseDao.assemblyCarByDept(paraMap);
// if (maps1 == null) {
// m.put("resourceCarNum", 0);
// } else {
// m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
// }
// });
// });
//本部门的应用关联的组件数量 //本部门的应用关联的组件数量
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> { CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> maps.forEach(m -> {
maps.forEach(m -> { paraMap.put("id", m.get("deptId"));
paraMap.put("id", m.get("deptId")); Map<String, Object> maps2 = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>(); maps2 = baseDao.assemblyUseByDept(paraMap);
maps2 = baseDao.assemblyUseByDept(paraMap); if (maps2 == null) {
if (maps2 == null) { m.put("resourceUseNum", 0);
m.put("resourceUseNum", 0); } else {
} else { m.put("resourceUseNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
m.put("resourceUseNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum")); }
} }), executor);
});
}, executor);
//还缺少组件调用数,这先用假数据代替 //还缺少组件调用数,这先用假数据代替
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> { CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> maps.forEach(m -> m.put("resourceCallNum", 0)), executor);
maps.forEach(m -> {
m.put("resourceCallNum", 0);
});
}, executor);
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02); CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02);
all.join(); all.join();
PageData<Map<String, Object>> pageData = new PageData<>(maps, list.size()); return new PageData<>(maps, list.size());
return pageData;
} }
@Override @Override
public PageData<Map<String, Object>> resourceDatasUseDetails(Map<String, Object> params) { public PageData<Map<String, Object>> resourceDatasUseDetails(Map<String, Object> params) {
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result;
Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString()); Integer pageSize = Integer.parseInt(params.get("limit").toString());
//查询部门列表 //查询部门列表
Object[] ps = {params.get("id"), params.get("id")}; Object[] ps = {params.get("id"), params.get("id")};
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list;
if (Long.parseLong(params.get("id").toString()) == 0) { if (Long.parseLong(params.get("id").toString()) == 0) {
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept "); list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept ");
} else { } else {
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps); list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps);
} }
if (list.size() > 0) { if (!list.isEmpty()) {
List<List<Map<String, Object>>> partition = Lists.partition(list, pageSize); List<List<Map<String, Object>>> partition = Lists.partition(list, pageSize);
result.addAll(partition.get(page)); result = new ArrayList<>(partition.get(page));
} else { } else {
return new PageData<>(list, list.size()); return new PageData<>(list, 0);
} }
ConcurrentHashMap map = new ConcurrentHashMap(); ConcurrentHashMap map = new ConcurrentHashMap();
map.put("resourceType", params.get("resourceType")); map.put("resourceType", params.get("resourceType"));
@ -1679,13 +1651,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
}); });
PageData<Map<String, Object>> pageData = new PageData<>(result, list.size()); return new PageData<>(result, list.size());
return pageData;
} }
@Override @Override
public List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params) { public List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params) {
List<Map<String, Object>> result = new ArrayList<>(); 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())}; 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 " + 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 " + "INNER JOIN tb_data_resource d ON a.resource_id = d.id WHERE a.del_flag = 0 AND d.type = ? AND " +
@ -1724,7 +1695,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
@Override @Override
public Object selectTotalByDept() { public HashMap<String, Object> selectTotalByDept() {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
Long deptId = SecurityUser.getUser().getDeptId(); Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList = null; List<Long> deptList = null;
@ -1855,17 +1826,17 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectInfrastructureList() { public Object selectInfrastructureList() {
return new HashMap<String, Object>() {{ HashMap<String, Object> resultMap = new HashMap<>();
Map map = (Map) selectTotal(); Map map = (Map) selectTotal();
List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("total"); List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("total");
list.forEach(index -> { list.forEach(index -> {
if ("基础设施".equals(index.get("type").toString())) { if ("基础设施".equals(index.get("type").toString())) {
put("视频资源", Integer.parseInt(index.get("count").toString())); resultMap.put("视频资源", Integer.parseInt(index.get("count").toString()));
} }
}); });
put("感知资源", 0); resultMap.put("感知资源", 0);
put("云资源", 0); resultMap.put("云资源", 0);
}}; return resultMap;
} }
private List<Long> getSourceIdsByProcess(List<HistoricProcessInstance> list) { private List<Long> getSourceIdsByProcess(List<HistoricProcessInstance> list) {
@ -1906,34 +1877,29 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map> result = new ArrayList<>(); List<Map> result = new ArrayList<>();
List<Map<String, Object>> dtoMaps = baseDao.selectDevelopDocResource(); List<Map<String, Object>> dtoMaps = baseDao.selectDevelopDocResource();
Map<String, List<Map<String, Object>>> resourceTypeMap = dtoMaps.stream().collect(Collectors.groupingBy(m -> m.get("type").toString())); Map<String, List<Map<String, Object>>> resourceTypeMap = dtoMaps.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
resourceTypeMap.entrySet().stream().forEach(temp -> { resourceTypeMap.forEach((key, value) -> {
if (!"组件服务".equals(temp.getKey())) { if (!"组件服务".equals(key)) {
Map map = new HashMap(); Map<String, Object> map = new HashMap<>();
map.put("title", temp.getKey()); map.put("title", key);
map.put("children", temp.getValue()); map.put("children", value);
result.add(map); result.add(map);
} }
}); });
if (resourceTypeMap.get("组件服务") != null) { if (resourceTypeMap.get("组件服务") != null) {
Map componentMap = new HashMap(); Map<String, Object> componentMap = new HashMap<>();
componentMap.put("title", "组件服务"); componentMap.put("title", "组件服务");
Map<String, List> map = new ConcurrentHashMap<>(); Map<String, List> map = new ConcurrentHashMap<>();
List<CompletableFuture> tasks = resourceTypeMap.get("组件服务").stream().map(it -> { CompletableFuture.allOf(resourceTypeMap.get("组件服务").stream().map(it -> CompletableFuture.runAsync(() -> selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream()
CompletableFuture task = CompletableFuture.runAsync(() -> { .filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream().filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
if (map.get(attr.getAttrValue()) != null) { if (map.get(attr.getAttrValue()) != null) {
map.get(attr.getAttrValue()).add(it); map.get(attr.getAttrValue()).add(it);
} else { } else {
map.put(attr.getAttrValue(), (List) Collections.synchronizedList(new ArrayList() {{ map.put(attr.getAttrValue(), Collections.synchronizedList(new ArrayList() {{
add(it); add(it);
}})); }}));
} }
}); }), executor)).toArray(CompletableFuture[]::new)).join();
}, executor); componentMap.put("children", map.entrySet().stream().map(it -> new HashMap<String, Object>() {{
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
componentMap.put("children", map.entrySet().stream().map(it -> new HashMap() {{
put("title", it.getKey()); put("title", it.getKey());
put("children", it.getValue()); put("children", it.getValue());
}}).collect(Collectors.toList())); }}).collect(Collectors.toList()));

View File

@ -47,6 +47,7 @@ public class ShiroSessionManager extends DefaultWebSessionManager {
} }
} }
/*@Override /*@Override
protected void onStart(Session session, SessionContext context) { protected void onStart(Session session, SessionContext context) {
log.info("执行onStart"); log.info("执行onStart");

View File

@ -1,7 +1,7 @@
tsingtao-xha.cloudhls=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls tsingtao-xha.cloudhls=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls
tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls
tsingtao-xha.cloudcam=http://10.10.30.9:8001/data_service/getCamera/getCameraCount tsingtao-xha.cloudcam=http://10.10.30.9:8001/data_service/getCamera/getCameraCount
tsingtao-xha.localcam=http://10.134.135.9:8001/data_service/getCamera/getCameraCount tsingtao-xha.localcam=http://10.10.30.57:9537/data_service/getCamera/getCameraCount
tsingtao-xha.resourcecount=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43 tsingtao-xha.resourcecount=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43
tsingtao-xha.resourceapplyinfo=http://10.10.30.24:30058/share-portal/platform/index/abilityMarket/count tsingtao-xha.resourceapplyinfo=http://10.10.30.24:30058/share-portal/platform/index/abilityMarket/count
tsingtao-xha.sjzy=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43 tsingtao-xha.sjzy=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43