|
@@ -82,7 +82,7 @@ public class MediaReportCtrl {
|
|
Result<List<Product>> result = new Result();
|
|
Result<List<Product>> result = new Result();
|
|
|
|
|
|
try {
|
|
try {
|
|
- List<Product> allProductList = mediaReportService.getAllProductList(requestBody.getInteger("mediaType"));
|
|
|
|
|
|
+ List<Product> allProductList = mediaReportService.getAllProductList(requestBody.getInteger("mediaType"), requestBody.getString("advertiserId"));
|
|
result.setResult(allProductList);
|
|
result.setResult(allProductList);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
log.error(e.getMessage());
|
|
log.error(e.getMessage());
|
|
@@ -190,24 +190,6 @@ public class MediaReportCtrl {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- //@PostMapping("/{pageNum}/{pageSize}")
|
|
|
|
- //public Result<PageInfo<JSONObject>> toutiaoMediaReport(@PathVariable int pageNum,
|
|
|
|
- // @PathVariable int pageSize,
|
|
|
|
- // @RequestBody JSONObject requestBody){
|
|
|
|
- // Result<PageInfo<JSONObject>> result = new Result<>();
|
|
|
|
- // if(requestBody.isEmpty()){
|
|
|
|
- // log.error("requestBody is null");
|
|
|
|
- // result.setSuccess(false);
|
|
|
|
- // return result;
|
|
|
|
- // }
|
|
|
|
- // PageInfo<JSONObject> pageInfo =mediaReportService.toutiaoMediaReport(pageNum ,pageSize,requestBody);
|
|
|
|
- //
|
|
|
|
- // result.setResult(pageInfo);
|
|
|
|
- // result.setSuccess(true);
|
|
|
|
- // return result;
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 导出数据
|
|
* 导出数据
|
|
* @param requestBody
|
|
* @param requestBody
|
|
@@ -215,15 +197,9 @@ public class MediaReportCtrl {
|
|
* @param response
|
|
* @param response
|
|
*/
|
|
*/
|
|
@PostMapping("/exportMediaReportExcel")
|
|
@PostMapping("/exportMediaReportExcel")
|
|
- public Result exportMediaReportExcel(@RequestBody JSONObject requestBody,
|
|
|
|
|
|
+ public void exportMediaReportExcel(@RequestBody JSONObject requestBody,
|
|
HttpServletRequest request,
|
|
HttpServletRequest request,
|
|
HttpServletResponse response) {
|
|
HttpServletResponse response) {
|
|
- Result result = new Result();
|
|
|
|
- if(StringUtils.isBlank(requestBody.getString("todayDate")) || requestBody.getInteger("mediaType") ==null){
|
|
|
|
- result.setSuccess(false);
|
|
|
|
- result.setMessage("参数有误");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
String today = requestBody.getString("todayDate");
|
|
String today = requestBody.getString("todayDate");
|
|
Date todayDate = DateUtils.parseDate(today, "yyyy-MM-dd");
|
|
Date todayDate = DateUtils.parseDate(today, "yyyy-MM-dd");
|
|
Date yesterdayDate = DateUtils.addDay(todayDate, -1);
|
|
Date yesterdayDate = DateUtils.addDay(todayDate, -1);
|
|
@@ -235,10 +211,8 @@ public class MediaReportCtrl {
|
|
excelData.forEach(data->{
|
|
excelData.forEach(data->{
|
|
List<Object> temp= new ArrayList<>();
|
|
List<Object> temp= new ArrayList<>();
|
|
temp.add(data.get("mediaType")==null?"-":(data.getInteger("mediaType")==1?"头条":"快手"));
|
|
temp.add(data.get("mediaType")==null?"-":(data.getInteger("mediaType")==1?"头条":"快手"));
|
|
- //temp.add(data.get("advertiserId")==null?"-":data.get("advertiserId"));
|
|
|
|
temp.add(data.get("advertiserName")==null?"-":data.get("advertiserName"));
|
|
temp.add(data.get("advertiserName")==null?"-":data.get("advertiserName"));
|
|
temp.add(data.get("productName")==null?"-":data.get("productName"));
|
|
temp.add(data.get("productName")==null?"-":data.get("productName"));
|
|
- //temp.add(data.get("operatorManger")==null?"-":data.get("operatorManger"));
|
|
|
|
temp.add(data.get("operator")==null?"-":data.get("operator"));
|
|
temp.add(data.get("operator")==null?"-":data.get("operator"));
|
|
temp.add(data.get("sale")==null?"-":data.get("sale"));
|
|
temp.add(data.get("sale")==null?"-":data.get("sale"));
|
|
temp.add(data.get("todayCost"));
|
|
temp.add(data.get("todayCost"));
|
|
@@ -252,17 +226,15 @@ public class MediaReportCtrl {
|
|
OutputStream os = response.getOutputStream();
|
|
OutputStream os = response.getOutputStream();
|
|
ExportExcelUtils eeu = new ExportExcelUtils();
|
|
ExportExcelUtils eeu = new ExportExcelUtils();
|
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
- eeu.exportExcel(workbook, 0, "媒介报表", headers, excelList);
|
|
|
|
|
|
+ eeu.exportExcelForMediaReport(workbook, 0, "媒介报表", headers, excelList);
|
|
HttpUtils.setResponseHeader(response, "媒介报表.xlsx");
|
|
HttpUtils.setResponseHeader(response, "媒介报表.xlsx");
|
|
workbook.write(os);
|
|
workbook.write(os);
|
|
os.flush();
|
|
os.flush();
|
|
os.close();
|
|
os.close();
|
|
}catch (IOException e){
|
|
}catch (IOException e){
|
|
log.error(e.getMessage());
|
|
log.error(e.getMessage());
|
|
- result.setSuccess(false);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|