|
@@ -2,19 +2,31 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
+import cn.com.ctop.common.module.vo.ByteDanceReportAccountDailyDTOEntity;
|
|
|
+import cn.com.ctop.common.module.vo.SheetInfoVo;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
import cn.com.ctop.kuaishou.modules.report.entity.KuaishouInfoDTO;
|
|
|
import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
|
|
|
import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
|
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
|
|
|
+import com.alibaba.excel.EasyExcelFactory;
|
|
|
+import com.alibaba.excel.ExcelWriter;
|
|
|
+import com.alibaba.excel.metadata.Sheet;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -122,6 +134,32 @@ public class KuaiShouController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/exportKuaishouSaleProjectInfo")
|
|
|
+ public void exportKuaishouSaleProjectInfo(@RequestBody KuaishouInfoDTO dto, HttpServletResponse response) throws IOException {
|
|
|
+ Result<PageInfo<ProjectAccountDTO>> result = new Result<>();
|
|
|
+ result.setSuccess(true);
|
|
|
+
|
|
|
+ if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage("参数有误");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setPageSize(1000000000);
|
|
|
+ //查询总的消耗信息
|
|
|
+ SheetInfoVo totalSheetVo = accountService.getKuaishouSaleProjectInfoSheetVO(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageNum(),dto.getPageSize(),"", dto.getYn());
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ String date = DateUtils.formatDate(new Date());
|
|
|
+ HttpUtils.setResponseHeader(response, "快手销售报表" + date + ".xlsx");
|
|
|
+ ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
|
|
|
+ Sheet sheet = new Sheet(1, 0, ByteDanceReportAccountDailyDTOEntity.class);
|
|
|
+ sheet.setSheetName(totalSheetVo.getSheetName());
|
|
|
+ excelWriter.write(totalSheetVo.getDetails(), sheet);
|
|
|
+ excelWriter.finish();
|
|
|
+ outputStream.flush();
|
|
|
+ outputStream.close();
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping("/getKuaishouAccountInfoByProjectId")
|
|
|
public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouAccountInfoByProjectId(@RequestBody KuaishouInfoDTO dto) {
|
|
|
Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
|