天眼接口查询下载接口等完善

zhairh
anthonywj 2 years ago
parent 5a00ea8b6a
commit d7d16c2f52

@ -3,16 +3,29 @@ package com.glxp.udidl.admin.controller.tyapi;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udidl.admin.annotation.AuthRuleAnnotation;
import com.glxp.udidl.admin.dto.udplat.UdplatManufactureModel;
import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity;
import com.glxp.udidl.admin.entity.tyapi.TyCompanySearchEntity;
import com.glxp.udidl.admin.entity.tyapi.TySupplierEntity;
import com.glxp.udidl.admin.req.tyapi.TyBaseInfoRequest;
import com.glxp.udidl.admin.res.BaseResponse;
import com.glxp.udidl.admin.res.tyapi.TyBatchDlResponse;
import com.glxp.udidl.admin.res.tyapi.TyContactResponse;
import com.glxp.udidl.admin.service.tyapi.TyCompanyDetailService;
import com.glxp.udidl.admin.service.tyapi.TyCompanySearchService;
import com.glxp.udidl.admin.service.tyapi.TyContactInfoService;
import com.glxp.udidl.admin.service.tyapi.TySupplierService;
import com.glxp.udidl.admin.util.ResultVOUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Api(tags = "天眼查API接口")
@ -21,6 +34,12 @@ public class TySearchController {
@Resource
TyCompanySearchService tyCompanySearchService;
@Resource
TySupplierService tySupplierService;
@Resource
TyCompanyDetailService tyCompanyDetailService;
@Resource
TyContactInfoService tyContactInfoService;
@ApiOperation(value = "天眼查企业信息查询", response = TyCompanySearchEntity.class)
@GetMapping("udidl/ty/company/findBycCeditCode")
@ -37,4 +56,53 @@ public class TySearchController {
}
}
@ApiOperation(value = "天眼查批量下载供应商列表接口")
@PostMapping("/udidl/ty/company/batch/supplier")
public BaseResponse imports(@RequestBody String hospitals) {
if (StrUtil.isEmpty(hospitals)) {
return ResultVOUtils.error(500, "医院名称列表不能为空");
}
String[] hospAarray = hospitals.split(",");
TyBatchDlResponse tyBatchDlResponse = new TyBatchDlResponse();
List<TyCompanyDetailEntity> mTyCompanyDetailEntities = new ArrayList<>();
List<TyContactResponse> mTyContactResponses = new ArrayList<>();
List<TySupplierEntity> mTySupplierEntities = new ArrayList<>();
for (int i = 0; i < hospAarray.length; i++) {
tySupplierService.download(hospAarray[i]);
List<TySupplierEntity> tySupplierEntities = tySupplierService.list(new QueryWrapper<TySupplierEntity>().eq("hospName", hospAarray[i]));
if (CollUtil.isNotEmpty(tySupplierEntities)) {
mTySupplierEntities.addAll(tySupplierEntities);
for (TySupplierEntity tySupplierEntity : tySupplierEntities) {
TyCompanyDetailEntity tyCompanyDetailEntity = tyCompanyDetailService.download(tySupplierEntity.getSupplier_name());
if (tyCompanyDetailEntity != null)
mTyCompanyDetailEntities.add(tyCompanyDetailEntity);
List<TyContactResponse> tyContactResponses = tyContactInfoService.download(tySupplierEntity.getSupplier_name());
if (CollUtil.isNotEmpty(tyContactResponses)) {
mTyContactResponses.addAll(tyContactResponses);
}
}
}
}
tyBatchDlResponse.setTyContactResponses(mTyContactResponses);
tyBatchDlResponse.setTyCompanyDetailEntities(mTyCompanyDetailEntities);
tyBatchDlResponse.setTySupplierEntities(mTySupplierEntities);
return ResultVOUtils.success(tyBatchDlResponse);
}
@ApiOperation(value = "天眼查批量下载企业详细信息接口")
@GetMapping("/udidl/ty/company/getBaseInfo")
public BaseResponse getCompanyInfo(TyBaseInfoRequest tyBaseInfoRequest) {
if (StrUtil.isEmpty(tyBaseInfoRequest.getName()) && StrUtil.isEmpty(tyBaseInfoRequest.getCreditCode())) {
return ResultVOUtils.error(500, "请输入企业名称或统一社会信用代码");
}
String keyWord = "";
if (StrUtil.isNotEmpty(tyBaseInfoRequest.getCreditCode())) {
keyWord = tyBaseInfoRequest.getCreditCode();
} else
keyWord = tyBaseInfoRequest.getName();
TyCompanyDetailEntity tyCompanyDetailEntity = tyCompanyDetailService.download(keyWord);
return ResultVOUtils.success(tyCompanyDetailEntity);
}
}

@ -1,9 +1,10 @@
package com.glxp.udidl.admin.dao.tyapi;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udidl.admin.dao.BaseMapperPlus;
import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TyCompanyDetailMapper extends BaseMapper<TyCompanyDetailEntity> {
public interface TyCompanyDetailMapper extends BaseMapperPlus<TyCompanyDetailMapper, TyCompanyDetailEntity, TyCompanyDetailEntity> {
}

@ -1,9 +1,9 @@
package com.glxp.udidl.admin.dao.tyapi;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udidl.admin.dao.BaseMapperPlus;
import com.glxp.udidl.admin.entity.tyapi.TyContactCallEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TyContactCallMapper extends BaseMapper<TyContactCallEntity> {
public interface TyContactCallMapper extends BaseMapperPlus<TyContactCallMapper, TyContactCallEntity, TyContactCallEntity> {
}

@ -1,9 +1,17 @@
package com.glxp.udidl.admin.dao.tyapi;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udidl.admin.dao.BaseMapperPlus;
import com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity;
import com.glxp.udidl.admin.req.tyapi.TyContactRequest;
import com.glxp.udidl.admin.res.tyapi.TyContactResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TyContactInfoMapper extends BaseMapper<TyContactInfoEntity> {
public interface TyContactInfoMapper extends BaseMapperPlus<TyContactInfoMapper, TyContactInfoEntity, TyContactInfoEntity> {
List<TyContactResponse> findGroup(TyContactRequest tyContactRequest);
}

@ -6,341 +6,348 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*/
@ApiModel(value="com-glxp-udidl-admin-entity-tyapi-TyCompanyDetail")
*
*/
@ApiModel(value = "com-glxp-udidl-admin-entity-tyapi-TyCompanyDetail")
@Data
@TableName(value = "ty_company_detail")
public class TyCompanyDetailEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value="")
@ApiModelProperty(value = "")
private String id;
/**
*
*/
@TableField(value = "historyNames")
@ApiModelProperty(value="曾用名")
@ApiModelProperty(value = "曾用名")
private String historyNames;
/**
*
*/
@TableField(value = "cancelDate")
@ApiModelProperty(value="注销日期")
@ApiModelProperty(value = "注销日期")
private String cancelDate;
/**
*
*/
@TableField(value = "regStatus")
@ApiModelProperty(value="企业状态")
@ApiModelProperty(value = "企业状态")
private String regStatus;
/**
*
*/
@TableField(value = "regCapital")
@ApiModelProperty(value="注册资本")
@ApiModelProperty(value = "注册资本")
private String regCapital;
/**
*
*/
@TableField(value = "city")
@ApiModelProperty(value="市")
@ApiModelProperty(value = "市")
private String city;
/**
*
*/
@TableField(value = "staffNumRange")
@ApiModelProperty(value="人员规模")
@ApiModelProperty(value = "人员规模")
private String staffNumRange;
/**
*
*/
@TableField(value = "bondNum")
@ApiModelProperty(value="股票名")
@ApiModelProperty(value = "股票名")
private String bondNum;
/**
*
*/
@TableField(value = "historyNameList")
@ApiModelProperty(value="曾用名列表")
@ApiModelProperty(value = "曾用名列表")
private String historyNameList;
/**
*
*/
@TableField(value = "industry")
@ApiModelProperty(value="行业")
@ApiModelProperty(value = "行业")
private String industry;
/**
*
*/
@TableField(value = "bondName")
@ApiModelProperty(value="股票名")
@ApiModelProperty(value = "股票名")
private String bondName;
/**
*
*/
@TableField(value = "revokeDate")
@ApiModelProperty(value="吊销日期")
@ApiModelProperty(value = "吊销日期")
private String revokeDate;
/**
* 1 2
*/
@TableField(value = "`type`")
@ApiModelProperty(value="法人类型1 人 2 公司")
@ApiModelProperty(value = "法人类型1 人 2 公司")
private String type;
/**
*
*/
@TableField(value = "updateTimes")
@ApiModelProperty(value="更新时间")
@ApiModelProperty(value = "更新时间")
private String updateTimes;
/**
*
*/
@TableField(value = "legalPersonName")
@ApiModelProperty(value="法人")
@ApiModelProperty(value = "法人")
private String legalPersonName;
/**
*
*/
@TableField(value = "revokeReason")
@ApiModelProperty(value="吊销原因")
@ApiModelProperty(value = "吊销原因")
private String revokeReason;
/**
*
*/
@TableField(value = "regNumber")
@ApiModelProperty(value="注册号")
@ApiModelProperty(value = "注册号")
private String regNumber;
/**
*
*/
@TableField(value = "creditCode")
@ApiModelProperty(value="统一社会信用代码")
@ApiModelProperty(value = "统一社会信用代码")
private String creditCode;
/**
*
*/
@TableField(value = "property3")
@ApiModelProperty(value="英文名")
@ApiModelProperty(value = "英文名")
private String property3;
/**
*
*/
@TableField(value = "usedBondName")
@ApiModelProperty(value="股票曾用名")
@ApiModelProperty(value = "股票曾用名")
private String usedBondName;
/**
*
*/
@TableField(value = "approvedTime")
@ApiModelProperty(value="核准时间")
@ApiModelProperty(value = "核准时间")
private String approvedTime;
/**
*
*/
@TableField(value = "fromTime")
@ApiModelProperty(value="经营开始时间")
@ApiModelProperty(value = "经营开始时间")
private String fromTime;
/**
*
*/
@TableField(value = "socialStaffNum")
@ApiModelProperty(value="参保人数")
@ApiModelProperty(value = "参保人数")
private String socialStaffNum;
/**
*
*/
@TableField(value = "actualCapitalCurrency")
@ApiModelProperty(value="实收注册资本币种 人民币 美元 欧元 等")
@ApiModelProperty(value = "实收注册资本币种 人民币 美元 欧元 等")
private String actualCapitalCurrency;
/**
*
*/
@TableField(value = "`alias`")
@ApiModelProperty(value="简称")
@ApiModelProperty(value = "简称")
private String alias;
/**
*
*/
@TableField(value = "companyOrgType")
@ApiModelProperty(value="企业类型")
@ApiModelProperty(value = "企业类型")
private String companyOrgType;
/**
*
*/
@TableField(value = "cancelReason")
@ApiModelProperty(value="注销原因")
@ApiModelProperty(value = "注销原因")
private String cancelReason;
/**
*
*/
@TableField(value = "orgNumber")
@ApiModelProperty(value="组织机构代码")
@ApiModelProperty(value = "组织机构代码")
private String orgNumber;
/**
*
*/
@TableField(value = "email")
@ApiModelProperty(value="邮箱")
@ApiModelProperty(value = "邮箱")
private String email;
/**
*
*/
@TableField(value = "toTime")
@ApiModelProperty(value="经营结束时间")
@ApiModelProperty(value = "经营结束时间")
private String toTime;
/**
*
*/
@TableField(value = "actualCapital")
@ApiModelProperty(value="实收注册资金")
@ApiModelProperty(value = "实收注册资金")
private String actualCapital;
/**
*
*/
@TableField(value = "estiblishTime")
@ApiModelProperty(value="成立日期")
@ApiModelProperty(value = "成立日期")
private String estiblishTime;
/**
*
*/
@TableField(value = "regInstitute")
@ApiModelProperty(value="登记机关")
@ApiModelProperty(value = "登记机关")
private String regInstitute;
/**
*
*/
@TableField(value = "businessScope")
@ApiModelProperty(value="经营范围")
@ApiModelProperty(value = "经营范围")
private String businessScope;
/**
*
*/
@TableField(value = "taxNumber")
@ApiModelProperty(value="纳税人识别号")
@ApiModelProperty(value = "纳税人识别号")
private String taxNumber;
/**
*
*/
@TableField(value = "regLocation")
@ApiModelProperty(value="注册地址")
@ApiModelProperty(value = "注册地址")
private String regLocation;
/**
*
*/
@TableField(value = "regCapitalCurrency")
@ApiModelProperty(value="注册资本币种 人民币 美元 欧元 等")
@ApiModelProperty(value = "注册资本币种 人民币 美元 欧元 等")
private String regCapitalCurrency;
/**
*
*/
@TableField(value = "tags")
@ApiModelProperty(value="企业标签")
@ApiModelProperty(value = "企业标签")
private String tags;
/**
*
*/
@TableField(value = "websiteList")
@ApiModelProperty(value="网址")
@ApiModelProperty(value = "网址")
private String websiteList;
/**
*
*/
@TableField(value = "phoneNumber")
@ApiModelProperty(value="企业联系方式")
@ApiModelProperty(value = "企业联系方式")
private String phoneNumber;
/**
*
*/
@TableField(value = "district")
@ApiModelProperty(value="区")
@ApiModelProperty(value = "区")
private String district;
/**
*
*/
@TableField(value = "bondType")
@ApiModelProperty(value="股票类型")
@ApiModelProperty(value = "股票类型")
private String bondType;
/**
*
*/
@TableField(value = "`name`")
@ApiModelProperty(value="企业名")
@ApiModelProperty(value = "企业名")
private String name;
/**
*
*/
@TableField(value = "percentileScore")
@ApiModelProperty(value="企业评分")
@ApiModelProperty(value = "企业评分")
private String percentileScore;
/**
*
*/
@TableField(value = "industryAll")
@ApiModelProperty(value="国民经济行业分类")
@ApiModelProperty(value = "国民经济行业分类")
private String industryAll;
/**
* 0 1
*/
@TableField(value = "isMicroEnt")
@ApiModelProperty(value="是否是小微企业 0不是 1是")
@ApiModelProperty(value = "是否是小微企业 0不是 1是")
private String isMicroEnt;
/**
*
*/
@TableField(value = "base")
@ApiModelProperty(value="省份简称")
@ApiModelProperty(value = "省份简称")
private String base;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L;
}

@ -6,25 +6,28 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*/
@ApiModel(value="com-glxp-udidl-admin-entity-tyapi-TyCompanySearch")
*
*/
@ApiModel(value = "com-glxp-udidl-admin-entity-tyapi-TyCompanySearch")
@Data
@TableName(value = "ty_company_search")
public class TyCompanySearchEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value="")
@ApiModelProperty(value = "")
private String id;
/**
*
*/
@TableField(value = "`name`")
@ApiModelProperty(value="公司名")
@ApiModelProperty(value = "公司名")
private String name;
@ -32,78 +35,82 @@ public class TyCompanySearchEntity implements Serializable {
*
*/
@TableField(value = "regStatus")
@ApiModelProperty(value="经营状态")
@ApiModelProperty(value = "经营状态")
private String regStatus;
/**
*
*/
@TableField(value = "estiblishTime")
@ApiModelProperty(value="成立日期")
@ApiModelProperty(value = "成立日期")
private String estiblishTime;
/**
*
*/
@TableField(value = "regCapital")
@ApiModelProperty(value="注册资本")
@ApiModelProperty(value = "注册资本")
private String regCapital;
/**
* -1234567-;89-
*/
@TableField(value = "companyType")
@ApiModelProperty(value="机构类型-1公司2香港企业3社会组织4律所5事业单位6基金会7-不存在法人、注册资本、统一社会信用代码、经营状态;8台湾企业9-新机构")
@ApiModelProperty(value = "机构类型-1公司2香港企业3社会组织4律所5事业单位6基金会7-不存在法人、注册资本、统一社会信用代码、经营状态;8台湾企业9-新机构")
private String companyType;
/**
*
*/
@TableField(value = "matchType")
@ApiModelProperty(value="匹配原因")
@ApiModelProperty(value = "匹配原因")
private String matchType;
/**
* 1- 2-
*/
@TableField(value = "`type`")
@ApiModelProperty(value="1-公司 2-人")
@ApiModelProperty(value = "1-公司 2-人")
private String type;
/**
*
*/
@TableField(value = "legalPersonName")
@ApiModelProperty(value="法人")
@ApiModelProperty(value = "法人")
private String legalPersonName;
/**
*
*/
@TableField(value = "regNumber")
@ApiModelProperty(value="注册号")
@ApiModelProperty(value = "注册号")
private String regNumber;
/**
*
*/
@TableField(value = "creditCode")
@ApiModelProperty(value="统一社会信用代码")
@ApiModelProperty(value = "统一社会信用代码")
private String creditCode;
/**
*
*/
@TableField(value = "orgNumber")
@ApiModelProperty(value="组织机构代码")
@ApiModelProperty(value = "组织机构代码")
private String orgNumber;
/**
*
*/
@TableField(value = "base")
@ApiModelProperty(value="省份")
@ApiModelProperty(value = "省份")
private String base;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L;
}

@ -6,61 +6,67 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*/
@ApiModel(value="com-glxp-udidl-admin-entity-tyapi-TyContactCall")
*
*/
@ApiModel(value = "com-glxp-udidl-admin-entity-tyapi-TyContactCall")
@Data
@TableName(value = "ty_contact_call")
public class TyContactCallEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value="")
@ApiModelProperty(value = "")
private Integer id;
/**
*
*/
@TableField(value = "phoneNumber")
@ApiModelProperty(value="电话")
@ApiModelProperty(value = "电话")
private String phoneNumber;
/**
*
*/
@TableField(value = "`source`")
@ApiModelProperty(value="号码来源")
@ApiModelProperty(value = "号码来源")
private String source;
/**
*
*/
@TableField(value = "tag")
@ApiModelProperty(value="标签")
@ApiModelProperty(value = "标签")
private String tag;
/**
* ID
*/
@TableField(value = "contactIdFk")
@ApiModelProperty(value="公司ID外键")
private Integer contactIdFk;
@ApiModelProperty(value = "公司ID外键")
private String contactIdFk;
/**
*
*/
@TableField(value = "creditCodeFk")
@ApiModelProperty(value="所属企业统一社会信用号外键")
@ApiModelProperty(value = "所属企业统一社会信用号外键")
private String creditCodeFk;
/**
*
*/
@TableField(value = "supplierName")
@ApiModelProperty(value="所属企业名称")
@ApiModelProperty(value = "所属企业名称")
private String supplierName;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L;
}

@ -6,13 +6,16 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*/
@ApiModel(value="com-glxp-udidl-admin-entity-tyapi-TyContactInfo")
*
*/
@ApiModel(value = "com-glxp-udidl-admin-entity-tyapi-TyContactInfo")
@Data
@TableName(value = "ty_contact_info")
public class TyContactInfoEntity implements Serializable {
@ -20,50 +23,53 @@ public class TyContactInfoEntity implements Serializable {
* id
*/
@TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value="公司id")
@ApiModelProperty(value = "公司id")
private String id;
/**
*
*/
@TableField(value = "phoneNumber")
@ApiModelProperty(value="电话")
@ApiModelProperty(value = "电话")
private String phoneNumber;
/**
*
*/
@TableField(value = "regLocation")
@ApiModelProperty(value="注册地址")
@ApiModelProperty(value = "注册地址")
private String regLocation;
/**
*
*/
@TableField(value = "email")
@ApiModelProperty(value="邮箱")
@ApiModelProperty(value = "邮箱")
private String email;
/**
*
*/
@TableField(value = "websiteList")
@ApiModelProperty(value="网址")
@ApiModelProperty(value = "网址")
private String websiteList;
/**
*
*/
@TableField(value = "creditCodeFk")
@ApiModelProperty(value="所属企业统一社会信用号")
@ApiModelProperty(value = "所属企业统一社会信用号")
private String creditCodeFk;
/**
*
*/
@TableField(value = "supplierName")
@ApiModelProperty(value="所属企业名称")
@ApiModelProperty(value = "所属企业名称")
private String supplierName;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,12 @@
package com.glxp.udidl.admin.req.tyapi;
import lombok.Data;
@Data
public class TyBaseInfoRequest {
//企业名称
private String name;
//统一社会信用代码
private String creditCode;
}

@ -0,0 +1,9 @@
package com.glxp.udidl.admin.req.tyapi;
import lombok.Data;
@Data
public class TyContactRequest {
private String supplierName;
private String creditCodeFk;
}

@ -23,7 +23,7 @@ public class CompanyBaseResponse {
@JsonProperty("historyNames")
private String historyNames;
@JsonProperty("cancelDate")
private Object cancelDate;
private String cancelDate;
@JsonProperty("regStatus")
private String regStatus;
@JsonProperty("regCapital")
@ -41,7 +41,7 @@ public class CompanyBaseResponse {
@JsonProperty("bondName")
private String bondName;
@JsonProperty("revokeDate")
private Object revokeDate;
private String revokeDate;
@JsonProperty("type")
private Integer type;
@JsonProperty("updateTimes")
@ -79,7 +79,7 @@ public class CompanyBaseResponse {
@JsonProperty("email")
private String email;
@JsonProperty("toTime")
private Object toTime;
private String toTime;
@JsonProperty("actualCapital")
private String actualCapital;
@JsonProperty("estiblishTime")

@ -0,0 +1,15 @@
package com.glxp.udidl.admin.res.tyapi;
import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity;
import com.glxp.udidl.admin.entity.tyapi.TySupplierEntity;
import lombok.Data;
import java.util.List;
@Data
public class TyBatchDlResponse {
List<TyContactResponse> tyContactResponses;
List<TyCompanyDetailEntity> tyCompanyDetailEntities;
List<TySupplierEntity> tySupplierEntities;
}

@ -0,0 +1,81 @@
package com.glxp.udidl.admin.res.tyapi;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class TyContactResponse {
/**
*
*/
@ApiModelProperty(value = "当前电话")
private String mainPhoneNumber;
/**
*
*/
@ApiModelProperty(value = "注册地址")
private String regLocation;
/**
*
*/
@ApiModelProperty(value = "邮箱")
private String email;
/**
*
*/
@TableField(value = "websiteList")
@ApiModelProperty(value = "网址")
private String websiteList;
/**
*
*/
@TableField(value = "creditCodeFk")
@ApiModelProperty(value = "所属企业统一社会信用号")
private String creditCodeFk;
/**
*
*/
@TableField(value = "supplierName")
@ApiModelProperty(value = "所属企业名称")
private String supplierName;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value = "")
private Integer id;
/**
*
*/
@ApiModelProperty(value = "电话")
private String phoneNumber;
/**
*
*/
@ApiModelProperty(value = "号码来源")
private String source;
/**
*
*/
@ApiModelProperty(value = "标签")
private String tag;
}

@ -1,10 +1,57 @@
package com.glxp.udidl.admin.service.tyapi;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udidl.admin.entity.tyapi.TyContactCallEntity;
import com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity;
import com.glxp.udidl.admin.res.tyapi.CompanyBaseResponse;
import com.glxp.udidl.admin.res.tyapi.ContactResponse;
import com.glxp.udidl.admin.util.BeanCopyUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.udidl.admin.dao.tyapi.TyCompanyDetailMapper;
import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity;
import javax.annotation.Resource;
import java.util.List;
@Service
public class TyCompanyDetailService extends ServiceImpl<TyCompanyDetailMapper, TyCompanyDetailEntity> {
@Resource
TyDlHttpClient tyDlHttpClient;
@Resource
TyCompanyDetailMapper tyCompanyDetailMapper;
public TyCompanyDetailEntity download(String company) {
if (tyCompanyDetailMapper.exists(new QueryWrapper<TyCompanyDetailEntity>().eq("name", company))) {
log.error(company + "企业详细信息已存在!");
} else {
CompanyBaseResponse companyBaseResponse = tyDlHttpClient.getBaseInfo(company);
if (companyBaseResponse.getErrorCode() == 0) {
CompanyBaseResponse.ResultDTO resultDTO = companyBaseResponse.getResult();
TyCompanyDetailEntity tyCompanyDetailEntity = new TyCompanyDetailEntity();
BeanUtil.copyProperties(resultDTO, tyCompanyDetailEntity);
if (CollUtil.isNotEmpty(resultDTO.getHistoryNameList())) {
tyCompanyDetailEntity.setHistoryNameList(StringUtils.join(resultDTO.getHistoryNameList(), ","));
}
CompanyBaseResponse.ResultDTO.IndustryAllDTO industryAllDTO = resultDTO.getIndustryAll();
if (industryAllDTO != null) {
tyCompanyDetailEntity.setIndustryAll(JSON.toJSONString(industryAllDTO));
}
tyCompanyDetailMapper.insert(tyCompanyDetailEntity);
} else {
log.error(company + "下载企业信息失败!");
}
}
List<TyCompanyDetailEntity> tyCompanyDetailEntities = tyCompanyDetailMapper.selectList(new QueryWrapper<TyCompanyDetailEntity>().eq("name", company));
if (CollUtil.isNotEmpty(tyCompanyDetailEntities))
return tyCompanyDetailEntities.get(0);
else
return null;
}
}

@ -1,10 +1,62 @@
package com.glxp.udidl.admin.service.tyapi;
import org.springframework.stereotype.Service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity;
import com.glxp.udidl.admin.dao.tyapi.TyContactCallMapper;
import com.glxp.udidl.admin.dao.tyapi.TyContactInfoMapper;
import com.glxp.udidl.admin.entity.tyapi.TyContactCallEntity;
import com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity;
import com.glxp.udidl.admin.req.tyapi.TyContactRequest;
import com.glxp.udidl.admin.res.tyapi.ContactResponse;
import com.glxp.udidl.admin.res.tyapi.TyContactResponse;
import com.glxp.udidl.admin.util.BeanCopyUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class TyContactInfoService extends ServiceImpl<TyContactInfoMapper, TyContactInfoEntity> {
@Resource
TyDlHttpClient tyDlHttpClient;
@Resource
TyContactInfoMapper tyContactInfoMapper;
@Resource
TyContactCallMapper tyContactCallMapper;
public List<TyContactResponse> download(String company) {
if (tyContactInfoMapper.exists(new QueryWrapper<TyContactInfoEntity>().eq("supplierName", company))) {
log.error(company + "企业联系方式已存在重复下载!");
} else {
ContactResponse contactResponse = tyDlHttpClient.getContact(company);
if (contactResponse.getErrorCode() == 0) {
ContactResponse.ResultDTO resultDTO = contactResponse.getResult();
TyContactInfoEntity tyContactInfoEntity = new TyContactInfoEntity();
BeanUtil.copyProperties(resultDTO, tyContactInfoEntity);
tyContactInfoEntity.setSupplierName(company);
tyContactInfoMapper.insert(tyContactInfoEntity);
List<ContactResponse.ResultDTO.AllCallsDTO> allCallsDTOS = resultDTO.getAllCalls();
if (CollUtil.isNotEmpty(allCallsDTOS)) {
List<TyContactCallEntity> tyContactCallEntities = BeanCopyUtils.copyList(allCallsDTOS, TyContactCallEntity.class);
if (CollUtil.isNotEmpty(tyContactCallEntities)) {
for (TyContactCallEntity tyContactCallEntity : tyContactCallEntities) {
tyContactCallEntity.setContactIdFk(tyContactInfoEntity.getId());
tyContactCallEntity.setSupplierName(company);
}
tyContactCallMapper.insertBatch(tyContactCallEntities);
}
}
}
}
TyContactRequest tyContactRequest = new TyContactRequest();
tyContactRequest.setSupplierName(company);
List<TyContactResponse> tyContactInfoEntities = tyContactInfoMapper.findGroup(tyContactRequest);
return tyContactInfoEntities;
}
}

@ -7,6 +7,7 @@ import com.glxp.udidl.admin.res.tyapi.ContactResponse;
import com.glxp.udidl.admin.res.tyapi.OpenSearchResponse;
import com.glxp.udidl.admin.res.tyapi.SupplierResponse;
import com.glxp.udidl.admin.util.OkHttpCli;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -14,6 +15,7 @@ import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Service
public class TyDlHttpClient {
@ -36,6 +38,7 @@ public class TyDlHttpClient {
params.put("pageNum", pageNum + "");
params.put("pageSize", pageSize + "");
String response = okHttpCli.doGet(supplyUrl, params, headers);
log.info(response);
SupplierResponse baseResponse = JSONObject.parseObject(response, new TypeReference<SupplierResponse>() {
});
return baseResponse;
@ -46,6 +49,7 @@ public class TyDlHttpClient {
Map<String, String> params = new HashMap<>();
params.put("keyword", company);
String response = okHttpCli.doGet(baseInfoUrl, params, headers);
log.info(response);
CompanyBaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<CompanyBaseResponse>() {
});
return baseResponse;
@ -56,6 +60,7 @@ public class TyDlHttpClient {
Map<String, String> params = new HashMap<>();
params.put("keyword", company);
String response = okHttpCli.doGet(contactUrl, params, headers);
log.info(response);
ContactResponse baseResponse = JSONObject.parseObject(response, new TypeReference<ContactResponse>() {
});
return baseResponse;
@ -67,6 +72,7 @@ public class TyDlHttpClient {
Map<String, String> params = new HashMap<>();
params.put("keyword", company);
String response = okHttpCli.doGet(openSearchUrl, params, headers);
log.info(response);
OpenSearchResponse baseResponse = JSONObject.parseObject(response, new TypeReference<OpenSearchResponse>() {
});
return baseResponse;

@ -2,6 +2,8 @@ package com.glxp.udidl.admin.service.tyapi;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity;
import com.glxp.udidl.admin.res.tyapi.SupplierResponse;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -19,29 +21,34 @@ public class TySupplierService extends ServiceImpl<TySupplierMapper, TySupplierE
@Resource
TySupplierMapper tySupplierMapper;
public void download(String hospital) {
public List<TySupplierEntity> download(String hospital) {
Integer pageNum = 1;
Integer pageSize = 20;
while (true) {
SupplierResponse supplierResponse = tyDlHttpClient.getSupplier(hospital, pageNum, pageSize);
if (supplierResponse.getErrorCode() == 0) {
List<SupplierResponse.ResultDTO.PageBeanDTO.SupplierDTO> supplierDTOS = supplierResponse.getResult().getPageBean().getResult();
List<TySupplierEntity> tySupplierEntities = BeanUtil.copyToList(supplierDTOS, TySupplierEntity.class);
if (CollUtil.isNotEmpty(supplierDTOS)) {
for (TySupplierEntity tySupplierEntity : tySupplierEntities) {
tySupplierEntity.setHospName(hospital);
tySupplierEntity.setUpdateTime(new Date());
if (tySupplierMapper.exists(new QueryWrapper<TySupplierEntity>().eq("hospName", hospital))) {
log.error(hospital + "供应商列表已存在重复下载!");
} else {
while (true) {
SupplierResponse supplierResponse = tyDlHttpClient.getSupplier(hospital, pageNum, pageSize);
if (supplierResponse.getErrorCode() == 0) {
List<SupplierResponse.ResultDTO.PageBeanDTO.SupplierDTO> supplierDTOS = supplierResponse.getResult().getPageBean().getResult();
List<TySupplierEntity> tySupplierEntities = BeanUtil.copyToList(supplierDTOS, TySupplierEntity.class);
if (CollUtil.isNotEmpty(supplierDTOS)) {
for (TySupplierEntity tySupplierEntity : tySupplierEntities) {
tySupplierEntity.setHospName(hospital);
tySupplierEntity.setUpdateTime(new Date());
}
}
tySupplierMapper.insertBatch(tySupplierEntities);
if (CollUtil.isNotEmpty(supplierDTOS) && supplierDTOS.size() == 20) {
pageNum = pageNum + 1;
} else {
break;
}
}
tySupplierMapper.insertBatch(tySupplierEntities);
if (CollUtil.isNotEmpty(supplierDTOS) && supplierDTOS.size() == 20) {
pageNum = pageNum + 1;
} else {
return;
}
}
}
List<TySupplierEntity> tySupplierEntities = tySupplierMapper.selectList(new QueryWrapper<TySupplierEntity>().eq("hospName", hospital));
return tySupplierEntities;
}

@ -1,19 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.udidl.admin.dao.tyapi.TyContactInfoMapper">
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity">
<!--@mbg.generated-->
<!--@Table ty_contact_info-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="phoneNumber" jdbcType="VARCHAR" property="phoneNumber" />
<result column="regLocation" jdbcType="VARCHAR" property="regLocation" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="websiteList" jdbcType="VARCHAR" property="websiteList" />
<result column="creditCodeFk" jdbcType="VARCHAR" property="creditCodeFk" />
<result column="supplierName" jdbcType="VARCHAR" property="supplierName" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, phoneNumber, regLocation, email, websiteList, creditCodeFk, supplierName
</sql>
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity">
<!--@mbg.generated-->
<!--@Table ty_contact_info-->
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="phoneNumber" jdbcType="VARCHAR" property="phoneNumber"/>
<result column="regLocation" jdbcType="VARCHAR" property="regLocation"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="websiteList" jdbcType="VARCHAR" property="websiteList"/>
<result column="creditCodeFk" jdbcType="VARCHAR" property="creditCodeFk"/>
<result column="supplierName" jdbcType="VARCHAR" property="supplierName"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, phoneNumber, regLocation, email, websiteList, creditCodeFk, supplierName
</sql>
<select id="findGroup" parameterType="com.glxp.udidl.admin.req.tyapi.TyContactRequest"
resultType="com.glxp.udidl.admin.res.tyapi.TyContactResponse">
SELECT tci.phoneNumber mainPhoneNumber,
tci.regLocation,
tci.email,
tci.websiteList,
tci.creditCodeFk,
tci.supplierName,
tci.updateTime,
tcc.id,
tcc.phoneNumber,
tcc.source,
tcc.tag
FROM ty_contact_info tci
inner join ty_contact_call tcc on tci.id = tcc.contactIdFk
<where>
<if test="supplierName != '' and supplierName != null">
AND supplierName = #{supplierName}
</if>
<if test="creditCodeFk != '' and creditCodeFk != null">
AND creditCodeFk = #{creditCodeFk}
</if>
</where>
</select>
</mapper>

@ -1,7 +1,9 @@
# 字段新增 表名字段名字段类型修改方式1新增2修改3删除
CALL Pro_Temp_ColumnWork('ty_supplier', 'updateTime', 'date', 1);
CALL Pro_Temp_ColumnWork('ty_supplier', 'updateTime', 'date', 1);
CALL Pro_Temp_ColumnWork('ty_supplier', 'updateTime', 'date', 1);
CALL Pro_Temp_ColumnWork('ty_supplier', 'updateTime', 'date', 1);

Loading…
Cancel
Save