|
|
|
@ -106,8 +106,7 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
@Override
|
|
|
|
|
public UdiProductEntity findOneByOriginUuid(String originUuid) {
|
|
|
|
|
List<UdiProductEntity> udiProductEntities = findByOriginUuid(originUuid);
|
|
|
|
|
if (CollUtil.isNotEmpty(udiProductEntities))
|
|
|
|
|
return udiProductEntities.get(0);
|
|
|
|
|
if (CollUtil.isNotEmpty(udiProductEntities)) return udiProductEntities.get(0);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -135,16 +134,14 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateUdiInfo(UdiProductEntity udiProductEntity) {
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getNameCode()))
|
|
|
|
|
return false;
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getNameCode())) return false;
|
|
|
|
|
udiProductEntity.setUpdateTime(new Date());
|
|
|
|
|
return udiProductDao.updateUdiInfo(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean updateUdiInfoByUuid(UdiProductEntity udiProductEntity) {
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getUuid()))
|
|
|
|
|
return false;
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getUuid())) return false;
|
|
|
|
|
return udiProductDao.updateUdiInfoByUuid(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -171,8 +168,7 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateUdiInfoNotAll(UdiInfoRequest udiInfoRequest) {
|
|
|
|
|
if (StrUtil.isEmpty(udiInfoRequest.getUuid()))
|
|
|
|
|
return false;
|
|
|
|
|
if (StrUtil.isEmpty(udiInfoRequest.getUuid())) return false;
|
|
|
|
|
|
|
|
|
|
return udiProductDao.updateUdiInfoNotAll(udiInfoRequest);
|
|
|
|
|
}
|
|
|
|
@ -192,7 +188,8 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
udiRelevanceEntity = udiRelevanceDao.selectById(addProductRequest.getRelId());
|
|
|
|
|
List<UdiProductEntity> udiProductEntities = udiProductDao.findByUuids(udiRelevanceEntity.getUuid());
|
|
|
|
|
for (UdiProductEntity udiProductEntity : udiProductEntities) {
|
|
|
|
|
if (addProductRequest.getNameCode().equals(udiProductEntity.getNameCode())) {
|
|
|
|
|
if (StrUtil.isNotEmpty(addProductRequest.getNameCode()) && StrUtil.isNotEmpty(udiProductEntity.getNameCode())
|
|
|
|
|
&& udiProductEntity.getNameCode().equals(udiProductEntity.getNameCode())) {
|
|
|
|
|
udiProductEntity.setBhxjsl(addProductRequest.getBhxjsl());
|
|
|
|
|
}
|
|
|
|
|
addProductRequest.setNameCode(udiProductEntity.getNameCode());
|
|
|
|
@ -207,22 +204,14 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
if (IntUtil.value(udiProductEntity.getPackLevel()) == 1) {
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int i = udiProductDao.updateById(udiProductEntity);
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
throw new JsonException(500, "更新错误");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//修改关联表
|
|
|
|
|
// udiRelevanceEntity.setUseLeverCount(addProductRequest.getUseLeverCount());
|
|
|
|
|
udiRelevanceEntity.setSplitEnable(addProductRequest.getSplitEnable());
|
|
|
|
|
udiRelevanceEntity.setAutoCode(addProductRequest.getAutoCode());
|
|
|
|
|
// udiRelevanceEntity.setUseLevelDi(addProductRequest.getUseLevelDi());
|
|
|
|
|
// udiRelevanceEntity.setUseLevelUnit(addProductRequest.getUseLevelUnit());
|
|
|
|
|
udiRelevanceEntity.setUseLevel(addProductRequest.getUseLevel());
|
|
|
|
|
// udiRelevanceEntity.setDistributeLevelDi(addProductRequest.getDistributeLevelDi());
|
|
|
|
|
// udiRelevanceEntity.setDistributeLevelUnit(addProductRequest.getDistributeLevelUnit());
|
|
|
|
|
// udiRelevanceEntity.setDistributeLevelCount(addProductRequest.getDistributeLevelCount());
|
|
|
|
|
udiRelevanceEntity.setDistributeLevel(addProductRequest.getDistributeLevel());
|
|
|
|
|
udiRelevanceEntity.setPayFeeCode(addProductRequest.getPayFeeCode());
|
|
|
|
|
udiRelevanceEntity.setUseMaxLevel(addProductRequest.getUseMaxLevel());
|
|
|
|
@ -232,9 +221,6 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
udiRelevanceEntity.setManuReview(addProductRequest.getManuReview());
|
|
|
|
|
udiRelevanceEntity.setNotCodeType(addProductRequest.getNotCodeType());
|
|
|
|
|
udiRelevanceEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
udiRelevanceEntity.setDrugSellingPrice(addProductRequest.getDrugSellingPrice());
|
|
|
|
|
udiRelevanceEntity.setDrugSellingPriceTime(addProductRequest.getDrugSellingPriceTime());
|
|
|
|
|
udiRelevanceEntity.setHangingNetType(addProductRequest.getHangingNetType());
|
|
|
|
@ -300,7 +286,6 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
udiProductDao.insert(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
udiRelevanceDao.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
updateLevelCount(udiRelevanceEntity);
|
|
|
|
@ -339,9 +324,7 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
// 上传多玛融合表
|
|
|
|
|
|
|
|
|
|
List<CodeRel> codeRelArrayList = new ArrayList<>();
|
|
|
|
|
if (StringUtils.isNotEmpty(updateLevelDrugRequest.getPackUnit())
|
|
|
|
|
|| !Objects.isNull(updateLevelDrugRequest.getBhxjsl()) || StringUtils.isNotEmpty(updateLevelDrugRequest.getXjdw())
|
|
|
|
|
) {
|
|
|
|
|
if (StringUtils.isNotEmpty(updateLevelDrugRequest.getPackUnit()) || !Objects.isNull(updateLevelDrugRequest.getBhxjsl()) || StringUtils.isNotEmpty(updateLevelDrugRequest.getXjdw())) {
|
|
|
|
|
CodeRel codeRel = new CodeRel();
|
|
|
|
|
codeRel.setDrugCode(udiProductEntity1.getNameCode());
|
|
|
|
|
codeRel.setUpdateTime(new Date());
|
|
|
|
@ -386,8 +369,7 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
udiProductEntity.setPackLevel("1");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Map<String, List<UdiProductEntity>> groupedByLevel = udiInfoEntities.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(UdiProductEntity::getPackLevel));
|
|
|
|
|
Map<String, List<UdiProductEntity>> groupedByLevel = udiInfoEntities.stream().collect(Collectors.groupingBy(UdiProductEntity::getPackLevel));
|
|
|
|
|
groupedByLevel.forEach((level, entities) -> {
|
|
|
|
|
UdiProductEntity udiProductEntity = entities.get(0);
|
|
|
|
|
DiLevelResponse diLevelResponse = new DiLevelResponse();
|
|
|
|
@ -442,15 +424,11 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
return udiProductEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Optional<UdiProductEntity> nextEntityOptional = udiProductEntities.stream()
|
|
|
|
|
.filter(item -> item.getNameCode().equals(udiProductEntity.getBhxjcpbm()))
|
|
|
|
|
.findFirst();
|
|
|
|
|
Optional<UdiProductEntity> nextEntityOptional = udiProductEntities.stream().filter(item -> item.getNameCode().equals(udiProductEntity.getBhxjcpbm())).findFirst();
|
|
|
|
|
|
|
|
|
|
nextEntityOptional.ifPresent(entity -> xjCountWrapper.addCount(udiProductEntity.getBhxjsl()));
|
|
|
|
|
|
|
|
|
|
return nextEntityOptional
|
|
|
|
|
.map(entity -> findUltimateEntity(entity, udiProductEntities, xjCountWrapper))
|
|
|
|
|
.orElse(null);
|
|
|
|
|
return nextEntityOptional.map(entity -> findUltimateEntity(entity, udiProductEntities, xjCountWrapper)).orElse(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -533,16 +511,12 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
List<YbDrug> list = ybDrugService.getList(ybHcflDetailFilterRequest);
|
|
|
|
|
YbDrug ybDrug;
|
|
|
|
|
|
|
|
|
|
if (thrProductsEntity != null && !CollUtil.isEmpty(list)
|
|
|
|
|
&& !CollUtil.isEmpty(thirdAliDrugList)) {
|
|
|
|
|
if (thrProductsEntity != null && !CollUtil.isEmpty(list) && !CollUtil.isEmpty(thirdAliDrugList)) {
|
|
|
|
|
ybDrug = list.get(0);
|
|
|
|
|
// 多码融合表拼接参数
|
|
|
|
|
List<CodeRel> codeRelArrayList = new ArrayList<>();
|
|
|
|
|
// 选入就要把标识为空的数据先删除
|
|
|
|
|
udiProductDao.delete(new QueryWrapper<UdiProductEntity>()
|
|
|
|
|
.eq("uuid", thirdAliDrugRequest.getUuid())
|
|
|
|
|
.isNull("nameCode")
|
|
|
|
|
);
|
|
|
|
|
udiProductDao.delete(new QueryWrapper<UdiProductEntity>().eq("uuid", thirdAliDrugRequest.getUuid()).isNull("nameCode"));
|
|
|
|
|
try {
|
|
|
|
|
detailSort = Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -592,8 +566,7 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void addCount(int value) {
|
|
|
|
|
if (value == 0)
|
|
|
|
|
value = 1;
|
|
|
|
|
if (value == 0) value = 1;
|
|
|
|
|
this.count = this.count * value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|