From 33e5113e02e32b8553c5f4edd07eb1f149594f04 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期一, 24 二月 2025 18:59:58 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/MessageNotificationController.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 46 insertions(+), 2 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/MessageNotificationController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/MessageNotificationController.java index cd53bce..0ea8748 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/MessageNotificationController.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/MessageNotificationController.java @@ -5,6 +5,7 @@ import com.panzhihua.common.interfaces.OperLog; import com.panzhihua.common.model.vos.R; import com.panzhihua.sangeshenbian.model.entity.MessageNotification; +import com.panzhihua.sangeshenbian.model.entity.SystemUser; import com.panzhihua.sangeshenbian.service.IMessageNotificationService; import com.panzhihua.sangeshenbian.service.ISystemUserService; import com.panzhihua.sangeshenbian.warpper.MessageNotificationList; @@ -21,7 +22,7 @@ @Api @RestController -@RequestMapping("/sangeshenbian/messageNotification") +@RequestMapping("/messageNotification") public class MessageNotificationController extends BaseController { @Resource @@ -30,10 +31,32 @@ @Resource private ISystemUserService systemUserService; + + @GetMapping("/list") @ApiOperation(value = "获取消息通知列表", tags = {"三个身边后台-消息通知"}) @OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取消息通知列表") public R<IPage<MessageNotification>> list(MessageNotificationList query) { + Integer id = this.getLoginUserInfoSanGeShenBian().getId(); + SystemUser systemUser = systemUserService.getById(id); + switch (systemUser.getAccountLevel()){ + case 1: + query.setUserId("510400"); + break; + case 2: + query.setUserId(systemUser.getDistrictsCode()); + break; + case 3: + query.setUserId(systemUser.getStreetId().toString()); + break; + case 4: + query.setUserId(systemUser.getCommunityId().toString()); + break; + case 5: + query.setUserId(id.toString()); + break; + } + query.setUndertakerType(systemUser.getAccountLevel()); IPage<MessageNotification> page = messageNotificationService.list(query); return R.ok(page); } @@ -57,9 +80,30 @@ @ApiOperation(value = "获取未读数量", tags = {"三个身边后台-消息通知"}) @OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取未读数量") public R unreadCount() { + Integer id = this.getLoginUserInfoSanGeShenBian().getId(); + SystemUser systemUser = systemUserService.getById(id); + String userId = null; + switch (systemUser.getAccountLevel()){ + case 1: + userId = "510400"; + break; + case 2: + userId = systemUser.getDistrictsCode(); + break; + case 3: + userId = systemUser.getStreetId().toString(); + break; + case 4: + userId = systemUser.getCommunityId().toString(); + break; + case 5: + userId = id.toString(); + break; + } Integer count = messageNotificationService.lambdaQuery() .eq(MessageNotification::getReadStatus, 0) - .eq(MessageNotification::getUndertakerUserId, getUserId()) + .eq(MessageNotification::getUndertakerType, systemUser.getAccountLevel()) + .eq(MessageNotification::getUndertakerUserId, userId) .count(); return R.ok(count); } -- Gitblit v1.7.1