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

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.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.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.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.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 com.glxp.udidl.admin.util.ResultVOUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; 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 org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Api(tags = "天眼查API接口") @Api(tags = "天眼查API接口")
@ -21,6 +34,12 @@ public class TySearchController {
@Resource @Resource
TyCompanySearchService tyCompanySearchService; TyCompanySearchService tyCompanySearchService;
@Resource
TySupplierService tySupplierService;
@Resource
TyCompanyDetailService tyCompanyDetailService;
@Resource
TyContactInfoService tyContactInfoService;
@ApiOperation(value = "天眼查企业信息查询", response = TyCompanySearchEntity.class) @ApiOperation(value = "天眼查企业信息查询", response = TyCompanySearchEntity.class)
@GetMapping("udidl/ty/company/findBycCeditCode") @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; package com.glxp.udidl.admin.dao.tyapi;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udidl.admin.dao.BaseMapperPlus;
import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity; import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@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; 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 com.glxp.udidl.admin.entity.tyapi.TyContactCallEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@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; 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.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 org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper @Mapper
public interface TyContactInfoMapper extends BaseMapper<TyContactInfoEntity> { public interface TyContactInfoMapper extends BaseMapperPlus<TyContactInfoMapper, TyContactInfoEntity, TyContactInfoEntity> {
List<TyContactResponse> findGroup(TyContactRequest tyContactRequest);
} }

@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import lombok.Data; import lombok.Data;
/** /**
@ -342,5 +345,9 @@ public class TyCompanyDetailEntity implements Serializable {
@ApiModelProperty(value = "省份简称") @ApiModelProperty(value = "省份简称")
private String base; private String base;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import lombok.Data; import lombok.Data;
/** /**
@ -105,5 +108,9 @@ public class TyCompanySearchEntity implements Serializable {
@ApiModelProperty(value = "省份") @ApiModelProperty(value = "省份")
private String base; private String base;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import lombok.Data; import lombok.Data;
/** /**
@ -46,7 +49,7 @@ public class TyContactCallEntity implements Serializable {
*/ */
@TableField(value = "contactIdFk") @TableField(value = "contactIdFk")
@ApiModelProperty(value = "公司ID外键") @ApiModelProperty(value = "公司ID外键")
private Integer contactIdFk; private String contactIdFk;
/** /**
* *
@ -62,5 +65,8 @@ public class TyContactCallEntity implements Serializable {
@ApiModelProperty(value = "所属企业名称") @ApiModelProperty(value = "所属企业名称")
private String supplierName; private String supplierName;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import lombok.Data; import lombok.Data;
/** /**
@ -65,5 +68,8 @@ public class TyContactInfoEntity implements Serializable {
@ApiModelProperty(value = "所属企业名称") @ApiModelProperty(value = "所属企业名称")
private String supplierName; private String supplierName;
@TableField(value = "updateTime")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L; 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") @JsonProperty("historyNames")
private String historyNames; private String historyNames;
@JsonProperty("cancelDate") @JsonProperty("cancelDate")
private Object cancelDate; private String cancelDate;
@JsonProperty("regStatus") @JsonProperty("regStatus")
private String regStatus; private String regStatus;
@JsonProperty("regCapital") @JsonProperty("regCapital")
@ -41,7 +41,7 @@ public class CompanyBaseResponse {
@JsonProperty("bondName") @JsonProperty("bondName")
private String bondName; private String bondName;
@JsonProperty("revokeDate") @JsonProperty("revokeDate")
private Object revokeDate; private String revokeDate;
@JsonProperty("type") @JsonProperty("type")
private Integer type; private Integer type;
@JsonProperty("updateTimes") @JsonProperty("updateTimes")
@ -79,7 +79,7 @@ public class CompanyBaseResponse {
@JsonProperty("email") @JsonProperty("email")
private String email; private String email;
@JsonProperty("toTime") @JsonProperty("toTime")
private Object toTime; private String toTime;
@JsonProperty("actualCapital") @JsonProperty("actualCapital")
private String actualCapital; private String actualCapital;
@JsonProperty("estiblishTime") @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; 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 org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.udidl.admin.dao.tyapi.TyCompanyDetailMapper; import com.glxp.udidl.admin.dao.tyapi.TyCompanyDetailMapper;
import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity; import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity;
import javax.annotation.Resource;
import java.util.List;
@Service @Service
public class TyCompanyDetailService extends ServiceImpl<TyCompanyDetailMapper, TyCompanyDetailEntity> { 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; 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.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.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 @Service
public class TyContactInfoService extends ServiceImpl<TyContactInfoMapper, TyContactInfoEntity> { 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.OpenSearchResponse;
import com.glxp.udidl.admin.res.tyapi.SupplierResponse; import com.glxp.udidl.admin.res.tyapi.SupplierResponse;
import com.glxp.udidl.admin.util.OkHttpCli; import com.glxp.udidl.admin.util.OkHttpCli;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -14,6 +15,7 @@ import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Slf4j
@Service @Service
public class TyDlHttpClient { public class TyDlHttpClient {
@ -36,6 +38,7 @@ public class TyDlHttpClient {
params.put("pageNum", pageNum + ""); params.put("pageNum", pageNum + "");
params.put("pageSize", pageSize + ""); params.put("pageSize", pageSize + "");
String response = okHttpCli.doGet(supplyUrl, params, headers); String response = okHttpCli.doGet(supplyUrl, params, headers);
log.info(response);
SupplierResponse baseResponse = JSONObject.parseObject(response, new TypeReference<SupplierResponse>() { SupplierResponse baseResponse = JSONObject.parseObject(response, new TypeReference<SupplierResponse>() {
}); });
return baseResponse; return baseResponse;
@ -46,6 +49,7 @@ public class TyDlHttpClient {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("keyword", company); params.put("keyword", company);
String response = okHttpCli.doGet(baseInfoUrl, params, headers); String response = okHttpCli.doGet(baseInfoUrl, params, headers);
log.info(response);
CompanyBaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<CompanyBaseResponse>() { CompanyBaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<CompanyBaseResponse>() {
}); });
return baseResponse; return baseResponse;
@ -56,6 +60,7 @@ public class TyDlHttpClient {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("keyword", company); params.put("keyword", company);
String response = okHttpCli.doGet(contactUrl, params, headers); String response = okHttpCli.doGet(contactUrl, params, headers);
log.info(response);
ContactResponse baseResponse = JSONObject.parseObject(response, new TypeReference<ContactResponse>() { ContactResponse baseResponse = JSONObject.parseObject(response, new TypeReference<ContactResponse>() {
}); });
return baseResponse; return baseResponse;
@ -67,6 +72,7 @@ public class TyDlHttpClient {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("keyword", company); params.put("keyword", company);
String response = okHttpCli.doGet(openSearchUrl, params, headers); String response = okHttpCli.doGet(openSearchUrl, params, headers);
log.info(response);
OpenSearchResponse baseResponse = JSONObject.parseObject(response, new TypeReference<OpenSearchResponse>() { OpenSearchResponse baseResponse = JSONObject.parseObject(response, new TypeReference<OpenSearchResponse>() {
}); });
return baseResponse; return baseResponse;

@ -2,6 +2,8 @@ package com.glxp.udidl.admin.service.tyapi;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; 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 com.glxp.udidl.admin.res.tyapi.SupplierResponse;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -19,10 +21,12 @@ public class TySupplierService extends ServiceImpl<TySupplierMapper, TySupplierE
@Resource @Resource
TySupplierMapper tySupplierMapper; TySupplierMapper tySupplierMapper;
public void download(String hospital) { public List<TySupplierEntity> download(String hospital) {
Integer pageNum = 1; Integer pageNum = 1;
Integer pageSize = 20; Integer pageSize = 20;
if (tySupplierMapper.exists(new QueryWrapper<TySupplierEntity>().eq("hospName", hospital))) {
log.error(hospital + "供应商列表已存在重复下载!");
} else {
while (true) { while (true) {
SupplierResponse supplierResponse = tyDlHttpClient.getSupplier(hospital, pageNum, pageSize); SupplierResponse supplierResponse = tyDlHttpClient.getSupplier(hospital, pageNum, pageSize);
if (supplierResponse.getErrorCode() == 0) { if (supplierResponse.getErrorCode() == 0) {
@ -38,10 +42,13 @@ public class TySupplierService extends ServiceImpl<TySupplierMapper, TySupplierE
if (CollUtil.isNotEmpty(supplierDTOS) && supplierDTOS.size() == 20) { if (CollUtil.isNotEmpty(supplierDTOS) && supplierDTOS.size() == 20) {
pageNum = pageNum + 1; pageNum = pageNum + 1;
} else { } else {
return; break;
}
} }
} }
} }
List<TySupplierEntity> tySupplierEntities = tySupplierMapper.selectList(new QueryWrapper<TySupplierEntity>().eq("hospName", hospital));
return tySupplierEntities;
} }

@ -16,4 +16,30 @@
<!--@mbg.generated--> <!--@mbg.generated-->
id, phoneNumber, regLocation, email, websiteList, creditCodeFk, supplierName id, phoneNumber, regLocation, email, websiteList, creditCodeFk, supplierName
</sql> </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> </mapper>

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

Loading…
Cancel
Save