|
|
@@ -17,6 +17,7 @@ import com.uas.platform.b2c.core.constant.ShortConstant;
|
|
|
import com.uas.platform.b2c.core.constant.SplitChar;
|
|
|
import com.uas.platform.b2c.core.constant.Status;
|
|
|
import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
|
|
|
import com.uas.platform.b2c.core.utils.FastjsonUtils;
|
|
|
import com.uas.platform.b2c.core.utils.NumberUtil;
|
|
|
import com.uas.platform.b2c.core.utils.RegexConstant;
|
|
|
@@ -92,6 +93,7 @@ import com.uas.platform.b2c.trade.support.CodeType;
|
|
|
import com.uas.platform.b2c.trade.support.ResultMap;
|
|
|
import com.uas.platform.b2c.trade.util.BoundedExecutor;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
+import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
import com.uas.platform.core.model.Constant;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
@@ -103,8 +105,6 @@ import javassist.NotFoundException;
|
|
|
import org.apache.commons.beanutils.ConvertUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -156,7 +156,10 @@ import java.util.regex.Pattern;
|
|
|
@Service
|
|
|
public class ProductServiceImpl implements ProductService {
|
|
|
|
|
|
- private final Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class);
|
|
|
+ /**
|
|
|
+ * 系统操作日志
|
|
|
+ */
|
|
|
+ private static final UsageBufferedLogger LOGGER = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
|
|
|
@Autowired
|
|
|
private ProductDao productDao;
|
|
|
@@ -2403,17 +2406,17 @@ public class ProductServiceImpl implements ProductService {
|
|
|
if (null == productObject) {
|
|
|
return ResultMap.error(new IllegalOperatorException("物料信息不能为空"));
|
|
|
}
|
|
|
+ // 库存信息
|
|
|
+ Object goodsObject = jsonObject.get("goods");
|
|
|
+ if (null == goodsObject) {
|
|
|
+ return ResultMap.error(new IllegalOperatorException("库存信息不能为空"));
|
|
|
+ }
|
|
|
Product product = JSONObject.parseObject(productObject.toString(), Product.class);
|
|
|
// 检验物料信息
|
|
|
ResultMap resultMap = checkProductInfo(product);
|
|
|
if (Objects.equals(CodeType.ERROR.code(), resultMap.getCode())) {
|
|
|
return resultMap;
|
|
|
}
|
|
|
- // 库存信息
|
|
|
- Object goodsObject = jsonObject.get("goods");
|
|
|
- if (null == goodsObject) {
|
|
|
- return ResultMap.error(new IllegalOperatorException("库存信息不能为空"));
|
|
|
- }
|
|
|
Goods goods = JSONObject.parseObject(goodsObject.toString(), Goods.class);
|
|
|
// PCB
|
|
|
Object pcbObject = jsonObject.get("isPcb");
|
|
|
@@ -2492,7 +2495,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
detail.setCommodityInOutbound(inOutbound);
|
|
|
}
|
|
|
inOutbound = commodityInOutboundDao.save(inOutbound);
|
|
|
- logger.info("出入库历史", "卖家中心单个物料上传进行入库操作", inOutbound.getType(), "", inOutbound.getId());
|
|
|
+ LOGGER.log("出入库历史", "卖家中心单个物料上传进行入库操作", inOutbound.getType(), "", inOutbound.getId());
|
|
|
}
|
|
|
// 添加到个人物料库
|
|
|
bindToPerson(productInfo, userUU, enUU);
|
|
|
@@ -2529,7 +2532,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
goods.setReserve(productInfo.getErpReserve());
|
|
|
goodsService.setGoodsDefault(goods);
|
|
|
goods = goodsDao.save(goods);
|
|
|
- logger.info("上架商品库存操作", "卖家中心单个物料上传进行入库操作", "增加库存: " + productInfo.getErpReserve(), goods.getCode(), goods.getId());
|
|
|
+ LOGGER.log("上架商品库存操作", "卖家中心单个物料上传进行入库操作", "增加库存: " + productInfo.getErpReserve(), goods.getCode(), goods.getId());
|
|
|
CommodityInOutbound inOutbound = new CommodityInOutbound(InOutBoundType.OTHER_INBOUND);
|
|
|
String inOutboundId = createNumberService.generateOrderNumber(com.uas.platform.b2c.core.constant.EncodingRulesConstant.INOUTBOUND_NUM, "trade$commodity_in_outbound", 8);
|
|
|
inOutbound.setInOutId(inOutboundId);
|
|
|
@@ -2689,7 +2692,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
Double reserve = goods.getReserve() != null ? goods.getReserve() : 0D + addQty;
|
|
|
goods.setReserve(reserve);
|
|
|
goods = goodsDao.save(goods);
|
|
|
- logger.info("上架商品库存操作", "卖家中心单个物料上传进行入库操作", "增加库存: " + addQty, goods.getCode(), goods.getId());
|
|
|
+ LOGGER.log("上架商品库存操作", "卖家中心单个物料上传进行入库操作", "增加库存: " + addQty, goods.getCode(), goods.getId());
|
|
|
} else if (InOutBoundType.OTHER_OUTBOUND.equals(type)) {
|
|
|
// 出库
|
|
|
int index = goodsList.size() - 1;
|
|
|
@@ -2706,7 +2709,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
Double reserve = subQty >= 0 ? 0 : subQty;
|
|
|
goods.setReserve(Math.abs(reserve));
|
|
|
goods = goodsDao.save(goods);
|
|
|
- logger.info("上架商品库存操作", "卖家中心单个物料上传进行出库操作", existQty + "->" + goods.getReserve(), goods.getCode(), goods.getId());
|
|
|
+ LOGGER.log("上架商品库存操作", "卖家中心单个物料上传进行出库操作", existQty + "->" + goods.getReserve(), goods.getCode(), goods.getId());
|
|
|
if (reserve <= 0) {
|
|
|
break;
|
|
|
}
|
|
|
@@ -2749,7 +2752,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
if (CollectionUtils.isEmpty(productPersonList)) {
|
|
|
ProductPerson productPerson = new ProductPerson(enUU, userUU, productInfo.getId());
|
|
|
productPerson = productPersonDao.save(productPerson);
|
|
|
- logger.info("个人物料", "新增个人物料", "通过卖家中心单个物料上传绑定个人物料", productInfo.getProdNum(), productPerson.getId());
|
|
|
+ LOGGER.log("个人物料", "新增个人物料", "通过卖家中心单个物料上传绑定个人物料", productInfo.getProdNum(), productPerson.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2760,6 +2763,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @param productInfo 物料信息
|
|
|
*/
|
|
|
private void assignmentGoods(Goods goods, Product productInfo) {
|
|
|
+ GoodsHistory goodsHistory;
|
|
|
goods = Goods.productConvertGoods(goods, productInfo);
|
|
|
if (productInfo.getId() != null) {
|
|
|
List<Goods> goodsList = goodsDao.findByProductId(productInfo.getId());
|
|
|
@@ -2768,6 +2772,16 @@ public class ProductServiceImpl implements ProductService {
|
|
|
goods.setProductid(productInfo.getId());
|
|
|
}
|
|
|
}
|
|
|
+ String type = null;
|
|
|
+ if (null != goods.getId()) {
|
|
|
+ type = GoodsHistory.OperateType.Update.name();
|
|
|
+ goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
|
|
|
+ } else {
|
|
|
+ type = GoodsHistory.OperateType.PutOn.name();
|
|
|
+ goodsHistory = goodsHistoryService.converTGoodsHist(goods, type, false);
|
|
|
+ }
|
|
|
+ goodsHistory = goodsHistoryService.save(goodsHistory);
|
|
|
+ LOGGER.log("库存操作", "单个物料上传更新库存操作", "操作方式 " + type, goodsHistory.getCode(), goodsHistory.getId());
|
|
|
final Double minBuyQty = goods.getMinBuyQty();
|
|
|
// 判断前端传入的分段价格是默认的值还是填写错误
|
|
|
List<GoodsQtyPrice> qtyPrices = goods.getOriginalPrices();
|
|
|
@@ -2804,6 +2818,6 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
|
goodsService.setGoodsDefault(goods);
|
|
|
goods = goodsDao.save(goods);
|
|
|
- logger.info("上架商品", "新增上架商品", "通过卖家中心单个物料上传新增上架商品", goods.getCode(), goods.getId());
|
|
|
+ LOGGER.log("上架商品", "新增上架商品", "通过卖家中心单个物料上传新增上架商品", goods.getCode(), goods.getId());
|
|
|
}
|
|
|
}
|