From 1f1c2ecd4d216d165703d1f418eaa1691aa5a86a Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 27 八月 2024 16:37:39 +0800
Subject: [PATCH] 提交

---
 cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs          |   52 ++++++++
 cylsg/cylsg.Application/Users/UserAppService.cs          |  114 ++++++++++++++++--
 cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs |   41 +++++-
 cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs  |  102 ++++++++++++++--
 cylsg/cylsg.Application/Orders/Dtos/Mapper.cs            |    8 +
 cylsg/EzTencentCloud/TencentCloudService.cs              |    6 
 cylsg/cylsg.Application/Users/Dtos/UserDto.cs            |    2 
 cylsg/cylsg.Model/UserModel/UserCompany.cs               |    5 
 8 files changed, 282 insertions(+), 48 deletions(-)

diff --git a/cylsg/EzTencentCloud/TencentCloudService.cs b/cylsg/EzTencentCloud/TencentCloudService.cs
index ceafd97..a276174 100644
--- a/cylsg/EzTencentCloud/TencentCloudService.cs
+++ b/cylsg/EzTencentCloud/TencentCloudService.cs
@@ -138,7 +138,7 @@
                 httpProfile.Endpoint = ("ocr.tencentcloudapi.com");
                 clientProfile.HttpProfile = httpProfile;
 
-                var _ocrClient = new OcrClient(cred, "ap-chengdu", clientProfile);
+                var _ocrClient = new OcrClient(cred, "ap-shanghai", clientProfile);
           
                 var ret = _ocrClient.BizLicenseOCRSync(new BizLicenseOCRRequest()
                 {
@@ -256,7 +256,7 @@
 
             httpProfile.Endpoint = ("iai.tencentcloudapi.com");
             clientProfile.HttpProfile = httpProfile;
-            var iaiClient = new IaiClient(cred, "ap-chengdu", clientProfile);
+            var iaiClient = new IaiClient(cred, "ap-shanghai", clientProfile);
             var ret = iaiClient.CreateFace( new TencentCloud.Iai.V20200303.Models.CreateFaceRequest
             {
               
@@ -291,7 +291,7 @@
 
             httpProfile.Endpoint = ("iai.tencentcloudapi.com");
             clientProfile.HttpProfile = httpProfile;
-            var iaiClient = new IaiClient(cred, "ap-chengdu", clientProfile);
+            var iaiClient = new IaiClient(cred, "ap-shanghai", clientProfile);
             var ret = iaiClient.VerifyFaceSync(new  TencentCloud.Iai.V20200303.Models.VerifyFaceRequest
             {
 
diff --git a/cylsg/cylsg.Application/Orders/Dtos/Mapper.cs b/cylsg/cylsg.Application/Orders/Dtos/Mapper.cs
index 0e74ae9..1c87dab 100644
--- a/cylsg/cylsg.Application/Orders/Dtos/Mapper.cs
+++ b/cylsg/cylsg.Application/Orders/Dtos/Mapper.cs
@@ -1,4 +1,5 @@
 锘縰sing cylsg.Model.OrderModel;
+using cylsg.Model.UserModel;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -22,7 +23,12 @@
 
             config.ForType<OrderBiddingDetailCheck, OrderBiddingDetailCheckDto>();
             config.ForType<OrderBiddingDetailCheckDto, OrderBiddingDetailCheck>();
-            
+
+
+            config.ForType<UserTiXianDetail, UserTiXianDetailDto>();
+            config.ForType<UserTiXianDetailDto, UserTiXianDetail>(); 
+
+
         }
     }
 }
diff --git a/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs b/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs
index c524481..918d253 100644
--- a/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs
+++ b/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs
@@ -1,6 +1,9 @@
-锘縰sing cylsg.Model.OrderModel;
+锘縰sing cylsg.Core.Attributes;
+using cylsg.Core;
+using cylsg.Model.OrderModel;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -501,4 +504,51 @@
         public decimal? TodaySalary { get; set; }
 
     }
+
+
+
+    /// <summary>
+    /// 鐢ㄦ埛宸ヤ汉鎻愮幇鏄庣粏琛�
+    /// </summary>
+    public class UserTiXianDetailDto
+    {
+        /// <summary>
+        /// 鎻愮幇鏄庣粏Id
+        /// </summary>
+        public int Id { get; set; }
+
+
+        /// <summary>
+        /// 鐢ㄦ埛id
+        /// </summary>
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// 鐢ㄦ埛id
+        /// </summary>
+        public string UserName { get; set; }
+        /// <summary>
+        /// 閲戦
+        /// </summary>
+        public decimal? YiTiXianJine { get; set; }
+
+
+        /// <summary>
+        /// 鏀嚭杩樻槸鏀跺叆
+        /// </summary>
+        public int ZhiChuShouRu { get; set; }
+
+        /// <summary>
+        /// 鏀嚭杩樻槸鏀跺叆
+        /// </summary>
+        public string ZhiChuShouRuName { get; set; }
+
+
+        /// <summary>
+        /// 澶囨敞
+        /// </summary>
+        public string Remark { get; set; }
+
+
+    }
 }
diff --git a/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs b/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs
index c0e305c..86db772 100644
--- a/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs
+++ b/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs
@@ -116,11 +116,30 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
             }
+
+
+            if (!string.IsNullOrEmpty(orderDto.OrderName) && orderDto.OrderName.Length > 100)
+            {
+                throw Oops.Oh("鎷涘伐鍚嶇О闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(orderDto.Demand) && orderDto.Demand.Length > 2000)
+            {
+                throw Oops.Oh("闇�姹傞暱搴﹁繃闀匡紒");
+            }
+            if (!string.IsNullOrEmpty(orderDto.WorderAddress) && orderDto.WorderAddress.Length > 500)
+            {
+                throw Oops.Oh("宸ヤ綔鍦扮偣闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(orderDto.ContactPhone) && orderDto.ContactPhone.Length > 30)
+            {
+                throw Oops.Oh("鑱旂郴鐢佃瘽闀垮害杩囬暱锛�");
+            }
+
             var userCompanyRes = new BaseRepository<UserCompany>();
             var userCompany = await userCompanyRes.GetFirstAsync(p => p.UserId == userid && p.IsEn == true && p.IsDeleted == false);
             if (userCompany == null || string.IsNullOrEmpty(userCompany.BusinessLicense))
@@ -148,7 +167,7 @@
                 order.WorkPrice = orderDto.WorkPrice;
 
 
-                order.UpDataBy = ITCode;
+                order.UpDataBy = NickName;
                 order.UpDataTime = DateTime.Now;
                 res = await orderRes.UpdateAsync(order);
 
@@ -157,9 +176,9 @@
             else
             {
                 var order = _mapper.Map<Order>(orderDto);
-                order.UpDataBy = ITCode;
+                order.UpDataBy = NickName;
                 order.UpDataTime = DateTime.Now;
-                order.CreateBy = ITCode;
+                order.CreateBy = NickName;
                 order.CreateTime = DateTime.Now;
                 order.OrderStatus = 0;
                 order.OrderUserId = userid;
@@ -188,7 +207,7 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
@@ -225,7 +244,7 @@
 
             orderBidding.IsSelected = true;
             orderBidding.Selectedtime = DateTime.Now;
-            orderBidding.UpDataBy = ITCode;
+            orderBidding.UpDataBy = NickName;
             orderBidding.UpDataTime = DateTime.Now;
 
 
@@ -383,7 +402,7 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
@@ -428,11 +447,11 @@
                 orderBiddingDetail.TodaySalary = dakaDto.TodaySalary;
                 orderBiddingDetail.IsShenPi = (int)IsShenPis.yishenpi;
                 orderBiddingDetail.ShenPitime = DateTime.Now;
-                orderBiddingDetail.UpDataBy = ITCode;
+                orderBiddingDetail.UpDataBy = NickName;
                 orderBiddingDetail.UpDataTime = DateTime.Now;
                 orderBiddingDetail.IsTiXian = true;
                 orderBiddingDetail.TiXiantime = DateTime.Now;
-                //orderBiddingDetail.CreateBy = ITCode;
+                //orderBiddingDetail.CreateBy = NickName;
                 //orderBiddingDetail.CreateTime = DateTime.Now;
                 res = await orderBiddingDetailRes.UpdateAsync(orderBiddingDetail);
                 if (!res)
@@ -450,9 +469,9 @@
                     userTiXianDetail.YiTiXianJine = TodaySalary;
                     userTiXianDetail.ZhiChuShouRu = (int)ZhiChuShouRus.shouru;
                     userTiXianDetail.Remark = "鎷涘伐璁㈠崟" + order.OrderName + orderBiddingDetail.WorkDate.Value.ToString("yyyy-MM-dd") + "宸ヨ祫缁撶畻";
-                    userTiXianDetail.UpDataBy = ITCode;
+                    userTiXianDetail.UpDataBy = NickName;
                     userTiXianDetail.UpDataTime = DateTime.Now;
-                    userTiXianDetail.CreateBy = ITCode;
+                    userTiXianDetail.CreateBy = NickName;
                     userTiXianDetail.CreateTime = DateTime.Now;
 
                     res = await userTiXianDetailRes.InsertAsync(userTiXianDetail);
diff --git a/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs b/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs
index 3f658a3..74c4038 100644
--- a/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs
+++ b/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs
@@ -273,7 +273,7 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
@@ -292,6 +292,10 @@
             if (order == null || order.OrderStatus>0)
             {
                 throw Oops.Oh("璇ユ嫑宸ョ姸鎬佸凡缁忔棤娉曟姇閫掞紒");
+            }
+            if (order.OrderUserId == userid)
+            {
+                throw Oops.Oh("鑷繁鏃犳硶鎶曢�掕嚜宸卞彂甯冪殑鎷涘伐锛�");
             }
 
             bool res;
@@ -316,9 +320,9 @@
                 orderBidding1.WorkerUserId = userid;
                 orderBidding1.OrderId = baoMingDto.OrderId;
                 orderBidding1.IsSelected = false;
-                orderBidding1.UpDataBy = ITCode;
+                orderBidding1.UpDataBy = NickName;
                 orderBidding1.UpDataTime = DateTime.Now;
-                orderBidding1.CreateBy = ITCode;
+                orderBidding1.CreateBy = NickName;
                 orderBidding1.CreateTime = DateTime.Now;
 
                 res = await orderBiddingRes.InsertAsync(orderBidding1);
@@ -338,7 +342,7 @@
         {
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
@@ -387,7 +391,7 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
@@ -423,9 +427,9 @@
                 orderBiddingDetail.WorkDate = dateTime;
                 orderBiddingDetail.IsShenPi = 0;
                 orderBiddingDetail.IsTiXian = false;
-                orderBiddingDetail.UpDataBy = ITCode;
+                orderBiddingDetail.UpDataBy = NickName;
                 orderBiddingDetail.UpDataTime = DateTime.Now;
-                orderBiddingDetail.CreateBy = ITCode;
+                orderBiddingDetail.CreateBy = NickName;
                 orderBiddingDetail.CreateTime = DateTime.Now;
                 orderBiddingDetail.Id =  await orderBiddingDetailRes.InsertReturnIdentityAsync(orderBiddingDetail);
             }
@@ -434,9 +438,9 @@
             orderBiddingDetailCheck.OrderBiddingDetailId = orderBiddingDetail.Id;
             orderBiddingDetailCheck.CheckPhoto = dakaDto.CheckPhoto;
             orderBiddingDetailCheck.Checktime = DateTime.Now;
-            orderBiddingDetailCheck.UpDataBy = ITCode;
+            orderBiddingDetailCheck.UpDataBy = NickName;
             orderBiddingDetailCheck.UpDataTime = DateTime.Now;
-            orderBiddingDetailCheck.CreateBy = ITCode;
+            orderBiddingDetailCheck.CreateBy = NickName;
             orderBiddingDetailCheck.CreateTime = DateTime.Now;
             res = await OrderBiddingDetailCheckRes.InsertAsync(orderBiddingDetailCheck);
 
@@ -591,7 +595,7 @@
         {
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
@@ -695,7 +699,7 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
@@ -728,9 +732,9 @@
             orderBiddingDetail.WorkCount = dakaDto.WorkCount;
             orderBiddingDetail.TodaySalary = dakaDto.TodaySalary;
             orderBiddingDetail.IsShenPi = 1;
-            orderBiddingDetail.UpDataBy = ITCode;
+            orderBiddingDetail.UpDataBy = NickName;
             orderBiddingDetail.UpDataTime = DateTime.Now;
-            //orderBiddingDetail.CreateBy = ITCode;
+            //orderBiddingDetail.CreateBy = NickName;
             //orderBiddingDetail.CreateTime = DateTime.Now;
             var res = await orderBiddingDetailRes.UpdateAsync(orderBiddingDetail);
 
@@ -742,5 +746,77 @@
 
 
 
+
+        /// <summary>
+        /// 鏌ヨ宸ヤ汉鐨勬敹鍏ヨ褰�
+        /// </summary>
+        /// <param name="page"></param>
+        /// <returns></returns>
+        [Authorize]
+        [HttpPost]
+        public async Task<PageResult<UserTiXianDetailDto>> PostMyTiXianDetailListPage(PageBaseSearch page)
+        {
+            var UserID = App.User?.FindFirstValue("UserID");
+            int userid = 0;
+            if (!string.IsNullOrEmpty(UserID))
+            {
+                userid = int.Parse(UserID);
+            }
+
+            PageResult<UserTiXianDetailDto> result = new PageResult<UserTiXianDetailDto>();
+
+            RefAsync<int> total = 0;
+
+
+            var userTiXianDetailRepository = new BaseRepository<UserTiXianDetail>();
+
+            var data = await userTiXianDetailRepository.Context.Queryable<UserTiXianDetail>()
+                     .Where(a => a.IsEn == true && a.IsDeleted == false && a.UserId == userid)
+                        .OrderByDescending(a => a.CreateTime)
+                      .Select(a => new UserTiXianDetailDto
+                      {
+                          Id = a.Id,
+                          UserId = a.UserId,
+                          YiTiXianJine = a.YiTiXianJine,
+                          ZhiChuShouRu = a.ZhiChuShouRu,
+                          Remark = a.Remark,
+                         
+
+                      })
+
+                    .ToPageListAsync(page.PageIndex, page.PageSize, total);
+
+            if (data != null && data.Count > 0)
+            {
+                foreach (var userTiXianDetailDto in data)
+                {
+                    
+                    switch (userTiXianDetailDto.ZhiChuShouRu)
+                    {
+                        case (int)ZhiChuShouRus.zhichu: userTiXianDetailDto.ZhiChuShouRuName = "鏀嚭"; break;
+                        case (int)ZhiChuShouRus.shouru: userTiXianDetailDto.ZhiChuShouRuName = "鏀跺叆"; break;
+                        default: break;
+                    }
+
+                     
+
+
+
+
+                  
+
+                }
+
+            }
+            result.Items = data;
+            result.PageIndex = page.PageIndex;
+            result.PageSize = page.PageSize;
+            result.TotalCount = total;
+
+            return result;
+        }
+
+
+
     }
 }
diff --git a/cylsg/cylsg.Application/Users/Dtos/UserDto.cs b/cylsg/cylsg.Application/Users/Dtos/UserDto.cs
index bbe62f6..b2a6d83 100644
--- a/cylsg/cylsg.Application/Users/Dtos/UserDto.cs
+++ b/cylsg/cylsg.Application/Users/Dtos/UserDto.cs
@@ -147,7 +147,7 @@
         /// <summary>
         /// 娉ㄥ唽鏃堕棿
         /// </summary>
-        public DateTime? Regtime { get; set; }
+        public string Regtime { get; set; }
 
         /// <summary>
         /// 鑱旂郴鍦板潃
diff --git a/cylsg/cylsg.Application/Users/UserAppService.cs b/cylsg/cylsg.Application/Users/UserAppService.cs
index baf8708..7acfbe1 100644
--- a/cylsg/cylsg.Application/Users/UserAppService.cs
+++ b/cylsg/cylsg.Application/Users/UserAppService.cs
@@ -52,10 +52,18 @@
             userDto = _mapper.Map<UserDto>(user);
 
             var userWorker = await userWorkerRes.GetFirstAsync(p=>p.UserId== userid);
-            userDto.userWorker = _mapper.Map<UserWorkerDto>(userWorker);
-
+            if (userWorker != null)
+            {
+                userDto.userWorker = _mapper.Map<UserWorkerDto>(userWorker);
+            }
+           
+            
             var userCompany = await userCompanyRes.GetFirstAsync(p => p.UserId == userid);
-            userDto.userCompany = _mapper.Map<UserCompanyDto>(userCompany);
+            if (userCompany != null)
+            {
+                userDto.userCompany = _mapper.Map<UserCompanyDto>(userCompany);
+            }
+               
 
 
 
@@ -72,12 +80,41 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
             }
-         
+
+            if (!string.IsNullOrEmpty(userWorkerDto.IdCardFace) && userWorkerDto.IdCardFace.Length > 500)
+            {
+                throw Oops.Oh("韬唤璇佹闈㈣矾寰勯暱搴﹁繃闀匡紒");
+            }
+            if (!string.IsNullOrEmpty(userWorkerDto.IdCardBack) && userWorkerDto.IdCardBack.Length > 500)
+            {
+                throw Oops.Oh("韬唤璇佸弽闈㈣矾寰勯暱搴﹁繃闀匡紒");
+            }
+            if (!string.IsNullOrEmpty(userWorkerDto.name) && userWorkerDto.name.Length > 100)
+            {
+                throw Oops.Oh("濮撳悕闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userWorkerDto.Phone) && userWorkerDto.Phone.Length > 30)
+            {
+                throw Oops.Oh("鐢佃瘽鍙风爜闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userWorkerDto.IdCode) && userWorkerDto.IdCode.Length > 30)
+            {
+                throw Oops.Oh("韬唤璇佸彿闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userWorkerDto.Address) && userWorkerDto.Address.Length > 500)
+            {
+                throw Oops.Oh("鑱旂郴鍦板潃闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userWorkerDto.Resume) && userWorkerDto.Resume.Length > 2000)
+            {
+                throw Oops.Oh("绠�鍘嗘弿杩伴暱搴﹁繃闀匡紒");
+            }
+
             var userWorkerRes = new BaseRepository<UserWorker>();
             bool res;
             if (userWorkerDto.Id > 0)
@@ -91,7 +128,7 @@
                 userWorker1.Address = userWorkerDto.Address;
                 userWorker1.Resume = userWorkerDto.Resume;
 
-                userWorker1.UpDataBy = ITCode;
+                userWorker1.UpDataBy = NickName;
                 userWorker1.UpDataTime = DateTime.Now;
                 res = await userWorkerRes.UpdateAsync(userWorker1);
 
@@ -100,9 +137,9 @@
             else
             {
                 var userWorker = _mapper.Map<UserWorker>(userWorkerDto);
-                userWorker.UpDataBy = ITCode;
+                userWorker.UpDataBy = NickName;
                 userWorker.UpDataTime = DateTime.Now;
-                userWorker.CreateBy = ITCode;
+                userWorker.CreateBy = NickName;
                 userWorker.CreateTime = DateTime.Now;
                 userWorker.UserId = userid;
                 res = await userWorkerRes.InsertAsync(userWorker);
@@ -129,12 +166,44 @@
 
             var UserID = App.User?.FindFirstValue("UserID");
             int userid = 0;
-            string ITCode = App.User?.FindFirstValue("ITCode");
+            string NickName = App.User?.FindFirstValue("NickName");
             if (!string.IsNullOrEmpty(UserID))
             {
                 userid = int.Parse(UserID);
             }
-          
+            if(!string.IsNullOrEmpty(userCompanyDto.BusinessLicense) && userCompanyDto.BusinessLicense.Length > 500)
+            {
+                throw Oops.Oh("钀ヤ笟鎵х収璺緞闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userCompanyDto.Suppliername) && userCompanyDto.Suppliername.Length > 100)
+            {
+                throw Oops.Oh("浼佷笟鍚嶇О闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userCompanyDto.Regtime) && userCompanyDto.Regtime.Length > 50)
+            {
+                throw Oops.Oh("娉ㄥ唽鏃堕棿闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userCompanyDto.Address) && userCompanyDto.Address.Length > 500)
+            {
+                throw Oops.Oh("鑱旂郴鍦板潃闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userCompanyDto.Suppliercode) && userCompanyDto.Suppliercode.Length > 30)
+            {
+                throw Oops.Oh("浼佷笟娉ㄥ唽鍙烽暱搴﹁繃闀匡紒");
+            }
+            if (!string.IsNullOrEmpty(userCompanyDto.Contact) && userCompanyDto.Contact.Length > 50)
+            {
+                throw Oops.Oh("鑱旂郴浜洪暱搴﹁繃闀匡紒");
+            }
+            if (!string.IsNullOrEmpty(userCompanyDto.Phone) && userCompanyDto.Phone.Length > 50)
+            {
+                throw Oops.Oh("鑱旂郴鐢佃瘽闀垮害杩囬暱锛�");
+            }
+            if (!string.IsNullOrEmpty(userCompanyDto.Resume) && userCompanyDto.Resume.Length > 2000)
+            {
+                throw Oops.Oh("鍏徃绠�浠嬮暱搴﹁繃闀匡紒");
+            }
+
             var userCompanyRes = new BaseRepository<UserCompany>();
             bool res;
             if (userCompanyDto.Id > 0)
@@ -150,7 +219,7 @@
                 userCompany1.Resume = userCompanyDto.Resume;
  
 
-                userCompany1.UpDataBy = ITCode;
+                userCompany1.UpDataBy = NickName;
                 userCompany1.UpDataTime = DateTime.Now;
                 res = await userCompanyRes.UpdateAsync(userCompany1);
 
@@ -159,9 +228,9 @@
             else
             {
                 var userCompany = _mapper.Map<UserCompany>(userCompanyDto);
-                userCompany.UpDataBy = ITCode;
+                userCompany.UpDataBy = NickName;
                 userCompany.UpDataTime = DateTime.Now;
-                userCompany.CreateBy = ITCode;
+                userCompany.CreateBy = NickName;
                 userCompany.CreateTime = DateTime.Now;
                 userCompany.UserId = userid;
                 res = await userCompanyRes.InsertAsync(userCompany);
@@ -191,12 +260,25 @@
             var user = await userRes.GetByIdAsync(userid);
             userDto = _mapper.Map<UserDto>(user);
 
+            //var userWorker = await userWorkerRes.GetFirstAsync(p => p.UserId == userid);
+            //userDto.userWorker = _mapper.Map<UserWorkerDto>(userWorker);
+
+            //var userCompany = await userCompanyRes.GetFirstAsync(p => p.UserId == userid);
+            //userDto.userCompany = _mapper.Map<UserCompanyDto>(userCompany);
+
+
             var userWorker = await userWorkerRes.GetFirstAsync(p => p.UserId == userid);
-            userDto.userWorker = _mapper.Map<UserWorkerDto>(userWorker);
+            if (userWorker != null)
+            {
+                userDto.userWorker = _mapper.Map<UserWorkerDto>(userWorker);
+            }
+
 
             var userCompany = await userCompanyRes.GetFirstAsync(p => p.UserId == userid);
-            userDto.userCompany = _mapper.Map<UserCompanyDto>(userCompany);
-
+            if (userCompany != null)
+            {
+                userDto.userCompany = _mapper.Map<UserCompanyDto>(userCompany);
+            }
 
 
             return userDto;
diff --git a/cylsg/cylsg.Model/UserModel/UserCompany.cs b/cylsg/cylsg.Model/UserModel/UserCompany.cs
index bc4b662..d90773c 100644
--- a/cylsg/cylsg.Model/UserModel/UserCompany.cs
+++ b/cylsg/cylsg.Model/UserModel/UserCompany.cs
@@ -8,6 +8,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata;
 
 namespace cylsg.Model.UserModel
 {
@@ -47,8 +48,8 @@
         /// <summary>
         /// 娉ㄥ唽鏃堕棿
         /// </summary>
-        [SugarColumn(ColumnDescription = "娉ㄥ唽鏃堕棿", IsNullable = true)]
-        public DateTime? Regtime { get; set; }
+        [SugarColumn(ColumnDescription = "娉ㄥ唽鏃堕棿", ColumnDataType = "nvarchar(50)", IsNullable = true)]
+        public string Regtime { get; set; }
 
         /// <summary>
         /// 鑱旂郴鍦板潃

--
Gitblit v1.9.1