Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

wangh 1 year ago
parent
commit
7c94733b89

+ 86 - 19
OASystem/OASystem.Api/Controllers/AuthController.cs

@@ -125,6 +125,73 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(view));
         }
 
+        /// <summary>
+        /// 申请注册 数据Data
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        //[Authorize]
+        [HttpPost]
+        [Route("register/daraSource")]
+        public async Task<IActionResult> RegisterDataSource()
+        {
+            string sql = string.Format(@"Select sc.Id CompanyId,sc.CompanyName,sd.Id DepId,sd.DepName,sjp.Id JobId,sjp.JobName  From Sys_Company sc
+                                         Left Join Sys_Department sd On sd.IsDel = 0 And sc.Id = sd.CompanyId
+                                         Left Join Sys_JobPost sjp On sjp.IsDel = 0 And sjp.DepId = sd.Id 
+                                         Where sc.IsDel = 0");
+
+            var companyDetails = _loginRep._sqlSugar.SqlQueryable<CompanyDetailsView>(sql).ToList();
+
+            List<CompanyDetailsView1> detailsView1 = new List<CompanyDetailsView1>();
+
+            if (companyDetails.Count > 0)
+            {
+                var companyDetails1 = companyDetails.GroupBy(it => it.CompanyId).Select(it => it.First()).ToList();
+
+
+                detailsView1 = companyDetails1.Select(it =>
+                {
+                    CompanyDetailsView1 itemCompany = new CompanyDetailsView1();
+                    List<DepDetailsView> depDetailsView = new List<DepDetailsView>();
+
+                    var companyDetails2 = companyDetails.GroupBy(it => it.DepId).Select(it => it.First()).ToList();
+                    //部门
+                    depDetailsView = companyDetails2.Where(depIt => depIt.CompanyId == it.CompanyId).Select(depIt => {
+
+                        DepDetailsView depDetails = new DepDetailsView();
+                        List<JobDetailsView> jobDetails = new List<JobDetailsView>();
+
+                        //岗位
+                        jobDetails = companyDetails.Where(jobIt => jobIt.DepId == depIt.DepId).Select(jobIt => {
+
+                            JobDetailsView jobDetail = new JobDetailsView() { 
+                                JobId = jobIt.JobId,
+                                JobName = jobIt.JobName,
+                            };
+
+                            return jobDetail;
+                        }).ToList();
+
+                        depDetails.DepId = depIt.DepId;
+                        depDetails.DepName = depIt.DepName;
+                        depDetails.SubJob = jobDetails;
+                        return depDetails;
+                    }).ToList();
+
+                    itemCompany.CompanyId = it.CompanyId;
+                    itemCompany.CompanyName = it.CompanyName;
+                    itemCompany.SubDep = depDetailsView;
+                    return itemCompany;
+                }).ToList();
+
+            }
+
+
+
+
+            return Ok(new { Code = 200, Msg = "查询成功!", Data = detailsView1 });
+        }
+
         /// <summary>
         /// 申请注册
         /// </summary>
@@ -137,26 +204,26 @@ namespace OASystem.API.Controllers
         {
             #region 企业微信添加员工
 
-            string lastName = dto.CnName.Substring(0, 1);
-            string lastNamePy = string.Empty;
-            if (PinyinHelper.IsChinese(Convert.ToChar(lastName)))
-            {
-                lastNamePy = PinyinHelper.GetPinyin(lastName);
-            }
-
-            string userId = string.Format("{0}.{1}", dto.EnName, lastNamePy.ToLower());
-            Create_Request request = new Create_Request()
-            {
-                userid = userId,
-                name = dto.CnName,
-                mobile = dto.Phone,
-                department = new List<long>() { dto.DepId },
-                position = dto.JobPostId.ToString(),
-                gender = dto.Sex == 0 ? 1 : dto.Sex == 1 ? 2 : 1,
-                biz_mail = dto.Email
-            };
+            //string lastName = dto.CnName.Substring(0, 1);
+            //string lastNamePy = string.Empty;
+            //if (PinyinHelper.IsChinese(Convert.ToChar(lastName)))
+            //{
+            //    lastNamePy = PinyinHelper.GetPinyin(lastName);
+            //}
 
-            var qiYeWeChatCreateData = await _qiYeWeChatApiServic.CreateAsync(request);
+            //string userId = string.Format("{0}.{1}", dto.EnName, lastNamePy.ToLower());
+            //Create_Request request = new Create_Request()
+            //{
+            //    userid = userId,
+            //    name = dto.CnName,
+            //    mobile = dto.Phone,
+            //    department = new List<long>() { dto.DepId },
+            //    position = dto.JobPostId.ToString(),
+            //    gender = dto.Sex == 0 ? 1 : dto.Sex == 1 ? 2 : 1,
+            //    biz_mail = dto.Email
+            //};
+
+            //var qiYeWeChatCreateData = await _qiYeWeChatApiServic.CreateAsync(request);
             #endregion
 
 

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

@@ -476,9 +476,9 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, "id错误:" + diId.ToString()));
             }
 
+            List<DelegationVisaProgressView> list = _delegationVisaRep.GetDelegationProgressList(diId);
 
-
-            return Ok(JsonView(false));
+            return Ok(JsonView(list));
         }
 
 

+ 6 - 6
OASystem/OASystem.Domain/Dtos/UserDto/RegisterDto.cs

@@ -63,14 +63,9 @@ namespace OASystem.Domain.Dtos.UserDto
         /// </summary>
         public string? IdCrad { get; set; }
 
-        /// <summary>
-        /// 出生日期
-        /// </summary>
-        public DateTime BirthDay { get; set; }
-
         /// <summary>
         /// 学历
-        /// 0 未设置 1 大专 2 本科 3 研究生
+        /// 0 未设置 1 小学、2 初中、3 高中、4 专科、5 本科、6 研究生
         /// </summary>
         public int Education { get; set; }
 
@@ -121,5 +116,10 @@ namespace OASystem.Domain.Dtos.UserDto
         /// 工作经历
         /// </summary>
         public string? WorkExperience { get; set; }
+
+        /// <summary>
+        /// 入职时间
+        /// </summary>
+        public DateTime Edate  { get; set; }
     }
 }

+ 32 - 3
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaProgress.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -111,11 +112,18 @@ namespace OASystem.Domain.Entities.Groups
         public int CustomerId { get; set; }
 
         /// <summary>
-        /// 客户姓
+        /// 客户姓
         /// 正式使用新版OA后弃用
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)")]
-        public string CustomerName { get; set; }
+        public string LastName { get; set; }
+
+        /// <summary>
+        /// 客户名
+        /// 正式使用新版OA后弃用
+        /// </summary>
+        [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)")]
+        public string FirstName { get; set; }
 
         /// <summary>
         /// 签证国家
@@ -145,6 +153,27 @@ namespace OASystem.Domain.Entities.Groups
         public DateTime LastOperatorDt { get; set; }
     }
 
+    public enum Enum_DelegationVisaPicType
+    {
+        [Description("护照首页")]
+        FirstPage,
+
+        [Description("批件")]
+        Documents,
+
+        [Description("免签证明")]
+        Exemption,
+
+        [Description("派遣函红头文件")]
+        Dispatch,
+
+        [Description("签证页")]
+        Visa,
+
+        [Description("发票")]
+        Invoice
+    }
+
     [SugarTable("Grp_VisaProgressCustomerPicture")]
     public class Grp_VisaProgressCustomerPicture : EntityBase
     {
@@ -176,6 +205,6 @@ namespace OASystem.Domain.Entities.Groups
         /// 5:发票
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDataType = "int")]
-        public int PicType { get; set; }
+        public Enum_DelegationVisaPicType PicType { get; set; }
     }
 }

+ 1 - 1
OASystem/OASystem.Domain/Entities/System/Sys_Users.cs

@@ -42,7 +42,7 @@ namespace OASystem.Domain.Entities.System
         /// 密码
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
-        public string Password { get; set; }
+        public string Password { get; set; } = "123456"; //默认密码
         /// <summary>
         /// 性别0 男1 女  2 未设置
         /// </summary>

+ 23 - 25
OASystem/OASystem.Domain/ViewModels/Groups/Grp_DelegationVisaView.cs

@@ -30,23 +30,40 @@ namespace OASystem.Domain.ViewModels.Groups
         public string CompletePNumber { get; set; } = "已完成0人";
     }
 
-    public class DelegationVisaPersonView
+    public class DelegationVisaProgressView
     {
         /// <summary>
         /// ID
         /// DeleClient.ID
         /// </summary>
-        public int PersonViewId { get; set; }
+        public int ProgressViewId { get; set; }
 
         //public int RowNumber { get; set; }
         public int DiId { get; set; }
-
+        public int CustomerId { get; set; }
         public string LastName { get; set; }
         public string FirstName { get; set; }
 
         public string Country { get; set; }
         public int StatusSign { get; set; }
-        public string StatusStr { get; set; }
+
+        private string statusstr = "未知";
+        public string StatusStr
+        {
+            get
+            {
+                switch (StatusSign) {
+                    case 0: statusstr= "未完成"; break;
+                    case 1: statusstr= "已完成";break;
+                    case 2: statusstr= "已忽略";break;
+                    default: statusstr= "未知";break;
+                }
+                return statusstr;
+            }
+            set {
+                this.statusstr = value;
+            }
+        }
         public DelegationVisaPicCountList PicCountList { get; set; }
     }
 
@@ -65,33 +82,14 @@ namespace OASystem.Domain.ViewModels.Groups
         }
     }
 
-    public enum Enum_DelegationVisaPicType
-    {
-        [Description("护照首页")]
-        FirstPage,
-
-        [Description("批件")]
-        Documents,
-
-        [Description("免签证明")]
-        Exemption,
-
-        [Description("派遣函红头文件")]
-        Dispatch,
-
-        [Description("签证页")]
-        Visa,
-
-        [Description("发票")]
-        Invoice
-    }
+    
 
     public class DelegationVisaVisitCountryView
     {
         public int CountryViewId { get; set; }
         public int PersonViewId { get; set; }
         public string PicName { get; set; }
-        public Enum_DelegationVisaPicType PicType { get; set; }
+        public Entities.Groups.Enum_DelegationVisaPicType PicType { get; set; }
         public string PicPath { get; set; }
     }
 

+ 94 - 0
OASystem/OASystem.Domain/ViewModels/System/CompanyDetailsView.cs

@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.System
+{
+    /// <summary>
+    /// 公司详情
+    /// </summary>
+    public class CompanyDetailsView
+    {
+        /// <summary>
+        /// 公司Id
+        /// </summary>
+        public int CompanyId { get; set; }
+
+        /// <summary>
+        /// 公司名称
+        /// </summary>
+        public string? CompanyName { get; set; }
+
+        /// <summary>
+        /// 部门Id
+        /// </summary>
+        public int DepId { get; set; }
+
+        /// <summary>
+        /// 部门名称
+        /// </summary>
+        public string? DepName { get; set; }
+
+        /// <summary>
+        /// 岗位Id
+        /// </summary>
+        public int JobId { get; set; }
+
+        /// <summary>
+        /// 岗位名称
+        /// </summary>
+        public string? JobName { get; set; }
+    }
+
+    public class CompanyDetailsView1
+    {
+        /// <summary>
+        /// 公司Id
+        /// </summary>
+        public int CompanyId { get; set; }
+
+        /// <summary>
+        /// 公司名称
+        /// </summary>
+        public string? CompanyName { get; set; }
+
+        /// <summary>
+        /// 公司下的部门
+        /// </summary>
+        public List<DepDetailsView> SubDep { get; set; }
+    }
+
+    public class DepDetailsView
+    {
+        /// <summary>
+        /// 部门Id
+        /// </summary>
+        public int DepId { get; set; }
+
+        /// <summary>
+        /// 部门名称
+        /// </summary>
+        public string? DepName { get; set; }
+
+
+        /// <summary>
+        /// 部门下的岗位
+        /// </summary>
+        public List<JobDetailsView> SubJob { get; set; }
+    }
+
+    public class JobDetailsView
+    {
+        /// <summary>
+        /// 岗位Id
+        /// </summary>
+        public int JobId { get; set; }
+
+        /// <summary>
+        /// 岗位名称
+        /// </summary>
+        public string? JobName { get; set; }
+    }
+}

+ 83 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationVisaRepository.cs

@@ -1,4 +1,5 @@
-using OASystem.Domain.Dtos.Groups;
+using Aspose.Words.Lists;
+using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.Resource;
@@ -54,7 +55,7 @@ From DelegationInfo With(Nolock) {2}
             return rst;
         }
 
-        public List<DelegationVisaPersonView> GetDelegationPersonList(int diid)
+        public List<DelegationVisaProgressView> GetDelegationProgressList(int diid)
         {
             ChangeDataBase(DBEnum.OA2014DB);
 
@@ -64,27 +65,100 @@ Diid,
 LastName,
 [Name] as 'FirstName'
 From DeleClient With(Nolock) Where Diid = {0} And IsDel = 0 ", diid);
-            List<DelegationVisaPersonView> clientList = _sqlSugar.SqlQueryable<DelegationVisaPersonView>(sqlDeleClient).ToList();
+            List<DelegationVisaProgressView> clientList = _sqlSugar.SqlQueryable<DelegationVisaProgressView>(sqlDeleClient).ToList();
 
             string sqlDelegation = string.Format(@" Select * From DelegationInfo With(Nolock) Where Id = {0} ", diid);
             OA2021_DelegationInfo delegationInfo = _sqlSugar.SqlQueryable<OA2021_DelegationInfo>(sqlDelegation).First();
-            string countryName = delegationInfo.VisitCountry;
+            //string countryName = delegationInfo.VisitCountry;
+
 
+            #region 检查与配置
 
-            #region 配置
+            ChangeDataBase(DBEnum.OA2023DB);
 
+            string sqlCheck = string.Format(@" Select * From Grp_VisaProgressCustomer With(Nolock) Where DiId = {0} ", diid);
+            List<Grp_VisaProgressCustomer> listVisaPro = _sqlSugar.SqlQueryable<Grp_VisaProgressCustomer>(sqlCheck).ToList();
+            if (listVisaPro.Count < 1)
+            {
+                //listVisaPro = new List<Grp_VisaProgressCustomer>(initVisitCountry(diid, delegationInfo));
+                initVisitCountry(diid, delegationInfo);
+            }
             #endregion
 
-            return null;
+            string sqlView1 = string.Format(@" Select 
+Id as 'ProgressViewId',
+DiId,
+CustomerId,
+LastName,
+FirstName,
+Country,
+WorkStatus as 'StatusSign'
+From Grp_VisaProgressCustomer With(Nolock) Where DiId = {0} And IsDel = 0 ", diid);
+
+            List<DelegationVisaProgressView> result = _sqlSugar.SqlQueryable<DelegationVisaProgressView>(sqlView1).ToList();
+
+            //查询各子项行数
+            foreach (var pro in result)
+            {
+                string sqlCheckCount = string.Format(@" Select PicType,Count(PicType) PicTypeCount 
+From Grp_VisaProgressCustomerPicture Where VisaProgressCustomerId = {0}
+Group by PicType Order By PicType ", pro.ProgressViewId);
+
+                List<dynamic> tempList = _sqlSugar.SqlQueryable<dynamic>(sqlCheckCount).ToList();
+                DelegationVisaPicCountList countList = new DelegationVisaPicCountList();
+
+                foreach (var item in tempList)
+                {
+                    int tempCount = item.PicTypeCount;
+                    switch (item.PicType)
+                    {
+                        case 0: countList.FirstPageCount = tempCount; break;
+                        case 1: countList.DocumentsCount = tempCount; break;
+                        case 2: countList.ExemptionCount = tempCount; break;
+                        case 3: countList.DispatchCount = tempCount; break;
+                        case 4: countList.VisaCount = tempCount; break;
+                        case 5: countList.InvoiceCount = tempCount; break;
+                        default:break;
+                    }
+                }
+                countList.totalCount();
+                pro.PicCountList = countList;
+            }
+
+            return result;
         }
 
-        public int initVisitCountry(int diid)
+        public void initVisitCountry(int diid, OA2021_DelegationInfo delegationInfo)
         {
+            ChangeDataBase(DBEnum.OA2014DB);
+            string sqlDeleClient = String.Format(@" Select * From DeleClient With(Nolock) Where diid = {0} ", diid);
+            List<OA2021_DeleClient> listDeleClient = _sqlSugar.SqlQueryable<OA2021_DeleClient>(sqlDeleClient).ToList();
             ChangeDataBase(DBEnum.OA2023DB);
 
-            string sqlCheck = string.Format(@" Select * From  ");
+            List<Grp_VisaProgressCustomer> listVisaCustomer = new List<Grp_VisaProgressCustomer>();
+
+            string countryName = delegationInfo.VisitCountry;
+            string[] countrys = Regex.Replace(countryName, @"[,,|-、\s丶]", ",", RegexOptions.IgnoreCase).Split(',');
+
+
+            foreach (var client in listDeleClient)
+            {
+                foreach (string cname in countrys)
+                {
+                    Grp_VisaProgressCustomer item = new Grp_VisaProgressCustomer();
+                    item.Country = cname;
+                    item.CreateUserId = -3;
+                    item.CustomerId = 0;
+                    item.DiId = diid;
+                    item.FirstName = client.Name;
+                    item.LastName = client.LastName;
+                    item.WorkStatus = 0;
+                    listVisaCustomer.Add(item);
+                }
+            }
 
-            return 0;
+            _sqlSugar.Insertable(listVisaCustomer).UseParameter().ExecuteCommand();
+            //return listVisaCustomer;
         }
 
     }

+ 5 - 1
OASystem/OASystem.Infrastructure/Repositories/Login/LoginRepository.cs

@@ -97,6 +97,10 @@ namespace OASystem.Infrastructure.Repositories.Login
         public async Task<Result> Register(LoginRepository _loginRep, RegisterDto registerDto)
         {
             Result result = new Result();
+
+            string IdCrad = registerDto.IdCrad;
+            string birthDay = IdCrad.Substring(6, 4) + "-" + IdCrad.Substring(10, 2) + "-" + IdCrad.Substring(12, 2);
+
             Sys_Users _userInfo = new Sys_Users()
             {
                 CnName = registerDto.CnName,
@@ -114,7 +118,7 @@ namespace OASystem.Infrastructure.Repositories.Login
                 Edate = DateTime.Now,  //入职时间默认当前数据提交时间
                 Rdate = new DateTime(1990, 1, 1),  //离职时间默认最原始时间
                 Seniority = 0, //工龄默认 0
-                Birthday = registerDto.BirthDay,
+                Birthday = Convert.ToDateTime(birthDay),
                 IDCard = registerDto.IdCrad,
                 StartWorkDate = new DateTime(1990, 1, 1),  //开始工作时间默认最原始时间
                 GraduateInstitutions = registerDto.GraduationSchhol,