diff --git a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java index 4ee455ac..bd6b7492 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java @@ -1,6 +1,7 @@ package io.renren.common.aspect; +import com.alibaba.fastjson.JSON; import io.renren.common.annotation.ActivitiNoticeOperation; import io.renren.modules.notice.dto.SysNoticeDTO; import io.renren.modules.notice.enums.NoticeStatusEnum; @@ -200,7 +201,7 @@ public class ActivitiNoticeAspect { */ private void end_notice(final DelegateExecution execution, final ActivitiNoticeOperation activitiNoticeOperation) { Map kv = execution.getVariables(); - logger.error("表单:" + kv.toString()); + logger.error("表单:" + JSON.toJSONString(kv)); if (work_.contains(ExecutionListener.EVENTNAME_END + kv.get("id").toString())) { logger.error("------------出现重放------------"); return; @@ -229,9 +230,9 @@ public class ActivitiNoticeAspect { String finalCreator = creator; String finalResult = result; Long resourceId = null; - if (kv.containsKey("resourceId")) { + if (kv.containsKey("resourceId") && kv.get("resourceId") != null) { resourceId = Long.valueOf(kv.get("resourceId").toString()); - } else if (kv.containsKey("id")) { + } else if (kv.containsKey("id") && kv.get("id") != null) { resourceId = Long.valueOf(kv.get("id").toString()); } Optional resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java index 191e266d..77722914 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java @@ -78,6 +78,10 @@ public class AbilityCenterController { return new Result().error("联系管理员添加流程"); } return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> { + if (index.get("resourceId") == null) { + logger.error("未携带资源id"); + return null; + } if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 logger.error("重复发起申请"); return null; diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java index dd7b6173..cfb84061 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java @@ -183,7 +183,7 @@ public class CensusControllerV2 { String sql = String.format("SELECT COUNT(id) FROM tb_data_resource WHERE dept_id = %s AND type = '应用资源' AND del_flag = 0;", index.get("id").toString()); logger.info(sql); Long count = jdbcTemplate.queryForObject(sql, Long.class); - if (!"0".equals(index.get("pid").toString()) && higher) { // 有上级部门 且 配置资源归属上级 + if (!"0" .equals(index.get("pid").toString()) && higher) { // 有上级部门 且 配置资源归属上级 Optional sysDeptDTO = Optional.ofNullable(sysDeptService.get(Long.valueOf(index.get("pid").toString()))); if (sysDeptDTO.isPresent() && sysDeptDTO.get().getType() != null && sysDeptDTO.get().getType() >= 2) { @@ -413,7 +413,7 @@ public class CensusControllerV2 { HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto); result.add(new HashMap() { { - put("amount", dataResource.get("rows")); + put("amount", (dataResource != null && dataResource.containsKey("rows") && dataResource.get("rows") != null) ? dataResource.get("rows") : 0); put("type", "总数据数"); } }); @@ -431,7 +431,7 @@ public class CensusControllerV2 { }); result.add(new HashMap() { { - List lists = (List) dataResource.get("data"); + List lists = (dataResource != null && dataResource.containsKey("data") && dataResource.get("data") != null) ? (List) dataResource.get("data") : new ArrayList<>(); ArrayList list = new ArrayList<>(); lists.forEach(item -> { list.add(new HashMap() {{ @@ -462,10 +462,22 @@ public class CensusControllerV2 { }); } } else { + result.add(new HashMap() { + { + put("amount", 0L); + put("type", "总数据数"); + } + }); logger.error("青岛西海岸获取失败"); } } catch (Exception exception) { logger.error("青岛西海岸失败", exception); + result.add(new HashMap() { + { + put("amount", 0L); + put("type", "总数据数"); + } + }); } OkHttpClient client1 = new OkHttpClient(); @@ -496,13 +508,46 @@ public class CensusControllerV2 { }).collect(Collectors.toList())); } }); - } } else { logger.error("青岛西海岸获取失败"); + result.add(new HashMap() { + { + put("amount", 0L); + put("type", "总申请次数"); + } + }); + result.add(new HashMap() { + { + put("amount", 0); + put("type", "满足率"); + } + }); + result.add(new HashMap() { + { + put("resourceTop5", new ArrayList<>()); + } + }); } } catch (Exception exception) { logger.error("青岛西海岸失败", exception); + result.add(new HashMap() { + { + put("amount", 0L); + put("type", "总申请次数"); + } + }); + result.add(new HashMap() { + { + put("amount", 0); + put("type", "满足率"); + } + }); + result.add(new HashMap() { + { + put("resourceTop5", new ArrayList<>()); + } + }); } } break; diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 5a87ef3a..9fc8630a 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -158,7 +158,7 @@ public class ResourceServiceImpl extends CrudServiceImpl attrEntities = dto.getInfoList(); + List attrEntities_ = new ArrayList<>(); if (attrEntities != null) { attrEntities.forEach(item -> { item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); item.setDataResourceId(resourceID); attrDao.insert(item); + attrEntities_.add(item); }); } + resourceEntity.setInfoList(attrEntities_); + resourceDao.updateById(resourceEntity); } @Override @Transactional - @CacheEvict(key = selectDeptListKey, allEntries = true) + @CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true) public void deleteWithAttrs(JSONObject jsonObject) { JSONArray jsonArray = jsonObject.getJSONArray("ids"); List idList = jsonArray.toJavaList(Long.class); @@ -196,7 +200,7 @@ public class ResourceServiceImpl extends CrudServiceImpl 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 = 100;