:feat: 项目立项与合同新增页面勾选批量推送合规接口
This commit is contained in:
+36
@@ -68,6 +68,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -135,6 +136,41 @@ public class HcsSyncController {
|
||||
return R.data(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面勾选批量重推(项目立项/合同列表勾选行后批量推送,逐条推送互不影响,单条失败计入失败明细)
|
||||
*/
|
||||
@PostMapping("/sync/{bizType}/batch")
|
||||
@ApiOperationSupport(order = 17)
|
||||
@Operation(summary = "按勾选ID批量推送/重推合规", description = "仅支持 project(项目立项)、contract(合同),逐条重置待同步后立即推送,单条失败不影响其余,返回成功数与失败明细")
|
||||
public R<String> repushBatch(@Parameter(description = "业务类型 project/contract", required = true) @PathVariable String bizType,
|
||||
@Parameter(description = "单据ID列表", required = true) @RequestBody List<Long> ids) {
|
||||
if (!List.of(HcsSyncConstant.BIZ_TYPE_PROJECT, HcsSyncConstant.BIZ_TYPE_CONTRACT).contains(bizType)) {
|
||||
throw new IllegalArgumentException("不支持的HCS批量推送业务类型:" + bizType);
|
||||
}
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return R.fail("请先勾选要推送的单据");
|
||||
}
|
||||
int successCount = 0;
|
||||
List<String> failureList = new ArrayList<>();
|
||||
for (Long id : ids) {
|
||||
try {
|
||||
if (HcsSyncConstant.BIZ_TYPE_PROJECT.equals(bizType)) {
|
||||
hcsProjectSyncSupport.repushProject(id);
|
||||
} else {
|
||||
hcsContractSyncSupport.repushContract(id);
|
||||
}
|
||||
successCount++;
|
||||
} catch (Exception exception) {
|
||||
failureList.add(id + ":" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
String summary = "批量推送完成:成功 " + successCount + " 条,失败 " + failureList.size() + " 条";
|
||||
if (!failureList.isEmpty()) {
|
||||
summary += ";失败明细:" + String.join(";", failureList);
|
||||
}
|
||||
return R.data(summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 特批结果人工确认(§9-U1 过渡兜底:与合规 paymentLegal/result 回调等效,均联动付款审批状态)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user