From 13dce68bfdf0aca4b05e800494d2cd82c36ac44c Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期四, 22 八月 2024 16:59:13 +0800
Subject: [PATCH] 基础信息页面修改

---
 Wms/Wms/Controllers/BasisController.cs | 2079 ++++++++++------------------------------------------------
 1 files changed, 372 insertions(+), 1,707 deletions(-)

diff --git a/Wms/Wms/Controllers/BasisController.cs b/Wms/Wms/Controllers/BasisController.cs
index 41d72d9..95d7afc 100644
--- a/Wms/Wms/Controllers/BasisController.cs
+++ b/Wms/Wms/Controllers/BasisController.cs
@@ -20,12 +20,16 @@
 using System.Security.Cryptography;
 using System.Data;
 using Model.ModelDto.LogDto;
+using Utility;
+using Model.ModelVm.LogVm;
+using System.Diagnostics;
 
 namespace Wms.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
     [Authorize]
+    [ServiceFilter(typeof(ApiResponseActionFilter))]
     public class BasisController : ControllerBase
     {
         /// <summary>
@@ -44,6 +48,7 @@
         private readonly IFunSettingServer _setting; //鍔熻兘璁惧畾
         private readonly IInterfaceServer _interface;//鎺ュ彛绠$悊
         private readonly IOperationSysServer _operation; //鎿嶄綔鏃ュ織
+        private readonly UserManager _userManager;
         /// <summary>
         /// 鏋勯�犲嚱鏁�
         /// </summary>
@@ -58,7 +63,10 @@
         /// <param name="department">閮ㄩ棬</param>
         /// <param name="setting">鍔熻兘璁惧畾</param>
         /// <param name="operation">鎿嶄綔鏃ュ織</param>
-        public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer, IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc, IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting, IInterfaceServer interfaceS, IOperationSysServer operation)
+        public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer, 
+            IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc, 
+            IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting, 
+            IInterfaceServer interfaceS, IOperationSysServer operation, UserManager userManager)
         {
             _customerSvc = customerSvc;//瀹㈡埛Svc
             _logisticsSvc = logisticsSvc;//鐗╂祦Svc
@@ -73,6 +81,7 @@
             _setting = setting; //鍔熻兘璁惧畾
             _interface = interfaceS;//鎺ュ彛绠$悊
             _operation = operation; //鎿嶄綔鏃ュ織
+            _userManager = userManager;
         }
         //鍩烘湰淇℃伅绠$悊
 
@@ -89,15 +98,9 @@
         /// <param name="Status">鐘舵��</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetUserRoleList(string UserName, string DepartmentNo, string RoleNo, string Status)
+        public async Task<List<UserInfoDto>> GetUserRoleList(string UserName, string DepartmentNo, string RoleNo, string Status)
         {
-            List<UserInfoDto> userdtolist = _userInforServer.GetUserRoleList(UserName, DepartmentNo, RoleNo, Status);
-            return Ok(new
-            {
-                data = userdtolist,
-                code = 0,
-                mes = "鎴愬姛"
-            });
+            return await _userInforServer.GetUserRoleList(UserName, DepartmentNo, RoleNo, Status);
         }
 
         /// <summary>
@@ -106,15 +109,9 @@
         /// <param name="id">鐢ㄦ埛id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetUserinfoListById(int id)
+        public async Task<SysUserInfor> GetUserinfoListById(int id)
         {
-            SysUserInfor userinfo = _userInforServer.GetUserInfoById(id);
-            return Ok(new
-            {
-                data = userinfo,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _userInforServer.GetUserInfoById(id);
         }
 
 
@@ -125,38 +122,18 @@
         /// <returns></returns>
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> InsertUserinfo(UserInfoDto UserInfoDto)
+        [UnitOfWork]
+        public async Task InsertUserinfo(UserInfoDto UserInfoDto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _userInforServer.InsertUserInfo(UserInfoDto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                UserInfoDto.CreateUser = uid;
-                int i = await _userInforServer.InsertUserInfo(UserInfoDto);
-
-                //鍒ゆ柇鏄惁鏂板鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new { data = i, code = 1, msg = "鏂板澶辫触" });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new { data = i, code = 3, msg = "鐢ㄦ埛鍚嶆垨鐧诲綍鍚嶉噸澶�" });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鐢ㄦ埛绠$悊", UserInfoDto.UserNo, "娣诲姞", "娣诲姞鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + UserInfoDto.UserNo, uid);
-                    return Ok(new { data = i, code = 0, msg = "鏂板鎴愬姛" });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("鏂板鐢ㄦ埛寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鐢ㄦ埛绠$悊",
+                FkNo = UserInfoDto.UserNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + UserInfoDto.UserNo
+            });
         }
 
 
@@ -167,34 +144,20 @@
         /// <returns></returns>
         /// <exception cref="System.Exception">寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> DeleteUserInfo(int userids)
+        [UnitOfWork]
+        public async Task DeleteUserInfo(int userids)
         {
-            //寮傚父
-            try
+            //鑾峰彇鐢ㄦ埛淇℃伅
+            SysUserInfor user = await _userInforServer.GetUserInfoById(userids);
+            await _userInforServer.DeleteUserinfo(user);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇鐢ㄦ埛淇℃伅
-                SysUserInfor user = _userInforServer.GetUserInfoById(userids);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                int i = await _userInforServer.DeleteUserinfo(user);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new { data = i, code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鐢ㄦ埛绠$悊", user.UserNo, "鍒犻櫎", "鍒犻櫎鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + user.UserNo, uid);
-                    return Ok(new { data = i, code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("鍒犻櫎鐢ㄦ埛淇℃伅寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鐢ㄦ埛绠$悊",
+                FkNo = user.UserNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + user.UserNo
+            });
         }
 
 
@@ -205,73 +168,24 @@
         /// <returns></returns>
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> UpdateUserinfo(UserInfoDto userdto)
+        [UnitOfWork]
+        public async Task UpdateUserinfo(UserInfoDto userdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _userInforServer.UpdateUserinfo(userdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //userdto.UpdateUser = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                userdto.UpdateUser = uid;
-
-                //缂栬緫鐢ㄦ埛淇℃伅
-                int i = await _userInforServer.UpdateUserinfo(userdto);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new { data = i, code = 1, msg = "缂栬緫澶辫触" });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new { data = i, code = 1, msg = "鐢ㄦ埛鍚嶆垨鐧诲綍鍚嶉噸澶�" });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鐢ㄦ埛绠$悊", userdto.UserNo, "淇敼", "淇敼鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + userdto.UserNo, uid);
-                    return Ok(new { data = i, code = 0, msg = "缂栬緫鎴愬姛" });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("缂栬緫鐢ㄦ埛淇℃伅寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鐢ㄦ埛绠$悊",
+                FkNo = userdto.UserNo,
+                TypeName = "缂栬緫",
+                Msg = "淇敼鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + userdto.UserNo
+            });
         }
 
 
         #endregion
 
         #region 淇敼瀵嗙爜
-
-        /// <summary>
-        /// 淇敼瀵嗙爜 鏍规嵁id鑾峰彇鐢ㄦ埛鍘熷瘑鐮�
-        /// </summary>
-        /// <param name="PassWord">鐢ㄦ埛鍘熷瘑鐮�</param>
-        /// <returns></returns>
-        [HttpGet]
-        public int GetUserUptPassById(string PassWord, int userId)
-        {
-            ////鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-            //var claimsIdentity = this.User.Identity as ClaimsIdentity;
-            //var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-            //int uid = Convert.ToInt32(userId);
-
-            //鏍规嵁鐢ㄦ埛id鑾峰彇鐢ㄦ埛瀵嗙爜
-            SysUserInfor user = _userInforServer.GetUserInfoById(userId);
-            //鍒ゆ柇鍘熷瘑鐮佹槸鍚︽纭�
-            if (user.PassWord == PassWord)
-            {
-                return 1;
-            }
-            else
-            {
-                return 0;
-            }
-        }
 
         ///// <param name="userId">鐢ㄦ埛id</param>
         /// <summary>
@@ -283,100 +197,30 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> UptUserPassWord(string pwdOld, string pwdNew, string pwdNewTwo/*, int userId*/)
+        public async Task UptUserPassWord(string pwdOld, string pwdNew, string pwdNewTwo/*, int userId*/)
         {
-            //鎹曡幏寮傚父
-            try
-            {
-                pwdOld = Md5Tools.CalcMd5(pwdOld);
-                pwdNew = Md5Tools.CalcMd5(pwdNew);
-                pwdNewTwo = Md5Tools.CalcMd5(pwdNewTwo);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒ゆ柇鍘熷瘑鐮佹槸鍚︽纭�
-                int a = GetUserUptPassById(pwdOld, uid);
-                if (a == 1)
-                {
-                    //淇敼瀵嗙爜
-                    int i = await _userInforServer.UptUserPassWord(pwdOld, pwdNew, pwdNewTwo, uid);
-                    if (i == 0)
-                    {
-                        return Ok(new
-                        {
-                            data = i,
-                            code = 1,
-                            msg = "淇敼澶辫触"
-                        });
-                    }
-                    //鍒ゆ柇涓ゆ鏂板瘑鐮佹槸鍚︿竴鑷�
-                    else if (i == 3)
-                    {
-                        return Ok(new
-                        {
-                            data = i,
-                            code = 0,
-                            msg = "淇敼鎴愬姛 璇烽噸鏂扮櫥褰�"
-                        });
-                    }
-                    else
-                    {
-                        return Ok(new
-                        {
-                            data = i,
-                            code = 0,
-                            msg = "淇敼鎴愬姛 璇烽噸鏂扮櫥褰�"
-                        });
-                    }
-                }
-                else
-                {
-                    //閿欒
-                    return Ok(new
-                    {
-                        data = a,
-                        code = 1,
-                        msg = "鍘熷瘑鐮佷笉姝g‘"
-                    });
-                }
-
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("淇敼瀵嗙爜寮傚父", ex);
-            }
+            pwdOld = Md5Tools.CalcMd5(pwdOld);
+            pwdNew = Md5Tools.CalcMd5(pwdNew);
+            pwdNewTwo = Md5Tools.CalcMd5(pwdNewTwo);
+            //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
+            SysUserInfor user = await _userInforServer.GetUserInfoById(_userManager.UserId);
+            if (user == null)
+                throw Oops.Bah("鎵句笉鍒扮敤鎴蜂俊鎭�");
+            if (user.PassWord != pwdOld)
+                throw Oops.Bah("鍘熷瘑鐮佷笉姝g‘");
+            //淇敼瀵嗙爜
+            int i = await _userInforServer.UptUserPassWord(pwdNew, _userManager.UserId);
+            if (i <= 0)
+                throw Oops.Bah("淇敼瀵嗙爜澶辫触");
         }
         /// <summary>
         /// x澶╁悗鎻愰啋鐢ㄦ埛淇敼瀵嗙爜
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult IsPassWordTime()
+        public async Task<int> IsPassWordTime()
         {
-            //鎹曡幏寮傚父
-            try
-            {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒ゆ柇鍘熷瘑鐮佹槸鍚︽纭�
-                int a = _userInforServer.IsPassWordTime(uid);
-                return Ok(new
-                {
-                    data = a,
-                    code = 0,
-                    msg = "淇敼澶辫触"
-                });
-
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("淇敼瀵嗙爜寮傚父", ex);
-            }
+            return await _userInforServer.IsPassWordTime(_userManager.UserId);
         }
         #endregion
 
@@ -391,29 +235,9 @@
         /// <param name="RoleName">瑙掕壊鍚嶇О</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRolesList(string RoleNo, string RoleName)
+        public async Task<List<RoleDto>> GetRolesList(string RoleNo, string RoleName)
         {
-            //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-            var claimsIdentity = this.User.Identity as ClaimsIdentity;
-            if (claimsIdentity == null)
-            {
-                throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-            }
-            string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-            if (string.IsNullOrWhiteSpace(UserId))
-            {
-                throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-            }
-
-            //鏌ヨ
-            List<RoleDto> roles = _rolesServer.GetRoleList(RoleNo, RoleName, UserId);
-            //杩斿洖鏁版嵁
-            return Ok(new
-            {
-                data = roles,
-                code = 0,
-                msg = "鑾峰彇鎴愬姛"
-            });
+            return await _rolesServer.GetRoleList(RoleNo, RoleName);
         }
 
         /// <summary>
@@ -422,15 +246,9 @@
         /// <param name="roleid">瑙掕壊id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRolesListById(int roleid)
+        public async Task<SysRoles> GetRolesListById(int roleid)
         {
-            SysRoles role = _rolesServer.GetRoleInfoById(roleid);
-            return Ok(new
-            {
-                data = role,
-                code = 0,
-                msg = "鑾峰彇鎴愬姛"
-            });
+            return await _rolesServer.GetRoleInfoById(roleid);
         }
 
         /// <summary>
@@ -440,52 +258,18 @@
         /// <returns></returns>
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> InsertRoleInfo(RoleDto roledto)
+        [UnitOfWork]
+        public async Task InsertRoleInfo(RoleDto roledto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _rolesServer.InsertRoleInfo(roledto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒涘缓浜�
-                roledto.CreateUser = uid;
-                int i = await _rolesServer.InsertRoleInfo(roledto);
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鏂板澶辫触"
-                    });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 3,
-                        msg = "瑙掕壊鍙峰繀椤诲敮涓�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", roledto.RoleNo, "娣诲姞", "娣诲姞瑙掕壊淇℃伅 瑙掕壊鍙凤細" + roledto.RoleNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鏂板鎴愬姛"
-                    });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("瑙掕壊鏂板寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = roledto.RoleNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞瑙掕壊淇℃伅 瑙掕壊鍙凤細" + roledto.RoleNo
+            });
         }
 
         /// <summary>
@@ -495,45 +279,20 @@
         /// <returns></returns>
         /// <exception cref="System.Exception"></exception>
         [HttpGet]
-        public async Task<IActionResult> DeleteRoleInfo(int roleids)
+        [UnitOfWork]
+        public async Task DeleteRoleInfo(int roleids)
         {
-            //鎹曡幏寮傚父
-            try
+            //鏍规嵁瑙掕壊id鑾峰彇瑙掕壊淇℃伅
+            SysRoles role = await _rolesServer.GetRoleInfoById(roleids);
+            await _rolesServer.DeleteRoleInfo(role);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鏍规嵁瑙掕壊id鑾峰彇瑙掕壊淇℃伅
-                SysRoles role = _rolesServer.GetRoleInfoById(roleids);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                role.UpdateUser = uid;
-                int i = await _rolesServer.DeleteRoleInfo(role);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鍒犻櫎澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", role.RoleNo, "鍒犻櫎", "鍒犻櫎瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鍒犻櫎鎴愬姛"
-                    });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("瑙掕壊鍒犻櫎寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = role.RoleNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo
+            });
         }
 
         /// <summary>
@@ -543,45 +302,18 @@
         /// <returns></returns>
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> UpdateRolesInfo(SysRoles role)
+        [UnitOfWork]
+        public async Task UpdateRolesInfo(SysRoles role)
         {
-            //鎹曡幏寮傚父
-            try
+            await _rolesServer.UpdateRoleInfo(role);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                role.UpdateUser = uid;
-
-                int i = await _rolesServer.UpdateRoleInfo(role);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "缂栬緫澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", role.RoleNo, "淇敼", "淇敼瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "缂栬緫鎴愬姛"
-                    });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("缂栬緫瑙掕壊寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = role.RoleNo,
+                TypeName = "缂栬緫",
+                Msg = "淇敼瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo
+            });
         }
 
         #endregion
@@ -593,16 +325,9 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRBACLists(int id)
+        public async Task<List<FunctionMenuDto>> GetRBACLists(int id)
         {
-            //List<RoleRightDto> roleright = 
-            var obj = _rBACServer.GetMenuByroleIdNew(id);
-            return Ok(new
-            {
-                data = obj,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _rBACServer.GetMenuByroleIdNew(id);
         }
 
 
@@ -611,27 +336,9 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightRBAC(int id, string MenuNo)
+        public async Task<List<FunctionMenuDto>> GetRoleRightRBAC(int id, string MenuNo)
         {
-            //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-            var claimsIdentity = this.User.Identity as ClaimsIdentity;
-            if (claimsIdentity == null)
-            {
-                throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-            }
-            string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-            if (string.IsNullOrWhiteSpace(UserId))
-            {
-                throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-            }
-
-            List<FunctionMenuDto> menudto = _rBACServer.GetRoleRightRBAC(MenuNo, UserId);
-            return Ok(new
-            {
-                data = menudto,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _rBACServer.GetRoleRightRBAC(MenuNo, _userManager.UserId.ToString());
         }
 
         /// <summary>
@@ -639,15 +346,9 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightLists(int id)
+        public async Task<List<RoleRightDto>> GetRoleRightLists(int id)
         {
-            List<RoleRightDto> roleRightDtos = _rBACServer.GetRoleRightList(id);
-            return Ok(new
-            {
-                data = roleRightDtos,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _rBACServer.GetRoleRightList(id);
         }
 
         /// <summary>
@@ -656,33 +357,15 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightList()
+        public async Task<List<RoleRightDto>> GetRoleRightList()
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var roleRightDtos = _roleRightServer.GetRoleMenuList(int.Parse(userId));
-                return Ok(new
-                {
-                    data = roleRightDtos,
-                    msg = "鎴愬姛",
-                    code = 0
-                });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { msg = e.Message, code = 0 });
-            }
+            Stopwatch stopwatch = new Stopwatch();
+            stopwatch.Start();
+            var model =  await _roleRightServer.GetRoleMenuList();
+            stopwatch.Stop();
+
+            var time = stopwatch.ElapsedMilliseconds;
+            return model;
         }
 
         /// <summary>
@@ -691,15 +374,9 @@
         /// <param name="id">瑙掕壊鏉冮檺id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightOneListById(int id)
+        public async Task<List<SysRoleRight>> GetRoleRightOneListById(int id)
         {
-            List<SysRoleRight> roleRights = _roleRightServer.GetRoleRightOneListById(id);
-            return Ok(new
-            {
-                data = roleRights,
-                msg = "鎴愬姛",
-                core = 0
-            });
+            return await _roleRightServer.GetRoleRightOneListById(id);
         }
 
         /// <summary>
@@ -710,46 +387,21 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> InsertRoleRight(string MenuNo, int id)
+        [UnitOfWork]
+        public async Task InsertRoleRight(string MenuNo, int id)
         {
-            //鎹曡幏寮傚父
-            try
+            //鏍规嵁Id鑾峰彇瑙掕壊鍙�
+            SysRoles roles = await _rolesServer.GetRoleInfoById(id);
+            //淇濆瓨瑙掕壊鏉冮檺淇℃伅
+            await _roleRightServer.InsertRoleRight(MenuNo, roles.RoleNo);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-
-                //鏍规嵁Id鑾峰彇瑙掕壊鍙�
-                SysRoles roles = _rolesServer.GetRoleInfoById(id);
-
-                //淇濆瓨瑙掕壊鏉冮檺淇℃伅
-                int i = await _roleRightServer.InsertRoleRight(MenuNo, roles.RoleNo, userId);
-                //鍒ゆ柇鏄惁鏂板鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        msg = "鍒嗛厤澶辫触",
-                        code = 1
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", roles.RoleNo, "淇敼", "鍒嗛厤瑙掕壊鏉冮檺 瑙掕壊鍙凤細" + roles.RoleNo, Convert.ToInt32(userId));
-                    return Ok(new
-                    {
-                        data = i,
-                        msg = "鍒嗛厤鎴愬姛",
-                        code = 0
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鏂板瑙掕壊鏉冮檺淇℃伅寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = roles.RoleNo,
+                TypeName = "缂栬緫",
+                Msg = "鍒嗛厤瑙掕壊鏉冮檺 瑙掕壊鍙凤細" + roles.RoleNo
+            });
         }
 
         #endregion
@@ -763,15 +415,9 @@
         /// <param name="DepartmentNo">閮ㄩ棬鍙�</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetDepartmentList(string DepartmentName, string DepartmentNo)
+        public async Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo)
         {
-            List<DepartmentDto> departmentlist = _department.GetDepartmentList(DepartmentName, DepartmentNo);
-            return Ok(new
-            {
-                data = departmentlist,
-                code = 0,
-                msg = "鑾峰彇閮ㄩ棬淇℃伅鍒楄〃鎴愬姛"
-            });
+            return await _department.GetDepartmentList(DepartmentName, DepartmentNo);
         }
 
         /// <summary>
@@ -780,15 +426,9 @@
         /// <param name="id">閮ㄩ棬id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetDepartmentById(int id)
+        public async Task<SysDepartment> GetDepartmentById(int id)
         {
-            SysDepartment department = _department.GetDepartmentById(id);
-            return Ok(new
-            {
-                data = department,
-                msg = "鎴愬姛",
-                code = 0
-            });
+            return await _department.GetDepartmentById(id);
         }
 
         /// <summary>
@@ -798,56 +438,18 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> AddDepartment(DepartmentDto departmentdto)
+        [UnitOfWork]
+        public async Task AddDepartment(DepartmentDto departmentdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _department.AddDepartment(departmentdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                departmentdto.CreateUser = uid;
-
-                int i = await _department.AddDepartment(departmentdto);
-                //鍒ゆ柇鏄惁鏂板鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鏂板澶辫触"
-                    });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 3,
-                        msg = "閮ㄩ棬鍙峰繀椤诲敮涓�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "閮ㄩ棬绠$悊", departmentdto.DepartmentNo, "娣诲姞", "娣诲姞閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鏂板鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鏂板閮ㄩ棬寮傚父", ex);
-            }
-
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "閮ㄩ棬绠$悊",
+                FkNo = departmentdto.DepartmentNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo
+            });
         }
 
         /// <summary>
@@ -857,46 +459,19 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> DelDepartment(int Id)
+        [UnitOfWork]
+        public async Task DelDepartment(int Id)
         {
-            //鎹曡幏寮傚父
-            try
+            SysDepartment department = await _department.GetDepartmentById(Id);
+            await _department.DelDepartment(department);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                SysDepartment department = _department.GetDepartmentById(Id);
-
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                department.UpdateUser = uid;
-                int i = await _department.DelDepartment(department);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鍒犻櫎澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "閮ㄩ棬绠$悊", department.DepartmentNo, "鍒犻櫎", "鍒犻櫎閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + department.DepartmentNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鍒犻櫎鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鍒犻櫎閮ㄩ棬寮傚父", ex);
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "閮ㄩ棬绠$悊",
+                FkNo = department.DepartmentNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + department.DepartmentNo
+            });
         }
 
         /// <summary>
@@ -906,44 +481,18 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> ExitDepartment(DepartmentDto departmentdto)
+        [UnitOfWork]
+        public async Task ExitDepartment(DepartmentDto departmentdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _department.ExitDepartment(departmentdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                departmentdto.UpdateUser = uid;
-                int i = await _department.ExitDepartment(departmentdto);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "缂栬緫澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "閮ㄩ棬绠$悊", departmentdto.DepartmentNo, "淇敼", "缂栬緫閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "缂栬緫鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("缂栬緫閮ㄩ棬寮傚父", ex);
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "閮ㄩ棬绠$悊",
+                FkNo = departmentdto.DepartmentNo,
+                TypeName = "缂栬緫",
+                Msg = "缂栬緫閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo
+            });
         }
 
         #endregion
@@ -958,15 +507,9 @@
         /// <param name="GroupNo">缁勫彿</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetFunSettingList(string FunSetName, string IsEnable, string GroupNo)
+        public async Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo)
         {
-            List<FunSettingDto> settinglist = _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo);
-            return Ok(new
-            {
-                data = settinglist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo);
         }
 
         /// <summary>
@@ -975,15 +518,9 @@
         /// <param name="id">鍔熻兘id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetFunSettingById(int id)
+        public async Task<SysFunSetting> GetFunSettingById(int id)
         {
-            SysFunSetting settinglist = _setting.GetFunSettingById(id);
-            return Ok(new
-            {
-                data = settinglist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _setting.GetFunSettingById(id);
         }
 
         /// <summary>
@@ -992,18 +529,9 @@
         /// <param name="funSetNo">鍔熻兘缂栧彿</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetFunSettingByNo(string funSetNo)
+        public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo)
         {
-            try
-            {
-                var models = _setting.GetFunSettingByNo(funSetNo);
-
-                return Ok(new { code = 0, msg = "鍔熻兘璁惧畾淇℃伅", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _setting.GetFunSettingByNo(funSetNo);
         }
         /// <summary>
         /// 鏂板鍔熻兘淇℃伅
@@ -1012,80 +540,18 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> AddFunSettings(FunSettingDto settingdto)
+        [UnitOfWork]
+        public async Task AddFunSettings(FunSettingDto settingdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _setting.AddFunSettings(settingdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒涘缓浜�
-                settingdto.CreateUser = uid;
-                //鏂板
-                int i = await _setting.AddFunSettings(settingdto);
-                //鍒ゆ柇鏄惁鏂板鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 3,
-                        msg = "鍔熻兘鍙峰繀椤诲敮涓�"
-                    });
-                }
-                else if (i == 4)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 4,
-                        msg = "鏄剧ず椤哄簭鑼冨洿涓�1---5"
-                    });
-                }
-                else if (i == 5)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 5,
-                        msg = "璇疯緭鍏ユ纭粍鍙�"
-                    });
-                }
-                else if (i == 6)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 6,
-                        msg = "姣忎竴缁勫彧鑳藉紑鍚竴涓姛鑳�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鍔熻兘璁惧畾", settingdto.FunSetNo, "娣诲姞", "娣诲姞鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                return Ok(new { data = "", code = 1, msg = "鏂板鍔熻兘寮傚父锛�" + ex.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鍔熻兘璁惧畾",
+                FkNo = settingdto.FunSetNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo
+            });
         }
 
         /// <summary>
@@ -1095,46 +561,19 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> DelFunSettings(int id)
+        [UnitOfWork]
+        public async Task DelFunSettings(int id)
         {
-            //鎹曡幏寮傚父
-            try
+            SysFunSetting funSetting = await _setting.GetFunSettingById(id);
+            await _setting.DelFunSettings(funSetting);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                SysFunSetting funSetting = _setting.GetFunSettingById(id);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                funSetting.UpdateUser = uid;
-                //鍒犻櫎
-                int i = await _setting.DelFunSettings(funSetting);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鍔熻兘璁惧畾", funSetting.FunSetNo, "鍒犻櫎", "鍒犻櫎鍔熻兘璁惧畾 鍔熻兘鍙凤細" + funSetting.FunSetNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鍒犻櫎鍔熻兘寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鍔熻兘璁惧畾",
+                FkNo = funSetting.FunSetNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎鍔熻兘璁惧畾 鍔熻兘鍙凤細" + funSetting.FunSetNo
+            });
         }
 
         /// <summary>
@@ -1144,79 +583,23 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> ExitFunSettings(FunSettingDto settingdto)
+        [UnitOfWork]
+        public async Task ExitFunSettings(FunSettingDto settingdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _setting.ExitFunSettings(settingdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                settingdto.UpdateUser = uid;
-                //缂栬緫
-                int i = await _setting.ExitFunSettings(settingdto);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else if (i == 6)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 6,
-                        msg = "姣忎竴缁勫彧鑳藉紑鍚竴涓姛鑳�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鍔熻兘璁惧畾", settingdto.FunSetNo, "淇敼", "淇敼鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                return Ok(new { data = "", code = 1, msg = "缂栬緫鍔熻兘寮傚父锛�" + ex.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鍔熻兘璁惧畾",
+                FkNo = settingdto.FunSetNo,
+                TypeName = "缂栬緫",
+                Msg = "淇敼鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo
+            });
         }
 
         #endregion
 
         #region 鐗╂枡绠$悊
-
-        ///// <summary>
-        ///// 鏌ヨ鐗╂枡淇℃伅
-        ///// </summary>
-        ///// <param name="matevm">鐗╂枡缂栫爜瑙嗗浘妯″瀷</param>
-        ///// <returns></returns>
-        //[HttpPost]
-        //public IActionResult GetMaterialsList(GetMaterialsVm matevm)
-        //{
-        //    try
-        //    {
-        //        var bolls = _mate.GetMaterialsList(matevm.SkuNo, matevm.SkuName, matevm.Type, matevm.IsInspect, matevm.Page, matevm.Limit, out int count);
-
-        //        return Ok(new { code = 0, count, msg = "鐗╂枡淇℃伅", data = bolls });
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        return Ok(new { code = 1, msg = e.Message });
-        //    }
-        //}
-
 
         #region yyk
 
@@ -1235,15 +618,9 @@
         /// <param name="categoryNo">绫诲埆缂栫爜</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo)
+        public async Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo)
         {
-            List<MaterialsDto> matedto = _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo);
-            return Ok(new
-            {
-                data = matedto,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo);
         }
 
         /// <summary>
@@ -1252,15 +629,9 @@
         /// <param name="id">鐗╂枡id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetMateById(int id)
+        public async Task<SysMaterials> GetMateById(int id)
         {
-            SysMaterials mate = _mate.GetMateById(id);
-            return Ok(new
-            {
-                data = mate,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetMateById(id);
         }
 
         /// <summary>
@@ -1268,31 +639,18 @@
         /// </summary>
         /// <param name="matedto">鐗╂枡dto</param>
         /// <returns></returns>
-        /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> AddMate(MaterialsDto matedto)
+        public async Task AddMate(MaterialsDto matedto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _mate.AddMate(matedto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒涘缓浜�
-                matedto.CreateUser = uid;
-                //鏂板
-                int i = await _mate.AddMate(matedto);
-                
-                await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂枡绠$悊", matedto.SkuNo, "娣诲姞", "娣诲姞鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo, uid);
-                return Ok(new { data = i, code = 0, msg = "鎴愬姛" });
-
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父 
-                return Ok(new { code = 1, msg = "鏂板鐗╂枡寮傚父"+ ex.Message });
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "鐗╂枡绠$悊",
+                FkNo = matedto.SkuNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo
+            });
         }
 
         /// <summary>
@@ -1302,45 +660,18 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> DelMate(int id)
+        public async Task DelMate(int id)
         {
-            //鎹曡幏寮傚父
-            try
+            SysMaterials mate = await _mate.GetMateById(id);
+            await _mate.DelMate(mate);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                SysMaterials mate = _mate.GetMateById(id);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                mate.UpdateUser = uid;
-                //鍒犻櫎
-                int i = await _mate.DelMate(mate);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂枡绠$悊", mate.SkuNo, "鍒犻櫎", "鍒犻櫎鐗╂枡淇℃伅 鐗╂枡鍙凤細" + mate.SkuNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鍒犻櫎鐗╂枡寮傚父", ex);
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "鐗╂枡绠$悊",
+                FkNo = mate.SkuNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎鐗╂枡淇℃伅 鐗╂枡鍙凤細" + mate.SkuNo
+            });
         }
 
         /// <summary>
@@ -1350,43 +681,17 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> ExitMate(MaterialsDto matedto)
+        public async Task ExitMate(MaterialsDto matedto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _mate.ExitMate(matedto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存柊浜�
-                matedto.UpdateUser = uid;
-                //缂栬緫
-                int i = await _mate.ExitMate(matedto);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new { data = i, code = 1, msg = "淇敼澶辫触" });
-                }
-                else if (i == 2)
-                {
-                    return Ok(new { data = i, code = 2, msg = "涓存湡澶╂暟涓嶅彲澶т簬365鍙婂皬浜�30" });
-                }
-                //else if (i == 4)
-                //{
-                //    return Ok(new { data = i, code = 4, msg = "浣庡簱瀛樹笉鍙珮浜�1000" });
-                //}
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂枡绠$悊", matedto.SkuNo, "淇敼", "缂栬緫鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo, uid);
-                    return Ok(new { data = i, code = 0, msg = "淇敼鎴愬姛" });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮�
-                return Ok(new { code = 1, msg = "缂栬緫鐗╂枡寮傚父"+ex.Message });
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "鐗╂枡绠$悊",
+                FkNo = matedto.SkuNo,
+                TypeName = "缂栬緫",
+                Msg = "缂栬緫鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo
+            });
         }
 
         #region 鍖呰 鍗曚綅
@@ -1396,15 +701,9 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetUnitList()
+        public async Task<List<SysUnit>> GetUnitList()
         {
-            List<SysUnit> unitlist = _mate.GetUnitList();
-            return Ok(new
-            {
-                data = unitlist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetUnitList();
         }
 
         /// <summary>
@@ -1412,15 +711,9 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetPackagList()
+        public async Task<List<SysPackag>> GetPackagList()
         {
-            List<SysPackag> packlist = _mate.GetPackagList();
-            return Ok(new
-            {
-                data = packlist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetPackagList();
         }
 
         #endregion
@@ -1608,18 +901,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetCustomerList(GetCustomerVm model)
+        public async Task<SqlSugarPagedList> GetCustomerList(GetCustomerVm model)
         {
-            try
-            {
-                var bolls = _customerSvc.GetCustomerList(model.CustomerNo,model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, out int count);
-
-                return Ok(new { code = 0, count, msg = "瀹㈡埛淇℃伅", data = bolls });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            RefAsync<int> count = new RefAsync<int>();
+            var bolls = await _customerSvc.GetCustomerList(model.CustomerNo, model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, count);
+            return new SqlSugarPagedList() { Items = bolls, Total = count };
         }
         /// <summary>
         /// 鏌ヨ鍗曟潯瀹㈡埛淇℃伅
@@ -1627,36 +913,18 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetCustomer(IdVm model)
+        public async Task<SysCustomer> GetCustomer(IdVm model)
         {
-            try
-            {
-                var bolls = _customerSvc.GetCustomer(model.Id);
-
-                return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _customerSvc.GetCustomer(model.Id);
         }
         /// <summary>
         /// 鏌ヨ鍏ㄩ儴瀹㈡埛淇℃伅
         /// </summary> 
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetCustomerSelect()
+        public async Task<List<SysCustomer>> GetCustomerSelect()
         {
-            try
-            {
-                var bolls = _customerSvc.GetCustomerSelect();
-
-                return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _customerSvc.GetCustomerSelect();
         }
         /// <summary>
         /// 娣诲姞瀹㈡埛淇℃伅
@@ -1664,38 +932,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddCustomer(AddCustomerVm model)
+        [UnitOfWork]
+        public async Task AddCustomer(AddCustomerVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
-
-                if (bolls)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "娣诲姞", "娣诲姞瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
-                    return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, _userManager.UserId);
+            await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "娣诲姞", "娣诲姞瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, _userManager.UserId);
         }
         /// <summary>
         /// 缂栬緫瀹㈡埛淇℃伅
@@ -1703,38 +944,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditCustomer(EditCustomerVm model)
+        [UnitOfWork]
+        public async Task EditCustomer(EditCustomerVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
-
-                if (bolls)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
-                    return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, _userManager.UserId);
+            await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, _userManager.UserId);
         }
         /// <summary>
         /// 鍒犻櫎瀹㈡埛淇℃伅
@@ -1742,38 +956,12 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelCustomer(IdVm model)
+        [UnitOfWork]
+        public async Task DelCustomer(IdVm model)
         {
-            try
-            {
-                SysCustomer customer = _customerSvc.GetCustomer(model.Id);
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _customerSvc.DelCustomer(model.Id, int.Parse(userId));
-                if (bolls)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, Convert.ToInt32(userId));
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            SysCustomer customer = await _customerSvc.GetCustomer(model.Id);
+            var bolls = await _customerSvc.DelCustomer(model.Id, _userManager.UserId);
+            await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, _userManager.UserId);
         }
         /// <summary>
         /// 鍒犻櫎瀹㈡埛淇℃伅(澶氬垹闄�)
@@ -1781,36 +969,10 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelsCustomer(IdVm model)
+        [UnitOfWork]
+        public async Task DelsCustomer(IdVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _customerSvc.DelsCustomer(model.Ids, int.Parse(userId));
-                if (bolls)
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _customerSvc.DelsCustomer(model.Ids, _userManager.UserId);
         }
         #endregion
 
@@ -1821,18 +983,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetLogisticsInfoList(GetLogisticsInfoVm model)
+        public async Task<SqlSugarPagedList> GetLogisticsInfoList(GetLogisticsInfoVm model)
         {
-            try
-            {
-                var bolls = _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, out int count);
-
-                return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = bolls });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            RefAsync<int> count = new RefAsync<int>();
+            var list = await _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, count);
+            return new SqlSugarPagedList() { Items = list, Total = count };
         }
         /// <summary>
         /// 鏌ヨ鍗曟潯鐗╂祦淇℃伅
@@ -1840,36 +995,18 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetLogisticsInfo(IdVm model)
+        public async Task<SysLogisticsInfo> GetLogisticsInfo(IdVm model)
         {
-            try
-            {
-                var bolls = _logisticsSvc.GetLogisticsInfo(model.Id);
-
-                return Ok(new { code = 0, data = bolls });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _logisticsSvc.GetLogisticsInfo(model.Id);
         }
         /// <summary>
         /// 鏌ヨ鍏ㄩ儴鐗╂祦淇℃伅
         /// </summary> 
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetLogisticsInfoSelect()
+        public async Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect()
         {
-            try
-            {
-                var bolls = _logisticsSvc.GetLogisticsInfoSelect();
-
-                return Ok(new { code = 0, data = bolls });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _logisticsSvc.GetLogisticsInfoSelect();
         }
 
         /// <summary>
@@ -1878,38 +1015,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddLogisticsInfo(AddLogisticsInfoVm model)
+        [UnitOfWork]
+        public async Task AddLogisticsInfo(AddLogisticsInfoVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId));
-
-                if (bolls)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
-                    return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _logisticsSvc.AddLogisticsInfo(model, _userManager.UserId);
+            await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, _userManager.UserId);
         }
         /// <summary>
         /// 缂栬緫鐗╂祦淇℃伅
@@ -1917,38 +1027,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditLogisticsInfo(EditLogisticsInfoVm model)
+        [UnitOfWork]
+        public async Task EditLogisticsInfo(EditLogisticsInfoVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId));
-
-                if (bolls)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
-                    return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _logisticsSvc.EditLogisticsInfo(model, _userManager.UserId);
+            await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, _userManager.UserId);
         }
         /// <summary>
         /// 鍒犻櫎鐗╂祦淇℃伅
@@ -1956,39 +1039,12 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelLogisticsInfo(IdVm model)
+        [UnitOfWork]
+        public async Task DelLogisticsInfo(IdVm model)
         {
-            try
-            {
-                SysLogisticsInfo logisit = _logisticsSvc.GetLogisticsInfo(model.Id);
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId));
-                if (bolls)
-                {
-
-                    _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, Convert.ToInt32(userId));
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _logisticsSvc.DelLogisticsInfo(model.Id, _userManager.UserId);
+            SysLogisticsInfo logisit = await _logisticsSvc.GetLogisticsDelInfo(model.Id);
+            await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, _userManager.UserId);
         }
         /// <summary>
         /// 鍒犻櫎鐗╂祦淇℃伅(澶氭潯淇℃伅)
@@ -1996,36 +1052,10 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelsLogisticsInfo(IdVm model)
+        [UnitOfWork]
+        public async Task DelsLogisticsInfo(IdVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-
-                var bolls = _logisticsSvc.DelsLogisticsInfo(model.Ids, int.Parse(userId));
-                if (bolls)
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _logisticsSvc.DelsLogisticsInfo(model.Ids, _userManager.UserId);
         }
         #endregion
 
@@ -2037,18 +1067,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetUnitList(GetUnitVm model)
+        public async Task<SqlSugarPagedList> GetUnitList(GetUnitVm model)
         {
-            try
-            {
-                var list = _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, out int count);
-
-                return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = list });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            RefAsync<int> count = new RefAsync<int>();
+            var list = await _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, count);
+            return new SqlSugarPagedList() { Items = list, Total = count };
         }
         /// <summary>
         /// 鏌ヨ鍗曟潯鍗曚綅淇℃伅
@@ -2056,24 +1079,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetUnit(IdVm model)
+        public async Task<SysUnit> GetUnit(IdVm model)
         {
-            try
-            {
-                var data = _unitSvc.GetUnit(model.Id);
-                if (data != null)
-                {
-                    return Ok(new { code = 0, data });
-                }
-                else
-                {
-                    return Ok(new { code = 1, data = "鏈煡璇㈠埌鐗╂祦淇℃伅" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _unitSvc.GetUnit(model.Id);
         }
         /// <summary>
         /// 娣诲姞璁¢噺淇℃伅
@@ -2081,43 +1089,16 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddUnit(AddEditUnitVm model)
+        [UnitOfWork]
+        public async Task AddUnit(AddEditUnitVm model)
         {
             if (ModelState.IsValid)
             {
-                try
-                {
-                    //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                    var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                    if (claimsIdentity == null)
-                    {
-                        return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                    }
-                    var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                    if (string.IsNullOrWhiteSpace(userId))
-                    {
-                        return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                    }
-
-                    var bolls = _unitSvc.AddUnit(model.UnitName, model.Abbrev, int.Parse(userId));
-
-                    if (bolls)
-                    {
-                        return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
-                    }
-                    else
-                    {
-                        return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
-                    }
-                }
-                catch (Exception e)
-                {
-                    return Ok(new { code = 1, msg = e.Message });
-                }
+                await _unitSvc.AddUnit(model.UnitName, model.Abbrev, _userManager.UserId);
             }
             else
             {
-                return Ok(new { code = 1, msg = "鏁版嵁鏍煎紡閿欒" });
+                throw Oops.Bah("鏁版嵁鏍煎紡閿欒");
             }
 
         }
@@ -2127,45 +1108,18 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditUnit(AddEditUnitVm model)
+        [UnitOfWork]
+        public async Task EditUnit(AddEditUnitVm model)
         {
             if (ModelState.IsValid)
             {
-                try
-                {
-                    //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                    var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                    if (claimsIdentity == null)
-                    {
-                        return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                    }
-                    var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                    if (string.IsNullOrWhiteSpace(userId))
-                    {
-                        return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                    }
-
-                    var bolls = _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, int.Parse(userId));
-
-                    if (bolls)
-                    {
-                        SysUnit unit = _unitSvc.GetUnit(model.Id);
-                        _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "缂栬緫", "缂栬緫璁¢噺鍗曚綅 鍗曚綅鍚嶇О锛�" + unit.UnitNo, Convert.ToInt32(userId));
-                        return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
-                    }
-                    else
-                    {
-                        return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
-                    }
-                }
-                catch (Exception e)
-                {
-                    return Ok(new { code = 1, msg = e.Message });
-                }
+                await _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, _userManager.UserId);
+                SysUnit unit = await _unitSvc.GetUnit(model.Id);
+                await _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "缂栬緫", "缂栬緫璁¢噺鍗曚綅 鍗曚綅鍚嶇О锛�" + unit.UnitNo, _userManager.UserId);
             }
             else
             {
-                return Ok(new { code = 1, msg = "鏁版嵁鏍煎紡閿欒" });
+                throw Oops.Bah("鏁版嵁鏍煎紡閿欒");
             }
 
         }
@@ -2175,35 +1129,10 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelUnit(IdVm model)
+        [UnitOfWork]
+        public async Task DelUnit(IdVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var bolls = _unitSvc.DelUnit(model.Id, int.Parse(userId));
-                if (bolls)
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _unitSvc.DelUnit(model.Id, _userManager.UserId);
         }
         /// <summary>
         /// 鍒犻櫎璁¢噺鍗曚綅淇℃伅锛堝鍒犻櫎锛�
@@ -2211,53 +1140,14 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelsUnit(IdVm model)
+        [UnitOfWork]
+        public async Task DelsUnit(IdVm model)
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var bolls = _unitSvc.DelsUnit(model.Ids, int.Parse(userId));
-                if (bolls)
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            var bolls = await _unitSvc.DelsUnit(model.Ids, _userManager.UserId);
         }
         #endregion
 
         #region 鍖呰绠$悊
-        private string UserId;
-        //public BasisController() 
-        //{
-        //    var claimsIdentity = this.User.Identity as ClaimsIdentity;
-        //    if (claimsIdentity == null)
-        //    {
-        //        throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-        //    }
-        //    UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-        //    if (string.IsNullOrWhiteSpace(UserId))
-        //    {
-        //        throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-        //    }
-        //}
 
         /// <summary>
         /// 鏌ヨ鍖呰淇℃伅
@@ -2265,18 +1155,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetPackagList(GetPackagVm model)
+        public async Task<SqlSugarPagedList> GetPackagList(GetPackagVm model)
         {
-            try
-            {
-                var list = _packagSvc.GetPackagList(model.PackagNo, model.PackagName, model.Level, model.Page, model.Limit, out int count);
-
-                return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = list });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            RefAsync<int> count = new RefAsync<int>();
+            var list = await _packagSvc.GetPackagList(model.PackagNo, model.PackagName, model.Level, model.Page, model.Limit, count);
+            return new SqlSugarPagedList { Items = list, Total = count };
         }
 
         /// <summary>
@@ -2285,15 +1168,9 @@
         /// <param name="id">鍖呰id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetPackagById(int id)
+        public async Task<SysPackag> GetPackagById(int id)
         {
-            SysPackag packag = _packagSvc.GetPackagById(id);
-            return Ok(new
-            {
-                data = packag,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _packagSvc.GetPackagById(id);
         }
 
         /// <summary>
@@ -2302,47 +1179,11 @@
         /// <param name="model">鍖呰淇℃伅</param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddPackag(AddEditPackagVm model)
+        [UnitOfWork]
+        public async Task AddPackag(AddEditPackagVm model)
         {
-            try
-            {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                int i = _packagSvc.AddPackag(model);
-
-                if (i == 1)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "娣诲姞", "娣诲姞鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, Convert.ToInt32(UserId));
-                    return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
-                }
-                else if (i > 1)
-                {
-                    return Ok(new { code = i, msg = "鍖呰绛夌骇涓嶅彲瓒婄骇娣诲姞" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
-                }
-            }
-
-            catch (Exception e)
-            {
-                return Ok(new
-                {
-                    code = 1,
-                    msg = e.Message
-                });
-            }
+            await _packagSvc.AddPackag(model);
+            await _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "娣诲姞", "娣诲姞鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, _userManager.UserId);
         }
 
         /// <summary>
@@ -2351,42 +1192,11 @@
         /// <param name="model">鍖呰淇℃伅</param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditPackag(AddEditPackagVm model)
+        [UnitOfWork]
+        public async Task EditPackag(AddEditPackagVm model)
         {
-            try
-            {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                int i = _packagSvc.EditPackag(model);
-
-                if (i == 1)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "缂栬緫", "缂栬緫鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, Convert.ToInt32(UserId));
-                    return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
-                }
-                if (i == 2)
-                {
-                    return Ok(new { code = i, msg = "鍖呰绛夌骇涓嶅彲瓒婄骇淇敼 璇烽噸鏂拌緭鍏�" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _packagSvc.EditPackag(model);
+            await _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "缂栬緫", "缂栬緫鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, _userManager.UserId);
         }
 
         /// <summary>
@@ -2395,37 +1205,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelPackag(AddEditPackagVm model)
+        [UnitOfWork]
+        public async Task DelPackag(AddEditPackagVm model)
         {
-            try
-            {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                var bolls = _packagSvc.DelPackag(model.Id, int.Parse(UserId));
-
-                if (bolls)
-                {
-                    _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "鍒犻櫎", "鍒犻櫎鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, Convert.ToInt32(UserId));
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            await _packagSvc.DelPackag(model.Id, _userManager.UserId);
+            await _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "鍒犻櫎", "鍒犻櫎鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, _userManager.UserId);
         }
         #endregion
 
@@ -2434,22 +1218,11 @@
         /// <summary>
         /// 鑾峰彇鎿嶄綔鏃ュ織淇℃伅鍒楄〃
         /// </summary>
-        /// <param name="menuName">鑿滃崟鍚嶇О</param>
-        /// <param name="type">鎿嶄綔绫诲瀷</param>
-        /// <param name="msg">鎿嶄綔鍐呭</param>
-        /// <param name="menuNo">鑿滃崟鍙�</param>
-        /// <param name="parentNo">妯″潡鍙�</param>
         /// <returns></returns>
-        [HttpGet]
-        public IActionResult GetSysOperationList(string menuName, string type, string msg, string menuNo, string parentNo)
+        [HttpPost]
+        public async Task<SqlSugarPagedList> GetSysOperationList(GetOperationVm model)
         {
-            List<OperationDto> operation = _operation.GetSysOperationList(menuName, type, msg, menuNo, parentNo);
-            return Ok(new
-            {
-                data = operation,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _operation.GetSysOperationList(model);
         }
 
         /// <summary>
@@ -2458,15 +1231,9 @@
         /// <param name="dicName">瀛楀吀鍚嶇О</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetDicTypeList(string dicName)
+        public async Task<List<SysDictionary>> GetDicTypeList(string dicName)
         {
-            List<SysDictionary> diclist = _operation.GetDicTypeList(dicName);
-            return Ok(new
-            {
-                data = diclist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _operation.GetDicTypeList(dicName);
         }
 
         #endregion
@@ -2478,18 +1245,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetInterfaceList(InterfaceVm model)
+        public async Task<SqlSugarPagedList> GetInterfaceList(InterfaceVm model)
         {
-            try
-            {
-                var models = _interface.GetInterfaceList(model, out int count);
-
-                return Ok(new { code = 0, count, msg = "鎺ュ彛鍒楄〃", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _interface.GetInterfaceList(model);
         }
 
         /// <summary>
@@ -2498,18 +1256,9 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetInterfaceDetailList(InterfaceDetailVm model)
+        public async Task<SqlSugarPagedList> GetInterfaceDetailList(InterfaceDetailVm model)
         {
-            try
-            {
-                var models = _interface.GetInterfaceDetailList(model, out int count);
-
-                return Ok(new { code = 0, count, msg = "鎺ュ彛鏄庣粏鍒楄〃", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _interface.GetInterfaceDetailList(model);
         }
 
         /// <summary>
@@ -2518,41 +1267,18 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddInterface(InterfaceVm model)
+        [UnitOfWork]
+        public async Task AddInterface(InterfaceVm model)
         {
-            try
+            await _interface.AddInterface(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.AddInterface(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
-                }
-                if (strMesage.Contains("-1"))
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-                else
-                {
-                    return Ok(new { code = 0, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "娣诲姞",
+                Msg = $"娣诲姞浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭�"
+            });
         }
 
         /// <summary>
@@ -2561,41 +1287,18 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditInterface(InterfaceVm model)
+        [UnitOfWork]
+        public async Task EditInterface(InterfaceVm model)
         {
-            try
+            await _interface.EditInterface(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.EditInterface(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
-                }
-                if (strMesage.Contains("-1"))
-                {
-                    return Ok(new { code = 0, msg = "閮ㄥ垎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "缂栬緫",
+                Msg = $"缂栬緫浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭�"
+            });
         }
 
         /// <summary>
@@ -2604,37 +1307,18 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelInterface(InterfaceVm model)
+        [UnitOfWork]
+        public async Task DelInterface(InterfaceVm model)
         {
-            try
+            await _interface.DelInterface(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.DelInterface(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "缂栬緫",
+                Msg = $"鍒犻櫎浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭�"
+            });
         }
 
         /// <summary>
@@ -2643,37 +1327,18 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelInterfaceDetail(InterfaceDetailVm model)
+        [UnitOfWork]
+        public async Task DelInterfaceDetail(InterfaceDetailVm model)
         {
-            try
+            await _interface.DelInterfaceDetail(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(UserId))
-                {
-                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.DelInterfaceDetail(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "缂栬緫",
+                Msg = $"鍒犻櫎浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭紝鏈郴缁熷瓧娈典负{model.Field}鐨勬帴鍙d俊鎭�"
+            });
         }
         #endregion
     }

--
Gitblit v1.8.0