From 68f761dcdef9149f148508e5df8f1c2970934f15 Mon Sep 17 00:00:00 2001
From: chenzx <m15572880737@163.com>
Date: 星期一, 25 十一月 2024 18:50:08 +0800
Subject: [PATCH] 20241125czx接口更新
---
GasolineBlend.BLL/SubsidyDataBLL.cs | 2
GasolineBlend.Entity/GasolineBlend.Entity.csproj | 1
GasolineBlend/GasolineBlend.csproj | 1
GasolineBlend.BLL/DefaultCompanyBLL.cs | 34 +++++
GasolineBlend.DAL/ArticleDataDAL.cs | 22 ++-
GasolineBlend.DAL/GasolineBlend.DAL.csproj | 1
.vs/PolicyControl/FileContentIndex/04d3f97a-8414-4d0e-9d75-5ecea460a9b4.vsidx | 0
.vs/PolicyControl/FileContentIndex/65f4c7ec-ff52-4e7a-9fee-c640c785a1b7.vsidx | 0
GasolineBlend.DAL/DefaultCompanyDAL.cs | 70 +++++++++++
GasolineBlend/Controllers/DefaultCompanyController.cs | 97 ++++++++++++++++
GasolineBlend/Controllers/SubsidyDataController.cs | 4
GasolineBlend.DAL/PushDataDAL.cs | 16 +-
GasolineBlend/Controllers/ArticleDataController.cs | 4
GasolineBlend.Entity/DefaultCompany.cs | 50 ++++++++
.vs/PolicyControl/v17/fileList.bin | 0
GasolineBlend.BLL/GasolineBlend.BLL.csproj | 1
GasolineBlend.BLL/ArticleDataBLL.cs | 6
GasolineBlend.Entity/PushDataPage.cs | 6
18 files changed, 295 insertions(+), 20 deletions(-)
diff --git a/.vs/PolicyControl/FileContentIndex/04d3f97a-8414-4d0e-9d75-5ecea460a9b4.vsidx b/.vs/PolicyControl/FileContentIndex/04d3f97a-8414-4d0e-9d75-5ecea460a9b4.vsidx
new file mode 100644
index 0000000..0115622
--- /dev/null
+++ b/.vs/PolicyControl/FileContentIndex/04d3f97a-8414-4d0e-9d75-5ecea460a9b4.vsidx
Binary files differ
diff --git a/.vs/PolicyControl/FileContentIndex/65f4c7ec-ff52-4e7a-9fee-c640c785a1b7.vsidx b/.vs/PolicyControl/FileContentIndex/65f4c7ec-ff52-4e7a-9fee-c640c785a1b7.vsidx
new file mode 100644
index 0000000..11f12f7
--- /dev/null
+++ b/.vs/PolicyControl/FileContentIndex/65f4c7ec-ff52-4e7a-9fee-c640c785a1b7.vsidx
Binary files differ
diff --git a/.vs/PolicyControl/v17/fileList.bin b/.vs/PolicyControl/v17/fileList.bin
index 73cafb6..f1658db 100644
--- a/.vs/PolicyControl/v17/fileList.bin
+++ b/.vs/PolicyControl/v17/fileList.bin
Binary files differ
diff --git a/GasolineBlend.BLL/ArticleDataBLL.cs b/GasolineBlend.BLL/ArticleDataBLL.cs
index 426899d..3bd1c22 100644
--- a/GasolineBlend.BLL/ArticleDataBLL.cs
+++ b/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>
diff --git a/GasolineBlend.BLL/DefaultCompanyBLL.cs b/GasolineBlend.BLL/DefaultCompanyBLL.cs
new file mode 100644
index 0000000..53468e0
--- /dev/null
+++ b/GasolineBlend.BLL/DefaultCompanyBLL.cs
@@ -0,0 +1,34 @@
+锘縰sing 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);
+ }
+
+
+
+ }
+}
diff --git a/GasolineBlend.BLL/GasolineBlend.BLL.csproj b/GasolineBlend.BLL/GasolineBlend.BLL.csproj
index 3be4af3..30fc314 100644
--- a/GasolineBlend.BLL/GasolineBlend.BLL.csproj
+++ b/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" />
diff --git a/GasolineBlend.BLL/SubsidyDataBLL.cs b/GasolineBlend.BLL/SubsidyDataBLL.cs
index dbf0bd4..60e6ede 100644
--- a/GasolineBlend.BLL/SubsidyDataBLL.cs
+++ b/GasolineBlend.BLL/SubsidyDataBLL.cs
@@ -310,5 +310,7 @@
}
}
+
+
}
}
diff --git a/GasolineBlend.DAL/ArticleDataDAL.cs b/GasolineBlend.DAL/ArticleDataDAL.cs
index 8d910f4..0afddb1 100644
--- a/GasolineBlend.DAL/ArticleDataDAL.cs
+++ b/GasolineBlend.DAL/ArticleDataDAL.cs
@@ -1,6 +1,7 @@
锘縰sing 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))
{
diff --git a/GasolineBlend.DAL/DefaultCompanyDAL.cs b/GasolineBlend.DAL/DefaultCompanyDAL.cs
new file mode 100644
index 0000000..14792d9
--- /dev/null
+++ b/GasolineBlend.DAL/DefaultCompanyDAL.cs
@@ -0,0 +1,70 @@
+锘縰sing 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;
+ }
+ }
+
+ }
+}
diff --git a/GasolineBlend.DAL/GasolineBlend.DAL.csproj b/GasolineBlend.DAL/GasolineBlend.DAL.csproj
index 94426f8..0bcca27 100644
--- a/GasolineBlend.DAL/GasolineBlend.DAL.csproj
+++ b/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" />
diff --git a/GasolineBlend.DAL/PushDataDAL.cs b/GasolineBlend.DAL/PushDataDAL.cs
index b899ec8..cadf6ae 100644
--- a/GasolineBlend.DAL/PushDataDAL.cs
+++ b/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
{
diff --git a/GasolineBlend.Entity/DefaultCompany.cs b/GasolineBlend.Entity/DefaultCompany.cs
new file mode 100644
index 0000000..9a00513
--- /dev/null
+++ b/GasolineBlend.Entity/DefaultCompany.cs
@@ -0,0 +1,50 @@
+锘縰sing 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;
+ }
+ }
+ }
+}
diff --git a/GasolineBlend.Entity/GasolineBlend.Entity.csproj b/GasolineBlend.Entity/GasolineBlend.Entity.csproj
index fa34b0a..01aae95 100644
--- a/GasolineBlend.Entity/GasolineBlend.Entity.csproj
+++ b/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" />
diff --git a/GasolineBlend.Entity/PushDataPage.cs b/GasolineBlend.Entity/PushDataPage.cs
index 55d7fdd..42d53bf 100644
--- a/GasolineBlend.Entity/PushDataPage.cs
+++ b/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>
diff --git a/GasolineBlend/Controllers/ArticleDataController.cs b/GasolineBlend/Controllers/ArticleDataController.cs
index 33ff9df..2bf12c5 100644
--- a/GasolineBlend/Controllers/ArticleDataController.cs
+++ b/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,
diff --git a/GasolineBlend/Controllers/DefaultCompanyController.cs b/GasolineBlend/Controllers/DefaultCompanyController.cs
new file mode 100644
index 0000000..2c189a1
--- /dev/null
+++ b/GasolineBlend/Controllers/DefaultCompanyController.cs
@@ -0,0 +1,97 @@
+锘縰sing 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();
+ }
+ }
+
+
+
+
+ }
+}
diff --git a/GasolineBlend/Controllers/SubsidyDataController.cs b/GasolineBlend/Controllers/SubsidyDataController.cs
index fe562b5..7d24a94 100644
--- a/GasolineBlend/Controllers/SubsidyDataController.cs
+++ b/GasolineBlend/Controllers/SubsidyDataController.cs
@@ -141,7 +141,7 @@
return Error();
}
}
-
-
+
+
}
}
diff --git a/GasolineBlend/GasolineBlend.csproj b/GasolineBlend/GasolineBlend.csproj
index e3b6956..2b9be30 100644
--- a/GasolineBlend/GasolineBlend.csproj
+++ b/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" />
--
Gitblit v1.8.0