feat: 定向更新阿里健康药品

v3
chenhc 3 months ago
parent 0179e57d73
commit aac33c4e28

@ -147,8 +147,19 @@ public class ThirdAliDrugController {
return ResultVOUtils.success(thirdAliDrugList);
}
@GetMapping("/udiwms/aliDrug/111")
public BaseResponse teest111() {
@GetMapping("/udiwms/aliDrug/updateByCpmctymc")
public BaseResponse updateByCpmctymc(ThirdAliDrugRequest thirdAliDrug, BindingResult bindingResult){
String cpmctymc = thirdAliDrug.getCpmctymc();
if (StrUtil.isEmpty(cpmctymc)) {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT,"标识参数不能为空");
}
List<ThirdAliDrug> add = thirdAliDrugService.updateByCpmctymc(cpmctymc);
return ResultVOUtils.success(add);
}
@GetMapping("/udiwms/aliDrug/updateAll")
public BaseResponse updateAll() {
thirdAliDrugService.updateThirdAliDrugTask();
return ResultVOUtils.success();
}

@ -187,4 +187,47 @@ public class ThirdAliDrugService extends ServiceImpl<ThirdAliDrugMapper, ThirdAl
}
}
}
public List<ThirdAliDrug> updateByCpmctymc(String cpmctymc) {
ThirdAliDrugAddRequest thirdAliDrugAddRequest = new ThirdAliDrugAddRequest();
// TODO: 2025/1/4 这里用调用的 入参 cpmctymc
List<ThirdAliDrug> add = null;
AlihealthThirdAliDrugInsertReqeust request = new AlihealthThirdAliDrugInsertReqeust();
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(cpmctymc);
request.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
// key组装
AuthAliUser authAliUser = authAliUserService.getOne();
//增加次数限制
Integer drugResCodeCount = authAliUser.getDrugResCodeCount();
Integer drugResCodeCountMax = authAliUser.getDrugResCodeCountMax();
if (drugResCodeCount >= drugResCodeCountMax){
throw new JsonException("当前系统调用阿里药品数据查询接口最大次数已达到,禁止访问,如需访问请联系管理员增加访问次数!");
}
drugResCodeCount = drugResCodeCount + 1;
authAliUser.setDrugResCodeCount(drugResCodeCount);
authAliUserService.updateById(authAliUser);
try {
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsertAll(request);
if(baseResponse.getCode() == 20000){
add = baseResponse.getData();
}else {
log.error("阿里访问失败==="+baseResponse.getMessage());
throw new JsonException(baseResponse.getMessage());
}
}catch (Exception e){
log.error("阿里访问失败==="+e.getMessage());
throw new JsonException("阿里访问失败");
}
if (CollUtil.isNotEmpty(add)){
thirdAliDrugAddRequest.setList(add);
this.addThirdAliDrug(thirdAliDrugAddRequest);
}
return add;
}
}

Loading…
Cancel
Save