调整收付款问题

This commit is contained in:
2026-08-31 17:04:01 +08:00
parent d1ef6eb97b
commit a4599c48c5
4 changed files with 62 additions and 0 deletions
@@ -28,6 +28,7 @@ import org.springblade.transport.pojo.vo.FormalSettlementVO;
import org.springblade.transport.pojo.vo.PreSettlementVO;
import org.springblade.transport.service.IFormalSettlementService;
import org.springblade.transport.service.IPreSettlementService;
import org.springblade.transport.service.IReceiptFlowService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -51,6 +52,7 @@ import java.util.Map;
public class FormalSettlementController extends BladeController {
private final IFormalSettlementService formalSettlementService;
private final IPreSettlementService preSettlementService;
private final IReceiptFlowService receiptFlowService;
@GetMapping("/list")
@ApiOperationSupport(order = 1)
@@ -166,4 +168,11 @@ public class FormalSettlementController extends BladeController {
public R<List<String>> applyPayments(@RequestBody FormalSettlementBatchPaymentRequest request) {
return R.data(formalSettlementService.applyPayments(request));
}
@GetMapping("/receipt-claims")
@ApiOperationSupport(order = 19)
@Operation(summary = "应收正式结算单收款认领信息")
public R<List<Map<String, Object>>> receiptClaims(@RequestParam Long formalSettlementId) {
return R.data(receiptFlowService.settlementClaims(formalSettlementId));
}
}
@@ -48,6 +48,8 @@ public interface IReceiptFlowService extends BaseService<KingdeeReceiptFlow> {
List<Map<String, Object>> settlementCandidates(String keyword, Long flowId);
List<Map<String, Object>> settlementClaims(Long formalSettlementId);
Long claim(ReceiptClaimRequest request);
int sync(ReceiptFlowSyncRequest request);
@@ -183,6 +183,7 @@ public class PreSettlementServiceImpl extends BaseServiceImpl<PreSettlementMappe
public PreSettlementVO detail(Long id) {
PreSettlement settlement = loadExisting(id);
PreSettlementVO vo = PreSettlementWrapper.build().entityVO(settlement);
fillPaymentApplicationAmounts(List.of(vo));
List<PreSettlementDetail> details = listDetails(id);
vo.setDetails(details);
List<Long> detailIds = details.stream().map(PreSettlementDetail::getId).toList();
@@ -151,6 +151,56 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
.toList();
}
@Override
public List<Map<String, Object>> settlementClaims(Long formalSettlementId) {
if (formalSettlementId == null) {
throw new ServiceException("正式结算单ID不能为空");
}
FormalSettlement settlement = formalSettlementMapper.selectById(formalSettlementId);
if (settlement == null || Objects.equals(settlement.getIsDeleted(), 1)) {
throw new ServiceException("正式结算单不存在");
}
List<ReceiptClaimSettlement> relations = claimSettlementMapper.selectList(
Wrappers.<ReceiptClaimSettlement>lambdaQuery()
.eq(ReceiptClaimSettlement::getFormalSettlementId, formalSettlementId)
.eq(ReceiptClaimSettlement::getStatus, 1)
.orderByDesc(ReceiptClaimSettlement::getCreateTime));
if (relations.isEmpty()) {
return List.of();
}
List<Long> claimIds = relations.stream().map(ReceiptClaimSettlement::getReceiptClaimId)
.filter(Objects::nonNull).distinct().toList();
List<Long> flowIds = relations.stream().map(ReceiptClaimSettlement::getReceiptFlowId)
.filter(Objects::nonNull).distinct().toList();
Map<Long, ReceiptClaim> claims = claimIds.isEmpty() ? Map.of() : claimMapper.selectBatchIds(claimIds)
.stream().collect(Collectors.toMap(ReceiptClaim::getId, Function.identity()));
Map<Long, KingdeeReceiptFlow> flows = flowIds.isEmpty() ? Map.of() : listByIds(flowIds)
.stream().collect(Collectors.toMap(KingdeeReceiptFlow::getId, Function.identity()));
return relations.stream().map(relation -> {
ReceiptClaim claim = claims.get(relation.getReceiptClaimId());
KingdeeReceiptFlow flow = flows.get(relation.getReceiptFlowId());
if (claim == null || flow == null) {
return null;
}
Map<String, Object> row = new LinkedHashMap<>();
row.put("receiptClaimId", claim.getId());
row.put("receiptFlowId", flow.getId());
row.put("receiptNoticeNo", flow.getReceiptNoticeNo());
row.put("payerName", flow.getPayerName());
row.put("receiptAmount", money(flow.getReceiptAmount()));
row.put("allocatedReceiptAmount", money(relation.getAllocatedReceiptAmount()));
row.put("transactionTime", flow.getTransactionTime());
row.put("counterpartyName", flow.getCounterpartyName());
row.put("detailSerialNo", flow.getDetailSerialNo());
row.put("claimerName", claim.getClaimerName());
row.put("claimerDeptName", claim.getClaimerDeptName());
row.put("claimDate", claim.getClaimDate());
row.put("claimStatus", claim.getClaimStatus());
row.put("claimStatusName", CLAIMED.equals(claim.getClaimStatus()) ? "已认领" : "已作废");
return row;
}).filter(Objects::nonNull).toList();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long claim(ReceiptClaimRequest request) {