Pārlūkot izejas kodu

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

jiangjc 1 gadu atpakaļ
vecāks
revīzija
dbae7b06f8

+ 226 - 6
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -66,6 +66,7 @@ using Aspose.Words.Lists;
 using OASystem.API.OAMethodLib.YouDaoAPI;
 using NPOI.XSSF.Streaming.Values;
 using OASystem.API.OAMethodLib.Quartz.Business;
+using System.Linq;
 
 namespace OASystem.API.Controllers
 {
@@ -1347,6 +1348,14 @@ namespace OASystem.API.Controllers
 
                 var carFeeTypeItems = await _groupRepository.Query<Sys_SetData>(s => s.STid == 17 && s.IsDel == 0).ToListAsync();
 
+
+                /*
+                 * 车/导游地接 费用类型
+                 */
+                var carFeeItems = await _groupRepository.Query<Sys_SetData>(s => s.STid == 83 && s.IsDel == 0).ToListAsync();
+
+                var cityData = await _groupRepository.Query<Grp_NationalTravelFee>(s => s.IsDel == 0).ToListAsync();
+
                 /*
                  * 用户信息
                  */
@@ -1476,7 +1485,33 @@ namespace OASystem.API.Controllers
                                 }
 
 
-                                _detail.PriceNameContent = touristGuideGroundReservations.Area;
+                                bool isInt = int.TryParse(touristGuideGroundReservations.Area, out int cityId);
+
+                                if (isInt)
+                                {
+                                    var cityInfo = cityData.Find(it => it.Id == cityId);
+                                    if (cityInfo != null)
+                                    {
+                                        string nameContent = $@"{cityInfo.Country}-{cityInfo.City}";
+
+                                        var carFeeItem = carFeeItems.Find(it => it.Id == touristGuideGroundReservations.PriceType);
+                                        if (carFeeItem != null )
+                                        {
+                                            nameContent += $@"({carFeeItem.Name})";
+                                        }
+                                        _detail.PriceNameContent = nameContent;
+
+                                    }
+                                }
+                                else
+                                {
+                                    _detail.PriceNameContent = touristGuideGroundReservations.Area;
+                                }
+
+                                
+
+
+                                
 
                                 List<Grp_CarTouristGuideGroundReservationsContent> touristGuideGroundReservationsContents = _CarTouristGuideGroundReservationsContent
                                     .Where(s => s.CTGGRId == touristGuideGroundReservations.Id && s.IsDel == 0 && s.Price != 0).ToList();
@@ -4233,18 +4268,20 @@ namespace OASystem.API.Controllers
 
                         //总计
                         decimal allPrice = dac1totalPrice + dac2totalPrice + _EnterExitCosts.Visa + _EnterExitCosts.Safe + _EnterExitCosts.Ticket;
-                        
+
                         //国际旅费
 
                         string outsideJJ = "";
                         string allPriceJJ = "";
-                        if (_EnterExitCosts.SumJJC == 1) {
+                        if (_EnterExitCosts.SumJJC == 1)
+                        {
                             outsideJJ = string.Format(@"经济舱:{0} 元/人", _EnterExitCosts.OutsideJJPay.ToString("#0.00"));
                             allPriceJJ = string.Format(@"经济舱:{0} 元/人", (allPrice + _EnterExitCosts.OutsideJJPay).ToString("#0.00"));
                         }
                         string outsideGW = "";
                         string allPriceGW = "";
-                        if (_EnterExitCosts.SumGWC == 1) {
+                        if (_EnterExitCosts.SumGWC == 1)
+                        {
                             outsideGW = string.Format(@"公务舱:{0}    元/人", _EnterExitCosts.OutsaideGWPay.ToString("#0.00"));
                             allPriceGW = string.Format(@"公务舱:{0}   元/人", (allPrice + _EnterExitCosts.OutsaideGWPay).ToString("#0.00"));
                         }
@@ -4494,6 +4531,189 @@ namespace OASystem.API.Controllers
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
                         return Ok(JsonView(true, "成功", new { Url = url }));
                     }
+                    else if (dto.SubTypeId == 1066) //成都市因公临时出国任务和预算审批意见表(外专培训团专用)
+                    {
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/成都市因公临时出国任务和预算审批意见表.docx");
+                        //载入模板
+                        Document doc = new Document(tempPath);
+
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        Dictionary<string, string> dic = new Dictionary<string, string>();
+
+                        dic.Add("GroupName", _DelegationInfo.TeamName);
+                        dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
+
+                        string missionLeader = "";  //团负责人默认接团客户名单第一个人
+                        string missionLeaderJob = "";//负责人job
+                        int groupNumber = 0; //团人数
+                        if (DeleClientList.Count > 0)
+                        {
+                            missionLeader = DeleClientList[0]?.Name ?? "";
+                            missionLeaderJob = DeleClientList[0]?.Job ?? "";
+                        }
+                        dic.Add("MissionLeader", missionLeader); //团负责人
+                        dic.Add("MissionLeaderJob", missionLeaderJob); //团负责人job
+                        dic.Add("GroupNumber", _DelegationInfo.VisitPNumber.ToString()); //团人数
+
+
+                        #region MyRegion
+                        //if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
+                        //{
+                        //    List<string> list = new List<string>();
+                        //    try
+                        //    {
+                        //        var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
+                        //        foreach (var item in spilitArr)
+                        //        {
+                        //            var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
+                        //            var depCode = spDotandEmpty[2].Substring(0, 3);
+                        //            var arrCode = spDotandEmpty[2].Substring(3, 3);
+                        //            string depName = threeCodes.Find(it => it.Three.Equals(depCode)).City,
+                        //                   arrName = threeCodes.Find(it => it.Three.Equals(arrCode)).City;
+
+                        //            list.Add(depName);
+                        //            list.Add(arrName);
+                        //        }
+
+                        //        list = list.Distinct().ToList();
+                        //        dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
+                        //    }
+                        //    catch (Exception)
+                        //    {
+                        //        dic.Add("ReturnCode", "行程录入不正确!");
+                        //    }
+                        //}
+                        //else
+                        //{
+                        //    dic.Add("ReturnCode", "未录入行程!");
+                        //}
+
+                        List<string> countrys = _groupRepository.GroupSplitCountry(_DelegationInfo.VisitCountry);
+                        dic.Add("ReturnCode", string.Join( "、", countrys));
+                        #endregion
+
+
+                        //dic.Add("ReturnCodeAir", dic["ReturnCode"]);
+                        //dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
+                        //dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
+
+                        //if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
+                        //{
+                        //    TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
+                        //    dic.Add("Day", sp.Days.ToString());
+
+                        //}
+                        dic.Add("Day", _DelegationInfo.VisitDays.ToString());
+
+                        dic.Add("CultivateDay", dac4.Count.ToString()); //培训天数
+                                                                     // dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
+
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+                        Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
+
+                        //培训人员名单
+                        int cultivateRowIndex = 7;
+                        foreach (var item in DeleClientList)
+                        {
+                            builder.MoveToCell(0, cultivateRowIndex, 0, 0);
+                            builder.Write(item.Name);
+                            builder.MoveToCell(0, cultivateRowIndex, 1, 0);
+                            builder.Write(item.Sex == 0 ? "男" : item.Sex == 1 ? "女" : "");
+
+                            builder.MoveToCell(0, cultivateRowIndex, 2, 0);
+
+                            string birthDay = "";
+                            if (!string.IsNullOrEmpty(item.Birthday))
+                            {
+                                var isDt = DateTime.TryParse(item.Birthday, out DateTime dt);
+                                if (isDt)
+                                {
+                                    birthDay = $"{dt.Year}.{dt.Month}";
+                                }
+                            }
+                            builder.Write(birthDay);
+
+                            builder.MoveToCell(0, cultivateRowIndex, 3, 0);
+                            builder.Write(item.Company);
+
+                            builder.MoveToCell(0, cultivateRowIndex, 4, 0);
+                            builder.Write(item.Job);
+
+                            cultivateRowIndex++;
+                        }
+
+                        //删除多余行
+                        //cultivateRowIndex -= 2;
+                        int delRows = 10 + 7  - cultivateRowIndex;
+                        if (delRows > 0)
+                        {
+                            for (int i = 0; i < delRows; i++)
+                            {
+
+                                table1.Rows.RemoveAt(cultivateRowIndex);
+                                //cultivateRowIndex++;
+                            }
+                        }
+
+                        decimal hotelFeeTotal = dac1.Sum(it => it.SubTotal);//住宿费
+                        dic.Add("HotelFeeTotal", hotelFeeTotal.ToString("#0.00"));
+                        decimal mealsFeeTotal = dac2.Sum(it => it.SubTotal);//伙食费
+                        dic.Add("MealsFeeTotal", mealsFeeTotal.ToString("#0.00"));
+                        decimal miscellaneousFeeTotal = dac3.Sum(it => it.SubTotal);//公杂费
+                        dic.Add("MiscellaneousFeeTotal", miscellaneousFeeTotal.ToString("#0.00"));
+                        decimal trainingFeeTotal = dac4.Sum(it => it.SubTotal);//培训费
+                        dic.Add("TrainingFeeTotal", trainingFeeTotal.ToString("#0.00"));
+                        decimal cityTranfficFeeToatal = _EnterExitCosts.CityTranffic; //城市区间交通费
+                        dic.Add("CityTranfficFeeToatal", cityTranfficFeeToatal.ToString("#0.00"));//
+                        //其他费用
+                        decimal otherFeeTotal = _EnterExitCosts.Visa + _EnterExitCosts.Safe + _EnterExitCosts.Ticket + _EnterExitCosts.YiMiao + _EnterExitCosts.HeSuan+ _EnterExitCosts.Service;
+                        dic.Add("OtherFeeTotal", otherFeeTotal.ToString("#0.00"));
+
+                        //其他费用合计
+                        decimal _otherFeeTotal = hotelFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + trainingFeeTotal + cityTranfficFeeToatal + otherFeeTotal;
+
+                        decimal _jjcFeeToatal = _EnterExitCosts.AirJJ + _otherFeeTotal; //经济舱
+                        decimal _gwcFeeToatal = _EnterExitCosts.AirGW + _otherFeeTotal; //公务舱
+                       
+                        //公务舱合计
+
+                        //国际旅费
+
+                        string outsideJJ = "";
+                        string allPriceJJ = "";
+                        if (_EnterExitCosts.SumJJC == 1 && _EnterExitCosts.SumGWC == 0)
+                        {
+                            dic.Add("AirFeeTotal", _EnterExitCosts.AirJJ.ToString("#0.00"));
+                            dic.Add("FeeTotal", _jjcFeeToatal.ToString("#0.00"));
+                        }
+                        if (_EnterExitCosts.SumGWC == 1 && _EnterExitCosts.SumJJC == 0)
+                        {
+                            dic.Add("AirFeeTotal", _EnterExitCosts.AirGW.ToString("#0.00"));
+                            dic.Add("FeeTotal", _gwcFeeToatal.ToString("#0.00"));
+                        }
+
+                        if (_EnterExitCosts.SumJJC == 1 && _EnterExitCosts.SumGWC == 1)
+                        {
+                            string airFeeTotalStr = string.Format(@$"经济舱:{_EnterExitCosts.AirJJ.ToString("#0.00")} 公务舱:{_EnterExitCosts.AirGW.ToString("#0.00")}");
+                            dic.Add("AirFeeTotal", airFeeTotalStr);
+                            string feeTotalStr = string.Format(@$"经济舱:{_jjcFeeToatal.ToString("#0.00")} 公务舱:{_gwcFeeToatal.ToString("#0.00")}");
+                            dic.Add("FeeTotal", feeTotalStr);
+                        }
+
+                        foreach (var key in dic.Keys)
+                        {
+                            builder.MoveToBookmark(key);
+                            builder.Write(dic[key]);
+                        }
+
+                        //模板文件名
+                        string strFileName = $"{_DelegationInfo.TeamName}成都市因公临时出国任务和预算审批意见表(外专培训团专用).docx";
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+                        return Ok(JsonView(true, "成功", new { Url = url }));
+                    }
                 }
                 else if (dto.ExportType == 2) //表格
                 {
@@ -10865,8 +11085,8 @@ namespace OASystem.API.Controllers
             dic.Add("SQtime", info1.ApprovalDt.ConvertToDatetime());
             dic.Add("SQRemark", info1.ApprovalRemark);
 
-            dic.Add("CPJtime", info1.ApprovalDt.ConvertToDatetime());
-            dic.Add("CPJRemark", info1.ApprovalRemark);
+            dic.Add("CPJtime", info1.IssueApprovalDt.ConvertToDatetime());
+            dic.Add("CPJRemark", info1.IssueApprovalRemark);
 
             //dic.Add("HZtime", info1.ApplyPassportDt.ConvertToDatetime());
             //dic.Add("HZRemark", info1.ApplyPassportRemark);

+ 1 - 1
OASystem/OASystem.Domain/Dtos/Groups/TourClientListDto.cs

@@ -75,7 +75,7 @@ namespace OASystem.Domain.Dtos.Groups
 
         /// <summary>
         /// 性别
-        /// 0 男1 女 其他值 未设置
+        /// 0 男1 女 -1 未设置
         /// </summary>
         public int Sex { get; set; }
 

+ 34 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -227,6 +227,40 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     CreateUserId = dto.UserId
                 };
 
+                string idNo = "", birthDay = "";
+                int sex = -1;
+                #region 身份证验证 
+
+                if (!string.IsNullOrEmpty(dto.IDCardNo))
+                {
+                    
+                    var idBool = dto.IDCardNo.IsValidChineseId();
+                    if (idBool)
+                    {
+                        idNo = dto.IDCardNo;
+                        DateTime? birthDayDt = CommonFun.GetBirthDateFromIdentityCard(dto.IDCardNo);
+                        if (birthDayDt != null)
+                        {
+                            birthDay = birthDayDt?.ToString("yyyy-MM-dd") ?? "";
+                        }
+
+                        sex = CommonFun.GetGenderFromIdentityCard(dto.IDCardNo);
+                    }
+
+
+                    #region dto重新赋值
+
+                    if (string.IsNullOrEmpty(dto.BirthDay)) dto.BirthDay = birthDay;
+                    if (dto.Sex < 0) dto.Sex = sex;
+
+                    #endregion
+
+                }
+
+
+                #endregion
+
+
                 Crm_CustomerCert _CustomerCert = new Crm_CustomerCert()
                 {
                     SdId = 773,
@@ -468,7 +502,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return _result;
         }
 
-
         /// <summary>
         /// AddMultiple
         /// 添加多个

+ 44 - 2
OASystem/OASystem.Infrastructure/Tools/CommonFun.cs

@@ -380,12 +380,54 @@ public static class CommonFun
     /// </summary>
     /// <param name="idNumber"></param>
     /// <returns></returns>
-    public static bool ValidateIdNumber(this string idNumber)
+    public static bool IsValidChineseId(this string idNumber)
     {
-        string pattern = @"^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|X)$";
+        string pattern = @"^[1-9]\d{5}(18|19|20|21|22)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|[Xx])$";
         Regex regex = new Regex(pattern);
         return regex.IsMatch(idNumber);
     }
+
+    /// <summary>
+    /// 通过身份证提取生日
+    /// </summary>
+    /// <param name="identityCard"></param>
+    /// <returns></returns>
+    public static DateTime? GetBirthDateFromIdentityCard(string identityCard)
+    {
+        // 身份证号码正则表达式验证,支持18位身份证号码
+        if (!Regex.IsMatch(identityCard, @"^\d{17}(\d|X|x)$"))
+        {
+            return null;
+        }
+
+        // 获取出生日期(8位数字)
+        string birthDateString = identityCard.Substring(6, 8);
+
+        // 尝试将出生日期字符串转换为DateTime类型
+        if (DateTime.TryParse(birthDateString, out DateTime birthDate))
+        {
+            return birthDate;
+        }
+
+        return null;
+    }
+
+    /// <summary>
+    /// 通过身份证判断性别
+    /// </summary>
+    /// <param name="idNumber"></param>
+    /// <returns>0 男1 女 -1 未设置</returns>
+    /// <exception cref="ArgumentException"></exception>
+    public static int GetGenderFromIdentityCard(string idNumber)
+    {
+        if (string.IsNullOrEmpty(idNumber) || idNumber.Length != 18)
+            return -1;
+
+        char genderChar = idNumber[16];
+        return int.Parse(genderChar.ToString()) % 2 == 0 ? 1 :0;
+    }
+
+
     #endregion
 
     #region string格式日期格式化