diff --git a/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java b/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java index f2f7b0c1..432388d7 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java @@ -293,7 +293,7 @@ public class UdiRlSupController extends BaseController { udiProductEntity.setUpdateTime(new Date()); UdiRelevanceEntity udiRelevanceEntity1 = udiRelevanceService.selectById(Long.valueOf(rlidStr)); UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity1.getUuid()); - if (byUuid != null){ + if (byUuid != null) { byUuid.setCatalogname1(udiProductEntity.getCatalogname1()); byUuid.setCatalogname2(udiProductEntity.getCatalogname2()); byUuid.setCatalogname3(udiProductEntity.getCatalogname3()); @@ -301,7 +301,7 @@ public class UdiRlSupController extends BaseController { byUuid.setManufactory(udiProductEntity.getManufactory()); byUuid.setUpdateTime(new Date()); udiProductService.updateUdiInfo(byUuid); - }else { + } else { udiProductEntity.setId(IdUtil.getSnowflakeNextId()); udiProductService.insertUdiInfo(udiProductEntity); } @@ -309,9 +309,9 @@ public class UdiRlSupController extends BaseController { try { CodeRel codeRel = new CodeRel(); - if(udiProductEntity.getProductsType() == null || udiProductEntity.getProductsType() == 1){ + if (udiProductEntity.getProductsType() == null || udiProductEntity.getProductsType() == 1) { codeRel.setDiNameCode(udiProductEntity.getNameCode()); - }else { + } else { codeRel.setDrugCode(udiProductEntity.getNameCode()); } codeRel.setYbbm(udiProductEntity.getYbbm()); @@ -319,8 +319,8 @@ public class UdiRlSupController extends BaseController { codeRel.setTyshxyh(udiProductEntity.getTyshxydm()); codeRel.setUpdateTime(new Date()); erpBasicClient.updateCodeRelDetail(codeRel); - }catch (Exception e){ - System.out.println("上传多码融合:"+e); + } catch (Exception e) { + System.out.println("上传多码融合:" + e); } return ResultVOUtils.success("选入成功!"); @@ -365,10 +365,28 @@ public class UdiRlSupController extends BaseController { BeanUtil.copyProperties(udiInfoExportRequest.getSupplementRequest(), udiProductEntity); //处理是否需要扫码字段 classifyCodeService.updateRequireScanCode(udiProductEntity); - udiProductEntity.setId(IdUtil.getSnowflakeNextId()); - udiProductService.insertUdiInfo(udiProductEntity); + + udiProductEntity.setUpdateTime(new Date()); + UdiRelevanceEntity udiRelevanceEntity1 = udiRelevanceService.selectById(Long.valueOf(rlidStr)); + UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity1.getUuid()); + if (byUuid != null) { + byUuid.setCatalogname1(udiProductEntity.getCatalogname1()); + byUuid.setCatalogname2(udiProductEntity.getCatalogname2()); + byUuid.setCatalogname3(udiProductEntity.getCatalogname3()); + byUuid.setDetailSort(udiProductEntity.getDetailSort()); + byUuid.setYbbm(udiProductEntity.getYbbm()); + byUuid.setManufactory(udiProductEntity.getManufactory()); + byUuid.setUpdateTime(new Date()); + udiProductService.updateUdiInfo(byUuid); + } else { + udiProductEntity.setId(IdUtil.getSnowflakeNextId()); + udiProductService.insertUdiInfo(udiProductEntity); + } + + return ResultVOUtils.success("选入成功!"); } + @AuthRuleAnnotation("") @PostMapping("/sale/info/updateCompanyProductRelevance") @Log(title = "单据管理", businessType = BusinessType.UPDATE) diff --git a/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java b/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java index 9006bf42..64c34ba2 100644 --- a/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java +++ b/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java @@ -143,4 +143,26 @@ public class ThirdAliDrug implements Serializable { this.updateTime = updateTime; this.approvalNum = approvalNum; } + + + @Override + public String toString() { + return "ThirdAliDrug{" + + "id=" + id + + ", type='" + type + '\'' + + ", manufacturer='" + manufacturer + '\'' + + ", cpmctymc='" + cpmctymc + '\'' + + ", form='" + form + '\'' + + ", formSpec='" + formSpec + '\'' + + ", bzgg='" + bzgg + '\'' + + ", spmc='" + spmc + '\'' + + ", nameCode='" + nameCode + '\'' + + ", packRatio='" + packRatio + '\'' + + ", packLevel='" + packLevel + '\'' + + ", erpId='" + erpId + '\'' + + ", approvalNum='" + approvalNum + '\'' + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + '}'; + } } diff --git a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java index a2edf545..8fbe1219 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -23,10 +23,12 @@ import com.glxp.api.service.thrsys.ThrProductsService; import com.glxp.api.service.thrsys.YbDrugService; import com.glxp.api.util.*; import com.glxp.api.util.udi.UdiInfoUtil; +import org.jfree.util.Log; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -277,9 +279,18 @@ public class UdiContrastService { if (CollUtil.isNotEmpty(thirdAliDrugList)) { for (int i = 0; i < thirdAliDrugList.size(); i++) { ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); - List integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio()); + List integers = new ArrayList<>(); + if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) { + integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio()); + } udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel()); - udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1)); + try { + udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1)); + } catch (IndexOutOfBoundsException e) { + e.printStackTrace(); + Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString()); + } + udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { udiProductEntity.setXjdw(ybDrug.getMinUnit()); diff --git a/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java index 480ece2e..9057a925 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/UdiRelevanceServiceImpl.java @@ -418,12 +418,12 @@ public class UdiRelevanceServiceImpl extends ServiceImpl basicPrductRemak8=#{basicPrductRemak8}, - sfwblztlcp=#{sfwblztlcp}, @@ -591,6 +590,18 @@ packMatrial=#{packMatrial}, + + catalogname3=#{catalogname3}, + + + catalogname1=#{catalogname1}, + + + catalogname2=#{catalogname2}, + + + detailSort=#{detailSort}, + WHERE nameCode = #{nameCode} and uuid = #{uuid} diff --git a/src/main/resources/mybatis/mapper/basic/UdiRlSupDao.xml b/src/main/resources/mybatis/mapper/basic/UdiRlSupDao.xml index 549ef5fd..e833124e 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiRlSupDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiRlSupDao.xml @@ -270,6 +270,7 @@ + GROUP BY basic_udirel.id ORDER BY company_product_relevance.updateTime DESC