SupplySettlementController.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.etotem.cfc.controller.admin;
  2. import com.etotem.cfc.common.Result;
  3. import com.etotem.cfc.entity.SupplySettlement;
  4. import com.etotem.cfc.entity.SupplySettlementDetail;
  5. import com.etotem.cfc.service.SupplySettlementService;
  6. import org.springframework.web.bind.annotation.PostMapping;
  7. import org.springframework.web.bind.annotation.RequestBody;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RestController;
  10. import javax.annotation.Resource;
  11. import java.util.List;
  12. import java.util.Map;
  13. @RestController
  14. @RequestMapping("/api/admin/supply-settlement")
  15. public class SupplySettlementController {
  16. @Resource
  17. private SupplySettlementService supplySettlementService;
  18. /**
  19. * 结算记录列表(分页+过滤)
  20. */
  21. @PostMapping("/list")
  22. public Result<Map<String, Object>> list(@RequestBody Map<String, Object> params) {
  23. return supplySettlementService.list(params);
  24. }
  25. /**
  26. * 结算详情
  27. */
  28. @PostMapping("/detail")
  29. public Result<SupplySettlement> detail(@RequestBody Map<String, Object> params) {
  30. Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
  31. if (id == null) {
  32. return Result.error("id不能为空");
  33. }
  34. return supplySettlementService.detail(id);
  35. }
  36. /**
  37. * 结算明细列表
  38. */
  39. @PostMapping("/detail-items")
  40. public Result<List<SupplySettlementDetail>> detailItems(@RequestBody Map<String, Object> params) {
  41. Long settlementId = params.get("settlementId") != null
  42. ? Long.valueOf(params.get("settlementId").toString()) : null;
  43. if (settlementId == null) {
  44. return Result.error("settlementId不能为空");
  45. }
  46. return supplySettlementService.detailItems(settlementId);
  47. }
  48. /**
  49. * 手动生成结算单
  50. */
  51. @PostMapping("/create")
  52. public Result<SupplySettlement> create(@RequestBody Map<String, Object> params) {
  53. return supplySettlementService.createSettlement(params);
  54. }
  55. /**
  56. * 确认结算
  57. */
  58. @PostMapping("/confirm")
  59. public Result<Void> confirm(@RequestBody Map<String, Object> params) {
  60. Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
  61. if (id == null) {
  62. return Result.error("id不能为空");
  63. }
  64. return supplySettlementService.confirm(id);
  65. }
  66. }