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 cfdf9fd8..00e3064e 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 @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; +import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -42,6 +43,8 @@ import java.util.stream.Collectors; public class CensusControllerV2 { @Value("${project.place}") private Integer projectPlace; + @Value("${project.higher}") + private Boolean higher; private static final Logger logger = LoggerFactory.getLogger(CensusControllerV2.class); @Autowired @@ -175,7 +178,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())) { // 有上级部门 + 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) { @@ -195,7 +198,7 @@ public class CensusControllerV2 { re.put("deptName", sysDeptService.get(Long.valueOf(index)).getName()); re.put("count", i.get(index).stream().mapToLong(index_ -> index_.values().stream().mapToLong(count_ -> count_).sum()).sum()); return re; - }).collect(Collectors.toList()); + }).filter(index -> ObjectUtils.allNotNull(index)).collect(Collectors.toList()); result.sort(Comparator.comparing(x -> { ObjectMapper mapper = new ObjectMapper(); try { @@ -344,10 +347,10 @@ public class CensusControllerV2 { result_.add(jsonObject.getJSONObject("data").getLongValue("total")); } } else { - logger.error("包头获取失败"); + logger.error("青岛西海岸获取失败"); } } catch (Exception exception) { - logger.error("包头失败", exception); + logger.error("青岛西海岸失败", exception); } }); CompletableFuture local = @@ -363,10 +366,10 @@ public class CensusControllerV2 { result_.add(jsonObject.getJSONObject("data").getLongValue("total")); } } else { - logger.error("包头获取失败"); + logger.error("青岛西海岸获取失败"); } } catch (Exception exception) { - logger.error("包头失败", exception); + logger.error("青岛西海岸失败", exception); } }); CompletableFuture.allOf(cloud, local); diff --git a/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java b/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java index cb7bf161..c7bc2dac 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/controller/SysNoticeController.java @@ -17,11 +17,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import java.util.Arrays; import java.util.Map; @@ -34,6 +38,7 @@ import java.util.Map; @RequestMapping("sys/notice") @Api(tags = "通知管理") public class SysNoticeController { + private static Logger logger = LoggerFactory.getLogger(SysNoticeController.class); @Autowired private SysNoticeService sysNoticeService; @Autowired @@ -89,9 +94,19 @@ public class SysNoticeController { @PutMapping("mynotice/read/{noticeId}") @ApiOperation("标记我的通知为已读") - public Result read(@PathVariable("noticeId") Long noticeId) { - sysNoticeUserService.updateReadStatus(SecurityUser.getUserId(), noticeId); - + public Result read(@PathVariable("noticeId") String noticeId) { + if (StringUtils.isNotEmpty(noticeId) && noticeId.contains(";")) { + String[] noticeIds = noticeId.split(";"); + Arrays.asList(noticeIds).stream().distinct().forEach(index -> { + try { + sysNoticeUserService.updateReadStatus(SecurityUser.getUserId(), Long.valueOf(index)); + } catch (Exception exception) { + logger.error("标识已读失败", exception); + } + }); + } else { + sysNoticeUserService.updateReadStatus(SecurityUser.getUserId(), Long.valueOf(noticeId)); + } return new Result(); } diff --git a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java index 9eab13e2..d4e46ee1 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java @@ -44,10 +44,17 @@ public class SysNoticeServiceImpl extends CrudServiceImpl getWrapper(Map params) { - String type = (String) params.get("type"); - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(type), "type", type); + params.keySet().stream().filter(index -> null != params.get(index)).forEach(index -> { + switch (index) { + case "type": + wrapper.eq(StringUtils.isNotBlank((String) params.get("type")), "type", (String) params.get("type")); + break; + case "from": + wrapper.eq(StringUtils.isNotBlank((String) params.get("from")), "`from`", (String) params.get("from")); + break; + } + }); wrapper.orderByDesc(Constant.CREATE_DATE); return wrapper; } @@ -79,6 +86,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl \ No newline at end of file diff --git a/renren-common/src/main/java/io/renren/common/constant/Constant.java b/renren-common/src/main/java/io/renren/common/constant/Constant.java index 1f306bc2..0aa7039f 100644 --- a/renren-common/src/main/java/io/renren/common/constant/Constant.java +++ b/renren-common/src/main/java/io/renren/common/constant/Constant.java @@ -215,6 +215,11 @@ public interface Constant { } } + /** + * 项目部署地点 + */ + String PROJECT_PLACE = "PROJECT_PLACE"; + /** * 项目运行地点 */