| | |
| | | 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> |
| New file |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | <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" /> |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Drawing.Printing; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | 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(); |
| | |
| | | } |
| | | } |
| | | |
| | | 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)) |
| | | { |
| New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | <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" /> |
| | |
| | | { |
| | | 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(); |
| | | } |
| | | } |
| | |
| | | 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, |
| | |
| | | IsPublicAnnouncement = pushDataPage.IsPublicAnnouncement, |
| | | IsLawsAndRegulations = pushDataPage.IsLawsAndRegulations, |
| | | IsEmailPush = pushDataPage.IsEmailPush, |
| | | Inbox = pushDataPage.Inbox, |
| | | Email = pushDataPage.Email, |
| | | Keyword = pushDataPage.Keyword, |
| | | Region = pushDataPage.Region, |
| | | UserId = pushDataPage.UserId |
| | | }; |
| | | |
| | |
| | | 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 |
| | | { |
| New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <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" /> |
| | |
| | | /// <summary> |
| | | ///邮箱 |
| | | /// </summary> |
| | | public string Inbox { get; set; } |
| | | public string Email { get; set; } |
| | | /// <summary> |
| | | ///关键词 |
| | | /// </summary> |
| | | public string Keyword { get; set; } |
| | | /// <summary> |
| | | ///用户 |
| | | /// </summary> |
| | |
| | | /// <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, |
| New file |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | <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" /> |