public class ConmChangePlugin extends AbstractListPlugin implements Plugin {

物料撤销调用流程撤回接口(MaterialUnsubmitOp),修改注释(MaterialBillImportPlugin、)
This commit is contained in:
pan-houxiang 2025-12-12 11:16:21 +08:00
parent e52bf8a5f1
commit 1f8801ce68
3 changed files with 94 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import java.util.Map;
/**
* 标准单据列表插件
* 采购合同变更调用返利规则状态查询
*/
public class ConmChangePlugin extends AbstractListPlugin implements Plugin {
final static String KEY_OPKEY = "bizchange";

View File

@ -10,6 +10,7 @@ import java.util.Map;
/**
* 单据界面插件
* 物料导入地区必录字段时赋值给其他地区必录字段
*/
public class MaterialBillImportPlugin extends AbstractBillPlugIn implements Plugin {
@Override

View File

@ -0,0 +1,92 @@
package tqq9.lc123.cloud.app.plugin.operate.sys;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;
import kd.bos.dataentity.utils.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import tqq9.lc123.cloud.app.eip.iscb.LCLogService;
import tqq9.lc123.cloud.app.eip.iscb.impl.LCLogServiceImpl;
import tqq9.lc123.cloud.app.plugin.utils.HttpRequestUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import static cfca.svs.api.ClientEnvironment.connectTimeout;
import static kd.imc.rim.common.utils.HttpUtil.socketTimeout;
/**
* 单据操作插件
* 物料撤销 调用流程撤回 接口
*/
public class MaterialUnsubmitOp extends AbstractOperationServicePlugIn implements Plugin {
// private static final Log logger = LogFactory.getLog(MaterialUnsubmitOp.class);
// final static String KEY_OPKEY = "unsubmit";
// private static String WL_UnSubmit_URL;
//
// static {
// DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
// new QFilter[]{new QFilter("number", QCP.equals, "WL_UnSubmit_URL")});
// WL_UnSubmit_URL = url != null ? url.getString("name") : null;
// }
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
// LCLogService lcLogService = new LCLogServiceImpl();
// String operationKey = e.getOperationKey();
// if (StringUtils.equals(operationKey, KEY_OPKEY)) {
// //获取选中的物料单据数据
// DynamicObject[] dataEntities = e.getDataEntities();
// for (DynamicObject material : dataEntities) {
// String id = String.valueOf(material.getLong("id"));
// // 创建HttpClient实例
// try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
// // 创建PUT请求
// HttpPut httpPut = new HttpPut(WL_UnSubmit_URL);
// // 设置请求体
// StringEntity entity1 = new StringEntity("0", ContentType.APPLICATION_JSON);
// StringEntity entity2 = new StringEntity(id, ContentType.APPLICATION_JSON);
// httpPut.setEntity(entity1);
// httpPut.setEntity(entity2);
// // 执行请求并处理响应
// try (CloseableHttpResponse response = httpClient.execute(httpPut)) {
// int statusCode = response.getStatusLine().getStatusCode();
// HttpEntity responseEntity = response.getEntity();
//
// if (responseEntity == null) {
// throw new IOException("Empty response entity");
// }
//
// String responseBody = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
// logger.debug("Response status: {}, Body: {}", statusCode, responseBody);
//
// if (statusCode < 200 || statusCode >= 300) {
// throw new IOException("HTTP request failed with status code: " + statusCode + "\n" + "HTTP request failed responseBody: " + responseBody);
// }
// }
//
// } catch (IOException ex) {
// lcLogService.savelog("FW_流程实例流程撤回", WL_UnSubmit_URL, false, false, id.toString(), "接口调用报错errormessage:" + ex.getMessage());
// throw new RuntimeException(ex + "FW_流程实例流程撤回失败" );
// }
// }
//
// }
}
}