Commit be7d7ad5 by 杨林龙

开发试驾数据

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