Browse Source

1、Grp_EnterExitCost 增加字段 IsConfirm(1:未确认;2已确认)
2、编写PostEnterExitCostIsConfirm Code
3、

amigotrip 8 months ago
parent
commit
649ba5422e

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

@@ -4084,8 +4084,9 @@ 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 url = string.Format("http://oa.pan-american-intl.com:4399/?sign={0}&fileUrl={1}", sign, fileUrl);
-                await AppNoticeLibrary.SendUserMsg_GroupShare_ToGM(dto.DiId, "208", dto.UserId, url);
+                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);
 
 
                 return Ok(JsonView(true, data.Msg, data.Data));
@@ -4096,6 +4097,31 @@ namespace OASystem.API.Controllers
             }
         }
 
+        /// <summary>
+        /// 团组模块 - 出入境费用 - Confirm 费用
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostEnterExitCostIsConfirm(ConfirmCostDto dto)
+        {
+            //TODO:测试完毕需把对应的用户ID更改
+            //1、数据表添加字段
+            //2、更改字段接口()
+            var _view = await _enterExitCostRep.ConfirmCost(dto);
+
+            //3、确认成功 给财务发送消息
+            if (_view.Code == 200)
+            {
+                if (dto.Type == 1)
+                {
+                    int diId = _enterExitCostRep._sqlSugar.Queryable<Grp_EnterExitCost>().Where(x => x.IsDel == 0 && x.Id == dto.Id).First()?.DiId ?? 0;
+                    await AppNoticeLibrary.SendUserMsg_GroupShare_ToFinance(diId);
+                }
+            }
+            return Ok(_view);
+        }
+
 
         /// <summary>
         /// 团组模块 - 出入境费用 - File downlaod

+ 2 - 1
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -3251,7 +3251,8 @@ namespace OASystem.API.OAMethodLib
                             options.CreateNoteHyperlinks = true;
 
                             doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName, options);
-                            _view.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName };
+                            //_view.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName };
+                            _view.Data = new { Url = strFileName };
                             _view.Msg = "成功";
                             return _view;
 

+ 16 - 4
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Config.cs

@@ -232,7 +232,6 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             return result;
         }
 
-
         /// <summary>
         /// 日付申请审核结果推送给申请人
         /// </summary>
@@ -332,14 +331,27 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 >操作人员:{1}
 >操作时间:<font color='comment'>{2}</font> 
 
-<font color='comment'>- </font>
-
-[详细信息请前往OA系统查看]({3}) ", info.TeamName, info.CreateUser, info.RefreshDate, info.Url);
+[请点击进入明细进行查看或确认]({3}) ", info.TeamName, info.CreateUser, info.RefreshDate, info.Url);
 
             return result;
         }
 
+        /// <summary>
+        /// 出入境费用 确认 通知发送给 财务相关人员
+        /// </summary>
+        /// <returns></returns>
+        public static string GroupShare_ToFinance(GroupShare_ToUserModel info)
+        {
+            string result = string.Format(@" `出入境费用确认操作通知`  
 
+>团组:<font color='info'>{0}</font> 
+
+>操作时间:<font color='comment'>{2}</font> 
+
+[出入境费用已确认,请进行相关流程操作。] ", info.TeamName, info.RefreshDate);
+
+            return result;
+        }
     }
 
 

+ 40 - 6
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -1,4 +1,5 @@
-using NPOI.SS.Formula.Functions;
+using EyeSoft.Runtime.InteropServices;
+using NPOI.SS.Formula.Functions;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
@@ -524,6 +525,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
         /// <returns></returns>
         public static async Task<bool> SendUserMsg_GroupStatus_PayResult(int Grp_CreditCardPaymentId, List<string> userId)
         {
+            //, QiyeWeChatEnum qiyeWeChat
             Grp_CreditCardPayment ccp = _grpDeleRep.Query<Grp_CreditCardPayment>(s => s.Id == Grp_CreditCardPaymentId).First();
             Grp_DelegationInfo group = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == ccp.DIId).First();
 
@@ -788,18 +790,16 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
         #region 三公费用更改通知
 
-
         /// <summary>
         /// 三公费用更改通知发送总经理(21)
         /// </summary>
         /// <param name="sign"></param>
         /// <returns></returns>
-        public static async Task<bool> SendUserMsg_GroupShare_ToGM(int diId,string receivedUserId, int updateUserId, string url)
+        public static async Task<bool> SendUserMsg_GroupShare_ToGM(int diId,List<string> receivedUserIds, int updateUserId, string url)
         {
 
             Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
-            List<string> qwUserIdList =new List<string>() { receivedUserId };
-
+            
             GroupShare_ToGMModel info = new GroupShare_ToGMModel()
             {
                 RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
@@ -808,8 +808,9 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
                 Url = url
             };
 
-            if (qwUserIdList.Count > 0)
+            if (receivedUserIds.Count > 0)
             {
+                List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
                 ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupShare_ToGM(info));
                 if (result.errcode != 0)
                 {
@@ -821,6 +822,39 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             return true;
         }
 
+        /// <summary>
+        /// 三公费用确认通知发送财务部人员
+        /// </summary>
+        /// <param name="sign"></param>
+        /// <returns></returns>
+        public static async Task<bool> SendUserMsg_GroupShare_ToFinance(int diId)
+        {
+
+            Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
+
+            GroupShare_ToUserModel info = new GroupShare_ToUserModel()
+            {
+                RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
+                TeamName = groupInfo.TeamName
+            };
+
+            List<string> receivedUserIds = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.DepId == 3).Select(x => x.Id.ToString()).ToList();
+            receivedUserIds = new List<string>() { "208","4", "233" };
+            if (receivedUserIds.Count > 0)
+            {
+                List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupShare_ToFinance(info));
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+
         #endregion
 
 

+ 14 - 0
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDto.cs

@@ -218,6 +218,20 @@ namespace OASystem.Domain.Dtos.Groups
 
     }
 
+    public class ConfirmCostDto {
+
+        /// <summary>
+        /// 类型
+        /// 1:确认 2:撤回
+        /// </summary>
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 数据Id
+        /// </summary>
+        public int Id { get; set; }
+    }
+
     /// <summary>
     /// 出入境费用 - 表格导出 Dto
     /// </summary>

+ 7 - 1
OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCost.cs

@@ -71,7 +71,6 @@ namespace OASystem.Domain.Entities.Groups
 
         #endregion
 
-
         /// <summary>
         /// 国际旅费合计(经济舱)
         /// </summary>
@@ -212,5 +211,12 @@ namespace OASystem.Domain.Entities.Groups
         public int AirGWC_Checked { get; set; }
 
         #endregion
+
+        /// <summary>
+        /// 确认费用(确认费用后 不可更改)
+        /// 1:未确认 2:已确认
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int IsConfirm { get; set; } = 1;
     }
 }

+ 49 - 5
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -226,8 +226,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             trainingExpenseData = trainingExpenseData.Select(it => { it.CreateUserId = dto.UserId; return it; }).ToList();
             if (trainingExpenseData.Count > 0) subData.AddRange(trainingExpenseData);
 
-
-
             //处理币种string
             enterExitCost.CurrencyRemark = CommonFun.GetCurrencyChinaToString(dto.Currencys);
             enterExitCost.CreateUserId = dto.UserId;
@@ -239,9 +237,19 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 try
                 {
                     int enterExitId = 0;
-
+                    
                     if (enterExitCost.Id > 0) //修改
                     {
+                        //修改验证
+                        //IsConfirm == 2 不可修改
+
+                        var info = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.Id == enterExitCost.Id).First();
+                        if (info.IsConfirm == 2)
+                        {
+                            result.Msg = "该团出入境费用已确认!不可更改!!";
+                            return result;
+                        }
+
                         var updateId = _sqlSugar.Updateable<Grp_EnterExitCost>(enterExitCost)
                                                 .IgnoreColumns(it => new { it.DeleteUserId, it.DeleteTime, it.CreateUserId, it.CreateTime, it.IsDel })
                                                 .ExecuteCommand();
@@ -254,14 +262,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             _sqlSugar.RollbackTran();
                             result.Msg = "修改操作失败!";
                             return result;
-
                         }
                     }
                     else
                     {
                         //效重 根据团组Id 
 
-                        var info  = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
+                        var info = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
                         if (info != null )
                         {
                             _sqlSugar.RollbackTran();
@@ -315,6 +322,43 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
         }
 
+        /// <summary>
+        /// 确认费用
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<JsonView> ConfirmCost(ConfirmCostDto dto)
+        {
+            var _view = new JsonView() { Code = 20001, Msg = "操作失败!" };
+            if (dto.Id < 1)
+            {
+                _view.Msg = MsgTips.Id;
+                return _view;
+            }
+
+            int confirm = 1;
+            if (dto.Type == 1) confirm = 2; // 确认
+            else if (dto.Type == 2) { confirm = 1; } // 撤回
+            else
+            {
+                _view.Msg = "请传入正确的type;1:确认 2:撤回";
+                return _view;
+            }
+            var update = await _sqlSugar.Updateable<Grp_EnterExitCost>()
+                                        .SetColumns(x => new Grp_EnterExitCost() { IsConfirm = confirm })
+                                        .Where(x => x.Id == dto.Id)
+                                        .ExecuteCommandAsync();
+            if (update>0)
+            {
+                _view.Code = 200;
+                _view.Msg = "操作成功!";
+                return _view;
+            }
+
+            return _view;
+        }
+
+
         /// <summary>
         /// Del
         /// </summary>