Parcourir la source

产品修改限制去除

yzc il y a 1 an
Parent
commit
d2185edf4e

+ 3 - 17
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.common.constant.SourceConstant;
+import com.fjhx.common.utils.Assert;
 import com.fjhx.customer.entity.customer.po.Customer;
 import com.fjhx.customer.service.customer.CustomerService;
 import com.fjhx.file.utils.ObsFileUtil;
@@ -346,23 +347,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
     @DSTransactional
     @Override
     public void editByEhsd(ProductInfoDto productInfoDto) {
-        ProductInfoEhsdJson newProductInfoEhsdJson = JSONObject.parseObject(productInfoDto.getEhsdJson(), ProductInfoEhsdJson.class);
-        //只允许修改以下字段 销售指导价、成本价、净重、图片、备注
-        ProductInfo productInfo = getById(productInfoDto.getId());
-        if (ObjectUtil.isEmpty(productInfo)) {
-            throw new ServiceException("无法查询到改产品的产品信息,产品id" + productInfoDto.getId());
-        }
-        //限制只能改以下字段
-        ProductInfoEhsdJson productInfoEhsdJson = JSONObject.parseObject(productInfo.getEhsdJson(), ProductInfoEhsdJson.class);
-        productInfoEhsdJson.setPrice(newProductInfoEhsdJson.getPrice());//销售指导价
-        productInfoEhsdJson.setCurrency(newProductInfoEhsdJson.getCurrency());//指导价币种
-        productInfoEhsdJson.setCostPrice(newProductInfoEhsdJson.getCostPrice());//成本价
-        productInfoEhsdJson.setCostCurrency(newProductInfoEhsdJson.getCostCurrency());//成本币种
-        productInfoEhsdJson.setNetWeight(newProductInfoEhsdJson.getNetWeight());//净重
-
-        productInfo.setRemark(productInfoDto.getRemark());//备注
-        productInfo.setEhsdJson(JSONObject.toJSONString(productInfoEhsdJson, JSONWriter.Feature.WriteLongAsString));
-        this.updateById(productInfo);
+        Assert.notEmpty(productInfoDto.getId(), "产品id不能为空");
+        this.updateById(productInfoDto);
         //修改图片
         ObsFileUtil.editFile(productInfoDto.getFileList(), productInfoDto.getId());
     }