Commit 4b449dec authored by 吴春's avatar 吴春

提交订单成本与运费成本日志表

parent 77c79416
......@@ -226,7 +226,7 @@ namespace Mall.CacheManager.User
{
try
{
TimeSpan ts = GetExpirTime(JwtExpirTime);
TimeSpan ts = GetExpirTime(31536000);//365天不过期
redis.StringSet<TransactionPriceInfo>(cacheKey, model, ts);
}
catch (Exception ex)
......
using VT.FW.DB;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.Product
{
/// <summary>
/// 商品订单日志信息表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_OrderGoods_Log
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 来源id
/// </summary>
public int? OrderId
{
get;
set;
}
/// <summary>
/// 来源id
/// </summary>
public int? OrderDetailId
{
get;
set;
}
/// <summary>
/// 原成本价
/// </summary>
public decimal OldCostPrice { get; set; }
/// <summary>
/// 新成本价
/// </summary>
public decimal NewCostPrice { get; set; }
/// <summary>
/// 修改人信息
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// 来源类型 1成本,2-运费
/// </summary>
public int Type
{
get;
set;
}
/// <summary>
/// 操作内容
/// </summary>
public string Content
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using VT.FW.DB;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品订单日志信息表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_OrderGoods_Log_Extend : RB_OrderGoods_Log
{
/// <summary>
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 下单时间
/// </summary>
public string OrderStartDate { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string OrderNo { get; set; }
public string EmpName { get; set; }
/// <summary>
/// 下单时间
/// </summary>
public string OrderEndDate { get; set; }
/// <summary>
/// 操作时间
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 操作时间
/// </summary>
public string EndDate { get; set; }
}
}
......@@ -350,6 +350,10 @@ namespace Mall.Module.Product
///</summary>
private readonly RB_Invoice_Online_TradeRepository invoiceOnlineTradeRepository = new RB_Invoice_Online_TradeRepository();
/// <summary>
/// 不可开发票提现信息记录表
///</summary>
private readonly RB_OrderGoods_LogRepository orderGoodsLogRepository = new RB_OrderGoods_LogRepository();
#region 购物车
......@@ -12221,7 +12225,7 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetOrderFreightCostMoney(int orderId, decimal freightMoney, int tenantId, int mallBaseId)
public bool SetOrderFreightCostMoney(int orderId, decimal freightMoney, int CreateBy, int tenantId, int mallBaseId)
{
var orderModel = goods_OrderDetailRepository.GetEntity(orderId);
if (orderModel == null)
......@@ -12252,15 +12256,19 @@ namespace Mall.Module.Product
if (flag)
{
//记录日志
Task.Run(() => goods_LogRepository.Insert(new RB_Goods_Log()
Task.Run(() => orderGoodsLogRepository.Insert(new RB_OrderGoods_Log()
{
Content = "修改订单商品:" + orderModel.GoodsName + "运费成本:" + freightMoney + ";历史:价格:" + (orderModel.FreightCostMoney ?? 0).ToString(),
CreateDate = DateTime.Now,
Id = 0,
MallBaseId = mallBaseId,
SourceId = orderModel.OrderId,
OrderId = orderModel.OrderId,
OrderDetailId = orderModel.Id,
CreateBy = CreateBy,
TenantId = tenantId,
Type = 1
OldCostPrice = (orderModel.FreightCostMoney ?? 0),
NewCostPrice = freightMoney,
Type = 2
}));
}
return flag;
......@@ -12277,9 +12285,9 @@ namespace Mall.Module.Product
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetOrderCostMoney(int orderId, decimal costMoney, int tenantId, int mallBaseId)
public bool SetOrderCostMoney(int OrderDetailId, decimal costMoney, int CreateBy, int tenantId, int mallBaseId)
{
var orderModel = goods_OrderDetailRepository.GetEntity(orderId);
var orderModel = goods_OrderDetailRepository.GetEntity(OrderDetailId);
if (orderModel == null)
{
return false;
......@@ -12308,14 +12316,18 @@ namespace Mall.Module.Product
if (flag)
{
//记录日志
Task.Run(() => goods_LogRepository.Insert(new RB_Goods_Log()
Task.Run(() => orderGoodsLogRepository.Insert(new RB_OrderGoods_Log()
{
Content = "修改订单商品:" + orderModel.GoodsName + "成本:" + costMoney + ";历史:价格:" + (orderModel.CostMoney ?? 0).ToString(),
CreateDate = DateTime.Now,
Id = 0,
MallBaseId = mallBaseId,
SourceId = orderModel.OrderId,
OrderId = orderModel.OrderId,
OrderDetailId = orderModel.Id,
CreateBy = CreateBy,
TenantId = tenantId,
OldCostPrice = (orderModel.CostMoney ?? 0),
NewCostPrice = costMoney,
Type = 1
}));
}
......@@ -15314,5 +15326,23 @@ namespace Mall.Module.Product
}
#endregion
#region 订单成本修改记录
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_OrderGoods_Log_Extend> GetOrderGoodsLogPageList(int pageIndex, int pageSize, out long rowCount, RB_OrderGoods_Log_Extend dmodel)
{
return orderGoodsLogRepository.GetPageList(pageIndex, pageSize, out rowCount, dmodel);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品订单日志仓储层
/// </summary>
public class RB_OrderGoods_LogRepository : BaseRepository<RB_OrderGoods_Log>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_OrderGoods_Log_Extend> GetList(RB_OrderGoods_Log_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_OrderGoods_Log_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_OrderGoods_Log_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Type > 0)
{
where += $@" and {nameof(RB_OrderGoods_Log_Extend.Type)}={dmodel.Type}";
}
if (dmodel.OrderId > 0)
{
where += $@" and {nameof(RB_OrderGoods_Log_Extend.OrderId)}={dmodel.OrderId}";
}
if (dmodel.OrderDetailId > 0)
{
where += $@" and {nameof(RB_OrderGoods_Log_Extend.OrderDetailId)}={dmodel.OrderId}";
}
if (dmodel.CreateBy > 0)
{
where += $@" and {nameof(RB_OrderGoods_Log_Extend.CreateBy)}={dmodel.CreateBy}";
}
string sql = $@"SELECT * FROM RB_Goods_Log where {where} order by Id asc";
return Get<RB_OrderGoods_Log_Extend>(sql).ToList();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_OrderGoods_Log_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_OrderGoods_Log_Extend dmodel)
{
string where = $" where 1=1 and c.{nameof(RB_Goods_Order.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and a.{nameof(RB_OrderGoods_Log_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and a.{nameof(RB_OrderGoods_Log_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and a.{nameof(RB_OrderGoods_Log_Extend.Id)}={dmodel.Id}";
}
if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
where += $" and DATE_FORMAT(a.{nameof(RB_OrderGoods_Log_Extend.CreateDate)},'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.StartDate}','%Y-%m-%d' ) ";
}
if (!string.IsNullOrWhiteSpace(dmodel.EndDate))
{
where += $" and DATE_FORMAT(a.{nameof(RB_OrderGoods_Log_Extend.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' ) ";
}
if (!string.IsNullOrWhiteSpace(dmodel.OrderStartDate))
{
where += $" and DATE_FORMAT(c.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )>=DATE_FORMAT('{dmodel.OrderStartDate}','%Y-%m-%d' ) ";
}
if (!string.IsNullOrWhiteSpace(dmodel.OrderEndDate))
{
where += $" and DATE_FORMAT(c.{nameof(RB_Goods_Order.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.OrderEndDate}','%Y-%m-%d' ) ";
}
if (!string.IsNullOrEmpty(dmodel.OrderNo))
{
where += $@" and c.{nameof(RB_Goods_Order.OrderNo)} like '%{dmodel.OrderNo}%'";
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and b.{nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
}
if (dmodel.Type > 0)
{
where += $@" and a.{nameof(RB_Material_Info.Type)}={dmodel.Type}";
}
string sql = $@"SELECT a.*,b.GoodsName,c.OrderNo,d.EmpName from rb_ordergoods_log as a
LEFT JOIN rb_goods_orderdetail as b on a.OrderDetailId=b.Id
LEFT JOIN rb_goods_order as c on a.OrderId=c.OrderId
LEFT JOIN rb_employee as d on a.CreateBy=d.EmpId {where} order by Id desc";
return GetPage<RB_OrderGoods_Log_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
}
}
......@@ -2077,6 +2077,7 @@ namespace Mall.WebApi.Controllers.MallBase
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int OrderId = parms.GetInt("Id", 0);
int EmpId = parms.GetInt("EmpId", 0);
decimal FreightMoney = parms.GetDecimal("FreightCostMoney");
if (OrderId <= 0)
{
......@@ -2088,7 +2089,7 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("请传递运费成本");
}
bool flag = orderModule.SetOrderFreightCostMoney(OrderId, FreightMoney, req.TenantId, req.MallBaseId);
bool flag = orderModule.SetOrderFreightCostMoney(OrderId, FreightMoney, EmpId, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
......@@ -2109,6 +2110,7 @@ namespace Mall.WebApi.Controllers.MallBase
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int OrderId = parms.GetInt("Id", 0);
int EmpId = parms.GetInt("EmpId", 0);
decimal costMoney = parms.GetDecimal("CostMoney");
if (OrderId <= 0)
{
......@@ -2118,7 +2120,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.ParamIsNull("请传递商品成本");
}
bool flag = orderModule.SetOrderCostMoney(OrderId, costMoney, req.TenantId, req.MallBaseId);
bool flag = orderModule.SetOrderCostMoney(OrderId, costMoney, EmpId, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
......@@ -4583,7 +4585,7 @@ namespace Mall.WebApi.Controllers.MallBase
RB_Invoice_Online_Trade_Extend demodel = JsonConvert.DeserializeObject<RB_Invoice_Online_Trade_Extend>(RequestParm.msg.ToString());
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
// demodel.CreateBy = UserInfo.EmpId;
// demodel.CreateBy = UserInfo.EmpId;
if (demodel.CreateBy == 0)
{
return ApiResult.Failed("操作人不能是管理员,请登录员工账号");
......@@ -4667,5 +4669,36 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion
#region 订单商品成本修改记录
/// <summary>
/// 获取提现信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOrderGoodsLogPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_OrderGoods_Log_Extend demodel = JsonConvert.DeserializeObject<RB_OrderGoods_Log_Extend>(RequestParm.msg.ToString());
demodel.TenantId = UserInfo.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = orderModule.GetOrderGoodsLogPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.NewCostPrice,
x.OldCostPrice,
EmpName = x.EmpName ??= "",
x.OrderNo,
GoodsName = x.GoodsName ??= "",
x.Type,
CreateDateStr = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
});
return ApiResult.Success("", pagelist);
}
#endregion
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment