|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.erp.service.impl;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
@@ -286,18 +287,20 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
|
|
|
FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(fsStoreOrderItem.getProductId());
|
|
|
Assert.notNull(fsStoreProduct,String.format("当前产品 %d 没有找到", fsStoreOrderItem.getProductId()));
|
|
|
|
|
|
- FsStoreProductAttrValue fsStoreProductAttrValue = new FsStoreProductAttrValue();
|
|
|
- //判断是否含有商品规格信息 有则查询商品规格信息 没有取商品的价格
|
|
|
- if (null != fsStoreOrderItem.getProductAttrValueId()) {
|
|
|
- fsStoreProductAttrValue = fsStoreProductAttrValueService.selectFsStoreProductAttrValueById(fsStoreOrderItem.getProductAttrValueId());
|
|
|
- Asserts.notNull(fsStoreProductAttrValue,String.format("商品 %d 属性 %d 没有找到",fsStoreOrderItem.getProductId(), fsStoreOrderItem.getProductAttrValueId()));
|
|
|
- } else {
|
|
|
- fsStoreProductAttrValue.setPrice(fsStoreProduct.getPrice());
|
|
|
- }
|
|
|
+ JSONObject jsonObject = JSON.parseObject(fsStoreOrderItem.getJsonInfo());
|
|
|
+
|
|
|
+// FsStoreProductAttrValue fsStoreProductAttrValue = new FsStoreProductAttrValue();
|
|
|
+// //判断是否含有商品规格信息 有则查询商品规格信息 没有取商品的价格
|
|
|
+// if (null != fsStoreOrderItem.getProductAttrValueId()) {
|
|
|
+// fsStoreProductAttrValue = fsStoreProductAttrValueService.selectFsStoreProductAttrValueById(fsStoreOrderItem.getProductAttrValueId());
|
|
|
+// Asserts.notNull(fsStoreProductAttrValue,String.format("商品 %d 属性 %d 没有找到",fsStoreOrderItem.getProductId(), fsStoreOrderItem.getProductAttrValueId()));
|
|
|
+// } else {
|
|
|
+// fsStoreProductAttrValue.setPrice(fsStoreProduct.getPrice());
|
|
|
+// }
|
|
|
//商品编码
|
|
|
goodItem.put("cptgoodsid",fsStoreProduct.getBarCode());
|
|
|
//商品规格编码
|
|
|
- goodItem.put("cptspeccode", fsStoreProductAttrValue.getBarCode());
|
|
|
+ goodItem.put("cptspeccode", jsonObject.getString("barCode"));
|
|
|
|
|
|
//商品名称
|
|
|
goodItem.put("cgoodsname", fsStoreProduct.getProductName());
|
|
@@ -306,14 +309,14 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
|
|
|
//购买数量
|
|
|
goodItem.put("fqty", fsStoreOrderItem.getNum());
|
|
|
//原单价
|
|
|
- goodItem.put("fnormprice", fsStoreProductAttrValue.getPrice());
|
|
|
- BigDecimal subtract = fsStoreProductAttrValue.getPrice().subtract(divide);
|
|
|
+ goodItem.put("fnormprice", jsonObject.getBigDecimal("price"));
|
|
|
+ BigDecimal subtract = jsonObject.getBigDecimal("price").subtract(divide);
|
|
|
//前面的所有商品采用平均优惠计算 最后一个采用减法
|
|
|
if (i != fsStoreOrderItemsSize - 1) {
|
|
|
alreadySum = alreadySum.add(divide);
|
|
|
} else {
|
|
|
BigDecimal d = discountMoney.subtract(alreadySum);
|
|
|
- subtract = fsStoreProductAttrValue.getPrice().subtract(d);
|
|
|
+ subtract = jsonObject.getBigDecimal("price").subtract(d);
|
|
|
}
|
|
|
|
|
|
//实售单价 优惠后的单价 单位元
|
|
@@ -402,7 +405,8 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
|
|
|
goodItem.put("cptspeccode", fsStoreOrderItem.getProductAttrValueId());
|
|
|
|
|
|
FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(fsStoreOrderItem.getProductId());
|
|
|
- FsStoreProductAttrValue fsStoreProductAttrValue = fsStoreProductAttrValueService.selectFsStoreProductAttrValueById(fsStoreOrderItem.getProductAttrValueId());
|
|
|
+// FsStoreProductAttrValue fsStoreProductAttrValue = fsStoreProductAttrValueService.selectFsStoreProductAttrValueById(fsStoreOrderItem.getProductAttrValueId());
|
|
|
+ JSONObject jsonObject = JSON.parseObject(fsStoreOrderItem.getJsonInfo());
|
|
|
//商品名称
|
|
|
goodItem.put("cgoodsname", fsStoreProduct.getProductName());
|
|
|
//商品规格名称 f
|
|
@@ -410,14 +414,14 @@ public class HzOMSErpOrderServiceImpl implements IErpOrderService {
|
|
|
//本次申请数量
|
|
|
goodItem.put("fqty", fsStoreOrderItem.getNum());
|
|
|
//原单价
|
|
|
- goodItem.put("fnormprice", fsStoreProductAttrValue.getPrice());
|
|
|
- BigDecimal subtract = fsStoreProductAttrValue.getPrice().subtract(divide);
|
|
|
+ goodItem.put("fnormprice", jsonObject.getBigDecimal("price"));
|
|
|
+ BigDecimal subtract = jsonObject.getBigDecimal("price").subtract(divide);
|
|
|
//前面的所有商品采用平均优惠计算 最后一个采用减法
|
|
|
if (i != fsStoreOrderItemsSize - 1) {
|
|
|
alreadySum = alreadySum.add(divide);
|
|
|
} else {
|
|
|
BigDecimal d = discountMoney.subtract(alreadySum);
|
|
|
- subtract = fsStoreProductAttrValue.getPrice().subtract(d);
|
|
|
+ subtract = jsonObject.getBigDecimal("price").subtract(d);
|
|
|
}
|
|
|
|
|
|
//本次申请退款单价 单位元
|