yanjinhui
2025-05-27 f1a841f056fe4d7be16f39d6fe169667f743d00a
project/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
@@ -26,13 +26,15 @@
        private readonly ISys_MenuService _menuService;
        private readonly IRepository<Dt_FaceRecognition> _faceServer;
        private readonly IRepository<Dt_Loginhsy> _LoginhsyServer;
        public Sys_UserService(IRepository<Dt_Loginhsy> LoginhsyServer,IRepository<Dt_FaceRecognition> faceServer, IRepository<Sys_User> repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService) : base(repository)
        private readonly IRepository<Dt_Maintenance> _MainServer;
        public Sys_UserService(IRepository<Dt_Loginhsy> LoginhsyServer,IRepository<Dt_FaceRecognition> faceServer, IRepository<Sys_User> repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService, IRepository<Dt_Maintenance> MainServer) : base(repository)
        {
            _faceServer = faceServer;
            _LoginhsyServer = LoginhsyServer;
            _unitOfWorkManage = unitOfWorkManage;
            _cacheService = cacheService;
            _menuService = menuService;
            _MainServer = MainServer;
        }
@@ -551,15 +553,26 @@
                    //Face_token = baiduResult.result.face_token,
                    PhoneNo = addUserDTO.phoneno,
                    Role_Id = addUserDTO.roleid,
                    IsLeader=addUserDTO.IsLeader,
                    RoleName = addUserDTO.rolename,
                    Enable = addUserDTO.enable,
                    UserPwd = "j79rYYvCz4vdhcboB1Ausg==",
                    Userteam=addUserDTO.userteam,
                    //Userteam=addUserDTO.userteam,
                    Dept_Id=addUserDTO.dept_Id,
                    CardNumber=addUserDTO.carnuber,
                    //CardNumber=addUserDTO.carnuber,
                    CreateDate = DateTime.Now
                };
                BaseDal.AddData(sys);
                //创建Dt_Maintenance表中的数据
                var Main = new Dt_Maintenance
                {
                    UserAccount = addUserDTO.username,
                    Roleid = addUserDTO.roleid,
                    IsLeader=addUserDTO.IsLeader,//是否是组长
                };
                _MainServer.AddData(Main);
                return new WebResponseContent { Status = true, Data = sys };
            }
            catch (Exception ex)
@@ -583,6 +596,8 @@
                // 1. 查询用户
                var userList = BaseDal.QueryData();
                var sys = userList.FirstOrDefault(x => x.User_Id == addUserDTO.id);
                //查找Dt_MaintenanceTeam中的数据
                var team = _MainServer.QueryData(x => x.UserAccount == sys.UserName).FirstOrDefault();
                if (sys == null)
                {
                    return new WebResponseContent { Status = false, Message = "没找到该用户" };
@@ -604,10 +619,11 @@
                sys.PhoneNo = addUserDTO.phoneno;
                sys.Role_Id = addUserDTO.roleid;
                sys.RoleName = addUserDTO.rolename;
                sys.CardNumber = addUserDTO.carnuber;
                sys.Userteam = addUserDTO.userteam;
                //sys.CardNumber = addUserDTO.carnuber;
                //sys.Userteam = addUserDTO.userteam;
                sys.Dept_Id = addUserDTO.dept_Id;
                sys.Enable = addUserDTO.enable;
                sys.IsLeader = addUserDTO.IsLeader;//更新用户表的是否是组长
                //如果人脸识别添加了这里就注释掉
                sys.HeadImageUrl = addUserDTO.path;
@@ -638,6 +654,11 @@
                // 8. 更新数据库
                BaseDal.UpdateData(sys);
                //更新Dt_Maintenance表中的数据和user表中修改的一样
                team.UserAccount = addUserDTO.username;//账号
                team.Roleid = addUserDTO.roleid;//更新权限
                team.IsLeader = addUserDTO.IsLeader;
                _MainServer.UpdateData(team);
                return new WebResponseContent { Status = true, Data = sys };
            }