|
|
|
@ -615,108 +615,106 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
private ThirdAliDrugService thirdAliDrugService;
|
|
|
|
|
@Override
|
|
|
|
|
public void saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest) {
|
|
|
|
|
// 查询现在如果有码为空的就进行替代掉
|
|
|
|
|
List<UdiProductEntity> list = udiProductDao.selectList(
|
|
|
|
|
new QueryWrapper<UdiProductEntity>().eq("uuid", thirdAliDrugRequest.getUuid())
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm());
|
|
|
|
|
ThirdAliDrug thirdAliDrug = thirdAliDrugService.getOne(
|
|
|
|
|
ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>().eq("nameCode",thirdAliDrugRequest.getNameCode()).last("limit 1")
|
|
|
|
|
);
|
|
|
|
|
if(thirdAliDrugServiceOne != null){
|
|
|
|
|
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>().eq("bzgg",thirdAliDrugServiceOne.getBzgg()).eq("packRatio",thirdAliDrugServiceOne.getPackRatio())
|
|
|
|
|
);
|
|
|
|
|
if(thirdAliDrugList != null && thirdAliDrugList.size() >0){
|
|
|
|
|
for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) {
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
YbDrug ybDrug = new YbDrug();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
YbDrug ybDrug = new YbDrug();
|
|
|
|
|
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setUuid(thirdAliDrugRequest.getUuid());
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
|
//设置包装级别
|
|
|
|
|
udiProductEntity.setPackLevel(1 + "");
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
udiProductEntity.setPrice("0.00");
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setUpdateTime(new Date());
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
udiProductEntity.setUuid(thirdAliDrugRequest.getUuid());
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
|
//设置包装级别
|
|
|
|
|
udiProductEntity.setPackLevel(1 + "");
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
udiProductEntity.setPrice("0.00");
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setUpdateTime(new Date());
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
// for (int i = 0; i < thirdAliDrugList.size(); i++) {
|
|
|
|
|
// ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
|
|
|
|
|
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
|
|
|
|
|
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
|
|
|
|
|
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
|
|
|
|
|
udiProductEntity.setSpmc(thirdAliDrug.getSpmc());
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
|
|
|
|
|
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
|
|
|
|
|
udiProductEntity.setSpmc(thirdAliDrug.getSpmc());
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setBzgg(thirdAliDrug.getBzgg());
|
|
|
|
|
udiProductEntity.setBzgg(thirdAliDrug.getBzgg());
|
|
|
|
|
// udiProductEntity.setMatrial(ybDrug.getMaterialName());
|
|
|
|
|
// udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
|
|
|
|
|
// udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
// udiProductEntity.setBhxjsl(ybDrug.getFactor());
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
|
|
|
|
|
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
|
|
|
|
|
|
|
|
|
|
List<Integer> integers = new ArrayList<>();
|
|
|
|
|
if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) {
|
|
|
|
|
integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio());
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel());
|
|
|
|
|
try {
|
|
|
|
|
udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1));
|
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString());
|
|
|
|
|
udiProductEntity.setBhxjsl(0);
|
|
|
|
|
}
|
|
|
|
|
List<Integer> integers = new ArrayList<>();
|
|
|
|
|
if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) {
|
|
|
|
|
integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio());
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel());
|
|
|
|
|
try {
|
|
|
|
|
udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1));
|
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString());
|
|
|
|
|
udiProductEntity.setBhxjsl(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
|
|
|
|
|
udiProductEntity.setXjdw(ybDrug.getMinUnit());
|
|
|
|
|
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")) {
|
|
|
|
|
udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4);
|
|
|
|
|
} else {
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName());
|
|
|
|
|
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
|
|
|
|
|
if (list != null && list.size() == 1) {
|
|
|
|
|
if (StringUtils.isEmpty(udiProductEntity.getNameCode())) {
|
|
|
|
|
udiProductEntity.setId(list.get(0).getId());
|
|
|
|
|
udiProductDao.updateById(udiProductEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
|
|
|
|
|
udiProductEntity.setXjdw(ybDrug.getMinUnit());
|
|
|
|
|
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")) {
|
|
|
|
|
udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4);
|
|
|
|
|
} else {
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName());
|
|
|
|
|
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
|
|
|
|
|
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|