最小数量修改

dev_unify
yewj 4 months ago
parent 2409d88b58
commit f1a16d24b7

@ -227,7 +227,8 @@ public class UdiContrastService {
@Resource
ThirdAliDrugService thirdAliDrugService;
// @Transactional
// @Transactional
public void createOnlyMainId(String mainId) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
filterThrProductsRequest.setCode(mainId);
@ -262,12 +263,12 @@ public class UdiContrastService {
if (list != null && list.size() > 0) {
YbDrug ybDrug = list.get(0);
// 数据做处理好查询阿里接口
ybDrug.setRegisteredProductName(ybDrug.getRegisteredProductName().replace("(","").replace(")",""));
if(ybDrug.getApprovalCode().contains("(")){
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
ybDrug.setRegisteredProductName(ybDrug.getRegisteredProductName().replace("(", "").replace(")", ""));
if (ybDrug.getApprovalCode().contains("(")) {
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
ybDrug.setRegisteredProductName(charArr[0]);
}
ybDrug.setApprovalCode(ybDrug.getApprovalCode().replace("(","").replace(")",""));
ybDrug.setApprovalCode(ybDrug.getApprovalCode().replace("(", "").replace(")", ""));
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
@ -308,44 +309,44 @@ public class UdiContrastService {
udiProductEntity.setUpdateTime(new Date());
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>()
.eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()),"cpmctymc",ybDrug.getRegisteredProductName())
.eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()),"approvalNum",ybDrug.getApprovalCode())
.eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()), "cpmctymc", ybDrug.getRegisteredProductName())
.eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()), "approvalNum", ybDrug.getApprovalCode())
);
if (CollUtil.isNotEmpty(thirdAliDrugList)) {
} else {
Map map = new HashMap();
if(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName())){
map.put("cpmctymc",ybDrug.getRegisteredProductName());
if (StringUtils.isNotEmpty(ybDrug.getRegisteredProductName())) {
map.put("cpmctymc", ybDrug.getRegisteredProductName());
}
if(StringUtils.isNotEmpty(ybDrug.getApprovalCode())){
map.put("approvalNum",ybDrug.getApprovalCode());
if (StringUtils.isNotEmpty(ybDrug.getApprovalCode())) {
map.put("approvalNum", ybDrug.getApprovalCode());
}
List<ThirdAliDrug> thirdAliDrugsListGjk = null;
try {
String response = HttpUtil.get(udiUrl+"/udiwms/aliDrug/getDrugLevelList",map);
String response = HttpUtil.get(udiUrl + "/udiwms/aliDrug/getDrugLevelList", map);
BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() {
});
if (udiDlDeviceResponse != null) {
// 查询国家库是否有值 有值直接返回没值查询阿里接口
thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList();
thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList();
}
} catch (Exception e) {
log.error("国家库查询阿里产品访问出现错误==="+e.getMessage());
log.error("国家库查询阿里产品访问出现错误===" + e.getMessage());
}
if(thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)){
if (thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)) {
}else {
} else {
List<ThirdAliDrug> thirdAliDrugListNew = null;
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
@ -359,26 +360,26 @@ public class UdiContrastService {
alihealthKytDrugrescodeReqeust.setApp_key("31721223");
alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0");
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust);
if(baseResponse.getCode() == 20000){
thirdAliDrugListNew = baseResponse.getData();
thirdAliDrugService.addOrUpdate(thirdAliDrugListNew);
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust);
if (baseResponse.getCode() == 20000) {
thirdAliDrugListNew = baseResponse.getData();
thirdAliDrugService.addOrUpdate(thirdAliDrugListNew);
}else {
} else {
udiProductService.insertUdiInfo(udiProductEntity);
log.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
log.error("阿里接口未查到产品信息===" + baseResponse.getMessage());
// throw new JsonException(500, "阿里接口未查到产品信息");
}
if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){
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);
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());
log.error("国家库上传阿里产品访问出现错误===" + e.getMessage());
}
}
@ -388,8 +389,8 @@ public class UdiContrastService {
}
thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>()
.eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()),"cpmctymc",ybDrug.getRegisteredProductName())
.eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()),"approvalNum",ybDrug.getApprovalCode())
.eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()), "cpmctymc", ybDrug.getRegisteredProductName())
.eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()), "approvalNum", ybDrug.getApprovalCode())
);
for (int i = 0; i < thirdAliDrugList.size(); i++) {
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
@ -403,16 +404,20 @@ public class UdiContrastService {
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString());
udiProductEntity.setBhxjsl(0);
}
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
udiProductEntity.setXjdw(ybDrug.getMinUnit());
udiProductEntity.setBhxjsl(ybDrug.getFactor());
if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) {
udiProductEntity.setBhxjsl(DimaUtil.trMinCount(thirdAliDrug.getBzgg()));
} else
udiProductEntity.setBhxjsl(ybDrug.getFactor());
}
if (thirdAliDrug.getPackLevel() != null || !thirdAliDrug.getPackLevel() .equals("0") ){
if (thirdAliDrug.getPackLevel() != null || !thirdAliDrug.getPackLevel().equals("0")) {
udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4);
}else {
} else {
udiProductEntity.setDiType(1);
}
udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName());

@ -1483,7 +1483,7 @@ public class SpsSyncDownloadService {
boolean result = redisUtil.setIfAbsent(redisKey, 1, 10);
if (!result) {
String errorMsg = String.format("syncIdcSps----process------------同步回滚[%s]重复进入", entry.getKey().getRemark());
logger.error(errorMsg);
// logger.error(errorMsg);
}
if ((boolean) entry.getValue().get("isNew")) {
basicExportTimeService.deleteById(entry.getValue().get("id").toString());

@ -2,6 +2,8 @@ package com.glxp.api.util;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author AnthonyYwj
@ -34,4 +36,16 @@ public class DimaUtil {
return reversed;
}
public static Integer trMinCount(String bzgg) {
// 定义正则表达式模式,用于匹配数字
Pattern pattern = Pattern.compile("\\d+");
Matcher matcher = pattern.matcher(bzgg);
if (matcher.find()) {
return Integer.parseInt(matcher.group());
}
return null;
}
}

Loading…
Cancel
Save