From 5856a6e5de198436bc112923609db21c9a45fd10 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 01 七月 2025 15:58:42 +0800
Subject: [PATCH] 增加公司收藏工人的功能

---
 cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs          |   23 +++++++++++
 cylsg/cylsg.Model/OrderModel/OrderBidding.cs             |    6 +++
 cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs |   47 +++++++++++++++++++++++
 cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs  |    2 
 4 files changed, 77 insertions(+), 1 deletions(-)

diff --git a/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs b/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs
index 9ac7c36..493176e 100644
--- a/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs
+++ b/cylsg/cylsg.Application/Orders/Dtos/OrderDto.cs
@@ -353,6 +353,12 @@
         public decimal? WorkPrice { get; set; }
 
         /// <summary>
+        /// 鏄惁鏀惰棌
+        /// </summary>
+        public bool? IsCollect { get; set; }
+
+
+        /// <summary>
         /// 鍘嗗彶宸ヤ环
         /// </summary>
         public List<OrderBiddingWorkPrice> orderBiddingWorkPrices { get; set; }
@@ -391,6 +397,23 @@
     }
 
 
+    public class ShoucangDto
+    {
+
+        /// <summary>
+        /// 鎷涘伐鏄庣粏OrderBiddingId
+        /// </summary>
+        public int OrderBiddingId { get; set; }
+
+
+        /// <summary>
+        /// 鏄惁鏀惰棌
+        /// </summary>
+        public bool IsCollect { get; set; }
+
+    }
+
+
     public class WorkPriceDto
     {
 
diff --git a/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs b/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs
index 843f03c..72105d6 100644
--- a/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs
+++ b/cylsg/cylsg.Application/Orders/OrderCompanyAppService.cs
@@ -337,6 +337,53 @@
 
 
 
+        /// <summary>
+        /// 鍏徃鏀惰棌宸ヤ汉
+        /// </summary>
+        /// <returns></returns>
+        [Authorize]
+        [HttpPost]
+        public async Task<bool> ShoucangGongren(ShoucangDto shoucangDto)
+        {
+
+            var UserID = App.User?.FindFirstValue("UserID");
+            int userid = 0;
+            string NickName = App.User?.FindFirstValue("NickName");
+            if (!string.IsNullOrEmpty(UserID))
+            {
+                userid = int.Parse(UserID);
+            }
+
+            var orderBiddingRes = new BaseRepository<OrderBidding>();
+
+            var orderBidding = await orderBiddingRes.GetByIdAsync(shoucangDto.OrderBiddingId);
+            if (orderBidding == null || orderBidding.IsEn != true || orderBidding.IsDeleted == true)
+            {
+                throw Oops.Oh("璇ユ姇閫掑凡缁忔棤鏁堬紒");
+            } 
+
+          
+
+
+
+            bool res;
+
+            orderBidding.IsCollect = shoucangDto.IsCollect;
+        
+            orderBidding.UpDataBy = NickName;
+            orderBidding.UpDataTime = DateTime.Now;
+
+
+            res = await orderBiddingRes.UpdateAsync(orderBidding);
+
+            
+
+            return res;
+        }
+
+
+
+
 
         /// <summary>
         /// 鍏徃淇敼宸ヤ汉宸ヤ环
diff --git a/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs b/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs
index d1a91ae..3c79614 100644
--- a/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs
+++ b/cylsg/cylsg.Application/Orders/OrderWorkerAppService.cs
@@ -314,7 +314,7 @@
                 }
             }
 
-            orderBiddings = orderBiddings.Where(x => (x.IsSelected == null || x.IsSelected != false)).OrderBy(x=>x.IsSelected).ToList();
+            orderBiddings = orderBiddings.Where(x => (x.IsSelected == null || x.IsSelected != false)).OrderBy(x=>x.IsSelected).ThenByDescending(x=>x.IsCollect).ToList();
             var orderBiddingDtos = _mapper.Map<List<OrderBiddingDto>>(orderBiddings);
             if(orderBiddingDtos != null&& orderBiddingDtos.Count > 0)
             {
diff --git a/cylsg/cylsg.Model/OrderModel/OrderBidding.cs b/cylsg/cylsg.Model/OrderModel/OrderBidding.cs
index 39ef9c3..05fbeca 100644
--- a/cylsg/cylsg.Model/OrderModel/OrderBidding.cs
+++ b/cylsg/cylsg.Model/OrderModel/OrderBidding.cs
@@ -59,5 +59,11 @@
         /// </summary>
         [SugarColumn(ColumnDescription = "宸ヨ祫鎬婚", Length = 18, DecimalDigits = 2, IsNullable = true)]
         public decimal? Salary { get; set; }
+
+        /// <summary>
+        /// 鏄惁鏀惰棌
+        /// </summary>
+        [SugarColumn(ColumnDescription = "鏄惁鏀惰棌", IsNullable = true)]
+        public bool? IsCollect { get; set; }
     }
 }

--
Gitblit v1.9.1