puzhibing
2023-05-18 53562814add61acfdc02d6b25dae6324f6fd5f92
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TFeedbackController.java
@@ -5,8 +5,16 @@
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.SinataUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.TSystemNotice;
import com.stylefeng.guns.modular.system.model.TUser;
import com.stylefeng.guns.modular.system.service.ITSystemNoticeService;
import com.stylefeng.guns.modular.system.service.ITUserService;
import com.stylefeng.guns.modular.system.util.EmailUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -18,6 +26,7 @@
import com.stylefeng.guns.modular.system.model.TFeedback;
import com.stylefeng.guns.modular.system.service.ITFeedbackService;
import java.io.File;
import java.util.Date;
import java.util.Map;
@@ -38,6 +47,12 @@
    @Autowired
    private ITSystemNoticeService tSystemNoticeService;
    @Autowired
    private ITUserService userService;
    @Value("${spring.mail.template-path}")
    private String templatePath;
    /**
     * 跳转到司机反馈管理首页
@@ -153,6 +168,23 @@
            tFeedback.setState(2);
            tFeedbackService.updateById(tFeedback);
            try {
                TUser userInfo = userService.selectById(tFeedback.getUserId());
                if(ToolUtil.isNotEmpty(userInfo.getEmail())){
                    String path = templatePath +  "user/feedbackResult.html";
                    Document document = Jsoup.parse(new File(path), "UTF-8");
                    document.getElementById("chinese").attr("style", "display: none;");
                    document.getElementById("french").attr("style", "display: none;");
                    Element english_user = document.getElementById("english_user");
                    english_user.text("Hello " + userInfo.getNickName() + ",");
                    Element english_content = document.getElementById("english_content");
                    english_content.text(remark);
                    EmailUtil.send(userInfo.getEmail(), "Feedback Processing Results",  document.html());
                }
            }catch (Exception e){
                e.printStackTrace();
            }
            //增加系统消息
            TSystemNotice notice = new TSystemNotice();
            notice.setType(2);