| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TEvaluateResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TOrderResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TEvaluate; |
| | | import com.stylefeng.guns.modular.system.service.ITEvaluateService; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 跳转详情页面 |
| | | */ |
| | | @RequestMapping("/evaluateDetail") |
| | | public String evaluateDetail(Integer evaluateId, Model model) { |
| | | tEvaluateService.evaluateDetail(evaluateId,model); |
| | | return PREFIX + "tEvaluateDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | public Object list(String createTime,String userName,String driverName ,Integer score) { |
| | | return tEvaluateService.selectPageList(createTime,userName,driverName,null,score); |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list-back") |
| | | @ResponseBody |
| | | public Object listBack(String condition) { |
| | | return tEvaluateService.selectList(null); |
| | | } |
| | | |
| | |
| | | public Object detail(@PathVariable("tEvaluateId") Integer tEvaluateId) { |
| | | return tEvaluateService.selectById(tEvaluateId); |
| | | } |
| | | |
| | | @ApiOperation(value = "导出评价列表",notes="导出评价列表") |
| | | @RequestMapping(value = "/export") |
| | | @ResponseBody |
| | | public void export(String createTime,String userName,String driverName,Integer score, HttpServletResponse response) { |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time1 = format.format(date); |
| | | String fileName = "EvaluateInfo"+time1+".xls"; |
| | | String[] title = new String[] {"评价时间","订单编号","评论用户", |
| | | "评论用户手机号","评论司机","司机手机号","评价分数","评价内容"}; |
| | | List<TEvaluateResp> list = tEvaluateService.selectPageList(createTime, userName, driverName, null, score); |
| | | String[][] values = new String[list.size()][]; |
| | | for (int i = 0; i < list.size(); i++) { |
| | | TEvaluateResp d = list.get(i); |
| | | values[i] = new String[title.length]; |
| | | values[i][0] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d.getCreateTime()); |
| | | values[i][1] = d.getCode(); |
| | | values[i][2] = d.getUserName(); |
| | | values[i][3] = d.getUserPhone(); |
| | | values[i][4] = d.getDriverName(); |
| | | values[i][5] = d.getDriverPhone(); |
| | | values[i][6] = String.valueOf(Objects.nonNull(d.getScore())?d.getScore(): ""); |
| | | Integer score1 = d.getScore(); |
| | | if(Objects.nonNull(score1)){ |
| | | if(1 == score1){ |
| | | values[i][6] = "非常差"; |
| | | }else if (2 == score1){ |
| | | values[i][6] = "差"; |
| | | }else if (3 == score1){ |
| | | values[i][6] = "一般"; |
| | | }else if (4 == score1){ |
| | | values[i][6] = "满意"; |
| | | }else if (5 == score1){ |
| | | values[i][6] = "非常满意"; |
| | | } |
| | | }else { |
| | | values[i][6] = ""; |
| | | } |
| | | values[i][7] = d.getEvaluate(); |
| | | } |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook("Variance"+time1, title, values, null); |
| | | ExcelUtil.setResponseHeader(response, fileName); |
| | | OutputStream os = response.getOutputStream(); |
| | | wb.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |