package com.hdkj.lt.bf.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdkj.lt.bf.entity.UserFeedback;
import com.hdkj.lt.bf.entity.vo.UserFeedbackVO;
import com.hdkj.lt.bf.mapper.UserFeedbackMapper;
import com.hdkj.lt.bf.service.IUserFeedbackService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 用户问题反馈信息表 服务实现类
 * </p>
 *
 * @author luorui
 * @since 2025-08-29
 */
@Service
public class UserFeedbackServiceImpl extends ServiceImpl<UserFeedbackMapper, UserFeedback> implements IUserFeedbackService {

    @Override
    public void saveUserFeedback(UserFeedbackVO userFeedbackVO) {
        UserFeedback userFeedback = new UserFeedback();
        BeanUtil.copyProperties(userFeedbackVO, userFeedback);
        LoginUser loginUser = SecurityUtils.getLoginUser();
        if (null != loginUser) {
            userFeedback.setCreator(loginUser.getUserid());
        }
        userFeedback.setCreateTime(LocalDateTime.now());
        this.save(userFeedback);
    }
}
