Эх сурвалжийг харах

Merge branch 'feature-dgy-添加订单触发返现' into DuGuYang

DuGuYang 1 жил өмнө
parent
commit
07758fb1c5

+ 43 - 6
Areas/Api/Controllers/v1/Main1/ConsumerOrdersController.cs

@@ -138,7 +138,9 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 curData.Add("PayMode", subdata["PayMode"].ToString()); //交易平台(1 支付宝 2 微信)
                 curData.Add("OrderNo", subdata["OrderNo"].ToString()); //交易号
                 curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //交易时间
-                curData.Add("MaxDivi", ConsumerProfitService.Sum(" 1=1 and OrderId=" + subdata["Id"].ToString() + "","GetMoney").ToString("f2")); //分账金额
+                curData.Add("MaxDivi", ConsumerProfitService.Sum(" 1=1 and OrderId=" + subdata["Id"].ToString() + "", "GetMoney").ToString("f2")); //分账金额
+                curData.Add("MaxDiviAmount", decimal.Parse(subdata["MaxDivi"].ToString())); //最大返现金额
+                curData.Add("CurDiviAmount", decimal.Parse(subdata["CurDivi"].ToString())); //已返现金额
                 if (query.SubjectType == "SUBJECT_TYPE_ENTERPRISE") subjectType = 1; //企业公司
                 if (query.SubjectType == "SUBJECT_TYPE_INDIVIDUAL") subjectType = 2; //个体工商户
                 curData.Add("SubjectType", subjectType); //主体类型(1 企业 2 个体)
@@ -173,7 +175,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
 
 
 
-        #region 交易查询-直连订单发起分红
+        #region 交易查询-直连订单发起返现
         [Authorize]
         public JsonResult DirectQueryDivideAccounts(string value)
         {
@@ -185,8 +187,43 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         private AppResultJson DirectQueryDivideAccountsDo(string value)
         {
             JsonData data = JsonMapper.ToObject(value);
-            string Id = data["Id"].ToString(); //订单Id
-            return new AppResultJson() { Status = "1", Info = "成功" };
+            int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //订单Id
+            var order = ConsumerOrdersService.Query(Id);
+            if (order.Id > 0 && order.DivideFlag == 2)
+            {
+                var check = ConsumerProfitService.Query(" and OrderId=" + Id + "");
+                if (check.Id > 0)
+                {
+                    return new AppResultJson() { Status = "-1", Info = "操作失败,该订单已存在返现记录" };
+                }
+                else
+                {
+                    var query = ConsumerOrdersService.Query(Id);
+                    List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrders:Divi:" + query.PayMode + ":" + query.MerchantId);
+                    if (suborders.Count > 0)
+                    {
+                        var suborder = suborders.FirstOrDefault(m => m.Id == Id);
+                        if (suborder == null)
+                        {
+                            RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + query.PayMode + ":List", Id);
+                            return new AppResultJson() { Status = "1", Info = "成功" };
+                        }
+                        else
+                        {
+                            return new AppResultJson() { Status = "-1", Info = "操作失败,该订单已存在返现队列中" };
+                        }
+                    }
+                    else
+                    {
+                        RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + query.PayMode + ":List", Id);
+                        return new AppResultJson() { Status = "1", Info = "成功" };
+                    }
+                }
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = "操作失败,该订单未分账" };
+            }
         }
         #endregion
 
@@ -238,11 +275,11 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             ConsumerOrders query = new ConsumerOrders();
             int id = int.Parse(function.CheckInt(data["id"].ToString()));
             query = ConsumerOrdersService.Query(id);
-            if(query.PayMode == 2)
+            if (query.PayMode == 2)
             {
                 RedisDbconn.Instance.AddList("AddWeChatDiviQueue", id.ToString());
             }
-            else if(query.PayMode == 1)
+            else if (query.PayMode == 1)
             {
                 RedisDbconn.Instance.AddList("AddAlipayDiviQueue", id.ToString());
             }

+ 43 - 0
Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs

@@ -315,6 +315,49 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
             #endregion
         }
 
+        #region 商户管理-直连修改商户微信或支付宝签约状态为成功
+        [Authorize]
+        public JsonResult DirectEditAlipayOrWeChatStatus(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            AppResultJson result = DirectEditAlipayOrWeChatStatusDo(value);
+            return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
+        }
+        private AppResultJson DirectEditAlipayOrWeChatStatusDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int MerchantId = int.Parse(function.CheckInt(data["MerchantId"].ToString())); //商户Id
+            int Kind = int.Parse(function.CheckInt(data["Kind"].ToString())); //类型(0 所有 1 支付宝 2 微信)
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            var query = main1db.MerchantAddInfo.FirstOrDefault(m => m.Id == MerchantId) ?? new MerchantAddInfo();
+            var querys = main1db.MerchantInfo.FirstOrDefault(m => m.Id == MerchantId) ?? new MerchantInfo();
+            Dictionary<string, object> fields = new Dictionary<string, object>();
+            if (Kind == 0)
+            {
+                query.QueryCount = 2;
+                query.Status = 2;
+
+                querys.QueryCount = 2;
+                querys.Status = 2;
+            }
+            if (Kind == 1)
+            {
+                query.QueryCount = 2;
+
+                querys.QueryCount = 2;
+            }
+            if (Kind == 2)
+            {
+                query.Status = 2;
+
+                querys.Status = 2;
+            }
+            main1db.SaveChanges();
+            return new AppResultJson() { Status = "1", Info = "修改成功", Data = Obj };
+        }
+        #endregion
+
 
         #region 商户管理-直连添加支付宝PID和微信商户号
         [Authorize]

+ 40 - 3
Areas/Api/Controllers/v1/Main2/ConsumerOrdersController.cs

@@ -140,6 +140,8 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 curData.Add("OrderNo", subdata["OrderNo"].ToString()); //交易号
                 curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //交易时间
                 curData.Add("MaxDivi", ConsumerProfitService.Sum(" 1=1 and OrderId=" + subdata["Id"].ToString() + "", "GetMoney").ToString("f2")); //分账金额
+                curData.Add("MaxDiviAmount", decimal.Parse(subdata["MaxDivi"].ToString())); //最大返现金额
+                curData.Add("CurDiviAmount", decimal.Parse(subdata["CurDivi"].ToString())); //已返现金额
                 if (query.SubjectType == "SUBJECT_TYPE_ENTERPRISE") subjectType = 1; //企业公司
                 if (query.SubjectType == "SUBJECT_TYPE_INDIVIDUAL") subjectType = 2; //个体工商户
                 if (query.SubjectType == "SUBJECT_TYPE_SMALL") subjectType = 3; //小微
@@ -170,7 +172,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         #endregion
 
 
-        #region 交易查询-银联订单发起分红
+        #region 交易查询-银联订单发起返现
         [Authorize]
         public JsonResult UnionPayQueryDivideAccounts(string value)
         {
@@ -182,8 +184,43 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         private AppResultJson UnionPayQueryDivideAccountsDo(string value)
         {
             JsonData data = JsonMapper.ToObject(value);
-            string Id = data["Id"].ToString(); //订单Id
-            return new AppResultJson() { Status = "1", Info = "成功" };
+            int Id = int.Parse(function.CheckInt(data["Id"].ToString())); //订单Id
+            var order = ConsumerOrdersService.Query(Id);
+            if (order.Id > 0 && order.DivideFlag >= 1)
+            {
+                var check = ConsumerProfitService.Query(" and OrderId=" + Id + "");
+                if (check.Id > 0)
+                {
+                    return new AppResultJson() { Status = "-1", Info = "操作失败,该订单已存在返现记录" };
+                }
+                else
+                {
+                    var query = ConsumerOrdersService.Query(Id);
+                    List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + query.PayMode + ":" + query.MerchantId);
+                    if (suborders.Count > 0)
+                    {
+                        var suborder = suborders.FirstOrDefault(m => m.Id == Id);
+                        if (suborder == null)
+                        {
+                            RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + query.PayMode + ":List", Id);
+                            return new AppResultJson() { Status = "1", Info = "成功" };
+                        }
+                        else
+                        {
+                            return new AppResultJson() { Status = "-1", Info = "操作失败,该订单已存在返现队列中" };
+                        }
+                    }
+                    else
+                    {
+                        RedisDbconn.Instance.AddList("ConsumerOrdersHd:Divi:" + query.PayMode + ":List", Id);
+                        return new AppResultJson() { Status = "1", Info = "成功" };
+                    }
+                }
+            }
+            else
+            {
+                return new AppResultJson() { Status = "-1", Info = "操作失败,该订单未分账" };
+            }
         }
         #endregion
 

+ 3 - 3
Models/Main1/ConsumerOrders.cs

@@ -30,10 +30,10 @@ namespace MySystem.Models.Main1
         public int UserId { get; set; }
         public decimal MerchantActualAmount { get; set; }
         public string DivideLog { get; set; }
-        public int DivideFlag { get; set; }
-        public DateTime? DivideDate { get; set; }
         public string TradePayNo { get; set; }
         public int SetRecordId { get; set; }
-
+        public int DivideFlag { get; set; }
+        public DateTime? DivideDate { get; set; }
+        public ulong ReturnFlag { get; set; }
     }
 }

+ 7 - 0
Models/Main1/MerchantInfo.cs

@@ -48,5 +48,12 @@ namespace MySystem.Models.Main1
         public int IsAct { get; set; }
         public int ExamineStatus { get; set; }
         public int Months { get; set; }
+        public DateTime? EndTime { get; set; }
+        public DateTime? StartTime { get; set; }
+        public string BusinessHours { get; set; }
+        public string BriefIntroduction { get; set; }
+        public int Popularity { get; set; }
+        public decimal Latitude { get; set; }
+        public decimal Longitude { get; set; }
     }
 }

+ 37 - 0
Models/Main1/WebCMSEntities.cs

@@ -2298,6 +2298,11 @@ namespace MySystem.Models.Main1
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
+                entity.Property(e => e.ReturnFlag)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'")
+                    .HasComment("返现队列标记");
+
                 entity.Property(e => e.ReturnMoney).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.SeoDescription)
@@ -6865,6 +6870,18 @@ namespace MySystem.Models.Main1
 
                 entity.Property(e => e.BindStatus).HasColumnType("int(11)");
 
+                entity.Property(e => e.BriefIntroduction)
+                    .HasColumnType("longtext")
+                    .HasComment("简介")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.BusinessHours)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("营业时间段")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.CreateDate).HasColumnType("datetime");
 
                 entity.Property(e => e.CreateMan)
@@ -6872,6 +6889,10 @@ namespace MySystem.Models.Main1
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.EndTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业结束时间");
+
                 entity.Property(e => e.ExamineStatus)
                     .HasColumnType("int(11)")
                     .HasComment("服务费考核状态");
@@ -6888,6 +6909,10 @@ namespace MySystem.Models.Main1
 
                 entity.Property(e => e.LastConsumeDate).HasColumnType("datetime");
 
+                entity.Property(e => e.Latitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("纬度");
+
                 entity.Property(e => e.LoginPwd)
                     .HasColumnType("varchar(32)")
                     .HasCharSet("utf8")
@@ -6898,6 +6923,10 @@ namespace MySystem.Models.Main1
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Longitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("经度");
+
                 entity.Property(e => e.Mobile)
                     .HasColumnType("varchar(11)")
                     .HasCharSet("utf8")
@@ -6917,6 +6946,10 @@ namespace MySystem.Models.Main1
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Popularity)
+                    .HasColumnType("int(11)")
+                    .HasComment("人气值");
+
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
                 entity.Property(e => e.SeoDescription)
@@ -6940,6 +6973,10 @@ namespace MySystem.Models.Main1
 
                 entity.Property(e => e.Sort).HasColumnType("int(11)");
 
+                entity.Property(e => e.StartTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业开始时间");
+
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
                 entity.Property(e => e.TotalActActual).HasColumnType("decimal(18,2)");

+ 2 - 0
Models/Main2/ConsumerOrders.cs

@@ -34,5 +34,7 @@ namespace MySystem.Models.Main2
         public string DivideLog { get; set; }
         public string TradePayNo { get; set; }
         public int SetRecordId { get; set; }
+        public int SettleAmount { get; set; }
+        public ulong ReturnFlag { get; set; }
     }
 }

+ 8 - 1
Models/Main2/MerchantInfo.cs

@@ -45,8 +45,15 @@ namespace MySystem.Models.Main2
         public decimal AllocationAmount { get; set; }
         public decimal ActMaxAmount { get; set; }
         public decimal ActCurrentAmount { get; set; }
-        public int IsAct { get; set; }
         public int ExamineStatus { get; set; }
         public int Months { get; set; }
+        public int IsAct { get; set; }
+        public DateTime? EndTime { get; set; }
+        public DateTime? StartTime { get; set; }
+        public string BusinessHours { get; set; }
+        public string BriefIntroduction { get; set; }
+        public int Popularity { get; set; }
+        public decimal Latitude { get; set; }
+        public decimal Longitude { get; set; }
     }
 }

+ 41 - 0
Models/Main2/WebCMSEntities.cs

@@ -2295,6 +2295,11 @@ namespace MySystem.Models.Main2
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
+                entity.Property(e => e.ReturnFlag)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'")
+                    .HasComment("返现队列标记");
+
                 entity.Property(e => e.ReturnMoney).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.SeoDescription)
@@ -2316,6 +2321,10 @@ namespace MySystem.Models.Main2
                     .HasColumnType("int(11)")
                     .HasComment("活动记录Id");
 
+                entity.Property(e => e.SettleAmount)
+                    .HasColumnType("int(11)")
+                    .HasComment("结算金额");
+
                 entity.Property(e => e.SnNo)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
@@ -6757,6 +6766,18 @@ namespace MySystem.Models.Main2
 
                 entity.Property(e => e.BindStatus).HasColumnType("int(11)");
 
+                entity.Property(e => e.BriefIntroduction)
+                    .HasColumnType("longtext")
+                    .HasComment("简介")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.BusinessHours)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("营业时间段")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.CreateDate).HasColumnType("datetime");
 
                 entity.Property(e => e.CreateMan)
@@ -6764,6 +6785,10 @@ namespace MySystem.Models.Main2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.EndTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业结束时间");
+
                 entity.Property(e => e.ExamineStatus)
                     .HasColumnType("int(11)")
                     .HasComment("服务费考核状态");
@@ -6780,6 +6805,10 @@ namespace MySystem.Models.Main2
 
                 entity.Property(e => e.LastConsumeDate).HasColumnType("datetime");
 
+                entity.Property(e => e.Latitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("纬度");
+
                 entity.Property(e => e.LoginPwd)
                     .HasColumnType("varchar(32)")
                     .HasCharSet("utf8")
@@ -6790,6 +6819,10 @@ namespace MySystem.Models.Main2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Longitude)
+                    .HasColumnType("decimal(18,8)")
+                    .HasComment("经度");
+
                 entity.Property(e => e.Mobile)
                     .HasColumnType("varchar(11)")
                     .HasCharSet("utf8")
@@ -6809,6 +6842,10 @@ namespace MySystem.Models.Main2
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.Popularity)
+                    .HasColumnType("int(11)")
+                    .HasComment("人气值");
+
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
                 entity.Property(e => e.SeoDescription)
@@ -6832,6 +6869,10 @@ namespace MySystem.Models.Main2
 
                 entity.Property(e => e.Sort).HasColumnType("int(11)");
 
+                entity.Property(e => e.StartTime)
+                    .HasColumnType("datetime")
+                    .HasComment("营业开始时间");
+
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
                 entity.Property(e => e.TotalActActual).HasColumnType("decimal(18,2)");

+ 5 - 0
Util/RedisDbconn.cs

@@ -93,6 +93,11 @@ namespace MySystem
             return RedisHelper.LPush(key, value);
             // return 0;
         }
+        public long AddRightList(string key, object value)
+        {
+            return RedisHelper.RPush(key, value);
+            // return 0;
+        }
         public T RPop<T>(string key)
         {
             return RedisHelper.RPop<T>(key);