新增单价营业员相关字段,实现思迅流水
This commit is contained in:
parent
98f5a160af
commit
3b7a923109
@ -28,6 +28,10 @@ public class ProductQuantityConsumption {
|
||||
@ApiModelProperty("商品编号")
|
||||
private String productNumber;
|
||||
|
||||
@TableField(value = "unit_price", updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty("商品单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("数量(正数表示入库/增加,负数表示出库/减少)")
|
||||
@TableField(value = "quantity",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ -126,4 +126,8 @@ public class StoreDbConfig implements Serializable {
|
||||
@TableField(value = "shop_gap_time",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@NotBlank(message = "商品同步间隔时间不能为空")
|
||||
private String shopGapTime;
|
||||
|
||||
@TableField(value = "sale_account",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@NotBlank(message = "营业员账号")
|
||||
private String saleAccount;
|
||||
}
|
||||
@ -902,17 +902,19 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
ProductQuantityConsumption productQuantityConsumption=new ProductQuantityConsumption();
|
||||
String productKey= (String) k;
|
||||
String[] productKeyArrys=productKey.split("-");
|
||||
if(productKeyArrys.length!=2){
|
||||
if(productKeyArrys.length!=3){
|
||||
return;
|
||||
}
|
||||
String productNumber=productKeyArrys[0];
|
||||
String orderId=productKeyArrys[1];
|
||||
String unitPrice=productKeyArrys[2];
|
||||
productQuantityConsumption.setConsumeId(IdUtil.getSnowflakeNextIdStr());
|
||||
productQuantityConsumption.setOrderId(orderId);
|
||||
productQuantityConsumption.setProductNumber(productNumber);
|
||||
productQuantityConsumption.setQuantity(Convert.toBigDecimal(v));
|
||||
productQuantityConsumption.setStoreId(Integer.valueOf(storeId));
|
||||
productQuantityConsumption.setStatus(0);
|
||||
productQuantityConsumption.setUnitPrice(new BigDecimal(unitPrice));
|
||||
productQuantityConsumptionList.add(productQuantityConsumption);
|
||||
});
|
||||
return productQuantityConsumptionList;
|
||||
@ -971,8 +973,9 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
cn.hutool.json.JSONArray array_item_spec= JSONUtil.parseArray(spuItem.getItem_spec());
|
||||
logger.info("array_item_spec:{}",array_item_spec);
|
||||
logger.info("key:{},Product_number:{}",key,itemId);
|
||||
String unitPrice= String.valueOf(spuItem.getItem_unit_price());
|
||||
if(array_item_spec.isEmpty()){
|
||||
redisTemplate.opsForHash().increment(key, itemId+"-"+orderId, delta.doubleValue());
|
||||
redisTemplate.opsForHash().increment(key, itemId+"-"+orderId+"-"+unitPrice, delta.doubleValue());
|
||||
logger.info("存储无规格库存成功");
|
||||
continue;
|
||||
}
|
||||
@ -980,7 +983,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
||||
String name = Convert.toStr(item.get("name"));
|
||||
BigDecimal itemQuaryty = getBigDecimal(delta, name);
|
||||
// 使用 Redis 的 HINCRBY 保证原子性和高性能
|
||||
redisTemplate.opsForHash().increment(key, itemId+"-"+orderId, itemQuaryty.doubleValue());
|
||||
redisTemplate.opsForHash().increment(key, itemId+"-"+orderId+"-"+unitPrice, itemQuaryty.doubleValue());
|
||||
logger.info("存储有规格库存成功");
|
||||
} catch (Exception e) {
|
||||
logger.error("库存累计失败,productKey={}, delta={}, error={}", productKey, delta, e.getMessage(), e);
|
||||
|
||||
3
sql/shop/dev/20251103_dml.sql
Normal file
3
sql/shop/dev/20251103_dml.sql
Normal file
@ -0,0 +1,3 @@
|
||||
alter table product_quantity_consumption add column unit_price decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品单价';
|
||||
|
||||
ALTER table store_db_config add column `sale_account` varchar(8) NOT NULL default '8080' COMMENT '营业员账号';
|
||||
Loading…
Reference in New Issue
Block a user