From f4a0b32daa9e021227707bcfb70b67738bd1b000 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期五, 24 一月 2025 17:28:13 +0800
Subject: [PATCH] 修改报销部分逻辑

---
 cylsg/cylsg.Application/CyOS/CyOSBaoXiaoCaiWuController.cs   |    4 
 cylsg/cylsg.Model/ECTEModel/OaWorkPlan.cs                    |    9 ++
 cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs  |   17 +++++
 cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs |   14 ++++
 cylsg/cylsg.Model/ECTEModel/OaWorkPlanShenpi.cs              |   17 +++++
 cylsg/cylsg.redis/IEzCoreNetRedisService.cs                  |    5 +
 cylsg/cylsg.Application/CyOS/CyOSStaffController.cs          |   51 ++++++++++++----
 cylsg/cylsg.Application/CyOS/CyOSSettingController.cs        |   16 ++++
 cylsg/cylsg.redis/EzCoreNetRedisService.cs                   |   16 +++++
 9 files changed, 127 insertions(+), 22 deletions(-)

diff --git a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoCaiWuController.cs b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoCaiWuController.cs
index f839286..7b345c9 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoCaiWuController.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoCaiWuController.cs
@@ -42,7 +42,7 @@
             }
 
             Expression<Func<OaWorkPlan, bool>> SearchList = (x) => true;
-
+            SearchList = SearchList.And(x => x.ApprovalStatus != PlanStatusType.Uncommitted);
             //宸濆嵃宸ヤ綔鍗�
             SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
             SearchList = SearchList.And(x => x.PlanType == 3);
@@ -158,7 +158,7 @@
                     try
                     {
                         data.EvaluationStatus = BaoxiaoStausType.Reimbursed;
-                        data.PlanContent = plan.PlanContent;
+                        //data.PlanContent = plan.PlanContent;
                         data.LastUpdateTime = DateTime.Now;
                         await _SugarClient.Updateable(data).ExecuteCommandAsync();
 
diff --git a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs
index c4aa2a1..a8e452b 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs
@@ -1,5 +1,6 @@
 锘縰sing cylsg.Model.ECTEModel;
 using cylsg.Model.utilityViewModel;
+using cylsg.utility.Extend;
 using ECTESTOA;
 using Furion.LinqBuilder;
 using Models;
@@ -42,6 +43,7 @@
             Expression<Func<OaWorkPlan, bool>> SearchList = (x) => true;
 
             //宸濆嵃宸ヤ綔鍗�
+            SearchList = SearchList.And(x => x.ApprovalStatus != PlanStatusType.Uncommitted);
             SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
             SearchList = SearchList.And(x => x.PlanType == 3);
             SearchList = SearchList.And(x => x.PlanDataType == 17);
@@ -135,6 +137,10 @@
                 throw Oops.Oh("娌℃湁鎵惧埌鎶ラ攢鍗�");
             if ( data.ApprovalStatus != PlanStatusType.unApproval)
                 throw Oops.Oh("鎶ラ攢鍗曞凡缁忔壒澶嶅畬姣�");
+            if (data.ApprovalStatus == PlanStatusType.Uncommitted)
+            {
+                throw Oops.Oh("鎶ラ攢鍗曟湭鎻愪氦涓嶅彲瀹℃壒");
+            }
             OaWorkPlanShenpi shenpi = data.OaWorkPlanShenpis.Where(x => x.ApprovalStaffId == Permissions.MemberId&&x.Buzhou==2).FirstOrDefault();
             await _SugarClient.AsTenant().BeginTranAsync();
             try
@@ -168,6 +174,17 @@
                     };
                     await _SugarClient.Insertable(shenpi).ExecuteCommandAsync();
                 }
+                if(!(param.RewardResult?.isPureNum()==true))
+                {
+                    throw Oops.Oh("绉戠洰閫夋嫨閿欒");
+                }
+                //瀹℃壒鏃跺彲淇敼鍐呭
+                data.RewardResult = param.RewardResult;
+                data.PlanContent = param.PlanContent;
+                if(param.PlanMoney>0&&param.PlanMoney<=data.PlanMoney)
+                data.PlanMoney = param.PlanMoney;
+
+
 
                 data.ApprovalTime = DateTime.Now;
                 data.ApprovalStatus = param.ApprovalStatus;
diff --git a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs
index 6ec8bcd..39e60fe 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs
@@ -41,6 +41,7 @@
             Expression<Func<OaWorkPlan, bool>> SearchList = (x) => true;
 
             //宸濆嵃宸ヤ綔鍗�
+            SearchList = SearchList.And(x => x.ApprovalStatus != PlanStatusType.Uncommitted);
             SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
             SearchList = SearchList.And(x => x.PlanType == 3);
             SearchList = SearchList.And(x => x.PlanDataType == 17);
@@ -168,6 +169,10 @@
                 throw Oops.Oh("娌℃湁鎵惧埌鎶ラ攢鍗�");
             if (data.ApprovalStatus != null && data.ApprovalStatus != PlanStatusType.unApproval)
                 throw Oops.Oh("鎶ラ攢鍗曞凡缁忔壒澶嶅畬姣�");
+            if(data.ApprovalStatus== PlanStatusType.Uncommitted)
+            {
+                throw Oops.Oh("鎶ラ攢鍗曟湭鎻愪氦涓嶅彲瀹℃壒");
+            }
             OaWorkPlanShenpi shenpi = data.OaWorkPlanShenpis.Where(x => x.ApprovalStaffId == Permissions.MemberId&&x.Buzhou==1).FirstOrDefault();
              if (shenpi!=null)
             {
@@ -178,7 +183,14 @@
             }
              else
             {
-              await   _SugarClient.AsTenant().BeginTranAsync();
+    
+
+                data.RewardResult = param.RewardResult;
+                data.PlanContent = param.PlanContent;
+                if (param.PlanMoney > 0 && param.PlanMoney <= data.PlanMoney)
+                    data.PlanMoney = param.PlanMoney;
+
+                await   _SugarClient.AsTenant().BeginTranAsync();
                 try
                 {
                     if (param.ApprovalStatus == PlanStatusType.No)
diff --git a/cylsg/cylsg.Application/CyOS/CyOSSettingController.cs b/cylsg/cylsg.Application/CyOS/CyOSSettingController.cs
index 8db3b42..5442385 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSSettingController.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSSettingController.cs
@@ -1,5 +1,6 @@
 锘縰sing cylsg.Model.ECTEModel;
 using ECTESTOA;
+using EzCoreNet.Redis;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -16,10 +17,13 @@
 
         private readonly ISqlSugarClient _client;
         private readonly IOAServices _oAServices;
-        public CYOSSettingController( ISqlSugarClient client,IOAServices oAServices )
+        private readonly IEzCoreNetRedisService _eZCoreNetRedisService;
+         
+        public CYOSSettingController( ISqlSugarClient client,IOAServices oAServices,IEzCoreNetRedisService netRedisService )
         {
             _client = client.AsTenant().GetConnection("ECTESTOADB");
             _oAServices = oAServices;
+            _eZCoreNetRedisService = netRedisService;
         }
 
         /// <summary>
@@ -50,6 +54,14 @@
                 Remark = x.Remark,
             }).WithCache(3600).ToListAsync();
         }
-
+        /// <summary>
+        /// 鑾峰彇娴佹按鍙�
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        public  string GetShowID()
+        {
+          return   _eZCoreNetRedisService.GetYYYMMddAnd4sn();
+        }
     }
 }
diff --git a/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs b/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
index 0c322a4..1c5135c 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
@@ -5,6 +5,7 @@
 using cylsg.utility.Extend;
 using Cylsg.Filter;
 using ECTESTOA;
+using EzCoreNet.Redis;
 using Furion.LinqBuilder;
 using System;
 using System.Collections.Generic;
@@ -25,12 +26,14 @@
     {
         private readonly IOAServices _OAServices;
         private readonly ISqlSugarClient _SugarClient;
+        private readonly IEzCoreNetRedisService _ezCoreNetRedisService;
 
         private  ECTESTOAPermissions Permissions;
-        public CyOSStaffController(IOAServices oaServices, ISqlSugarClient sugarClient)
+        public CyOSStaffController(IOAServices oaServices, ISqlSugarClient sugarClient,IEzCoreNetRedisService netRedisService)
         {
             _OAServices = oaServices;
             _SugarClient = sugarClient.AsTenant().GetConnection("ECTESTOADB");
+            _ezCoreNetRedisService = netRedisService;
         }
 
         /// <summary>
@@ -48,6 +51,7 @@
             SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
             SearchList = SearchList.And(x => x.PlanType == 3);
             SearchList = SearchList.And(x => x.PlanDataType == 17);
+
             if (!string.IsNullOrEmpty(param.StaffName))
             {
                 SearchList = SearchList.And(x => x.SentStaff.Name.Contains(param.StaffName));
@@ -159,6 +163,10 @@
                    
                 }
             }
+            if (pram.ApprovalStatus != PlanStatusType.Uncommitted)
+                pram.EvaluationContent = _ezCoreNetRedisService.GetYYYMMddAnd4sn();
+            else
+                pram.EvaluationContent = "";
             pram.PlanType = 3;//鍥哄畾涓�3
             pram.MemberId = _OAServices.firmId;
             pram.SentStaffId = Permissions.MemberId;
@@ -174,11 +182,15 @@
             pram.PlanRemark = "";
             pram.PlanPeople = Permissions.Name;
             pram.PlanComplany = "";
-            pram.PlanStatus = PlanStatusType.unApproval;
+            if(pram.PlanStatus!= PlanStatusType.Uncommitted)
+            {
+                pram.PlanStatus = PlanStatusType.unApproval;
+            }
+         
+           
             pram.ApprovalStaffId = Guid.Empty;
             pram.ApprovalTime=DateTime.Now;
-            pram.ApprovalContent = "";
-            pram.EvaluationContent = "";
+            pram.ApprovalContent = "";           
             pram.EvaluationStaffId = Guid.Empty;
             pram.EvaluationTime = DateTime.Now;     
             pram.RewardMoney = 0;
@@ -230,18 +242,21 @@
             var data= await _SugarClient.Queryable<OaWorkPlan>().Includes(x=>x.WorkPlanAttachments).Includes(x=>x.OaWorkPlanShenpis).Where(x=>x.Keyid==pram.Keyid&&x.SentStaffId==Permissions.MemberId).FirstAsync();
             if(data==null)
                 throw Oops.Oh("娌℃湁鏉冮檺");
-            if(data.ApprovalStatus!= PlanStatusType.unApproval||data.OaWorkPlanShenpis.Count>0)
+            if (data.ApprovalStatus != PlanStatusType.Uncommitted)
             {
-                if(data.HoubufapiaoStatus == HoubufapiaoStatusType.HouBuFaPiao&&data.HoubufapiaoStatus== HoubufapiaoStatusType.HouBuFaPiao)
+                if (data.ApprovalStatus != PlanStatusType.unApproval || data.OaWorkPlanShenpis.Count > 0)
                 {
-                    //鍚庤ˉ鍙戠エ锛屽彧鑳戒慨鏀瑰彂绁ㄥ拰闄勪欢
-                    await _SugarClient.UpdateNav(data).Include(x => x.WorkPlanAttachments).ExecuteCommandAsync();
-                    return true;
-                }
-                else
+                    if (data.HoubufapiaoStatus == HoubufapiaoStatusType.HouBuFaPiao && data.HoubufapiaoStatus == HoubufapiaoStatusType.HouBuFaPiao)
+                    {
+                        //鍚庤ˉ鍙戠エ锛屽彧鑳戒慨鏀瑰彂绁ㄥ拰闄勪欢
+                        await _SugarClient.UpdateNav(data).Include(x => x.WorkPlanAttachments).ExecuteCommandAsync();
+                        return true;
+                    }
+                    else
 
-                throw Oops.Oh("宸茬粡杩涘叆瀹℃壒娴佺▼涓嶅彲淇敼");
-                
+                        throw Oops.Oh("宸茬粡杩涘叆瀹℃壒娴佺▼涓嶅彲淇敼");
+
+                }
             }
 
             if (data.RewardResult != pram.RewardResult)
@@ -265,7 +280,15 @@
                 }
 
             }
-         
+
+            if(data.ApprovalStatus== PlanStatusType.Uncommitted&&pram.ApprovalStatus== PlanStatusType.unApproval)
+            {
+                //閲嶆柊鎻愪氦蹇呴』淇敼鏂扮殑鍗曞彿
+                data.EvaluationContent = _ezCoreNetRedisService.GetYYYMMddAnd4sn();
+                data.ApprovalStatus = pram.ApprovalStatus;
+            }
+            
+            
              data.PlanMoney=pram.PlanMoney;
             //鎽樿
              data.PlanContent =pram.PlanContent;
diff --git a/cylsg/cylsg.Model/ECTEModel/OaWorkPlan.cs b/cylsg/cylsg.Model/ECTEModel/OaWorkPlan.cs
index 6c193c2..84d9ea8 100644
--- a/cylsg/cylsg.Model/ECTEModel/OaWorkPlan.cs
+++ b/cylsg/cylsg.Model/ECTEModel/OaWorkPlan.cs
@@ -170,7 +170,7 @@
         public BaoxiaoStausType? EvaluationStatus { get; set; } = BaoxiaoStausType.NotReimbursed;
 
             /// <summary>
-            /// 鑰冭瘎鍐呭
+            /// 鑰冭瘎鍐呭// 鍙樻洿涓� 鎶ラ攢鍗曠紪鍙�  
             /// </summary>
             [SugarColumn(ColumnName = "EvaluationContent", Length = 200)]
             public string? EvaluationContent { get; set; }
@@ -256,7 +256,12 @@
         /// 鍚﹀畾
         /// </summary>
         [Description("鍚﹀畾")]
-        No
+        No,
+        /// <summary>
+        /// 
+        /// </summary>
+        [Description("鏈彁浜�")]
+        Uncommitted
     }
     /// <summary>
     /// 鍚庤ˉ鍙戠エ鐘舵��
diff --git a/cylsg/cylsg.Model/ECTEModel/OaWorkPlanShenpi.cs b/cylsg/cylsg.Model/ECTEModel/OaWorkPlanShenpi.cs
index 151f147..736fc4c 100644
--- a/cylsg/cylsg.Model/ECTEModel/OaWorkPlanShenpi.cs
+++ b/cylsg/cylsg.Model/ECTEModel/OaWorkPlanShenpi.cs
@@ -78,6 +78,21 @@
             /// </summary>
             [SugarColumn(ColumnName = "Buzhou")]
             public int? Buzhou { get; set; }
-        }
+        /// <summary>
+        /// 瀹℃壒鏃朵紶閫掔鐩甀D
+        /// </summary>
+        [SugarColumn( IsIgnore= true)]
+        public string? RewardResult { get; set; }
+        /// <summary>
+        /// 瀹℃壒鏃朵紶閫掓憳瑕�
+        /// </summary>
+        [SugarColumn(IsIgnore = true)]
+        public string? PlanContent { get; set; }
+        /// <summary>
+        /// 瀹℃壒鏃朵紶閫掗噾棰�
+        /// </summary>
+        [SugarColumn(IsIgnore = true)]
+        public decimal? PlanMoney { get; set; }
+    }
     
 }
diff --git a/cylsg/cylsg.redis/EzCoreNetRedisService.cs b/cylsg/cylsg.redis/EzCoreNetRedisService.cs
index 5ce6426..f81b0a7 100644
--- a/cylsg/cylsg.redis/EzCoreNetRedisService.cs
+++ b/cylsg/cylsg.redis/EzCoreNetRedisService.cs
@@ -121,6 +121,22 @@
             return re;
         }
 
+        
+        public string GetYYYMMddAnd4sn()
+        {
+            string formattedDate = DateTime.Now.ToString("yyyyMMdd");
+
+
+            var sn = Incrby($"CreatYYYMMddAnd4snKey:{formattedDate}");
+            if (sn < 1)
+            {
+                //璁剧疆鏈夋晥鏈熼檺涓�24灏忔椂
+                SetTtl($"CreatYYYMMddAnd4snKey:{formattedDate}", 24 * 60 * 60);
+            }
+            string re =   formattedDate + sn.ToString("D4");
+
+            return re;
+        }
         /// <summary>
         ///
         /// </summary>
diff --git a/cylsg/cylsg.redis/IEzCoreNetRedisService.cs b/cylsg/cylsg.redis/IEzCoreNetRedisService.cs
index e7ae2af..b980cdf 100644
--- a/cylsg/cylsg.redis/IEzCoreNetRedisService.cs
+++ b/cylsg/cylsg.redis/IEzCoreNetRedisService.cs
@@ -87,6 +87,11 @@
         /// </summary>
         string Get32sn();
         /// <summary>
+        /// 鑾峰彇yyymmdd +4浣嶆祦姘村彿
+        /// </summary>
+        /// <returns></returns>
+         string GetYYYMMddAnd4sn();
+        /// <summary>
         /// 璁剧疆閿�
         /// </summary>
         /// <param name="LockKey"> 閿並ey</param>

--
Gitblit v1.9.1