From 80aa425c4ca51f7c0224a6245968cdd08940321b Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期四, 13 六月 2024 10:17:30 +0800
Subject: [PATCH] 修改校园代理 完成
---
CoreCms.Net.Model/Entities/baifenbingfa/DistributionSend/DistributionSendOder.cs | 71 +++
CoreCms.Net.Services/baifenbingfa/DistributorDeliveryServices.cs | 204 +++++++++
CoreCms.Net.Web.Admin/wwwroot/views/order/orders/edit.html | 53 ++
CoreCms.Net.Web.WebApi/Controllers/PinTuanController.cs | 1
CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs | 89 +++
CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs | 85 ++++
CoreCms.Net.Web.Admin/wwwroot/views/order/orders/details.html | 4
CoreCms.Net.Configuration/GlobalConstVars.cs | 12
CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs | 5
CoreCms.Net.Services/CoreCms.Net.Services.csproj | 1
CoreCms.Net.Web.Admin/wwwroot/views/order/orders/distribution.html | 2
CoreCms.Net.Web.Admin/wwwroot/views/order/orders/union.html | 6
CoreCms.Net.DTO/CoreCms.Net.DTO.csproj | 4
CoreCms.Net.Model/FromBody/FMOrder.cs | 5
CoreCms.Net.Web.Admin/wwwroot/views/order/billdelivery/details.html | 8
CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsBillDeliveryController.cs | 42 +
CoreCms.Net.Web.Admin/wwwroot/views/shop/store/edit.html | 1
CoreCms.Net.Model/Entities/Order/CoreCmsOrderItem.cs | 3
CoreCms.Net.Web.Admin/wwwroot/views/order/orders/shopping.html | 2
CoreCms.Net.Model/Entities/baifenbingfa/puhuo/Puhuo.cs | 2
CoreCms.Net.Web.Admin/wwwroot/views/order/orders/index.html | 23 +
CoreCms.Net.Utility/Extensions/ObjectExtensions.cs | 15
CoreCms.Net.Model/Entities/Order/CoreCmsOrderPartial.cs | 7
CoreCms.Net.Model/Entities/Order/CoreCmsOrder.cs | 23
CoreCms.Net.Model/Entities/Bill/CoreCmsBillDeliveryPartial.cs | 11
CoreCms.Net.RedisMQ/CoreCms.Net.RedisMQ.csproj | 1
CoreCms.Net.IServices/Order/ICoreCmsOrderServices.cs | 6
CoreCms.Net.Model/Entities/Cart/CoreCmsCart.cs | 2
CoreCms.Net.Services/Order/CoreCmsOrderServices.cs | 41 +
CoreCms.Net.IServices/baifenbingfa/IBfbfComAPIService.cs | 32 +
CoreCms.Net.Web.WebApi/Controllers/UserController.cs | 19
CoreCms.Net.Web.Admin/wwwroot/views/order/orders/ship.html | 33 +
CoreCms.Net.Services/Bill/CoreCmsBillDeliveryServices.cs | 62 ++
CoreCms.Net.Configuration/SystemSettingDictionary.cs | 1
CoreCms.Net.Model/Entities/Good/CoreCmsProducts.cs | 2
CoreCms.Net.DTO/BaifenBingFaDto.cs | 35 +
CoreCms.Net.Web.WebApi/Controllers/baifenbingfa/DistributorDeliveryController.cs | 94 ++++
CoreCms.Net.Model/Entities/Bill/CoreCmsBillDelivery.cs | 73 +++
CoreCms.Net.RedisMQ/DistributionSendOderMQ.cs | 77 +++
CoreCms.Net.Model/Entities/Distribution/CoreCmsDistribution.cs | 4
CoreCms.Net.IServices/Bill/ICoreCmsBillDeliveryServices.cs | 4
CoreCms.Net.IServices/baifenbingfa/IDistributorDeliveryServices.cs | 69 +++
42 files changed, 1,168 insertions(+), 66 deletions(-)
diff --git a/CoreCms.Net.Configuration/GlobalConstVars.cs b/CoreCms.Net.Configuration/GlobalConstVars.cs
index a70151c..2033d4f 100644
--- a/CoreCms.Net.Configuration/GlobalConstVars.cs
+++ b/CoreCms.Net.Configuration/GlobalConstVars.cs
@@ -424,6 +424,18 @@
/// </summary>
public const string DistributionAchievementOder = "DistributionAchievementOder";
+
+
+ /// <summary>
+ /// 澧炲姞缁忛攢鍟嗗垎閰嶈褰曡〃
+ /// </summary>
+ public const string AddDistributionSendOderMQ = "AddDistributionSendOderMQ";
+
+ /// <summary>
+ /// 淇敼缁忛攢鍟嗗垎閰嶈褰曡〃鍒嗛厤璁板綍
+ /// </summary>
+ public const string ActiveDistributionSendOderMQ = "ActiveDistributionSendOderMQ";
+
}
/// <summary>
diff --git a/CoreCms.Net.Configuration/SystemSettingDictionary.cs b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
index 9bc34fb..578fa8e 100644
--- a/CoreCms.Net.Configuration/SystemSettingDictionary.cs
+++ b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
@@ -336,6 +336,7 @@
{
new CommonKeyValues() {sDescription = "鏈湴鍚屽煄閰嶉��", sValue = "鏃�", sKey = "benditongcheng"},
new CommonKeyValues() {sDescription = "鏈湴涓婇棬鑷彁", sValue = "鏃�", sKey = "shangmenziti"},
+ new CommonKeyValues() {sDescription = "渚涘簲鍟嗛�佽揣", sValue = "鏃�", sKey = "Distributor"},
};
return list;
}
diff --git a/CoreCms.Net.DTO/BaifenBingFaDto.cs b/CoreCms.Net.DTO/BaifenBingFaDto.cs
new file mode 100644
index 0000000..03b9b23
--- /dev/null
+++ b/CoreCms.Net.DTO/BaifenBingFaDto.cs
@@ -0,0 +1,35 @@
+锘縰sing CoreCms.Net.Model.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CoreCms.Net.DTO
+{
+ /// <summary>
+ /// ActiveDistributionSendOder mq妯″瀷
+ /// </summary>
+ public class ActiveDistributionSendOderMQ
+ {
+ /// <summary>
+ /// 璁㈠崟鐘舵��
+ /// </summary>
+ public sendDistributionAcceptType? SendOderActive { get; set; }
+ /// <summary>
+ /// 鎻忚堪
+ /// </summary>
+ public string? Dec { get; set; }
+
+ /// <summary>
+ /// 鍙戦�佸崟ID
+ /// </summary>
+ public string deliveryID { get; set; }
+
+ /// <summary>
+ /// 鎵�灞炵敤鎴稩D
+ /// </summary>
+ public int userID { get; set; }
+
+ }
+}
diff --git a/CoreCms.Net.DTO/CoreCms.Net.DTO.csproj b/CoreCms.Net.DTO/CoreCms.Net.DTO.csproj
index 938d50a..f738a70 100644
--- a/CoreCms.Net.DTO/CoreCms.Net.DTO.csproj
+++ b/CoreCms.Net.DTO/CoreCms.Net.DTO.csproj
@@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\CoreCms.Net.Model\CoreCms.Net.Model.csproj" />
+ </ItemGroup>
+
</Project>
diff --git a/CoreCms.Net.IServices/Bill/ICoreCmsBillDeliveryServices.cs b/CoreCms.Net.IServices/Bill/ICoreCmsBillDeliveryServices.cs
index 97aa77c..d9ad018 100644
--- a/CoreCms.Net.IServices/Bill/ICoreCmsBillDeliveryServices.cs
+++ b/CoreCms.Net.IServices/Bill/ICoreCmsBillDeliveryServices.cs
@@ -38,7 +38,7 @@
/// <returns></returns>
Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items,
int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "",
- string memo = "", string deliveryCompanyId = "");
+ string memo = "", string deliveryCompanyId = "", int? sendDistributionID = null);
/// <summary>
@@ -58,7 +58,7 @@
/// <returns></returns>
Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items,
int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "",
- string memo = "", string deliveryCompanyId = "");
+ string memo = "", string deliveryCompanyId = "", int? sendDistributionID = null);
/// <summary>
diff --git a/CoreCms.Net.IServices/Order/ICoreCmsOrderServices.cs b/CoreCms.Net.IServices/Order/ICoreCmsOrderServices.cs
index 28bdc99..c13c235 100644
--- a/CoreCms.Net.IServices/Order/ICoreCmsOrderServices.cs
+++ b/CoreCms.Net.IServices/Order/ICoreCmsOrderServices.cs
@@ -215,10 +215,11 @@
/// <param name="storeId">搴楅摵鏀惰揣鍦板潃</param>
/// <param name="shipAreaId">鐪佸競鍖篿d</param>
/// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
+ /// <param name="deliveryCompanyId">閫佽揣缁忛攢鍟咺D</param>
/// <returns></returns>
Task<WebApiCallBack> BatchShip(string[] ids, string logiCode, string logiNo,
Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo,
- int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "");
+ int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "",int? sendDistributionID=null);
/// <summary>
/// 璁㈠崟鍙戣揣
@@ -234,10 +235,11 @@
/// <param name="storeId">搴楅摵鏀惰揣鍦板潃</param>
/// <param name="shipAreaId">鐪佸競鍖篿d</param>
/// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
+ /// <param name="sendDistributionID">閫佽揣缁忛攢鍟咺D</param>
/// <returns></returns>
Task<WebApiCallBack> Ship(string ids, string logiCode, string logiNo,
Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo,
- int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "");
+ int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null);
/// <summary>
diff --git a/CoreCms.Net.IServices/baifenbingfa/IBfbfComAPIService.cs b/CoreCms.Net.IServices/baifenbingfa/IBfbfComAPIService.cs
index 2ee3dff..ca738dc 100644
--- a/CoreCms.Net.IServices/baifenbingfa/IBfbfComAPIService.cs
+++ b/CoreCms.Net.IServices/baifenbingfa/IBfbfComAPIService.cs
@@ -38,7 +38,37 @@
/// </summary>
/// <param name="count"></param>
/// <returns></returns>
- public decimal CommandCustomizable(int count);
+ decimal CommandCustomizable(int count);
+
+ /// <summary>
+ /// 鏍规嵁缁忕含搴﹀鍒楄〃杩涜杩滆繎璺濈鎺掑簭
+ /// </summary>
+ /// <param name="DataList"></param>
+ /// <param name="longitude"></param>
+ /// <param name="latitude"></param>
+ /// <returns></returns>
+ List<DistributorSort> orderedDistributors(List<DistributorSort> DataList,string longitude,string latitude);
+
+ /// <summary>
+ /// 鑾峰彇鏍″洯浠g悊鍒楄〃 鏍规嵁璐у搧ID鑾峰彇宸茬粡閾鸿揣鐨勬牎鍥唬鐞嗗垪琛�
+ /// </summary>
+ /// <returns></returns>
+ Task<List<DistributorSort>> GetDistributorsList(List<int > PIds);
+ /// <summary>
+ /// 鑾峰彇璁㈠崟鐨勬墍鏈夎揣鍝両D
+ /// </summary>
+ /// <param name="OderIds"></param>
+ /// <returns></returns>
+ public Task<List<int>> GetOderProductsIDs(string[] OderIds);
+
+ }
+
+ public class DistributorSort
+ {
+ public int id { get; set; }
+ public string name { get; set; }
+ public string longitude { get; set; }
+ public string latitude { get; set; }
}
diff --git a/CoreCms.Net.IServices/baifenbingfa/IDistributorDeliveryServices.cs b/CoreCms.Net.IServices/baifenbingfa/IDistributorDeliveryServices.cs
new file mode 100644
index 0000000..9f96c8a
--- /dev/null
+++ b/CoreCms.Net.IServices/baifenbingfa/IDistributorDeliveryServices.cs
@@ -0,0 +1,69 @@
+锘縰sing CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static CoreCms.Net.Configuration.GlobalEnumVars;
+
+namespace CoreCms.Net.IServices.baifenbingfa
+{
+ /// <summary>
+ /// 缁忛攢鍟嗗彂璐х浉鍏虫湇鍔�
+ /// </summary>
+ public interface IDistributorDeliveryServices
+ {
+ /// <summary>
+ /// 鑾峰彇缁忛攢鍟嗗彂璐ф湭澶勭悊璁㈠崟
+ /// </summary>
+ /// <returns></returns>
+ Task< int> GetNoAcceptedDeliveryCount();
+
+ /// <summary>
+ /// 鏄惁鏄剧ず缁忛攢鍟嗚彍鍗曢」
+ /// </summary>
+ /// <returns></returns>
+ Task<bool> GetShowDelivery();
+
+ /// <summary>
+ /// 鑾峰彇鎵�鏈夎鍗�
+ /// </summary>
+ /// <param name="Param"></param>
+ /// <returns>
+ /// </returns>
+ Task<(List<CoreCmsBillDelivery>, int)> GetDeliveryList(GetDeliveryListPost Param);
+ /// <summary>
+ /// 璁剧疆璁㈠崟鐘舵��
+ /// </summary>
+ /// <param name="acceptType"> 鍚屾剰绫诲瀷</param>
+ /// <param name="DeliveryID">閰嶉�佸崟ID</param>
+ /// <param name="CancelledDec">鍙栨秷鍘熷洜</param>
+ /// <returns></returns>
+ Task<WebApiCallBack> SetDeliveryAccepted(sendDistributionAcceptType acceptType,string DeliveryID,string CancelledDec= null);
+ }
+
+
+ public class GetDeliveryListPost
+ {
+ /// <summary>
+ /// 姣忛〉鏁伴噺
+ /// </summary>
+ public int limit { get; set; } = 5;
+
+ /// <summary>
+ /// 椤电爜
+ /// </summary>
+ public int page { get; set; } = 1;
+
+ /// <summary>
+ /// 缁忛攢鍟嗙‘璁ょ姸鎬�
+ /// </summary>
+ public sendDistributionAcceptType? distributionAcceptStatus { get; set; }
+ /// <summary>
+ /// 璁㈠崟鐘舵��
+ /// </summary>
+ public BillDeliveryStatus? Status { get; set; }
+}
+}
diff --git a/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDelivery.cs b/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDelivery.cs
index 30b569e..00d00db 100644
--- a/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDelivery.cs
+++ b/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDelivery.cs
@@ -8,6 +8,7 @@
* Description: 鏆傛棤
***********************************************************************/
+using Chuanyin.Attribute;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
@@ -16,7 +17,7 @@
{
/// <summary>
/// 鍙戣揣鍗曡〃
- /// </summary>
+ /// </summary>
public partial class CoreCmsBillDelivery
{
/// <summary>
@@ -218,7 +219,73 @@
public System.DateTime? updateTime { get; set; }
-
-
+
+ /// <summary>
+ /// SendDistributionID 鍙戣揣缁忛攢鍟咺D
+ /// </summary>
+ [SugarColumn(ColumnDescription = "鍙戣揣缁忛攢鍟咺D")]
+ public int? sendDistributionID { get; set; }
+
+ /// <summary>
+ /// 閫佽揣浠g悊鍟嗙敤鎴稩D
+ /// </summary>
+ public int? sendDistributionUserID { get; set; }
+
+ /// <summary>
+ /// sendDistributionAccept 缁忛攢鍟嗗彂璐х‘璁ょ姸鎬�
+ /// </summary>
+ [SugarColumn(ColumnDescription = "缁忛攢鍟嗗彂璐х‘璁ょ姸鎬�")]
+ public sendDistributionAcceptType? sendDistributionAccept { get; set; }
+
+
+
+
}
+ /// <summary>
+ /// 渚涘簲鍟嗛�佽揣纭鐘舵��
+ /// </summary>
+ public enum sendDistributionAcceptType
+ {
+
+ /// <summary>
+ /// 璁㈠崟宸茶鍒涘缓锛岀瓑寰呭鐞嗐��
+ /// </summary>
+ [Description("鎺ュ彈")]
+ Accepted,
+
+ /// <summary>
+ /// 璁㈠崟鍟嗗搧宸叉墦鍖咃紝鍑嗗鎴栧凡缁忓彂鍑恒��
+ /// </summary>
+ [Description("鍙戣揣")]
+ Shipped,
+
+ /// <summary>
+ /// 璁㈠崟鍟嗗搧宸叉垚鍔熼�佽揪瀹㈡埛鎵嬩腑銆�
+ /// </summary>
+ [Description("閫佽揪")]
+ Delivered,
+
+ /// <summary>
+ /// 璁㈠崟琚敤鎴锋垨绯荤粺鍙栨秷銆�
+ /// </summary>
+ [Description("鍙栨秷")]
+ Cancelled,
+
+ /// <summary>
+ /// 璁㈠崟澶勭悊瓒呰繃浜嗛瀹氱殑鏃堕棿闄愬埗锛岃嚜鍔ㄥ彇娑堛��
+ /// </summary>
+ [Description("瓒呮椂")]
+ TimedOut,
+
+ /// <summary>
+ /// 绛夊緟纭鎺ュ彈
+ /// </summary>
+ [Description("绛夊緟纭鎺ュ彈")]
+ NoAccted,
+
+
+
+ }
+
+
}
diff --git a/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDeliveryPartial.cs b/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDeliveryPartial.cs
index 4739b8a..3ebc1f6 100644
--- a/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDeliveryPartial.cs
+++ b/CoreCms.Net.Model/Entities/Bill/CoreCmsBillDeliveryPartial.cs
@@ -32,5 +32,16 @@
[SugarColumn(IsIgnore = true)]
public System.String shipAreaIdName { get; set; }
+
+ /// <summary>
+ /// 鍟嗗搧鍒楄〃
+ /// </summary>
+ [Navigate(NavigateType.OneToOne,nameof(orderId))]
+ public CoreCmsOrder? order { get; set; }
+ /// <summary>
+ /// sendDistributionAccept 缁忛攢鍟嗗彂璐х‘璁ょ姸鎬佸瓧绗︿覆鎻忚堪
+ /// </summary>
+ [SugarColumn(IsIgnore =true)]
+ public string distributionAcceptStr { get; set; }
}
}
diff --git a/CoreCms.Net.Model/Entities/Cart/CoreCmsCart.cs b/CoreCms.Net.Model/Entities/Cart/CoreCmsCart.cs
index 80a1550..04b8662 100644
--- a/CoreCms.Net.Model/Entities/Cart/CoreCmsCart.cs
+++ b/CoreCms.Net.Model/Entities/Cart/CoreCmsCart.cs
@@ -17,7 +17,7 @@
/// <summary>
/// 璐墿杞﹁〃
/// </summary>
- [SqlCodeFirst]
+
public class CoreCmsCart
{
/// <summary>
diff --git a/CoreCms.Net.Model/Entities/Distribution/CoreCmsDistribution.cs b/CoreCms.Net.Model/Entities/Distribution/CoreCmsDistribution.cs
index a38ccf3..c84bff4 100644
--- a/CoreCms.Net.Model/Entities/Distribution/CoreCmsDistribution.cs
+++ b/CoreCms.Net.Model/Entities/Distribution/CoreCmsDistribution.cs
@@ -17,7 +17,7 @@
/// 缁忛攢鍟嗚〃
/// </summary>
[SugarTable("CoreCmsDistribution",TableDescription = "缁忛攢鍟嗚〃")]
- [SqlCodeFirst]
+
public partial class CoreCmsDistribution
{
/// <summary>
@@ -167,7 +167,7 @@
[SugarColumn(ColumnDescription = "鎵�灞炶涓�")]
public string profession { get; set; }
/// <summary>
- /// 搴楅摵鍋氭爣鐗�
+ /// 搴楅摵瀹氫綅
/// </summary>
[Display(Name = "搴楅摵瀹氫綅")]
[SugarColumn(ColumnDescription = "搴楅摵瀹氫綅", IsNullable =true)]
diff --git a/CoreCms.Net.Model/Entities/Good/CoreCmsProducts.cs b/CoreCms.Net.Model/Entities/Good/CoreCmsProducts.cs
index 72b923a..8afe4af 100644
--- a/CoreCms.Net.Model/Entities/Good/CoreCmsProducts.cs
+++ b/CoreCms.Net.Model/Entities/Good/CoreCmsProducts.cs
@@ -18,7 +18,7 @@
/// <summary>
/// 璐у搧琛�
/// </summary>
- [SqlCodeFirst]
+
public partial class CoreCmsProducts
{
/// <summary>
diff --git a/CoreCms.Net.Model/Entities/Order/CoreCmsOrder.cs b/CoreCms.Net.Model/Entities/Order/CoreCmsOrder.cs
index 10c964c..d9e1bd7 100644
--- a/CoreCms.Net.Model/Entities/Order/CoreCmsOrder.cs
+++ b/CoreCms.Net.Model/Entities/Order/CoreCmsOrder.cs
@@ -8,6 +8,7 @@
* Description: 鏆傛棤
***********************************************************************/
+using Chuanyin.Attribute;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
@@ -17,6 +18,7 @@
/// <summary>
/// 璁㈠崟琛�
/// </summary>
+
public partial class CoreCmsOrder
{
/// <summary>
@@ -175,11 +177,9 @@
/// <summary>
/// 閰嶉�佹柟寮忓悕绉�
/// </summary>
- [Display(Name = "閰嶉�佹柟寮忓悕绉�")]
-
+ [Display(Name = "閰嶉�佹柟寮忓悕绉�")]
- [StringLength(maximumLength:50,ErrorMessage = "{0}涓嶈兘瓒呰繃{1}瀛�")]
-
+ [StringLength(maximumLength:50,ErrorMessage = "{0}涓嶈兘瓒呰繃{1}瀛�")]
public System.String logisticsName { get; set; }
@@ -278,8 +278,13 @@
public System.String shipAddress { get; set; }
-
-
+
+ /// <summary>
+ /// 鏀惰揣鍦板潃瀹氫綅
+ /// </summary>
+ [Display(Name = "鏀惰揣鍦板潃瀹氫綅")]
+ [SugarColumn(ColumnDescription = "鏀惰揣鍦板潃瀹氫綅",IsNullable = true)]
+ public System.String shipCoordinate { get; set; }
/// <summary>
/// 鏀惰揣浜哄鍚�
/// </summary>
@@ -543,11 +548,6 @@
/// 鏇存柊鏃堕棿
/// </summary>
[Display(Name = "鏇存柊鏃堕棿")]
-
-
-
-
-
public System.DateTime? updateTime { get; set; }
@@ -557,7 +557,6 @@
/// 璁″垝璁㈠崟id ALTER TABLE [CoreCmsOrder] ADD [planorderId] [nvarchar](255) NULL;
/// </summary>
[Display(Name = "璁″垝璁㈠崟id")]
-
[StringLength(maximumLength: 255, ErrorMessage = "{0}涓嶈兘瓒呰繃{1}瀛�")]
[SugarColumn(IsNullable = true)]
diff --git a/CoreCms.Net.Model/Entities/Order/CoreCmsOrderItem.cs b/CoreCms.Net.Model/Entities/Order/CoreCmsOrderItem.cs
index 3f20306..e82337d 100644
--- a/CoreCms.Net.Model/Entities/Order/CoreCmsOrderItem.cs
+++ b/CoreCms.Net.Model/Entities/Order/CoreCmsOrderItem.cs
@@ -16,8 +16,7 @@
/// <summary>
/// 璁㈠崟鏄庣粏琛�
/// </summary>
- [SugarTable("CoreCmsOrderItem",TableDescription = "璁㈠崟鏄庣粏琛�")]
- [SqlCodeFirst]
+ [SugarTable("CoreCmsOrderItem",TableDescription = "璁㈠崟鏄庣粏琛�")]
public partial class CoreCmsOrderItem
{
/// <summary>
diff --git a/CoreCms.Net.Model/Entities/Order/CoreCmsOrderPartial.cs b/CoreCms.Net.Model/Entities/Order/CoreCmsOrderPartial.cs
index 3d2ea81..58219d8 100644
--- a/CoreCms.Net.Model/Entities/Order/CoreCmsOrderPartial.cs
+++ b/CoreCms.Net.Model/Entities/Order/CoreCmsOrderPartial.cs
@@ -23,8 +23,13 @@
/// 璁㈠崟璇︽儏
/// </summary>
[SugarColumn(IsIgnore = true)]
+
public List<CoreCmsOrderItem> items { get; set; }
-
+ /// <summary>
+ /// 瀛愭煡璇�
+ /// </summary>
+ [Navigate(NavigateType.OneToMany, nameof(CoreCmsOrderItem.orderId), nameof(orderId))]
+ public List<CoreCmsOrderItem> Orderitems { get; set; }
/// <summary>
/// 鐢ㄦ埛淇℃伅
/// </summary>
diff --git a/CoreCms.Net.Model/Entities/baifenbingfa/DistributionSend/DistributionSendOder.cs b/CoreCms.Net.Model/Entities/baifenbingfa/DistributionSend/DistributionSendOder.cs
new file mode 100644
index 0000000..13e4497
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/baifenbingfa/DistributionSend/DistributionSendOder.cs
@@ -0,0 +1,71 @@
+锘縰sing Chuanyin.Attribute;
+using CoreCms.Net.Model.Entities.baseModel;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CoreCms.Net.Model.Entities.baifenbingfa.DistributionSendOder
+{
+ /// <summary>
+ /// 渚涘簲鍟嗗彂璐ч厤鍙戣褰�
+ /// </summary>
+ [SugarTable(TableDescription = "渚涘簲鍟嗗彂璐ч厤鍙戣褰�")]
+ [SqlCodeFirst]
+ public class DistributionSendOder: BFBaseModel
+ {
+ /// <summary>
+ /// ID
+ /// </summary>
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭ID")]
+ public int id { get; set; }
+ /// <summary>
+ /// 鍒嗛厤渚涘簲鍟嗙敤鎴稩D
+ /// </summary>
+ [SugarColumn(ColumnDescription = "鍒嗛厤渚涘簲鍟嗙敤鎴稩D", IsNullable =true)]
+ public int? userID { get; set; }
+ /// <summary>
+ /// 鍒嗛厤渚涘簲鍟咺D
+ /// </summary>
+ [SugarColumn(ColumnDescription = "鍒嗛厤渚涘簲鍟咺D")]
+ public int distributionID { get; set; }
+
+ /// <summary>
+ /// 鍒嗛厤鏃堕棿
+ /// </summary>
+ [SugarColumn(ColumnDescription = "鍒嗛厤鏃堕棿", IsNullable = true)]
+ public DateTime? sendTime { get; set; }
+
+ /// <summary>
+ /// 纭鏃堕棿
+ /// </summary>
+ [SugarColumn(ColumnDescription = "纭鏃堕棿", IsNullable = true)]
+ public DateTime? activeTime { get; set; }
+
+
+ /// <summary>
+ /// 鍘熷洜
+ /// </summary>
+ [SugarColumn(ColumnDescription = "鍘熷洜", IsNullable = true)]
+ public string description { get; set; }
+
+ /// <summary>
+ /// 鍒嗛厤鎿嶄綔鍛業D
+ /// </summary>
+ [SugarColumn(ColumnDescription = "鍒嗛厤鎿嶄綔鍛業D", IsNullable = true)]
+ public int? sendMangerID { get; set; }
+ /// <summary>
+ /// 閰嶉�佸崟ID
+ /// </summary>
+ [SugarColumn(ColumnDescription = "閰嶉�佸崟Id")]
+ public string deliveryID { get; set; }
+
+ /// <summary>
+ /// 閰嶉�佺姸鎬�
+ /// </summary>
+ [SugarColumn(ColumnDescription = "閰嶉�佺姸鎬�",IsNullable =true)]
+ public sendDistributionAcceptType? sendDistributionAccept { get; set; }
+ }
+}
diff --git a/CoreCms.Net.Model/Entities/baifenbingfa/puhuo/Puhuo.cs b/CoreCms.Net.Model/Entities/baifenbingfa/puhuo/Puhuo.cs
index 0576a67..ddd39ef 100644
--- a/CoreCms.Net.Model/Entities/baifenbingfa/puhuo/Puhuo.cs
+++ b/CoreCms.Net.Model/Entities/baifenbingfa/puhuo/Puhuo.cs
@@ -14,7 +14,7 @@
/// <summary>
/// 閾鸿揣
/// </summary>
- [SqlCodeFirst]
+
public class Puhuo : BFBaseModel
{
/// <summary>
diff --git a/CoreCms.Net.Model/FromBody/FMOrder.cs b/CoreCms.Net.Model/FromBody/FMOrder.cs
index 5eafb59..fdd4365 100644
--- a/CoreCms.Net.Model/FromBody/FMOrder.cs
+++ b/CoreCms.Net.Model/FromBody/FMOrder.cs
@@ -98,6 +98,11 @@
/// 澶囨敞
/// </summary>
public string memo { get; set; }
+
+ /// <summary>
+ /// 鏍″洯浠g悊SendDistributionID
+ /// </summary>
+ public int? SendDistributionID { get; set; }
}
diff --git a/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs b/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs
index c6a256a..e38ac5d 100644
--- a/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs
+++ b/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs
@@ -439,6 +439,11 @@
public string logisticsName { get; set; }
public List<CoreCmsOrderItem> items { get; set; }
public List<CoreCmsOrder> orders { get; set; }
+ /// <summary>
+ /// 瀹氫綅淇℃伅锛岀敤閫楀彿鍒嗗壊
+ /// liao20240605
+ /// </summary>
+ public string? Coordinate { get; set; }
}
/// <summary>
diff --git a/CoreCms.Net.RedisMQ/CoreCms.Net.RedisMQ.csproj b/CoreCms.Net.RedisMQ/CoreCms.Net.RedisMQ.csproj
index afc9ef8..eb437cc 100644
--- a/CoreCms.Net.RedisMQ/CoreCms.Net.RedisMQ.csproj
+++ b/CoreCms.Net.RedisMQ/CoreCms.Net.RedisMQ.csproj
@@ -14,6 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\CoreCms.Net.Caching\CoreCms.Net.Caching.csproj" />
<ProjectReference Include="..\CoreCms.Net.Configuration\CoreCms.Net.Configuration.csproj" />
+ <ProjectReference Include="..\CoreCms.Net.IRepository\CoreCms.Net.IRepository.csproj" />
<ProjectReference Include="..\CoreCms.Net.IServices\CoreCms.Net.IServices.csproj" />
<ProjectReference Include="..\CoreCms.Net.Loging\CoreCms.Net.Loging.csproj" />
<ProjectReference Include="..\CoreCms.Net.WeChat.Service\CoreCms.Net.WeChat.Service.csproj" />
diff --git a/CoreCms.Net.RedisMQ/DistributionSendOderMQ.cs b/CoreCms.Net.RedisMQ/DistributionSendOderMQ.cs
new file mode 100644
index 0000000..7863227
--- /dev/null
+++ b/CoreCms.Net.RedisMQ/DistributionSendOderMQ.cs
@@ -0,0 +1,77 @@
+锘縰sing CoreCms.Net.Configuration;
+using CoreCms.Net.DTO;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Loging;
+using CoreCms.Net.Model.Entities.baifenbingfa.DistributionSendOder;
+using InitQ.Abstractions;
+using InitQ.Attributes;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CoreCms.Net.RedisMQ
+{
+ /// <summary>
+ /// 渚涘簲鍟嗛厤閫佽鍗曞垎閰嶈褰�
+ /// </summary>
+ public class DistributionSendOderMQ: IRedisSubscribe
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ public DistributionSendOderMQ(IUnitOfWork unitOfWork)
+ {
+ _unitOfWork= unitOfWork;
+
+ }
+
+ /// <summary>
+ /// 澧炲姞涓�涓褰�
+ /// </summary>
+ /// <param name="message"></param>
+ [Subscribe(RedisMessageQueueKey.AddDistributionSendOderMQ)]
+ public async void AddDistributionSendOder(string message)
+ {
+ var Param = JsonConvert.DeserializeObject<DistributionSendOder>(message);
+ if(Param == null) {
+
+ NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "AddDistributionSendOder 澧炲姞涓�涓褰� 澶勭悊澶辫触", $"杞崲妯″瀷澶辫触===銆� {message}");
+ return;
+ }
+ Param.createTime = DateTime.Now;
+ Param.createBy = "绯荤粺闃熷垪";
+
+ await _unitOfWork.GetDbClient().Insertable(Param).ExecuteCommandAsync();
+
+ }
+
+ /// <summary>
+ /// 淇敼鐘舵��
+ /// </summary>
+ /// <param name="message"></param>
+ [Subscribe(RedisMessageQueueKey.ActiveDistributionSendOderMQ)]
+ public async void ActiveDistributionSendOder(string message)
+ {
+ var Param = JsonConvert.DeserializeObject<ActiveDistributionSendOderMQ>(message);
+ if (Param == null)
+ {
+
+ NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "ActiveDistributionSendOder 淇敼鐘舵�� 澶勭悊澶辫触", $"杞崲妯″瀷澶辫触===銆� {message}");
+ return;
+ }
+
+ var oder=await _unitOfWork.GetDbClient().Queryable<DistributionSendOder>().Where(x => x.deliveryID == Param.deliveryID && x.userID == Param.userID).FirstAsync();
+ oder.upDataTime = DateTime.Now;
+ oder.upDataBy = "ActiveDistributionSendOder 闃熷垪";
+ oder.description = Param.Dec;
+ oder.sendDistributionAccept= Param.SendOderActive;
+
+ await _unitOfWork.GetDbClient().Updateable(Param).ExecuteCommandAsync();
+
+ }
+
+
+ }
+}
diff --git a/CoreCms.Net.Services/Bill/CoreCmsBillDeliveryServices.cs b/CoreCms.Net.Services/Bill/CoreCmsBillDeliveryServices.cs
index 6077e7e..af7246c 100644
--- a/CoreCms.Net.Services/Bill/CoreCmsBillDeliveryServices.cs
+++ b/CoreCms.Net.Services/Bill/CoreCmsBillDeliveryServices.cs
@@ -12,22 +12,27 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Caching.AutoMate.RedisCache;
using CoreCms.Net.Configuration;
+using CoreCms.Net.DTO;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.Entities.baifenbingfa.DistributionSendOder;
using CoreCms.Net.Model.ViewModels.Api;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
+using Essensoft.Paylink.Alipay.Domain;
using Flurl.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinExpressDeliveryOpenMessageGetDeliveryListResponse.Types;
namespace CoreCms.Net.Services
@@ -45,7 +50,9 @@
private readonly IUnitOfWork _unitOfWork;
private readonly IServiceProvider _serviceProvider;
private readonly IRedisOperationRepository _redisOperationRepository;
+ private readonly ICoreCmsDistributionRepository _coreCmsDistributionRepository;
+ private readonly IHttpContextUser _user;
public CoreCmsBillDeliveryServices(
@@ -55,7 +62,10 @@
, ICoreCmsStoreServices storeServices
, ICoreCmsBillDeliveryItemServices billDeliveryItemServices
, ICoreCmsOrderLogServices orderLogServices
- , ICoreCmsSettingServices settingServices, IRedisOperationRepository redisOperationRepository)
+ , ICoreCmsSettingServices settingServices
+ , IRedisOperationRepository redisOperationRepository,
+ ICoreCmsDistributionRepository coreCmsDistributionRepository
+ , IHttpContextUser user)
{
this._dal = dal;
base.BaseDal = dal;
@@ -66,6 +76,9 @@
_orderLogServices = orderLogServices;
_settingServices = settingServices;
_redisOperationRepository = redisOperationRepository;
+ _coreCmsDistributionRepository = coreCmsDistributionRepository;
+ _user = user;
+
}
@@ -83,12 +96,17 @@
/// <param name="shipAddress">鏀惰揣鍦板潃</param>
/// <param name="memo">鍙戣揣鎻忚堪</param>
/// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
+ /// <param name="sendDistributionID">閫佽揣渚涘簲鍟咺D</param>
/// <returns></returns>
- public async Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "")
+ public async Task<WebApiCallBack> BatchShip(string[] orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "", int? sendDistributionID = null)
{
using var container = _serviceProvider.CreateScope();
var jm = new WebApiCallBack();
-
+ if(sendDistributionID > 0)
+ {
+ jm.msg = "缁忛攢鍟嗗彂璐т笉鏀寔鎵归噺鍙戣揣";
+ return jm;
+ }
var orderService = container.ServiceProvider.GetService<ICoreCmsOrderServices>();
var stockServices = container.ServiceProvider.GetService<ICoreCmsStockServices>();
//鑾峰彇璁㈠崟璇︽儏
@@ -180,7 +198,7 @@
}
if (tNum < 1)
{
- jm.msg = "璇疯嚦灏戝彂鐢熶竴浠跺晢鍝�!";
+ jm.msg = "璇疯嚦灏戝彂涓�浠跺晢鍝�!";
return jm;
}
//浜嬪姟澶勭悊寮�濮�
@@ -231,12 +249,13 @@
/// <param name="shipAddress">鏀惰揣鍦板潃</param>
/// <param name="memo">鍙戣揣鎻忚堪</param>
/// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
+ /// <param name="sendDistributionID">缁忛攢鍟嗛�佽揣ID</param>
/// <returns></returns>
- public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "")
+ public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo, Dictionary<int, int> items, int storeId = 0, string shipName = "", string shipMobile = "", int shipAreaId = 0, string shipAddress = "", string memo = "", string deliveryCompanyId = "",int? sendDistributionID=null)
{
using var container = _serviceProvider.CreateScope();
var jm = new WebApiCallBack();
-
+
var orderService = container.ServiceProvider.GetService<ICoreCmsOrderServices>();
//鑾峰彇璁㈠崟璇︽儏
var dInfoResult = await orderService.GetOrderShipInfo(orderId);
@@ -288,7 +307,33 @@
billDelivery.memo = memo;
billDelivery.createTime = DateTime.Now;
billDelivery.thirdPartylogiCode = deliveryCompanyId;
+
+ if(sendDistributionID>0)
+ {
+ var a= _coreCmsDistributionRepository.QueryById(sendDistributionID);
+ if(a==null)
+ {
+ jm.msg = "缁忛攢鍟嗕笉瀛樺湪";
+ return jm;
+ }
+ billDelivery.sendDistributionUserID= a.userId;
+ billDelivery.sendDistributionID = sendDistributionID;
+ billDelivery.sendDistributionAccept = sendDistributionAcceptType.NoAccted;
+ var mQ = new DistributionSendOder
+ {
+
+ sendDistributionAccept = sendDistributionAcceptType.NoAccted,
+ distributionID = (int)sendDistributionID,
+ sendMangerID = _user.ID,
+ deliveryID = billDelivery.deliveryId,
+ sendTime = DateTime.Now,
+ userID= a.userId
+
+ };
+ //璁板綍鎿嶄綔璁板綍
+ await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.AddDistributionSendOderMQ, JsonConvert.SerializeObject(mQ));
+ }
//璁剧疆鍙戣揣鏄庣粏
var bdRel = new List<CoreCmsBillDeliveryItem>();
@@ -335,7 +380,10 @@
//鎻掑叆鍙戣揣鍗曚富浣撹〃
- await _dal.InsertAsync(billDelivery);
+ await _dal.InsertAsync(billDelivery);
+
+
+
//鎻掑叆鍙戣揣鍗曟槑缁嗚〃
await _billDeliveryItemServices.InsertAsync(bdRel);
diff --git a/CoreCms.Net.Services/CoreCms.Net.Services.csproj b/CoreCms.Net.Services/CoreCms.Net.Services.csproj
index b746a65..a795d38 100644
--- a/CoreCms.Net.Services/CoreCms.Net.Services.csproj
+++ b/CoreCms.Net.Services/CoreCms.Net.Services.csproj
@@ -11,6 +11,7 @@
<PackageReference Include="Flurl.Http" Version="3.2.4" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
+ <PackageReference Include="NEST" Version="7.17.5" />
<PackageReference Include="Qiniu" Version="8.5.0" />
<PackageReference Include="QRCoder" Version="1.4.3" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.0" />
diff --git a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
index c31eadd..4eb4577 100644
--- a/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
+++ b/CoreCms.Net.Services/Order/CoreCmsOrderServices.cs
@@ -82,6 +82,7 @@
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
private readonly ICoreCmsPlanOrderServices _planOrderServices;
+
private IUnitOfWork _unitOfWork;
@@ -666,6 +667,7 @@
order.shipAddress = userShipInfo.street + " " + userShipInfo.address;
order.shipName = userShipInfo.name;
order.shipMobile = userShipInfo.mobile;
+ order.shipCoordinate = userShipInfo.latitude + "," + userShipInfo.longitude;
var ship = await _shipServices.GetShip(userShipInfo.areaId);
if (ship != null)
@@ -907,12 +909,31 @@
order.aftersalesItem = await _billAftersalesServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
//鍙戣揣鍗�
order.delivery = await _billDeliveryServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
+
if (order.delivery != null && order.delivery.Any())
{
foreach (var item in order.delivery)
{
- var outFirstAsync = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == item.logiCode);
- item.logiName = outFirstAsync != null ? outFirstAsync.logiName : item.logiCode;
+ if (item.logiCode == "Distributor")
+ {
+ //鏄緵搴斿晢閫佽揣
+ var ds= await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x => x.id == item.sendDistributionID).FirstAsync();
+ if(ds==null)
+ {
+ item.logiName = "缁忛攢鍟嗛厤閫侊紝浣嗘槸缁忛攢鍟嗗凡缁忛��鍑烘垨鑰呬笉瀛樺湪";
+ }
+ else
+ {
+ item.logiName = $"缁忛攢鍟嗛厤閫侊紙{ds.schoolName}--{ds.name}锛�";
+ }
+ item.distributionAcceptStr = item.sendDistributionAccept?.GetDescription() ?? "缁忛攢鍟嗘湭纭鎺ュ彈閰嶉��";
+
+ }
+ else
+ {
+ var outFirstAsync = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == item.logiCode);
+ item.logiName = outFirstAsync != null ? outFirstAsync.logiName : item.logiCode;
+ }
}
}
//鑾峰彇鎻愯揣闂ㄥ簵
@@ -1886,6 +1907,7 @@
shipMobile = orderInfo[0].shipMobile,
logisticsId = orderInfo[0].logisticsId,
logisticsName = orderInfo[0].logisticsName,
+ Coordinate= orderInfo[0].shipCoordinate,
items = new List<CoreCmsOrderItem>(),
orders = orderInfo //鎶婅鍗曚俊鎭啑浣欎笂鍘�
};
@@ -1957,7 +1979,12 @@
//鏄惁鏈夎鍛�
if (string.IsNullOrEmpty(jm.msg))
{
- jm.msg = "璇锋敞鎰忥紒鍚堝苟鍙戣揣璁㈠崟涓瓨鍦細" + jm.msg + "銆傜‘瀹氬彂璐у悧锛�";
+ //澶氬湴鍧�澶氱敤鎴风姝� 鍚堝苟鍙戣揣 20240605
+
+ jm.msg = jm.msg + "銆備笉鍙悎骞跺彂璐�";
+ jm.status = false;
+ return jm;
+ // jm.msg = "璇锋敞鎰忥紒鍚堝苟鍙戣揣璁㈠崟涓瓨鍦細" + jm.msg + "銆傜‘瀹氬彂璐у悧锛�";
}
jm.status = true;
jm.data = newOrder;
@@ -2124,10 +2151,10 @@
/// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
/// <returns></returns>
public async Task<WebApiCallBack> BatchShip(string[] ids, string logiCode, string logiNo,
- Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "")
+ Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null)
{
- var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId);
+ var result = await _billDeliveryServices.BatchShip(ids, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId,sendDistributionID);
return result;
}
@@ -2151,9 +2178,9 @@
/// <param name="deliveryCompanyId">绗笁鏂瑰鎺ョ墿娴佺紪鐮�</param>
/// <returns></returns>
public async Task<WebApiCallBack> Ship(string orderId, string logiCode, string logiNo,
- Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "")
+ Dictionary<int, int> items, string shipName, string shipMobile, string shipAddress, string memo, int storeId = 0, int shipAreaId = 0, string deliveryCompanyId = "", int? sendDistributionID = null)
{
- var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId);
+ var result = await _billDeliveryServices.Ship(orderId, logiCode, logiNo, items, storeId, shipName, shipMobile, shipAreaId, shipAddress, memo, deliveryCompanyId,sendDistributionID);
return result;
}
diff --git a/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs b/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs
index 0b5c19e..9f355f2 100644
--- a/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs
+++ b/CoreCms.Net.Services/baifenbingfa/BfbfComAPIService.cs
@@ -4,6 +4,8 @@
using CoreCms.Net.IServices.baifenbingfa;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Utility.Helper;
+using Nest;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -71,5 +73,88 @@
return 0;
return count * 1;
}
+
+ public List<DistributorSort> orderedDistributors(List<DistributorSort> DataList, string latitude, string longitude)
+ {
+
+
+ GeoCoordinate inputLocation = new GeoCoordinate(double.Parse(longitude), double.Parse(latitude)); // 杈撳叆鐨勭粡绾害
+
+ var sortedDistributors = DataList.OrderBy(d => CalculateDistance(inputLocation, new GeoCoordinate(double.Parse(d.longitude), double.Parse(d.latitude))))
+ .ToList();
+ return sortedDistributors;
+ }
+
+
+ /// <summary>
+ /// 璁$畻缁忕含杈捐窛绂�
+ /// </summary>
+ /// <param name="location1"></param>
+ /// <param name="location2"></param>
+ /// <returns></returns>
+ private static double CalculateDistance(GeoCoordinate location1, GeoCoordinate location2)
+ {
+ const double earthRadiusKm = 6371;
+ var dLat = ToRadians(location2.Latitude - location1.Latitude);
+ var dLon = ToRadians(location2.Longitude - location1.Longitude);
+
+ var a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +
+ Math.Cos(ToRadians(location1.Latitude)) * Math.Cos(ToRadians(location2.Latitude)) *
+ Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
+ var c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
+ var distance = earthRadiusKm * c;
+
+ return distance;
+ }
+
+ private static double ToRadians(double degree)
+ {
+ return degree * Math.PI / 180;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鏈夋晥鏍″洯浠g悊
+ /// </summary>
+ /// <param name="PIds"></param>
+ /// <returns></returns>
+ public async Task< List<DistributorSort>> GetDistributorsList(List<int> PIds)
+ {
+ var blist= await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x=>x.profession=="鏍″洯浠g悊"&&x.verifyStatus== (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes).ToListAsync();
+ List < DistributorSort > retlist=new List<DistributorSort>();
+ foreach (var item in blist)
+ {
+ if (string.IsNullOrEmpty(item.storeCoordinate) || item.storeCoordinate == ",")
+ //娌℃湁瀹氫綅锛屼笉鍔犲叆
+ continue;
+ var ldinate= item.storeCoordinate.Split(',');
+ retlist.Add( new DistributorSort()
+ {
+ id = item.id,
+ latitude = ldinate[0],
+ longitude = ldinate[1],
+ name = item.schoolName + ":" + item.name
+
+
+
+ });
+ }
+ return retlist;
+ }
+
+
+
+ public async Task< List< int>> GetOderProductsIDs(string[] OderIds)
+ {
+ var list= await _unitOfWork.GetDbClient().Queryable<CoreCmsOrder>().Where(x => OderIds.Contains(x.orderId))
+ .Select(x => new { items = SqlFunc.Subqueryable<CoreCmsOrderItem>().Where(it => it.orderId == x.orderId).ToList() }).ToListAsync();
+ var li=new List<int>();
+ foreach (var item in list)
+ {
+ li.AddRange(item.items.Select(x=>x.id).ToList());
+
+
+ }
+ return li;
+ }
}
}
diff --git a/CoreCms.Net.Services/baifenbingfa/DistributorDeliveryServices.cs b/CoreCms.Net.Services/baifenbingfa/DistributorDeliveryServices.cs
new file mode 100644
index 0000000..e7e7b7c
--- /dev/null
+++ b/CoreCms.Net.Services/baifenbingfa/DistributorDeliveryServices.cs
@@ -0,0 +1,204 @@
+锘縰sing CoreCms.Net.Caching.AutoMate.RedisCache;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IServices;
+using CoreCms.Net.IServices.baifenbingfa;
+using CoreCms.Net.Model.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using CoreCms.Net.Auth.HttpContextUser;
+using CoreCms.Net.Model.Entities.Expression;
+using CoreCms.Net.Model.ViewModels.Basics;
+using COSXML.Model.Tag;
+using NPOI.SS.Formula.Functions;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+using CoreCms.Net.Configuration;
+using Newtonsoft.Json;
+using CoreCms.Net.DTO;
+
+namespace CoreCms.Net.Services.baifenbingfa
+{
+ /// <summary>
+ /// 渚涘簲鍟嗗彂璐у崟澶勭悊鏈嶅姟
+ /// </summary>
+ public class DistributorDeliveryServices : BaseServices<CoreCmsBillDelivery>, IDistributorDeliveryServices
+ {
+
+ private readonly ICoreCmsBillDeliveryRepository _dal;
+ private readonly ICoreCmsStoreServices _storeServices;
+ private readonly ICoreCmsBillDeliveryItemServices _billDeliveryItemServices;
+ private readonly ICoreCmsOrderLogServices _orderLogServices;
+ private readonly ICoreCmsSettingServices _settingServices;
+ private readonly IUnitOfWork _unitOfWork;
+ private readonly IServiceProvider _serviceProvider;
+ private readonly IRedisOperationRepository _redisOperationRepository;
+ private readonly IHttpContextUser _user;
+
+ public readonly ICoreCmsDistributionServices _coreCmsDistributionServices;
+
+ public DistributorDeliveryServices(
+ IUnitOfWork unitOfWork,
+ IServiceProvider serviceProvider
+ , ICoreCmsBillDeliveryRepository dal
+ , ICoreCmsStoreServices storeServices
+ , ICoreCmsBillDeliveryItemServices billDeliveryItemServices
+ , ICoreCmsOrderLogServices orderLogServices
+ , ICoreCmsSettingServices settingServices
+ , IRedisOperationRepository redisOperationRepository
+ , IHttpContextUser user
+ ,ICoreCmsDistributionServices coreCmsDistributionServices )
+ {
+ this._dal = dal;
+ base.BaseDal = dal;
+ _unitOfWork = unitOfWork;
+ _serviceProvider = serviceProvider;
+ _storeServices = storeServices;
+ _billDeliveryItemServices = billDeliveryItemServices;
+ _orderLogServices = orderLogServices;
+ _settingServices = settingServices;
+ _redisOperationRepository = redisOperationRepository;
+ _user = user;
+ _coreCmsDistributionServices = coreCmsDistributionServices;
+ }
+
+ public async Task<(List< CoreCmsBillDelivery>,int )> GetDeliveryList(GetDeliveryListPost Param)
+ {
+
+
+ var where = PredicateBuilder.True<CoreCmsBillDelivery>();
+ if(Param.Status != null )
+ {
+ where= where.And(x => x.status == (int)Param.Status);
+ }
+ if (Param.distributionAcceptStatus != null)
+ {
+ where= where.And(x => x.sendDistributionAccept == Param.distributionAcceptStatus);
+ }
+ where= where.And(x => x.sendDistributionUserID == _user.ID);
+ //蹇呴』鏄嚭浜庡彂璐х姸鎬�
+ //where= where.And(x => x.order.shipStatus ==(int ) GlobalEnumVars.OrderShipStatus.Yes);
+ //蹇呴』鏄湁鏁堢姸鎬�
+ //where= where.And(x => x.order.status == (int)GlobalEnumVars.OrderStatus.Normal);
+ RefAsync<int> totl = 0;
+ var list= await _unitOfWork.GetDbClient().Queryable<CoreCmsBillDelivery>().Includes(x => x.order, order => order.Orderitems, ite => ite.productInfo)
+ .Where(where).OrderByDescending(x => x.createTime)
+ .ToPageListAsync(Param.page, Param.limit, totl);
+ var listdata= new PageList<CoreCmsBillDelivery>(list, Param.page, Param.limit, totl);
+
+ return (listdata,totl);
+ //return await _dal.QueryPageAsync(where, x => x.createTime, SqlSugar.OrderByType.Desc, Param.page, Param.page);
+ }
+
+ public async Task<int> GetNoAcceptedDeliveryCount()
+ {
+ return await _dal.GetCountAsync(x => x.sendDistributionUserID == _user.ID && x.sendDistributionAccept == sendDistributionAcceptType.NoAccted);
+ }
+
+ public async Task<bool> GetShowDelivery()
+ {
+ return (await _coreCmsDistributionServices.GetCountAsync(x => x.userId == _user.ID && x.verifyStatus == (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes&&x.profession=="鏍″洯浠g悊", isDataCache: true, cacheTimes: 60)>0);
+ }
+ public async Task<WebApiCallBack> SetDeliveryAccepted(sendDistributionAcceptType acceptType, string DeliveryID, string CancelledDec = null)
+ {
+ WebApiCallBack ret = new WebApiCallBack();
+ var data = await _dal.QueryByIdAsync(DeliveryID);
+ if (data == null)
+ {
+ ret.status = false;
+ ret.msg = " 娌℃湁鎵惧埌鍙戣揣鍗�";
+ return ret;
+
+ }
+ if (data.sendDistributionUserID != _user.ID)
+ {
+ ret.status = false;
+ ret.msg = "璇ュ彂璐у崟涓嶅睘浜庤璇ョ敤鎴�";
+ return ret;
+ }
+
+ var oder = await _unitOfWork.GetDbClient().Queryable<CoreCmsOrder>().Where(x=>x.status== (int)GlobalEnumVars.OrderStatus.Normal).Includes(x => x.Orderitems).Where(x => x.orderId == data.orderId).FirstAsync();
+ if(oder != null)
+ {
+ ret.status = false;
+ ret.msg = "璁㈠崟宸茬粡瀹岀粨锛屼笉鍙搷浣�";
+ return ret;
+ }
+
+ var mQ = new ActiveDistributionSendOderMQ
+ {
+ Dec = CancelledDec,
+ SendOderActive = acceptType,
+ deliveryID = DeliveryID,
+ userID = _user.ID
+ };
+ //璁板綍鎿嶄綔璁板綍
+ await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.ActiveDistributionSendOderMQ, JsonConvert.SerializeObject(mQ));
+ //鐢ㄦ埛涓嶅悓鎰忛厤閫�
+ try
+ {
+
+
+ _unitOfWork.BeginTran();
+ if (acceptType == sendDistributionAcceptType.Cancelled)
+ {
+ //濡傛灉鏄彇娑堣鍗曪紝闇�瑕佹妸璁㈠崟
+ //涓嶆帴鍙� 闇�瑕佸皢鍘熻鍗曡缃负涓哄垎閰嶇姸鎬侊紝
+
+
+
+ if (oder.status != (int)GlobalEnumVars.OrderStatus.Complete
+ && oder.status != (int)GlobalEnumVars.OrderStatus.Cancel
+ &&oder.shipStatus== (int)GlobalEnumVars.OrderShipStatus.Yes
+ )
+ {
+ var Deliveryitem = await _unitOfWork.GetDbClient().Queryable<CoreCmsBillDeliveryItem>().Where(x => x.deliveryId == data.deliveryId).ToListAsync();
+
+ foreach (var item in oder.Orderitems)
+ {
+ //澶勭悊宸插彂璐ф暟鎹�
+
+ item.sendNums -= Deliveryitem.Where(x => x.productId == item.productId).Select(x => x.nums).FirstOrDefault();
+ if(item.sendNums<0)
+ item.sendNums = 0;
+ item.updateTime = DateTime.Now;
+
+
+
+ }
+ oder.shipStatus =(int ) GlobalEnumVars.OrderShipStatus.No;
+
+ oder.updateTime = DateTime.Now;
+ await _unitOfWork.GetDbClient().UpdateNav( oder ).Include(x=>x.Orderitems).ExecuteCommandAsync() ;
+
+
+ }
+
+
+ }
+
+ data.sendDistributionAccept = acceptType;
+ data.updateTime= DateTime.Now;
+ ret.status = true;
+ var r= await _dal.UpdateAsync(data);
+ if(r==true)
+ _unitOfWork.CommitTran();
+ else
+ {
+ _unitOfWork.RollbackTran();
+ }
+ ret.status = r;
+ ret.msg = r ? "璁剧疆鎴愬姛" : "璁剧疆澶辫触";
+ return ret;
+ }
+ catch (Exception)
+ {
+ _unitOfWork.RollbackTran();
+ throw;
+ }
+ }
+ }
+}
diff --git a/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs b/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs
index 2f02087..9661063 100644
--- a/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs
+++ b/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs
@@ -14,6 +14,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Text;
namespace CoreCms.Net.Utility.Extensions
@@ -174,8 +175,18 @@
return thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out result) ? result : result;
}
-
-
+ /// <summary>
+ /// 鑾峰彇鏋氫妇鐨勬爣娉ㄧ殑鍊�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static string GetDescription(this Enum value)
+ {
+ var field = value.GetType().GetField(value.ToString());
+ var attributes = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);
+ return attributes.Length > 0 ? attributes[0].Description : value.ToString();
+ }
}
}
diff --git a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsBillDeliveryController.cs b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsBillDeliveryController.cs
index d3665c6..4f46918 100644
--- a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsBillDeliveryController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsBillDeliveryController.cs
@@ -16,6 +16,7 @@
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.Filter;
+using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
@@ -24,6 +25,7 @@
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Web.Admin.Infrastructure;
+using DotLiquid.Util;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
@@ -47,19 +49,25 @@
private readonly ICoreCmsBillDeliveryItemServices _itemServices;
private readonly ICoreCmsLogisticsServices _logisticsServices;
private readonly IWebHostEnvironment _webHostEnvironment;
+ private readonly IUnitOfWork _unitOfWork;
+ private readonly ICoreCmsDistributionOrderServices _coreCmsDistributionOrderServices;
/// <summary>
/// 鏋勯�犲嚱鏁�
/// </summary>
public CoreCmsBillDeliveryController(IWebHostEnvironment webHostEnvironment,
ICoreCmsBillDeliveryServices coreCmsBillDeliveryServices, ICoreCmsAreaServices areaServices,
- ICoreCmsBillDeliveryItemServices itemServices, ICoreCmsLogisticsServices logisticsServices)
+ ICoreCmsBillDeliveryItemServices itemServices
+ , ICoreCmsLogisticsServices logisticsServices
+ , IUnitOfWork sugarUnitOfWork, ICoreCmsDistributionOrderServices coreCmsDistributionOrderServices)
{
_webHostEnvironment = webHostEnvironment;
_coreCmsBillDeliveryServices = coreCmsBillDeliveryServices;
_areaServices = areaServices;
_itemServices = itemServices;
_logisticsServices = logisticsServices;
+ _unitOfWork = sugarUnitOfWork;
+ _coreCmsDistributionOrderServices = coreCmsDistributionOrderServices;
}
#region 鑾峰彇鍒楄〃============================================================
@@ -221,8 +229,19 @@
if (!string.IsNullOrEmpty(item.logiCode))
{
+
+ if (item.logiCode == "Distributor")
+ {
+ //鏄緵搴斿晢渚涜揣锛岄偅涔堥渶瑕佽幏鍙栦緵搴斿晢淇℃伅
+ var dis = await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x => x.id == item.sendDistributionID).FirstAsync();
+ if (dis != null)
+ item.logiName = $"鍒嗛厤缁欑粡閿�鍟嗗彂璐э紙{dis.name} -- {dis.schoolName}锛�";
+ }
+ else
+ {
var logiModel = logist.Find(p => p.logiCode == item.logiCode);
if (logiModel != null) item.logiName = logiModel.logiName;
+ }
}
}
}
@@ -363,9 +382,24 @@
if (!string.IsNullOrEmpty(model.logiCode))
{
- var logiModel = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == model.logiCode);
- ;
- if (logiModel != null) model.logiName = logiModel.logiName;
+ if (model.logiCode == "Distributor")
+ {
+ //鏄緵搴斿晢渚涜揣锛岄偅涔堥渶瑕佽幏鍙栦緵搴斿晢淇℃伅
+ var dis = await _unitOfWork.GetDbClient().Queryable<CoreCmsDistribution>().Where(x => x.id == model.sendDistributionID).FirstAsync();
+ if (dis != null)
+ {
+ model.logiName = $"鍒嗛厤缁欑粡閿�鍟嗗彂璐э紙{dis.name} -- {dis.schoolName}锛�";
+ model.distributionAcceptStr = model.sendDistributionAccept?.GetDescription()??"鏈‘璁ゆ帴鍙楀垎閰�";
+ }
+
+ }
+ else
+
+ {
+ var logiModel = await _logisticsServices.QueryByClauseAsync(p => p.logiCode == model.logiCode);
+ if (logiModel != null) model.logiName = logiModel.logiName;
+ }
+
}
var items = await _itemServices.QueryListByClauseAsync(p => p.deliveryId == model.deliveryId,
diff --git a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs
index dac6e3c..391da5a 100644
--- a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs
@@ -19,10 +19,12 @@
using CoreCms.Net.Configuration;
using CoreCms.Net.Filter;
using CoreCms.Net.IServices;
+using CoreCms.Net.IServices.baifenbingfa;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
+using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.Excel;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
@@ -69,7 +71,7 @@
private readonly ICoreCmsOrderItemServices _orderItemServices;
-
+ private readonly IBfbfComAPIService _bfbfServices;
/// <summary>
@@ -84,7 +86,14 @@
, ICoreCmsLogisticsServices logisticsServices
, ICoreCmsBillPaymentsServices billPaymentsServices
, ICoreCmsPaymentsServices paymentsServices
- , ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices, IWeChatShippingDeliveryServices weChatShippingDeliveryServices)
+ , ICoreCmsSettingServices settingServices
+ , ICoreCmsUserWeChatInfoServices userWeChatInfoServices
+ , IRedisOperationRepository redisOperationRepository
+ , ICoreCmsBillDeliveryServices billDeliveryServices
+ , IWeChatApiHttpClientFactory weChatApiHttpClientFactory
+ , ICoreCmsOrderItemServices orderItemServices
+ , IWeChatShippingDeliveryServices weChatShippingDeliveryServices
+ , IBfbfComAPIService bfbfComAPIService)
{
_webHostEnvironment = webHostEnvironment;
_coreCmsOrderServices = coreCmsOrderServices;
@@ -102,6 +111,7 @@
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
_orderItemServices = orderItemServices;
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
+ _bfbfServices = bfbfComAPIService;
}
#region 鑾峰彇鍒楄〃============================================================
@@ -519,6 +529,16 @@
var storeList = await _storeServices.QueryAsync();
var logistics = await _logisticsServices.QueryListByClauseAsync(p => p.isDelete == false);
+ logistics.Add(new CoreCmsLogistics
+ {
+ id = int.MaxValue,
+ logiCode = "Distributor",
+ logiName = "鏍″洯浠g悊閰嶉��",
+ sort = -1,
+
+ });
+
+ logistics = logistics.OrderBy(x => x.sort).ToList();
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
var result = await _coreCmsOrderServices.GetOrderShipInfo(entity.id);
if (!result.status)
@@ -526,7 +546,40 @@
jm.msg = result.msg;
return jm;
}
+ string lat = "";
+ try
+ {
+ lat = (result.data as AdminOrderShipResult).Coordinate;
+ }
+ catch (Exception)
+ {
+ lat = "";
+ }
+ List<DistributorSort> Distributors = new List<DistributorSort>();
+ if (!string.IsNullOrEmpty(lat))
+ //璧版牎鍥唬鐞�
+ {
+ string[] latlist= lat.Split(',');
+ if (latlist.Length == 2)
+ {
+ try
+ {
+ var ProductsIds = await _bfbfServices.GetOderProductsIDs(entity.id);
+ Distributors = await _bfbfServices.GetDistributorsList(ProductsIds);
+ //Distributors = _bfbfServices.orderedDistributors(Distributors, latlist[0], latlist[1]);
+
+ }
+ catch (Exception)
+ {
+ Distributors = new List<DistributorSort>();
+
+
+ }
+
+ }
+ }
+
if (storeList.Any())
{
foreach (var store in storeList)
@@ -546,6 +599,7 @@
deliveryCompany,
storeList,
logistics,
+ Distributors
};
return jm;
@@ -564,12 +618,23 @@
public async Task<AdminUiCallBack> DoShip([FromBody] AdminOrderShipPost entity)
{
var jm = new AdminUiCallBack();
+ if (entity.logiCode== "Distributor")
+ //濡傛灉閫夋嫨浜嗘牎鍥唬鐞嗗彂璐�
+ {
+ if (entity.SendDistributionID == null && entity.SendDistributionID == 0)
+ {
+ jm.code= 1;
+ jm.msg = "蹇呴』閫夋嫨涓�涓牎鍥唬鐞嗛厤閫�";
+ return jm;
+ }
+ }
+
WebApiCallBack result;
if (entity.orderId.Contains(","))
{
var ids = entity.orderId.Split(",");
- result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
+ result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId,entity.SendDistributionID);
if (result.status)
{
@@ -579,6 +644,8 @@
//渚濇鎺ㄥ叆闃熷垪.
foreach (var item in orderPaymentIds)
{
+ //缁忛攢鍟嗗彂璐т笉澶勭悊鍙戣揣淇℃伅 鏄簲璇ヤ綔涓哄悓鍩庡鐞嗭紵杩樻槸涓嶅鐞嗭紝闇�瑕佽繍琛屾椂鐮旂┒
+ if(entity.logiCode != "Distributor")
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, item.paymentId);
}
}
@@ -588,12 +655,14 @@
}
else
{
- result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
+ result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId,entity.SendDistributionID);
//寰俊鍙戣揣淇℃伅绠$悊API鍙戣揣
if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == entity.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo)
{
- await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
+ //缁忛攢鍟嗗彂璐т笉澶勭悊鍙戣揣淇℃伅
+ if (entity.logiCode != "Distributor")
+ await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
}
}
@@ -916,9 +985,17 @@
return jm;
}
jm.code = result.status ? 0 : 1;
+ var CmsOrder = result.data as CoreCmsOrder;
+ if(CmsOrder == null)
+ {
+ jm.msg = "涓嶅瓨鍦ㄦ淇℃伅";
+ return jm;
+ }
+ //鍓旈櫎缁忛攢鍟嗗彇娑堢殑鐗╂祦淇℃伅
+ CmsOrder.delivery = CmsOrder.delivery.Where(x => x.logiCode != "Distributor" || (x.logiCode == "Distributor" && x.sendDistributionAccept == sendDistributionAcceptType.Accepted)).ToList();
- var allConfigs = await _settingServices.GetConfigDictionaries();
+ var allConfigs = await _settingServices.GetConfigDictionaries();
var shopName = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopName);
var shopMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopMobile);
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/billdelivery/details.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/billdelivery/details.html
index f1a90ab..7c5e237 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/billdelivery/details.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/billdelivery/details.html
@@ -29,10 +29,17 @@
<div class="layui-input-inline layui-form-mid layui-inline-3">
{{d.params.data.model.logiName || '' }}
</div>
+ {{# if(d.params.data.model.logiCode!="Distributor"){}}
<label class="layui-form-label">蹇�掑崟鍙凤細</label>
<div class="layui-input-inline layui-form-mid layui-inline-3">
{{d.params.data.model.logiNo || '' }}
</div>
+ {{# }else {}}
+ <label class="layui-form-label">缁忛攢鍟嗗彂璐х‘璁ょ姸鎬侊細</label>
+ <div class="layui-input-inline layui-form-mid layui-inline-3">
+ {{d.params.data.model.distributionAcceptStr || '' }}
+ </div>
+ {{#}}}
</div>
<div class="layui-form-item">
<label class="layui-form-label">鏀惰揣鐢佃瘽锛�</label>
@@ -50,6 +57,7 @@
{{d.params.data.model.shipAddress || '' }}
</div>
</div>
+
<div class="layui-form-item">
<label class="layui-form-label">鍙戣揣澶囨敞锛�</label>
<div class="layui-input-inline layui-form-mid layui-inline-100">
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/details.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/details.html
index aa85068..d569d87 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/details.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/details.html
@@ -340,7 +340,7 @@
<th>鏀惰揣浜哄悕</th>
<th>鏀惰揣鐢佃瘽</th>
<th>鏀惰揣鍦板潃</th>
- <th style="width: 60px">鎿嶄綔</th>
+ <th style="width: 60px">鐘舵��</th>
</tr>
</thead>
<tbody>
@@ -354,6 +354,8 @@
<td>{{item.shipMobile}}</td>
<td>{{item.shipAreaIdName}}-{{item.shipAddress}}</td>
<td>
+
+ {{item.logiCode=="Distributor"? item.distributionAcceptStr??"鏈‘璁ゆ帴鍙楅厤閫�":""}}
<!-- <button type="button" class="layui-btn layui-btn-warm layui-btn-xs" data-deliveryId="{{item.deliveryId}}" lay-active="refreshDelivery" style="margin-left: 0px">鍚屾鐩存挱璁㈠崟</button> -->
</td>
</tr>
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/distribution.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/distribution.html
index a8f34dd..6ed1c12 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/distribution.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/distribution.html
@@ -53,7 +53,7 @@
<td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">
{{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}}
</td>
- <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">锟� {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td>
+ <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">锟� {{ Number(item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td>
</tr>
{{# }); }}
</tbody>
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/edit.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/edit.html
index 3788d14..f1a5175 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/edit.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/edit.html
@@ -65,9 +65,27 @@
</div>
</div>
<div class="layui-form-item">
+ <label for="shipCoordinate" class="layui-form-label layui-form-required"
+ >鍧愭爣浣嶇疆</label
+ >
+ <div class="layui-input-block">
+ <input
+ name="shipCoordinate"
+ id="coordinateBox"
+ lay-active="showMap"
+ lay-verType="tips"
+ value="{{d.params.data.orderModel.shipCoordinate || '' }}"
+ lay-verify="required|verifycoordinate"
+ class="layui-input"
+ lay-reqText="璇疯緭鍏ュ潗鏍囦綅缃�"
+ placeholder="璇疯緭鍏ュ潗鏍囦綅缃�"
+ />
+ </div>
+ </div>
+ <div class="layui-form-item">
<label class="layui-form-label">鏀惰揣鍦板潃</label>
<div class="layui-input-block">
- <input type="text" name="shipAddress" value="{{d.params.data.orderModel.shipAddress}}" class="layui-input">
+ <input type="text" name="shipAddress" id="shipAddressBox" value="{{d.params.data.orderModel.shipAddress}}" class="layui-input">
</div>
</div>
{{# } }}
@@ -81,7 +99,7 @@
layui.data.sendParams = function (d) {
//寮�鍚皟璇曟儏鍐典笅鑾峰彇鎺ュ彛璧嬪�兼暟鎹�
if (debug) { console.log(d.params.data); }
- layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
+ layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg',"util",],
function () {
var $ = layui.$
, form = layui.form
@@ -89,6 +107,7 @@
, laydate = layui.laydate
, upload = layui.upload
, cropperImg = layui.cropperImg
+ ,util = layui.util
, coreHelper = layui.coreHelper;
coreHelper.Post("Api/Tools/GetAreaCheckedList", { id: d.params.data.orderModel.shipAreaId }, function (data) {
@@ -168,6 +187,36 @@
}
}
}
+ //澶勭悊灞炴�� 涓� lay-active 鐨勬墍鏈夊厓绱犱簨浠�
+ util.event("lay-active", {
+ showMap: function () {
+ var oldData = $("#coordinateBox").val();
+ let data = {
+ oldData: oldData,
+ coordinateBoxIdName: "coordinateBox",
+ addressBoxIdName: "shipAddressBox",
+ };
+
+ admin.popup({
+ shadeClose: false,
+ title: "鏌ョ湅璇︽儏",
+ area: ["1000px", "570px"],
+ id: "LAY-popup-common-getQQMap",
+ success: function (layero, index) {
+ layui
+ .view(this.id)
+ .render("common/getQQMap", { data })
+ .done(function () {
+ form.render();
+ });
+ // 绂佹寮圭獥鍑虹幇婊氬姩鏉�
+ $(layero)
+ .children(".layui-layer-content")
+ .css("overflow", "visible");
+ },
+ });
+ },
+ });
//閲嶈浇form
form.render(null, 'LAY-app-CoreCmsOrder-editForm');
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/index.html
index f676c6b..1a8c3e3 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/index.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/index.html
@@ -922,6 +922,17 @@
area: ['1000px', '90%'],
id: 'LAY-popup-CoreCmsOrder-distribution',
success: function (layero, index) {
+
+ if(e.data.order.delivery?.length>0)
+ {
+ e.data.order.delivery.forEach(element => {
+ if( element.logiCode=="Distributor")
+ {
+ e.data.order.logisticsName+=`[${element.logiName} == ${element.sendDistributionAccept}] `
+ }
+ });
+ }
+
view(this.id).render('order/orders/distribution', { data: e.data }).done(function () {
form.on('submit(LAY-app-order-distributionPrint-submit)', function (data) {
LODOP = getLodop();
@@ -955,6 +966,17 @@
id: 'LAY-popup-CoreCmsOrder-union',
success: function (layero, index) {
view(this.id).render('order/orders/union', { data: e.data }).done(function () {
+
+ if(e.data.order.delivery?.length>0)
+ {
+ e.data.order.delivery.forEach(element => {
+ if( element.logiCode=="Distributor")
+ {
+ e.data.order.logisticsName+=`[${element.logiName} == ${element.sendDistributionAccept}]`
+ }
+ });
+ }
+
form.on('submit(LAY-app-order-unionPrint-submit)', function (data) {
LODOP = getLodop();
LODOP.ADD_PRINT_HTM(20, "5%", "90%", "100%", document.getElementById("printDiv").innerHTML);
@@ -1089,6 +1111,7 @@
//鐩戝惉鎻愪氦
form.on('submit(LAY-app-CoreCmsOrder-shipForm-submit)',
function (data) {
+
var field = data.field; //鑾峰彇鎻愪氦鐨勫瓧娈�
var keys = Object.keys(field);
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/ship.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/ship.html
index 8ae2d17..34cf868 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/ship.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/ship.html
@@ -113,7 +113,7 @@
<div class="layui-inline">
<label class="layui-form-label">鐗╂祦鍏徃</label>
<div class="layui-input-inline layui-inline-4">
- <select name="logiCode" lay-verify="required" lay-reqText="璇烽�夋嫨鐗╂祦鍏徃" lay-search lay-filter="logiCodefilter">
+ <select name="logiCode" lay-verify="required" lay-reqText="璇烽�夋嫨鐗╂祦鍏徃" lay-search lay-filter="logiCodefilter" id="SelWUliuId">
<option value="">鎼滅储閫夋嫨鐗╂祦鍏徃</option>
{{# layui.each(d.params.data.logistics, function(index, item){ }}
<option value="{{item.logiCode}}">{{item.logiName}}</option>
@@ -121,7 +121,7 @@
</select>
</div>
</div>
- <div class="layui-inline">
+ <!-- <div class="layui-inline" >
<label class="layui-form-label">鐩存挱鐗╂祦</label>
<div class="layui-input-inline layui-inline-4">
<select name="deliveryCompanyId" lay-verify="required" lay-reqText="鐩存挱鐗╂祦" lay-search>
@@ -129,6 +129,18 @@
<option value="OTHERS" selected="selected">鏃犵墿娴�</option>
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
+ {{# }); }}
+ </select>
+ </div>
+ </div> -->
+
+ <div class="layui-inline" id="SelXiaoyuanDiali_" >
+ <label class="layui-form-label ">閫夋嫨鏍″洯浠g悊</label>
+ <div class="layui-input-inline layui-inline-4">
+ <select name="sendDistributionID" lay-reqText="閫夋嫨鏍″洯浠g悊" lay-search id="selXiaoYuanDaiLiInputID">
+ <option value="">閫夋嫨鏍″洯浠g悊</option>
+ {{# layui.each(d.params.data.distributors, function(index, item){ }}
+ <option value="{{item.id}}">{{item.name}}</option>
{{# }); }}
</select>
</div>
@@ -169,7 +181,17 @@
, coreHelper = layui.coreHelper;
form.on('select(logiCodefilter)', function (data) {
- if (data.value == 'benditongcheng' || data.value == 'shangmenziti') {
+ if(data.value=="Distributor")
+ {
+ $('#SelXiaoyuanDiali_').show();
+ $('#selXiaoYuanDaiLiInputID').attr('lay-verify', 'required')
+ form.render(null, 'LAY-app-CoreCmsOrder-shipForm');
+ }
+ else{
+ $('#SelXiaoyuanDiali_').hide();
+ $('#selXiaoYuanDaiLiInputID').removeAttr('lay-verify')
+ }
+ if (data.value == 'benditongcheng' || data.value == 'shangmenziti'||data.value=='Distributor') {
$('#logiNo').val('鏃�');
} else {
var logiNoVal = $('#logiNo').val();
@@ -260,6 +282,11 @@
}
//閲嶈浇form
+ if($("#SelWUliuId").val()!="Distributor")
+ {
+ $('#SelXiaoyuanDiali_').hide();
+ $('#selXiaoYuanDaiLiInputID').attr('lay-verify', '')
+ }
form.render(null, 'LAY-app-CoreCmsOrder-shipForm');
})
};
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/shopping.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/shopping.html
index 1c33a87..ff51d49 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/shopping.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/shopping.html
@@ -52,7 +52,7 @@
<td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">
{{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}}
</td>
- <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">锟� {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td>
+ <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">锟� {{ Number(item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td>
</tr>
{{# }); }}
</tbody>
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/union.html b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/union.html
index c270d33..5d0b587 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/union.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/order/orders/union.html
@@ -50,7 +50,7 @@
<td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">
{{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}}
</td>
- <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">锟� {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td>
+ <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top;">锟� {{ Number( item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td>
</tr>
{{# }); }}
</tbody>
@@ -133,7 +133,7 @@
<td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">
{{item.nums-item.sendNums-item.reshipNums+item.reshipedNums}}
</td>
- <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">锟� {{ item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums) }}</td>
+ <td style="padding: 10px 5px; border-bottom: 1px solid #ddd; font-size: 14px; vertical-align: top; text-align: center">锟� {{ Number( item.price * (item.nums-item.sendNums-item.reshipNums+item.reshipedNums)).toFixed(2) }}</td>
</tr>
{{# }); }}
</tbody>
@@ -181,6 +181,7 @@
layui.data.sendParams = function (d) {
//寮�鍚皟璇曟儏鍐典笅鑾峰彇鎺ュ彛璧嬪�兼暟鎹�
if (debug) { console.log(d.params.data); }
+
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
function () {
var $ = layui.$
@@ -192,6 +193,7 @@
, coreHelper = layui.coreHelper;
//閲嶈浇form
+
form.render();
})
};
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/store/edit.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/store/edit.html
index 38ba732..92bef24 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/shop/store/edit.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/store/edit.html
@@ -399,6 +399,7 @@
util.event("lay-active", {
showMap: function () {
var oldData = $("#coordinateBox").val();
+
let data = {
oldData: oldData,
coordinateBoxIdName: "coordinateBox",
diff --git a/CoreCms.Net.Web.WebApi/Controllers/PinTuanController.cs b/CoreCms.Net.Web.WebApi/Controllers/PinTuanController.cs
index 0878855..0e32150 100644
--- a/CoreCms.Net.Web.WebApi/Controllers/PinTuanController.cs
+++ b/CoreCms.Net.Web.WebApi/Controllers/PinTuanController.cs
@@ -31,6 +31,7 @@
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
+
public class PinTuanController : ControllerBase
{
diff --git a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs
index c813e43..99c0ae1 100644
--- a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs
+++ b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs
@@ -23,6 +23,7 @@
using CoreCms.Net.Caching.AutoMate.RedisCache;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
+using CoreCms.Net.IServices.baifenbingfa;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
@@ -92,6 +93,7 @@
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
private readonly WeChatOptions _weChatOptions;
private readonly IRedisOperationRepository _redisOperationRepository;
+ private readonly IDistributorDeliveryServices _distributorDeliveryServices;
/// <summary>
/// 鏋勯�犲嚱鏁�
@@ -122,7 +124,14 @@
, ICoreCmsSettingServices settingServices
, ICoreCmsServicesServices servicesServices
, IOptions<WeChatOptions> weChatOptions
- , ICoreCmsUserServicesOrderServices userServicesOrderServices, ICoreCmsUserServicesTicketServices userServicesTicketServices, ICoreCmsStoreServices storeServices, ICoreCmsCouponServices couponServices, ICoreCmsOrderServices orderServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IRedisOperationRepository redisOperationRepository)
+ , ICoreCmsUserServicesOrderServices userServicesOrderServices
+ , ICoreCmsUserServicesTicketServices userServicesTicketServices
+ , ICoreCmsStoreServices storeServices
+ , ICoreCmsCouponServices couponServices
+ , ICoreCmsOrderServices orderServices
+ , IWeChatApiHttpClientFactory weChatApiHttpClientFactory
+ , IRedisOperationRepository redisOperationRepository
+ , IDistributorDeliveryServices distributorDeliveryServices)
{
_user = user;
_userWeChatInfoServices = userWeChatInfoServices;
@@ -156,6 +165,7 @@
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
_redisOperationRepository = redisOperationRepository;
_weChatOptions = weChatOptions.Value;
+ _distributorDeliveryServices = distributorDeliveryServices;
}
@@ -1006,7 +1016,10 @@
{
user.sex = (int)GlobalEnumVars.UserSexTypes.鏈煡;
}
+ //鏈鐞嗚鍗曟暟閲�
+ var DeliveryCount = await _distributorDeliveryServices.GetNoAcceptedDeliveryCount();
+ var ShowDelivery = await _distributorDeliveryServices.GetShowDelivery();
jm.data = new
{
user.id,
@@ -1031,7 +1044,9 @@
orderCount,
footPrintCount,
collectionCount,
- user.isplanorder
+ user.isplanorder,
+ DeliveryCount,
+ ShowDelivery
};
return jm;
}
diff --git a/CoreCms.Net.Web.WebApi/Controllers/baifenbingfa/DistributorDeliveryController.cs b/CoreCms.Net.Web.WebApi/Controllers/baifenbingfa/DistributorDeliveryController.cs
new file mode 100644
index 0000000..4f6b3ca
--- /dev/null
+++ b/CoreCms.Net.Web.WebApi/Controllers/baifenbingfa/DistributorDeliveryController.cs
@@ -0,0 +1,94 @@
+锘縰sing CoreCms.Net.IRepository;
+using CoreCms.Net.IServices;
+using CoreCms.Net.IServices.baifenbingfa;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.FromBody;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using CoreCms.Net.Utility.Extensions;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using SKIT.FlurlHttpClient.Wechat.Api.Models;
+using Swashbuckle.AspNetCore.Annotations;
+using System.Threading.Tasks;
+
+namespace CoreCms.Net.Web.WebApi.Controllers.baifenbingfa
+{
+ /// <summary>
+ /// 缁忛攢鍟嗗彂璐у崟澶勭悊
+ /// </summary>
+ /// <summary>
+ /// 椤甸潰鎺ュ彛
+ /// </summary>
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ [Authorize]
+ public class DistributorDeliveryController: ControllerBase
+ {
+
+ IDistributorDeliveryServices _distributorDeliveryServices ;
+
+ public DistributorDeliveryController(IDistributorDeliveryServices distributorDeliveryServices )
+ {
+ _distributorDeliveryServices= distributorDeliveryServices ;
+ }
+ /// <summary>
+ /// 鑾峰彇list
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("GetList")]
+ [SwaggerResponse(200, "杩斿洖鏁版嵁", typeof(WebApiCallBack))]
+ [SwaggerResponse(201, "Data绫诲瀷", typeof(IPageList<CoreCmsBillDelivery>))]
+
+ public async Task<WebApiCallBack> GetList(GetDeliveryListPost param)
+ {
+ var datalist = await _distributorDeliveryServices.GetDeliveryList(param);
+ return new WebApiCallBack
+ {
+ status = true,
+ data =new { datalist= datalist.Item1,
+ total=datalist.Item2
+ }
+
+ };
+
+ }
+
+ /// <summary>
+ /// 鎺ュ彈鍙戣揣鍗�
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("Accepted")]
+ public async Task<WebApiCallBack> Accepted([FromBody] AccptedInParam param)
+ {
+ var datalist = await _distributorDeliveryServices.SetDeliveryAccepted( param.acceptType, param.id,param.noAcceptTypeMsg);
+ return new WebApiCallBack
+ {
+ status = true,
+ data = datalist
+
+ };
+
+ }
+
+
+ }
+ public class AccptedInParam
+ {
+ /// <summary>
+ /// 鐘舵�� 0 涓烘帴鍙� 3 涓烘嫆缁�/鍙栨秷
+ /// </summary>
+ public sendDistributionAcceptType acceptType { get; set; }
+ /// <summary>
+ /// 鍙戣揣鍗旾D
+ ///
+ /// </summary>
+ public string id { get; set; }
+ /// <summary>
+ /// 鏍″洯浠g悊鎷掔粷鍘熷洜
+ /// </summary>
+ public string noAcceptTypeMsg { get; set; }
+ }
+
+
+}
--
Gitblit v1.9.1