using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.Mvc;
|
using CommonHelper;
|
using GasolineBlend.BLL;
|
using GasolineBlend.Entity;
|
using GasolineBlend.Filter;
|
using Pissa.Service.DbService;
|
using Operator = NPOI.Util.Operator;
|
|
|
namespace GasolineBlend.Controllers
|
{
|
public class PatentSearchController:BaseController
|
{
|
private PatentSearchBLL _acc = new PatentSearchBLL();
|
private SysService _sysService = new SysService();
|
|
/// <summary>
|
/// 简单搜索
|
/// </summary>
|
/// <param name="keyWord"></param>
|
/// <param name="sortFields"></param>
|
/// <param name="keyWordField"></param>
|
/// <param name="pageNo"></param>
|
/// <param name="pageSize"></param>
|
/// <returns></returns>
|
[LoginChecked()]
|
[HttpPost]
|
public ActionResult GetPatentList(string keyWord, List<SortFields> sortFields, string keyWordField="", int pageNo=1,int pageSize=10)
|
{
|
try
|
{
|
PatentSearchAll patentSearchAll = new PatentSearchAll();
|
patentSearchAll.keyword = keyWord;
|
patentSearchAll.keywordField = keyWordField;
|
patentSearchAll.sortFields = sortFields;
|
patentSearchAll.pageNo = pageNo;
|
patentSearchAll.pageSize = pageSize;
|
var list = _acc.GetPatentSearchResult(patentSearchAll);
|
if (list != null && list.success)
|
{
|
var log = new SysPatentSearchLog();
|
log.UserId = OperatorProvider.Instance.Current.UserId;
|
log.Keyword = patentSearchAll.keyword;
|
log.KeywordField = patentSearchAll.ToJson();
|
log.SearchType = "智能搜索";
|
_sysService.AddPatentSearchLog(log);
|
}
|
return !list.success ? Error("获取智能搜索专利列表失败!"+list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取智能搜索专利列表失败 GetPatentList", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
/// 智能/高级搜索
|
/// </summary>
|
/// <param name="patentSearchAdvance"></param>
|
/// <returns></returns>
|
|
[LoginChecked()]
|
[HttpPost]
|
public ActionResult GetPatentListbyAdvance(PatentSearchAdvance patentSearchAdvance)
|
{
|
try
|
{
|
var list = _acc.GetAdvanceSearchResult(patentSearchAdvance);
|
if (list != null && list.success)
|
{
|
var log = new SysPatentSearchLog();
|
log.UserId = OperatorProvider.Instance.Current.UserId;
|
log.Keyword = "";
|
log.KeywordField = "";//待优化patentSearchAdvance.ToJson();
|
log.SearchType = "高级搜索";
|
_sysService.AddPatentSearchLog(log);
|
}
|
return !list.success ? Error("获取高级搜索专利列表失败!" + list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取高级搜索专利列表失败 GetPatentListbyAdvance", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
/// 获取专利详情
|
/// </summary>
|
/// <param name="id"></param>
|
/// <returns></returns>
|
[LoginChecked()]
|
[HttpGet]
|
public ActionResult GetPatentListbyId(string id)
|
{
|
try
|
{
|
PatentSearchDetail patentSearchDetail=new PatentSearchDetail();
|
patentSearchDetail.id = id;
|
var list = _acc.GetDetailSearchResult(patentSearchDetail);
|
return !list.success ? Error("获取专利详情失败!" + list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取专利详情失败 GetPatentListbyId", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
/// 批量搜索
|
/// </summary>
|
/// <param name="content"></param>
|
/// <param name="keywordField"></param>
|
/// <param name="sortFields"></param>
|
/// <param name="pageNo"></param>
|
/// <param name="pageSize"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult GetPatentListbyPatch(string content,string keywordField,List<SortFields> sortFields, int pageNo = 1, int pageSize = 10)
|
{
|
try
|
{
|
PatentSearchAll patentSearchAll = new PatentSearchAll();
|
patentSearchAll.content=content.Replace(",",",").Replace(";", ";");
|
patentSearchAll.keywordField = keywordField;
|
patentSearchAll.sortFields = sortFields;
|
patentSearchAll.pageNo = pageNo;
|
patentSearchAll.pageSize = pageSize;
|
var list = _acc.GetPatchSearchResult(patentSearchAll);
|
return !list.success ? Error("获取批量搜索专利列表失败!" + list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取批量搜索专利列表失败 GetPatentListbyPatch", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
/// 获取专利列表相关数据
|
/// </summary>
|
/// <param name="patentSearchCount"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult GetPatentListCount(PatentSearchCount patentSearchCount)
|
{
|
try
|
{
|
var list = _acc.GetPatentCountResult(patentSearchCount);
|
return !list.success ? Error("获取专利列表相关数据失败!" + list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取专利列表相关数据失败 GetPatentListCount", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
/// 获取特色专利分类列表
|
/// </summary>
|
/// <returns></returns>
|
[LoginChecked(false)]
|
[HttpGet]
|
public ActionResult GetSpePatentTypeList()
|
{
|
try
|
{
|
var list = _acc.GetSpePatentTypeList();
|
return !list.success ? ErrorNoShow("获取特色专利分类列表失败!" + list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取特色专利分类列表失败 GetSpePatentTypeList", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
/// 专利下载(待完善)
|
/// </summary>
|
/// <param name="keyWord"></param>
|
/// <param name="keyWordField"></param>
|
/// <param name="startNo"></param>
|
/// <param name="endNo"></param>
|
/// <returns></returns>
|
[LoginChecked()]
|
[HttpPost]
|
public ActionResult GetPatentDownload(string keyWord, string keyWordField = "", int startNo = 1, int endNo = 10)
|
{
|
try
|
{
|
PatentSearchAll patentSearchAll = new PatentSearchAll();
|
patentSearchAll.keyword = keyWord;
|
patentSearchAll.keywordField = keyWordField;
|
patentSearchAll.pageNo = 1;
|
patentSearchAll.pageSize = endNo;
|
var list = _acc.GetPatentSearchResult(patentSearchAll);
|
//if (list != null && list.success)
|
//{
|
//
|
//}
|
return !(list != null && list.success) ? Error("下载智能搜索专利列表失败!" + list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "下载智能搜索专利列表失败 GetPatentDownload", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
|
/// <summary>
|
/// 查询搜索记录(待完善)
|
/// </summary>
|
/// <param name="pageNo"></param>
|
/// <param name="pageSize"></param>
|
/// <param name="searchType"></param>
|
/// <returns></returns>
|
[LoginChecked()]
|
[HttpPost]
|
public ActionResult GetPatentSearchLog(int pageNo, int pageSize,string searchType="")
|
{
|
var userId = OperatorProvider.Instance.Current.UserId;
|
var page = _sysService.GetPatentSearchLog(userId, pageNo, pageSize,searchType);
|
return Success(data: page);
|
}
|
|
/// <summary>
|
/// 法律搜索(暂时不用)
|
/// </summary>
|
/// <param name="lawStatus"></param>
|
/// <param name="pageNo"></param>
|
/// <param name="pageSize"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public ActionResult GetPatentListbyLaw(string lawStatus, int pageNo = 1, int pageSize = 10)
|
{
|
try
|
{
|
PatentSearchAll patentSearchAll = new PatentSearchAll();
|
patentSearchAll.lawStatus = lawStatus;
|
patentSearchAll.keywordField = "";
|
patentSearchAll.pageNo = pageNo;
|
patentSearchAll.pageSize = pageSize;
|
var list = _acc.GetLawSearchResult(patentSearchAll);
|
return !list.success ? Error("获取法律搜索专利列表失败!" + list.message) : SuccessNoShow(data: list.result);
|
}
|
catch (Exception e)
|
{
|
LogHelper.Write(Level.Error, "获取法律搜索专利列表失败 GetPatentListbyLaw", e, OperatorProvider.Instance.Current.LoginName);
|
return Error();
|
}
|
}
|
}
|
}
|