示例#1
0
        public ActionResult SingelSearch(string guid = null, string searchInfo = null)
        {
            CheckTime();
            QgOrgCodeEntity qgCrawlerEntity = null;

            if (string.IsNullOrWhiteSpace(guid) && string.IsNullOrWhiteSpace(searchInfo))
            {
                ViewBag.Guid = Guid.NewGuid();
            }
            else
            {
                ViewBag.Guid = guid;

                List <string> companyList = new List <string> {
                    searchInfo
                };
                TaskEntity taskEntity = new TaskEntity();
                taskEntity.TaskType       = EnumTaskType.QgCrawler;
                taskEntity.TaskName       = $"单个任务[{DateTime.Now.ToString("G")}]";
                taskEntity.Unique         = Conv.ToGuid(guid);
                taskEntity.TaskStateDicId = 2;
                taskEntity.TaskNum        = 1;
                taskEntity.CreateTime     = DateTime.Now;
                taskEntity.IsSingelSearch = true;
                new TaskDomain().Add(taskEntity);

                var tasklist = Crawler.QgOrgCode.TaskList.GetInstance();
                tasklist.AddTask(companyList);
                new QgCrawler(taskEntity).RunCrawler(tasklist, 1);

                qgCrawlerEntity = new QgOrgCodeDomain().Get(t => t.companyName == searchInfo && t.jgmc != null).FirstOrDefault();
            }
            return(View(qgCrawlerEntity));
        }
示例#2
0
        public ActionResult Export(TaskEntity model, bool isOptimize)
        {
            var crawlerlists = new QgOrgCodeDomain().Get(t => t.TaskGuid == model.Unique).ToList();

            if (crawlerlists.Count < 1)
            {
                return(Content("<script>alert('未找到内容');</script>"));
            }
            var bytes = crawlerlists.ListToExcel(isOptimize);

            return(File(bytes, "application/vnd.ms-excel",
                        "导出全国组织机构采集信息[" + DateTime.Now.ToString("yyyy-M-d dddd") + "].xls"));
        }
示例#3
0
        public ActionResult CheckGoGather(TaskEntity model)
        {
            var searchNum = new QgOrgCodeDomain().Get(t => t.TaskGuid == model.Unique).Count;

            return(Json(new { state = "doing", num = searchNum }));
        }