From 0c7e6deb5e426a53ce095ddff808168c26215d83 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 20 六月 2025 12:55:40 +0800
Subject: [PATCH] 提交
---
zhengcaioa/zhengcaioa/Controllers/ProjectController.cs | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 336 insertions(+), 3 deletions(-)
diff --git a/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs b/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs
index 2ce14a0..a2d268f 100644
--- a/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs
@@ -17,6 +17,9 @@
using System.IdentityModel.Tokens.Jwt;
using CommonToolsCore;
using System.Transactions;
+using DTO.WebCrawler;
+using System.Net.Http.Headers;
+using Microsoft.Extensions.Configuration;
namespace zhengcaioa.Controllers
{
@@ -32,13 +35,14 @@
private readonly IFiOrderrecievemoneyService _fiOrderrecievemoneyService;
private readonly IAreaService _areaService;
private readonly IPltPageService _pltPageService;
-
+ private readonly IConfiguration _configuration;
public ProjectController(ILogger<ProjectController> logger, IProjectService projectService, ILiaotianService liaotianService,IIntentionCustomerService intentionCustomerService, IUserService userService
, ICooperatecustomCustomerService cooperatecustomCustomerService
, ISysBaimingdanService sysBaimingdanService
, IFiOrderrecievemoneyService fiOrderrecievemoneyService
, IAreaService areaService
- , IPltPageService pltPageService)
+ , IPltPageService pltPageService
+ , IConfiguration configuration)
{
_logger = logger;
_projectService = projectService;
@@ -50,6 +54,7 @@
_fiOrderrecievemoneyService = fiOrderrecievemoneyService;
_areaService = areaService;
_pltPageService = pltPageService;
+ _configuration = configuration;
}
[CheckLogin]
public IActionResult Index()
@@ -493,6 +498,13 @@
projectDTO.Fbyy = Fbyy.TextContent.Trim();
projectDTO.Fblx = "鍋滄璇勫";
}
+ if (Number != null && Number.TextContent.Contains("缁堟鍘熷洜"))
+ {
+ var Fbyy = Number.QuerySelector("span");
+ projectDTO.Fbyy = Fbyy.TextContent.Trim();
+ projectDTO.Fblx = "鍋滄璇勫";
+ }
+
}
var Caigourennames = cDocumet.QuerySelectorAll("span").Where(m => m.Id == "_notice_content_noticePurchase-purchaserOrgName");
if (Caigourennames != null && Caigourennames.ToList().Count > 0)
@@ -960,7 +972,7 @@
{
//string SecurityKey = _configuration.GetSection("SecurityKey").Value;
var keyId = headers["Authorization"].FirstOrDefault();
- if (string.IsNullOrEmpty("keyId"))
+ if (string.IsNullOrEmpty(keyId))
{
returnMsg.code = 2;
returnMsg.error = "娌℃湁鑾峰彇鍒版潈闄愪俊鎭�";
@@ -1362,5 +1374,326 @@
return new JsonResult(resultEntity);
}
+
+
+
+
+ [CheckLogin]
+ public IActionResult indexZhengfuProject()
+ {
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ List<ActionEntity> actionlist = new List<ActionEntity>();
+ //ActionEntity actionEntity = new ActionEntity();
+ //actionEntity.OpenType = 0;
+ //actionEntity.ActionUrl = "";
+ //actionEntity.ActionFun = "Search";
+ //actionEntity.PageIco = "fa fa-search";
+ //actionEntity.ActionName = "鏌ヨ";
+ //actionlist.Add(actionEntity);
+ //ActionEntity actionEntity1 = new ActionEntity();
+ //actionEntity1.OpenType = 0;
+ //actionEntity1.ActionUrl = "";
+ //actionEntity1.ActionFun = "Add";
+ //actionEntity1.PageIco = "fa fa-plus";
+ //actionEntity1.ActionName = "鏂板";
+ //actionlist.Add(actionEntity1);
+ var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/Project/indexZhengfuProject");
+ var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList();
+ if (pageEntities1.Count(x => x.PageShortcut == "Search") <= 0)
+ {
+ ActionEntity actionEntity = new ActionEntity();
+ actionEntity.OpenType = 0;
+ actionEntity.ActionUrl = "";
+ actionEntity.ActionFun = "Search";
+ actionEntity.PageIco = "fa fa-search";
+ actionEntity.ActionName = "鏌ヨ";
+ actionlist.Add(actionEntity);
+
+ ViewData["Creater11"] = curentuser.Id;
+ }
+ foreach (var pageEntity in pageEntities1)
+ {
+ ActionEntity actionEntity1 = new ActionEntity();
+ actionEntity1.OpenType = pageEntity.OpenType;
+ actionEntity1.ActionUrl = "";
+ actionEntity1.ActionFun = pageEntity.PageShortcut;
+ actionEntity1.PageIco = pageEntity.PageIco;
+ actionEntity1.ActionName = pageEntity.PageName;
+ actionlist.Add(actionEntity1);
+ }
+
+ ViewData["ActionInfo"] = actionlist;
+ ViewBag.ProjectDropDown = _projectService.AllcgfsDropDown().Select(x => new { code = x.Value, label = x.Text }).ToList();
+ //ViewBag.flbx = _liaotianService.GetSYScode("Project", "flbx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+ var areaDTOs = _projectService.Getsheng().ToList();
+ foreach (var areaDTO in areaDTOs)
+ {
+ if (areaDTO.CodeId == "510000")
+ {
+ areaDTOs.Remove(areaDTO);
+ break;
+ }
+ }
+ var areaDTOsic = new Area();
+ areaDTOsic.CodeId = "510000";
+ areaDTOsic.Name = "鍥涘窛鐪�";
+ areaDTOsic.ParentId = "0 ";
+ areaDTOs.Insert(1, areaDTOsic);
+ ViewBag.ShengDropDown = areaDTOs.Select(x => new { code = x.CodeId, label = x.Name }).ToList();
+
+ ViewBag.Creater = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList();
+
+
+
+ ViewBag.gglx = _liaotianService.GetSYScode("zhengfu_Project", "gglx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+ ViewBag.cgfs = _liaotianService.GetSYScode("zhengfu_Project", "cgfs").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+
+
+ ViewBag.Baomingtimebegin = DateTime.Now.AddMonths(-6).ToString("yyyy-MM-dd");
+ ViewBag.Baomingtimeend = DateTime.Now.ToString("yyyy-MM-dd");
+
+
+
+
+ return View();
+ }
+
+ [CheckLogin]
+ public string GetZhengfuProjectList(ZhengfuProjectDTOSearch search)
+ {
+ //JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
+ return JsonConvert.SerializeObject(_projectService.SearchByPagingCaigougonggao(search));
+ }
+
+
+
+ public IActionResult ADDZhengfuProject(string id = null)
+ {
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/Project/indexZhengfuProject");
+ var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList();
+ ViewData["ActionInfo2"] = pageEntities2;
+ ZhengfuProjectDTO zhengfuProjectDTO = new ZhengfuProjectDTO();
+ if (!String.IsNullOrEmpty(id))
+ {
+ zhengfuProjectDTO = _projectService.GetZhengfuProjectDTO(id);
+
+
+
+
+
+ }
+ else
+ {
+ zhengfuProjectDTO.Sheng = "510000";
+ zhengfuProjectDTO.City = "510100";
+ zhengfuProjectDTO.RegionCode = "510107";
+ zhengfuProjectDTO.NoticeTime = DateTime.Now;
+ zhengfuProjectDTO.Gglx = "02";
+ //zhengfuProjectDTO.NoticeTime = DateTime.Now;
+ //zhengfuProjectDTO.NoticeTime = DateTime.Now;
+ }
+
+
+ var areaDTOs = _projectService.Getsheng().ToList();
+ foreach (var areaDTO in areaDTOs)
+ {
+ if (areaDTO.CodeId == "510000")
+ {
+ areaDTOs.Remove(areaDTO);
+ break;
+ }
+ }
+ var areaDTOsic = new Area();
+ areaDTOsic.CodeId = "510000";
+ areaDTOsic.Name = "鍥涘窛鐪�";
+ areaDTOsic.ParentId = "0 ";
+ areaDTOs.Insert(1, areaDTOsic);
+ var sheng = areaDTOs;
+ var shi = _projectService.Getshi(zhengfuProjectDTO.Sheng);
+ var quxian = _projectService.Getquxian(zhengfuProjectDTO.City);
+
+ ViewBag.gglx = _liaotianService.GetSYScode("zhengfu_Project", "gglx");
+ ViewBag.cgfs = _liaotianService.GetSYScode("zhengfu_Project", "cgfs");
+ ViewBag.hyfl = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl");
+
+ ViewBag.sheng = sheng;
+ ViewBag.shi = shi;
+ ViewBag.quxian = quxian;
+ ViewData.Model = zhengfuProjectDTO;
+ return View();
+ }
+
+
+
+ /// <summary>
+ /// 淇濆瓨
+ /// </summary>
+ /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
+ /// <returns></returns>
+ ///
+ [CheckLogin]
+ [HttpPost]
+ public string SaveZhengfuProject(ZhengfuProjectDTO data)
+ {
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ data.RecStatus = "A";
+ if (String.IsNullOrEmpty(data.Id))
+ {
+ data.Creater = curentuser.Id;
+ data.Createtime = DateTime.Now;
+ }
+ if (string.IsNullOrWhiteSpace(data.Content))
+ {
+ data.Content = data.Content1;
+ }
+ data.Shorttitle = data.Title;
+ data.Modifier = curentuser.Id;
+ data.Modifytime = DateTime.Now;
+ ResultEntity resultEntity = new ResultEntity();
+ resultEntity.Result = false;
+
+ resultEntity = _projectService.saveZhengfuProjectDTO(data);
+ if (resultEntity.Result)
+ {
+ var areaDTOs = _areaService.GetList();
+
+ string api_domain = _configuration.GetSection("Elasticsearchurl").Value;
+ string url = $"{api_domain}/webcrawler/_doc/" + data.Id;
+ string result = string.Empty;
+ Uri postUrl = new Uri(url);
+ eswebcrawler eswebcrawler1 = new eswebcrawler();
+ eswebcrawler1.Id = data.Id;
+ eswebcrawler1.noticeTime = data.NoticeTime.ToString("yyyy-MM-dd HH:mm:ss");
+ eswebcrawler1.openTenderTime = data.OpenTenderTime.HasValue ? data.OpenTenderTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : null;
+ eswebcrawler1.sheng = data.Sheng;
+ if (!string.IsNullOrWhiteSpace(data.Sheng))
+ {
+ var areaDTO = areaDTOs.Where(x => x.CodeId == data.Sheng).FirstOrDefault();
+ if (areaDTO != null)
+ {
+ eswebcrawler1.shengName = areaDTO.Name;
+ }
+ }
+
+ eswebcrawler1.city = data.City;
+ if (!string.IsNullOrWhiteSpace(data.City))
+ {
+ var areaDTO = areaDTOs.Where(x => x.CodeId == data.City).FirstOrDefault();
+ if (areaDTO != null)
+ {
+ eswebcrawler1.cityName = areaDTO.Name;
+ }
+ }
+ eswebcrawler1.regionCode = data.RegionCode;
+ if (!string.IsNullOrWhiteSpace(data.RegionCode))
+ {
+ var areaDTO = areaDTOs.Where(x => x.CodeId == data.RegionCode).FirstOrDefault();
+ if (areaDTO != null)
+ {
+ eswebcrawler1.regionName = areaDTO.Name;
+ }
+ }
+
+ eswebcrawler1.cgfs = data.Cgfs;
+ if (!string.IsNullOrWhiteSpace(data.Cgfs))
+ {
+ var sysCodeDtl = _liaotianService.GetSYScode("zhengfu_Project", "cgfs").Where(x => x.CodeSn == data.Cgfs).FirstOrDefault();
+ if (sysCodeDtl != null)
+ {
+ eswebcrawler1.cgfsName = sysCodeDtl.Comments;
+ }
+ }
+
+
+ eswebcrawler1.gglx = data.Gglx;
+ if (!string.IsNullOrWhiteSpace(data.Gglx))
+ {
+ var sysCodeDtl = _liaotianService.GetSYScode("zhengfu_Project", "gglx").Where(x => x.CodeSn == data.Gglx).FirstOrDefault();
+ if (sysCodeDtl != null)
+ {
+ eswebcrawler1.gglxName = sysCodeDtl.Comments;
+ }
+ }
+ eswebcrawler1.openTenderCode = data.OpenTenderCode;
+ eswebcrawler1.title = data.Title;
+ eswebcrawler1.shorttitle = data.Shorttitle;
+ eswebcrawler1.pageurl = data.Pageurl;
+ eswebcrawler1.pingmu = data.Pingmu;
+ eswebcrawler1.pingmuName = "";
+ eswebcrawler1.purchaser = data.Purchaser;
+ eswebcrawler1.budget = data.Budget.HasValue ? data.Budget.Value.ToString() : "";
+ eswebcrawler1.agency = data.Agency;
+ eswebcrawler1.agencyCode = data.AgencyCode;
+ eswebcrawler1.modifyTime = data.Modifytime.ToString("yyyy-MM-dd HH:mm:ss");
+
+ string requestJson = JsonConvert.SerializeObject(eswebcrawler1);
+
+ using (HttpContent httpContent = new StringContent(requestJson))
+ {
+ httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+ using (HttpClient httpClient = new HttpClient())
+ {
+ httpClient.Timeout = TimeSpan.FromSeconds(60);
+ HttpResponseMessage responseMessage = httpClient.PutAsync(postUrl, httpContent).Result;
+ result = responseMessage.Content.ReadAsStringAsync().Result;
+ }
+
+ }
+
+ Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(result);
+
+ if (jobject["error"] == null && jobject["_shards"]["successful"].ToString() == "1")
+ {
+
+ }
+ else
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "淇濆瓨鏁版嵁搴撳嚭閿欙紒";
+
+ }
+ }
+
+
+
+
+
+
+ return JsonConvert.SerializeObject(resultEntity);
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇椤圭洰鏄惁宸茬粡褰曞叆
+ /// </summary>
+ /// <param name="shengid">甯俰d</param>
+ /// <returns></returns>
+ [CheckLogin]
+ public string getPageurl(string Pageurl, string Id)
+ {
+ var quxian = _projectService.GetZhengfuProjectDTOByPageurl(Pageurl, Id);
+
+ return JsonConvert.SerializeObject(quxian);
+
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇椤圭洰鏄惁宸茬粡褰曞叆
+ /// </summary>
+ /// <param name="shengid">甯俰d</param>
+ /// <returns></returns>
+ [CheckLogin]
+ public string getTitle(string Title, string Id, DateTime? NoticeTime)
+ {
+ var quxian = _projectService.GetZhengfuProjectDTOByTitle(Title, Id, NoticeTime);
+
+ return JsonConvert.SerializeObject(quxian);
+
+ }
}
}
--
Gitblit v1.9.1