天眼查询,供应商与企业信息详情等接口完善
parent
e578197c7d
commit
61a8006c10
@ -0,0 +1,153 @@
|
|||||||
|
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.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.req.tyapi.TyImportSupRequest;
|
||||||
|
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下载接口")
|
||||||
|
@RestController
|
||||||
|
public class TyDownloadController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
TyCompanySearchService tyCompanySearchService;
|
||||||
|
@Resource
|
||||||
|
TySupplierService tySupplierService;
|
||||||
|
@Resource
|
||||||
|
TyCompanyDetailService tyCompanyDetailService;
|
||||||
|
@Resource
|
||||||
|
TyContactInfoService tyContactInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "天眼查批量下载供应商列表接口")
|
||||||
|
@PostMapping("/udidl/ty/company/batch/dl/supplier")
|
||||||
|
public BaseResponse imports(@RequestBody TyImportSupRequest tyImportSupRequest) {
|
||||||
|
|
||||||
|
List<String> hospList = new ArrayList<>();
|
||||||
|
if (StrUtil.isNotEmpty(tyImportSupRequest.getHospitals())) {
|
||||||
|
String[] hospAarray = tyImportSupRequest.getHospitals().split(",");
|
||||||
|
CollUtil.toList(hospAarray);
|
||||||
|
} else if (CollUtil.isNotEmpty(tyImportSupRequest.getHospNames())) {
|
||||||
|
hospList.addAll(tyImportSupRequest.getHospNames());
|
||||||
|
} else if (CollUtil.isNotEmpty(tyImportSupRequest.getHospCertCodes())) {
|
||||||
|
hospList.addAll(tyImportSupRequest.getHospCertCodes());
|
||||||
|
}
|
||||||
|
TyBatchDlResponse tyBatchDlResponse = new TyBatchDlResponse();
|
||||||
|
List<TySupplierEntity> mTySupplierEntities = new ArrayList<>();
|
||||||
|
for (int i = 0; i < hospList.size(); i++) {
|
||||||
|
List<TySupplierEntity> tySupplierEntities = null;
|
||||||
|
if (CollUtil.isNotEmpty(tyImportSupRequest.getHospCertCodes())) {
|
||||||
|
tySupplierService.downloadByCode(hospList.get(i), null);
|
||||||
|
tySupplierEntities = tySupplierService.list(new QueryWrapper<TySupplierEntity>().eq("creditCodeFk", hospList.get(i)));
|
||||||
|
} else {
|
||||||
|
tySupplierService.downloadByName(hospList.get(i), null);
|
||||||
|
tySupplierEntities = tySupplierService.list(new QueryWrapper<TySupplierEntity>().eq("hospName", hospList.get(i)));
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(tySupplierEntities)) {
|
||||||
|
mTySupplierEntities.addAll(tySupplierEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tyBatchDlResponse.setTySupplierEntities(mTySupplierEntities);
|
||||||
|
return ResultVOUtils.success(tyBatchDlResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "天眼查批量下载供应商列表接口")
|
||||||
|
@PostMapping("/udidl/ty/company/batch/dl/rel/supplier")
|
||||||
|
public BaseResponse importRels(@RequestBody TyImportSupRequest tyImportSupRequest) {
|
||||||
|
if (StrUtil.isEmpty(tyImportSupRequest.getHospitals())) {
|
||||||
|
return ResultVOUtils.error(500, "医院名称列表不能为空");
|
||||||
|
}
|
||||||
|
List<String> hospList = new ArrayList<>();
|
||||||
|
String[] hospAarray = tyImportSupRequest.getHospitals().split(",");
|
||||||
|
if (hospAarray != null)
|
||||||
|
hospList = CollUtil.toList(hospAarray);
|
||||||
|
TyBatchDlResponse tyBatchDlResponse = new TyBatchDlResponse();
|
||||||
|
List<TyCompanyDetailEntity> mTyCompanyDetailEntities = new ArrayList<>();
|
||||||
|
List<TyContactResponse> mTyContactResponses = new ArrayList<>();
|
||||||
|
List<TySupplierEntity> mTySupplierEntities = new ArrayList<>();
|
||||||
|
for (int i = 0; i < hospList.size(); i++) {
|
||||||
|
tySupplierService.downloadByName(hospList.get(i), null);
|
||||||
|
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.downloadByName(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/dl/getBaseInfo")
|
||||||
|
public BaseResponse getCompanyInfo(TyBaseInfoRequest tyBaseInfoRequest) {
|
||||||
|
if (StrUtil.isEmpty(tyBaseInfoRequest.getName()) && StrUtil.isEmpty(tyBaseInfoRequest.getCreditCode())) {
|
||||||
|
return ResultVOUtils.error(500, "请输入企业名称或统一社会信用代码");
|
||||||
|
}
|
||||||
|
String keyWord = "";
|
||||||
|
TyCompanyDetailEntity tyCompanyDetailEntity;
|
||||||
|
if (StrUtil.isNotEmpty(tyBaseInfoRequest.getCreditCode())) {
|
||||||
|
tyCompanyDetailEntity = tyCompanyDetailService.downloadByCode(tyBaseInfoRequest.getCreditCode());
|
||||||
|
} else
|
||||||
|
tyCompanyDetailEntity = tyCompanyDetailService.downloadByCode(tyBaseInfoRequest.getName());
|
||||||
|
|
||||||
|
return ResultVOUtils.success(tyCompanyDetailEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "天眼查批量下载企业详细信息接口")
|
||||||
|
@GetMapping("/udidl/ty/company/batch/dl/getBaseInfo")
|
||||||
|
public BaseResponse batchGetCompanyInfo(TyBaseInfoRequest tyBaseInfoRequest) {
|
||||||
|
if (StrUtil.isEmpty(tyBaseInfoRequest.getName()) && StrUtil.isEmpty(tyBaseInfoRequest.getCreditCode())) {
|
||||||
|
return ResultVOUtils.error(500, "请输入企业名称或统一社会信用代码");
|
||||||
|
}
|
||||||
|
List<TyCompanyDetailEntity> tyCompanyDetailEntities = new ArrayList<>();
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(tyBaseInfoRequest.getSupCodes())) {
|
||||||
|
for (String supCode : tyBaseInfoRequest.getSupCodes()) {
|
||||||
|
TyCompanyDetailEntity tyCompanyDetailEntity = tyCompanyDetailService.downloadByCode(supCode);
|
||||||
|
tyCompanyDetailEntities.add(tyCompanyDetailEntity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (String supName : tyBaseInfoRequest.getSupNames()) {
|
||||||
|
TyCompanyDetailEntity tyCompanyDetailEntity = tyCompanyDetailService.downloadByName(supName);
|
||||||
|
tyCompanyDetailEntities.add(tyCompanyDetailEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success(tyCompanyDetailEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,21 @@
|
|||||||
package com.glxp.udidl.admin.req.tyapi;
|
package com.glxp.udidl.admin.req.tyapi;
|
||||||
|
|
||||||
|
import com.glxp.udidl.admin.req.ListPageRequest;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TyBaseInfoRequest {
|
public class TyBaseInfoRequest extends ListPageRequest {
|
||||||
|
|
||||||
//企业名称
|
//企业名称
|
||||||
private String name;
|
private String name;
|
||||||
//统一社会信用代码
|
//统一社会信用代码
|
||||||
private String creditCode;
|
private String creditCode;
|
||||||
|
|
||||||
|
|
||||||
|
private List<String> supNames;
|
||||||
|
private List<String> supCodes;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue