| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.export.PlatformLedgerReportExport; |
| | | import com.ruoyi.system.export.ProcurementReportClinicExport; |
| | | import com.ruoyi.system.export.ProcurementReportPlatformExport; |
| | | import com.ruoyi.system.export.ProcurementReportSupplierExport; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | 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; |
| | |
| | | private final TSysAppUserService sysAppUserService; |
| | | private final TCrmClinicPointsService crmClinicPointsService; |
| | | private final TSysOrderService sysOrderService; |
| | | private final TSysPayRecordService sysPayRecordService; |
| | | |
| | | @Autowired |
| | | public FinancialStatementsController(TErpProcurementService erpProcurementService, TokenService tokenService, ISysUserService sysUserService, TCrmSupplierService crmSupplierService, TCrmClinicService crmClinicService, TSysAppUserService sysAppUserService, TCrmClinicPointsService crmClinicPointsService, TSysOrderService sysOrderService) { |
| | | public FinancialStatementsController(TErpProcurementService erpProcurementService, TokenService tokenService, ISysUserService sysUserService, TCrmSupplierService crmSupplierService, TCrmClinicService crmClinicService, TSysAppUserService sysAppUserService, TCrmClinicPointsService crmClinicPointsService, TSysOrderService sysOrderService, TSysPayRecordService sysPayRecordService) { |
| | | this.erpProcurementService = erpProcurementService; |
| | | this.tokenService = tokenService; |
| | | this.sysUserService = sysUserService; |
| | |
| | | this.sysAppUserService = sysAppUserService; |
| | | this.crmClinicPointsService = crmClinicPointsService; |
| | | this.sysOrderService = sysOrderService; |
| | | this.sysPayRecordService = sysPayRecordService; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * AI检测支付报表 |
| | | */ |
| | | @ApiOperation(value = "AI检测支付报表") |
| | | @PostMapping(value = "/detectionPaymentReport") |
| | | public R<PageInfo<DetectionPaymentReportVO>> detectionPaymentReport(@RequestBody DetectionPaymentReportQuery query) { |
| | | PageInfo<DetectionPaymentReportVO> pageInfo = sysPayRecordService.detectionPaymentReport(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | @Log(title = "财务报表-AI检测支付报表导出", businessType = BusinessType.EXPORT) |
| | | @ApiOperation(value = "AI检测支付报表导出") |
| | | @PostMapping("/exportDetectionPaymentReport") |
| | | public void exportDetectionPaymentReport(@RequestBody DetectionPaymentReportQuery query){ |
| | | List<DetectionPaymentReportVO> list = sysPayRecordService.exportDetectionPaymentReport(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), DetectionPaymentReportVO.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("AI检测支付报表.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 = "/platformLedgerReport") |
| | | public R<PageInfo<ClinicProcurementReportVO>> platformLedgerReport(@RequestBody ClinicProcurementReportQuery query) { |
| | | PageInfo<ClinicProcurementReportVO> pageInfo = erpProcurementService.platformLedgerReport(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | @Log(title = "财务报表-平台分账报表导出", businessType = BusinessType.EXPORT) |
| | | @ApiOperation(value = "平台分账报表导出") |
| | | @PostMapping("/exportPlatformLedgerReport") |
| | | public void exportPlatformLedgerReport(@RequestBody ClinicProcurementReportQuery query){ |
| | | List<PlatformLedgerReportExport> list = erpProcurementService.exportPlatformLedgerReport(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), PlatformLedgerReportExport.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 = "/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(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |