939 lines
54 KiB
Java
939 lines
54 KiB
Java
package shkd.utils;
|
||
|
||
import com.alibaba.fastjson.JSON;
|
||
import com.alibaba.fastjson.JSONArray;
|
||
import com.alibaba.fastjson.JSONObject;
|
||
import com.bes.enterprise.hc.core.http.message.BasicNameValuePair;
|
||
import com.bes.mq.org.apache.http.HttpEntity;
|
||
import com.bes.mq.org.apache.http.HttpResponse;
|
||
import com.bes.mq.org.apache.http.NameValuePair;
|
||
import com.bes.mq.org.apache.http.client.ClientProtocolException;
|
||
import com.bes.mq.org.apache.http.client.methods.HttpGet;
|
||
import com.bes.mq.org.apache.http.client.utils.URLEncodedUtils;
|
||
import com.bes.mq.org.apache.http.impl.client.DefaultHttpClient;
|
||
import com.bes.mq.org.apache.http.params.BasicHttpParams;
|
||
import com.bes.mq.org.apache.http.params.HttpConnectionParams;
|
||
import kd.bos.dataentity.entity.DynamicObject;
|
||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||
import kd.bos.dataentity.entity.OrmLocaleValue;
|
||
import kd.bos.logging.Log;
|
||
import kd.bos.logging.LogFactory;
|
||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||
import kd.bos.util.HttpClientUtils;
|
||
import kd.bos.util.StringUtils;
|
||
import okhttp3.OkHttpClient;
|
||
import org.apache.http.client.HttpClient;
|
||
import org.apache.http.client.config.RequestConfig;
|
||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||
import org.apache.http.client.methods.HttpPost;
|
||
import org.apache.http.client.methods.HttpUriRequest;
|
||
import org.apache.http.entity.StringEntity;
|
||
import org.apache.http.impl.client.CloseableHttpClient;
|
||
import org.apache.http.impl.client.HttpClients;
|
||
import org.apache.http.util.EntityUtils;
|
||
import okhttp3.OkHttpClient;
|
||
import okhttp3.Request;
|
||
import okhttp3.Response;
|
||
|
||
import java.io.*;
|
||
import java.net.URI;
|
||
import java.text.ParseException;
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.*;
|
||
|
||
/**
|
||
* 天眼查集成工具类
|
||
*/
|
||
public class TycUtils {
|
||
|
||
//天眼查接口正式_token
|
||
public static final String tyc_Token = "29493db8-db63-4efe-8530-7b87e0b4b87a";//24000元
|
||
// public static final String tyc_Token = "6d62098a-b59a-43a0-8dd6-ec24a647efc5";//500次
|
||
//天眼查API_企业基本信息(含主要人员)_819
|
||
public static final String tyc_Baseinfo = "http://open.api.tianyancha.com/services/open/ic/baseinfoV3/2.0";
|
||
//天眼查API_疑似实际控制人_1123
|
||
public static final String tyc_ActualControl = "http://open.api.tianyancha.com/services/open/ic/actualControl/3.0";
|
||
//天眼查API_实际控制权_747
|
||
public static final String tyc_Companyholding = "http://open.api.tianyancha.com/services/v4/open/companyholding";
|
||
//天眼查API_总公司_963
|
||
public static final String tyc_ParentCompany = "http://open.api.tianyancha.com/services/open/ic/parentCompany/2.0";
|
||
//天眼查API_工商信息_1001
|
||
public static final String tyc_Ic = "http://open.api.tianyancha.com/services/open/cb/ic/2.0";
|
||
//天眼查API_建筑资质-注册人员_1009
|
||
public static final String tyc_RegHuman = "http://open.api.tianyancha.com/services/open/bq/regHuman/2.0";
|
||
//天眼查API_建筑资质-工程项目_1011
|
||
public static final String tyc_Project = "http://open.api.tianyancha.com/services/open/bq/project/2.0";
|
||
//天眼查API_失信被执行人(人员)_1076
|
||
public static final String tyc_Human_Dishonest = "http://open.api.tianyancha.com/services/v4/open/human/dishonest";
|
||
//天眼查API_被执行(人员)_1077
|
||
public static final String tyc_ZhiXingInfo = "http://open.api.tianyancha.com/services/v4/open/human/zhixinginfo";
|
||
//苍穹系统预置👇
|
||
//天眼查API_资质证书_880
|
||
public static final String tyc_Certificate = "http://open.api.tianyancha.com/services/open/m/certificate/2.0";
|
||
//天眼查API_建筑资质-资质资格_1007
|
||
public static final String tyc_Qualification = "http://open.api.tianyancha.com/services/open/bq/qualification/2.0";
|
||
//天眼查API_变更记录_822
|
||
public static final String tyc_Changeinfo = "http://open.api.tianyancha.com/services/open/ic/changeinfo/2.0";
|
||
//天眼查API_经营异常_848
|
||
public static final String tyc_Abnormal = "http://open.api.tianyancha.com/services/open/mr/abnormal/2.0";
|
||
//天眼查API_企业股东_821
|
||
public static final String tyc_Holder = "http://open.api.tianyancha.com/services/open/ic/holder/2.0";
|
||
//天眼查API_建筑资质-不良行为_1030
|
||
public static final String tyc_BadConduct = "http://open.api.tianyancha.com/services/open/bq/badConduct/2.0";
|
||
//天眼查API_企业三要素验证_1074
|
||
public static final String tyc_Verify = "http://open.api.tianyancha.com/services/open/ic/verify/2.0";
|
||
//天眼查API_行政处罚_1124
|
||
public static final String tyc_PunishmentInfo = "http://open.api.tianyancha.com/services/open/mr/punishmentInfo/3.0";
|
||
//天眼查API_严重违法_846
|
||
public static final String tyc_Illegalinfo = "http://open.api.tianyancha.com/services/open/mr/illegalinfo/2.0";
|
||
//天眼查API_法律诉讼_1114
|
||
public static final String tyc_LawSuit = "http://open.api.tianyancha.com/services/open/jr/lawSuit/3.0";
|
||
//天眼查API_失信人_843
|
||
public static final String tyc_Jr_Dishonest = "http://open.api.tianyancha.com/services/open/jr/dishonest/2.0";
|
||
|
||
private static final Log logger = LogFactory.getLog(TycUtils.class);
|
||
|
||
/**
|
||
* http get请求
|
||
* @param url 接口url
|
||
* @param token token
|
||
* @param supname 供应商name
|
||
* @param apiname 接口name
|
||
* @return 返回接口数据
|
||
*/
|
||
public static String executeGet(String token,String url,String supname,String apiname,Integer type) {
|
||
|
||
// 创建 OkHttpClient 对象
|
||
OkHttpClient client = new OkHttpClient();
|
||
|
||
// 创建请求对象,设置请求地址
|
||
Request request = new Request.Builder()
|
||
.url(url)
|
||
.header("Content-Type", "application/json")
|
||
.header("Authorization", token)
|
||
.build();
|
||
|
||
String resultData = null;
|
||
try {
|
||
Response response = client.newCall(request).execute();
|
||
resultData = response.body().string();
|
||
JSONObject resultData1 = JSONObject.parseObject(resultData);
|
||
if (null != resultData1) {
|
||
JSONObject result = (JSONObject)resultData1.get("result");
|
||
String logType = (type == 0) ? "潜在" : "正式";
|
||
DobeDWUtils.saveLog(supname + "_" + logType,
|
||
"天眼查", apiname + "\n" + request.toString(), resultData.toString(),
|
||
null != result, "query_tyc");
|
||
}
|
||
|
||
} catch (Exception e) {
|
||
String logType = (type == 0) ? "潜在" : "正式";
|
||
DobeDWUtils.saveLog(supname + "_" + logType,
|
||
"天眼查", apiname + "\n" + request.toString(), e.getMessage(),
|
||
false, "query_tyc");
|
||
}
|
||
return resultData;
|
||
}
|
||
|
||
/**
|
||
* 天眼查查询
|
||
* @param supplier 供应商实体
|
||
* @param type 0:潜在/1:正式
|
||
*/
|
||
public static void queryTyc(DynamicObject supplier, Integer type) {
|
||
String tyc_Test_keyword = supplier.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",type);
|
||
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 = supplier.getDynamicObjectCollection("qeug_entryentity");
|
||
qeugEntryentity.clear();
|
||
JSONObject staffListS = tyc_Baseinfo_result.getJSONObject("staffList");
|
||
if (null != staffListS) {
|
||
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);//主要人员职位
|
||
}
|
||
}
|
||
}
|
||
|
||
//设置到供应商中
|
||
supplier.set("qeug_legalpersonn", legalPersonName);//法人代表
|
||
supplier.set("qeug_regnumber", regNumber);//企业注册号
|
||
supplier.set("qeug_orgnumber", orgNumber);//组织机构代码
|
||
supplier.set("qeug_businessduration", businessduration);//营业期限
|
||
supplier.set("qeug_reglocation", regLocation);//公司地址
|
||
supplier.set("qeug_reginstitute", regInstitute);//登记机关
|
||
supplier.set("qeug_regstatus", regStatus);//经营状态
|
||
supplier.set("qeug_websitelist", websiteList);//企业网站
|
||
try {
|
||
Date parse = sdf.parse(estiblishtime);
|
||
supplier.set("qeug_photodate", parse);//发照日期
|
||
supplier.set("qeug_estiblishtime", parse);//成立日期
|
||
} catch (ParseException ex) {
|
||
throw new RuntimeException(ex);
|
||
}
|
||
supplier.set("qeug_creditcode", creditCode);//统一社会信用代码
|
||
supplier.set("qeug_industry", industry);//所属行业
|
||
supplier.set("qeug_bases", provinceName);//省
|
||
supplier.set("qeug_regcapital", regCapital);//注册资本
|
||
supplier.set("qeug_companyorgtype", companyOrgType);//企业类型
|
||
supplier.set("qeug_canceldate", canceldate);//注销日期
|
||
supplier.set("qeug_city", city);//城市
|
||
supplier.set("qeug_phonenumber", phoneNumber);//联系电话
|
||
supplier.set("qeug_historynames", historyNames);//曾用名
|
||
supplier.set("qeug_socialstaffnum", socialStaffNum);//参保人数
|
||
supplier.set("qeug_businessscopes", businessScope);//经营范围
|
||
SaveServiceHelper.save(new DynamicObject[]{supplier});
|
||
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 20.疑似实际控制人_1123 ?keyword=北京百度网讯科技有限公司
|
||
*/
|
||
String tyc_ActualControl = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_ActualControl
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "疑似实际控制人_1123",type);
|
||
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();
|
||
}
|
||
supplier.set("qeug_controllingperson", name);//控制人姓名
|
||
SaveServiceHelper.save(new DynamicObject[]{supplier});
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 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",type);
|
||
|
||
/**
|
||
* 3.总公司_963 ?keyword=139573097
|
||
*/
|
||
String tyc_ParentCompany = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_ParentCompany
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "总公司_963",type);
|
||
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");
|
||
supplier.set("qeug_headoffice", name);//总公司名
|
||
SaveServiceHelper.save(new DynamicObject[]{supplier});
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 4.工商信息_1001 ?keyword=9519792
|
||
*/
|
||
DynamicObjectCollection qeugIcentry = supplier.getDynamicObjectCollection("qeug_icentry");
|
||
qeugIcentry.clear();
|
||
String tyc_Ic = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Ic
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "工商信息_1001",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 5.建筑资质-注册人员_1009 ?pageSize=20&keyword=中煤科工集团北京华宇工程有限公司&pageNum=1
|
||
*/
|
||
DynamicObjectCollection qeugReghumanentry = supplier.getDynamicObjectCollection("qeug_reghumanentry");
|
||
qeugReghumanentry.clear();
|
||
String tyc_RegHuman = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_RegHuman
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "建筑资质-注册人员_1009",type);
|
||
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[]{supplier});
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 6.建筑资质-工程项目_1011 ?pageSize=20&keyword=中煤科工集团北京华宇工程有限公司&pageNum=1
|
||
*/
|
||
DynamicObjectCollection qeug_projectentry = supplier.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",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 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",type);
|
||
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 = supplier.getDynamicObjectCollection("qeug_certificateentry");
|
||
qeugCertificateentry.clear();
|
||
String tyc_Certificate = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Certificate
|
||
+ "?name=" + tyc_Test_keyword, tyc_Test_keyword, "证照_1081",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 10.建筑资质-资质资格_1007 ?pageSize=20&keyword=河南省建筑设计研究院有限公司&pageNum=1
|
||
*/
|
||
DynamicObjectCollection qeug_qualificationentry = supplier.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",type);
|
||
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[]{supplier});
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 11.变更记录_822 ?keyword=北京百度网讯科技有限公司&pageNum=1&pageSize=20
|
||
*/
|
||
DynamicObjectCollection qeugChangeinfo = supplier.getDynamicObjectCollection("qeug_changeinfo");
|
||
qeugChangeinfo.clear();
|
||
String tyc_Changeinfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Changeinfo
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "变更记录_822",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 12.经营异常_848 ?pageSize=20&keyword=宁夏凯捷建设工程有限公司&pageNum=1
|
||
*/
|
||
DynamicObjectCollection qeugAbnormal = supplier.getDynamicObjectCollection("qeug_abnormal");
|
||
qeugAbnormal.clear();
|
||
String tyc_Abnormal = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Abnormal
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "经营异常_848",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 13.企业股东_821 ?pageSize=20&keyword=北京百度网讯科技有限公司&pageNum=1
|
||
*/
|
||
DynamicObjectCollection qeugShareholderentry = supplier.getDynamicObjectCollection("qeug_shareholderentry");
|
||
qeugShareholderentry.clear();
|
||
String tyc_Holder = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Holder
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "企业股东_821",type);
|
||
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 types = (Integer) o.get("type");//股东类型 1-公司 2-人 3-其它
|
||
switch (types) {
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 14.建筑资质-不良行为_1030 ?pageSize=20&keyword=湖北正大建设工程有限公司&pageNum=1
|
||
*/
|
||
DynamicObjectCollection qeug_badconductentry = supplier.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",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 15.企业三要素验证_1074 ?code=91110000802100433B&name=北京百度网讯科技有限公司&legalPersonName=梁志祥
|
||
*/
|
||
String code = supplier.getString("societycreditcode");//统一社会信用代码
|
||
String name = supplier.getString("name");//供应商名字
|
||
String legalPersonName = supplier.getString("artificialperson");//法人
|
||
String tyc_Verify = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Verify
|
||
+ "?code=" + code + "&name=" + name + "&legalPersonName=" + legalPersonName, tyc_Test_keyword, "企业三要素验证_1074",type);
|
||
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;
|
||
}
|
||
}
|
||
supplier.set("qeug_verify", result);
|
||
SaveServiceHelper.save(new DynamicObject[]{supplier});
|
||
}
|
||
|
||
|
||
/**
|
||
* 16.行政处罚_1124 ?pageSize=20&keyword=北京百度网讯科技有限公司&pageNum=1 qeug_punishmentinfoentry
|
||
*/
|
||
DynamicObjectCollection qeugPunishmentinfoentry = supplier.getDynamicObjectCollection("qeug_punishmentinfoentry");
|
||
qeugPunishmentinfoentry.clear();
|
||
String tyc_PunishmentInfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_PunishmentInfo
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "行政处罚_1124",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 17.严重违法_846 ?pageSize=20&keyword=武陟县佳翔汽车服务有限公司&pageNum=1
|
||
*/
|
||
DynamicObjectCollection qeugIllegalinfoentry = supplier.getDynamicObjectCollection("qeug_illegalinfoentry");
|
||
qeugIllegalinfoentry.clear();
|
||
String tyc_Illegalinfo = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_Illegalinfo
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "严重违法_846",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 18.法律诉讼_1114 ?keyword=北京百度网讯科技有限公司&pageNum=1&pageSize=20
|
||
*/
|
||
DynamicObjectCollection qeugLawsuitentry = supplier.getDynamicObjectCollection("qeug_lawsuitentry");
|
||
qeugLawsuitentry.clear();
|
||
String tyc_LawSuit = TycUtils.executeGet(TycUtils.tyc_Token, TycUtils.tyc_LawSuit
|
||
+ "?keyword=" + tyc_Test_keyword, tyc_Test_keyword, "法律诉讼_1114",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 19.失信人_843 ?keyword=恩施鑫地源农业开发有限公司&pageNum=1&pageSize=1
|
||
*/
|
||
DynamicObjectCollection qeugJrDishonestentry = supplier.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",type);
|
||
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[]{supplier});
|
||
}
|
||
}
|
||
}
|
||
//todo 判断是潜在还是正式
|
||
if (type == 1) {
|
||
supplier.set("qeug_istyccheck",true);//是否查询天眼查(正式供应商)
|
||
SaveServiceHelper.save(new DynamicObject[]{supplier});
|
||
}
|
||
} catch (Exception ex) {
|
||
String logType = (type == 1) ? "正式" : "潜在";
|
||
DobeDWUtils.saveLog(tyc_Test_keyword + "_" + logType,
|
||
"天眼查", tyc_Test_keyword, ex.getMessage() + "\n" +
|
||
ex.getStackTrace()[0].getClassName() + "\n" +
|
||
ex.getStackTrace()[0].getMethodName() + "\n" +
|
||
ex.getStackTrace()[0].getLineNumber(),
|
||
false, "query_tyc");
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 比对天眼查数据
|
||
* @param supplier 潜在供应商/正式供应商
|
||
*/
|
||
public static void showPreaudits(DynamicObject supplier) {
|
||
|
||
// DynamicObject resm_regsupplier = BusinessDataServiceHelper.loadSingle(pkValue, "resm_regsupplier");
|
||
|
||
if (supplier != null) {
|
||
DynamicObjectCollection qeug_infocheckentry = supplier.getDynamicObjectCollection("qeug_infocheckentry");
|
||
qeug_infocheckentry.clear();
|
||
|
||
DynamicObject[] qeugTycInfochecks = BusinessDataServiceHelper.load("qeug_tyc_infocheck", "number,name,qeug_apifields", null);
|
||
|
||
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
|
||
|
||
for (int i = 0; i < qeugTycInfochecks.length; i++) {
|
||
DynamicObject qeugTycInfocheck = qeugTycInfochecks[i];
|
||
DynamicObject add = qeug_infocheckentry.addNew();
|
||
add.set("seq", i);
|
||
add.set("qeug_bsfield", qeugTycInfocheck.getString("number")); // 核对字段标识
|
||
add.set("qeug_bsfieldname", qeugTycInfocheck.getString("name")); // 核对项目名称
|
||
add.set("qeug_bsinput", getBsInput(supplier, qeugTycInfocheck.getString("number"), sd)); // 录入内容
|
||
String qeugApifields = qeugTycInfocheck.getString("qeug_apifields"); // 接口字段标识
|
||
add.set("qeug_apifield", qeugApifields); // 接口字段标识
|
||
add.set("qeug_queryresult", getQueryResult(supplier, qeugApifields, sd)); // 接口查询结果
|
||
|
||
// 判断是否匹配
|
||
String bsinput = add.getString("qeug_bsinput");
|
||
String queryresult = add.getString("qeug_queryresult");
|
||
add.set("qeug_issame", bsinput.equals(queryresult) ? "1" : "0"); // 0: 不匹配 1: 匹配
|
||
}
|
||
|
||
SaveServiceHelper.save(new DynamicObject[]{supplier});
|
||
}
|
||
}
|
||
|
||
// 获取录入内容
|
||
public static String getBsInput(DynamicObject resm_regsupplier, String number, SimpleDateFormat sd) {
|
||
Object obj = resm_regsupplier.get(number);
|
||
return formatFieldValue(obj, sd);
|
||
}
|
||
|
||
// 获取查询结果
|
||
public static String getQueryResult(DynamicObject resm_regsupplier, String qeugApifields, SimpleDateFormat sd) {
|
||
Object obj = resm_regsupplier.get(qeugApifields);
|
||
return formatFieldValue(obj, sd);
|
||
}
|
||
|
||
// 格式化字段值
|
||
public static String formatFieldValue(Object obj, SimpleDateFormat sd) {
|
||
if (obj instanceof Date) {
|
||
return sd.format((Date) obj);
|
||
} else if (obj instanceof String) {
|
||
return (String) obj;
|
||
} else if (obj instanceof Long) {
|
||
return sd.format(new Date((Long) obj));
|
||
}else if(obj instanceof OrmLocaleValue) {
|
||
OrmLocaleValue o = (OrmLocaleValue) obj;
|
||
return (String)o.get("zh_CN");
|
||
}
|
||
return ""; // 返回空字符串表示无效值
|
||
}
|
||
|
||
public static String convertTimestampToDate(long timestamp) {
|
||
Date date = new Date(timestamp);
|
||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||
return sdf.format(date);
|
||
}
|
||
|
||
public static Map<String, String> getProvinceMap() {
|
||
// 省份代码
|
||
Map<String, String> map = new HashMap<>();
|
||
map.put("gj","国家");map.put("sh", "上海");map.put("bj", "北京");map.put("tj", "天津");map.put("gd", "广东");
|
||
map.put("zj", "浙江");map.put("fj", "福建");map.put("han", "海南");map.put("cq", "重庆");map.put("js", "江苏");
|
||
map.put("heb", "河北");map.put("sc", "四川");map.put("hen", "河南");map.put("ah", "安徽");map.put("snx", "陕西");
|
||
map.put("sd", "山东");map.put("nx", "宁夏");map.put("gz", "贵州");map.put("jx", "江西");map.put("gx", "广西");
|
||
map.put("sx", "山西");map.put("xj", "新疆");map.put("hub", "湖北");map.put("ln", "辽宁");map.put("nmg", "内蒙古");
|
||
map.put("jl", "吉林");map.put("qh", "青海");map.put("xz", "西藏");map.put("yn", "云南");map.put("gs", "甘肃");
|
||
map.put("hlj", "黑龙江");map.put("hun", "湖南");map.put("hk", "香港");
|
||
return map;
|
||
}
|
||
|
||
public static String getProvinceName(String code) {
|
||
Map<String, String> map = getProvinceMap();
|
||
if (map.containsKey(code)) {
|
||
return map.get(code);
|
||
}
|
||
|
||
return null;
|
||
}
|
||
}
|