package com.boman.web.core.controller;

import com.alibaba.fastjson.JSONObject;
import com.boman.domain.dto.AjaxResult;
import com.boman.web.core.service.bomanMessageReceive.IBomanMessageReceiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tjf
 * @Date: 2021/07/06/15:16
 */
@RestController
@RequestMapping("/messageReceive")
public class BomanMessageReceiveController {

    @Autowired
    private IBomanMessageReceiveService bomanMessageReceiveService;
    /**
     * 根据发文id查询出该发文所选人员名称和部门
     * @param messageId
     * @return
     */
    @GetMapping("/{messageId}")
    public AjaxResult getUserNameAndDeptName(@PathVariable("messageId") String messageId) {
        return bomanMessageReceiveService.getUserNameAndDeptName(messageId);
    }

    /**
     * 小程序首页统计
     * @param userId
     * @return
     */
    @GetMapping("/index/{userId}")
    public AjaxResult getIndexInfo(@PathVariable("userId") String userId) {
        AjaxResult indexInfo = bomanMessageReceiveService.getIndexInfo(userId);
        return indexInfo;
    }

   /**
    * 功能描述: 读取发文和未读取发文的人数统计
    *
    * @param messageId messageId
    * @return com.boman.domain.dto.AjaxResult
    */
    @GetMapping("/recieve/statistic/{messageId}")
    public AjaxResult statisticRecieve(@PathVariable("messageId") Long messageId) {
        return bomanMessageReceiveService.statisticRecieve(messageId);
    }


}
