wangyu преди 6 години
родител
ревизия
9061b53d4a
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

+ 3 - 2
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -89,7 +89,8 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
      * @return Boolean true
      */
     public Boolean updateProduct(UpdateProductVO updateProductVO) {
-        if(updateProductVO.getName().equals(this.selectProductByName(updateProductVO.getName()).getName())){
+        LantoneProduct lantoneProductInfo = this.selectProductByName(updateProductVO.getName());
+        if(updateProductVO.getName().equals(lantoneProductInfo.getName()) && updateProductVO.getId() != lantoneProductInfo.getId()){
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "产品名称重复");
         }
@@ -97,7 +98,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         BeanUtil.copyProperties(updateProductVO, lantoneProduct);
         lantoneProduct.setModifier(UserUtils.getCurrentPrincipleID());
         lantoneProduct.setGmtModified(DateUtil.now());
-        if(updateProductVO.getServiceStatus()==StatusEnum.Disable.getKey()){
+        if(null != updateProductVO.getServiceStatus() && updateProductVO.getServiceStatus()==StatusEnum.Disable.getKey()){
             Page page =new Page();
             OpenedProductsIndex openedProductsIndex =new OpenedProductsIndex();
             openedProductsIndex.setProductId(updateProductVO.getId());