| | |
| | | package com.yeshi.fanli.controller.client;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.bind.annotation.RequestParam;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.customerservice.CustomerServiceCommonQuestion;
|
| | | import com.yeshi.fanli.entity.customerservice.CustomerServiceHistory;
|
| | | import com.yeshi.fanli.exception.user.UserComplaintException;
|
| | | import com.yeshi.fanli.service.inter.customerservice.CustomerServiceCommonQuestionService;
|
| | | import com.yeshi.fanli.service.inter.customerservice.CustomerServiceHistoryService;
|
| | | import com.yeshi.fanli.service.inter.user.UserComplaintService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private CustomerServiceHistoryService customerServiceHistoryService;
|
| | |
|
| | | @Resource
|
| | | private UserComplaintService userComplaintService;
|
| | |
|
| | | /**
|
| | | * 预设标题的关键字列表
|
| | |
| | | out.print(JsonUtil.loadTrueResult(JsonUtil.getApiCommonGson().toJson(answer)));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 用户吐槽
|
| | | * 用户吐槽记录添加
|
| | | * |
| | | * @param fileList
|
| | | * @param uid
|
| | | * @param content
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "complaint")
|
| | | public void complaint(List<CommonsMultipartFile> fileList, Long uid, String content, PrintWriter out) {
|
| | | |
| | | // 图片最多五张、可以为空
|
| | | if (fileList != null && fileList.size() > 5 ) {
|
| | | out.print(JsonUtil.loadFalseResult("图片最多可上传五张"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (content == null || content.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("吐槽内容为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | public void complaint(AcceptData acceptData, MultipartFile[] fileList, String content, Long uid,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | try {
|
| | | |
| | | |
| | | out.print(JsonUtil.loadTrueResult("吐槽"));
|
| | | List<MultipartFile> files = new ArrayList<>();
|
| | | if (fileList != null)
|
| | | for (MultipartFile mf : fileList) {
|
| | | files.add(mf);
|
| | | }
|
| | | userComplaintService.addUserComplaint(files, uid, content);
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (UserComplaintException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | out.print(JsonUtil.loadFalseResult("图片上传失败失败"));
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("操作失败"));
|
| | | out.print(JsonUtil.loadFalseResult("保存失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|