puzhibing
2023-05-18 53562814add61acfdc02d6b25dae6324f6fd5f92
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TComplaintController.java
@@ -5,10 +5,14 @@
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.modular.system.model.TProblem;
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.util.PushMinistryOfTransportUtil;
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;
@@ -16,13 +20,11 @@
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.TComplaint;
import com.stylefeng.guns.modular.system.service.ITComplaintService;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.io.File;
import java.util.Date;
import java.util.Map;
@@ -45,10 +47,10 @@
    private ITSystemNoticeService tSystemNoticeService;
    @Autowired
    private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
    private ITUserService userService;
    @Value("${pushMinistryOfTransport}")
    private boolean pushMinistryOfTransport;
    @Value("${spring.mail.template-path}")
    private String templatePath;
@@ -133,6 +135,20 @@
            tComplaint.setHandleTime(new Date());
            tComplaintService.updateById(tComplaint);
            try {
                TUser userInfo = userService.selectById(tComplaint.getUserId());
                String path = templatePath +  "user/complaint.html";
                Document document = Jsoup.parse(new File(path), "UTF-8");
                document.getElementById("chinese").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(handleResult);
                EmailUtil.send(userInfo.getEmail(), "Complaint driver handling result notification",  document.html());
            }catch (Exception e){
                e.printStackTrace();
            }
            //增加系统消息
            TSystemNotice notice = new TSystemNotice();
            notice.setType(2);
@@ -142,15 +158,6 @@
            notice.setInsertTime(new Date());
            notice.setRead(1);
            tSystemNoticeService.insert(notice);
            new Thread(new Runnable() {
                @Override
                public void run() {
                    if(pushMinistryOfTransport){//上传数据
                        pushMinistryOfTransportUtil.ratedPassengerComplaint(tComplaint.getId());
                    }
                }
            }).start();
        }
        return SUCCESS_TIP;
    }