parent
b3c8dfecf8
commit
5be468c250
@ -0,0 +1,76 @@
|
||||
package com.glxp.api.controller.alihealth;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.glxp.api.annotation.Log;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.constant.BusinessType;
|
||||
import com.glxp.api.entity.collect.RelCodeBatch;
|
||||
import com.glxp.api.req.alihealth.AlihealthKytGetentinfoReqeust;
|
||||
import com.glxp.api.req.alihealth.AlihealthRelCodeInsertReqeust;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.req.thrsys.AuthCompanyRequest;
|
||||
import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse;
|
||||
import com.glxp.api.util.alihealth.AlihealthUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.BindingResult;
|
||||
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.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class AlihealthBusController {
|
||||
@Resource
|
||||
private AlihealthUtils alihealthUtils;
|
||||
@Value("${ALIHEALTH_URL:http://gw.api.taobao.com/router/rest}")
|
||||
private String alihealthUrl;
|
||||
@PostMapping("/spms/alihealth/relCodeInsert")
|
||||
@Log(title = "阿里健康自动赋码关联关系", businessType = BusinessType.OTHER)
|
||||
public BaseResponse relCodeInsert(@RequestBody AlihealthRelCodeInsertReqeust alihealthRelCodeInsertReqeust) {
|
||||
if(StringUtils.isEmpty(alihealthRelCodeInsertReqeust.getRefEntId())){
|
||||
AlihealthKytGetentinfoResponse alihealthKytGetentinfoResponse = null;
|
||||
try {
|
||||
AlihealthKytGetentinfoReqeust alihealthKytGetentinfoReqeust = new AlihealthKytGetentinfoReqeust();
|
||||
alihealthKytGetentinfoReqeust.setApp_key(alihealthRelCodeInsertReqeust.getAppKey());
|
||||
alihealthKytGetentinfoReqeust.setEnt_name(alihealthRelCodeInsertReqeust.getName());
|
||||
alihealthRelCodeInsertReqeust.getAppSecret();
|
||||
Map map = alihealthUtils.disposeSign(alihealthKytGetentinfoReqeust, alihealthRelCodeInsertReqeust.getAppSecret());
|
||||
String json = HttpUtil.get(alihealthUrl, map);
|
||||
alihealthKytGetentinfoResponse = new AlihealthKytGetentinfoResponse(json);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultVOUtils.error("阿里健康接口调用失败===请检查key和密文");
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(alihealthKytGetentinfoResponse.getMsg_info())
|
||||
&& alihealthKytGetentinfoResponse.getMsg_info().equals("调用成功")
|
||||
) {
|
||||
alihealthRelCodeInsertReqeust.setRefEntId(alihealthKytGetentinfoResponse.getRef_ent_id());
|
||||
} else {
|
||||
return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytGetentinfoResponse.getMsg_info());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BaseResponse baseResponse = alihealthUtils.relCodeInsert(alihealthRelCodeInsertReqeust);
|
||||
|
||||
if(baseResponse.getCode() == 20000){
|
||||
// 插入成功返回
|
||||
return baseResponse;
|
||||
}else {
|
||||
log.error("调用阿里码获取关联关系接口==="+baseResponse.getMessage());
|
||||
return ResultVOUtils.error("调用阿里码获取关联关系接口==="+baseResponse.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.req.alihealth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlihealthRelCodeInsertReqeust {
|
||||
/**
|
||||
* 往来单位名称
|
||||
*/
|
||||
private String name;
|
||||
private String appKey;
|
||||
private String appSecret;
|
||||
|
||||
private String customerId;
|
||||
private String code;
|
||||
private String refEntId;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuthCompanyRequest {
|
||||
/**
|
||||
* 往来单位名称
|
||||
*/
|
||||
private String name;
|
||||
private String appId;
|
||||
private String appSecret;
|
||||
|
||||
private String refEntId;
|
||||
private String code;
|
||||
|
||||
}
|
Loading…
Reference in New Issue