最小数量修改

dev_unify
yewj 4 months ago
parent 2409d88b58
commit f1a16d24b7

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

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

@ -2,6 +2,8 @@ package com.glxp.api.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @author AnthonyYwj * @author AnthonyYwj
@ -34,4 +36,16 @@ public class DimaUtil {
return reversed; 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