CostCostingGroupController.java 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package com.imed.costaccount.web;
  2. import com.imed.costaccount.common.exception.CostException;
  3. import com.imed.costaccount.common.util.PageUtils;
  4. import com.imed.costaccount.common.util.Result;
  5. import com.imed.costaccount.model.dto.StartDTO;
  6. import com.imed.costaccount.model.vo.AfterAllocationFormVO;
  7. import com.imed.costaccount.model.vo.CollectDataFormVO;
  8. import com.imed.costaccount.service.AllocationService;
  9. import com.imed.costaccount.service.CostCostingGroupService;
  10. import io.swagger.annotations.*;
  11. import org.springframework.web.bind.annotation.*;
  12. import javax.validation.Valid;
  13. import java.util.List;
  14. /**
  15. * 成本归集
  16. *
  17. * @author KCYG
  18. * @date 2021-08-12 11:00:23
  19. */
  20. @Api(tags = "成本分摊")
  21. @RestController
  22. @RequestMapping("/costAccount/costcostinggroup")
  23. public class CostCostingGroupController extends AbstractController {
  24. private final CostCostingGroupService costCostingGroupService;
  25. private final AllocationService allocationService;
  26. public CostCostingGroupController(CostCostingGroupService costCostingGroupService, AllocationService allocationService) {
  27. this.costCostingGroupService = costCostingGroupService;
  28. this.allocationService = allocationService;
  29. }
  30. @ApiOperation("成本分摊前数据列表")
  31. @GetMapping("/queryStartAllocation")
  32. @ApiImplicitParams({
  33. @ApiImplicitParam(name = "current", value = "当前页", required = true),
  34. @ApiImplicitParam(name = "pageSize", value = "当前页大小", required = true),
  35. @ApiImplicitParam(name = "responsibilityCode", value = "责任中心代码", required = false),
  36. @ApiImplicitParam(name = "accountCode", value = "会计中心代码"),
  37. @ApiImplicitParam(name = "date", value = "年月yyyy-MM")}
  38. )
  39. public Result queryStartAllocation(@RequestParam(value = "current", defaultValue = "1") Integer current,
  40. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
  41. @RequestParam(value = "responsibilityCode", required = false) String responsibilityCode,
  42. @RequestParam(value = "accountCode", required = false) String accountCode,
  43. @RequestParam(value = "date") String date) {
  44. // 简单校验时间格式 这里要求的是yyyy-MM-dd
  45. if (date.length() != 7) {
  46. throw new CostException("时间格式不正确,这里要求yyyy-MM 格式");
  47. }
  48. PageUtils pageUtils = costCostingGroupService.queryStartAllocation(current, pageSize, responsibilityCode, accountCode, date, getHospId());
  49. return Result.ok(pageUtils);
  50. }
  51. @ApiOperation("成本分摊列表")
  52. @GetMapping("/allocationList")
  53. @ApiImplicitParams({
  54. @ApiImplicitParam(name = "current", value = "当前页", required = true),
  55. @ApiImplicitParam(name = "pageSize", value = "当前页大小", required = true),
  56. @ApiImplicitParam(name = "date", value = "年月yyyy-MM-dd", required = true)
  57. })
  58. public Result allocationList(@RequestParam(value = "current", defaultValue = "1", required = false) Integer current,
  59. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
  60. @RequestParam(value = "date", required = false) String date) {
  61. PageUtils pageUtils = costCostingGroupService.queryAllocation(current, pageSize, date, getHospId());
  62. return Result.ok(pageUtils);
  63. }
  64. @ApiOperation("开始分摊")
  65. @PostMapping("/startAllocation")
  66. public Result startAllocation(@RequestBody @Valid StartDTO startDTO) {
  67. // costCostingGroupService.startAllocation(startDTO, getHospId());
  68. allocationService.startAllocation(startDTO, getHospId());
  69. return Result.ok();
  70. }
  71. @ApiOperation("分摊后列表")
  72. @GetMapping("/queryAfterAllocation")
  73. @ApiImplicitParams({
  74. @ApiImplicitParam(name = "year", value = "年月日(yyyy-MM-dd)"),
  75. @ApiImplicitParam(name = "responsibilityCode", value = "责任中心代码"),
  76. @ApiImplicitParam(name = "current", value = "每页数据大小"),
  77. @ApiImplicitParam(name = "pageSize", value = "每页数据大小")
  78. })
  79. public Result queryAfterAllocation(@RequestParam(value = "year", required = false) String year,
  80. @RequestParam(value = "responsibilityCode", required = false) String responsibilityCode,
  81. @RequestParam(value = "current", defaultValue = "1", required = false) Integer current,
  82. @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize) {
  83. PageUtils pageUtils = allocationService.queryAfterAllocation(year, responsibilityCode, current, pageSize, getHospId());
  84. return Result.ok(pageUtils);
  85. }
  86. @ApiOperation("分摊后报表")
  87. @GetMapping("/queryAfterAllocationForm")
  88. @ApiImplicitParams({
  89. @ApiImplicitParam(name = "year", value = "年月日(yyyy-MM-dd)"),
  90. @ApiImplicitParam(name = "responsibilityCode", value = "责任中心代码")
  91. })
  92. public Result queryAfterAllocationForm(@RequestParam(value = "year", required = false) String year,
  93. @RequestParam(value = "responsibilityCode", required = false) String responsibilityCode) {
  94. return Result.ok(allocationService.queryAfterAllocationForm(year, responsibilityCode, getHospId()));
  95. }
  96. @ApiOperation("分摊后报表输出")
  97. @GetMapping("/afterAllocationFormList")
  98. public Result afterAllocationFormList(@RequestParam(value = "date", required = false)
  99. @ApiParam(name = "date", value = "年月日(yyyy-MM-dd)") String date) {
  100. List<AfterAllocationFormVO> list = allocationService.afterAllocationFormList(date, getHospId());
  101. PageUtils pageUtils = new PageUtils(list, 0, 0, 0);
  102. return Result.ok(pageUtils);
  103. }
  104. }