Pu Zhibing
2025-02-27 f0a9a41697a8568e8b3bd3436c450e68b3298916
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java
@@ -4,7 +4,11 @@
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo;
import com.panzhihua.common.service.sangeshenbian.SystemUserService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.sangeshenbian.model.entity.Banner;
import com.panzhihua.sangeshenbian.model.entity.SystemUser;
import com.panzhihua.sangeshenbian.model.query.BasePage;
import com.panzhihua.sangeshenbian.model.vo.ComplaintTodoVO;
import com.panzhihua.sangeshenbian.model.vo.MessageNotificationVO;
@@ -12,9 +16,11 @@
import com.panzhihua.sangeshenbian.service.IBannerService;
import com.panzhihua.sangeshenbian.service.IComplaintService;
import com.panzhihua.sangeshenbian.service.IMessageNotificationService;
import com.panzhihua.sangeshenbian.service.ISystemUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -29,12 +35,14 @@
 */
@RestController
@RequestMapping("/applet/home")
@RequiredArgsConstructor
@RequiredArgsConstructor(onConstructor_=@Lazy)
@Api(tags = "首页相关接口")
public class HomeController extends BaseController {
    private final IBannerService bannerService;
    private final IMessageNotificationService messageNotificationService;
    private final IComplaintService complaintService;
    private final ISystemUserService systemUserService;
    private final UserService userService;
    @ApiOperation("获取banner列表")
    @GetMapping("/banner-list")
    public R<List<Banner>> getBannerList() {
@@ -60,4 +68,18 @@
    public R<Page<ComplaintTodoVO>> getTodoList(@RequestBody BasePage page) {
        return R.ok(complaintService.getTodoList(page,getLoginUserInfo()));
    }
    @GetMapping("/current-user-info")
    @ApiOperation("获取三个身边当前用户信息 用于判断用户是否是上级")
    public R<SystemUser> getCurrentUserInfo() {
        return R.ok(systemUserService.getSystemUserByPhone(getLoginUserInfo().getPhone()).orElse(null));
    }
    /**
     * 标记已读
     */
    @PostMapping("/read")
    @ApiOperation("标记已读")
    public R<?> read(){
        messageNotificationService.read(getLoginUserInfo());
        return R.ok();
    }
}