| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package com.etotem.cfc.controller.admin;
- import com.etotem.cfc.common.Result;
- import com.etotem.cfc.entity.SupplySettlement;
- import com.etotem.cfc.entity.SupplySettlementDetail;
- import com.etotem.cfc.service.SupplySettlementService;
- 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 javax.annotation.Resource;
- import java.util.List;
- import java.util.Map;
- @RestController
- @RequestMapping("/api/admin/supply-settlement")
- public class SupplySettlementController {
- @Resource
- private SupplySettlementService supplySettlementService;
- /**
- * 结算记录列表(分页+过滤)
- */
- @PostMapping("/list")
- public Result<Map<String, Object>> list(@RequestBody Map<String, Object> params) {
- return supplySettlementService.list(params);
- }
- /**
- * 结算详情
- */
- @PostMapping("/detail")
- public Result<SupplySettlement> detail(@RequestBody Map<String, Object> params) {
- Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
- if (id == null) {
- return Result.error("id不能为空");
- }
- return supplySettlementService.detail(id);
- }
- /**
- * 结算明细列表
- */
- @PostMapping("/detail-items")
- public Result<List<SupplySettlementDetail>> detailItems(@RequestBody Map<String, Object> params) {
- Long settlementId = params.get("settlementId") != null
- ? Long.valueOf(params.get("settlementId").toString()) : null;
- if (settlementId == null) {
- return Result.error("settlementId不能为空");
- }
- return supplySettlementService.detailItems(settlementId);
- }
- /**
- * 手动生成结算单
- */
- @PostMapping("/create")
- public Result<SupplySettlement> create(@RequestBody Map<String, Object> params) {
- return supplySettlementService.createSettlement(params);
- }
- /**
- * 确认结算
- */
- @PostMapping("/confirm")
- public Result<Void> confirm(@RequestBody Map<String, Object> params) {
- Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
- if (id == null) {
- return Result.error("id不能为空");
- }
- return supplySettlementService.confirm(id);
- }
- }
|