package com.ruoyi.xq.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.xq.domain.Feedback;
import com.ruoyi.xq.dto.app.other.FeedbackReq;
import com.ruoyi.xq.dto.common.user.MinUser;
import com.ruoyi.xq.enums.other.FeedbackReportStatusEnum;
import com.ruoyi.xq.mapper.FeedbackMapper;
import com.ruoyi.xq.service.FeedbackService;
import com.ruoyi.xq.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 留言举报Service业务层处理
 *
 * @author 77
 * @date 2024-04-18
 */
@Service
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper,Feedback> implements FeedbackService {
    @Autowired
    private UserService userService;

    @Override
    public void feedback(FeedbackReq req) {
        MinUser minUser = userService.getMinUserById(req.getUserId());
        Feedback feedback = new Feedback();
        feedback.setUserId(minUser.getId());
        feedback.setUsercode(minUser.getUsercode());
        feedback.setTitle(req.getTitle());
        feedback.setContent(req.getContent());
        feedback.setFeedbackMobile(req.getFeedbackMobile());
        feedback.setReportStatus(FeedbackReportStatusEnum.NO_DEAL.getCode());
        this.save(feedback);
    }
}
