package com.ruoyi.busi.service.impl;

import java.util.List;

import com.ruoyi.busi.query.BusiFeedbackQuery;
import com.ruoyi.busi.vo.BusiFeedbackVo;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.busi.mapper.BusiFeedbackMapper;
import com.ruoyi.busi.domain.BusiFeedback;
import com.ruoyi.busi.service.IBusiFeedbackService;

/**
 * 意见反馈Service业务层处理
 *
 * @author 朱春云
 * @date 2025-03-17
 */
@Service
public class BusiFeedbackServiceImpl extends ServiceImpl<BusiFeedbackMapper,BusiFeedback>  implements IBusiFeedbackService
{
    @Autowired
    private BusiFeedbackMapper busiFeedbackMapper;

    @Override
    public IPage<BusiFeedbackVo> queryListPage(BusiFeedbackQuery pageReqVO, Page<BusiFeedbackVo> page) {
        return busiFeedbackMapper.queryListPage(pageReqVO, page);
    }

    /**
     * 处理反馈
     * @param busiFeedback
     */
    @Override
    public void dealFeedback(BusiFeedback busiFeedback) {
        busiFeedback.setBackTime(DateUtils.getNowDate());
        busiFeedback.setBackUserId(SecurityUtils.getUserId());
        busiFeedbackMapper.updateById(busiFeedback);
    }

    /**
     * 新增意见反馈
     *
     * @param busiFeedback {@link BusiFeedback}
     * @author PQZ
     * @date 14:35 2025/4/14
     **/
    @Override
    public void uniAddFeedBack(BusiFeedback busiFeedback) {
        Long userId = SecurityUtils.getUserId();
        busiFeedback.setUserId(userId);
        save(busiFeedback);
    }
}
