Просмотр исходного кода

Merge branch 'feature-dgy-费率调整' into DuGuYang

DuGuYang 3 лет назад
Родитель
Сommit
08bd92d660

+ 60 - 0
AppStart/Helper/SetFeeFlagService.cs

@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading;
+using MySystem.Models;
+using Library;
+
+namespace MySystem
+{
+    /// <summary>
+    /// 设置机具费率标记并推送消息
+    /// </summary>
+    public class SetFeeFlagService
+    {
+        public readonly static SetFeeFlagService Instance = new SetFeeFlagService();
+        private SetFeeFlagService()
+        { }
+
+        public void Start()
+        {
+            Thread th = new Thread(doSomething);
+            th.IsBackground = true;
+            th.Start();
+        }
+
+        public void doSomething()
+        {
+            while (true)
+            {
+                if (DateTime.Now.Hour < 3)
+                {
+                    try
+                    {
+                        string check = function.ReadInstance("/Fee/check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
+                        if (string.IsNullOrEmpty(check))
+                        {
+                            function.WritePage("/Fee/", "check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", DateTime.Now.ToString("HH:mm:ss"));
+                            WebCMSEntities db = new WebCMSEntities();
+                            var date = DateTime.Now.AddDays(-178);
+                            var posList = db.PosMachinesTwo.Where(m => m.Status > -1 && m.BindingTime <= date && m.BindingState == 1 && m.UpFeeFlag == 0).ToList();
+                            //循环修改机具费率调升标记
+                            //统计需要推送消息的用户Id
+                            foreach (var item in posList)
+                            {
+                                string info = "{\"RecordId\":\"\",\"PosId\":\"" + item.Id + "\",\"Fee\": \"" + 0.63 + "\",\"Kind\": \"" + 1 + "\",\"OpMan\": \"\"}";
+                                RedisDbconn.Instance.AddList("SetDepositPostQueue", info);
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        function.WriteLog(DateTime.Now.ToString() + ":" + ex.ToString(), "机具费率标记设置异常");
+                    }
+                }
+                Thread.Sleep(600000);
+            }
+        }
+    }
+}

+ 11 - 7
Areas/Admin/Controllers/MainServer/PosMachinesTwoChangeController.cs

@@ -51,7 +51,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 机具库列表
         /// 机具库列表
         /// </summary>
         /// </summary>
         /// <returns></returns>
         /// <returns></returns>
-        public JsonResult IndexData(PosMachinesTwo data, string BindingStateSelect, string ActivationStateSelect, string UserIdMakerCode, string UserIdRealName, string StoreIdCode, string StoreIdName, string ActivationDateData, string BindingDateData, string BrandSelect = "1", string UpFeeFlagSelect = "0", int page = 1, int limit = 30)
+        public JsonResult IndexData(PosMachinesTwo data, string BindingStateSelect, string ActivationStateSelect, string UserIdMakerCode, string UserIdRealName, string StoreIdCode, string StoreIdName, string ActivationDateData, string BindingDateData, string BrandSelect = "1", int page = 1, int limit = 30)
         {
         {
 
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -59,7 +59,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("PosSn", "1"); //SN编号
             Fields.Add("PosSn", "1"); //SN编号
             Fields.Add("BrandId", "0"); //品牌
             Fields.Add("BrandId", "0"); //品牌
 
 
-            string condition = " and Status>-1 AND BindingState = 1 AND DATE_SUB(CURDATE(), INTERVAL 180 DAY) >= date(BindingTime) and DownFeeFlag =0";
+            string condition = " and Status>-1 AND BindingState = 1 AND DATE_SUB(CURDATE(), INTERVAL 180 DAY) >= date(BindingTime) and UpFeeFlag =1 and DownFeeFlag =0";
             //绑定状态
             //绑定状态
             if (!string.IsNullOrEmpty(BindingStateSelect))
             if (!string.IsNullOrEmpty(BindingStateSelect))
             {
             {
@@ -103,10 +103,10 @@ namespace MySystem.Areas.Admin.Controllers
             // {
             // {
             //     condition += " and BrandId = 1";
             //     condition += " and BrandId = 1";
             // }
             // }
-            if (!string.IsNullOrEmpty(UpFeeFlagSelect))
-            {
-                condition += " and UpFeeFlag = " + UpFeeFlagSelect;
-            }
+            // if (!string.IsNullOrEmpty(UpFeeFlagSelect))
+            // {
+            //     condition += " and UpFeeFlag = " + UpFeeFlagSelect;
+            // }
 
 
             if (!string.IsNullOrEmpty(ActivationDateData))
             if (!string.IsNullOrEmpty(ActivationDateData))
             {
             {
@@ -128,6 +128,10 @@ namespace MySystem.Areas.Admin.Controllers
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             foreach (Dictionary<string, object> dic in diclist)
             {
             {
+                //是否真实调升/降
+                int ActivityList = int.Parse(dic["ActivityList"].ToString());
+                if (ActivityList == 1) dic["ActivityList"] = "已真实调升";
+                if (ActivityList == 2) dic["ActivityList"] = "已真实调降";
                 //绑定状态
                 //绑定状态
                 int BindingState = int.Parse(dic["BindingState"].ToString());
                 int BindingState = int.Parse(dic["BindingState"].ToString());
                 if (BindingState == 0) dic["BindingState"] = "未绑定";
                 if (BindingState == 0) dic["BindingState"] = "未绑定";
@@ -484,7 +488,7 @@ namespace MySystem.Areas.Admin.Controllers
                     // Kind:1或2,1为费率0.63,2为费率0.6
                     // Kind:1或2,1为费率0.63,2为费率0.6
                     // OpMan:操作人,app传创客编号,后台传SysUserName
                     // OpMan:操作人,app传创客编号,后台传SysUserName
                     string info = "{\"RecordId\":\"\",\"PosId\":\"" + id + "\",\"Fee\": \"" + 0.63 + "\",\"Kind\": \"" + 1 + "\",\"OpMan\": \"" + SysUserName + "\"}";
                     string info = "{\"RecordId\":\"\",\"PosId\":\"" + id + "\",\"Fee\": \"" + 0.63 + "\",\"Kind\": \"" + 1 + "\",\"OpMan\": \"" + SysUserName + "\"}";
-                    RedisDbconn.Instance.AddList("SetDepositQueue", info);
+                    RedisDbconn.Instance.AddList("SetDepositPostQueue", info);
                 }
                 }
                 else
                 else
                 {
                 {

+ 2 - 2
Areas/Admin/Views/MainServer/PosMachinesTwoChange/Index.cshtml

@@ -74,7 +74,7 @@
                             <input class="layui-input" type="text" name="PosSn" placeholder="" autocomplete="off">
                             <input class="layui-input" type="text" name="PosSn" placeholder="" autocomplete="off">
                         </div>
                         </div>
                     </div>
                     </div>
-                    <div class="layui-inline">
+                    @* <div class="layui-inline">
                         <label class="layui-form-label">是否调升费率</label>
                         <label class="layui-form-label">是否调升费率</label>
                         <div class="layui-input-inline">
                         <div class="layui-input-inline">
                             <select id="UpFeeFlagSelect" name="UpFeeFlagSelect" lay-search="">
                             <select id="UpFeeFlagSelect" name="UpFeeFlagSelect" lay-search="">
@@ -83,7 +83,7 @@
                                 <option value="1">已调升</option>
                                 <option value="1">已调升</option>
                             </select>
                             </select>
                         </div>
                         </div>
-                    </div>
+                    </div> *@
                     <div class="layui-inline">
                     <div class="layui-inline">
                         <label class="layui-form-label">绑定状态</label>
                         <label class="layui-form-label">绑定状态</label>
                         <div class="layui-input-inline">
                         <div class="layui-input-inline">

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

@@ -128,6 +128,7 @@ layui.config({
             { type: 'checkbox', fixed: 'left' }
             { type: 'checkbox', fixed: 'left' }
             , { field: 'PosSn', width: 200, title: 'SN编号', sort: true }
             , { field: 'PosSn', width: 200, title: 'SN编号', sort: true }
             , { field: 'BrandId', width: 200, title: '产品类型', sort: true }
             , { field: 'BrandId', width: 200, title: '产品类型', sort: true }
+            , { field: 'ActivityList', width: 200, title: '是否真实调升/降', sort: true }
             , { field: 'StoreIdCode', width: 200, title: '所在仓库编号', sort: true }
             , { field: 'StoreIdCode', width: 200, title: '所在仓库编号', sort: true }
             , { field: 'StoreIdName', width: 200, title: '所在仓库名称', sort: true }
             , { field: 'StoreIdName', width: 200, title: '所在仓库名称', sort: true }
             , { field: 'UserIdMakerCode', width: 200, title: '创客编号', sort: true }
             , { field: 'UserIdMakerCode', width: 200, title: '创客编号', sort: true }