Commit be7d7ad5 by 杨林龙

开发试驾数据

1 parent 96cb54dd
......@@ -20,9 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 项目名:oms-tiger-shield
......@@ -39,14 +37,11 @@ public class TrialDriveReportController {
@Autowired
private TrialDriveReportService trialDriveReportService;
@Autowired
private HttpServletResponse response;
@GetMapping("/search")
@SysLog("查询试驾数据")
@ApiOperation(value = "试驾报表查询")
public R search(TrialDriveReportSearch search) {
PageHelper.startPage(search.getPageNumber(), search.getPageSize(), true);
Page<Object> page = PageHelper.startPage(search.getPageNumber(), search.getPageSize(), true);
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
List<TrialDriveReportExport> testDrivePageList = trialDriveReportService.search(search);
......@@ -55,12 +50,7 @@ public class TrialDriveReportController {
List<TrialDriveReportExport> reportList = trialDriveReportService.listEffectiveTestDriveReportPage(search, testDrivePageList);
if (CollectionUtils.isNotEmpty(testDrivePageList) && CollectionUtils.isNotEmpty(reportList)) {
long total = ((Page<TrialDriveReportExport>) testDrivePageList).getTotal();
Map data = new HashMap(3);
data.put("list", reportList);
data.put("totalPages", total);
data.put("totalElements", total);
return R.ok().data(data);
return R.ok().putPageData(reportList, page.getTotal());
}
return R.ok().data("没有查询到任何数据");
}
......@@ -68,14 +58,14 @@ public class TrialDriveReportController {
@GetMapping(value = "/export")
@SysLog("导出试驾车辆数据")
@ApiOperation(value = "试驾报表导出")
public void exportGqWindReport(TrialDriveReportSearch search) throws Exception {
public void exportTrialDriveReport(HttpServletResponse response, TrialDriveReportSearch search) throws Exception {
String fileName = "有效试驾次数统计(按日" + DateFormatUtils.format(new Date(), "yyyy-MM-dd") + ")表";
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
List<TrialDriveReportExport> testDrivePageList = trialDriveReportService.search(search);
// 封装数据
List<TrialDriveReportExport> testDriveReportExcels = trialDriveReportService.exportEffectiveTestDriveReport(search, testDrivePageList);
// 调用公用方法导出 excel表格
EasyExcelUtils.writeExcel((HttpServletResponse) response.getOutputStream(), testDriveReportExcels, fileName, "有效试驾次数统计(按日)表", TrialDriveReportExport.class);
EasyExcelUtils.writeExcel(response, testDriveReportExcels, fileName, "有效试驾次数统计(按日)表", TrialDriveReportExport.class);
}
@GetMapping(value = "/years")
......
package cn.com.glsx.admin.modules.model.export;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
......@@ -11,14 +12,6 @@ import lombok.Data;
*/
@Data
public class TrialDriveReportExport {
// 围栏Id
@ExcelIgnore
private Integer fenceId;
// 围栏名
@ExcelIgnore
private String electricFenceName;
// 每种类型的统计数量
@ExcelIgnore
private Integer cnt;
......@@ -44,10 +37,8 @@ public class TrialDriveReportExport {
private String sn;
@ExcelProperty(value = "车架号VIN码", index = 4)
private String standno;
private String vin;
@ExcelIgnore
private String journeyTime;
// 年月
@ExcelProperty(value = "时间", index = 5)
private String statDate;
......
......@@ -7,7 +7,7 @@
<result column="shopName" jdbcType="VARCHAR" property="shopName"/>
<result column="vehicleTypeName" jdbcType="VARCHAR" property="vehicleTypeName"/>
<result column="sn" jdbcType="VARCHAR" property="sn"/>
<result column="vin" jdbcType="VARCHAR" property="standno"/>
<result column="vin" jdbcType="VARCHAR" property="vin"/>
<result column="statDate" jdbcType="VARCHAR" property="statDate"/>
<result column="cnt" jdbcType="INTEGER" property="cnt"/>
<result column="dayCount" jdbcType="INTEGER" property="dayCount"/>
......@@ -19,7 +19,7 @@
<result column="shopCode" jdbcType="VARCHAR" property="shopCode"/>
<result column="shopName" jdbcType="VARCHAR" property="shopName"/>
<result column="sn" jdbcType="VARCHAR" property="sn"/>
<result column="vin" jdbcType="VARCHAR" property="standno"/>
<result column="vin" jdbcType="VARCHAR" property="vin"/>
<result column="vehicleTypeName" jdbcType="VARCHAR" property="vehicleTypeName"/>
</resultMap>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!