dobe_comic8/main/java/shkd/repc/resm/opplugin/TycQzSupplierSearchOPPlugin...

59 lines
2.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package shkd.repc.resm.opplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
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.servicehelper.BusinessDataServiceHelper;
import static shkd.utils.TycUtils.*;
/**
* 潜在供应商一键查询
* qeug_resm_regsupplier_ext
*/
public class TycQzSupplierSearchOPPlugin extends AbstractOperationServicePlugIn{
//天眼查API_供应商名字
// public static String tyc_Test_keyword = "";
private static final Log logger = LogFactory.getLog(TycSupplierSearchOPPlugin.class);
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
String operationKey = e.getOperationKey();
DynamicObject[] dataEntities = e.getDataEntities();
if (dataEntities.length == 0) {
return; // 如果没有数据实体,直接返回
}
DynamicObject dynamicObject = dataEntities[0];
if ("query_tyc".equals(operationKey) || isPreauditQueryNeeded(operationKey, dynamicObject)) {
//潜在供应商
DynamicObject resm_regsupplier = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), "resm_regsupplier");
queryTyc(resm_regsupplier,0);
showPreaudits(resm_regsupplier);//比对天眼查数据
}
}
private boolean isPreauditQueryNeeded(String operationKey, DynamicObject dynamicObject) {
if ("preaudit".equals(operationKey)) {
Object pkValue = dynamicObject.getPkValue();
DynamicObject resm_regsupplier = BusinessDataServiceHelper.loadSingle(pkValue, "resm_regsupplier");
if (resm_regsupplier != null) {
DynamicObjectCollection qeugInfocheckentry = resm_regsupplier.getDynamicObjectCollection("qeug_infocheckentry");
return qeugInfocheckentry.isEmpty(); // 如果集合为空返回true表示需要查询
}
}
return false; // 不是预审或不需要查询的情况
}
}