选入药品阿里不能抛出异常

dev_unify
qiuyt 7 months ago
parent 94fff63ebb
commit b3b8376d9a

@ -227,7 +227,7 @@ public class UdiContrastService {
@Resource
ThirdAliDrugService thirdAliDrugService;
@Transactional
// @Transactional
public void createOnlyMainId(String mainId) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
filterThrProductsRequest.setCode(mainId);
@ -346,7 +346,7 @@ public class UdiContrastService {
if(thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)){
}else {
List<ThirdAliDrug> thirdAliDrugListNew;
List<ThirdAliDrug> thirdAliDrugListNew = null;
String customerId =customerService.getCustomerId();
CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(customerId);
@ -366,20 +366,22 @@ public class UdiContrastService {
if(baseResponse.getCode() == 20000){
thirdAliDrugListNew = baseResponse.getData();
thirdAliDrugService.addOrUpdate(thirdAliDrugListNew);
}else {
log.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
throw new JsonException(500, "阿里接口未查到产品信息");
// throw new JsonException(500, "阿里接口未查到产品信息");
}
// 上传到国家库
try {
Map mapNew = new HashMap();
mapNew.put("list",thirdAliDrugListNew);
String response = HttpUtil.post(udiUrl+"/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew));
BaseResponse baseResponseAdd = JSONUtil.toBean(response,BaseResponse.class);
log.info("成功上传国家库阿里产品数据");
} catch (Exception e) {
log.error("国家库上传阿里产品访问出现错误==="+e.getMessage());
if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){
try {
// 上传到国家库
Map mapNew = new HashMap();
mapNew.put("list",thirdAliDrugListNew);
String response = HttpUtil.post(udiUrl+"/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew));
BaseResponse baseResponseAdd = JSONUtil.toBean(response,BaseResponse.class);
log.info("成功上传国家库阿里产品数据");
} catch (Exception e) {
log.error("国家库上传阿里产品访问出现错误==="+e.getMessage());
}
}
}

Loading…
Cancel
Save