chenzx
2024-11-25 68f761dcdef9149f148508e5df8f1c2970934f15
20241125czx接口更新
12个文件已修改
6个文件已添加
315 ■■■■■ 已修改文件
.vs/PolicyControl/FileContentIndex/04d3f97a-8414-4d0e-9d75-5ecea460a9b4.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
.vs/PolicyControl/FileContentIndex/65f4c7ec-ff52-4e7a-9fee-c640c785a1b7.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
.vs/PolicyControl/v17/fileList.bin 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.BLL/ArticleDataBLL.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.BLL/DefaultCompanyBLL.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.BLL/GasolineBlend.BLL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.BLL/SubsidyDataBLL.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.DAL/ArticleDataDAL.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.DAL/DefaultCompanyDAL.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.DAL/GasolineBlend.DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.DAL/PushDataDAL.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.Entity/DefaultCompany.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.Entity/GasolineBlend.Entity.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.Entity/PushDataPage.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/ArticleDataController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/DefaultCompanyController.cs 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/SubsidyDataController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/GasolineBlend.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/PolicyControl/FileContentIndex/04d3f97a-8414-4d0e-9d75-5ecea460a9b4.vsidx
Binary files differ
.vs/PolicyControl/FileContentIndex/65f4c7ec-ff52-4e7a-9fee-c640c785a1b7.vsidx
Binary files differ
.vs/PolicyControl/v17/fileList.bin
Binary files differ
GasolineBlend.BLL/ArticleDataBLL.cs
@@ -41,12 +41,12 @@
            return new PaginatedResult<ArticleDataPage>(totalData, totalCount, totalPage);
        }
        public PaginatedResult<ArticleDataPage> GetDeclarationtimeList(string Keyword, int Time, int PageNumber, int PageSize)
        public PaginatedResult<ArticleDataPage> GetDeclarationtimeList(string Keyword, int Time, int PageNumber, int PageSize, string Region)
        {
            int totalCount = _acc.GetDeclarationtimeCount(Keyword, Time);
            int totalCount = _acc.GetDeclarationtimeCount(Keyword, Time,  Region);
            int totalPage = (int)Math.Ceiling((double)totalCount / PageSize);
            List<ArticleDataPage> totalData = _acc.GetDeclarationtimeList(Keyword, Time, PageNumber, PageSize);
            List<ArticleDataPage> totalData = _acc.GetDeclarationtimeList(Keyword, Time, PageNumber, PageSize,  Region);
            return new PaginatedResult<ArticleDataPage>(totalData, totalCount, totalPage);
        }
        /// <summary>
GasolineBlend.BLL/DefaultCompanyBLL.cs
New file
@@ -0,0 +1,34 @@
using CommonHelper;
using GasolineBlend.DAL;
using GasolineBlend.Entity;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using static GasolineBlend.Entity.DefaultCompany;
namespace GasolineBlend.BLL
{
    public class DefaultCompanyBLL
    {
        private DefaultCompanyDAL _acc = new DefaultCompanyDAL();
        public List<DefaultCompany> GetDefaultCompanyIsId(int UserId)
        {
            return _acc.GetDefaultCompanyIsId(UserId);
        }
        public bool UpdateDefaultCompany(DefaultCompany defaultCompany)
        {
            return _acc.UpdateDefaultCompany(defaultCompany);
        }
        public bool AddDefaultCompany(int UserId)
        {
            return _acc.AddDefaultCompany(UserId);
        }
    }
}
GasolineBlend.BLL/GasolineBlend.BLL.csproj
@@ -127,6 +127,7 @@
  <ItemGroup>
    <Compile Include="AccountBLL.cs" />
    <Compile Include="AccountGroupBLL.cs" />
    <Compile Include="DefaultCompanyBLL.cs" />
    <Compile Include="PushDataBLL.cs" />
    <Compile Include="OrderDataBLL.cs" />
    <Compile Include="UserPackageDataBLL.cs" />
GasolineBlend.BLL/SubsidyDataBLL.cs
@@ -310,5 +310,7 @@
                }
        
        }
    }
}
GasolineBlend.DAL/ArticleDataDAL.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
@@ -92,24 +93,29 @@
                return Count;
            }
        }
        public int GetDeclarationtimeCount(string Keyword, int Time)
        public int GetDeclarationtimeCount(string Keyword, int Time, string Region)
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = $"SELECT  COUNT(*)  from articledata WHERE articletype='申报通知' AND declarationtime IS NOT NULL  ";
                var sql = $"SELECT  COUNT(*)   from articledata a JOIN departmentdata d ON a.platform = d.department WHERE a.articletype='申报通知' AND a.declarationtime IS NOT NULL ";
                if (!string.IsNullOrEmpty(Region))
                {
                    sql += $" and a.region = '{Region}' ";
                }
                if (!string.IsNullOrEmpty(Keyword))
                {
                    sql += $" AND articletitle like '%{Keyword.Trim()}%' ";
                    sql += $" AND a.articletitle like '%{Keyword.Trim()}%' ";
                }
                if (Time != 0)
                {
                    if (Time == 7)
                    {
                        sql += $" AND declarationtime IS NOT NULL AND deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 7 DAY ";
                        sql += $" AND a.declarationtime IS NOT NULL AND a.deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 7 DAY ";
                    }
                    else if(Time == 30){
                        sql += $" AND declarationtime IS NOT NULL AND deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 30 DAY ";
                        sql += $" AND a.declarationtime IS NOT NULL AND a.deadline BETWEEN CURDATE() AND CURDATE() + INTERVAL 30 DAY ";
                    }    
                }
                int Count = connection.Query<int>(sql).FirstOrDefault();
@@ -117,11 +123,15 @@
            }
        }
        public List<ArticleDataPage> GetDeclarationtimeList( string Keyword,int Time, int PageNumber, int PageSize)
        public List<ArticleDataPage> GetDeclarationtimeList( string Keyword,int Time, int PageNumber, int PageSize ,string Region)
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = $"SELECT  *, d.region  from articledata a JOIN departmentdata d ON a.platform = d.department WHERE a.articletype='申报通知' AND a.declarationtime IS NOT NULL  ";
                if (!string.IsNullOrEmpty(Region))
                {
                    sql += $" and a.region = '{Region}' ";
                }
                if (!string.IsNullOrEmpty(Keyword))
                {
GasolineBlend.DAL/DefaultCompanyDAL.cs
New file
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommonHelper;
using Dapper;
using GasolineBlend.Entity;
using Google.Protobuf.WellKnownTypes;
using Microsoft.Office.Interop.Excel;
using MySql.Data.MySqlClient;
namespace GasolineBlend.DAL
{
    public class DefaultCompanyDAL : BaseMySQLDAL
    {
        public List<DefaultCompany> GetDefaultCompanyIsId(int UserId)
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = $"SELECT id,compose,userid,createtime FROM defaultcompany WHERE userid= '{UserId}'";
                return connection.Query<DefaultCompany>(sql).ToList();
            }
        }
        public bool UpdateDefaultCompany(DefaultCompany defaultCompany)
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = @"
               UPDATE defaultcompany
               SET
                   compose = @Compose,
                   createtime = NOW()
               WHERE userid = @UserId";
                var parameters = new
                {
                    Compose = defaultCompany.Compose,
                    UserId = defaultCompany.UserId
                };
                connection.Open(); // 打开数据库连接
                int affectedRows = connection.Execute(sql, parameters); // 执行更新操作
                return affectedRows > 0;
            }
        }
        public bool AddDefaultCompany(int UserId)
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = @"
                INSERT INTO defaultcompany (compose,createtime,userid)
                VALUES (NULL,NOW(),@UserId)";
                var parameters = new
                {
                    UserId = UserId
                };
                connection.Open(); // 打开数据库连接
                int affectedRows = connection.Execute(sql, parameters); // 执行更新操作
                return affectedRows > 0;
            }
        }
    }
}
GasolineBlend.DAL/GasolineBlend.DAL.csproj
@@ -85,6 +85,7 @@
  <ItemGroup>
    <Compile Include="AccountDAL.cs" />
    <Compile Include="AccountGroupDAL.cs" />
    <Compile Include="DefaultCompanyDAL.cs" />
    <Compile Include="PushDataDAL.cs" />
    <Compile Include="OrderDataDAL.cs" />
    <Compile Include="UserPackageDataDAL.cs" />
GasolineBlend.DAL/PushDataDAL.cs
@@ -20,7 +20,7 @@
        {
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = $"SELECT id,ispolicy,isdeclarationnotice,ispublicannouncement,islawsandregulations,isemailpush,inbox,userid,modificationtime FROM pushdata WHERE userid= '{UserId}'";
                var sql = $"SELECT id,ispolicy,isdeclarationnotice,ispublicannouncement,islawsandregulations,isemailpush,email,userid,modificationtime,region,keyword FROM pushdata WHERE userid= '{UserId}'";
                return connection.Query<PushDataPage>(sql).ToList();
            }
        }
@@ -36,10 +36,12 @@
                   ispublicannouncement = @IsPublicAnnouncement,
                   islawsandregulations = @IsLawsAndRegulations,
                   isemailpush = @IsEmailPush,
                   inbox = @Inbox,
                   email = @Email,
                   keyword = @Keyword,
                   region = @Region,
                   modificationtime = NOW()
               WHERE userid = @UserId";
                var parameters = new
                {
                    IsPolicy = pushDataPage.IsPolicy,
@@ -47,7 +49,9 @@
                    IsPublicAnnouncement = pushDataPage.IsPublicAnnouncement,
                    IsLawsAndRegulations = pushDataPage.IsLawsAndRegulations,
                    IsEmailPush = pushDataPage.IsEmailPush,
                    Inbox = pushDataPage.Inbox,
                    Email = pushDataPage.Email,
                    Keyword = pushDataPage.Keyword,
                    Region = pushDataPage.Region,
                    UserId = pushDataPage.UserId
                };
@@ -62,8 +66,8 @@
            using (IDbConnection connection = new MySqlConnection(connectionString))
            {
                var sql = @"
                INSERT INTO pushdata (ispolicy, isdeclarationnotice, ispublicannouncement, islawsandregulations, isemailpush, inbox,modificationtime,userid)
                VALUES ( 0, 0, 0,0, 0,NULL,NOW(),@UserId)";
                INSERT INTO pushdata (ispolicy, isdeclarationnotice, ispublicannouncement, islawsandregulations, isemailpush, inbox,modificationtime,region,keyword,userid)
                VALUES ( 0, 0, 0,0, 0,NULL,NOW(),NULL,NULL,@UserId)";
                var parameters = new
                {
GasolineBlend.Entity/DefaultCompany.cs
New file
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GasolineBlend.Entity
{
    public class DefaultCompany
    {
        /// <summary>
        /// 序号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 是否推送政策
        /// </summary>
        public string Compose { get; set; }
        /// <summary>
        ///用户
        /// </summary>
        public int UserId { get; set; }
        /// <summary>
        ///修改时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        public int Count { get; set; }
        /// <summary>
        /// 地区
        /// </summary>
        public string Region { get; set; }
        public string FavoriteFlag { get; set; }
        public class PaginatedResult<T>
        {
            public List<T> Data { get; set; }
            public int TotalCount { get; set; }
            public int TotalPages { get; set; }
            public PaginatedResult(List<T> totalData, int totalCount, int totalPages)
            {
                Data = totalData;
                TotalCount = totalCount;
                TotalPages = totalPages;
            }
        }
    }
}
GasolineBlend.Entity/GasolineBlend.Entity.csproj
@@ -47,6 +47,7 @@
    <Compile Include="Account.cs" />
    <Compile Include="AccountGroup.cs" />
    <Compile Include="AccountRecAge.cs" />
    <Compile Include="DefaultCompany.cs" />
    <Compile Include="PushDataPage.cs" />
    <Compile Include="OrderDataPage.cs" />
    <Compile Include="UserPackageDataPage.cs" />
GasolineBlend.Entity/PushDataPage.cs
@@ -35,7 +35,11 @@
        /// <summary>
        ///邮箱
        /// </summary>
        public string Inbox { get; set; }
        public string Email { get; set; }
        /// <summary>
        ///关键词
        /// </summary>
        public string Keyword { get; set; }
        /// <summary>
        ///用户
        /// </summary>
GasolineBlend/Controllers/ArticleDataController.cs
@@ -128,11 +128,11 @@
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult GetDeclarationtimeList(string Keyword, int Time, int PageNumber, int PageSize)
        public ActionResult GetDeclarationtimeList(string Keyword, int Time, int PageNumber, int PageSize, string Region)
        {
            try
            {
                var list = _acc.GetDeclarationtimeList(Keyword, Time, PageNumber, PageSize);
                var list = _acc.GetDeclarationtimeList(Keyword, Time, PageNumber, PageSize, Region);
                var response = new
                {
                    Data = list.Data,
GasolineBlend/Controllers/DefaultCompanyController.cs
New file
@@ -0,0 +1,97 @@
using CommonHelper;
using GasolineBlend.BLL;
using GasolineBlend.Entity;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using System.Web.Razor.Tokenizer.Symbols;
namespace GasolineBlend.Controllers
{
    public class DefaultCompanyController : BaseController
    {
        private DefaultCompanyBLL _acc = new DefaultCompanyBLL();
        /// <summary>
        ///获取推送
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult GetDefaultCompanyIsId(int UserId)
        {
            try
            {
                var list = _acc.GetDefaultCompanyIsId(UserId);
                if (list.Count == 0)
                {
                    bool isAdd = _acc.AddDefaultCompany(UserId);
                    if (!isAdd) {
                        return Error();
                    }
                    var list2 = _acc.GetDefaultCompanyIsId(UserId);
                    return SuccessNoShow(data: list2);
                }
                return SuccessNoShow(data: list);
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "获取推送 GetDefaultCompanyIsId", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
        /// <summary>
        ///修改推送
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult UpdateDefaultCompany(DefaultCompany defaultCompany)
        {
            try
            {
                bool isUpdate = _acc.UpdateDefaultCompany(defaultCompany);
                return isUpdate ? SuccessNoShow() : Error();
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "修改推送 UpdateDefaultCompany " +
                    "" +
                    "", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
        /// <summary>
        ///添加推送
        /// </summary>
        /// <param name="Keyword"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult AddDefaultCompany(int UserId)
        {
            try
            {
                bool isAdd = _acc.AddDefaultCompany(UserId);
                return isAdd ? SuccessNoShow() : Error();
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "添加智能体 AddPushData" +
                    "" +
                    "", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
    }
}
GasolineBlend/Controllers/SubsidyDataController.cs
@@ -141,7 +141,7 @@
                return Error();
            }
        }
    }
}
GasolineBlend/GasolineBlend.csproj
@@ -222,6 +222,7 @@
    <Compile Include="App_Start\FilterConfig.cs" />
    <Compile Include="App_Start\RouteConfig.cs" />
    <Compile Include="App_Start\WebExceptionFilterAttribute.cs" />
    <Compile Include="Controllers\DefaultCompanyController.cs" />
    <Compile Include="Controllers\PushDataController.cs" />
    <Compile Include="Controllers\OrderDataController.cs" />
    <Compile Include="Controllers\UserPackageDataController.cs" />