public object InitInfo() { //Dictionary<long, string> projectList = new Dictionary<long, string>(); List <Epm_Project> projectList = new List <Epm_Project>(); Epm_AdPutRecord ad = new Epm_AdPutRecord(); Dictionary <string, int> dic = new Dictionary <string, int>(); List <Epm_OilStation> oilList = new List <Epm_OilStation>(); string adUrl = ""; List <string> attendance = new List <string>(); using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(""))) { QueryCondition qc = new QueryCondition(); qc.ConditionList.Add(new ConditionExpression() { ExpName = "AdTargetNum", ExpValue = 0, ExpOperater = eConditionOperator.Equal, ExpLogical = eLogicalOperator.And }); // todo : 添加广告查询条件 var adResult = proxy.GetAdShowList(qc); if (adResult.Flag == EResultFlag.Success && adResult.Data.Any()) { ad = adResult.Data.FirstOrDefault() ?? new Epm_AdPutRecord(); var filesResult = proxy.GetBaseFiles(new List <long>() { ad.Id }); if (filesResult.Flag == EResultFlag.Success && filesResult.Data.Any()) { string type = ad.GetType().Name; var file = filesResult.Data.FirstOrDefault(p => p.TableId == ad.Id && p.TableName == type && (p.ImageType == "big" || p.ImageType == "start")); adUrl = file == null ? "" : file.Url; } } var user = CurrentUserView; QueryCondition qc1 = new QueryCondition() { PageInfo = GetPageInfo(1, false) }; qc1.PageInfo.isAllowPage = false; qc1.ConditionList = new List <ConditionExpression> { new ConditionExpression() { ExpName = "State", ExpValue = (int)ProjectState.Construction, ExpOperater = eConditionOperator.Equal, ExpLogical = eLogicalOperator.And } }; qc1.SortList.Add(new SortExpression() { SortName = "OperateTime", SortType = eSortType.Desc }); if (user != null) { var proList = proxy.GetProjectListById(user.CompanyId, user.UserId).Data; if (proList != null) { projectList = proxy.GetProjectListById(user.CompanyId, user.UserId).Data; } } //获取油站列表 var oilStationResult = proxy.GetOilStationAllList(); if (oilStationResult.Flag == EResultFlag.Success && oilStationResult.Data.Any()) { oilList = oilStationResult.Data; } //考勤设置信息 var attendanceList = proxy.GetAttendanceModel(); if (attendanceList.Flag == EResultFlag.Success && attendanceList.Data != null) { attendance = attendanceList.Data.AttendanceTimeList; } } //签到距离 string value = ConfigurationManager.AppSettings["FaceAIDistance"]; var data = new { adInfo = new { id = ad.Id, image = AppCommonHelper.SystemSetting["resourceUrl"] + "/Content/screen.jpg", url = "" }, projectList = projectList.Select(p => new { projectId = p.Id, projectName = p.Name, latitude = p.ProjectSubjectId == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value).Latitude, longitude = p.ProjectSubjectId == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value).Longitude, //latitude = "34.231696", //longitude = "108.93393", //oilStationName = GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? "" : GetOilInfo(oilList, p.ProjectSubjectId.Value).Name, distance = value ?? "0", }), waitList = new { approvalCount = 0, //dic.ContainsKey("approvalCount") ? dic["approvalCount"] : 0, unreadMsg = 0 //dic.ContainsKey("unreadMsg") ? dic["unreadMsg"] : 0 }, timedReminderList = getAttendence(attendance), sysSetting = AppCommonHelper.SystemSetting }; return(Json(APIResult.GetSuccessResult(data))); }