示例#1
0
        /// <summary>
        /// 新增数据
        /// </summary>
        public async Task <MapDto> Insert(MapInputDto input)
        {
            try
            {
                input.Id = Guid.NewGuid().ToString();
                MapEntity entity = new MapEntity
                {
                    Id                = input.Id,
                    MapName           = input.MapName,
                    MapBBox           = input.MapBBox,
                    MapPublishAddress = input.MapPublishAddress,
                    MapStatus         = input.MapStatus,
                    MapDesc           = input.MapDesc,
                    MapType           = input.MapType,
                    MapTag            = input.MapTag,
                    PublishDT         = input.PublishDT,
                    SortCode          = input.SortCode,
                    EnabledMark       = input.EnabledMark,
                    DeleteMark        = input.DeleteMark,
                    CreateUserId      = input.CreateUserId,
                    CreateUserName    = input.CreateUserId,
                    CreateDT          = DateTime.Now,
                    ModifyUserId      = input.ModifyUserId,
                    ModifyUserName    = input.ModifyUserName,
                    ModifyDate        = input.ModifyDate,
                    MapScale          = input.MapScale,
                    SpatialRefence    = input.SpatialRefence,
                    MapLegend         = input.MapLegend
                };
                ChineseConvert chn       = new ChineseConvert();
                string         mapEnName = chn.GetPinyinInitials(entity.MapName);
                string         lastIndex = (System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString());
                entity.MapEnName = mapEnName + lastIndex;
                var query = await _IMapRepository.InsertAsync(entity);

                var result = entity.MapTo <MapDto>();

                _IOperateLogAppService.WriteOperateLog(input.Id, input.ModifyUserId, 1002, 1101, 1201, 1411, "(" + input.MapName + ")");
                return(result);
            }
            catch (Exception ex)
            {
                _IOperateLogAppService.WriteOperateLog(input.Id, input.ModifyUserId, 1002, 1101, 1202, 1412, "(" + input.MapName + ")");
                throw new Exception(ex.Message);
            }
        }
示例#2
0
        /// <summary>
        /// 更新数据
        /// </summary>
        public async Task <MapDto> Update(MapInputDto input)
        {
            try
            {
                await UpdateMapBBox(input.Id);

                var entity = _IMapRepository.Get(input.Id);
                //entity.MapName = input.MapName;
                //entity.MapBBox = input.MapBBox;
                entity.MapPublishAddress = input.MapPublishAddress;
                entity.MapStatus         = input.MapStatus;
                entity.MapDesc           = input.MapDesc;
                entity.MapType           = input.MapType;
                entity.MapTag            = input.MapTag;
                entity.PublishDT         = input.PublishDT;
                entity.SortCode          = input.SortCode;
                entity.EnabledMark       = input.EnabledMark;
                entity.DeleteMark        = input.DeleteMark;
                entity.CreateUserId      = input.CreateUserId;
                entity.CreateUserName    = input.CreateUserId;
                //entity.CreateDT = input.CreateDT;
                entity.ModifyUserId   = input.ModifyUserId;
                entity.ModifyUserName = input.ModifyUserName;
                entity.ModifyDate     = DateTime.Now;
                entity.MapScale       = input.MapScale;
                entity.SpatialRefence = input.SpatialRefence;
                var query = await _IMapRepository.UpdateAsync(entity);

                var result = entity.MapTo <MapDto>();

                _IOperateLogAppService.WriteOperateLog(input.Id, input.CreateUserId, 1002, 1102, 1201, 1431, null);
                return(result);
            }
            catch (Exception ex)
            {
                _IOperateLogAppService.WriteOperateLog(input.Id, input.CreateUserId, 1002, 1102, 1202, 1432, null);
                throw new Exception(ex.Message);
            }
        }
示例#3
0
        /// <summary>
        /// 获取地图列表(通过标签,类型,名称)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public PagedResultOutput <MapDto> GetPageListByName(MapInputDto input, int PageSize, int PageIndex)
        {
            try
            {
                string mapType = input.MapType, tag = input.MapTag, name = input.MapName, mapID = "", type = "";

                if (!string.IsNullOrEmpty(tag))
                {
                    mapID = GetMultiLayerIDByTag(tag);
                }

                if (!string.IsNullOrEmpty(mapType))
                {
                    type = GetMultiChildTypeByType(mapType);
                }

                if (string.IsNullOrWhiteSpace(input.CreateUserId))
                {
                    return(null);
                }

                var mapUserData = GetDataByUserCodeAsync(input.CreateUserId, name, type, mapID).Result;

                var listMapType    = _IDataTypeRepository.GetAll();
                var listMapRefence = _IDicDataCodeRepository.GetAll();
                var listMapScale   = _IDicDataCodeRepository.GetAll();

                var query = (from l in mapUserData
                             join t in listMapType on l.MapType equals t.Id into tt
                             from de in tt.DefaultIfEmpty()
                             join r in listMapRefence on l.SpatialRefence equals r.Id into rr
                             from re in rr.DefaultIfEmpty()
                             join dt in listMapScale on l.MapScale equals dt.Id into dtt
                             from ldt in dtt.DefaultIfEmpty()
                             select new MapDto
                {
                    Id = l.Id,
                    MapName = l.MapName,
                    MapEnName = l.MapEnName,
                    MapBBox = l.MapBBox,
                    MapPublishAddress = l.MapPublishAddress,
                    MapStatus = l.MapStatus,
                    MapDesc = l.MapDesc,
                    MapType = (de == null) ? "" : de.TypeName,
                    MapTag = l.MapTag,
                    PublishDT = l.PublishDT,
                    SortCode = l.SortCode,
                    EnabledMark = l.EnabledMark,
                    DeleteMark = l.DeleteMark,
                    CreateUserId = l.CreateUserId,
                    CreateUserName = l.CreateUserName,
                    CreateDT = Convert.ToDateTime(Convert.ToDateTime(l.CreateDT).ToString("yyyy-MM-ddTHH:mm:ss")),
                    ModifyUserId = l.ModifyUserId,
                    ModifyUserName = l.ModifyUserName,
                    ModifyDate = l.ModifyDate,
                    MapScale = l.MapScale,
                    MapScaleName = (ldt == null) ? "" : ldt.CodeName,
                    SpatialRefence = l.SpatialRefence,
                    SpatialRefenceName = (re == null) ? "" : re.CodeName,
                    MaxY = l.MaxY,
                    MinY = l.MinY,
                    MinX = l.MinX,
                    MaxX = l.MaxX,
                    MapLegend = l.MapLegend,
                    MaxDegLat = "",
                    MinDegLat = "",
                    MinDegLon = "",
                    MaxDegLon = ""
                }).OrderByDescending(x => x.CreateDT);
                int count  = query.Count();
                var result = query.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();



                IReadOnlyList <MapDto> ir = new List <MapDto>();
                if (result != null && result.Count > 0)
                {
                    foreach (var dto in result)
                    {
                        dto.MapTag    = GetMultiTagNameByMapID(dto.Id);
                        dto.MaxDegLat = (dto.MaxY != null) ? ConvertBBox(Convert.ToDouble(dto.MaxY)) : "";
                        dto.MinDegLat = (dto.MinY != null) ? ConvertBBox(Convert.ToDouble(dto.MinY)) : "";
                        dto.MaxDegLon = (dto.MaxX != null) ? ConvertBBox(Convert.ToDouble(dto.MaxX)) : "";
                        dto.MinDegLon = (dto.MinX != null) ? ConvertBBox(Convert.ToDouble(dto.MinX)) : "";
                    }
                    ir = result.MapTo <List <MapDto> >();
                }

                PagedResultOutput <MapDto> outputList = new PagedResultOutput <MapDto>(count, ir);

                return(outputList);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#4
0
        /// <summary>
        /// 获取地图列表(通过标签,类型,名称)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public ListResultOutput <MapDto> GetAllListByName(MapInputDto input)
        {
            ListResultOutput <MapDto> list;

            try
            {
                string mapType = input.MapType, tag = input.MapTag, name = input.MapName, mapID = "", type = "";

                if (!string.IsNullOrEmpty(tag))
                {
                    mapID = GetMultiLayerIDByTag(tag);
                }

                if (!string.IsNullOrEmpty(mapType))
                {
                    type = GetMultiChildTypeByType(mapType);
                }

                if (string.IsNullOrWhiteSpace(input.CreateUserId))
                {
                    return(null);
                }

                var mapUserData = GetDataByUserCodeAsync(input.CreateUserId, name, type, mapID).Result;

                var listMapType    = _IDataTypeRepository.GetAll();
                var listMapRefence = _IDicDataCodeRepository.GetAll();
                var listMapScale   = _IDicDataCodeRepository.GetAll();

                var query = (from l in mapUserData
                             join t in listMapType on l.MapType equals t.Id into tt
                             from de in tt.DefaultIfEmpty()
                             join r in listMapRefence on l.SpatialRefence equals r.Id into rr
                             from re in rr.DefaultIfEmpty()
                             join dt in listMapScale on l.MapScale equals dt.Id into dtt
                             from ldt in dtt.DefaultIfEmpty()
                             select new MapDto
                {
                    Id = l.Id,
                    MapName = l.MapName,
                    MapEnName = l.MapEnName,
                    MapBBox = l.MapBBox,
                    MapPublishAddress = l.MapPublishAddress,
                    MapStatus = l.MapStatus,
                    MapDesc = l.MapDesc,
                    MapType = (de == null) ? "" : de.TypeName,
                    MapTag = l.MapTag,
                    PublishDT = l.PublishDT,
                    SortCode = l.SortCode,
                    EnabledMark = l.EnabledMark,
                    DeleteMark = l.DeleteMark,
                    CreateUserId = l.CreateUserId,
                    CreateUserName = l.CreateUserName,
                    CreateDT = l.CreateDT,
                    ModifyUserId = l.ModifyUserId,
                    ModifyUserName = l.ModifyUserName,
                    ModifyDate = l.ModifyDate,
                    MapScale = l.MapScale,
                    MapScaleName = (ldt == null) ? "" : ldt.CodeName,
                    SpatialRefence = l.SpatialRefence,
                    SpatialRefenceName = (re == null) ? "" : re.CodeName,
                    MaxY = l.MaxY,
                    MinY = l.MinY,
                    MinX = l.MinX,
                    MaxX = l.MaxX,
                    MapLegend = l.MapLegend,
                    MaxDegLat = "",
                    MinDegLat = "",
                    MinDegLon = "",
                    MaxDegLon = ""
                }).OrderByDescending(x => x.CreateDT);

                var result = query.ToList();

                list = new ListResultOutput <MapDto>(result.MapTo <List <MapDto> >());

                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }