package shkd.repc.resm.opplugin; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; 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.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.validate.ErrorLevel; 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.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.util.HttpClientUtils; import kd.bos.util.StringUtils; import shkd.utils.DobeDWUtils; import shkd.utils.OAUtils; import shkd.utils.TycUtils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import static shkd.utils.TycUtils.convertTimestampToDate; import static shkd.utils.TycUtils.getProvinceName; /** * 正式供应商一键查询(正式供应商_风险查询) * 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); //todo 把供应商画像是否查询过天眼查字段改为是 ////正式供应商_风险查询(供应商画像)--查询天眼查按钮 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); } } //todo 测试定时任务代码 //正式供应商列表批量查询 if ("query_tyc_zs".equals(operationKey)) { DynamicObject[] dataEntities = e.getDataEntities(); logger.info("111111111正式供应商列表批量查询"); for (DynamicObject dataEntity : dataEntities) { String name = dataEntity.getString("name"); QFilter q1 = new QFilter("name", QCP.equals, name); logger.info(name+"22222222正式供应商列表批量查询"); //正式供应商 DynamicObject supplier = BusinessDataServiceHelper.loadSingle("resm_official_supplier", new QFilter[]{q1}); if (null != supplier) { logger.info(name+"3333333正式供应商列表批量查询"); queryTyc(supplier); dbTYC(supplier);//比对天眼查数据 } } } } public void dbTYC(DynamicObject supplier_zs){ /** * -------------------------------------------基本信息核对------------------------------------------ */ DynamicObjectCollection qeug_infocheckentry = supplier_zs.getDynamicObjectCollection("qeug_infocheckentry"); qeug_infocheckentry.clear(); DynamicObject[] qeugTycInfochecks = BusinessDataServiceHelper.load("qeug_tyc_infocheck", "number,name,qeug_apifields", null); for (int i = 0; i < qeugTycInfochecks.length; i++) { DynamicObject qeugTycInfocheck = qeugTycInfochecks[i]; DynamicObject add = qeug_infocheckentry.addNew(); add.set("seq",i); String number = qeugTycInfocheck.getString("number"); add.set("qeug_bsfield",number);//核对字段标识 add.set("qeug_bsfieldname",qeugTycInfocheck.getString("name"));//核对项目名称 String bsinput = "";//录入内容 Object obj = supplier_zs.get(number); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); if (obj instanceof Date) { Date date = (Date) obj; bsinput = sd.format(date); } else if(obj instanceof String) { bsinput =(String) obj; }else if(obj instanceof OrmLocaleValue) { OrmLocaleValue o = (OrmLocaleValue) obj; bsinput = o.get("zh_CN"); } add.set("qeug_bsinput",bsinput); String qeugApifields = qeugTycInfocheck.getString("qeug_apifields");//接口字段标识 add.set("qeug_apifield",qeugApifields);//接口字段标识 String queryresult = "";//接口查询结果 Object obj1 = supplier_zs.get(qeugApifields); if (obj1 instanceof Date) { Date date = (Date) obj1; queryresult = sd.format(date); } else if(obj1 instanceof String) { queryresult =(String) obj1; } else if(obj1 instanceof Long) { Date date = new Date((Long) obj1); queryresult = sd.format(date); } add.set("qeug_queryresult",queryresult); if (bsinput.equals(queryresult)) { add.set("qeug_issame","1");//0:不匹配 1:匹配 }else { add.set("qeug_issame","0"); } } SaveServiceHelper.save(new DynamicObject[]{supplier_zs}); } public static void queryTyc(DynamicObject supplier_zs) { DynamicObject dynamicObject = supplier_zs;//正式供应商 // DynamicObject supplier_t = supplier_zs;//正式供应商 String tyc_Test_keyword = supplier_zs.getString("name"); try { /** * 1.企业基本信息(含主要人员)_819 ?keyword=中航重机股份有限公司 */ String tyc_Baseinfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Baseinfo + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"企业基本信息(含主要人员)_819"); JSONObject tyc_Baseinfo_results = JSONObject.parseObject(tyc_Baseinfo); if (null != tyc_Baseinfo_results) { JSONObject tyc_Baseinfo_result = (JSONObject)tyc_Baseinfo_results.get("result"); if (null != tyc_Baseinfo_result) { //法人 String legalPersonName = (String) tyc_Baseinfo_result.get("legalPersonName"); //注册号 String regNumber = (String) tyc_Baseinfo_result.get("regNumber"); //组织机构代码 String orgNumber = (String) tyc_Baseinfo_result.get("orgNumber"); //营业期限(逻辑待定)--经营开始时间-经营结束时间 String businessduration = ""; Long fromTime = (Long)tyc_Baseinfo_result.get("fromTime");//开始时间 Long toTime =(Long)tyc_Baseinfo_result.get("toTime");//结束时间 if (null != fromTime && null != toTime) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); businessduration =sdf.format(new Date(fromTime)) + "至" + sdf.format(new Date(toTime));//营业期限 } //注册地址 String regLocation = (String) tyc_Baseinfo_result.get("regLocation"); //登记机关 String regInstitute = (String) tyc_Baseinfo_result.get("regInstitute"); //经营范围(2000 文本) String businessScope = (String) tyc_Baseinfo_result.get("businessScope"); //企业状态(经营状态) String regStatus = (String) tyc_Baseinfo_result.get("regStatus"); //网址 String websiteList = (String) tyc_Baseinfo_result.get("websiteList"); //todo 发照日期 //统一社会信用代码 String creditCode = (String) tyc_Baseinfo_result.get("creditCode"); //行业 String industry = (String) tyc_Baseinfo_result.get("industry"); //省份简称 String base = (String) tyc_Baseinfo_result.get("base"); String provinceName = getProvinceName(base); //注册资本 String regCapital = (String) tyc_Baseinfo_result.get("regCapital"); //企业联系电话 //企业联系方式 String phoneNumber = (String) tyc_Baseinfo_result.get("phoneNumber"); //企业类型 String companyOrgType = (String) tyc_Baseinfo_result.get("companyOrgType"); //成立日期 String estiblishtime = ""; Long estiblishTime = (Long) tyc_Baseinfo_result.get("estiblishTime"); if (null != estiblishTime) { estiblishtime = convertTimestampToDate(estiblishTime); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //注销日期 String canceldate = ""; Long cancelDate = (Long) tyc_Baseinfo_result.get("cancelDate"); if (null != cancelDate) { canceldate = convertTimestampToDate(cancelDate); } //市 String city = (String) tyc_Baseinfo_result.get("city"); //曾用名 String historyNames = (String) tyc_Baseinfo_result.get("historyNames"); //参保人数 Integer socialStaffNum = (Integer) tyc_Baseinfo_result.get("socialStaffNum"); //主要人员列表 DynamicObjectCollection qeugEntryentity = dynamicObject.getDynamicObjectCollection("qeug_entryentity"); qeugEntryentity.clear(); JSONObject staffListS = tyc_Baseinfo_result.getJSONObject("staffList"); JSONArray staffLists = staffListS.getJSONArray("result"); if (null != staffLists) { for (int i = 0; i < staffLists.size(); i++) { DynamicObject add = qeugEntryentity.addNew(); JSONObject staffList = (JSONObject)staffLists.get(i); String name = staffList.getString("name");//主要人员姓名 String typeJoin = "";//主要人员职位 JSONArray typeJoins = staffList.getJSONArray("typeJoin"); if (null != typeJoins) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < typeJoins.size(); j++) { sb.append((String)typeJoins.get(j)); if (j < typeJoins.size() - 1) { sb.append(","); } } typeJoin = sb.toString(); } add.set("seq",i); add.set("qeug_personnelname",name);//主要人员姓名 add.set("qeug_position",typeJoin);//主要人员职位 } } //设置到潜在供应商中 dynamicObject.set("qeug_legalpersonn",legalPersonName);//法人代表 dynamicObject.set("qeug_regnumber",regNumber);//企业注册号 dynamicObject.set("qeug_orgnumber",orgNumber);//组织机构代码 dynamicObject.set("qeug_businessduration",businessduration);//营业期限 dynamicObject.set("qeug_reglocation",regLocation);//公司地址 dynamicObject.set("qeug_reginstitute",regInstitute);//登记机关 dynamicObject.set("qeug_regstatus",regStatus);//经营状态 dynamicObject.set("qeug_websitelist",websiteList);//企业网站 try { Date parse = sdf.parse(estiblishtime); dynamicObject.set("qeug_photodate",parse);//发照日期 dynamicObject.set("qeug_estiblishtime",parse);//成立日期 } catch (ParseException ex) { throw new RuntimeException(ex); } dynamicObject.set("qeug_creditcode",creditCode);//统一社会信用代码 dynamicObject.set("qeug_industry",industry);//所属行业 dynamicObject.set("qeug_bases",provinceName);//省 dynamicObject.set("qeug_regcapital",regCapital);//注册资本 dynamicObject.set("qeug_companyorgtype",companyOrgType);//企业类型 dynamicObject.set("qeug_canceldate",canceldate);//注销日期 dynamicObject.set("qeug_city",city);//城市 dynamicObject.set("qeug_phonenumber",phoneNumber);//联系电话 dynamicObject.set("qeug_historynames",historyNames);//曾用名 dynamicObject.set("qeug_socialstaffnum",socialStaffNum);//参保人数 dynamicObject.set("qeug_businessscopes",businessScope);//经营范围 SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } /** * 20.疑似实际控制人_1123 ?keyword=北京百度网讯科技有限公司 */ String tyc_ActualControl = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_ActualControl + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"疑似实际控制人_1123"); JSONObject tyc_ActualControl_results = JSONObject.parseObject(tyc_ActualControl); if (null != tyc_ActualControl_results) { JSONObject tyc_ActualControl_result = (JSONObject)tyc_ActualControl_results.get("result"); if (null != tyc_ActualControl_result) { JSONArray actualControllerLists = tyc_ActualControl_result.getJSONArray("actualControllerList"); String name = ""; if (null != actualControllerLists) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < actualControllerLists.size(); i++) { JSONObject actualControllerList = (JSONObject)actualControllerLists.get(i); sb.append((String)actualControllerList.get("name"));//控制人姓名 if (i < actualControllerLists.size() - 1) { sb.append(","); } } name = sb.toString(); } dynamicObject.set("qeug_controllingperson",name);//控制人姓名 SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } /** * todo 2.实际控制权_747 ?pageSize=20&keyword=北京百度网讯科技有限公司&pageNum=1 */ String tyc_Companyholding = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Companyholding + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"实际控制权_747"); /** * 3.总公司_963 ?keyword=139573097 */ String tyc_ParentCompany = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_ParentCompany + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"总公司_963"); JSONObject tyc_ParentCompany_results = JSONObject.parseObject(tyc_ParentCompany); if (null != tyc_ParentCompany_results) { JSONObject tyc_ParentCompany_result = (JSONObject)tyc_ParentCompany_results.get("result"); if (null != tyc_ParentCompany_result) { //总公司名 String name = (String) tyc_ParentCompany_result.get("name"); dynamicObject.set("qeug_headoffice",name);//总公司名 SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } /** * 4.工商信息_1001 ?keyword=9519792 */ DynamicObjectCollection qeugIcentry = dynamicObject.getDynamicObjectCollection("qeug_icentry"); qeugIcentry.clear(); String tyc_Ic = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Ic + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"工商信息_1001"); JSONObject tyc_Ic_results = JSONObject.parseObject(tyc_Ic); if (null != tyc_Ic_results) { JSONObject tyc_Ic_result = (JSONObject)tyc_Ic_results.get("result"); if (null != tyc_Ic_result) { JSONArray branchLists = tyc_Ic_result.getJSONArray("branchList"); if (null != branchLists) { for (int i = 0; i < branchLists.size(); i++) { DynamicObject add = qeugIcentry.addNew(); JSONObject branchList = (JSONObject)branchLists.get(i); String branchListname = (String)branchList.get("name");//分支机构名称 String regStatus = (String)branchList.get("regStatus");//经营状态 add.set("seq",i); add.set("qeug_branchlistname",branchListname);//分支机构名称 add.set("qeug_regstatusic",regStatus);//经营状态 SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } } /** * 5.建筑资质-注册人员_1009 ?pageSize=20&keyword=中煤科工集团北京华宇工程有限公司&pageNum=1 */ DynamicObjectCollection qeugReghumanentry = dynamicObject.getDynamicObjectCollection("qeug_reghumanentry"); qeugReghumanentry.clear(); String tyc_RegHuman = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_RegHuman + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"建筑资质-注册人员_1009"); JSONObject tyc_RegHuman_results = JSONObject.parseObject(tyc_RegHuman); if (null != tyc_RegHuman_results) { JSONObject tyc_RegHuman_result = (JSONObject)tyc_RegHuman_results.get("result"); if (null != tyc_RegHuman_result) { JSONArray items = tyc_RegHuman_result.getJSONArray("items"); if (null != items) { for (int i = 0; i < items.size(); i++) { DynamicObject add = qeugReghumanentry.addNew(); JSONObject branchList = (JSONObject)items.get(i); String humanName = (String) branchList.get("humanName");//注册人员名字 String registerType = (String) branchList.get("registerType");//注册类别 add.set("seq",i); add.set("qeug_humanname",humanName);//注册人员名字 add.set("qeug_registertype",registerType);//注册类别 SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } } /** * 6.建筑资质-工程项目_1011 ?pageSize=20&keyword=中煤科工集团北京华宇工程有限公司&pageNum=1 */ DynamicObjectCollection qeug_projectentry = dynamicObject.getDynamicObjectCollection("qeug_projectentry"); qeug_projectentry.clear(); String tyc_Project = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Project + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"建筑资质-工程项目_1011"); JSONObject tyc_Project_results = JSONObject.parseObject(tyc_Project); if (null != tyc_Project_results) { JSONObject tyc_Project_result = (JSONObject)tyc_Project_results.get("result"); if (null != tyc_Project_result) { JSONArray items = tyc_Project_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { DynamicObject add = qeug_projectentry.addNew(); JSONObject o = (JSONObject)items.get(i); String proName = (String)o.get("proName");//项目名称 String base = (String)o.get("base");//项目属地 String proType = (String)o.get("proType");//项目类别 String buildCompany = (String)o.get("buildCompany");//建设单位 add.set("seq",i); add.set("qeug_proname",proName);//项目名称 add.set("qeug_base",base);//项目属地 add.set("qeug_protype",proType);//项目类别 add.set("qeug_buildcompanys",buildCompany);//建设单位 SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 7.失信被执行人(人员)_1076 ?hid=2187083120&name=北京百乐文化传媒有限公司&humanName=贾跃亭&cid=34630712&pageSize=20&pageNum=1 */ String tyc_Human_Dishonest = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Human_Dishonest + "?name=" + tyc_Test_keyword,tyc_Test_keyword,"被执行人_1077"); JSONObject tyc_Human_Dishonest_results = JSONObject.parseObject(tyc_Human_Dishonest); if (null != tyc_Human_Dishonest_results) { JSONObject tyc_Human_Dishonest_result = (JSONObject)tyc_Human_Dishonest_results.get("result"); if (null != tyc_Human_Dishonest_result) { JSONArray items = tyc_Human_Dishonest_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { JSONObject o = (JSONObject)items.get(i); String courtname = (String)o.get("courtname");//法院 String iname = (String)o.get("iname");//失信人名称 String disrupttypename = (String)o.get("disrupttypename");//失信被执行人行为具体情形 String performance = (String)o.get("performance");//履行情况 String gistunit = (String)o.get("gistunit");//做出执行的依据单位 String duty = (String)o.get("duty");//生效法律文书确定的义务 } } } /** * todo 8.被执行(人员)_1077 ?name=宁夏泰华实业集团有限公司&humanName=禹学峰&cid=185429210&hid=2095668600&pageNum=1&pageSize=20 */ // String tyc_ZhiXingInfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_ZhiXingInfo // + "?name=" + tyc_Test_keyword); /** * 9.资质证书_880 ?name=北京百度网讯科技有限公司&certificateName=中国质量认证中心_CCC证书&pageSize=20&id=22822&pageNum=1 */ DynamicObjectCollection qeugCertificateentry = dynamicObject.getDynamicObjectCollection("qeug_certificateentry"); qeugCertificateentry.clear(); String tyc_Certificate = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Certificate + "?name=" + tyc_Test_keyword,tyc_Test_keyword,"证照_1081"); JSONObject tyc_Certificate_results = JSONObject.parseObject(tyc_Certificate); if (null != tyc_Certificate_results) { JSONObject tyc_Certificate_result = (JSONObject)tyc_Certificate_results.get("result"); if (null != tyc_Certificate_result) { JSONArray items = tyc_Certificate_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { JSONObject o = (JSONObject)items.get(i); DynamicObject add = qeugCertificateentry.addNew(); String certNo = (String)o.get("certNo");//证书编号 String certificateName = (String)o.get("certificateName");//证书类型 String startDate = (String)o.get("startDate");//发证日期 String endDate = (String)o.get("endDate");//截止日期 add.set("seq",i); add.set("qeug_certno",certNo); add.set("qeug_certificatename",certificateName); add.set("qeug_startdate",startDate); add.set("qeug_enddate",endDate); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 10.建筑资质-资质资格_1007 ?pageSize=20&keyword=河南省建筑设计研究院有限公司&pageNum=1 */ DynamicObjectCollection qeug_qualificationentry = dynamicObject.getDynamicObjectCollection("qeug_qualificationentry"); qeug_qualificationentry.clear(); String tyc_Qualification = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Qualification + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"建筑资质-资质资格_1007"); JSONObject tyc_Qualification_results = JSONObject.parseObject(tyc_Qualification); if (null != tyc_Qualification_results) { JSONObject tyc_Qualification_result = (JSONObject)tyc_Qualification_results.get("result"); if (null != tyc_Qualification_result) { JSONArray items = tyc_Qualification_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { DynamicObject add = qeug_qualificationentry.addNew(); JSONObject o = (JSONObject)items.get(i); String certificateNum = (String)o.get("certificateNum");//资质证书号 String qualificationName = (String)o.get("qualificationName");//资质名称 String issuingCertificateTime = (String)o.get("issuingCertificateTime");//发证日期 String effectiveTime = (String)o.get("effectiveTime");//证书有效期 String organ = (String)o.get("organ");//发证机关 add.set("seq",i); add.set("qeug_certificatenum",certificateNum); add.set("qeug_qualificationname",qualificationName); add.set("qeug_issuingcertificateti",issuingCertificateTime); add.set("qeug_effectivetime",effectiveTime); add.set("qeug_organ",organ); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 11.变更记录_822 ?keyword=北京百度网讯科技有限公司&pageNum=1&pageSize=20 */ DynamicObjectCollection qeugChangeinfo = dynamicObject.getDynamicObjectCollection("qeug_changeinfo"); qeugChangeinfo.clear(); String tyc_Changeinfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Changeinfo + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"变更记录_822"); JSONObject tyc_Changeinfo_results = JSONObject.parseObject(tyc_Changeinfo); if (null != tyc_Changeinfo_results) { JSONObject tyc_Changeinfo_result = (JSONObject)tyc_Changeinfo_results.get("result"); if (null != tyc_Changeinfo_result) { JSONArray items = tyc_Changeinfo_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { JSONObject o = (JSONObject)items.get(i); DynamicObject add = qeugChangeinfo.addNew(); String changeItem = (String)o.get("changeItem");//变更事项 String changeTime = (String)o.get("changeTime");//变更时间 String contentBefore = (String)o.get("contentBefore");//变更前 String contentAfter = (String)o.get("contentAfter");//变更后 add.set("seq",i); add.set("qeug_changeitem",changeItem); add.set("qeug_changetime",changeTime); add.set("qeug_contentbefore",contentBefore); add.set("qeug_contentafter",contentAfter); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 12.经营异常_848 ?pageSize=20&keyword=宁夏凯捷建设工程有限公司&pageNum=1 */ DynamicObjectCollection qeugAbnormal = dynamicObject.getDynamicObjectCollection("qeug_abnormal"); qeugAbnormal.clear(); String tyc_Abnormal = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Abnormal + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"经营异常_848"); JSONObject tyc_Abnormal_results = JSONObject.parseObject(tyc_Abnormal); if (null != tyc_Abnormal_results) { JSONObject tyc_Abnormal_result = (JSONObject)tyc_Abnormal_results.get("result"); if (null != tyc_Abnormal_result) { JSONArray items = tyc_Abnormal_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { JSONObject o = (JSONObject)items.get(i); DynamicObject add = qeugAbnormal.addNew(); String putReason = (String)o.get("putReason");//列入异常名录原因 String putDate = (String)o.get("putDate");//列入日期 String removeReason = (String)o.get("removeReason");//移除异常名录原因 String removeDate = (String)o.get("removeDate");//移出日期 add.set("seq",i); add.set("qeug_putreason",putReason); add.set("qeug_putdate",putDate); add.set("qeug_removereason",removeReason); add.set("qeug_removedate",removeDate); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 13.企业股东_821 ?pageSize=20&keyword=北京百度网讯科技有限公司&pageNum=1 */ DynamicObjectCollection qeugShareholderentry = dynamicObject.getDynamicObjectCollection("qeug_shareholderentry"); qeugShareholderentry.clear(); String tyc_Holder = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Holder + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"企业股东_821"); JSONObject tyc_Holder_results = JSONObject.parseObject(tyc_Holder); if (null != tyc_Holder_results) { JSONObject tyc_Holder_result = (JSONObject)tyc_Holder_results.get("result"); if (null != tyc_Holder_result) { JSONArray items = tyc_Holder_result.getJSONArray("items"); for (Object item : items) { DynamicObject add = qeugShareholderentry.addNew(); JSONObject o = (JSONObject) item; String name = (String) o.get("name");//股东名 String typeName = "";//股东类型 Integer type = (Integer) o.get("type");//股东类型 1-公司 2-人 3-其它 switch (type) { case 1: typeName = "公司"; break; case 2: typeName = "人"; break; case 3: typeName = "其它"; break; default: break; } add.set("qeug_name", name);//股东名 add.set("qeug_typename", typeName);//股东类型 1-公司 2-人 3-其它 SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 14.建筑资质-不良行为_1030 ?pageSize=20&keyword=湖北正大建设工程有限公司&pageNum=1 */ DynamicObjectCollection qeug_badconductentry = dynamicObject.getDynamicObjectCollection("qeug_badconductentry"); qeug_badconductentry.clear(); String tyc_BadConduct = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_BadConduct + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"建筑资质-不良行为_1030"); JSONObject tyc_BadConduct_results = JSONObject.parseObject(tyc_BadConduct); if (null != tyc_BadConduct_results) { JSONObject tyc_BadConduct_result = (JSONObject)tyc_BadConduct_results.get("result"); if (null != tyc_BadConduct_result) { JSONArray items = tyc_BadConduct_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { DynamicObject add = qeug_badconductentry.addNew(); JSONObject o = (JSONObject)items.get(i); String integritySubject = (String)o.get("integritySubject");//诚信记录主体 String creditIcon = (String)o.get("creditIcon");//标签 String decisionContent = (String)o.get("decisionContent");//决定内容 String decisionContent2 = (String)o.get("decisionContent2");//决定内容2 String reasons = (String)o.get("reasons");//查看事由 String decisionDate = (String)o.get("decisionDate");//决定日期 String publishValidityPeriod = (String)o.get("publishValidityPeriod");//发布有效期 add.set("seq",i); add.set("qeug_integritysubject",integritySubject); add.set("qeug_crediticon",creditIcon); add.set("qeug_decisioncontent",decisionContent); add.set("qeug_decisioncontent2",decisionContent2); add.set("qeug_reasons",reasons); add.set("qeug_decisiondate",decisionDate); add.set("qeug_publishvalidityperio",publishValidityPeriod); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 15.企业三要素验证_1074 ?code=91110000802100433B&name=北京百度网讯科技有限公司&legalPersonName=梁志祥 */ String code = dynamicObject.getString("societycreditcode");//统一社会信用代码 String name = dynamicObject.getString("name");//供应商名字 String legalPersonName =dynamicObject.getString("artificialperson");//法人 String tyc_Verify = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Verify + "?code="+code+"&name="+name+"&legalPersonName="+legalPersonName,tyc_Test_keyword,"企业三要素验证_1074"); JSONObject tyc_Verify_results = JSONObject.parseObject(tyc_Verify); if (null != tyc_Verify_results) { JSONObject tyc_Verify_result = (JSONObject)tyc_Verify_results.get("result"); String result = "";//三要素验证结果 if (null != tyc_Verify_result) { Integer o = (Integer)tyc_Verify_result.get("result");//验证结果,0-验证失败,1-验证成功,2-输入企业名疑似曾用名,其他两要素一致 switch (o){ case 0: result = "验证失败"; break; case 1: result = "验证成功"; break; case 2: result = "输入企业名疑似曾用名,其他两要素一致"; break; default: break; } } dynamicObject.set("qeug_verify",result); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } /** * 16.行政处罚_1124 ?pageSize=20&keyword=北京百度网讯科技有限公司&pageNum=1 qeug_punishmentinfoentry */ DynamicObjectCollection qeugPunishmentinfoentry = dynamicObject.getDynamicObjectCollection("qeug_punishmentinfoentry"); qeugPunishmentinfoentry.clear(); String tyc_PunishmentInfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_PunishmentInfo + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"行政处罚_1124"); JSONObject tyc_PunishmentInfo_results = JSONObject.parseObject(tyc_PunishmentInfo); if (null != tyc_PunishmentInfo_results) { JSONObject tyc_PunishmentInfo_result = (JSONObject)tyc_PunishmentInfo_results.get("result"); if (null != tyc_PunishmentInfo_result) { JSONArray items = tyc_PunishmentInfo_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { DynamicObject add = qeugPunishmentinfoentry.addNew(); JSONObject o = (JSONObject)items.get(i); String decisionDate = (String)o.get("decisionDate");//处罚日期 String punishNumber = (String)o.get("punishNumber");//决定文书号 String reason = (String)o.get("punishNumber");//处罚事由/违法行为类型 String content = (String)o.get("content");//处罚结果/内容 String departmentName = (String)o.get("departmentName");//处罚单位 String legalPersonName1 = (String)o.get("legalPersonName");//法定代表人 String punishStatus = (String)o.get("punishStatus");//处罚状态 String punishName = (String)o.get("punishName");//处罚名称 add.set("seq",i); add.set("qeug_decisiondatepun",decisionDate); add.set("qeug_punishnumber",punishNumber); add.set("qeug_punishnumberpun",reason); add.set("qeug_content",content); add.set("qeug_departmentname",departmentName); add.set("qeug_legalpersonname",legalPersonName1); add.set("qeug_punishstatus",punishStatus); add.set("qeug_punishname",punishName); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 17.严重违法_846 ?pageSize=20&keyword=武陟县佳翔汽车服务有限公司&pageNum=1 */ DynamicObjectCollection qeugIllegalinfoentry = dynamicObject.getDynamicObjectCollection("qeug_illegalinfoentry"); qeugIllegalinfoentry.clear(); String tyc_Illegalinfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Illegalinfo + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"严重违法_846"); JSONObject tyc_Illegalinfo_results = JSONObject.parseObject(tyc_Illegalinfo); if (null != tyc_Illegalinfo_results) { JSONObject tyc_Illegalinfo_result = (JSONObject)tyc_Illegalinfo_results.get("result"); if (null != tyc_Illegalinfo_result) { JSONArray items = tyc_Illegalinfo_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { DynamicObject add = qeugIllegalinfoentry.addNew(); JSONObject o = (JSONObject) items.get(i); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String removedate = "";//移除日期 Long removeDate = (Long) o.get("removeDate");//移除日期 if (null != removeDate) { removedate = sdf.format(new Date(removeDate)); } String putReason = (String) o.get("putReason");//列入原因 String putDepartment = (String) o.get("putDepartment");//决定列入部门(作出决定机关) String removeDepartment = (String) o.get("removeDepartment");//决定移除部门 String removeReason = (String) o.get("removeReason");//移除原因 String putDate = (String) o.get("putDate");//列入日期 add.set("seq", i); add.set("qeug_removedateil", removedate); add.set("qeug_putreasonil", putReason); add.set("qeug_putdepartment", putDepartment); add.set("qeug_removedepartment", removeDepartment); add.set("qeug_removereasonil", removeReason); add.set("qeug_putdateil", sdf.format(new Date(putDate))); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 18.法律诉讼_1114 ?keyword=北京百度网讯科技有限公司&pageNum=1&pageSize=20 */ DynamicObjectCollection qeugLawsuitentry = dynamicObject.getDynamicObjectCollection("qeug_lawsuitentry"); qeugLawsuitentry.clear(); String tyc_LawSuit = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_LawSuit + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"法律诉讼_1114"); JSONObject tyc_LawSuit_results = JSONObject.parseObject(tyc_LawSuit); if (null != tyc_LawSuit_results) { JSONObject tyc_LawSuit_result = (JSONObject)tyc_LawSuit_results.get("result"); if (null != tyc_LawSuit_result) { JSONArray items = tyc_LawSuit_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { DynamicObject add = qeugLawsuitentry.addNew(); JSONObject o = (JSONObject) items.get(i); String docType = (String) o.get("docType");//文书类型 String title = (String) o.get("title");//案件名称 String court = (String) o.get("court");//审理法院 String judgeTime = (String) o.get("judgeTime");//裁判日期 String caseNo = (String) o.get("caseNo");//案号 String caseType = (String) o.get("caseType");//案件类型 String caseReason = (String) o.get("caseReason");//案由 add.set("seq", i); add.set("qeug_doctype", docType); add.set("qeug_title", title); add.set("qeug_court", court); add.set("qeug_judgetime", judgeTime); add.set("qeug_caseno", caseNo); add.set("qeug_casetype", caseType); add.set("qeug_casereason", caseReason); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } /** * 19.失信人_843 ?keyword=恩施鑫地源农业开发有限公司&pageNum=1&pageSize=1 */ DynamicObjectCollection qeugJrDishonestentry = dynamicObject.getDynamicObjectCollection("qeug_jr_dishonestentry"); qeugJrDishonestentry.clear(); String tyc_Jr_Dishonest = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Jr_Dishonest + "?keyword=" + tyc_Test_keyword,tyc_Test_keyword,"失信人_843"); JSONObject tyc_Jr_Dishonest_results = JSONObject.parseObject(tyc_Jr_Dishonest); if (null != tyc_Jr_Dishonest_results) { JSONObject tyc_Jr_Dishonest_result = (JSONObject)tyc_Jr_Dishonest_results.get("result"); if (null != tyc_Jr_Dishonest_result) { JSONArray items = tyc_Jr_Dishonest_result.getJSONArray("items"); for (int i = 0; i < items.size(); i++) { DynamicObject add = qeugJrDishonestentry.addNew(); JSONObject o = (JSONObject) items.get(i); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String iname = (String) o.get("iname");//失信人名称 String disrupttypename = (String) o.get("disrupttypename");//失信被执行人行为具体情形 String casecode = (String) o.get("casecode");//案号 String performance = (String) o.get("performance");//履行情况 String regDate = "";//立案日期 Long regdate = (Long) o.get("regdate");//立案时间 if (null != regdate) { regDate = sdf.format(new Date(regdate)); } String publishDate = "";//发布日期 Long publishdate = (Long) o.get("publishdate");//发布时间 if (null != publishdate) { publishDate = sdf.format(new Date(publishdate)); } String gistunit = (String) o.get("gistunit");//做出执行的依据单位 add.set("seq", i); add.set("qeug_iname", iname); add.set("qeug_disrupttypename", disrupttypename); add.set("qeug_casecode", casecode); add.set("qeug_performance", performance); add.set("qeug_regdate", regDate); add.set("qeug_publishdate", publishDate); add.set("qeug_gistunit", gistunit); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } } } dynamicObject.set("qeug_istyccheck",true);//是否查询天眼查(正式供应商) SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); } catch (Exception ex) { DobeDWUtils.saveLog(tyc_Test_keyword, "天眼查",tyc_Test_keyword, ex.getMessage()+"\n"+ ex.getStackTrace()[0].getClassName()+"\n"+ ex.getStackTrace()[0].getMethodName()+"\n"+ ex.getStackTrace()[0].getLineNumber(), false,"query_tyc"); } } }