From 557c2711a3e103ebc3d0492344eca9730d5e92b2 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期一, 17 二月 2025 10:47:47 +0800
Subject: [PATCH] 增加司机配送单超时处理任务,防止一直不停手机定位信息,
---
CoreCms.Net.Services/Cart/CoreCmsCartServices.cs | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
index 87df3b3..706bf9e 100644
--- a/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
+++ b/CoreCms.Net.Services/Cart/CoreCmsCartServices.cs
@@ -12,10 +12,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.IServices;
+using CoreCms.Net.IServices.baifenbingfa;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
@@ -57,6 +59,8 @@
private readonly ICoreCmsSolitaireServices _solitaireServices;
private readonly ICoreCmsUserShipServices _userShipServices;
private readonly ICoreCmsStoreServices _storeServices;
+ private readonly IBfbfComAPIService _bfbfComAPIService;
+ private readonly IHttpContextUser _user;
public CoreCmsCartServices(
ICoreCmsCartRepository dal
@@ -69,7 +73,17 @@
, ICoreCmsUserServices userServices
, ICoreCmsSettingServices settingServices
, ICoreCmsProductsServices productsServices
- , ICoreCmsPinTuanGoodsServices pinTuanGoodsServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsGoodsServices goodsServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsPromotionResultServices promotionResultServices, ICoreCmsPinTuanRecordServices pinTuanRecordServices, ICoreCmsSolitaireServices solitaireServices, ICoreCmsUserShipServices userShipServices, ICoreCmsStoreServices storeServices)
+ , ICoreCmsPinTuanGoodsServices pinTuanGoodsServices
+ , IBfbfComAPIService bfbfComAPIService
+ ,ICoreCmsPromotionConditionServices promotionConditionServices
+ , ICoreCmsGoodsServices goodsServices
+ , ICoreCmsGoodsCategoryServices goodsCategoryServices
+ , ICoreCmsPromotionResultServices promotionResultServices
+ , ICoreCmsPinTuanRecordServices pinTuanRecordServices
+ , ICoreCmsSolitaireServices solitaireServices
+ , ICoreCmsUserShipServices userShipServices
+ , ICoreCmsStoreServices storeServices
+ ,IHttpContextUser user)
{
this._dal = dal;
base.BaseDal = dal;
@@ -92,6 +106,8 @@
_solitaireServices = solitaireServices;
_userShipServices = userShipServices;
_storeServices = storeServices;
+ _bfbfComAPIService = bfbfComAPIService;
+ _user = user;
}
#region 璁剧疆璐墿杞﹀晢鍝佹暟閲�====================================================
@@ -104,6 +120,7 @@
/// <param name="userId"></param>
/// <param name="numType"></param>
/// <param name="type"></param>
+ /// <param name="isCustomizable"></param>
/// <returns></returns>
public async Task<WebApiCallBack> SetCartNum(int id, int nums, int userId, int numType, int type = 1)
{
@@ -129,7 +146,7 @@
jm.msg = "鑾峰彇璐墿杞︽暟鎹け璐�";
return jm;
}
- var outData = await Add(userId, cartModel.productId, nums, numType, type);
+ var outData = await Add(userId, cartModel.productId, nums, numType, type,isCustomizable:cartModel.isCustomizable);
jm.status = outData.status;
jm.msg = jm.status ? GlobalConstVars.SetDataSuccess : GlobalConstVars.SetDataFailure;
jm.otherData = outData;
@@ -179,8 +196,9 @@
/// <param name="numType">鏁伴噺绫诲瀷/1鏄洿鎺ュ鍔�/2鏄祴鍊�</param>
/// <param name="cartTypes">1鏅�氳喘鐗╄繕鏄�2鍥㈣喘绉掓潃3鍥㈣喘妯″紡4绉掓潃妯″紡6鐮嶄环妯″紡7璧犲搧</param>
/// <param name="objectId">鍏宠仈瀵硅薄绫诲瀷</param>
+ /// <param name="isCustomizable">鍏宠仈瀵硅薄绫诲瀷</param>
/// <returns></returns>
- public async Task<WebApiCallBack> Add(int userId, int productId, int nums, int numType, int cartTypes = 1, int objectId = 0)
+ public async Task<WebApiCallBack> Add(int userId, int productId, int nums, int numType, int cartTypes = 1, int objectId = 0,bool isCustomizable = false)
{
var jm = new WebApiCallBack();
@@ -206,6 +224,11 @@
if (products == null)
{
jm.msg = "鑾峰彇璐у搧淇℃伅澶辫触";
+ return jm;
+ }
+ if(isCustomizable==true&&products.isCustomizable!=true)
+ {
+ jm.msg = "璇ヨ揣鐗╀笉鏀寔瀹氬埗";
return jm;
}
//鍒ゆ柇鏄惁涓嬫灦
@@ -298,7 +321,9 @@
productId = productId,
nums = nums,
type = cartTypes,
- objectId = objectId
+ objectId = objectId,
+ //鏀寔瀹氬埗
+ isCustomizable= isCustomizable,
};
var outId = await _dal.InsertAsync(catInfo);
jm.status = outId > 0;
@@ -338,6 +363,7 @@
/// <param name="userId">鐢ㄦ埛搴忓垪</param>
/// <param name="nums">鍔犲叆璐墿杞︽暟閲�</param>
/// <param name="ruleId">瑙勫垯搴忓垪</param>
+ /// <param name="ruleId">璐у搧鏄惁瀹氬埗</param>
public async Task<WebApiCallBack> AddCartHavePinTuan(int productId, int userId = 0, int nums = 1, int ruleId = 0)
{
var jm = new WebApiCallBack();
@@ -496,6 +522,7 @@
cartProducts.type = item.type;
cartProducts.weight = goodsWeight;
cartProducts.products = productInfo;
+ cartProducts.isCustomizable = item.isCustomizable;
//濡傛灉浼犺繃鏉ヤ簡璐墿杞︽暟鎹紝灏辩畻鎸囧畾鐨勮喘鐗╄溅鐨勬暟鎹紝鍚﹀垯锛屽氨绠楀叏閮ㄨ喘鐗╄溅鐨勬暟鎹�
if (ids != null && ids.Any() && ids.Contains(item.id))
{
@@ -515,6 +542,16 @@
{
case (int)GlobalEnumVars.OrderType.Common:
//鏍囧噯妯″紡涓嶉渶瑕佷慨鏀硅鍗曟暟鎹拰鍟嗗搧鏁版嵁
+ {
+ if(await _bfbfComAPIService.IsDictionary(_user.ID))
+ {
+ foreach (var item in cartDto.list)
+ {
+ item.products.price=item.products.distributionPrice;
+
+ }
+ }
+ }
break;
case (int)GlobalEnumVars.OrderType.PinTuan:
//鎷煎洟妯″紡璧版嫾鍥环锛屽幓淇敼鍟嗗搧浠锋牸
@@ -605,6 +642,13 @@
}
//鍗曟潯鍟嗗搧鎬讳环
item.products.amount = Math.Round(item.nums * (decimal)item.products.price, 2);
+ //瀹氬埗鍟嗗搧娣诲姞瀹氬埗浠锋牸
+ if (item.isCustomizable)
+ //鏄畾鍒跺晢鍝�
+ {
+ item.products.amount += _bfbfComAPIService.CommandCustomizable(item.nums);
+ item.CustomizableMoney = _bfbfComAPIService.CommandCustomizable(item.nums);
+ }
if (item.isSelect)
{
--
Gitblit v1.9.1