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

60 lines
2.3 KiB
Java

package shkd.repc.resm.opplugin;
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 static shkd.utils.TycUtils.*;
/**
* 正式供应商一键查询(正式供应商_风险查询)
* qeug_resm_tyc_supplie_ext
*/
public class TycSupplierSearchOPPlugin 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();
if("query_tyc".equals(operationKey)){
DynamicObject[] dataEntities1 = e.getDataEntities();
DynamicObject dynamicObject = dataEntities1[0];
Long supplierid = dynamicObject.getLong("supplierid");
QFilter q1 = new QFilter("id", QCP.equals, supplierid);
DynamicObject supplier_t = BusinessDataServiceHelper.loadSingle("resm_official_supplier", new QFilter[]{q1});
if (null != supplier_t) {
queryTyc(supplier_t,1);
}
}
//todo 测试定时任务代码
//正式供应商列表批量查询
if ("query_tyc_zs".equals(operationKey)) {
DynamicObject[] dataEntities = e.getDataEntities();
for (DynamicObject dataEntity : dataEntities) {
String name = dataEntity.getString("name");
QFilter q1 = new QFilter("name", QCP.equals, name);
//正式供应商
DynamicObject supplier = BusinessDataServiceHelper.loadSingle("resm_official_supplier", new QFilter[]{q1});
if (null != supplier) {
queryTyc(supplier,1);
showPreaudits(supplier);//比对天眼查数据
}
}
}
}
}