|
@@ -69,11 +69,13 @@ public class ExcelController extends AbstractController{
|
|
|
|
|
|
private final AllocationService allocationServicel;
|
|
|
|
|
|
+ private final CostDepartmentProfitService costDepartmentProfitService;
|
|
|
+
|
|
|
public ExcelController(UserService userService, DepartmentServiceImpl departmentService, ProductServiceImpl productService,
|
|
|
AccountingService accountingService, AccountingProductService accountingProductService,
|
|
|
ResponsibilityDepartmentService responsibilityDepartmentService,
|
|
|
CostShareParamService costShareParamService, CostIncomeGroupService costIncomeGroupService, JwtUtil jwtUtil,
|
|
|
- CostCostingGroupService costCostingGroupService, ShareParamValueService shareParamValueService, CostCostingCollectionService costCostingCollectionService, AllocationService allocationServicel) {
|
|
|
+ CostCostingGroupService costCostingGroupService, ShareParamValueService shareParamValueService, CostCostingCollectionService costCostingCollectionService, AllocationService allocationServicel, CostDepartmentProfitService costDepartmentProfitService) {
|
|
|
this.userService = userService;
|
|
|
this.departmentService = departmentService;
|
|
|
this.productService = productService;
|
|
@@ -87,6 +89,7 @@ public class ExcelController extends AbstractController{
|
|
|
this.shareParamValueService = shareParamValueService;
|
|
|
this.costCostingCollectionService = costCostingCollectionService;
|
|
|
this.allocationServicel = allocationServicel;
|
|
|
+ this.costDepartmentProfitService = costDepartmentProfitService;
|
|
|
}
|
|
|
|
|
|
@ApiOperation("用户导出模板设置")
|
|
@@ -367,34 +370,34 @@ public class ExcelController extends AbstractController{
|
|
|
writer.close();
|
|
|
IoUtil.close(out);
|
|
|
}
|
|
|
- /**
|
|
|
- * 测试模板数据导出
|
|
|
- */
|
|
|
- @ApiOperation("分摊报表输出")
|
|
|
- @GetMapping("/getShareReportTemplateTwo")
|
|
|
- public void getShareReportTemplateTwo(HttpServletResponse response,Integer shareNumber,String token) throws IOException {
|
|
|
- int userId = jwtUtil.getUserId(token);
|
|
|
- User user = userService.getById(userId);
|
|
|
- if (Objects.isNull(user)){
|
|
|
- throw new CostException(500,"用户不存在");
|
|
|
- }
|
|
|
- Long hospId = user.getHospId();
|
|
|
- String uuid = UUID.randomUUID().toString();
|
|
|
- String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
- FileUtil.del(FileUtil.file(url));
|
|
|
- ExcelWriter writer = new ExcelWriter(url);
|
|
|
- Sheet sheet = writer.getSheet();
|
|
|
- // 第几次分摊
|
|
|
- writer= costCostingCollectionService.getShareReportTemplate(writer,shareNumber,sheet);
|
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
- ServletOutputStream out = null;
|
|
|
- out = response.getOutputStream();
|
|
|
- writer.flush(out, true);
|
|
|
- writer.close();
|
|
|
- IoUtil.close(out);
|
|
|
-
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 测试模板数据导出
|
|
|
+// */
|
|
|
+// @ApiOperation("分摊报表输出")
|
|
|
+// @GetMapping("/getShareReportTemplateTwo")
|
|
|
+// public void getShareReportTemplateTwo(HttpServletResponse response,Integer shareNumber,String token) throws IOException {
|
|
|
+// int userId = jwtUtil.getUserId(token);
|
|
|
+// User user = userService.getById(userId);
|
|
|
+// if (Objects.isNull(user)){
|
|
|
+// throw new CostException(500,"用户不存在");
|
|
|
+// }
|
|
|
+// Long hospId = user.getHospId();
|
|
|
+// String uuid = UUID.randomUUID().toString();
|
|
|
+// String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
+// FileUtil.del(FileUtil.file(url));
|
|
|
+// ExcelWriter writer = new ExcelWriter(url);
|
|
|
+// Sheet sheet = writer.getSheet();
|
|
|
+// // 第几次分摊
|
|
|
+// writer= costCostingCollectionService.getShareReportTemplate(writer,shareNumber,sheet);
|
|
|
+// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
+// response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
+// ServletOutputStream out = null;
|
|
|
+// out = response.getOutputStream();
|
|
|
+// writer.flush(out, true);
|
|
|
+// writer.close();
|
|
|
+// IoUtil.close(out);
|
|
|
+//
|
|
|
+// }
|
|
|
@ApiOperation("分摊报表输出2.0")
|
|
|
@GetMapping("/getShareReportTemplate")
|
|
|
public void getTemplate(HttpServletResponse response,Integer levelSort,String token,Integer year,Integer month) throws IOException {
|
|
@@ -456,6 +459,33 @@ public class ExcelController extends AbstractController{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 成本分摊参数导出模板
|
|
|
+ */
|
|
|
+ @GetMapping("/getDepartmentProfit")
|
|
|
+ @ApiOperation("科室损益计算导出")
|
|
|
+ public void getDepartmentProfit(HttpServletResponse response,String token,String date) throws IOException {
|
|
|
+ int userId = jwtUtil.getUserId(token);
|
|
|
+ User user = userService.getById(userId);
|
|
|
+ if (Objects.isNull(user)){
|
|
|
+ throw new CostException(500,"用户不存在");
|
|
|
+ }
|
|
|
+ Long hospId = user.getHospId();
|
|
|
+ String uuid = UUID.randomUUID().toString();
|
|
|
+ String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
|
|
|
+ FileUtil.del(FileUtil.file(url));
|
|
|
+ ExcelWriter writer = new ExcelWriter(url);
|
|
|
+ Sheet sheet = writer.getSheet();
|
|
|
+ costDepartmentProfitService.getDepartmentProfit(writer,sheet,date);
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
|
|
|
+ ServletOutputStream out = null;
|
|
|
+ out = response.getOutputStream();
|
|
|
+ writer.flush(out, true);
|
|
|
+ writer.close();
|
|
|
+ IoUtil.close(out);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 成本分摊参数导出模板
|
|
|
*/
|
|
@@ -614,4 +644,5 @@ public class ExcelController extends AbstractController{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|