| | |
| | | import com.ruoyi.system.model.TCrmSupplier; |
| | | import com.ruoyi.system.query.ClinicProcurementReportQuery; |
| | | import com.ruoyi.system.query.DetectionPaymentReportQuery; |
| | | import com.ruoyi.system.query.PerformanceReportQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.BranchPerformanceReportVO; |
| | | import com.ruoyi.system.vo.ClinicProcurementReportVO; |
| | | import com.ruoyi.system.vo.DetectionPaymentReportVO; |
| | | import com.ruoyi.system.vo.SalespersonPerformanceReportVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分公司业绩报表 |
| | | */ |
| | | @ApiOperation(value = "分公司业绩报表") |
| | | @PostMapping(value = "/branchPerformanceReport") |
| | | public R<PageInfo<BranchPerformanceReportVO>> branchPerformanceReport(@RequestBody PerformanceReportQuery query) { |
| | | PageInfo<BranchPerformanceReportVO> pageInfo = erpProcurementService.branchPerformanceReport(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | @Log(title = "财务报表-分公司业绩报表导出", businessType = BusinessType.EXPORT) |
| | | @ApiOperation(value = "分公司业绩报表导出") |
| | | @PostMapping("/exportBranchPerformanceReport") |
| | | public void exportBranchPerformanceReport(@RequestBody PerformanceReportQuery query){ |
| | | List<BranchPerformanceReportVO> list = erpProcurementService.exportBranchPerformanceReport(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), BranchPerformanceReportVO.class, list); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("分公司业绩报表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 业务员业绩报表 |
| | | */ |
| | | @ApiOperation(value = "业务员业绩报表") |
| | | @PostMapping(value = "/salespersonPerformanceReport") |
| | | public R<PageInfo<SalespersonPerformanceReportVO>> salespersonPerformanceReport(@RequestBody PerformanceReportQuery query) { |
| | | PageInfo<SalespersonPerformanceReportVO> pageInfo = erpProcurementService.salespersonPerformanceReport(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | @Log(title = "财务报表-业务员业绩报表导出", businessType = BusinessType.EXPORT) |
| | | @ApiOperation(value = "业务员业绩报表导出") |
| | | @PostMapping("/exportSalespersonPerformanceReport") |
| | | public void exportSalespersonPerformanceReport(@RequestBody PerformanceReportQuery query){ |
| | | List<SalespersonPerformanceReportVO> list = erpProcurementService.exportSalespersonPerformanceReport(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), SalespersonPerformanceReportVO.class, list); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("业务员业绩报表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |