Commit 84df6ac0 authored by zhangzc's avatar zhangzc

添加企查查接口

parent c53db0e6
......@@ -153,6 +153,15 @@
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>esv-repository</id>
<url>http://192.168.31.249:18084/repository/maven-public/</url>
<!-- 外网环境使用 -->
<!-- <url>http://esvsy.wicp.vip:18084/repository/maven-public/</url>-->
</repository>
</repositories>
<profiles>
<profile>
<id>develop</id>
......
package com.esv.freight.customer.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.feign.FreightThirdpartyService
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/04 9:48
* @version:1.0
*/
@FeignClient(value = "freight-thirdparty-service")
public interface FreightThirdpartyService {
/**
* description 企查查数据查询
* param [bodyJson]
* return com.alibaba.fastjson.JSONObject
* author zhangzhichen
* createTime 2020/08/14 9:31
**/
@PostMapping(value = "/thirdparty/qcc/audit")
JSONObject audit(JSONObject bodyJson);
}
......@@ -20,6 +20,7 @@ import com.esv.freight.customer.module.goodsowner.form.AccountForm;
import com.esv.freight.customer.module.goodsowner.form.AccountInfoForm;
import com.esv.freight.customer.module.goodsowner.form.AccountQueryForm;
import com.esv.freight.customer.module.goodsowner.form.AccountScoreForm;
import com.esv.freight.customer.module.goodsowner.pojo.QccPojo;
import com.esv.freight.customer.module.goodsowner.service.GoodsOwnerAccountService;
import com.esv.freight.customer.module.goodsowner.service.GoodsOwnerInfoService;
import com.esv.freight.customer.module.goodsowner.validator.groups.*;
......@@ -304,4 +305,17 @@ public class GoodsOwnerController {
goodsOwnerInfoService.updateOverallScore(form);
return EResponse.ok();
}
/**
* description 企查查查询
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author zhangzhichen
* createTime 2020/08/12 16:38
**/
@PostMapping("/audit/qcc")
public EResponse auditQcc(@RequestBody @Validated(ValidatorAuditQcc.class) AccountForm form) throws EException {
QccPojo qccPojo = goodsOwnerAccountService.auditQcc(form);
return EResponse.ok(qccPojo);
}
}
......@@ -23,7 +23,7 @@ import javax.validation.constraints.NotNull;
@Data
public class AccountForm {
@NotNull(message = "参数id不能为空", groups = {ValidatorBlock.class, ValidatorUnblock.class, ValidatorAudit.class, ValidatorAuditHistory.class, ValidatorPasswordReset.class})
@NotNull(message = "参数id不能为空", groups = {ValidatorAuditQcc.class, ValidatorBlock.class, ValidatorUnblock.class, ValidatorAudit.class, ValidatorAuditHistory.class, ValidatorPasswordReset.class})
private Long id;
@NotNull(message = "参数auditStatus不能为空", groups = {ValidatorAudit.class})
......
package com.esv.freight.customer.module.goodsowner.pojo;
import lombok.Data;
/**
* @description:
* @project: spring-cloud-single-template
* @name: com.esv.freight.customer.module.goodsowner.pojo.QccPojo
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/8/14 14:27
* @version:1.0
*/
@Data
public class QccPojo {
/**
* 内部KeyNo
*/
private String KeyNo;
/**
* 公司名称
*/
private String Name;
/**
* 法人名称
*/
private String OperName;
/**
* 成立日期
*/
private String StartDate;
/**
* 企业状态
*/
private String Status;
/**
* 注册号
*/
private String No;
/**
* 社会统一信用代码
*/
private String CreditCode;
}
......@@ -8,6 +8,7 @@ import com.esv.freight.customer.module.goodsowner.entity.AuditHistoryEntity;
import com.esv.freight.customer.module.goodsowner.form.AccountForm;
import com.esv.freight.customer.module.goodsowner.form.AccountInfoForm;
import com.esv.freight.customer.module.goodsowner.form.AccountQueryForm;
import com.esv.freight.customer.module.goodsowner.pojo.QccPojo;
import com.esv.freight.customer.module.goodsowner.vo.AccountAvailableVO;
import java.util.List;
......@@ -138,5 +139,13 @@ public interface GoodsOwnerAccountService extends IService<GoodsOwnerAccountEnti
**/
Integer resetAccountPwd(AccountForm form);
/**
* description 企业查询
* param [form]
* return QccPojo
* author Administrator
* createTime 2020/08/12 17:27
**/
QccPojo auditQcc(AccountForm form);
}
......@@ -11,10 +11,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.esv.freight.customer.common.component.ErrorMessageComponent;
import com.esv.freight.customer.common.component.PasswordComponent;
import com.esv.freight.customer.common.exception.EException;
import com.esv.freight.customer.common.response.ECode;
import com.esv.freight.customer.common.response.EResponse;
import com.esv.freight.customer.common.util.FeignUtils;
import com.esv.freight.customer.common.util.ReqUtils;
import com.esv.freight.customer.common.vo.PageResultVO;
import com.esv.freight.customer.feign.FeignBaseService;
import com.esv.freight.customer.feign.FreightThirdpartyService;
import com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity;
import com.esv.freight.customer.module.carrier.service.CarrierAccountService;
import com.esv.freight.customer.module.driver.entity.DriverAccountEntity;
......@@ -28,6 +31,7 @@ import com.esv.freight.customer.module.goodsowner.entity.InfoEntity;
import com.esv.freight.customer.module.goodsowner.form.AccountForm;
import com.esv.freight.customer.module.goodsowner.form.AccountInfoForm;
import com.esv.freight.customer.module.goodsowner.form.AccountQueryForm;
import com.esv.freight.customer.module.goodsowner.pojo.QccPojo;
import com.esv.freight.customer.module.goodsowner.service.GoodsOwnerAccountService;
import com.esv.freight.customer.module.goodsowner.service.AuditHistoryService;
import com.esv.freight.customer.module.goodsowner.service.GoodsOwnerInfoService;
......@@ -62,6 +66,9 @@ public class GoodsOwnerAccountServiceImpl extends ServiceImpl<AccountDao, GoodsO
@Autowired
private CarrierAccountService carrierAccountService;
@Autowired
private FreightThirdpartyService freightThirdpartyService;
@Autowired
public GoodsOwnerAccountServiceImpl(FeignBaseService feignBaseService, PasswordComponent passwordComponent,
ErrorMessageComponent errorMessageComponent, GoodsOwnerInfoService goodsOwnerInfoService,
......@@ -402,4 +409,35 @@ public class GoodsOwnerAccountServiceImpl extends ServiceImpl<AccountDao, GoodsO
return this.baseMapper.updateById(goodsOwnerAccountEntity);
}
@Override
public QccPojo auditQcc(AccountForm form) {
// 1.判断帐号是否存在
Long accountId = form.getId();
GoodsOwnerAccountEntity goodsOwnerAccountEntity = this.getAccountRecordById(accountId);
if (null == goodsOwnerAccountEntity) {
throw new EException(1001, errorMessageComponent.getGoodsOwnerAccountAudit1001());
} else {
if (GoodsOwnerConstants.OWNER_AUDIT_STATUS_SUCCESS.equals(goodsOwnerAccountEntity.getAuditStatus())) {
throw new EException(1002, errorMessageComponent.getGoodsOwnerAccountAudit1002());
}
}
// 2.获取企业详情
AccountInfoDto dto = this.baseMapper.getAccountInfoById(form.getId());
// 3.调用feign接口请求企查查数据查询
JSONObject feignReqJson = new JSONObject();
feignReqJson.put("keyword", dto.getUniCreditCode());
log.info("Feign请求[企查查]传参:{}", feignReqJson.toJSONString());
JSONObject feignResJson = freightThirdpartyService.audit(feignReqJson);
log.info("Feign请求[企查查]返回:{}", feignResJson.toJSONString());
if (ECode.SUCCESS.code() != feignResJson.getIntValue("code")) {
throw new EException(feignResJson.getIntValue("code"), feignResJson.getString("message"));
}
QccPojo qccPojo = JSONObject.toJavaObject(FeignUtils.getFeignResultData(feignResJson), QccPojo.class);
return qccPojo;
}
}
\ No newline at end of file
package com.esv.freight.customer.module.goodsowner.validator.groups;
import javax.validation.groups.Default;
/**
* @description: 参数校验分组:企业查询
* @project: SpringCloudTemplate
* @name: com.esv.freight.customer.module.goodsowner.validator.groups.ValidatorAudit
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/08/12 16:53
* @version:1.0
*/
public interface ValidatorAuditQcc extends Default {
}
......@@ -3,14 +3,14 @@ server:
servlet:
context-path: /customer
nacos:
url: 119.3.171.225:8848
namespace: 38512237-cfe2-44e5-a6ba-df156723d7b6
group: TEST_GROUP
url: 192.168.31.248:8848
namespace: aad5aa26-5351-4e7a-a65e-ecb332f3c52c
group: DEFAULT_GROUP
spring:
application:
name: freight-customer-service
profiles:
active: test
active: dev
cloud:
nacos:
discovery:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment