天眼查询,供应商与企业信息详情等接口完善

zhairh
anthonywj 2 years ago
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);
}
}

@ -3,12 +3,14 @@ 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.github.pagehelper.PageInfo;
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.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;
@ -28,7 +30,7 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Api(tags = "天眼查API接口")
@Api(tags = "天眼查API查询接口")
@RestController
public class TySearchController {
@ -38,13 +40,10 @@ public class TySearchController {
TySupplierService tySupplierService;
@Resource
TyCompanyDetailService tyCompanyDetailService;
@Resource
TyContactInfoService tyContactInfoService;
@ApiOperation(value = "天眼查企业信息查询", response = TyCompanySearchEntity.class)
@ApiOperation(value = "天眼查企业信息查询(搜索查询)", response = TyCompanySearchEntity.class)
@GetMapping("udidl/ty/company/findBycCeditCode")
public BaseResponse findBycCeditCode(String creditCode) {
if (StrUtil.isEmpty(creditCode)) {
return ResultVOUtils.error(500, "统一社会信用代码不能为空!");
}
@ -56,52 +55,29 @@ public class TySearchController {
}
}
@ApiOperation(value = "天眼查批量下载供应商列表接口")
@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);
public BaseResponse supplierSearch(@RequestBody TyImportSupRequest tyImportSupRequest) {
List<TySupplierEntity> tySupplierEntities = tySupplierService.filterList(tyImportSupRequest);
PageInfo<TySupplierEntity> pageInfo = new PageInfo<>(tySupplierEntities);
return ResultVOUtils.page(pageInfo);
}
@ApiOperation(value = "天眼查批量下载企业详细信息接口")
@ApiOperation(value = "天眼查批量查询企业详细信息接口")
@GetMapping("/udidl/ty/company/getBaseInfo")
public BaseResponse getCompanyInfo(TyBaseInfoRequest tyBaseInfoRequest) {
if (StrUtil.isEmpty(tyBaseInfoRequest.getName()) && StrUtil.isEmpty(tyBaseInfoRequest.getCreditCode())) {
if (StrUtil.isEmpty(tyBaseInfoRequest.getName())
&& StrUtil.isEmpty(tyBaseInfoRequest.getCreditCode())
&& CollUtil.isNotEmpty(tyBaseInfoRequest.getSupCodes())
&& CollUtil.isNotEmpty(tyBaseInfoRequest.getSupNames())
) {
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);
List<TyCompanyDetailEntity> tyCompanyDetailEntities = tyCompanyDetailService.filterList(tyBaseInfoRequest);
PageInfo<TyCompanyDetailEntity> pageInfo = new PageInfo<>(tyCompanyDetailEntities);
return ResultVOUtils.page(pageInfo);
}

@ -3,8 +3,14 @@ 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 com.glxp.udidl.admin.req.tyapi.TyBaseInfoRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TyCompanyDetailMapper extends BaseMapperPlus<TyCompanyDetailMapper, TyCompanyDetailEntity, TyCompanyDetailEntity> {
List<TyCompanyDetailEntity> filterList(TyBaseInfoRequest tyBaseInfoRequest);
}

@ -3,8 +3,14 @@ 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.TySupplierEntity;
import com.glxp.udidl.admin.req.tyapi.TyImportSupRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TySupplierMapper extends BaseMapperPlus<TySupplierMapper, TySupplierEntity, TySupplierEntity> {
List<TySupplierEntity> filterList(TyImportSupRequest tyImportSupRequest);
}

@ -37,6 +37,11 @@ public class TySupplierEntity implements Serializable {
@ApiModelProperty(value = "报告期")
private String announcement_date;
@TableField(value = "year")
@ApiModelProperty(value = "年份")
private String year;
/**
*
*/

@ -1,12 +1,21 @@
package com.glxp.udidl.admin.req.tyapi;
import com.glxp.udidl.admin.req.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class TyBaseInfoRequest {
public class TyBaseInfoRequest extends ListPageRequest {
//企业名称
private String name;
//统一社会信用代码
private String creditCode;
private List<String> supNames;
private List<String> supCodes;
}

@ -0,0 +1,38 @@
package com.glxp.udidl.admin.req.tyapi;
import com.glxp.udidl.admin.req.ListPageRequest;
import lombok.Data;
import java.util.List;
@Data
public class TyImportSupRequest extends ListPageRequest {
/**
*
*/
private String hospitals;
private String hospName;
private String creditCodeFk;
/**
*
*/
private List<String> hospNames;
/**
*
*/
private List<String> hospCertCodes;
/**
*
*/
private String year;
/**
*
*/
private List<String> years;
}

@ -4,8 +4,12 @@ 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.github.pagehelper.PageHelper;
import com.glxp.udidl.admin.entity.tyapi.TyContactCallEntity;
import com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity;
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.tyapi.CompanyBaseResponse;
import com.glxp.udidl.admin.res.tyapi.ContactResponse;
import com.glxp.udidl.admin.util.BeanCopyUtils;
@ -16,6 +20,7 @@ import com.glxp.udidl.admin.dao.tyapi.TyCompanyDetailMapper;
import com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
@ -27,7 +32,7 @@ public class TyCompanyDetailService extends ServiceImpl<TyCompanyDetailMapper, T
@Resource
TyCompanyDetailMapper tyCompanyDetailMapper;
public TyCompanyDetailEntity download(String company) {
public TyCompanyDetailEntity downloadByName(String company) {
if (tyCompanyDetailMapper.exists(new QueryWrapper<TyCompanyDetailEntity>().eq("name", company))) {
log.error(company + "企业详细信息已存在!");
} else {
@ -54,4 +59,44 @@ public class TyCompanyDetailService extends ServiceImpl<TyCompanyDetailMapper, T
else
return null;
}
public TyCompanyDetailEntity downloadByCode(String creditCode) {
if (tyCompanyDetailMapper.exists(new QueryWrapper<TyCompanyDetailEntity>().eq("creditCode", creditCode))) {
log.error(creditCode + "企业详细信息已存在!");
} else {
CompanyBaseResponse companyBaseResponse = tyDlHttpClient.getBaseInfo(creditCode);
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(creditCode + "下载企业信息失败!");
}
}
List<TyCompanyDetailEntity> tyCompanyDetailEntities = tyCompanyDetailMapper.selectList(new QueryWrapper<TyCompanyDetailEntity>().eq("creditCode", creditCode));
if (CollUtil.isNotEmpty(tyCompanyDetailEntities))
return tyCompanyDetailEntities.get(0);
else
return null;
}
public List<TyCompanyDetailEntity> filterList(TyBaseInfoRequest tyBaseInfoRequest) {
if (null == tyBaseInfoRequest) {
return Collections.emptyList();
}
if (null != tyBaseInfoRequest.getPage() && null != tyBaseInfoRequest.getLimit()) {
PageHelper.offsetPage((tyBaseInfoRequest.getPage() - 1) * tyBaseInfoRequest.getLimit(), tyBaseInfoRequest.getLimit());
}
return tyCompanyDetailMapper.filterList(tyBaseInfoRequest);
}
}

@ -1,5 +1,6 @@
package com.glxp.udidl.admin.service.tyapi;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.udidl.admin.res.tyapi.CompanyBaseResponse;
@ -32,11 +33,14 @@ public class TyDlHttpClient {
String[] headers = {"Authorization", suthorization};
//获取供应商列表
public SupplierResponse getSupplier(String hospital, Integer pageNum, Integer pageSize) {
public SupplierResponse getSupplier(String hospital, String year, Integer pageNum, Integer pageSize) {
Map<String, String> params = new HashMap<>();
params.put("keyword", hospital);
params.put("pageNum", pageNum + "");
params.put("pageSize", pageSize + "");
if (StrUtil.isNotEmpty(year)) {
params.put("year", year);
}
String response = okHttpCli.doGet(supplyUrl, params, headers);
log.info(response);
SupplierResponse baseResponse = JSONObject.parseObject(response, new TypeReference<SupplierResponse>() {

@ -3,14 +3,19 @@ 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.github.pagehelper.PageHelper;
import com.glxp.udidl.admin.entity.tyapi.TyContactInfoEntity;
import com.glxp.udidl.admin.req.tyapi.TyImportSupRequest;
import com.glxp.udidl.admin.res.tyapi.SupplierResponse;
import com.glxp.udidl.admin.util.DateUtil;
import com.glxp.udidl.admin.util.IntUtil;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.udidl.admin.entity.tyapi.TySupplierEntity;
import com.glxp.udidl.admin.dao.tyapi.TySupplierMapper;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@ -21,21 +26,22 @@ public class TySupplierService extends ServiceImpl<TySupplierMapper, TySupplierE
@Resource
TySupplierMapper tySupplierMapper;
public List<TySupplierEntity> download(String hospital) {
public List<TySupplierEntity> downloadByName(String hospital, String year) {
Integer pageNum = 1;
Integer pageSize = 20;
if (tySupplierMapper.exists(new QueryWrapper<TySupplierEntity>().eq("hospName", hospital))) {
log.error(hospital + "供应商列表已存在重复下载!");
} else {
while (true) {
SupplierResponse supplierResponse = tyDlHttpClient.getSupplier(hospital, pageNum, pageSize);
SupplierResponse supplierResponse = tyDlHttpClient.getSupplier(hospital, year, 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.setHospName(tySupplierEntity.getSupplier_name());
tySupplierEntity.setUpdateTime(new Date());
tySupplierEntity.setYear(DateUtil.formatDate(IntUtil.value(tySupplierEntity.getAnnouncement_date()), "yyyy"));
}
}
tySupplierMapper.insertBatch(tySupplierEntities);
@ -51,5 +57,47 @@ public class TySupplierService extends ServiceImpl<TySupplierMapper, TySupplierE
return tySupplierEntities;
}
public List<TySupplierEntity> downloadByCode(String code, String year) {
Integer pageNum = 1;
Integer pageSize = 20;
if (tySupplierMapper.exists(new QueryWrapper<TySupplierEntity>().eq("creditCodeFk", code))) {
log.error(code + "供应商列表已存在重复下载!");
} else {
while (true) {
SupplierResponse supplierResponse = tyDlHttpClient.getSupplier(code, year, 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(tySupplierEntity.getSupplier_name());
tySupplierEntity.setCreditCodeFk(code);
tySupplierEntity.setUpdateTime(new Date());
tySupplierEntity.setYear(DateUtil.formatDate(IntUtil.value(tySupplierEntity.getAnnouncement_date()), "yyyy"));
}
}
tySupplierMapper.insertBatch(tySupplierEntities);
if (CollUtil.isNotEmpty(supplierDTOS) && supplierDTOS.size() == 20) {
pageNum = pageNum + 1;
} else {
break;
}
}
}
}
List<TySupplierEntity> tySupplierEntities = tySupplierMapper.selectList(new QueryWrapper<TySupplierEntity>().eq("creditCodeFk", code));
return tySupplierEntities;
}
public List<TySupplierEntity> filterList(TyImportSupRequest tyImportSupRequest) {
if (null == tyImportSupRequest) {
return Collections.emptyList();
}
if (null != tyImportSupRequest.getPage() && null != tyImportSupRequest.getLimit()) {
PageHelper.offsetPage((tyImportSupRequest.getPage() - 1) * tyImportSupRequest.getLimit(), tyImportSupRequest.getLimit());
}
return tySupplierMapper.filterList(tyImportSupRequest);
}
}

@ -1,8 +1,10 @@
package com.glxp.udidl.admin.util;
import com.github.pagehelper.PageInfo;
import com.glxp.udidl.admin.enums.ResultEnum;
import com.glxp.udidl.admin.res.BaseResponse;
import com.glxp.udidl.admin.res.PageSimpleResponse;
import java.util.HashMap;
import java.util.Map;
@ -73,4 +75,12 @@ public class ResultVOUtils {
return error(resultEnum.getCode(), message);
}
public static BaseResponse page(PageInfo pageInfo) {
PageSimpleResponse pageSimpleResponse = new PageSimpleResponse();
pageSimpleResponse.setList(pageInfo.getList());
pageSimpleResponse.setTotal(pageInfo.getTotal());
return success(pageSimpleResponse);
}
}

@ -1,65 +1,92 @@
<?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.TyCompanyDetailMapper">
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity">
<!--@mbg.generated-->
<!--@Table ty_company_detail-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="historyNames" jdbcType="VARCHAR" property="historyNames" />
<result column="cancelDate" jdbcType="VARCHAR" property="cancelDate" />
<result column="regStatus" jdbcType="VARCHAR" property="regStatus" />
<result column="regCapital" jdbcType="VARCHAR" property="regCapital" />
<result column="city" jdbcType="VARCHAR" property="city" />
<result column="staffNumRange" jdbcType="VARCHAR" property="staffNumRange" />
<result column="bondNum" jdbcType="VARCHAR" property="bondNum" />
<result column="historyNameList" jdbcType="VARCHAR" property="historyNameList" />
<result column="industry" jdbcType="VARCHAR" property="industry" />
<result column="bondName" jdbcType="VARCHAR" property="bondName" />
<result column="revokeDate" jdbcType="VARCHAR" property="revokeDate" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="updateTimes" jdbcType="VARCHAR" property="updateTimes" />
<result column="legalPersonName" jdbcType="VARCHAR" property="legalPersonName" />
<result column="revokeReason" jdbcType="VARCHAR" property="revokeReason" />
<result column="regNumber" jdbcType="VARCHAR" property="regNumber" />
<result column="creditCode" jdbcType="VARCHAR" property="creditCode" />
<result column="property3" jdbcType="VARCHAR" property="property3" />
<result column="usedBondName" jdbcType="VARCHAR" property="usedBondName" />
<result column="approvedTime" jdbcType="VARCHAR" property="approvedTime" />
<result column="fromTime" jdbcType="VARCHAR" property="fromTime" />
<result column="socialStaffNum" jdbcType="VARCHAR" property="socialStaffNum" />
<result column="actualCapitalCurrency" jdbcType="VARCHAR" property="actualCapitalCurrency" />
<result column="alias" jdbcType="VARCHAR" property="alias" />
<result column="companyOrgType" jdbcType="VARCHAR" property="companyOrgType" />
<result column="cancelReason" jdbcType="VARCHAR" property="cancelReason" />
<result column="orgNumber" jdbcType="VARCHAR" property="orgNumber" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="toTime" jdbcType="VARCHAR" property="toTime" />
<result column="actualCapital" jdbcType="VARCHAR" property="actualCapital" />
<result column="estiblishTime" jdbcType="VARCHAR" property="estiblishTime" />
<result column="regInstitute" jdbcType="VARCHAR" property="regInstitute" />
<result column="businessScope" jdbcType="VARCHAR" property="businessScope" />
<result column="taxNumber" jdbcType="VARCHAR" property="taxNumber" />
<result column="regLocation" jdbcType="VARCHAR" property="regLocation" />
<result column="regCapitalCurrency" jdbcType="VARCHAR" property="regCapitalCurrency" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="websiteList" jdbcType="VARCHAR" property="websiteList" />
<result column="phoneNumber" jdbcType="VARCHAR" property="phoneNumber" />
<result column="district" jdbcType="VARCHAR" property="district" />
<result column="bondType" jdbcType="VARCHAR" property="bondType" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="percentileScore" jdbcType="VARCHAR" property="percentileScore" />
<result column="industryAll" jdbcType="VARCHAR" property="industryAll" />
<result column="isMicroEnt" jdbcType="VARCHAR" property="isMicroEnt" />
<result column="base" jdbcType="VARCHAR" property="base" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, historyNames, cancelDate, regStatus, regCapital, city, staffNumRange, bondNum,
historyNameList, industry, bondName, revokeDate, `type`, updateTimes, legalPersonName,
revokeReason, regNumber, creditCode, property3, usedBondName, approvedTime, fromTime,
socialStaffNum, actualCapitalCurrency, `alias`, companyOrgType, cancelReason, orgNumber,
email, toTime, actualCapital, estiblishTime, regInstitute, businessScope, taxNumber,
regLocation, regCapitalCurrency, tags, websiteList, phoneNumber, district, bondType,
`name`, percentileScore, industryAll, isMicroEnt, base
</sql>
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity">
<!--@mbg.generated-->
<!--@Table ty_company_detail-->
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="historyNames" jdbcType="VARCHAR" property="historyNames"/>
<result column="cancelDate" jdbcType="VARCHAR" property="cancelDate"/>
<result column="regStatus" jdbcType="VARCHAR" property="regStatus"/>
<result column="regCapital" jdbcType="VARCHAR" property="regCapital"/>
<result column="city" jdbcType="VARCHAR" property="city"/>
<result column="staffNumRange" jdbcType="VARCHAR" property="staffNumRange"/>
<result column="bondNum" jdbcType="VARCHAR" property="bondNum"/>
<result column="historyNameList" jdbcType="VARCHAR" property="historyNameList"/>
<result column="industry" jdbcType="VARCHAR" property="industry"/>
<result column="bondName" jdbcType="VARCHAR" property="bondName"/>
<result column="revokeDate" jdbcType="VARCHAR" property="revokeDate"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="updateTimes" jdbcType="VARCHAR" property="updateTimes"/>
<result column="legalPersonName" jdbcType="VARCHAR" property="legalPersonName"/>
<result column="revokeReason" jdbcType="VARCHAR" property="revokeReason"/>
<result column="regNumber" jdbcType="VARCHAR" property="regNumber"/>
<result column="creditCode" jdbcType="VARCHAR" property="creditCode"/>
<result column="property3" jdbcType="VARCHAR" property="property3"/>
<result column="usedBondName" jdbcType="VARCHAR" property="usedBondName"/>
<result column="approvedTime" jdbcType="VARCHAR" property="approvedTime"/>
<result column="fromTime" jdbcType="VARCHAR" property="fromTime"/>
<result column="socialStaffNum" jdbcType="VARCHAR" property="socialStaffNum"/>
<result column="actualCapitalCurrency" jdbcType="VARCHAR" property="actualCapitalCurrency"/>
<result column="alias" jdbcType="VARCHAR" property="alias"/>
<result column="companyOrgType" jdbcType="VARCHAR" property="companyOrgType"/>
<result column="cancelReason" jdbcType="VARCHAR" property="cancelReason"/>
<result column="orgNumber" jdbcType="VARCHAR" property="orgNumber"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="toTime" jdbcType="VARCHAR" property="toTime"/>
<result column="actualCapital" jdbcType="VARCHAR" property="actualCapital"/>
<result column="estiblishTime" jdbcType="VARCHAR" property="estiblishTime"/>
<result column="regInstitute" jdbcType="VARCHAR" property="regInstitute"/>
<result column="businessScope" jdbcType="VARCHAR" property="businessScope"/>
<result column="taxNumber" jdbcType="VARCHAR" property="taxNumber"/>
<result column="regLocation" jdbcType="VARCHAR" property="regLocation"/>
<result column="regCapitalCurrency" jdbcType="VARCHAR" property="regCapitalCurrency"/>
<result column="tags" jdbcType="VARCHAR" property="tags"/>
<result column="websiteList" jdbcType="VARCHAR" property="websiteList"/>
<result column="phoneNumber" jdbcType="VARCHAR" property="phoneNumber"/>
<result column="district" jdbcType="VARCHAR" property="district"/>
<result column="bondType" jdbcType="VARCHAR" property="bondType"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="percentileScore" jdbcType="VARCHAR" property="percentileScore"/>
<result column="industryAll" jdbcType="VARCHAR" property="industryAll"/>
<result column="isMicroEnt" jdbcType="VARCHAR" property="isMicroEnt"/>
<result column="base" jdbcType="VARCHAR" property="base"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, historyNames, cancelDate, regStatus, regCapital, city, staffNumRange, bondNum,
historyNameList, industry, bondName, revokeDate, `type`, updateTimes, legalPersonName,
revokeReason, regNumber, creditCode, property3, usedBondName, approvedTime, fromTime,
socialStaffNum, actualCapitalCurrency, `alias`, companyOrgType, cancelReason, orgNumber,
email, toTime, actualCapital, estiblishTime, regInstitute, businessScope, taxNumber,
regLocation, regCapitalCurrency, tags, websiteList, phoneNumber, district, bondType,
`name`, percentileScore, industryAll, isMicroEnt, base
</sql>
<select id="filterList" parameterType="com.glxp.udidl.admin.req.tyapi.TyBaseInfoRequest"
resultType="com.glxp.udidl.admin.entity.tyapi.TyCompanyDetailEntity">
select ty_company_detail.*
from ty_company_detail
<where>
<if test="name != '' and name != null">
and name like concat('%', #{name}, '%')
</if>
<if test="creditCode != '' and creditCode != null">
and creditCode like concat('%', #{creditCode}, '%')
</if>
<if test="supNames != null and supNames.size() != 0">
AND name in
<foreach collection="supNames" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="supCodes != null and supCodes.size() != 0">
AND creditCode in
<foreach collection="supCodes" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

@ -1,25 +1,61 @@
<?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.TySupplierMapper">
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.tyapi.TySupplierEntity">
<!--@mbg.generated-->
<!--@Table ty_supplier-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="supplier_graphId" jdbcType="VARCHAR" property="supplier_graphId" />
<result column="announcement_date" jdbcType="VARCHAR" property="announcement_date" />
<result column="amt" jdbcType="VARCHAR" property="amt" />
<result column="logo" jdbcType="VARCHAR" property="logo" />
<result column="alias" jdbcType="VARCHAR" property="alias" />
<result column="supplier_name" jdbcType="VARCHAR" property="supplier_name" />
<result column="relationship" jdbcType="VARCHAR" property="relationship" />
<result column="dataSource" jdbcType="VARCHAR" property="dataSource" />
<result column="ratio" jdbcType="VARCHAR" property="ratio" />
<result column="creditCodeFk" jdbcType="VARCHAR" property="creditCodeFk" />
<result column="hospName" jdbcType="VARCHAR" property="hospName" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, supplier_graphId, announcement_date, amt, logo, `alias`, supplier_name, relationship,
dataSource, ratio, creditCodeFk, hospName
</sql>
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.tyapi.TySupplierEntity">
<!--@mbg.generated-->
<!--@Table ty_supplier-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="supplier_graphId" jdbcType="VARCHAR" property="supplier_graphId"/>
<result column="announcement_date" jdbcType="VARCHAR" property="announcement_date"/>
<result column="amt" jdbcType="VARCHAR" property="amt"/>
<result column="logo" jdbcType="VARCHAR" property="logo"/>
<result column="alias" jdbcType="VARCHAR" property="alias"/>
<result column="supplier_name" jdbcType="VARCHAR" property="supplier_name"/>
<result column="relationship" jdbcType="VARCHAR" property="relationship"/>
<result column="dataSource" jdbcType="VARCHAR" property="dataSource"/>
<result column="ratio" jdbcType="VARCHAR" property="ratio"/>
<result column="creditCodeFk" jdbcType="VARCHAR" property="creditCodeFk"/>
<result column="hospName" jdbcType="VARCHAR" property="hospName"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, supplier_graphId, announcement_date, amt, logo, `alias`, supplier_name, relationship,
dataSource, ratio, creditCodeFk, hospName
</sql>
<select id="filterList" parameterType="com.glxp.udidl.admin.req.tyapi.TyImportSupRequest"
resultType="com.glxp.udidl.admin.entity.tyapi.TySupplierEntity">
select ty_supplier.*
from ty_supplier
<where>
<if test="hospName != '' and hospName != null">
and hospName like concat('%', #{hospName}, '%')
</if>
<if test="creditCodeFk != '' and creditCodeFk != null">
and creditCodeFk like concat('%', #{creditCodeFk}, '%')
</if>
<if test="year != '' and year != null">
and year = #{year}
</if>
<if test="years != null and years.size() != 0">
AND year in
<foreach collection="years" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="hospNames != null and hospNames.size() != 0">
AND hospName in
<foreach collection="hospNames" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="hospCertCodes != null and hospCertCodes.size() != 0">
AND creditCodeFk in
<foreach collection="hospCertCodes" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

@ -1,9 +1,6 @@
# 字段新增 表名字段名字段类型修改方式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', 'year', 'varchar(60)', 1);

Loading…
Cancel
Save