|
|
@@ -2683,6 +2683,67 @@ public class contractApproveController {
|
|
|
return BigDecimal.ZERO;
|
|
|
}
|
|
|
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_ctt.updateContractEndDate")
|
|
|
+ public ResponseObject updateContractEndDate(UserContext uc, String ids, String periodEndDate) {
|
|
|
+ if (StringUtils.isBlank(ids)) {
|
|
|
+ return ResponseObject.newErrResponse("ids 不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(periodEndDate)) {
|
|
|
+ return ResponseObject.newErrResponse("PERIOD_END_DATE 不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ String[] idArray = ids.split(",");
|
|
|
+ StringBuilder validIdSb = new StringBuilder();
|
|
|
+ int validIdCount = 0;
|
|
|
+ for (String id : idArray) {
|
|
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
+ if (validIdSb.length() > 0) {
|
|
|
+ validIdSb.append(",");
|
|
|
+ }
|
|
|
+ validIdSb.append("?");
|
|
|
+ validIdCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (validIdCount == 0) {
|
|
|
+ return ResponseObject.newErrResponse("无有效合同ID");
|
|
|
+ }
|
|
|
+
|
|
|
+ String updateSql = String.format(
|
|
|
+ "UPDATE BO_EU_DNCTT_CONTRACT SET CONTRACT_END_DATE = ?, END_DATE = ? WHERE ID IN (%s)",
|
|
|
+ validIdSb.toString()
|
|
|
+ );
|
|
|
+ System.out.println("最终执行的SQL:" + updateSql);
|
|
|
+
|
|
|
+ Object[] params = new Object[2 + validIdCount];
|
|
|
+ params[0] = periodEndDate;
|
|
|
+ params[1] = periodEndDate;
|
|
|
+ int paramIndex = 2;
|
|
|
+ for (String id : idArray) {
|
|
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
+ params[paramIndex++] = id.trim();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("参数数组长度:" + params.length + ",占位符数量:" + (2 + validIdCount)); // 调试用
|
|
|
+
|
|
|
+ int updatedRows = DBSql.update(updateSql, params);
|
|
|
+
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("ids", ids);
|
|
|
+ result.put("periodEndDate", periodEndDate);
|
|
|
+ result.put("updatedRows", updatedRows);
|
|
|
+ result.put("validIdCount", validIdCount);
|
|
|
+
|
|
|
+ ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
+ responseObject.setData(result);
|
|
|
+ return responseObject;
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ResponseObject.newErrResponse("更新失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|