From 8b613a5275e6fe23b91f65cc6a7fba720ae4d7ef Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期二, 18 二月 2025 11:10:35 +0800
Subject: [PATCH] 完成阿里云本地上传token生成,实现小程序本地上传

---
 cylsg/cylsg.Application/CyOS/CyOSStaffController.cs |   63 ++++++++++++++++++++-----------
 1 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs b/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
index 0c322a4..a888020 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>
@@ -39,6 +42,7 @@
         [HttpPost]
         public async Task<WorekPlandto> getplanelist(SearchOaWorekPlan param)
         {
+            
             if(! await CheckRols())
             {
                 throw Oops.Oh("娌℃湁鏉冮檺");
@@ -48,6 +52,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 +164,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,22 +183,20 @@
             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;
             pram.RewardType = 1;
-         
-           
-
-
-
-
-
+            pram.Keyid = null;
             await  _SugarClient.InsertNav(pram).Include(x=>x.WorkPlanAttachments).ExecuteCommandAsync();
             return true;
             
@@ -230,18 +237,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 +275,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;
@@ -295,12 +313,11 @@
             {
                 throw Oops.Oh("娌℃湁鏉冮檺");
             }
-            return await _SugarClient.Queryable<OaWorkPlan>().Includes(x=>x.SentStaff).Includes(x=>x.Depart).Includes(x=>x.WorkPlanAttachments).Where(x => x.Keyid == id).FirstAsync();
+            return await _SugarClient.Queryable<OaWorkPlan>().Includes(x=>x.SentStaff).Includes(x => x.OaWorkPlanShenpis,y=>y.ApprovalStaff).Includes(x=>x.Depart).Includes(x=>x.WorkPlanAttachments).Where(x => x.Keyid == id).FirstAsync();
         }
         /// <summary>
         /// 鍒犻櫎
         /// </summary>
-        /// <param name="pram"></param>
         /// <returns></returns>
         [HttpDelete]
         public async Task<bool> DelOderAsync(int id )

--
Gitblit v1.9.1