代码备份

dev_unify
yewj 4 months ago
parent 16c86f330a
commit baa11d9504

@ -53,6 +53,7 @@ public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParameter
jsonObjectResult = jsonObject.getJSONObject(s).getJSONObject("result");
}
AlihealthKytCommonParametersResponse alihealthKytCommonParametersResponse = JSONUtil.toBean(jsonObjectResult.toString(),
AlihealthKytCommonParametersResponse.class);
BeanUtils.copyProperties(alihealthKytCommonParametersResponse, this);

@ -22,6 +22,8 @@ import com.glxp.api.service.collect.RelCodeBatchService;
import com.glxp.api.service.collect.RelCodeDetailService;
import com.taobao.api.Constants;
import com.taobao.api.internal.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -39,6 +41,7 @@ import java.util.*;
import static com.taobao.api.internal.util.TaobaoUtils.byte2hex;
@Slf4j
@Component
public class AlihealthUtils {
@Resource
@ -102,6 +105,7 @@ public class AlihealthUtils {
}
}
public BaseResponse<List<ThirdAliDrug>> thirdAliDrugInsertAll(AlihealthThirdAliDrugInsertReqeust request) {
// 初始化变量
List<ThirdAliDrug> resultList = new ArrayList<>();
@ -116,14 +120,20 @@ public class AlihealthUtils {
if (containsBrackets(originalName)) {
String convertedName = convertBrackets(originalName);
drugRequest.setPhysic_name(convertedName);
tryInsertAndCollect(request, resultList);
AlihealthThirdAliDrugInsertReqeust tempRequest = new AlihealthThirdAliDrugInsertReqeust();
BeanUtils.copyProperties(request, tempRequest);
tempRequest.getAlihealthKytDrugrescodeReqeust().setPhysic_name(convertedName);
tryInsertAndCollect(tempRequest, resultList);
}
// 处理罗马数字转换
if (containsRomanNumerals(originalName)) {
String convertedName = convertRomanNumerals(originalName);
drugRequest.setPhysic_name(convertedName);
tryInsertAndCollect(request, resultList);
AlihealthThirdAliDrugInsertReqeust tempRequest = new AlihealthThirdAliDrugInsertReqeust();
BeanUtils.copyProperties(request, tempRequest);
tempRequest.getAlihealthKytDrugrescodeReqeust().setPhysic_name(convertedName);
tryInsertAndCollect(tempRequest, resultList);
}
// 设置结果
@ -167,12 +177,15 @@ public class AlihealthUtils {
private BaseResponse<List<ThirdAliDrug>> tryInsertAndCollect(
AlihealthThirdAliDrugInsertReqeust request,
List<ThirdAliDrug> resultList) {
BaseResponse<List<ThirdAliDrug>> response = thirdAliDrugInsert(request);
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
BeanUtil.copyProperties(request, alihealthThirdAliDrugInsertReqeust);
BaseResponse<List<ThirdAliDrug>> response = thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust);
if (response.getCode() == 20000 && response.getData() != null) {
resultList.addAll(response.getData());
}
return response;
}
/**
*
*
@ -193,6 +206,7 @@ public class AlihealthUtils {
Map map = alihealthUtils.disposeSign(alihealthKytDrugrescodeReqeust, alihealthThirdAliDrugInsertReqeust.getAppSecret());
String json = HttpUtil.get(alihealthUrl, map);
log.error("阿里健康接口调用成功===" + json);
alihealthKytDrugrescodeResponse = new AlihealthKytDrugrescodeResponse(json);
} catch (Exception e) {
@ -206,7 +220,7 @@ public class AlihealthUtils {
String physicName = alihealthKytDrugrescodeReqeust.getPhysic_name();
if (alihealthKytDrugrescodeResponse.judgeCall() ) {
if (alihealthKytDrugrescodeResponse.judgeCall()) {
List<ThirdAliDrug> listNew = alihealthKytDrugrescodeResponse.disposeThirdAliDrugList(alihealthThirdAliDrugInsertReqeust.getErpId());
return ResultVOUtils.success(listNew);
} else {
@ -280,12 +294,12 @@ public class AlihealthUtils {
String sign;
try {
sign = new AlihealthUtils().signTopRequest(map, secret, "md5");
log.info("sign====" + sign);
alihealthKytCommonParametersReqeust.setSign(sign);
return BeanUtil.beanToMap(alihealthKytCommonParametersReqeust);
} catch (IOException e) {
e.printStackTrace();
}
return null;
return BeanUtil.beanToMap(alihealthKytCommonParametersReqeust);
}
@ -357,5 +371,4 @@ public class AlihealthUtils {
}
}

Loading…
Cancel
Save