Commit b774b387 by huangjinxin

Merge remote-tracking branch 'origin/develop' into develop

2 parents 211f6cb2 c134c5ef
...@@ -60,7 +60,8 @@ spring: ...@@ -60,7 +60,8 @@ spring:
#调度实例失效的检查时间间隔 #调度实例失效的检查时间间隔
clusterCheckinInterval: 10000 clusterCheckinInterval: 10000
useProperties: false useProperties: false
misfireThreshold: 600000 #设置调度引擎对触发器超时的忍耐时间 (单位毫秒),20分钟
misfireThreshold: 1200000
threadPool: threadPool:
class: org.quartz.simpl.SimpleThreadPool class: org.quartz.simpl.SimpleThreadPool
# 指定在线程池里面创建的线程是否是守护线程 # 指定在线程池里面创建的线程是否是守护线程
......
...@@ -42,7 +42,8 @@ public class MsgController { ...@@ -42,7 +42,8 @@ public class MsgController {
request.setUserId(userId); request.setUserId(userId);
if ("isRead".equalsIgnoreCase(request.getSort())) { if ("isRead".equalsIgnoreCase(request.getSort())) {
request.setSort("is_read"); request.setSort("is_read");
} if ("type".equalsIgnoreCase(request.getSort())) { }
if ("type".equalsIgnoreCase(request.getSort())) {
request.setSort("type"); request.setSort("type");
} else { } else {
request.setSort("create_time"); request.setSort("create_time");
...@@ -108,4 +109,17 @@ public class MsgController { ...@@ -108,4 +109,17 @@ public class MsgController {
return Result.success(true); return Result.success(true);
} }
/**
* 获取未读消息数量
*
* @param userId 用户 ID
* @return {@link Result }<{@link Integer }>
* @author RenPing
* @date 2023/11/07
*/
@GetMapping("/msg/getUnReadNum")
public Result<Integer> getUnReadNum(@RequestHeader(name = "userId", required = true) String userId) {
return Result.success(msgService.getUnReadNum(userId));
}
} }
...@@ -38,13 +38,13 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> { ...@@ -38,13 +38,13 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
" and IF(:#{#req.groupId} is not null, tt.group_id=:#{#req.groupId}, 1=1)" + " and IF(:#{#req.groupId} is not null, tt.group_id=:#{#req.groupId}, 1=1)" +
"group by tt.cluster_id,tt.branch_id,tt.group_id" + "group by tt.cluster_id,tt.branch_id,tt.group_id" +
") t" ") t"
, nativeQuery = true // 开启原生sql , nativeQuery = true
) )
Page<Map<String, Objects>> getGroupList(@Param("req") MsgQuery req, Pageable pageable); Page<Map<String, Objects>> getGroupList(@Param("req") MsgQuery req, Pageable pageable);
@Query(value = "select t.* from (select tt.*,r.is_read," + @Query(value = "select t.* from (select tt.*,r.is_read," +
" (select group_concat(u.nickname) from zzz_msg_receiver rr join sys_user u on u.id=rr.user_id where rr.msg_id=tt.id) receivers"+ " (select group_concat(u.nickname) from zzz_msg_receiver rr join sys_user u on u.id=rr.user_id where rr.msg_id=tt.id) receivers" +
" from zzz_msg tt join zzz_msg_receiver r on r.deleted=0 and r.msg_id=tt.id and r.user_id=:#{#req.userId}" + " from zzz_msg tt join zzz_msg_receiver r on r.deleted=0 and r.msg_id=tt.id and r.user_id=:#{#req.userId}" +
" where IF(:#{#msgGroupResp.clusterId} is not null, tt.cluster_id=:#{#msgGroupResp.clusterId}, tt.cluster_id is null)" + " where IF(:#{#msgGroupResp.clusterId} is not null, tt.cluster_id=:#{#msgGroupResp.clusterId}, tt.cluster_id is null)" +
" and IF(:#{#msgGroupResp.branchId} is not null, tt.branch_id=:#{#msgGroupResp.branchId}, tt.branch_id is null)" + " and IF(:#{#msgGroupResp.branchId} is not null, tt.branch_id=:#{#msgGroupResp.branchId}, tt.branch_id is null)" +
...@@ -53,7 +53,7 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> { ...@@ -53,7 +53,7 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
" and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)" + " and IF(:#{#req.endDate} is not null, tt.create_time<:#{#req.endDate}, 1=1)" +
" and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)" + " and IF(:#{#req.keyWord} is not null, tt.content like concat('%',:#{#req.keyWord},'%'), 1=1)" +
") t" ") t"
, nativeQuery = true // 开启原生sql , nativeQuery = true
) )
List<Map<String, Objects>> getList(@Param("req") MsgQuery req List<Map<String, Objects>> getList(@Param("req") MsgQuery req
, @Param("msgGroupResp") MsgGroupResp msgGroupResp, Pageable pageable); , @Param("msgGroupResp") MsgGroupResp msgGroupResp, Pageable pageable);
...@@ -72,13 +72,18 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> { ...@@ -72,13 +72,18 @@ public interface MsgDao extends JpaRepository<MsgEntity, Integer> {
" from sys_user u" + " from sys_user u" +
" join sys_user_org uo on u.id=uo.user_id" + " join sys_user_org uo on u.id=uo.user_id" +
" join sys_user_role ur on ur.user_id=u.id" + " join sys_user_role ur on ur.user_id=u.id" +
" join sys_role r on r.id=ur.role_id and r.name='分站派工'" + " join sys_role r on r.id=ur.role_id" +
" and IF(:groupId is not null, ((uo.org_id=:groupId and uo.org_level=2) or (uo.org_id=:branchId and uo.org_level=1) or (uo.org_id=:clusterId and uo.org_level=0)), 1=1)" + " and IF(:groupId is not null, ((uo.org_id=:groupId and uo.org_level=2) or (uo.org_id=:branchId and uo.org_level=1) or (uo.org_id=:clusterId and uo.org_level=0)), 1=1)" +
" and IF(:groupId is null and :branchId is not null, ((uo.org_id=:branchId and uo.org_level=1) or (uo.org_id=:clusterId and uo.org_level=0)), 1=1)" + " and IF(:groupId is null and :branchId is not null, ((uo.org_id=:branchId and uo.org_level=1) or (uo.org_id=:clusterId and uo.org_level=0)), 1=1)" +
" and IF(:groupId is null and :branchId is null and :clusterId is not null, uo.org_id=:clusterId and uo.org_level=0, 1=1)" " and IF(:groupId is null and :branchId is null and :clusterId is not null, uo.org_id=:clusterId and uo.org_level=0, 1=1)"
, nativeQuery = true // 开启原生sql , nativeQuery = true
) )
List<String> getDispatchUserList(@Param("clusterId") String clusterId, List<String> getDispatchUserList(@Param("clusterId") String clusterId,
@Param("branchId") String branchId, @Param("branchId") String branchId,
@Param("groupId") String groupId); @Param("groupId") String groupId);
@Query(value = "select count(distinct tt.id)" +
" from zzz_msg tt join zzz_msg_receiver r on r.deleted=0 and r.msg_id=tt.id and r.is_read=0 and r.user_id=?1"
, nativeQuery = true)
Integer getUnReadNum(String userId);
} }
...@@ -49,4 +49,14 @@ public interface MsgService { ...@@ -49,4 +49,14 @@ public interface MsgService {
* @date 2023/10/25 * @date 2023/10/25
*/ */
void add(MsgDTO dto); void add(MsgDTO dto);
/**
* 获取未读消息数量
*
* @param userId 用户 ID
* @return {@link Object }
* @author RenPing
* @date 2023/11/07
*/
Integer getUnReadNum(String userId);
} }
...@@ -135,4 +135,9 @@ public class MsgServiceImpl implements MsgService { ...@@ -135,4 +135,9 @@ public class MsgServiceImpl implements MsgService {
msgReceiverDao.save(msgReceiverEntity); msgReceiverDao.save(msgReceiverEntity);
}); });
} }
@Override
public Integer getUnReadNum(String userId) {
return msgDao.getUnReadNum(userId);
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!