Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

24282 2 éve
szülő
commit
6f801142b7

+ 5 - 1
hx-item/src/main/java/com/fjhx/item/entity/product/dto/ProductInfoDto.java

@@ -58,8 +58,12 @@ public class ProductInfoDto extends ProductInfo {
 
 
     /**
-     * 图片列表
+     * 图片列表
      */
     private List<ObsFile> imgList;
+    /**
+     * 副图片列表
+     */
+    private List<ObsFile> minorImgList;
 
 }

+ 16 - 6
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -275,6 +275,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         if (ObjectUtil.isEmpty(productInfoEhsdJson.getCustomerId())) {
             //如果客户id为空就赋值为0 公司产品
             productInfoEhsdJson.setCustomerId(0l);
+            productInfoEhsdJson.setType("1");//默认公司产品
         }
         productInfoDto.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
 
@@ -286,7 +287,9 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         //图片列表
         ObsFileUtil.saveFile(productInfoDto.getImgList(), productInfoDto.getId(), 1);
         //附件列表
-        ObsFileUtil.saveFile(productInfoDto.getFileList(), productInfoDto.getId(), 2);
+        ObsFileUtil.saveFile(productInfoDto.getMinorImgList(), productInfoDto.getId(), 2);
+        //附件列表
+        ObsFileUtil.saveFile(productInfoDto.getFileList(), productInfoDto.getId(), 3);
     }
 
     @DSTransactional
@@ -298,7 +301,9 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         this.nameDuplication(ProductInfo::getName, productInfoDto.getName(), productInfoDto.getId(), "产品名称重复");
         this.updateById(productInfoDto);
         ObsFileUtil.editFile(productInfoDto.getImgList(), productInfoDto.getId(), 1);
-        ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId(), 2);
+        ObsFileUtil.editFile(productInfoDto.getMinorImgList(), productInfoDto.getId(), 2);
+        ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId(), 3);
+
     }
 
     @Override
@@ -307,10 +312,15 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         ProductInfoVo result = BeanUtil.toBean(ProductInfo, ProductInfoVo.class);
 
         ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(result.getEhsdJson(), ProductInfoEhsdJson.class);
-        //赋值客户名称
-        Customer customer = customerService.getById(productInfoEhsdJson.getCustomerId());
-        productInfoEhsdJson.setCustomerName(customer.getName());
-        result.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
+        //判断客户id不为空
+        if (ObjectUtil.isNotEmpty(productInfoEhsdJson) && ObjectUtil.isNotEmpty(productInfoEhsdJson.getCustomerId())) {
+            //赋值客户名称
+            Customer customer = customerService.getById(productInfoEhsdJson.getCustomerId());
+            if(ObjectUtil.isNotEmpty(customer)) {
+                productInfoEhsdJson.setCustomerName(customer.getName());
+                result.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson));
+            }
+        }
         //赋值创建人名称
         UserUtil.assignmentNickName(Arrays.asList(result), ProductInfoVo::getCreateUser, ProductInfoVo::setCreateUserName);
         return result;

+ 1 - 1
hx-item/src/main/resources/mapper/product/ProductInfoMapper.xml

@@ -102,7 +102,7 @@
                c.`name` customerName
         FROM product_info pi
                  LEFT JOIN product_classify pc ON pi.product_classify_id = pc.id
-                 LEFT JOIN bytesailing_customer.customer c ON json_unquote(pi.ehsd_json - > '$.customerId') = c.id
+                 LEFT JOIN bytesailing_customer.customer c ON json_unquote(pi.ehsd_json -> '$.customerId') = c.id
             ${ew.customSqlSegment}
     </select>
 </mapper>