Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 11 months ago
parent
commit
e9ee2a2e41

+ 6 - 3
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -2104,7 +2104,7 @@ namespace OASystem.API.Controllers
                 sqlWhere += string.Format(@" And Id In ({0})", string.Join(",", _groupIds));
             }
 
-            string sql_1 = string.Format(@"Select * From Grp_CreditCardPayment Where IsDel = 0 And IsPay = 0 And IsAuditGM = 1 {0}", sqlWhere);
+            string sql_1 = string.Format(@"Select * From Grp_CreditCardPayment Where IsDel = 0 And IsPay = 0 And (IsAuditGM = 1 Or IsAuditGM = 3 ){0}", sqlWhere);
             #endregion
 
             var _paymentDatas = _sqlSugar.SqlQueryable<Grp_CreditCardPayment>(sql_1).ToList();//付款信息
@@ -2292,7 +2292,9 @@ namespace OASystem.API.Controllers
                                 PayCurrCode = setDatas.Find(it => it.Id == hotelContent.Currency)?.Name ?? "",
                                 PaymentAmount = _PaymentAmount1,
                                 PayRate = hotelContent.Rate,
-                                CNYSubTotalAmount = _CNYSubTotalAmount1
+                                CNYSubTotalAmount = _CNYSubTotalAmount1,
+                                AuditStatus = payInfo.IsAuditGM
+
                             };
                             string remaksDescription1 = $"【{childInfo1.PayType}】【{childInfo1.ModuleName}】{rouNumber}、[申请人:{childInfo1.Applicant}]{subPriceName}[收款方:{childInfo1.Payee}] {childInfo1.PayCurrCode} {_PaymentAmount1.ToString("#0.00")}、CNY:{childInfo1.CNYSubTotalAmount.ToString("#0.00")}(团组:{groupInfo.TeamName})";
 
@@ -2330,7 +2332,8 @@ namespace OASystem.API.Controllers
                             PayCurrCode = setDatas.Find(it => it.Id == payInfo.PaymentCurrency)?.Name ?? "",
                             PaymentAmount = _PaymentAmount,
                             PayRate = payInfo.DayRate,
-                            CNYSubTotalAmount = _CNYSubTotalAmount
+                            CNYSubTotalAmount = _CNYSubTotalAmount,
+                            AuditStatus = payInfo.IsAuditGM
                         };
 
                         string remaksDescription = $"【{childInfo.PayType}】【{childInfo.ModuleName}】{rouNumber}、[申请人:{childInfo.Applicant}]{priName}[收款方:{childInfo.Payee}] {childInfo.PayCurrCode} {_PaymentAmount.ToString("#0.00")}、CNY:{childInfo.CNYSubTotalAmount.ToString("#0.00")}(团组:{groupInfo.TeamName})";

+ 2 - 5
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -4085,8 +4085,8 @@ namespace OASystem.API.Controllers
                 string fileUrl = (string)fileView.Data.GetType().GetProperty("Url").GetValue(fileView.Data, null);
                 int sign = (int)data.Data.GetType().GetProperty("sign").GetValue(data.Data, null);
                 string md5Sign = GeneralMethod.Encrypt($"{sign}&fileName={fileUrl}");
-                string url = string.Format("http://oa.pan-american-intl.com:4399/?sign={0}&fileName={1}", sign,fileUrl);
-                await AppNoticeLibrary.SendUserMsg_GroupShare_ToGM(dto.DiId, new List<string>() { "208","5" }, dto.UserId, url);
+                string url = string.Format("http://oa.pan-american-intl.com:4399/#/Sankunginfo?sign={0}&fileName={1}", sign,fileUrl);
+                await AppNoticeLibrary.SendUserMsg_GroupShare_ToGM(dto.DiId, new List<string>() { "208","5","233" }, dto.UserId, url);
 
 
                 return Ok(JsonView(true, data.Msg, data.Data));
@@ -12240,7 +12240,6 @@ ORDER by  gctggrc.id DESC
         //}
         #endregion
 
-
         #region 查看邀请方
         /// <summary>
         /// 查看邀请方
@@ -12403,8 +12402,6 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
 
         #endregion
 
-
-
         #region 报批行程
         /// <summary>
         /// 报批行程初始化

+ 211 - 89
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -25,6 +25,7 @@ using System.ComponentModel.Design;
 using NetTaste;
 using OASystem.Domain.ViewModels.QiYeWeChat;
 using NPOI.POIFS.Crypt.Dsig;
+using EyeSoft.SequentialIdentity;
 
 namespace OASystem.API.Controllers
 {
@@ -2253,6 +2254,7 @@ namespace OASystem.API.Controllers
         private async Task<SalesYOYView> GroupSales(int companyId, int groupPickupUserId,string beginDt, string endDt)
         {
             decimal thisSales = 0.00M, lastSales = 0.00M, yoy = 1.00M;
+
             var _view = new SalesYOYView();
             List<int> userIds = new List<int>();
             userIds = await GetUserIds(companyId, groupPickupUserId);
@@ -2270,101 +2272,59 @@ namespace OASystem.API.Controllers
                 };
                 return _view;
             }
-             
-
-            string sql = string.Format($@"SELECT
-    CAST(SUM(Sales) AS decimal(12,2)) AS Sales
-FROM
-  (
-    SELECT
-      YEAR(di.VisitDate) AS [Year],
-      (
-        SELECT
-          CAST(SUM(ItemSumPrice * Rate) AS decimal(12,2))
-        FROM
-          Fin_ForeignReceivables
-        WHERE
-          IsDel = 0
-          AND AddingWay IN (0, 1, 2)
-          AND di.Id = Diid
-      ) AS Sales
-    FROM
-      Grp_DelegationInfo di
-    WHERE
-      di.IsDel = 0
-	  AND di.IsSure = 1
-      AND di.JietuanOperator IN (
-        SELECT
-          Id
-        FROM
-          Sys_Users
-        WITH
-          (NoLock)
-        WHERE
-          IsDel = 0 {userSqlWhere} 
-      )
-      AND di.VisitDate BETWEEN '{beginDt}' AND '{endDt}'
-  ) temp");
-
-            var newDB = _sqlSugar.CopyNew();
-            var salesData = newDB.SqlQueryable<SalesView>(sql).First();
-
-            thisSales = salesData?.Sales ?? 0.00M;
 
             string lastBeginDt = Convert.ToDateTime(beginDt).AddYears(-1).ToString("yyyy-MM-dd HH:mm:ss"),
                    lastEndDt = Convert.ToDateTime(endDt).AddYears(-1).ToString("yyyy-MM-dd HH:mm:ss");
-            string lastSql = string.Format($@"SELECT
-    CAST(SUM(Sales) AS decimal(12,2)) AS Sales
+            string salesSql = string.Format(@"
+SELECT
+	'ThisSales' As [Name],
+	CAST(SUM(Sales) AS decimal(12,2)) As Sales
 FROM
-  (
-    SELECT
-      YEAR(di.VisitDate) AS [Year],
-      (
-        SELECT
-          CAST(SUM(ItemSumPrice * Rate) AS decimal(12,2))
-        FROM
-          Fin_ForeignReceivables
-        WHERE
-          IsDel = 0
-          AND AddingWay IN (0, 1, 2)
-          AND di.Id = Diid
-      ) AS Sales
-    FROM
-      Grp_DelegationInfo di
-    WHERE
-      di.IsDel = 0
-	  AND di.IsSure = 1
-      AND di.JietuanOperator IN (
-        SELECT
-          Id
-        FROM
-          Sys_Users
-        WITH
-          (NoLock)
-        WHERE
-          IsDel = 0 {userSqlWhere} 
-      )
-      AND di.Issure = 1
-      AND di.VisitDate BETWEEN '{lastBeginDt}' AND '{lastEndDt}'
-  ) temp");
-
-            var salesData1 = newDB.SqlQueryable<SalesView>(lastSql).First();
-            lastSales = salesData1?.Sales ?? 0.00M;
-
-            if (lastSales != 0 && thisSales != 0) yoy = (thisSales - lastSales) / lastSales;
-
-            _view = new SalesYOYView
-            {
+	(
+	SELECT di.VisitDate,
+		(SELECT  CAST(SUM(ItemSumPrice * Rate) AS decimal(12,2)) FROM Fin_ForeignReceivables
+		WHERE IsDel = 0 AND AddingWay IN (0, 1, 2)AND di.Id = Diid
+		) AS Sales
+	FROM
+		Grp_DelegationInfo di
+	WHERE di.IsDel = 0 AND di.IsSure = 1
+		AND di.JietuanOperator IN (SELECT Id FROM Sys_Users WITH (NoLock) WHERE IsDel = 0  {0})
+		AND di.VisitDate BETWEEN '{1}' AND '{2}'
+	) temp
+Union ALL
+SELECT
+	'LastSales' As [Name],
+	CAST(SUM(Sales) AS decimal(12,2)) As Sales
+FROM
+	(
+	SELECT di.VisitDate,
+		(SELECT  CAST(SUM(ItemSumPrice * Rate) AS decimal(12,2)) FROM Fin_ForeignReceivables
+		WHERE IsDel = 0 AND AddingWay IN (0, 1, 2)AND di.Id = Diid
+		) AS Sales
+	FROM
+		Grp_DelegationInfo di
+	WHERE di.IsDel = 0 AND di.IsSure = 1
+		AND di.JietuanOperator IN (SELECT Id FROM Sys_Users WITH (NoLock) WHERE IsDel = 0 {3})
+		AND di.VisitDate BETWEEN '{4}' AND '{5}'
+	) temp", userSqlWhere, beginDt, endDt, userSqlWhere, lastBeginDt, lastEndDt);
+
+            var salesData = await _sqlSugar.SqlQueryable<SalesView>(salesSql).ToListAsync();
+
+             thisSales = salesData.Where(x => x.Name.Equals("ThisSales")).First()?.Sales ?? 0;
+             lastSales = salesData.Where(x => x.Name.Equals("LastSales")).First()?.Sales ?? 0;
+
+                if (lastSales != 0 && thisSales != 0) yoy = (thisSales - lastSales) / lastSales;
+
+            return new SalesYOYView() {
                 thisYearSales = thisSales.ToString("#0.00"),
                 lastYearSales = lastSales.ToString("#0.00"),
                 yoy = yoy.ToString("#0.00")
-
             };
-            return _view;
         }
 
         private class SalesView
         {
+            public string Name { get; set; }
             public decimal Sales { get; set; }
         }
 
@@ -2516,11 +2476,18 @@ FROM
             }
             else
             {
-                return Ok(JsonView(true, "操作成功!", new
+                if (_dto.PortType == 2 || _dto.PortType == 3)
                 {
-                    customerTypeData = new List<object> { },
-                    clientGradeData = new List<object> { }
-                }));
+                    return Ok(JsonView(true, "操作成功!", new List<object> { }));
+                }
+                else
+                {
+                    return Ok(JsonView(true, "操作成功!", new
+                    {
+                        customerTypeData = new List<object> { },
+                        clientGradeData = new List<object> { }
+                    }));
+                }
             }
 
             string sql = "";
@@ -2566,7 +2533,6 @@ And VisitDate Between '{beginDt}' And  '{endDt}'
 Group By [Name]
 Order By Count Desc");
 
-
                 var customerTypeData = await _sqlSugar.SqlQueryable<MarketingSalesGroupStatisticsView>(sql1).ToListAsync();
 
                 string sql2 = string.Format(@$"Select 
@@ -2646,7 +2612,6 @@ Order By Count Desc");
 	And VisitDate Between '{beginDt}' And  '{endDt}'
 	Group By CnName");
 
-
             RefAsync<int> total = 0;
 
             var rankingData = await _sqlSugar.SqlQueryable<MarketingSalesOrderRankingView>(sql).ToPageListAsync(_dto.PageIndex, _dto.PageSize, total);
@@ -2654,6 +2619,163 @@ Order By Count Desc");
             return Ok(JsonView(true, "操作成功!", rankingData, total));
         }
 
+        /// <summary>
+        ///  市场部销售额
+        ///  团组列表、客户类型、客户等级、接单排名
+        ///  (增加团组查询条件 IsSure=1)
+        /// </summary>
+        /// <param name="_dto">市场部销售额请求dto</param>
+        /// <returns></returns>
+        [HttpPost("PostMarketingSalesGroupItem")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostMarketingSalesGroupItem(MarketingSalesGroupListDto _dto)
+        {
+            #region  参数验证
+
+            MarketingSalesStatisticsDtoFoalidator validationRules = new MarketingSalesStatisticsDtoFoalidator();
+            var validResult = await validationRules.ValidateAsync(_dto);
+            if (!validResult.IsValid)
+            {
+                var errors = new StringBuilder();
+                foreach (var error in validResult.Errors) errors.AppendLine(error.ErrorMessage);
+                return Ok(JsonView(false, errors.ToString()));
+            }
+
+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
+
+            #region 页面操作权限验证
+            pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
+
+            if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, MsgTips.CheckAuth));
+            #endregion
+
+            #endregion
+
+            string userSql = "";
+            List<int> userIds = new List<int>();
+            userIds = await GetUserIds(_dto.CompanyId, _dto.GroupPickupUserId);
+
+            if (userIds.Count <= 0)
+            {
+                return Ok(JsonView(true, "操作成功!", new List<object> { }, 0));
+            }
+            else userSql = @$" And di.JietuanOperator In ({string.Join(",", userIds)})";
+
+
+            if (!string.IsNullOrEmpty(_dto.SearchCriteria))
+            {
+                userSql += string.Format(@$" AND di.TeamName Like '%{_dto.SearchCriteria}%'");
+            }
+
+            string beginDt = $"{_dto.BeginDt} 00:00:00", endDt = $"{_dto.EndDt} 23:59:59";
+
+
+            #region 团组List
+
+            string sql = string.Format(@$"SELECT
+  ROW_NUMBER() OVER (
+    ORDER BY
+      CollectionDays
+  ) AS RowNumber,
+  *
+FROM
+  (
+    SELECT
+      di.Id,
+      di.TeamName,
+      di.ClientUnit,
+      di.ClientName,
+      di.VisitDate,
+      di.VisitPNumber,
+      di.JietuanOperator,
+      di.VisitEndDate,
+      (
+        SELECT
+          CAST(
+            COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2)
+          ) AS GroupSales
+        FROM
+          Fin_ForeignReceivables
+        WHERE
+          IsDel = 0
+          AND di.Id = Diid
+          AND AddingWay IN (0, 1, 2)
+      ) AS GroupSales,
+      u.CnName AS GroupPickupUser,
+      DATEADD(DAY, 7, di.VisitEndDate) AS CollectionDays
+    FROM
+      Grp_DelegationInfo di
+    WITH
+      (NoLock)
+      LEFT JOIN Sys_Users u ON di.JietuanOperator = u.Id
+    WHERE
+      di.Isdel = 0
+	  AND di.IsSure = 1 {userSql} 
+      AND VisitDate Between '{beginDt}' And  '{endDt}'
+  ) Temp ");
+            RefAsync<int> total = 0;
+            var groupData = await _sqlSugar.SqlQueryable<MarketingSalesGroupList>(sql).ToPageListAsync(_dto.PageIndex, _dto.PageSize, total);
+            #endregion
+
+            #region 客户类型、客户等级 统计
+
+            string sql1 = string.Format(@$"Select 
+	sd.[Name],
+	Count(*) As [Count]
+From Grp_DelegationInfo di
+Left Join Sys_SetData sd On di.TeamDid = sd.Id
+Where di.Isdel = 0 
+And IsSure = 1 {userSql} 
+And VisitDate Between '{beginDt}' And  '{endDt}'
+Group By [Name]
+Order By Count Desc");
+
+            var customerTypeData = await _sqlSugar.SqlQueryable<MarketingSalesGroupStatisticsView>(sql1).ToListAsync();
+
+            string sql2 = string.Format(@$"Select 
+	sd.[Name],
+	Count(*) As [Count]
+From Grp_DelegationInfo di
+Left Join Sys_SetData sd On di.TeamLevSId = sd.Id
+Where di.Isdel = 0 
+And IsSure = 1 {userSql} 
+And VisitDate Between '{beginDt}' And  '{endDt}'
+Group By [Name]
+Order By Count Desc");
+            var clientGradeData = await _sqlSugar.SqlQueryable<MarketingSalesGroupStatisticsView>(sql2).ToListAsync();
+            #endregion
+
+            #region 接单排名
+
+            string sql4 = string.Format(@$"Select 
+	ROW_NUMBER() Over(Order By Count(*) Desc) As RowNumber,
+	u.CnName As UserName,
+	Count(*) As [Count]
+	From Grp_DelegationInfo di
+	Left Join Sys_Users u On di.JietuanOperator = u.Id
+	Where di.Isdel = 0 
+    AND IsSure = 1 {userSql} 
+	And VisitDate Between '{beginDt}' And  '{endDt}'
+	Group By CnName");
+
+            var rankingData = await _sqlSugar.SqlQueryable<MarketingSalesOrderRankingView>(sql4).ToListAsync();
+
+            #endregion
+
+            var viewData = new {
+                groupData = groupData,
+                groupTotal = total,
+                customerTypeData = customerTypeData,
+                clientGradeData = clientGradeData,
+                rankingData = rankingData
+            };
+
+
+            return Ok(JsonView(true, "操作成功!", viewData, total));
+        }
+
+
+
         /// <summary>
         ///  市场部销售额
         ///  客户拜访列表

+ 1 - 1
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Config.cs

@@ -346,7 +346,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
 >团组:<font color='info'>{0}</font> 
 
->操作时间:<font color='comment'>{2}</font> 
+>操作时间:<font color='comment'>{1}</font> 
 
 [出入境费用已确认,请进行相关流程操作。] ", info.TeamName, info.RefreshDate);
 

+ 6 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_DailyFeePaymentView.cs

@@ -494,6 +494,12 @@ namespace OASystem.Domain.ViewModels.Financial
         /// 费用描述 
         /// </summary>
         public string RemaksDescription { get; set; }
+
+        /// <summary>
+        /// 审核状态
+        /// 0 未审核 1已通过 2未通过 3 自动审核
+        /// </summary>
+        public int AuditStatus { get; set; }
     }
 
     public class PaymentRequestCheckedView

+ 0 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -242,7 +242,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         //修改验证
                         //IsConfirm == 2 不可修改
-
                         var info = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.Id == enterExitCost.Id).First();
                         if (info.IsConfirm == 2)
                         {