package com.pz.applet;

import java.util.Date;
import java.util.List;
import java.util.Arrays;

import lombok.RequiredArgsConstructor;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;

import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.pz.common.annotation.RepeatSubmit;
import com.pz.common.annotation.Log;
import com.pz.common.core.controller.BaseController;
import com.pz.common.core.domain.PageQuery;
import com.pz.common.core.domain.R;
import com.pz.common.core.validate.AddGroup;
import com.pz.common.core.validate.EditGroup;
import com.pz.common.enums.BusinessType;
import com.pz.common.utils.poi.ExcelUtil;
import com.pz.system.domain.vo.MessageVo;
import com.pz.system.domain.bo.MessageBo;
import com.pz.system.service.IMessageService;
import com.pz.common.core.page.TableDataInfo;

/**
 * 业务消息
 *
 * @author ruoyi
 * @date 2023-09-15
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/applet/message")
public class AccompanyMessageController extends BaseController {

    private final IMessageService iMessageService;

    /**
     * 查询消息列表
     */
    @GetMapping("/list")
    public R<List<MessageVo>> list(MessageBo bo) {
        bo.setSender(getUserId());
        return R.ok(iMessageService.queryPageList(bo));
    }


    /**
     * 获取我与对方聊天时间记录
     */
    @GetMapping("/historyTimeList/{toUserId}")
    public R<List<String>> historyTimeList(@PathVariable Long toUserId) {
        return R.ok(iMessageService.queryMessageTimeList(getUserId(), toUserId));
    }
}