init 初始化商品列表管理
This commit is contained in:
parent
d94878993d
commit
52e0233141
133
ARW.Model/Dto/Business/GoodsManager/Goodss/GoodsDto.cs
Normal file
133
ARW.Model/Dto/Business/GoodsManager/Goodss/GoodsDto.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
|
||||
namespace ARW.Model.Dto.Business.GoodsManager.Goodss
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品输入对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsDto
|
||||
{
|
||||
|
||||
public int GoodsId { get; set; }
|
||||
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "店铺guid不能为空")]
|
||||
public long ShopGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "商品类目guid不能为空")]
|
||||
public long GoodsCategoryGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "商品规格guid不能为空")]
|
||||
public long GoodsSkuGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "配送模板guid不能为空")]
|
||||
public long DeliveryGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "名称不能为空")]
|
||||
public string GoodsName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "编码不能为空")]
|
||||
public string GoodsCoding { get; set; }
|
||||
|
||||
public string GoodsMainImageVideo { get; set; }
|
||||
|
||||
public string GoodsVideoCover { get; set; }
|
||||
|
||||
public string GoodsSellingPoint { get; set; }
|
||||
|
||||
public int GoodsSpecType { get; set; }
|
||||
|
||||
|
||||
[Required(ErrorMessage = "图片不能为空")]
|
||||
public string GoodsPicture { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "价格(最低)不能为空")]
|
||||
public decimal GoodsPriceLowest { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "价格(最高)不能为空")]
|
||||
public decimal GoodsPriceHighest { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "划线价格(最低)不能为空")]
|
||||
public decimal GoodsDashedPriceLowest { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "划线价格(最高)不能为空")]
|
||||
public decimal GoodsDashedPriceHighest { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "库存总量不能为空")]
|
||||
public int GoodsTotalInventory { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "初始销量不能为空")]
|
||||
public int GoodsSalesInitial { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "实际销量不能为空")]
|
||||
public int GoodsSalesActual { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "详情不能为空")]
|
||||
public string GoodsDetails { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "库存计算方式(1下单立减库存 2付款立减库存)不能为空")]
|
||||
public int GoodsDeductStockType { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "是否赠送积分(1开启 0关闭)不能为空")]
|
||||
public int GoodsIsPointsGift { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "是否允许使用积分抵扣(1允许 0不允许)不能为空")]
|
||||
public int GoodsIsPointsDiscount { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "积分抵扣设置(0默认抵扣 1单独设置抵扣)不能为空")]
|
||||
public int GoodsIsAlonePointsDiscount { get; set; }
|
||||
|
||||
public string GoodsPointsDiscountConfig { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "是否开启会员折扣(1开启 0关闭)不能为空")]
|
||||
public int GoodsIsEnableGrade { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "会员折扣设置(0默认等级折扣 1单独设置折扣)不能为空")]
|
||||
public int GoodsIsAloneGrade { get; set; }
|
||||
|
||||
public string GoodsAloneGradeEquity { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "上下架状态(1上架 2下架)不能为空")]
|
||||
public int GoodsShelfStatus { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "排序不能为空")]
|
||||
public int GoodsSort { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品查询对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public long? ShopGuid { get; set; }
|
||||
|
||||
public long? GoodsCategoryGuid { get; set; }
|
||||
|
||||
public string GoodsName { get; set; }
|
||||
|
||||
public string GoodsCoding { get; set; }
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
305
ARW.Model/Models/Business/GoodsManager/Goodss/Goods.cs
Normal file
305
ARW.Model/Models/Business/GoodsManager/Goodss/Goods.cs
Normal file
@ -0,0 +1,305 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.GoodsManager.Goodss
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品,数据实体对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[SugarTable("tb_goods")]
|
||||
public class Goods : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "GoodsId")]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_id")]
|
||||
public int GoodsId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "GoodsGuid")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "goods_guid")]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :店铺guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "店铺guid")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "shop_guid")]
|
||||
public long ShopGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品类目guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "商品类目guid")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "goods_category_guid")]
|
||||
public long GoodsCategoryGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品规格guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "商品规格guid")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "goods_sku_guid")]
|
||||
public long GoodsSkuGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :配送模板guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "配送模板guid")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "delivery_guid")]
|
||||
public long DeliveryGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :名称
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "名称")]
|
||||
[SugarColumn(ColumnName = "goods_name")]
|
||||
public string GoodsName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :编码
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "编码")]
|
||||
[SugarColumn(ColumnName = "goods_coding")]
|
||||
public string GoodsCoding { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :主图视频
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "主图视频")]
|
||||
[SugarColumn(ColumnName = "goods_main_image_video")]
|
||||
public string GoodsMainImageVideo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :视频封面
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "视频封面")]
|
||||
[SugarColumn(ColumnName = "goods_video_cover")]
|
||||
public string GoodsVideoCover { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :图片
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "图片")]
|
||||
[SugarColumn(ColumnName = "goods_picture")]
|
||||
public string GoodsPicture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :卖点
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "卖点")]
|
||||
[SugarColumn(ColumnName = "goods_selling_point")]
|
||||
public string GoodsSellingPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品规格(1单规格 2多规格)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "商品规格(1单规格 2多规格)")]
|
||||
[SugarColumn(ColumnName = "goods_spec_type")]
|
||||
public string GoodsSpecType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :价格(最低)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "价格(最低)")]
|
||||
[SugarColumn(ColumnName = "goods_price_lowest")]
|
||||
public decimal GoodsPriceLowest { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :价格(最高)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "价格(最高)")]
|
||||
[SugarColumn(ColumnName = "goods_price_highest")]
|
||||
public decimal GoodsPriceHighest { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :划线价格(最低)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "划线价格(最低)")]
|
||||
[SugarColumn(ColumnName = "goods_dashed_price_lowest")]
|
||||
public decimal GoodsDashedPriceLowest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :划线价格(最高)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "划线价格(最高)")]
|
||||
[SugarColumn(ColumnName = "goods_dashed_price_highest")]
|
||||
public decimal GoodsDashedPriceHighest { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :库存总量
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "库存总量")]
|
||||
[SugarColumn(ColumnName = "goods_total_inventory")]
|
||||
public int GoodsTotalInventory { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :初始销量
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "初始销量")]
|
||||
[SugarColumn(ColumnName = "goods_sales_initial")]
|
||||
public int GoodsSalesInitial { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :实际销量
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "实际销量")]
|
||||
[SugarColumn(ColumnName = "goods_sales_actual")]
|
||||
public int GoodsSalesActual { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :详情
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "详情")]
|
||||
[SugarColumn(ColumnName = "goods_details")]
|
||||
public string GoodsDetails { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :库存计算方式(1下单立减库存 2付款立减库存)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "库存计算方式(1下单立减库存 2付款立减库存)")]
|
||||
[SugarColumn(ColumnName = "goods_deduct_stock_type")]
|
||||
public int GoodsDeductStockType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否赠送积分(1开启 0关闭)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否赠送积分(1开启 0关闭)")]
|
||||
[SugarColumn(ColumnName = "goods_is_points_gift")]
|
||||
public int GoodsIsPointsGift { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否允许使用积分抵扣(1允许 0不允许)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否允许使用积分抵扣(1允许 0不允许)")]
|
||||
[SugarColumn(ColumnName = "goods_is_points_discount")]
|
||||
public int GoodsIsPointsDiscount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :积分抵扣设置(0默认抵扣 1单独设置抵扣)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "积分抵扣设置(0默认抵扣 1单独设置抵扣)")]
|
||||
[SugarColumn(ColumnName = "goods_is_alone_points_discount")]
|
||||
public int GoodsIsAlonePointsDiscount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :单独设置积分抵扣的配置
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "单独设置积分抵扣的配置")]
|
||||
[SugarColumn(ColumnName = "goods_points_discount_config")]
|
||||
public string GoodsPointsDiscountConfig { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否开启会员折扣(1开启 0关闭)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否开启会员折扣(1开启 0关闭)")]
|
||||
[SugarColumn(ColumnName = "goods_is_enable_grade")]
|
||||
public int GoodsIsEnableGrade { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :会员折扣设置(0默认等级折扣 1单独设置折扣)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "会员折扣设置(0默认等级折扣 1单独设置折扣)")]
|
||||
[SugarColumn(ColumnName = "goods_is_alone_grade")]
|
||||
public int GoodsIsAloneGrade { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :单独设置折扣的配置
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "单独设置折扣的配置")]
|
||||
[SugarColumn(ColumnName = "goods_alone_grade_equity")]
|
||||
public string GoodsAloneGradeEquity { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :上下架状态(1上架 2下架)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "上下架状态(1上架 2下架)")]
|
||||
[SugarColumn(ColumnName = "goods_shelf_status")]
|
||||
public int GoodsShelfStatus { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :排序
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "排序")]
|
||||
[SugarColumn(ColumnName = "goods_sort")]
|
||||
public int GoodsSort { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
237
ARW.Model/Vo/Business/GoodsManager/Goodss/GoodsVo.cs
Normal file
237
ARW.Model/Vo/Business/GoodsManager/Goodss/GoodsVo.cs
Normal file
@ -0,0 +1,237 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.GoodsManager.Goodss
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品展示对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public class GoodsVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public int GoodsId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :店铺guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusTableColumn(Header = "店铺guid")]
|
||||
public long ShopGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品类目guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusTableColumn(Header = "商品类目guid")]
|
||||
public long GoodsCategoryGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品规格guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusTableColumn(Header = "商品规格guid")]
|
||||
public long GoodsSkuGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :配送模板guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusTableColumn(Header = "配送模板guid")]
|
||||
public long DeliveryGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :名称
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "名称")]
|
||||
public string GoodsName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :编码
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "编码")]
|
||||
public string GoodsCoding { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :主图视频
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public string GoodsMainImageVideo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :视频封面
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public string GoodsVideoCover { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :卖点
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "卖点")]
|
||||
public string GoodsSellingPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品规格(1单规格 2多规格)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "商品规格")]
|
||||
public string GoodsSpecType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :图片
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "图片")]
|
||||
public string GoodsPicture { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :价格(最低)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "价格(最低)")]
|
||||
public decimal GoodsPriceLowest { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :价格(最高)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "价格(最高)")]
|
||||
public decimal GoodsPriceHighest { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :划线价格(最低)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "划线价格(最低)")]
|
||||
public decimal GoodsDashedPriceLowest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :划线价格(最高)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "划线价格(最高)")]
|
||||
public decimal GoodsDashedPriceHighest { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :库存总量
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "库存总量")]
|
||||
public int GoodsTotalInventory { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :初始销量
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "初始销量")]
|
||||
public int GoodsSalesInitial { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :实际销量
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "实际销量")]
|
||||
public int GoodsSalesActual { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :详情
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "详情")]
|
||||
public string GoodsDetails { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :库存计算方式(1下单立减库存 2付款立减库存)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "库存计算方式(1下单立减库存 2付款立减库存)")]
|
||||
public int GoodsDeductStockType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否赠送积分(1开启 0关闭)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否赠送积分(1开启 0关闭)")]
|
||||
public int GoodsIsPointsGift { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否允许使用积分抵扣(1允许 0不允许)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否允许使用积分抵扣(1允许 0不允许)")]
|
||||
public int GoodsIsPointsDiscount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :积分抵扣设置(0默认抵扣 1单独设置抵扣)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "积分抵扣设置(0默认抵扣 1单独设置抵扣)")]
|
||||
public int GoodsIsAlonePointsDiscount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :单独设置积分抵扣的配置
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public string GoodsPointsDiscountConfig { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否开启会员折扣(1开启 0关闭)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否开启会员折扣(1开启 0关闭)")]
|
||||
public int GoodsIsEnableGrade { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :会员折扣设置(0默认等级折扣 1单独设置折扣)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "会员折扣设置(0默认等级折扣 1单独设置折扣)")]
|
||||
public int GoodsIsAloneGrade { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :单独设置折扣的配置
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public string GoodsAloneGradeEquity { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :上下架状态(1上架 2下架)
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "上下架状态(1上架 2下架)")]
|
||||
public int GoodsShelfStatus { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :排序
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "排序")]
|
||||
public int GoodsSort { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
|
||||
namespace ARW.Repository.Business.GoodsManager.Goodss
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品仓储
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class GoodsRepository : BaseRepository<Goods>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,200 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure;
|
||||
using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.GoodsManager.Goodss;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.Goodss;
|
||||
using ARW.Model.Dto.Business.GoodsManager.Goodss;
|
||||
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
using ARW.Model.Vo.Business.GoodsManager.Goodss;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.GoodsManager.Goodss
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品接口实现类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IGoodsService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class GoodsServiceImpl : BaseService<Goods>, IGoodsService
|
||||
{
|
||||
private readonly GoodsRepository _GoodsRepository;
|
||||
|
||||
public GoodsServiceImpl(GoodsRepository GoodsRepository)
|
||||
{
|
||||
this._GoodsRepository = GoodsRepository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询商品分页列表
|
||||
/// </summary>
|
||||
public async Task<PagedInfo<GoodsVo>> GetGoodsList(GoodsQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<Goods>();
|
||||
|
||||
predicate = predicate.AndIF(parm.ShopGuid != null, s => s.ShopGuid == parm.ShopGuid);
|
||||
predicate = predicate.AndIF(parm.GoodsCategoryGuid != null, s => s.GoodsCategoryGuid == parm.GoodsCategoryGuid);
|
||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.GoodsName), s => s.GoodsName.Contains(parm.GoodsName));
|
||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.GoodsCoding), s => s.GoodsCoding.Contains(parm.GoodsCoding));
|
||||
var query = _GoodsRepository
|
||||
.Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.GoodsSort, OrderByType.Asc)
|
||||
.Select(s => new GoodsVo
|
||||
{
|
||||
GoodsId = s.GoodsId,
|
||||
GoodsGuid = s.GoodsGuid,
|
||||
ShopGuid = s.ShopGuid,
|
||||
GoodsCategoryGuid = s.GoodsCategoryGuid,
|
||||
GoodsSkuGuid = s.GoodsSkuGuid,
|
||||
DeliveryGuid = s.DeliveryGuid,
|
||||
GoodsName = s.GoodsName,
|
||||
GoodsCoding = s.GoodsCoding,
|
||||
GoodsMainImageVideo = s.GoodsMainImageVideo,
|
||||
GoodsVideoCover = s.GoodsVideoCover,
|
||||
GoodsPicture = s.GoodsPicture,
|
||||
GoodsSellingPoint = s.GoodsSellingPoint,
|
||||
GoodsSpecType = s.GoodsSpecType,
|
||||
GoodsPriceLowest = s.GoodsPriceLowest,
|
||||
GoodsPriceHighest = s.GoodsPriceHighest,
|
||||
GoodsDashedPriceLowest = s.GoodsDashedPriceLowest,
|
||||
GoodsTotalInventory = s.GoodsTotalInventory,
|
||||
GoodsSalesInitial = s.GoodsSalesInitial,
|
||||
GoodsSalesActual = s.GoodsSalesActual,
|
||||
GoodsDetails = s.GoodsDetails,
|
||||
GoodsDeductStockType = s.GoodsDeductStockType,
|
||||
GoodsIsPointsGift = s.GoodsIsPointsGift,
|
||||
GoodsIsPointsDiscount = s.GoodsIsPointsDiscount,
|
||||
GoodsIsAlonePointsDiscount = s.GoodsIsAlonePointsDiscount,
|
||||
GoodsPointsDiscountConfig = s.GoodsPointsDiscountConfig,
|
||||
GoodsIsEnableGrade = s.GoodsIsEnableGrade,
|
||||
GoodsIsAloneGrade = s.GoodsIsAloneGrade,
|
||||
GoodsAloneGradeEquity = s.GoodsAloneGradeEquity,
|
||||
GoodsShelfStatus = s.GoodsShelfStatus,
|
||||
GoodsSort = s.GoodsSort,
|
||||
});
|
||||
|
||||
|
||||
return await query.ToPageAsync(parm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品
|
||||
/// </summary>
|
||||
public async Task<string> AddOrUpdateGoods(Goods model)
|
||||
{
|
||||
if (model.GoodsId != 0)
|
||||
{
|
||||
var response = await _GoodsRepository.UpdateAsync(model);
|
||||
return "修改成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var response = await _GoodsRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
return "添加成功!";
|
||||
}
|
||||
}
|
||||
|
||||
#region Excel处理
|
||||
/// <summary>
|
||||
/// 数据导入处理
|
||||
/// </summary>
|
||||
public async Task<GoodsVo> HandleImportData(GoodsVo Goods)
|
||||
{
|
||||
return Goods;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Excel导入
|
||||
/// </summary>
|
||||
public async Task<string> ImportExcel(Goods Goods, int index, bool isUpdateSupport, string user)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 空值判断
|
||||
// if (Goods.GoodsId == null) throw new CustomException("商品不能为空");
|
||||
|
||||
if (isUpdateSupport)
|
||||
{
|
||||
// 判断唯一值
|
||||
var model = await GetFirstAsync(s => s.GoodsId == Goods.GoodsId);
|
||||
|
||||
// 如果为空就新增数据
|
||||
if (model == null)
|
||||
{
|
||||
// 开启事务
|
||||
var res = await UseTranAsync(async () =>
|
||||
{
|
||||
var addRes = await AddOrUpdateGoods(Goods);
|
||||
});
|
||||
var addStr = $"第 {index} 行 => 商品:【{Goods.GoodsId}】<span style='color:#27af49'>新增成功!</span><br>";
|
||||
return addStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果有数据就进行修改
|
||||
// 开启事务
|
||||
await UseTranAsync(async () =>
|
||||
{
|
||||
Goods.GoodsId = model.GoodsId;
|
||||
Goods.GoodsGuid = model.GoodsGuid;
|
||||
Goods.Update_by = user;
|
||||
Goods.Update_time = DateTime.Now;
|
||||
var editRes = await AddOrUpdateGoods(Goods);
|
||||
});
|
||||
var editStr = $"第 {index} 行 => 商品:【{Goods.GoodsId}】<span style='color:#e6a23c'>更新成功!</span><br>";
|
||||
return editStr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 开启事务
|
||||
var res = await UseTranAsync(async () =>
|
||||
{
|
||||
var addRes = await AddOrUpdateGoods(Goods);
|
||||
});
|
||||
//Console.WriteLine(res.IsSuccess);
|
||||
var addStr = $"第 {index} 行 => 商品:【{Goods.GoodsId}】<span style='color:#27af49'>新增成功!</span><br>";
|
||||
return addStr;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorRes = $"第 {index} 行 => 商品:【{Goods.GoodsId}】<span style='color:red'>导入失败!{ex.Message}</span><br>";
|
||||
return errorRes;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Excel数据导出处理
|
||||
/// </summary>
|
||||
public async Task<List<GoodsVo>> HandleExportData(List<GoodsVo> data)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Business.GoodsManager.Goodss;
|
||||
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
using ARW.Model.Vo.Business.GoodsManager.Goodss;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.GoodsManager.Goodss
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品接口类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
public interface IGoodsService : IBaseService<Goods>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取商品分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<GoodsVo>> GetGoodsList(GoodsQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateGoods(Goods parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数据导入处理
|
||||
/// </summary>
|
||||
/// <param name="shopVo"></param>
|
||||
/// <returns></returns>
|
||||
Task<GoodsVo> HandleImportData(GoodsVo GoodsVo);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Excel导入
|
||||
/// </summary>
|
||||
/// <param name="shopVo"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> ImportExcel(Goods Goods,int index,bool isUpdateSupport,string user);
|
||||
|
||||
/// <summary>
|
||||
/// Excel导出
|
||||
/// </summary>
|
||||
Task<List<GoodsVo>> HandleExportData(List<GoodsVo> data);
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,180 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.GoodsManager.Goodss;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.Goodss;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
using ARW.Model.Vo.Business.GoodsManager.Goodss;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.GoodsManager.Goodss
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品控制器
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-19
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/[controller]")]
|
||||
public class GoodsController : BaseController
|
||||
{
|
||||
private readonly IGoodsService _GoodsService;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="GoodsService">商品服务</param>
|
||||
public GoodsController(IGoodsService GoodsService)
|
||||
{
|
||||
_GoodsService = GoodsService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getGoodsList")]
|
||||
[ActionPermissionFilter(Permission = "business:goods:list")]
|
||||
public async Task<IActionResult> GetGoodsList([FromQuery] GoodsQueryDto parm)
|
||||
{
|
||||
var res = await _GoodsService.GetGoodsList(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改商品
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addOrUpdateGoods")]
|
||||
[ActionPermissionFilter(Permission = "business:goods:addOrUpdate")]
|
||||
[Log(Title = "添加或修改商品", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public async Task<IActionResult> AddOrUpdateGoods([FromBody] GoodsDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var modal = new Goods();
|
||||
if (parm.GoodsId != 0) modal = parm.Adapt<Goods>().ToUpdate(HttpContext);
|
||||
else modal = parm.Adapt<Goods>().ToCreate(HttpContext);
|
||||
|
||||
var res = await _GoodsService.AddOrUpdateGoods(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除商品
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:goods:delete")]
|
||||
[Log(Title = "商品删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
var response = _GoodsService.Delete(idsArr);
|
||||
return SUCCESS("删除成功!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入商品
|
||||
/// </summary>
|
||||
/// <param name="formFile">使用IFromFile必须使用name属性否则获取不到文件</param>
|
||||
/// <param name="updateSupport">是否需要更新</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("importData")]
|
||||
[Log(Title = "商品导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = false)]
|
||||
[ActionPermissionFilter(Permission = "business:goods:import")]
|
||||
public async Task<IActionResult> ImportExcel([FromForm(Name = "file")] IFormFile formFile, bool updateSupport)
|
||||
{
|
||||
var isUpdateSupport = updateSupport;
|
||||
IEnumerable<GoodsVo> parm = ExcelHelper<GoodsVo>.ImportData(formFile.OpenReadStream());
|
||||
|
||||
var i = 0;
|
||||
var msgList = new List<string>();
|
||||
foreach (GoodsVo item in parm)
|
||||
{
|
||||
i++;
|
||||
var Goods = await _GoodsService.HandleImportData(item);
|
||||
var modal = Goods.Adapt<Goods>().ToCreate(HttpContext);
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext).UserName;
|
||||
var msg = await _GoodsService.ImportExcel(modal, i, isUpdateSupport, user);
|
||||
msgList.Add(msg);
|
||||
}
|
||||
|
||||
return SUCCESS(msgList.ToArray());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品导入模板下载
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("importTemplate")]
|
||||
[Log(Title = "商品模板", BusinessType = BusinessType.EXPORT, IsSaveRequestData = false, IsSaveResponseData = false)]
|
||||
[AllowAnonymous]
|
||||
public IActionResult ImportTemplateExcel()
|
||||
{
|
||||
List<GoodsVo> Goods = new List<GoodsVo>();
|
||||
MemoryStream stream = new MemoryStream();
|
||||
|
||||
// 示例数据
|
||||
var values = new List<string>() { "111", "222", "333" };
|
||||
string sFileName = DownloadImportTemplate(Goods, stream, "商品导入模板", values);
|
||||
|
||||
return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"{sFileName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出商品
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Log(Title = "商品导出", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
|
||||
[HttpGet("exportGoods")]
|
||||
[ActionPermissionFilter(Permission = "business:goods:export")]
|
||||
public async Task<IActionResult> ExportExcel([FromQuery] GoodsQueryDto parm)
|
||||
{
|
||||
parm.PageSize = 10000;
|
||||
var list = await _GoodsService.GetGoodsList(parm);
|
||||
var data = list.Result;
|
||||
|
||||
// 选中数据
|
||||
if (!string.IsNullOrEmpty(parm.ids))
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(parm.ids);
|
||||
var selectDataList = new List<GoodsVo>();
|
||||
foreach (var item in idsArr)
|
||||
{
|
||||
var select_data = data.Where(s => s.GoodsId == item).First();
|
||||
selectDataList.Add(select_data);
|
||||
}
|
||||
data = selectDataList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 导出数据处理
|
||||
var handleData = await _GoodsService.HandleExportData(data);
|
||||
|
||||
string sFileName = ExportExcel(handleData, "Goods", "商品列表");
|
||||
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -104,7 +104,7 @@ namespace ARW.Admin.WebApi.Controllers
|
||||
//fileName = Path.GetFileNameWithoutExtension(formFile.FileName);
|
||||
double fileSize = Math.Round(formFile.Length / 1024.0, 2);//文件大小KB
|
||||
string[] NotAllowedFileExtensions = new string[] { ".bat", ".exe", ".jar", ".js" };
|
||||
int MaxContentLength = 15;
|
||||
int MaxContentLength = 100;
|
||||
if (NotAllowedFileExtensions.Contains(fileExt))
|
||||
{
|
||||
return ToResponse(ResultCode.CUSTOM_ERROR, "上传失败,未经允许上传类型");
|
||||
|
Loading…
Reference in New Issue
Block a user