dobe_comic8/main/java/shkd/repc/task/TycQueryTask.java

76 lines
3.0 KiB
Java
Raw Normal View History

2024-11-04 15:32:41 +00:00
package shkd.repc.task;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.entity.OrmLocaleValue;
import kd.bos.entity.operate.result.OperateErrorInfo;
import kd.bos.entity.validate.ErrorLevel;
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.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin;
import shkd.repc.resm.opplugin.TycSupplierSearchOPPlugin;
import shkd.utils.DobeDWUtils;
import shkd.utils.TycUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import static shkd.repc.resm.opplugin.TycSupplierSearchOPPlugin.queryTyc;
import static shkd.utils.TycUtils.convertTimestampToDate;
import static shkd.utils.TycUtils.getProvinceName;
/**
* 天眼查定时任务
*/
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<String, Object> 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);
}
}
}
}
}