Commit 2be0ea2a authored by 吴春's avatar 吴春
parents 6d75fcdf bdbc7607
...@@ -22,6 +22,10 @@ namespace Mall.Model.Extend.Product ...@@ -22,6 +22,10 @@ namespace Mall.Model.Extend.Product
/// </summary> /// </summary>
public int? GoodsId { get; set; } public int? GoodsId { get; set; }
/// <summary> /// <summary>
/// 商品购买的数量
/// </summary>
public int? GoodsBuyNum { get; set; }
/// <summary>
/// 视频播放方向 1向下 2向上 /// 视频播放方向 1向下 2向上
/// </summary> /// </summary>
public int? SelectVideoDirection { get; set; } public int? SelectVideoDirection { get; set; }
......
...@@ -1607,8 +1607,10 @@ namespace Mall.Module.Product ...@@ -1607,8 +1607,10 @@ namespace Mall.Module.Product
} }
price_member_max = Math.Round(price_member_max, 2, MidpointRounding.AwayFromZero); price_member_max = Math.Round(price_member_max, 2, MidpointRounding.AwayFromZero);
price_member_min = Math.Round(price_member_min, 2, MidpointRounding.AwayFromZero); price_member_min = Math.Round(price_member_min, 2, MidpointRounding.AwayFromZero);
price_min = Math.Round(price_min, 2, MidpointRounding.AwayFromZero); //price_min = Math.Round(price_min, 2, MidpointRounding.AwayFromZero);
price_max = Math.Round(price_max, 2, MidpointRounding.AwayFromZero); //price_max = Math.Round(price_max, 2, MidpointRounding.AwayFromZero);//先使用会员的
price_min = price_member_min;
price_max = price_member_max;
#endregion #endregion
#region 订单信息 #region 订单信息
...@@ -3164,6 +3166,7 @@ namespace Mall.Module.Product ...@@ -3164,6 +3166,7 @@ namespace Mall.Module.Product
//查询分类 //查询分类
string ids = string.Join(",", list.Select(x => x.Id)); string ids = string.Join(",", list.Select(x => x.Id));
var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }); var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var olist = goods_OrderRepository.GetGoodsOrderNum(ids);
foreach (var item in list) foreach (var item in list)
{ {
item.CategoryList = clist.Where(x => x.GoodsId == item.Id).ToList(); item.CategoryList = clist.Where(x => x.GoodsId == item.Id).ToList();
...@@ -3176,6 +3179,8 @@ namespace Mall.Module.Product ...@@ -3176,6 +3179,8 @@ namespace Mall.Module.Product
item.CoverImage = CarouselIdList[0]; item.CoverImage = CarouselIdList[0];
//轮播图 //轮播图
} }
item.GoodsBuyNum = olist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0;
} }
} }
return list; return list;
......
...@@ -123,8 +123,14 @@ namespace Mall.Module.User ...@@ -123,8 +123,14 @@ namespace Mall.Module.User
/// 财务单据规则 /// 财务单据规则
/// </summary> /// </summary>
private static RB_Finance_ConfigurineRepository financeConfigurineRepository = new RB_Finance_ConfigurineRepository(); private static RB_Finance_ConfigurineRepository financeConfigurineRepository = new RB_Finance_ConfigurineRepository();
/// <summary>
private Repository.User.RB_Member_CouponRepository memberCouponRepository = new Repository.User.RB_Member_CouponRepository(); /// 用户优惠券
/// </summary>
private RB_Member_CouponRepository memberCouponRepository = new RB_Member_CouponRepository();
/// <summary>
/// 分销海报仓储层对象
/// </summary>
private RB_MiniProgram_FenXiaoPosterRepository fenXiaoPosterRepository = new RB_MiniProgram_FenXiaoPosterRepository();
#region 基础配置 #region 基础配置
...@@ -4143,6 +4149,20 @@ namespace Mall.Module.User ...@@ -4143,6 +4149,20 @@ namespace Mall.Module.User
#endregion #endregion
#region 获取分销海报
/// <summary>
/// 根据查询条件获取分销海报实体
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public RB_MiniProgram_FenXiaoPoster_Extend GetFenXiaoPosterEntityModule(RB_MiniProgram_FenXiaoPoster_Extend query)
{
return fenXiaoPosterRepository.GetEntityExtRepository(query);
}
#endregion
#region 获取小程序码 #region 获取小程序码
/// <summary> /// <summary>
......
...@@ -19,6 +19,7 @@ namespace Mall.Repository.BaseSetUp ...@@ -19,6 +19,7 @@ namespace Mall.Repository.BaseSetUp
/// 表名称 /// 表名称
/// </summary> /// </summary>
public string MinTableName { get { return nameof(RB_MiniProgram); } } public string MinTableName { get { return nameof(RB_MiniProgram); } }
/// <summary> /// <summary>
/// 获取小程序列表 /// 获取小程序列表
/// </summary> /// </summary>
......
...@@ -393,7 +393,7 @@ WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.Us ...@@ -393,7 +393,7 @@ WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.Us
public List<RB_Goods_Order_Extend> GetGoodsOrderNum(string goodsIds) public List<RB_Goods_Order_Extend> GetGoodsOrderNum(string goodsIds)
{ {
string sql2 = $@" string sql2 = $@"
SELECT od.GoodsId ,SUM(od.Number) as GoodsNum FROM rb_goods_order o SELECT od.GoodsId ,SUM(od.Number) as OrderNum FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId in({goodsIds}) and o.`Status`=0 and o.OrderStatus <> 7 group by od.GoodsId"; WHERE od.GoodsId in({goodsIds}) and o.`Status`=0 and o.OrderStatus <> 7 group by od.GoodsId";
return Get<RB_Goods_Order_Extend>(sql2).ToList(); return Get<RB_Goods_Order_Extend>(sql2).ToList();
...@@ -889,5 +889,34 @@ GROUP BY od.GoodsId,o.OrderId ...@@ -889,5 +889,34 @@ GROUP BY od.GoodsId,o.OrderId
return Get<RB_Goods_Order_Extend>(sql).ToList(); return Get<RB_Goods_Order_Extend>(sql).ToList();
} }
#endregion #endregion
#region
/// <summary>
/// 获取超时取消的订单列表
/// </summary>
/// <param name="cancelTime"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanCancelOrderList(int cancelTime,int t,int m)
{
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
/// <summary>
/// 获取可自动收货的订单列表
/// </summary>
/// <param name="day"></param>
/// <param name="t"></param>
/// <param name="m"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanReceivingOrderList(int day, int t, int m)
{
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =3 and DATE_ADD(DeliveryTime,INTERVAL {day} DAY) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
#endregion
} }
} }
...@@ -172,7 +172,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -172,7 +172,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.GoodsStatus = 1;//只查询销售中的 demodel.GoodsStatus = 1;//只查询销售中的
var list = productModule.GetAppletGoodsPageListForZY(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = productModule.GetAppletGoodsPageListForZY(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
List<object> RList = new List<object>(); List<object> RList = new List<object>();
int UserId = demodel.UserId ?? 0; int UserId = parms.UserId;
RB_Member_User_Extend userModel = new RB_Member_User_Extend(); RB_Member_User_Extend userModel = new RB_Member_User_Extend();
RB_Member_Grade_Extend memberGrade = new RB_Member_Grade_Extend(); RB_Member_Grade_Extend memberGrade = new RB_Member_Grade_Extend();
if (UserId > 0) if (UserId > 0)
......
...@@ -1089,6 +1089,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1089,6 +1089,7 @@ namespace Mall.WebApi.Controllers.MallBase
x.SellingPrice, x.SellingPrice,
x.InventoryNum, x.InventoryNum,
x.SalesNum, x.SalesNum,
x.GoodsBuyNum,
x.IsQuickBuy, x.IsQuickBuy,
x.GoodsStatus, x.GoodsStatus,
x.TenantId, x.TenantId,
......
...@@ -1027,6 +1027,24 @@ namespace Mall.WebApi.Controllers.User ...@@ -1027,6 +1027,24 @@ namespace Mall.WebApi.Controllers.User
#endregion #endregion
#region 获取分销海报
/// <summary>
/// 获取分销海报
/// </summary>
/// <returns></returns>
public ApiResult GetFenXiaoPoster()
{
var userInfo = AppletUserInfo;
var extModel = JsonConvert.DeserializeObject<RB_MiniProgram_FenXiaoPoster_Extend>(RequestParm.msg.ToString());
extModel.TenantId = userInfo.TenantId;
extModel.MallBaseId = userInfo.MallBaseId;
var result = userModule.GetFenXiaoPosterEntityModule(extModel);
return ApiResult.Success(data: result);
}
#endregion
#region 个人中心余额/积分/优惠券气泡 #region 个人中心余额/积分/优惠券气泡
/// <summary> /// <summary>
/// 个人中心- 积分明细 /// 个人中心- 积分明细
......
...@@ -28,5 +28,39 @@ namespace Mall.WindowsService.Helper ...@@ -28,5 +28,39 @@ namespace Mall.WindowsService.Helper
Interlocked.Exchange(ref inTimer, 0); Interlocked.Exchange(ref inTimer, 0);
} }
} }
/// <summary>
/// 自动取消订单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void AutoCancelOrder(object sender, System.Timers.ElapsedEventArgs e) {
if (Interlocked.Exchange(ref inTimer, 1) == 0)
{
LogHelper.Write("AutoCancelOrder=====Start");
Module.FinanceModule.AutoCancelOrder();
LogHelper.Write("AutoCancelOrder=====End");
Interlocked.Exchange(ref inTimer, 0);
}
}
/// <summary>
/// 自动收货订单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void AutoReceivingOrder(object sender, System.Timers.ElapsedEventArgs e)
{
if (Interlocked.Exchange(ref inTimer, 1) == 0)
{
if (DateTime.Now.Hour == 1)
{
LogHelper.Write("AutoReceivingOrder=====Start");
Module.FinanceModule.AutoReceivingOrder();
LogHelper.Write("AutoReceivingOrder=====End");
Interlocked.Exchange(ref inTimer, 0);
}
}
}
} }
} }
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="appsettings.json"> <Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
......
using Mall.Common; using Mall.Common;
using Mall.Common.Enum.Goods;
using Mall.Common.Plugin; using Mall.Common.Plugin;
using Mall.Model.Entity.Finance; using Mall.Model.Entity.Finance;
using Mall.Model.Extend.Finance; using Mall.Model.Extend.Finance;
using Mall.Model.Extend.Product; using Mall.Model.Extend.Product;
using Mall.Model.Extend.User;
using Mall.Repository;
using Mall.Repository.BaseSetUp;
using Mall.Repository.Finance; using Mall.Repository.Finance;
using Mall.Repository.Product; using Mall.Repository.Product;
using Mall.Repository.User;
using Mall.WindowsService.Helper; using Mall.WindowsService.Helper;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
...@@ -34,6 +39,40 @@ namespace Mall.WindowsService.Module ...@@ -34,6 +39,40 @@ namespace Mall.WindowsService.Module
/// 订单详情 /// 订单详情
/// </summary> /// </summary>
private static RB_Goods_OrderDetailRepository goodsOrderDetailRepository = new RB_Goods_OrderDetailRepository(); private static RB_Goods_OrderDetailRepository goodsOrderDetailRepository = new RB_Goods_OrderDetailRepository();
/// <summary>
/// 订单
/// </summary>
private static RB_Goods_OrderRepository goods_OrderRepository = new RB_Goods_OrderRepository();
/// <summary>
/// 基础配置
/// </summary>
private static RB_MallBaseRepository mallBaseRepository = new RB_MallBaseRepository();
/// <summary>
/// 订单日志
/// </summary>
private static RB_Goods_LogRepository goods_LogRepository = new RB_Goods_LogRepository();
/// <summary>
/// 商品
/// </summary>
private static RB_GoodsRepository goodsRepository = new RB_GoodsRepository();
/// <summary>
/// 商品规格价格
/// </summary>
private static RB_Goods_SpecificationPriceRepository goods_SpecificationPriceRepository = new RB_Goods_SpecificationPriceRepository();
/// <summary>
/// 会员
/// </summary>
private static RB_Member_UserRepository member_UserRepository = new RB_Member_UserRepository();
/// <summary>
/// 用户积分
/// </summary>
private static RB_Member_IntegralRepository member_IntegralRepository = new RB_Member_IntegralRepository();
/// <summary>
/// 优惠卷
/// </summary>
private static RB_Member_CouponRepository member_CouponRepository = new RB_Member_CouponRepository();
#region 收入 #region 收入
/// <summary> /// <summary>
...@@ -196,9 +235,296 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an ...@@ -196,9 +235,296 @@ and DATE_FORMAT(b.CreateDate,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') an
} }
#endregion #endregion
#region 成本
#endregion
#region 订单取消
/// <summary>
/// 自动取消订单
/// </summary>
/// <returns></returns>
public static bool AutoCancelOrder() {
try
{
var list = mallBaseRepository.GetListRepository(new Mall.Model.Extend.BaseSetUp.RB_MallBase_Extend() { });
foreach (var item in list)
{
if (item.CancelTime > 0)
{
//查询未付款的所有订单
var olist = goods_OrderRepository.GetCanCancelOrderList(item.CancelTime, item.TenantId, item.MallBaseId);
foreach (var qitem in olist)
{
try
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { };
keyValues.Add(nameof(RB_Goods_Order_Extend.OrderStatus), OrderStatusEnum.Cancel);
keyValues.Add(nameof(RB_Goods_Order_Extend.CancelTime), DateTime.Now);
#region 成本 List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.OrderId),
FiledValue=qitem.OrderId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.UserId),
FiledValue=qitem.UserId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.TenantId),
FiledValue=item.TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.MallBaseId),
FiledValue=item.MallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = goods_OrderRepository.Update(keyValues, wheres);
if (flag)
{
//回滚商品库存
if (true)
{
int tenantId = item.TenantId;
int mallBaseId = item.MallBaseId;
int TotalIntegralNumber = 0;
var detailList = goodsOrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = qitem.OrderId, TenantId = tenantId, MallBaseId = mallBaseId });
if (detailList.Any())
{
string goodsIds = string.Join(",", detailList.Select(x => x.GoodsId ?? 0).Distinct());
var goodsList = goodsRepository.GetList(new RB_Goods_Extend() { GoodsIds = goodsIds, TenantId = tenantId, MallBaseId = mallBaseId });
var speciPList = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsIds = goodsIds, TenantId = tenantId, MallBaseId = mallBaseId });
foreach (var ditem in detailList)
{
var gmodel = goodsList.Where(x => x.Id == ditem.GoodsId).FirstOrDefault();
if (gmodel == null)
{
continue;
}
if (string.IsNullOrEmpty(ditem.SpecificationSort))
{
if (gmodel.IsCustomSpecification == 1)
{
continue;
}
}
else
{
if (gmodel.IsCustomSpecification != 1)
{
continue;
}
var speciPModel = speciPList.Where(x => x.GoodsId == ditem.GoodsId && x.SpecificationSort == ditem.SpecificationSort).FirstOrDefault();
if (speciPModel == null)
{
continue;
}
//更新商品规格表库存 + 商品表总库存
Dictionary<string, object> keyValues2 = new Dictionary<string, object>() {
{ nameof(RB_Goods_SpecificationPrice_Extend.InventoryNum), (speciPModel.InventoryNum??0)+(ditem.Number??0)}
};
List<WhereHelper> wheres2 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_SpecificationPrice_Extend.Id),
FiledValue=speciPModel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goods_SpecificationPriceRepository.Update(keyValues2, wheres2);
}
//更新商品表库存
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_Extend.InventoryNum), (gmodel.InventoryNum??0)+(ditem.Number??0)}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_Extend.Id),
FiledValue=gmodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
goodsRepository.Update(keyValues1, wheres1);
goods_LogRepository.Insert(new Mall.Model.Entity.Product.RB_Goods_Log()
{
Id = 0,
Type = 2,
SourceId = ditem.GoodsId,
Content = $"取消订单{qitem.OrderId},还原商品库存:" + ditem.Number,
CreateDate = DateTime.Now,
MallBaseId = mallBaseId,
TenantId = tenantId
});
if (ditem.IntegralNumber > 0)
{
TotalIntegralNumber += (ditem.IntegralNumber ?? 0);
}
}
}
var umodel = member_UserRepository.GetEntity(qitem.UserId);
//积分抵扣回滚
if (TotalIntegralNumber > 0)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Member_User_Extend.Integral),umodel.Integral + TotalIntegralNumber}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Member_User_Extend.Id),
FiledValue=umodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag2 = member_UserRepository.Update(keyValues1, wheres1);
if (flag2)
{
member_IntegralRepository.Insert(new Mall.Model.Entity.User.RB_Member_Integral()
{
Id = 0,
CreateDate = DateTime.Now,
Description = "订单取消返回积分抵扣,订单号:" + qitem.OrderNo,
Image = 0,
Integral = TotalIntegralNumber,
MallBaseId = item.MallBaseId,
PlatformType = qitem.OrderSource,
Remarks = "",
TenantId = item.TenantId,
Type = Common.Enum.MarketingCenter.RecordTypeEnum.Income,
UserId = qitem.UserId,
OrderId = qitem.OrderId
});
}
}
//优惠券回滚
if (!string.IsNullOrEmpty(qitem.CouponsIds))
{
var cList = member_CouponRepository.GetList(new RB_Member_DiscountCoupon_Extend() { UseState = 1, Ids = qitem.CouponsIds, UserId = qitem.UserId, TenantId = item.TenantId, MallBaseId = item.MallBaseId });
foreach (var citem in cList)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Member_DiscountCoupon_Extend.UseState),0}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Member_DiscountCoupon_Extend.Id),
FiledValue=citem.Id,
OperatorEnum=OperatorEnum.Equal
}
};
member_CouponRepository.Update(keyValues1, wheres1);
}
}
//余额支付回滚
}
goods_LogRepository.Insert(new Mall.Model.Entity.Product.RB_Goods_Log()
{
Id = 0,
Type = 1,
SourceId = qitem.OrderId,
Content = "订单超时,自动取消订单",
CreateDate = DateTime.Now,
MallBaseId = item.MallBaseId,
TenantId = item.TenantId
});
}
}
catch (Exception ex)
{
Helper.LogHelper.Write("AutoCancelOrder:" + ex.Message);
continue;
}
}
}
}
return true;
}
catch (Exception ex)
{
Helper.LogHelper.Write("AutoCancelOrder:" + ex.Message);
return false;
}
}
#endregion
#region 自动收货
/// <summary>
/// 自动收货
/// </summary>
/// <returns></returns>
public static bool AutoReceivingOrder() {
try
{
var list = mallBaseRepository.GetListRepository(new Mall.Model.Extend.BaseSetUp.RB_MallBase_Extend() { });
foreach (var item in list)
{
if (item.AutoReceiving > 0)
{
//查询未付款的所有订单
var olist = goods_OrderRepository.GetCanReceivingOrderList(item.CancelTime, item.TenantId, item.MallBaseId);
foreach (var qitem in olist)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { };
keyValues.Add(nameof(RB_Goods_Order_Extend.OrderStatus), OrderStatusEnum.Received);
keyValues.Add(nameof(RB_Goods_Order_Extend.ReceivingTime), DateTime.Now);
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.OrderId),
FiledValue=qitem.OrderId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.UserId),
FiledValue=qitem.UserId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.TenantId),
FiledValue=item.TenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_Order_Extend.MallBaseId),
FiledValue=item.MallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = goods_OrderRepository.Update(keyValues, wheres);
if (flag)
{
goods_LogRepository.Insert(new Mall.Model.Entity.Product.RB_Goods_Log()
{
Id = 0,
Type = 1,
SourceId = qitem.OrderId,
Content = "系统自动确认收货",
CreateDate = DateTime.Now,
MallBaseId = item.MallBaseId,
TenantId = item.TenantId
});
}
}
}
}
return true;
}
catch (Exception ex)
{
Helper.LogHelper.Write("AutoCancelOrder:" + ex.Message);
return false;
}
}
#endregion #endregion
......
...@@ -12,6 +12,8 @@ namespace Mall.WindowsService ...@@ -12,6 +12,8 @@ namespace Mall.WindowsService
partial class WindowsService : ServiceBase partial class WindowsService : ServiceBase
{ {
System.Timers.Timer timer1; //计时器 System.Timers.Timer timer1; //计时器
private System.Timers.Timer timer2; //订单取消计时器
private System.Timers.Timer timer3; //订单自动收货计时器
public WindowsService() public WindowsService()
{ {
...@@ -27,6 +29,29 @@ namespace Mall.WindowsService ...@@ -27,6 +29,29 @@ namespace Mall.WindowsService
timer1.Interval = 1000 * (60 * 30); //60分钟 timer1.Interval = 1000 * (60 * 30); //60分钟
timer1.Elapsed += new System.Timers.ElapsedEventHandler(helper.RevenueFinance); timer1.Elapsed += new System.Timers.ElapsedEventHandler(helper.RevenueFinance);
timer1.Enabled = true; timer1.Enabled = true;
#region 订单取消定时器
timer2 = new System.Timers.Timer
{
Interval = 1000 * (60 * 10) //10分钟处理一次
};
timer2.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoCancelOrder);
timer2.Enabled = true;
#endregion
#region 订单自动完成定时器
timer3 = new System.Timers.Timer();
timer2 = new System.Timers.Timer
{
Interval = 1000 * (60 * 60) //60分钟调用一次
};
timer3.Elapsed += new System.Timers.ElapsedEventHandler(helper.AutoReceivingOrder);
timer3.Enabled = true;
#endregion
} }
protected override void OnStop() protected override void OnStop()
...@@ -34,6 +59,8 @@ namespace Mall.WindowsService ...@@ -34,6 +59,8 @@ namespace Mall.WindowsService
// TODO: 在此处添加代码以执行停止服务所需的关闭操作。 // TODO: 在此处添加代码以执行停止服务所需的关闭操作。
Helper.LogHelper.Write("主服务停止运行......"); Helper.LogHelper.Write("主服务停止运行......");
this.timer1.Enabled = false; this.timer1.Enabled = false;
this.timer2.Enabled = false;
this.timer3.Enabled = false;
} }
} }
} }
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