Merge branch 'master' of http://221.0.232.152:9393/ability-center/share-platform
* 'master' of http://221.0.232.152:9393/ability-center/share-platform: 去除市局部门搜索条件 ... ... 标识为已读支持批量 站内信来源标注为 其它 npe 。。。 ... 站内信通知区分来源 sql 我的通知来源分类 配置统计时,资源是否归属上级 # Conflicts: # renren-admin/src/main/java/io/renren/modules/resource/dataResource/domain/TsingtaoDataResourceService.java
This commit is contained in:
commit
fd406c9bfd
|
@ -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> 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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,17 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
|
||||
@Override
|
||||
public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params) {
|
||||
String type = (String) params.get("type");
|
||||
|
||||
QueryWrapper<SysNoticeEntity> 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<SysNoticeDao, SysNotic
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysNoticeDTO dto) {
|
||||
SysNoticeEntity entity = ConvertUtils.sourceToTarget(dto, SysNoticeEntity.class);
|
||||
entity.setFrom("其它"); // 站内信通知来源 (通知、评论、其它)
|
||||
|
||||
//更新发送者信息
|
||||
if (dto.getStatus() == NoticeStatusEnum.SEND.value() && StringUtils.isEmpty(dto.getSenderName())) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
project:
|
||||
# 平台部署位置 0:青岛市区 1:青岛西海岸 2:包头
|
||||
place: 0
|
||||
# 是否将资源归为上级
|
||||
higher: false
|
||||
# 大数据部门相关配置
|
||||
big_date:
|
||||
name: 青岛市大数据发展管理局
|
||||
|
|
|
@ -11,11 +11,15 @@
|
|||
|
||||
<!-- 获取我的通知列表 -->
|
||||
<select id="getMyNoticeList" resultType="io.renren.modules.notice.entity.SysNoticeEntity">
|
||||
select t2.id, t2.title, t2.type, t2.sender_name, t2.sender_date, t1.read_status, t2.content from sys_notice_user t1, sys_notice t2
|
||||
select t2.id, t2.title, t2.type, t2.sender_name, t2.sender_date, t1.read_status, t2.content ,t2.`from` from
|
||||
sys_notice_user t1, sys_notice t2
|
||||
where t1.notice_id = t2.id and t1.receiver_id = #{receiverId}
|
||||
<if test="readStatus != null">
|
||||
AND read_status = #{readStatus}
|
||||
</if>
|
||||
<if test="from != null">
|
||||
AND `from` = #{from}
|
||||
</if>
|
||||
order by t2.create_date desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -215,6 +215,11 @@ public interface Constant {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目部署地点
|
||||
*/
|
||||
String PROJECT_PLACE = "PROJECT_PLACE";
|
||||
|
||||
/**
|
||||
* 项目运行地点
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue