package shkd.repc.task; import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.exception.KDException; 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.schedule.executor.AbstractTask; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.sdk.plugin.Plugin; import java.util.Map; import static shkd.utils.TycUtils.*; /** * 天眼查定时任务 */ public class TycQueryTask extends AbstractTask implements Plugin { private static final Log logger = LogFactory.getLog(TycQueryTask.class); //todo 遍历所需要的供应商,拿到id,过滤出供应商画像(风险查询),进行调接口并且赋值到画像,并把供应商画像是否查询过天眼查字段改为是 @Override public void execute(RequestContext requestContext, Map map) throws KDException { //处理状态为正常的正式供应商 QFilter q1 = new QFilter("id", QCP.is_notnull, null); // QFilter q3 = new QFilter("treatmentstatus", QCP.equals, "A"); DynamicObject[] qeugTycInfochecks = BusinessDataServiceHelper.load("qeug_tyc_infocheck", "number,name,qeug_apifields", null); String str = ""; StringBuilder sb = new StringBuilder(); for (int i = 0; i < qeugTycInfochecks.length; i++) { if ("name".equals(qeugTycInfochecks[i].getString("number"))) { continue; } sb.append((String)qeugTycInfochecks[i].getString("number")); if (i < qeugTycInfochecks.length - 1) { sb.append(","); } } str = sb.toString(); DynamicObject[] loads = BusinessDataServiceHelper.load("resm_official_supplier", "name,"+str, new QFilter[]{q1}); for (DynamicObject supplier : loads) { //正式供应商 if (null != supplier) { QFilter q2 = new QFilter("supplierid", QCP.equals, supplier.getLong("id")); //正式供应商_风险查询(供应商画像) DynamicObject tyc_supplier = BusinessDataServiceHelper.loadSingle("resm_tyc_supplier", new QFilter[]{q2}); if (null != tyc_supplier) { queryTyc(supplier,1); } } } } }