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

Merge branch 'feature-dgy-导入改为队列操作' into feature-dgy-后台测试

DuGuYang 2 жил өмнө
parent
commit
9de15f767c
23 өөрчлөгдсөн 1351 нэмэгдсэн , 201 устгасан
  1. 373 0
      AppStart/Helper/ImportHelper/BatchEditUserAmountService.cs
  2. 127 0
      AppStart/Helper/ImportHelper/PreWithdrawalResultsService.cs
  3. 127 0
      AppStart/Helper/ImportHelper/StoreHouseWithdrawalResultsService.cs
  4. 70 3
      Areas/Admin/Controllers/MainServer/PreAmountRecordController.cs
  5. 70 3
      Areas/Admin/Controllers/MainServer/StoreHouseAmountRecordController.cs
  6. 7 52
      Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs
  7. 8 1
      Areas/Admin/Controllers/MainServer/ToChargeBackRecordController.cs
  8. 6 3
      Areas/Admin/Controllers/MainServer/ToChargeBackRecordSubController.cs
  9. 4 1
      Areas/Admin/Controllers/MainServer/ToChargeByStageController.cs
  10. 68 0
      Areas/Admin/Controllers/MainServer/UsersController.cs
  11. 12 52
      Areas/Admin/Controllers/OperateServer/StoreMachineApplyOperateController.cs
  12. 12 52
      Areas/Admin/Controllers/OperateServer/StoreMachineApplysOperateController.cs
  13. 70 0
      Areas/Admin/Controllers/OperateServer/SysAdminOperateController.cs
  14. 2 1
      Areas/Admin/Views/MainServer/PreAmountRecord/Indexs.cshtml
  15. 2 1
      Areas/Admin/Views/MainServer/StoreHouseAmountRecord/Indexs.cshtml
  16. 144 0
      Areas/Admin/Views/MainServer/Users/ImportByQueue.cshtml
  17. 2 1
      Areas/Admin/Views/MainServer/Users/Index.cshtml
  18. 21 20
      Startup.cs
  19. 57 1
      wwwroot/layuiadmin/modules_main/PreCardAmountRecord_Admin.js
  20. 57 1
      wwwroot/layuiadmin/modules_main/StoreHouseCardAmountRecord_Admin.js
  21. 1 0
      wwwroot/layuiadmin/modules_main/ToChargeBackRecord_Admin.js
  22. 111 9
      wwwroot/layuiadmin/modules_main/Users_Admin.js
  23. BIN
      wwwroot/users/批量修改提现结算金额模版.xlsx

+ 373 - 0
AppStart/Helper/ImportHelper/BatchEditUserAmountService.cs

@@ -0,0 +1,373 @@
+using System;
+using System.Threading;
+using System.Linq;
+using System.Data;
+using Library;
+using MySystem.Models;
+using System.Collections.Generic;
+
+/// <summary>
+/// 创客信息相关数据导入
+/// </summary>
+namespace MySystem
+{
+    public class BatchEditUserAmountService
+    {
+        public readonly static BatchEditUserAmountService Instance = new BatchEditUserAmountService();
+        private BatchEditUserAmountService()
+        {
+        }
+
+        public void Start()//启动
+        {
+            Thread thread = new Thread(ImportPostDo);
+            thread.IsBackground = true;
+            thread.Start();
+        }
+
+        public void ImportPostDo()
+        {
+            while (true)
+            {
+                try
+                {
+                    string data = RedisDbconn.Instance.RPop<string>("BatchEditUserAmountQueue");
+                    if (!string.IsNullOrEmpty(data))
+                    {
+                        string[] dataList = data.Split("#cut#");
+                        string _ExcelPath = dataList[0];
+                        string _Kind = dataList[1];
+                        string checkKey = dataList[2];
+                        string Operator = dataList[3]; // 操作人
+                        int SuccessCount = 0;
+                        int DoCount = 0;
+                        string FullExcelPath = function.getPath(_ExcelPath);
+                        FullExcelPath = FullExcelPath.Replace("//", "/");
+                        DataTable list = new PublicFunction().ExcelToDataTable(FullExcelPath);
+                        int TotalCount = list.Rows.Count;
+                        while (DoCount < list.Rows.Count)
+                        {
+                            WebCMSEntities db = new WebCMSEntities();
+                            //导入结算金额
+                            if (_Kind == "1")
+                            {
+                                var tran = db.Database.BeginTransaction();
+                                try
+                                {
+                                    int Size = 100;
+                                    if (list.Rows.Count - DoCount < 100)
+                                    {
+                                        Size = list.Rows.Count - DoCount;
+                                    }
+                                    Dictionary<string, int> storeData = new Dictionary<string, int>();
+                                    for (int i = DoCount; i < DoCount + Size; i++)
+                                    {
+                                        DataRow dr = list.Rows[i];
+                                        string MakerCode = dr[0].ToString(); //创客编号
+                                        string SettleAmount = dr[2].ToString(); //提现结算金额(元)
+                                        UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+                                        if (UserCode.UserId > 0)
+                                        {
+                                            var user = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId) ?? new Users();
+                                            if (user.Id > 0)
+                                            {
+                                                user.SettleAmount = decimal.Parse(function.CheckInt(SettleAmount));
+                                            }
+                                            else
+                                            {
+                                                RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "创客信息");
+                                            }
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "编号关联信息");
+                                        }
+                                    }
+                                    DoCount += Size;
+                                    db.SaveChanges();
+                                    tran.Commit();
+                                    if (DoCount >= list.Rows.Count)
+                                    {
+                                        RedisDbconn.Instance.Set("BatchEditUserAmountCheckImport:" + checkKey, "success|" + SuccessCount);
+                                        RedisDbconn.Instance.SetExpire("BatchEditUserAmountCheckImport:" + checkKey, 60000);
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    DoCount = list.Rows.Count;
+                                    function.WriteLog(ex.ToString(), "导入结算金额");
+                                    tran.Rollback();
+                                    ErrorMsg msg = new ErrorMsg()
+                                    {
+                                        Time = DateTime.Now,
+                                        ErrorContent = ex.ToString(),
+                                    };
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入结算金额Excel文件异常");
+                                }
+                                tran.Dispose();
+                            }
+                            //导入冻结金额
+                            if (_Kind == "2")
+                            {
+                                var tran = db.Database.BeginTransaction();
+                                try
+                                {
+                                    int Size = 100;
+                                    if (list.Rows.Count - DoCount < 100)
+                                    {
+                                        Size = list.Rows.Count - DoCount;
+                                    }
+                                    Dictionary<string, int> storeData = new Dictionary<string, int>();
+                                    for (int i = DoCount; i < DoCount + Size; i++)
+                                    {
+                                        DataRow dr = list.Rows[i];
+                                        string MakerCode = dr[0].ToString(); //创客编号
+                                        string CashFreezeAmt = dr[2].ToString(); //提现结算金额(元)
+                                        UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+                                        if (UserCode.UserId > 0)
+                                        {
+                                            var user = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId) ?? new Users();
+                                            if (user.Id > 0)
+                                            {
+                                                user.CashFreezeAmt = decimal.Parse(function.CheckInt(CashFreezeAmt));
+                                            }
+                                            else
+                                            {
+                                                RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "创客信息");
+                                            }
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "编号关联信息");
+                                        }
+                                    }
+                                    DoCount += Size;
+                                    db.SaveChanges();
+                                    tran.Commit();
+                                    if (DoCount >= list.Rows.Count)
+                                    {
+                                        RedisDbconn.Instance.Set("BatchEditUserAmountCheckImport:" + checkKey, "success|" + SuccessCount);
+                                        RedisDbconn.Instance.SetExpire("BatchEditUserAmountCheckImport:" + checkKey, 60000);
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    DoCount = list.Rows.Count;
+                                    function.WriteLog(ex.ToString(), "导入冻结金额");
+                                    tran.Rollback();
+                                    ErrorMsg msg = new ErrorMsg()
+                                    {
+                                        Time = DateTime.Now,
+                                        ErrorContent = ex.ToString(),
+                                    };
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入冻结金额Excel文件异常");
+                                }
+                                tran.Dispose();
+                            }
+                            //导入风控数据
+                            if (_Kind == "3")
+                            {
+                                var tran = db.Database.BeginTransaction();
+                                try
+                                {
+                                    int Size = 100;
+                                    if (list.Rows.Count - DoCount < 100)
+                                    {
+                                        Size = list.Rows.Count - DoCount;
+                                    }
+                                    Dictionary<string, int> storeData = new Dictionary<string, int>();
+                                    for (int i = DoCount; i < DoCount + Size; i++)
+                                    {
+                                        DataRow dr = list.Rows[i];
+                                        string MakerCode = dr[0].ToString(); //创客编号
+                                        string RiskFlag = dr[2].ToString(); //风控标记(0 否 1 是)
+                                        string RiskNote = dr[3].ToString(); //风控备注
+                                        UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+                                        if (UserCode.UserId > 0)
+                                        {
+                                            var user = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId) ?? new Users();
+                                            if (user.Id > 0)
+                                            {
+                                                user.RiskFlag = ulong.Parse(function.CheckInt(RiskFlag));
+                                                user.RiskRemark = RiskNote;
+                                            }
+                                            else
+                                            {
+                                                RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "创客信息");
+                                            }
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "编号关联信息");
+                                        }
+                                    }
+                                    DoCount += Size;
+                                    db.SaveChanges();
+                                    tran.Commit();
+                                    if (DoCount >= list.Rows.Count)
+                                    {
+                                        RedisDbconn.Instance.Set("BatchEditUserAmountCheckImport:" + checkKey, "success|" + SuccessCount);
+                                        RedisDbconn.Instance.SetExpire("BatchEditUserAmountCheckImport:" + checkKey, 60000);
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    DoCount = list.Rows.Count;
+                                    function.WriteLog(ex.ToString(), "导入风控数据");
+                                    tran.Rollback();
+                                    ErrorMsg msg = new ErrorMsg()
+                                    {
+                                        Time = DateTime.Now,
+                                        ErrorContent = ex.ToString(),
+                                    };
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入风控数据Excel文件异常");
+                                }
+                                tran.Dispose();
+                            }
+                            //批量修改账户金额
+                            if (_Kind == "4")
+                            {
+                                var tran = db.Database.BeginTransaction();
+                                try
+                                {
+                                    int Size = 100;
+                                    if (list.Rows.Count - DoCount < 100)
+                                    {
+                                        Size = list.Rows.Count - DoCount;
+                                    }
+                                    Dictionary<string, int> storeData = new Dictionary<string, int>();
+                                    for (int i = DoCount; i < DoCount + Size; i++)
+                                    {
+                                        DataRow dr = list.Rows[i];
+                                        string MakerCode = dr[0].ToString(); //创客编号
+                                        string RealName = dr[1].ToString(); //创客姓名
+                                        string OperationAmt = dr[2].ToString();//操作金额
+                                        string OperationType = dr[3].ToString();//操作类型(1-冻结 2-解冻 3-扣减 4-增加)
+                                        UserForMakerCode UserCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+                                        if (UserCode.UserId > 0)
+                                        {
+                                            var user = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId && m.RealName == RealName) ?? new Users();
+                                            if (user.Id > 0)
+                                            {
+                                                UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == user.Id) ?? new UserAccount();
+                                                if (account.Id > 0)
+                                                {
+                                                    decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
+                                                    decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
+                                                    decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
+                                                    int ChangeType = 0;
+                                                    if (OperationType == "1" && Convert.ToDecimal(OperationAmt) <= account.BalanceAmount)
+                                                    {
+                                                        account.BalanceAmount -= Convert.ToDecimal(OperationAmt);
+                                                        account.FreezeAmount += Convert.ToDecimal(OperationAmt);
+                                                        ChangeType = 61;
+                                                    }
+                                                    else if (OperationType == "1" && Convert.ToDecimal(OperationAmt) > account.BalanceAmount)
+                                                    {
+                                                        RedisDbconn.Instance.AddList("ErrList" + checkKey, "以下操作失败" + user.MakerCode + ',' + user.RealName + "冻结金额大于余额");
+                                                    }
+                                                    else if (OperationType == "2" && Convert.ToDecimal(OperationAmt) <= account.FreezeAmount)
+                                                    {
+                                                        account.BalanceAmount += Convert.ToDecimal(OperationAmt);
+                                                        account.FreezeAmount -= Convert.ToDecimal(OperationAmt);
+                                                        ChangeType = 62;
+                                                    }
+                                                    else if (OperationType == "2" && Convert.ToDecimal(OperationAmt) > account.FreezeAmount)
+                                                    {
+                                                        RedisDbconn.Instance.AddList("ErrList" + checkKey, "以下操作失败" + user.MakerCode + ',' + user.RealName + "解冻金额大于冻结金额");
+                                                    }
+                                                    else if (OperationType == "3" && Convert.ToDecimal(OperationAmt) <= account.BalanceAmount)
+                                                    {
+                                                        account.TotalAmount -= Convert.ToDecimal(OperationAmt);
+                                                        account.BalanceAmount -= Convert.ToDecimal(OperationAmt);
+                                                        ChangeType = 63;
+                                                    }
+                                                    else if (OperationType == "3" && Convert.ToDecimal(OperationAmt) > account.BalanceAmount)
+                                                    {
+                                                        RedisDbconn.Instance.AddList("ErrList" + checkKey, "以下操作失败" + user.MakerCode + ',' + user.RealName + "扣减金额大于余额");
+                                                    }
+                                                    else if (OperationType == "4")
+                                                    {
+                                                        account.TotalAmount += Convert.ToDecimal(OperationAmt);
+                                                        account.BalanceAmount += Convert.ToDecimal(OperationAmt);
+                                                        ChangeType = 64;
+                                                    }
+                                                    decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
+                                                    decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
+                                                    decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
+                                                    UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
+                                                    {
+                                                        CreateDate = DateTime.Now,
+                                                        UpdateDate = DateTime.Now,
+                                                        UserId = user.Id, //创客
+                                                        ChangeType = ChangeType, //变动类型
+                                                        ChangeAmount = Convert.ToDecimal(OperationAmt), //变更金额
+                                                        BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
+                                                        AfterTotalAmount = AfterTotalAmount, //变更后总金额
+                                                        BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
+                                                        AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
+                                                        BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
+                                                        AfterBalanceAmount = AfterBalanceAmount, //变更后余额
+                                                        Remark = dr[4].ToString(),
+                                                    }).Entity;
+                                                    db.SaveChanges();
+                                                    function.WriteLog(DateTime.Now.ToString() + "\n" + user.Id.ToString(), "批量修改账户金额");
+                                                }
+                                                else
+                                                {
+                                                    account = db.UserAccount.Add(new UserAccount()
+                                                    {
+                                                        Id = user.Id,
+                                                        UserId = user.Id,
+                                                    }).Entity;
+                                                    db.SaveChanges();
+                                                }
+                                            }
+                                            else
+                                            {
+                                                RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "创客信息");
+                                            }
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到" + MakerCode + "编号关联信息");
+                                        }
+                                    }
+                                    DoCount += Size;
+                                    db.SaveChanges();
+                                    tran.Commit();
+                                    if (DoCount >= list.Rows.Count)
+                                    {
+                                        RedisDbconn.Instance.Set("BatchEditUserAmountCheckImport:" + checkKey, "success|" + SuccessCount);
+                                        RedisDbconn.Instance.SetExpire("BatchEditUserAmountCheckImport:" + checkKey, 60000);
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    DoCount = list.Rows.Count;
+                                    function.WriteLog(ex.ToString(), "批量修改账户金额");
+                                    tran.Rollback();
+                                    ErrorMsg msg = new ErrorMsg()
+                                    {
+                                        Time = DateTime.Now,
+                                        ErrorContent = ex.ToString(),
+                                    };
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "批量修改账户金额Excel文件异常");
+                                }
+                                tran.Dispose();
+                            }
+                        }
+                    }
+                    else
+                    {
+                        Thread.Sleep(5000);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "后台导入Excel文件队列异常");
+                }
+            }
+        }
+    }
+}

+ 127 - 0
AppStart/Helper/ImportHelper/PreWithdrawalResultsService.cs

@@ -0,0 +1,127 @@
+using System;
+using System.Threading;
+using System.Linq;
+using System.Data;
+using Library;
+using MySystem.Models;
+using System.Collections.Generic;
+
+/// <summary>
+/// 小分仓临时额度提现结果导入
+/// </summary>
+namespace MySystem
+{
+    public class PreWithdrawalResultsService
+    {
+        public readonly static PreWithdrawalResultsService Instance = new PreWithdrawalResultsService();
+        private PreWithdrawalResultsService()
+        {
+        }
+
+        public void Start()//启动
+        {
+            Thread thread = new Thread(ImportPostDo);
+            thread.IsBackground = true;
+            thread.Start();
+        }
+
+        public void ImportPostDo()
+        {
+            while (true)
+            {
+                try
+                {
+                    string data = RedisDbconn.Instance.RPop<string>("PreWithdrawalResultsQueue");
+                    if (!string.IsNullOrEmpty(data))
+                    {
+                        string[] dataList = data.Split("#cut#");
+                        string _ExcelPath = dataList[0];
+                        string _Kind = dataList[1];
+                        string checkKey = dataList[2];
+                        string Operator = dataList[3]; // 操作人
+                        int SuccessCount = 0;
+                        int DoCount = 0;
+                        string FullExcelPath = function.getPath(_ExcelPath);
+                        FullExcelPath = FullExcelPath.Replace("//", "/");
+                        DataTable list = new PublicFunction().ExcelToDataTable(FullExcelPath);
+                        int TotalCount = list.Rows.Count;
+                        while (DoCount < list.Rows.Count)
+                        {
+                            WebCMSEntities db = new WebCMSEntities();
+                            //导入结算金额
+                            if (_Kind == "1")
+                            {
+                                var tran = db.Database.BeginTransaction();
+                                try
+                                {
+                                    int Size = 100;
+                                    if (list.Rows.Count - DoCount < 100)
+                                    {
+                                        Size = list.Rows.Count - DoCount;
+                                    }
+                                    Dictionary<string, int> storeData = new Dictionary<string, int>();
+                                    for (int i = DoCount; i < DoCount + Size; i++)
+                                    {
+                                        DataRow dr = list.Rows[i];
+                                        string Id = dr["A"].ToString();
+                                        string IsOk = dr["L"].ToString();
+                                        var id = int.Parse(Id);
+                                        var Info = db.PreAmountRecord.FirstOrDefault(m => m.Id == id) ?? new PreAmountRecord();
+                                        if (Info.Id > 0)
+                                        {
+                                            if (IsOk == "是") Info.Status = 1;
+                                            if (IsOk == "否")
+                                            {
+                                                Info.Status = -1;
+                                                var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == Info.UserId) ?? new UserAccount();
+                                                if (userAccount.Id > 0)
+                                                {
+                                                    userAccount.PreTempAmount += Info.UseAmount;//退还卡充值临额
+                                                    userAccount.ValidPreAmount += Info.UseAmount;//退还可用额度
+                                                }
+                                            }
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到记录为Id" + Id + "相关信息");
+                                        }
+                                    }
+                                    DoCount += Size;
+                                    db.SaveChanges();
+                                    tran.Commit();
+                                    if (DoCount >= list.Rows.Count)
+                                    {
+                                        RedisDbconn.Instance.Set("PreWithdrawalResultsCheckImport:" + checkKey, "success|" + SuccessCount);
+                                        RedisDbconn.Instance.SetExpire("PreWithdrawalResultsCheckImport:" + checkKey, 60000);
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    DoCount = list.Rows.Count;
+                                    function.WriteLog(ex.ToString(), "导入结算金额");
+                                    tran.Rollback();
+                                    ErrorMsg msg = new ErrorMsg()
+                                    {
+                                        Time = DateTime.Now,
+                                        ErrorContent = ex.ToString(),
+                                    };
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "导入结算金额Excel文件异常");
+                                }
+                                tran.Dispose();
+                            }
+
+                        }
+                    }
+                    else
+                    {
+                        Thread.Sleep(50000);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "后台导入Excel文件队列异常");
+                }
+            }
+        }
+    }
+}

+ 127 - 0
AppStart/Helper/ImportHelper/StoreHouseWithdrawalResultsService.cs

@@ -0,0 +1,127 @@
+using System;
+using System.Threading;
+using System.Linq;
+using System.Data;
+using Library;
+using MySystem.Models;
+using System.Collections.Generic;
+
+/// <summary>
+/// 分仓临时额度提现结果导入
+/// </summary>
+namespace MySystem
+{
+    public class StoreHouseWithdrawalResultsService
+    {
+        public readonly static StoreHouseWithdrawalResultsService Instance = new StoreHouseWithdrawalResultsService();
+        private StoreHouseWithdrawalResultsService()
+        {
+        }
+
+        public void Start()//启动
+        {
+            Thread thread = new Thread(ImportPostDo);
+            thread.IsBackground = true;
+            thread.Start();
+        }
+
+        public void ImportPostDo()
+        {
+            while (true)
+            {
+                try
+                {
+                    string data = RedisDbconn.Instance.RPop<string>("StoreHouseWithdrawalResultsQueue");
+                    if (!string.IsNullOrEmpty(data))
+                    {
+                        string[] dataList = data.Split("#cut#");
+                        string _ExcelPath = dataList[0];
+                        string _Kind = dataList[1];
+                        string checkKey = dataList[2];
+                        string Operator = dataList[3]; // 操作人
+                        int SuccessCount = 0;
+                        int DoCount = 0;
+                        string FullExcelPath = function.getPath(_ExcelPath);
+                        FullExcelPath = FullExcelPath.Replace("//", "/");
+                        DataTable list = new PublicFunction().ExcelToDataTable(FullExcelPath);
+                        int TotalCount = list.Rows.Count;
+                        while (DoCount < list.Rows.Count)
+                        {
+                            WebCMSEntities db = new WebCMSEntities();
+                            //导入结果
+                            if (_Kind == "1")
+                            {
+                                var tran = db.Database.BeginTransaction();
+                                try
+                                {
+                                    int Size = 100;
+                                    if (list.Rows.Count - DoCount < 100)
+                                    {
+                                        Size = list.Rows.Count - DoCount;
+                                    }
+                                    Dictionary<string, int> storeData = new Dictionary<string, int>();
+                                    for (int i = DoCount; i < DoCount + Size; i++)
+                                    {
+                                        DataRow dr = list.Rows[i];
+                                        string Id = dr["A"].ToString();
+                                        string IsOk = dr["L"].ToString();
+                                        var id = int.Parse(Id);
+                                        var Info = db.StoreHouseAmountRecord.FirstOrDefault(m => m.Id == id) ?? new StoreHouseAmountRecord();
+                                        if (Info.Id > 0)
+                                        {
+                                            if (IsOk == "是") Info.Status = 1;
+                                            if (IsOk == "否")
+                                            {
+                                                Info.Status = -1;
+                                                var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == Info.UserId) ?? new UserAccount();
+                                                if (userAccount.Id > 0)
+                                                {
+                                                    userAccount.TempAmount += Info.UseAmount;//退还卡充值临额
+                                                    userAccount.ValidAmount += Info.UseAmount;//退还可用额度
+                                                }
+                                            }
+                                        }
+                                        else
+                                        {
+                                            RedisDbconn.Instance.AddList("ErrList" + checkKey, "未找到记录为Id" + Id + "相关信息");
+                                        }
+                                    }
+                                    DoCount += Size;
+                                    db.SaveChanges();
+                                    tran.Commit();
+                                    if (DoCount >= list.Rows.Count)
+                                    {
+                                        RedisDbconn.Instance.Set("StoreHouseWithdrawalResultsCheckImport:" + checkKey, "success|" + SuccessCount);
+                                        RedisDbconn.Instance.SetExpire("StoreHouseWithdrawalResultsCheckImport:" + checkKey, 60000);
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    DoCount = list.Rows.Count;
+                                    function.WriteLog(ex.ToString(), "分仓临时额度提现结果导入");
+                                    tran.Rollback();
+                                    ErrorMsg msg = new ErrorMsg()
+                                    {
+                                        Time = DateTime.Now,
+                                        ErrorContent = ex.ToString(),
+                                    };
+                                    function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "分仓临时额度提现结果导入Excel文件异常");
+                                }
+                                tran.Dispose();
+                            }
+
+                        }
+                    }
+                    else
+                    {
+                        Thread.Sleep(50000);
+                    }
+                }
+                catch (Exception ex)
+                {
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "后台导入Excel文件队列异常");
+                }
+            }
+        }
+    }
+}

+ 70 - 3
Areas/Admin/Controllers/MainServer/PreAmountRecordController.cs

@@ -368,7 +368,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
             Ids = Ids.TrimEnd(',');
 
-            var Sql = "SELECT a.Id '记录ID',DATE_FORMAT(a.CreateDate,'%Y-%m-%d %H:%i:%s') '提现申请时间',(CASE WHEN a.Status=0 THEN '待处理' WHEN a.Status=2 THEN '处理中' WHEN a.Status=1 THEN '成功' WHEN a.Status=-1 THEN '失败' ELSE '' end) '提现结果',b.RealName '创客真实姓名',b.MakerCode '创客编号',a.UseAmount '申请提现临额',b.CertId '身份证号',b.SettleBankCardNo '银行卡号',b.SettleBankName '银行名称',b.Mobile '手机号',(CASE WHEN a.AmountType=1 THEN '临额提现' ELSE '' end) '交易类型' FROM PreAmountRecord a LEFT JOIN Users b ON a.UserId=b.Id" + condition + "";
+            var Sql = "SELECT a.Id '记录ID',DATE_FORMAT(a.CreateDate,'%Y-%m-%d %H:%i:%s') '提现申请时间',(CASE WHEN a.Status=0 THEN '待处理' WHEN a.Status=2 THEN '处理中' WHEN a.Status=1 THEN '成功' WHEN a.Status=-1 THEN '失败' ELSE '' end) '提现结果',b.RealName '创客真实姓名',b.MakerCode '创客编号',a.UseAmount '申请提现临额',b.CertId '身份证号',b.SettleBankCardNo '银行卡号',b.SettleBankName '银行名称',b.Mobile '手机号',(CASE WHEN a.AmountType=1 THEN '临额提现' ELSE '' end) '交易类型',null '是否成功(是、否)' FROM PreAmountRecord a LEFT JOIN Users b ON a.UserId=b.Id" + condition + "";
             var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
             var FileName = "小分仓临额提现提现记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
@@ -418,8 +418,8 @@ namespace MySystem.Areas.Admin.Controllers
             }
             else
             {
-                var Info = db.PreAmountRecord.Where(m => IdList.Contains(m.Id)).ToList();//成功
-                var Infos = db.PreAmountRecord.Where(m => IdLists.Contains(m.Id)).ToList();//失败
+                var Info = db.PreAmountRecord.Where(m => IdList.Contains(m.Id) && m.Status == 2).ToList();//成功
+                var Infos = db.PreAmountRecord.Where(m => IdLists.Contains(m.Id) && m.Status == 2).ToList();//失败
                 foreach (var item in Info)
                 {
                     item.Status = 1;//设置为成功
@@ -442,5 +442,72 @@ namespace MySystem.Areas.Admin.Controllers
         }
         #endregion
 
+
+        #region 通过队列导入数据
+
+        public IActionResult ImportByQueue(string right, string ExcelKind)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.ExcelKind = ExcelKind;
+            return View();
+        }
+        /// <summary>
+        /// 通过队列导入数据
+        /// </summary>
+        /// <param name="ExcelPath"></param>
+        [HttpPost]
+        public string ImportByQueuePost(string ExcelPath, int Kind = 0)
+        {
+            string key = function.MD5_16(Guid.NewGuid().ToString());
+            RedisDbconn.Instance.AddList("PreWithdrawalResultsQueue", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
+            return "success|" + key;
+        }
+        public string CheckImport(string key)
+        {
+            string result = RedisDbconn.Instance.Get<string>("PreWithdrawalResultsCheckImport:" + key);
+            if (!string.IsNullOrEmpty(result))
+            {
+                string[] datalist = result.Split('|');
+                if (datalist[0] == "success")
+                {
+                    return result;
+                }
+                return datalist[0];
+            }
+            return "0";
+        }
+        public Dictionary<string, object> CheckImportV2(string key)
+        {
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            string result = RedisDbconn.Instance.Get<string>("PreWithdrawalResultsCheckImport:" + key);
+            if (!string.IsNullOrEmpty(result))
+            {
+                string[] datalist = result.Split('|');
+                if (datalist[0] == "success")
+                {
+                    List<string> errList = RedisDbconn.Instance.GetList<string>("ErrList" + key);
+                    if (errList.Count > 0)
+                    {
+                        Obj.Add("status", 2);
+                        Obj.Add("errList", errList);
+                    }
+                    else
+                    {
+                        Obj.Add("status", 1);
+                        Obj.Add("data", result);
+                    }
+                    return Obj;
+                }
+                Obj.Add("status", 0);
+                Obj.Add("data", datalist[0]);
+                return Obj;
+            }
+            Obj.Add("status", -1);
+            Obj.Add("data", "执行中...");
+            return Obj;
+        }
+        #endregion
+
     }
 }

+ 70 - 3
Areas/Admin/Controllers/MainServer/StoreHouseAmountRecordController.cs

@@ -691,7 +691,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
             Ids = Ids.TrimEnd(',');
 
-            var Sql = "SELECT a.Id '记录ID',DATE_FORMAT(a.CreateDate,'%Y-%m-%d %H:%i:%s') '提现申请时间',(CASE WHEN a.Status=0 THEN '待处理' WHEN a.Status=2 THEN '处理中' WHEN a.Status=1 THEN '成功' WHEN a.Status=-1 THEN '失败' ELSE '' end) '提现结果',b.RealName '创客真实姓名',b.MakerCode '创客编号',a.UseAmount '申请提现临额',b.CertId '身份证号',b.SettleBankCardNo '银行卡号',b.SettleBankName '银行名称',b.Mobile '手机号',(CASE WHEN a.AmountType=1 THEN '临额提现' ELSE '' end) '交易类型' FROM StoreHouseAmountRecord a LEFT JOIN Users b ON a.UserId=b.Id" + condition + "";
+            var Sql = "SELECT a.Id '记录ID',DATE_FORMAT(a.CreateDate,'%Y-%m-%d %H:%i:%s') '提现申请时间',(CASE WHEN a.Status=0 THEN '待处理' WHEN a.Status=2 THEN '处理中' WHEN a.Status=1 THEN '成功' WHEN a.Status=-1 THEN '失败' ELSE '' end) '提现结果',b.RealName '创客真实姓名',b.MakerCode '创客编号',a.UseAmount '申请提现临额',b.CertId '身份证号',b.SettleBankCardNo '银行卡号',b.SettleBankName '银行名称',b.Mobile '手机号',(CASE WHEN a.AmountType=1 THEN '临额提现' ELSE '' end) '交易类型',null '是否成功(是、否)' FROM StoreHouseAmountRecord a LEFT JOIN Users b ON a.UserId=b.Id" + condition + "";
             var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
             var FileName = "分仓临额提现记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
@@ -764,8 +764,8 @@ namespace MySystem.Areas.Admin.Controllers
             }
             else
             {
-                var Info = db.StoreHouseAmountRecord.Where(m => IdList.Contains(m.Id)).ToList();//成功
-                var Infos = db.StoreHouseAmountRecord.Where(m => IdLists.Contains(m.Id)).ToList();//失败
+                var Info = db.StoreHouseAmountRecord.Where(m => IdList.Contains(m.Id) && m.Status == 2).ToList();//成功
+                var Infos = db.StoreHouseAmountRecord.Where(m => IdLists.Contains(m.Id) && m.Status == 2).ToList();//失败
                 foreach (var item in Info)
                 {
                     item.Status = 1;//设置为成功
@@ -788,5 +788,72 @@ namespace MySystem.Areas.Admin.Controllers
         }
         #endregion
 
+
+        #region 通过队列导入数据
+
+        public IActionResult ImportByQueue(string right, string ExcelKind)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.ExcelKind = ExcelKind;
+            return View();
+        }
+        /// <summary>
+        /// 通过队列导入数据
+        /// </summary>
+        /// <param name="ExcelPath"></param>
+        [HttpPost]
+        public string ImportByQueuePost(string ExcelPath, int Kind = 0)
+        {
+            string key = function.MD5_16(Guid.NewGuid().ToString());
+            RedisDbconn.Instance.AddList("StoreHouseWithdrawalResultsQueue", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
+            return "success|" + key;
+        }
+        public string CheckImport(string key)
+        {
+            string result = RedisDbconn.Instance.Get<string>("StoreHouseWithdrawalResultsCheckImport:" + key);
+            if (!string.IsNullOrEmpty(result))
+            {
+                string[] datalist = result.Split('|');
+                if (datalist[0] == "success")
+                {
+                    return result;
+                }
+                return datalist[0];
+            }
+            return "0";
+        }
+        public Dictionary<string, object> CheckImportV2(string key)
+        {
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            string result = RedisDbconn.Instance.Get<string>("StoreHouseWithdrawalResultsCheckImport:" + key);
+            if (!string.IsNullOrEmpty(result))
+            {
+                string[] datalist = result.Split('|');
+                if (datalist[0] == "success")
+                {
+                    List<string> errList = RedisDbconn.Instance.GetList<string>("ErrList" + key);
+                    if (errList.Count > 0)
+                    {
+                        Obj.Add("status", 2);
+                        Obj.Add("errList", errList);
+                    }
+                    else
+                    {
+                        Obj.Add("status", 1);
+                        Obj.Add("data", result);
+                    }
+                    return Obj;
+                }
+                Obj.Add("status", 0);
+                Obj.Add("data", datalist[0]);
+                return Obj;
+            }
+            Obj.Add("status", -1);
+            Obj.Add("data", "执行中...");
+            return Obj;
+        }
+        #endregion
+
     }
 }

+ 7 - 52
Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs

@@ -528,19 +528,7 @@ namespace MySystem.Areas.Admin.Controllers
 
                 BrandId = Convert.ToInt32(Brand);
 
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
                 CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandId);
                 if (items == null)
                 {
@@ -560,19 +548,8 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 int num = Convert.ToInt32(ApplyList[i]["ApplyNum"].ToString());
                 int BrandIds = Convert.ToInt32(ApplyList[i]["BrandId"].ToString());
-                if (BrandIds == 1) FromStoreId = 7;
-                if (BrandIds == 2) FromStoreId = 721;
-                if (BrandIds == 3) FromStoreId = 697;
-                if (BrandIds == 4) FromStoreId = 774;
-                if (BrandIds == 5) FromStoreId = 775;
-                if (BrandIds == 6) FromStoreId = 871;
-                if (BrandIds == 7) FromStoreId = 1047;
-                if (BrandIds == 8) FromStoreId = 4831;
-                if (BrandIds == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds) ?? new KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
                 var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds);
                 CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandIds) ?? new CheckSendInfo();
                 if (items.Num > num)
@@ -609,19 +586,8 @@ namespace MySystem.Areas.Admin.Controllers
                         }
                     }
 
-                    if (BrandId == 1) FromStoreId = 7;
-                    if (BrandId == 2) FromStoreId = 721;
-                    if (BrandId == 3) FromStoreId = 697;
-                    if (BrandId == 4) FromStoreId = 774;
-                    if (BrandId == 5) FromStoreId = 775;
-                    if (BrandId == 6) FromStoreId = 871;
-                    if (BrandId == 7) FromStoreId = 1047;
-                    if (BrandId == 8) FromStoreId = 4831;
-                    if (BrandId == 9) FromStoreId = 4832;
-                    if (BrandId == 10) FromStoreId = 5512;
-                    if (BrandId == 11) FromStoreId = 5513;
-                    if (BrandId == 12) FromStoreId = 5907;
-                    if (BrandId == 13) FromStoreId = 6381;
+                    var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                    FromStoreId = kqProducts.MainStoreId;
                     if (PosSnList.Contains(SnNo))
                     {
                         error += "以下操作失败" + SnNo + ',' + "该机具重复发货" + '\n';
@@ -650,19 +616,8 @@ namespace MySystem.Areas.Admin.Controllers
 
                 BrandId = Convert.ToInt32(Brand);
 
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
                 tostore = db.StoreHouse.FirstOrDefault(m => m.UserId == apply.UserId && m.BrandId == BrandId.ToString() && m.Status > -1 && m.Sort == 0);
                 SendInfo item = sendInfos.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandId);
                 if (item == null)

+ 8 - 1
Areas/Admin/Controllers/MainServer/ToChargeBackRecordController.cs

@@ -184,7 +184,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("Remark", data.Remark); //备注
             Fields.Add("Field1", data.Field1); //备用字段
 
-            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.Remark);
             int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ToChargeBackRecord", Fields, 0);
@@ -269,6 +269,7 @@ namespace MySystem.Areas.Admin.Controllers
             }
             Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额
             Fields.Add("Kind", data.Kind); //待扣金额
+            Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
             Fields.Add("SeoDescription", data.SeoDescription);
             if (info.ChargeType != 124)
             {
@@ -303,6 +304,7 @@ namespace MySystem.Areas.Admin.Controllers
                 if (toChargeBackRecord.Kind == 2) userAccount.OperateToChargeAmount -= toChargeBackRecord.ChargeAmount;//删除预扣款记录时扣减相应预扣额度
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecord", Fields, id);
             }
             db.SaveChanges();
@@ -327,6 +329,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecord", Fields, id);
             }
             db.SaveChanges();
@@ -374,6 +377,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 3);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecord", Fields, id);
             }
             db.SaveChanges();
@@ -397,6 +401,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecord", Fields, id);
             }
             db.SaveChanges();
@@ -543,6 +548,7 @@ namespace MySystem.Areas.Admin.Controllers
                     }).Entity;
                     userAccount.BalanceAmount += toChargeBackRecord.ChargeAmount;
                     toChargeBackRecord.Status = 2;
+                    toChargeBackRecord.SeoTitle = SysUserName + "_" + SysRealName;
                     info += toChargeBackRecord.Remark + "," + toChargeBackRecord.ChargeAmount + "<br/>";
                 }
             }
@@ -599,6 +605,7 @@ namespace MySystem.Areas.Admin.Controllers
                         }).Entity;
                         userAccount.BalanceAmount += toChargeBackRecord.ChargeAmount;
                         toChargeBackRecord.Status = 2;
+                        toChargeBackRecord.SeoTitle = SysUserName + "_" + SysRealName;
                         info += toChargeBackRecord.Remark + "," + toChargeBackRecord.ChargeAmount + "<br/>";
                     }
                     //未扣款

+ 6 - 3
Areas/Admin/Controllers/MainServer/ToChargeBackRecordSubController.cs

@@ -160,7 +160,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("StartDate", data.StartDate); //扣款开始时间
             Fields.Add("TimeNumber", data.TimeNumber); //期数
 
-            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
             int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ToChargeBackRecordSub", Fields, 0);
@@ -222,18 +222,18 @@ namespace MySystem.Areas.Admin.Controllers
                 if (toChargeBackRecordSub.ChargeAmount < data.ChargeAmount)
                 {
                     toChargeByStage.TotalAmount += data.ChargeAmount - toChargeBackRecordSub.ChargeAmount;
-                    
+
                     if (toChargeBackRecordSub.Kind == 0) userAccount.ToChargeAmount += data.ChargeAmount - toChargeBackRecordSub.ChargeAmount;
                     if (toChargeBackRecordSub.Kind == 1) userAccount.LeaderToChargeAmount += data.ChargeAmount - toChargeBackRecordSub.ChargeAmount;
                     if (toChargeBackRecordSub.Kind == 2) userAccount.OperateToChargeAmount += data.ChargeAmount - toChargeBackRecordSub.ChargeAmount;
                 }
             }
             Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额
+            Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
             Fields.Add("Remark", data.Remark); //备注
             Fields.Add("StartDate", data.StartDate); //扣款开始时间
             Fields.Add("TimeNumber", data.TimeNumber); //期数
 
-            Fields.Add("SeoTitle", data.SeoTitle);
             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecordSub", Fields, data.Id);
             AddSysLog(data.Id.ToString(), "ToChargeBackRecordSub", "update");
             db.SaveChanges();
@@ -258,6 +258,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", -1);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecordSub", Fields, id);
             }
             db.SaveChanges();
@@ -282,6 +283,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecordSub", Fields, id);
             }
             db.SaveChanges();
@@ -305,6 +307,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeBackRecordSub", Fields, id);
             }
             db.SaveChanges();

+ 4 - 1
Areas/Admin/Controllers/MainServer/ToChargeByStageController.cs

@@ -250,7 +250,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("TimeNumber", data.TimeNumber); //期数
             Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
 
-            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
             Fields.Add("SeoKeyword", data.SeoKeyword);
             Fields.Add("SeoDescription", data.SeoDescription);
             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeByStage", Fields, data.Id);
@@ -310,6 +310,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 1);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeByStage", Fields, id);
             }
             db.SaveChanges();
@@ -333,6 +334,7 @@ namespace MySystem.Areas.Admin.Controllers
                 int id = int.Parse(subid);
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("Status", 0);
+                Fields.Add("SeoTitle", SysUserName + "_" + SysRealName);
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeByStage", Fields, id);
             }
             db.SaveChanges();
@@ -379,6 +381,7 @@ namespace MySystem.Areas.Admin.Controllers
                     CreateDate = DateTime.Now,
                     UpdateDate = DateTime.Now,
                     UserId = UserId,   //创客
+                    SeoTitle = SysUserName + "_" + SysRealName,
                     ChargeAmount = ChargeAmount,   //待扣金额
                     Remark = Remark,   //备注
                     StartDate = StartDate,   //扣款开始时间

+ 68 - 0
Areas/Admin/Controllers/MainServer/UsersController.cs

@@ -1194,6 +1194,74 @@ namespace MySystem.Areas.Admin.Controllers
         }
         #endregion
 
+
+        #region 通过队列导入数据
+
+        public IActionResult ImportByQueue(string right, string ExcelKind)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            ViewBag.ExcelKind = ExcelKind;
+            return View();
+        }
+        /// <summary>
+        /// 通过队列导入数据
+        /// </summary>
+        /// <param name="ExcelPath"></param>
+        [HttpPost]
+        public string ImportByQueuePost(string ExcelPath, int Kind = 0)
+        {
+            string key = function.MD5_16(Guid.NewGuid().ToString());
+            RedisDbconn.Instance.AddList("BatchEditUserAmountQueue", ExcelPath + "#cut#" + Kind + "#cut#" + key + "#cut#" + SysUserName);
+            return "success|" + key;
+        }
+        public string CheckImport(string key)
+        {
+            string result = RedisDbconn.Instance.Get<string>("BatchEditUserAmountCheckImport:" + key);
+            if (!string.IsNullOrEmpty(result))
+            {
+                string[] datalist = result.Split('|');
+                if (datalist[0] == "success")
+                {
+                    return result;
+                }
+                return datalist[0];
+            }
+            return "0";
+        }
+        public Dictionary<string, object> CheckImportV2(string key)
+        {
+            Dictionary<string, object> Obj = new Dictionary<string, object>();
+            string result = RedisDbconn.Instance.Get<string>("BatchEditUserAmountCheckImport:" + key);
+            if (!string.IsNullOrEmpty(result))
+            {
+                string[] datalist = result.Split('|');
+                if (datalist[0] == "success")
+                {
+                    List<string> errList = RedisDbconn.Instance.GetList<string>("ErrList" + key);
+                    if (errList.Count > 0)
+                    {
+                        Obj.Add("status", 2);
+                        Obj.Add("errList", errList);
+                    }
+                    else
+                    {
+                        Obj.Add("status", 1);
+                        Obj.Add("data", result);
+                    }
+                    return Obj;
+                }
+                Obj.Add("status", 0);
+                Obj.Add("data", datalist[0]);
+                return Obj;
+            }
+            Obj.Add("status", -1);
+            Obj.Add("data", "执行中...");
+            return Obj;
+        }
+        #endregion
+
+
         #region 导出Excel
 
         /// <summary>

+ 12 - 52
Areas/Admin/Controllers/OperateServer/StoreMachineApplyOperateController.cs

@@ -631,19 +631,9 @@ namespace MySystem.Areas.Admin.Controllers
 
                 BrandId = Convert.ToInt32(Brand);
 
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new Models.KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+                
                 CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandId);
                 if (items == null)
                 {
@@ -663,19 +653,9 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 int num = Convert.ToInt32(ApplyList[i]["ApplyNum"].ToString());
                 int BrandIds = Convert.ToInt32(ApplyList[i]["BrandId"].ToString());
-                if (BrandIds == 1) FromStoreId = 7;
-                if (BrandIds == 2) FromStoreId = 721;
-                if (BrandIds == 3) FromStoreId = 697;
-                if (BrandIds == 4) FromStoreId = 774;
-                if (BrandIds == 5) FromStoreId = 775;
-                if (BrandIds == 6) FromStoreId = 871;
-                if (BrandIds == 7) FromStoreId = 1047;
-                if (BrandIds == 8) FromStoreId = 4831;
-                if (BrandIds == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds) ?? new Models.KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+
                 var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds);
                 CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandIds) ?? new CheckSendInfo();
                 if (items.Num > num)
@@ -696,19 +676,9 @@ namespace MySystem.Areas.Admin.Controllers
                 string SnNo = itemJson.Contains("\"A\"") ? dr["A"].ToString() : "";
                 string Brand = itemJson.Contains("\"B\"") ? dr["B"].ToString() : "";
                 BrandId = Convert.ToInt32(Brand);
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new Models.KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+
                 Models.MachineForSnNo posInfo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == SnNo) ?? new Models.MachineForSnNo();
                 var pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posInfo.SnId && m.StoreId == FromStoreId && m.UserId == 0 && m.BuyUserId == 0 && m.PreUserId == 0) ?? new Models.PosMachinesTwo();
                 if (pos.BindingState == 1 || pos.ActivationState == 1)
@@ -765,19 +735,9 @@ namespace MySystem.Areas.Admin.Controllers
                     }
                 }
 
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new Models.KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+
                 tostore = db.StoreHouse.FirstOrDefault(m => m.Sort > 0 && m.UserId == apply.UserId && m.BrandId == BrandId.ToString() && m.Status == 1);
                 SendInfo item = sendInfos.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandId);
                 if (item == null)

+ 12 - 52
Areas/Admin/Controllers/OperateServer/StoreMachineApplysOperateController.cs

@@ -528,19 +528,9 @@ namespace MySystem.Areas.Admin.Controllers
 
                 BrandId = Convert.ToInt32(Brand);
 
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+
                 CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandId);
                 if (items == null)
                 {
@@ -560,19 +550,9 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 int num = Convert.ToInt32(ApplyList[i]["ApplyNum"].ToString());
                 int BrandIds = Convert.ToInt32(ApplyList[i]["BrandId"].ToString());
-                if (BrandIds == 1) FromStoreId = 7;
-                if (BrandIds == 2) FromStoreId = 721;
-                if (BrandIds == 3) FromStoreId = 697;
-                if (BrandIds == 4) FromStoreId = 774;
-                if (BrandIds == 5) FromStoreId = 775;
-                if (BrandIds == 6) FromStoreId = 871;
-                if (BrandIds == 7) FromStoreId = 1047;
-                if (BrandIds == 8) FromStoreId = 4831;
-                if (BrandIds == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds) ?? new KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+
                 var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds);
                 CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandIds) ?? new CheckSendInfo();
                 if (items.Num > num)
@@ -593,19 +573,9 @@ namespace MySystem.Areas.Admin.Controllers
                 string SnNo = itemJson.Contains("\"A\"") ? dr["A"].ToString() : "";
                 string Brand = itemJson.Contains("\"B\"") ? dr["B"].ToString() : "";
                 BrandId = Convert.ToInt32(Brand);
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+
                 MachineForSnNo posInfo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == SnNo) ?? new MachineForSnNo();
                 var pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posInfo.SnId && m.StoreId == FromStoreId && m.UserId == 0 && m.BuyUserId == 0 && m.PreUserId == 0) ?? new PosMachinesTwo();
                 if (pos.BindingState == 1 || pos.ActivationState == 1)
@@ -649,19 +619,9 @@ namespace MySystem.Areas.Admin.Controllers
 
                 BrandId = Convert.ToInt32(Brand);
 
-                if (BrandId == 1) FromStoreId = 7;
-                if (BrandId == 2) FromStoreId = 721;
-                if (BrandId == 3) FromStoreId = 697;
-                if (BrandId == 4) FromStoreId = 774;
-                if (BrandId == 5) FromStoreId = 775;
-                if (BrandId == 6) FromStoreId = 871;
-                if (BrandId == 7) FromStoreId = 1047;
-                if (BrandId == 8) FromStoreId = 4831;
-                if (BrandId == 9) FromStoreId = 4832;
-                if (BrandId == 10) FromStoreId = 5512;
-                if (BrandId == 11) FromStoreId = 5513;
-                if (BrandId == 12) FromStoreId = 5907;
-                if (BrandId == 13) FromStoreId = 6381;
+                var kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                FromStoreId = kqProducts.MainStoreId;
+                
                 tostore = db.StoreHouse.FirstOrDefault(m => m.Sort > 0 && m.UserId == apply.UserId && m.BrandId == BrandId.ToString() && m.Status == 1);
                 SendInfo item = sendInfos.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandId);
                 if (item == null)

+ 70 - 0
Areas/Admin/Controllers/OperateServer/SysAdminOperateController.cs

@@ -282,6 +282,13 @@ namespace MySystem.Areas.Admin.Controllers
                         opdb.SaveChanges();
                     }
 
+                    var sys = opdb.SysAdmin.Select(m => new { m.UserId, m.CreateDate }).Where(m => m.CreateDate < DateTime.Now).ToList();
+                    foreach (var item in sys)
+                    {
+                        AddOpStoreHouseByUserId(item.UserId.ToString());
+                    }
+
+                    // TODO: 只有运营中心发5888
                     RedisDbconn.Instance.AddList("OperateAddServiceQueue", Id.ToString());
                 }
                 else
@@ -696,5 +703,68 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        #region 新建运营中心添加历史运营中心缺少分仓
+        /// <summary>
+        /// 新建运营中心添加历史运营中心缺少分仓
+        /// </summary>
+        /// <returns></returns>
+        public string AddOpStoreHouseByUserId(string UserIds)
+        {
+            string[] UserIdList = UserIds.Split(new char[] { ',' });
+            AddSysLog(UserIds, "SysAdmin", "新建运营中心添加历史运营中心缺少分仓");
+            var kqProduct = db.KqProducts.ToList();
+            foreach (string subid in UserIdList)
+            {
+                int UserId = int.Parse(subid);
+                SysAdmin sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.UserId == UserId) ?? new SysAdmin();
+                var store = db.StoreHouse.FirstOrDefault(m => m.Sort == sysAdmin.Id && m.UserId == sysAdmin.UserId) ?? new Models.StoreHouse();
+                foreach (var item in kqProduct)
+                {
+                    var BrandId = item.Id.ToString();
+                    var check = db.StoreHouse.Any(m => m.Sort == sysAdmin.Id && m.UserId == sysAdmin.UserId && m.BrandId == BrandId);
+                    if (!check)
+                    {
+                        string Nos = "YC000" + item.Id + sysAdmin.Id;
+                        var query = db.StoreHouse.Add(new Models.StoreHouse()
+                        {
+                            CreateDate = DateTime.Now, //创建时间
+                            CreateMan = SysUserName + "_" + SysRealName,
+                            ManageMobile = sysAdmin.MakerMobile, //手机号
+                            UserId = UserId, //运营中心创客Id
+                            OpId = UserId, //运营中心创客Id
+                            Address = store.Address,//仓库地址
+                            Areas = store.Areas,//所属地区
+                            ManageUserId = UserId,//仓库管理员
+                            StoreName = item.Name + "运营分仓", //仓库名称
+                            StoreNo = Nos, //仓库编号
+                            Sort = sysAdmin.Id,//运营中心Id
+                            Status = 1,
+                            BrandId = item.Id.ToString(),
+                            StoreKind = 2,//运营仓
+
+                        }).Entity;
+                        db.SaveChanges();
+
+                        var querys = opdb.StoreForOperate.Add(new OpModels.StoreForOperate()
+                        {
+                            CreateDate = DateTime.Now, //创建时间
+                            CreateMan = SysUserName + "_" + SysRealName,
+                            Sort = sysAdmin.UserId,
+                            OpId = sysAdmin.UserId,
+                            StoreId = query.Id,
+                            SeoKeyword = query.StoreNo,
+                            SeoDescription = query.StoreName,
+                        }).Entity;
+                        opdb.SaveChanges();
+                    }
+                }
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+
     }
 }

+ 2 - 1
Areas/Admin/Views/MainServer/PreAmountRecord/Indexs.cshtml

@@ -140,7 +140,8 @@
         </div>
         <div class="layui-form-item ml10">
             <div class="layui-input-block">
-                <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button>
+                @* <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button> *@
+                <button type="button" class="layui-btn" onclick="ConfirmImportByQueue()">立即导入</button>
             </div>
         </div>
     </div>

+ 2 - 1
Areas/Admin/Views/MainServer/StoreHouseAmountRecord/Indexs.cshtml

@@ -140,7 +140,8 @@
         </div>
         <div class="layui-form-item ml10">
             <div class="layui-input-block">
-                <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button>
+                @* <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button> *@
+                <button type="button" class="layui-btn" onclick="ConfirmImportByQueue()">立即导入</button>
             </div>
         </div>
     </div>

+ 144 - 0
Areas/Admin/Views/MainServer/Users/ImportByQueue.cshtml

@@ -0,0 +1,144 @@
+@{
+    string RightInfo = ViewBag.RightInfo as string;
+    string right = ViewBag.right as string;
+    string ExcelKind = ViewBag.ExcelKind as string;
+    
+}
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>导入数据</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
+    <script src="/admin/js/jquery-1.10.1.min.js"></script>
+    <script src="/admin/js/LAreaData2.js"></script>
+    <style>
+        .layui-form-label{
+            width: 135px !important;
+        }
+        .layui-form-item .layui-input-block{
+            margin-left: 165px !important;
+        }
+    </style>
+</head>
+<body>
+
+    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
+        <input type="hidden" name="Kind" value="@ExcelKind" />
+        
+        <div class="layui-card">
+          <div class="layui-card-body">
+            <div class="layui-tab" lay-filter="mytabbar">
+                <div class="layui-tab-content mt20">
+                    <div class="layui-tab-item layui-show">
+                        <div class="layui-form-item">
+                            <label class="layui-form-label">模板下载</label>
+                            <div class="layui-form-mid layui-word-aux" id="excelTemp">
+                                @if(ExcelKind == "1")
+                                {
+                                <a href="/users/批量修改提现结算金额模版.xlsx">点击下载批量修改提现结算金额模版</a>
+                                }
+                                @if(ExcelKind == "2")
+                                {
+                                <a href="/users/批量修改提现冻结金额模版.xlsx">点击下载批量修改提现冻结金额模版</a>
+                                }
+                                @if(ExcelKind == "3")
+                                {
+                                <a href="/users/提现风控模版.xlsx">点击下载提现风控模版</a>
+                                }
+                                @if(ExcelKind == "4")
+                                {
+                                <a href="/users/批量修改金额模版.xlsx">点击下载批量修改金额模版</a>
+                                }
+                            </div>
+                        </div>
+                        <div class="layui-form-item">
+                            <label class="layui-form-label">excel文件</label>
+                            <div class="layui-input-block">
+                                <div class="layui-upload">
+                                    <input type="hidden" id="ExcelPath" name="ExcelPath" value="">
+                                    <button class="layui-btn" type="button" id="ExcelPathBtn">选择</button>
+                                    <div class="layui-inline layui-word-aux"></div>
+                                </div>
+                                <div class="mt10" id="ExcelPathFile">
+                                </div>
+                            </div>
+                        </div>
+                        
+                    </div>
+
+                </div>
+            </div>
+            <div class="layui-form-item layui-hide">
+                <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit" value="确认">
+            </div>
+          </div>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/other/oss/upload-min.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script src="/other/mybjq/kindeditor-min.js"></script>
+    <script src="/other/mybjq/lang/zh_CN.js"></script>
+    <script>
+        
+                    
+        //编辑器
+        KindEditor.ready(function (K) {
+            
+        });
+
+        
+        var tree;
+        var element;
+        var upload;
+        layui.config({
+            base: '/layuiadmin/' //静态资源所在路径
+        }).extend({
+            index: 'lib/index' //主入口模块
+        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
+            var $ = layui.$
+                , form = layui.form
+                , layer = layui.layer
+                , layedit = layui.layedit
+                , laydate = layui.laydate
+                , croppers = layui.croppers
+                , transfer = layui.transfer
+                , util = layui.util;
+            tree = layui.tree;
+            element = layui.element;
+            upload = layui.upload;
+        
+            //Hash地址的定位
+            var layid = location.hash.replace(/^#test=/, '');
+            element.tabChange('test', layid);
+            element.on('tab(test)', function (elem) {
+                location.hash = 'test=' + $(this).attr('lay-id');
+            });
+    
+            //日期
+            
+
+            //上传文件
+            WebUploadJs('ExcelPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload/v2', {width:0,height:0,quality:0},{max_file_size:1048576},  function (filename) {
+                $('#ExcelPathFile').html(filename);
+                $('#ExcelPath').val(filename);
+            });
+
+            //穿梭框
+            
+            
+
+            //TreeView,比如权限管理
+            
+
+            //省市区
+
+        });
+
+    </script>
+</body>
+</html>

+ 2 - 1
Areas/Admin/Views/MainServer/Users/Index.cshtml

@@ -336,7 +336,8 @@
         </div>
         <div class="layui-form-item ml10">
             <div class="layui-input-block">
-                <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button>
+                @* <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button> *@
+                <button type="button" class="layui-btn" onclick="ConfirmImportByQueue()">立即导入</button>
             </div>
         </div>
     </div>

+ 21 - 20
Startup.cs

@@ -104,7 +104,7 @@ namespace MySystem
                 Env = "Develop";
                 app.UseDeveloperExceptionPage();
             }
-            else 
+            else
             {
                 Env = "Production";
                 app.UseHsts();
@@ -132,28 +132,29 @@ namespace MySystem
                     name: "default",
                     pattern: "{controller=Home}/{action=Index}/{Id?}");
             });
-            
+
             initMainServer(Env);
             initBsServer();
             initCashServer();
             initSpServer();
             initOperateServer();
 
-            if(Env == "Develop")
-            {
-            }
-            if(Env == "Production")
-            {
-                ResetUserTradeService.Instance.Start();
-                ResetMerchantTradeService.Instance.Start();
-                SycnProfitServiceV3.Instance.Start();
-                SycnHelpProfitService.Instance.Start();
-                ExcelHelper.Instance.Start();
-                OpExcelHelper.Instance.Start();
-                SycnUserMachineCountHelper.Instance.Start(); //重置创客机具数量
+            // if(Env == "Develop")
+            // {
+            // }
+            // if(Env == "Production")
+            // {
+            //     ResetUserTradeService.Instance.Start();
+            //     ResetMerchantTradeService.Instance.Start();
+            //     SycnProfitServiceV3.Instance.Start();
+            //     SycnHelpProfitService.Instance.Start();
+            //     ExcelHelper.Instance.Start();
+            //     OpExcelHelper.Instance.Start();
+            //     SycnUserMachineCountHelper.Instance.Start(); //重置创客机具数量
 
-                TestHelper.Instance.Start(); //生成兑换券
-            }
+            //     TestHelper.Instance.Start(); //生成兑换券
+            // }
+            BatchEditUserAmountService.Instance.Start(); //创客信息相关数据导入
         }
 
 
@@ -167,10 +168,10 @@ namespace MySystem
         private void initMainServer(string Env)
         {
             string dbName = "KxsMainServer";
-            // if(Env == "Production")
-            // {
-            //     dbName = "KxsProfitServer";
-            // }
+            if (Env == "Production")
+            {
+                dbName = "KxsProfitServer";
+            }
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Library.OtherMySqlConn.connstr = Configuration["Setting:SqlConnStr"];
             System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = '" + dbName + "'");

+ 57 - 1
wwwroot/layuiadmin/modules_main/PreCardAmountRecord_Admin.js

@@ -22,6 +22,62 @@ function ConfirmImport() {
     });
 }
 
+function ConfirmImportByQueue() {
+    $.ajax({
+        type: "POST",
+        url: "/Admin/PreAmountRecord/ImportByQueuePost?r=" + Math.random(1),
+        data: "Kind=" + ExcelKind + "&ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
+        dataType: "text",
+        success: function (data) {
+            if (data == "success") {
+                layer.msg("导入成功", { time: 2000 }, function () {
+                    window.location.reload();
+                });
+            } else if (data.indexOf("warning") == 0) {
+                var datalist = data.split('|');
+                layer.alert(datalist[0], { time: 20000 }, function () {
+                    window.location.reload();
+                });
+            } else {
+                layer.msg(data);
+            }
+        }
+    });
+}
+
+function CheckImport(table, key, loadindex, index) {
+    $.ajax({
+        url: "/Admin/PreAmountRecord/CheckImportV2?r=" + Math.random(1),
+        data: "key=" + key,
+        dataType: "json",
+        success: function (data) {
+            if (data.status == 1) {
+                layer.msg("成功操作" + data.data + "条", {
+                    time: 2000
+                }, function () {
+                    layer.close(index); //关闭弹层
+                    layer.close(loadindex);
+                    table.reload('LAY-list-manage'); //数据刷新
+                });
+            } else if (data.status == 2) {
+                layer.close(index); //关闭弹层
+                layer.close(loadindex);
+                var content = '';
+                for (var i = 0; i < data.errList.length; i++) {
+                    content += data.errList[i] + '<br/>'
+                }
+                layer.alert(content);
+            } else {
+                layer.msg(data.data, {
+                    time: 1000
+                }, function () {
+                    CheckImport(table, key, loadindex, index);
+                });
+            }
+        }
+    });
+}
+
 var excel;
 layui.config({
     base: '/layuiadmin/' //静态资源所在路径
@@ -69,7 +125,7 @@ layui.config({
     $('#ExcelFile').change(function (e) {
         var files = e.target.files;
         excel.importExcel(files, {}, function (data) {
-            ExcelData = data[0].sheet1;
+            ExcelData = data[0].Sheet1;
         });
     });
 

+ 57 - 1
wwwroot/layuiadmin/modules_main/StoreHouseCardAmountRecord_Admin.js

@@ -22,6 +22,62 @@ function ConfirmImport() {
     });
 }
 
+function ConfirmImportByQueue() {
+    $.ajax({
+        type: "POST",
+        url: "/Admin/StoreHouseAmountRecord/ImportByQueuePost?r=" + Math.random(1),
+        data: "Kind=" + ExcelKind + "&ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
+        dataType: "text",
+        success: function (data) {
+            if (data == "success") {
+                layer.msg("导入成功", { time: 2000 }, function () {
+                    window.location.reload();
+                });
+            } else if (data.indexOf("warning") == 0) {
+                var datalist = data.split('|');
+                layer.alert(datalist[0], { time: 20000 }, function () {
+                    window.location.reload();
+                });
+            } else {
+                layer.msg(data);
+            }
+        }
+    });
+}
+
+function CheckImport(table, key, loadindex, index) {
+    $.ajax({
+        url: "/Admin/StoreHouseAmountRecord/CheckImportV2?r=" + Math.random(1),
+        data: "key=" + key,
+        dataType: "json",
+        success: function (data) {
+            if (data.status == 1) {
+                layer.msg("成功操作" + data.data + "条", {
+                    time: 2000
+                }, function () {
+                    layer.close(index); //关闭弹层
+                    layer.close(loadindex);
+                    table.reload('LAY-list-manage'); //数据刷新
+                });
+            } else if (data.status == 2) {
+                layer.close(index); //关闭弹层
+                layer.close(loadindex);
+                var content = '';
+                for (var i = 0; i < data.errList.length; i++) {
+                    content += data.errList[i] + '<br/>'
+                }
+                layer.alert(content);
+            } else {
+                layer.msg(data.data, {
+                    time: 1000
+                }, function () {
+                    CheckImport(table, key, loadindex, index);
+                });
+            }
+        }
+    });
+}
+
 var excel;
 layui.config({
     base: '/layuiadmin/' //静态资源所在路径
@@ -69,7 +125,7 @@ layui.config({
     $('#ExcelFile').change(function (e) {
         var files = e.target.files;
         excel.importExcel(files, {}, function (data) {
-            ExcelData = data[0].sheet1;
+            ExcelData = data[0].Sheet1;
         });
     });
 

+ 1 - 0
wwwroot/layuiadmin/modules_main/ToChargeBackRecord_Admin.js

@@ -391,6 +391,7 @@ layui.config({
                                 data: userdata,
                                 dataType: "text",
                                 success: function (data) {
+                                    clickFlag = true;
                                     layer.close(index); //关闭弹层
                                     if (data == "success") {
                                         table.reload('LAY-list-manage'); //数据刷新

+ 111 - 9
wwwroot/layuiadmin/modules_main/Users_Admin.js

@@ -22,6 +22,62 @@ function ConfirmImport() {
     });
 }
 
+function ConfirmImportByQueue() {
+    $.ajax({
+        type: "POST",
+        url: "/Admin/Users/ImportByQueuePost?r=" + Math.random(1),
+        data: "Kind=" + ExcelKind + "&ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
+        dataType: "text",
+        success: function (data) {
+            if (data == "success") {
+                layer.msg("导入成功", { time: 2000 }, function () {
+                    window.location.reload();
+                });
+            } else if (data.indexOf("warning") == 0) {
+                var datalist = data.split('|');
+                layer.alert(datalist[0], { time: 20000 }, function () {
+                    window.location.reload();
+                });
+            } else {
+                layer.msg(data);
+            }
+        }
+    });
+}
+
+function CheckImport(table, key, loadindex, index) {
+    $.ajax({
+        url: "/Admin/Users/CheckImportV2?r=" + Math.random(1),
+        data: "key=" + key,
+        dataType: "json",
+        success: function (data) {
+            if (data.status == 1) {
+                layer.msg("成功操作" + data.data + "条", {
+                    time: 2000
+                }, function () {
+                    layer.close(index); //关闭弹层
+                    layer.close(loadindex);
+                    table.reload('LAY-list-manage'); //数据刷新
+                });
+            } else if (data.status == 2) {
+                layer.close(index); //关闭弹层
+                layer.close(loadindex);
+                var content = '';
+                for (var i = 0; i < data.errList.length; i++) {
+                    content += data.errList[i] + '<br/>'
+                }
+                layer.alert(content);
+            } else {
+                layer.msg(data.data, {
+                    time: 1000
+                }, function () {
+                    CheckImport(table, key, loadindex, index);
+                });
+            }
+        }
+    });
+}
+
 
 layui.config({
     base: '/layuiadmin/' //静态资源所在路径
@@ -70,6 +126,7 @@ layui.config({
         var files = e.target.files;
         excel.importExcel(files, {}, function (data) {
             ExcelData = data[0].Sheet1;
+            console.log(data);
         });
     });
 
@@ -872,17 +929,62 @@ layui.config({
             });
         }
         , ImportSettleAmount: function () {
-            ExcelKind = 1;
-            layer.open({
-                type: 1,
-                title: '导入',
-                maxmin: false,
-                area: ['460px', '280px'],
-                content: $('#excelForm'),
-                cancel: function () {
+            // ExcelKind = 1;
+            // layer.open({
+            //     type: 1,
+            //     title: '导入',
+            //     maxmin: false,
+            //     area: ['460px', '280px'],
+            //     content: $('#excelForm'),
+            //     cancel: function () {
+            //     }
+            // });
+            // $("#excelTemp").html('<a href="/users/批量修改提现结算金额模版.xlsx">点击下载批量修改提现结算金额模版</a>');
+            var perContent = layer.open({
+                type: 2,
+                title: '导入结算金额',
+                content: 'ImportByQueue?ExcelKind=1',
+                maxmin: true,
+                area: ['650px', '350px'],
+                btn: ['确定', '取消'],
+                yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index],
+                        submitID = 'LAY-list-front-submit',
+                        submit = layero.find('iframe').contents().find('#' + submitID);
+
+
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+                        var loadindex = layer.load(1, {
+                            shade: [0.5, '#000']
+                        });
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/Users/ImportByQueuePost?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                if (data.indexOf("success") == 0) {
+                                    var datalist = data.split('|');
+                                    var key = datalist[1];
+                                    CheckImport(table, key, loadindex, index);
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
                 }
             });
-            $("#excelTemp").html('<a href="/users/批量修改提现结算金额模版.xlsx">点击下载批量修改提现结算金额模版</a>');
         }
         , ImportFreezeAmt: function () {
             ExcelKind = 2;

BIN
wwwroot/users/批量修改提现结算金额模版.xlsx