feat: 付款审批入口接入特批即时发起并调整审批响应提示
/approve 与 MK 审批回调在审批生效后立即发起付款特批;审批响应区分特批待发起、特批审核中、 合规推送失败(data=false 警告,保留重推)与金蝶同步结果。
This commit is contained in:
+22
-3
@@ -29,13 +29,16 @@ import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.transport.constant.HcsSyncConstant;
|
||||
import org.springblade.transport.listener.KingdeeApprovalSyncListener;
|
||||
import org.springblade.transport.pojo.dto.PaymentApplicationSaveRequest;
|
||||
import org.springblade.transport.pojo.dto.PaymentApplicationStatusRequest;
|
||||
import org.springblade.transport.pojo.entity.PaymentApplication;
|
||||
import org.springblade.transport.pojo.vo.PaymentApplicationReferenceAmountVO;
|
||||
import org.springblade.transport.pojo.vo.PaymentApplicationVO;
|
||||
import org.springblade.transport.pojo.vo.ProjectAdvanceWriteOffOptionVO;
|
||||
import org.springblade.transport.service.IPaymentApplicationService;
|
||||
import org.springblade.transport.support.hcs.HcsImmediatePushSupport;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -43,6 +46,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/** 付款申请控制器。 @author Chill */
|
||||
@@ -53,6 +57,7 @@ import java.util.List;
|
||||
@Tag(name = "付款管理", description = "付款申请管理")
|
||||
public class PaymentApplicationController extends BladeController {
|
||||
private final IPaymentApplicationService paymentApplicationService;
|
||||
private final HcsImmediatePushSupport hcsImmediatePushSupport;
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "付款申请分页")
|
||||
@@ -96,13 +101,27 @@ public class PaymentApplicationController extends BladeController {
|
||||
@Operation(summary = "审批通过付款申请")
|
||||
public R approve(@RequestBody PaymentApplicationStatusRequest request) {
|
||||
paymentApplicationService.approve(request);
|
||||
return approveResponse();
|
||||
// 审批生效后立即发起付款特批(C106-3,不受即时推送开关控制);失败仅告警不阻断审批结果,保留重推
|
||||
hcsImmediatePushSupport.pushPaymentAndWait(request.getId());
|
||||
return approveResponse(request.getId());
|
||||
}
|
||||
|
||||
/** 审批接口统一响应:审批已生效,自动推送结果(成功单据号/失败原因)一并返回;失败用 data=false 供前端区分提示样式 */
|
||||
private R approveResponse() {
|
||||
/** 审批接口统一响应:审批已生效,付款特批发起/自动同步结果(成功单据号/失败原因)一并返回;失败用 data=false 供前端区分提示样式 */
|
||||
private R approveResponse(Long id) {
|
||||
String hcsFailure = HcsImmediatePushSupport.pollSyncFailure();
|
||||
String syncFailure = KingdeeApprovalSyncListener.pollSyncFailure();
|
||||
String syncResult = KingdeeApprovalSyncListener.pollSyncResult();
|
||||
if (hcsFailure != null) {
|
||||
return R.data(Boolean.FALSE, "审批通过,但发起付款特批/推送合规失败:" + hcsFailure + ",可稍后重推合规");
|
||||
}
|
||||
PaymentApplication payment = paymentApplicationService.getById(id);
|
||||
String specStatus = payment == null ? null : payment.getHcsSpecStatus();
|
||||
if (HcsSyncConstant.SPEC_STATUS_NEED.equals(specStatus)) {
|
||||
return R.success("审批通过,付款特批待发起,可在详情页重推合规");
|
||||
}
|
||||
if (Arrays.asList(HcsSyncConstant.SPEC_STATUS_PUSHING, HcsSyncConstant.SPEC_STATUS_PROCESSING).contains(specStatus)) {
|
||||
return R.success("审批通过,已发起付款特批,特批通过后将自动推送履约数据并同步金蝶");
|
||||
}
|
||||
if (syncFailure != null) {
|
||||
return R.data(Boolean.FALSE, "审批通过,但自动同步金蝶失败:" + syncFailure);
|
||||
}
|
||||
|
||||
+3
@@ -378,6 +378,7 @@ public final class MkProcessBizHandlers {
|
||||
@RequiredArgsConstructor
|
||||
public static class PaymentHandler implements IMkProcessBizHandler {
|
||||
private final IPaymentApplicationService service;
|
||||
private final HcsImmediatePushSupport hcsImmediatePushSupport;
|
||||
|
||||
@Override
|
||||
public String bizType() {
|
||||
@@ -429,6 +430,8 @@ public final class MkProcessBizHandlers {
|
||||
updated.setHcsSyncStatus(HcsSyncConstant.HCS_STATUS_UNSYNCED);
|
||||
service.updateById(updated);
|
||||
}
|
||||
// 审批通过立即发起付款特批(C106-3,不受即时推送开关控制;事务提交后异步执行,失败留待重推兜底)
|
||||
hcsImmediatePushSupport.pushPaymentAfterCommit(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -524,7 +524,7 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
|
||||
useBillBalance(entity);
|
||||
}
|
||||
entity.setApprovalStatus(TransportBusiConstant.APPROVED); entity.setCurrentNode("审批通过"); entity.setCurrentProcessor(AuthUtil.getUserName());
|
||||
// HCS 推送零埋点:审批通过仅置待同步状态,扫描任务据此推特批(如需)与履约记录(ADR-0001)
|
||||
// HCS 推送零埋点:审批通过仅置待同步状态;特批发起由 /approve 与 MK 审批回调经 HcsImmediatePushSupport 即时触发,扫描任务兜底(ADR-0001)
|
||||
entity.setHcsSyncStatus(HcsSyncConstant.HCS_STATUS_UNSYNCED);
|
||||
updateById(entity);
|
||||
// 履约计划款项金额累加(款项金额=申请付款金额,多次付款累加),已同步计划行置 update 待随付款链重推 C103-9
|
||||
|
||||
Reference in New Issue
Block a user