Browse Source

签证资料查询,增删改方法及对应的dto,view

wangh 1 year ago
parent
commit
e27add5d02

+ 156 - 2
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1,4 +1,6 @@
 
+using OASystem.Infrastructure.Repositories.System;
+
 namespace OASystem.API.Controllers
 {
     /// <summary>
@@ -15,10 +17,12 @@ namespace OASystem.API.Controllers
         private readonly ThreeCodeRepository _ThreeCodeRep;
         private readonly HotelDataRepository _hotelDataRep;
         private readonly ResItemInfoRepository _resItemInfoRep;
+        private readonly SetDataRepository _setDataRepository;
+        private readonly CountryFeeRepository _countryFeeRep;
 
         public ResourceController(IMapper mapper, IConfiguration config, CarDataRepository carDataRep,
             LocalGuideDataRepository localGuideDataRep, ThreeCodeRepository threeCodeRep,
-            HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep)
+            HotelDataRepository hotelDataRep, ResItemInfoRepository resItemInfoRep, SetDataRepository setDataRepository, CountryFeeRepository countryFeeRep)
         {
             _mapper = mapper;
             _config = config;
@@ -27,7 +31,35 @@ namespace OASystem.API.Controllers
             _ThreeCodeRep = threeCodeRep;
             _hotelDataRep = hotelDataRep;
             _resItemInfoRep = resItemInfoRep;
+            _setDataRepository = setDataRepository;
+            _countryFeeRep = countryFeeRep;
         }
+        #region 数据类型资料
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> QuerySetData(SetDataDto dto)
+        {
+            try
+            {
+                if (dto.DataType == 0)
+                {
+                    return Ok(JsonView(false, "请传类型Id!"));
+                }
+                var setData = _setDataRepository.QueryDto<Sys_SetData, SetDataView>(s => s.STid == dto.DataType).ToList();
+                if (setData.Count == 0)
+                {
+                    return Ok(JsonView(false, "暂无数据!"));
+                }
+                return Ok(JsonView(true, "查询成功!", setData));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+        }
+        #endregion
+
         #region 车公司资料板块
 
         /// <summary>
@@ -279,7 +311,7 @@ namespace OASystem.API.Controllers
                         data.Add(Local);
                     }
                 }
-                return Ok(JsonView(true, "查询成功", LocalGuide));
+                return Ok(JsonView(true, "查询成功", data));
             }
             catch (Exception)
             {
@@ -587,6 +619,126 @@ namespace OASystem.API.Controllers
         }
         #endregion
 
+        #region 签证费用资料
+        /// <summary>
+        /// 签证费用资料查询
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> QueryCountryFeeCost(DtoBase dto)
+        {
+            try
+            {
+                if (dto.PortType == 1)
+                {
+                    var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
+                    if (CountryFee.Count == 0)
+                    {
+                        return Ok(JsonView(false, "暂无数据!"));
+                    }
+                    CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
+                    return Ok(JsonView(true, "查询成功", CountryFee));
+                }
+                else if (dto.PortType == 2)
+                {
+                    var CountryFee = _countryFeeRep.QueryDto<Res_CountryFeeCost, CountryFeeCostView>().ToList();
+                    if (CountryFee.Count == 0)
+                    {
+                        return Ok(JsonView(false, "暂无数据!"));
+                    }
+                    CountryFee = CountryFee.OrderByDescending(s => s.CreateTime).ToList();
+                    return Ok(JsonView(true, "查询成功", CountryFee));
+                }
+                else
+                {
+                    return Ok(JsonView(false, "请传入PortType参数!1:Web,2:Android,3:IOS"));
+                }
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+           
+        }
+
+        /// <summary>
+        /// 签证费用资料操作(Status:1.新增,2.修改)
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> OperationCountryFeeCost(OperationCountryFeeCostDto dto)
+        {
+            try
+            {
+                if (dto.VisaContinent == "")
+                {
+                    return Ok(JsonView(false, "请检查州名是否填写!"));
+                }
+                if (dto.VisaCountry == "")
+                {
+                    return Ok(JsonView(false, "请检查国家名是否填写!"));
+                }
+                if (dto.VisaTime == "1")
+                {
+                    return Ok(JsonView(false, "请检一般签证时间是否填写正确!"));
+                }
+                if (dto.UrgentTime == "1")
+                {
+                    return Ok(JsonView(false, "请检加急时间是否填写正确!"));
+                }
+                if (dto.VisaPrice == 0)
+                {
+                    return Ok(JsonView(false, "请检查签证费用是否填写正确,小数点后可1到2位!"));
+                }
+                if (dto.VisaPrice == 1)
+                {
+                    return Ok(JsonView(false, "请检查签证加急费用是否填写正确,小数点后可1到2位!"));
+                }
+                Result result = await _countryFeeRep.OperationCountryFeeCost(dto);
+                if (result.Code != 0)
+                {
+                    return Ok(JsonView(false, result.Msg));
+                }
+                return Ok(JsonView(true, result.Msg));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+
+        }
+
+        /// <summary>
+        /// 签证费用资料操作(删除)
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> DelCountryFeeCost(DelCountryFeeCostDto dto)
+        {
+            try
+            {
+                var res = await _countryFeeRep.SoftDeleteByIdAsync<Res_CountryFeeCost>(dto.Id.ToString(), dto.DeleteUserId);
+                if (!res)
+                {
+                    return Ok(JsonView(false, "删除失败"));
+                }
+                return Ok(JsonView(true, "删除成功!"));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+        }
+        #endregion
+
         #region 物料信息、供应商维护
         #region 供应商
         /// <summary>
@@ -831,4 +983,6 @@ namespace OASystem.API.Controllers
         #endregion
         #endregion
     }
+
+   
 }

+ 2 - 0
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -162,6 +162,8 @@ namespace OASystem.API.Controllers
                 throw;
             }
         }
+
+       
         #endregion
 
         #region 企业操作

+ 4 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -85,6 +85,10 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<Res_HotelData, HotelDataView>();
             CreateMap<OperationHotelDto, Res_HotelData>();
             #endregion
+            #region 签证费用资料
+            CreateMap<Res_CountryFeeCost, CountryFeeCostView>();
+            CreateMap<OperationCountryFeeCostDto, Res_CountryFeeCost>();
+            #endregion
             #region 物料供应商
             CreateMap<Edit_ResItemVendorDto, Res_ItemVendor>()
                  .ForMember(dest => dest.Address, opt => opt.MapFrom(src => src.VendorAddress))

+ 169 - 0
OASystem/OASystem.Domain/Dtos/Resource/CountryFeeCostDto.cs

@@ -0,0 +1,169 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Resource
+{
+    public class OperationCountryFeeCostDto
+    {
+        /// <summary>
+        /// 操作状态
+        /// 1 添加 
+        /// 2 修改 
+        /// </summary>
+        public int Status { get; set; }
+        /// <summary>
+        /// 编号
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 洲名
+        /// </summary>
+        public string VisaContinent { get; set; }
+
+        /// <summary>
+        /// 国家名
+        /// </summary>
+        public string VisaCountry { get; set; }
+
+        /// <summary>
+        /// 是否免签 0:是 1:否
+        /// </summary>
+        public int IsVisaExemption { get; set; }
+        /// <summary>
+        /// 是否落地签 0:是 1:否
+        /// </summary>
+        public int IsVisaOnArrival { get; set; }
+        /// <summary>
+        /// 是否电子签 0:是 1:否
+        /// </summary>
+        public int IsElectronicSignature { get; set; }
+
+        private decimal visaPrice;
+        /// <summary>
+        /// 签证费用
+        /// </summary>
+        public decimal VisaPrice
+        {
+            get { return visaPrice; }
+            set
+            {
+                Regex reg = new Regex(@"[^0-9]{1,17}([.]{1}[^0-9]{1,4})?$");
+                if (!reg.IsMatch(value.ToString()))
+                {
+                    visaPrice = Convert.ToDecimal(value);
+                }
+                else
+                {
+                    visaPrice = 0;
+                }
+            }
+        }
+
+
+        /// <summary>
+        /// 签证费用描述
+        /// </summary>
+        public string VisaPriceDesc { get; set; }
+
+        /// <summary>
+        /// 签证类型 大公务/小公务/大小公务同时免签
+        /// </summary>
+        public string VisaType { get; set; }
+
+        private string visaTime;
+        /// <summary>
+        /// 一般签证时间
+        /// </summary>
+        public string VisaTime 
+        { 
+            get { return visaTime; }
+            set
+            {
+                int s = -1;
+                if (int.TryParse(value,out s))
+                {
+                    visaTime = value;
+                }
+                else
+                {
+                    ugentTime = "1";
+                }
+            }
+        }
+
+        /// <summary>
+        /// 签证是否加急 0:加急  1: 不加急
+        /// </summary>
+        public int IsUrgent { get; set; }
+
+        private string ugentTime;
+        /// <summary>
+        /// 加急时间 
+        /// </summary>
+        public string UrgentTime
+        {
+            get { return ugentTime; }
+            set
+            {
+                int s = -1;
+                if (int.TryParse(value, out s))
+                {
+                    ugentTime = value;
+                }
+                else
+                {
+                    ugentTime = "1";
+                }
+            }
+        }
+        private decimal urgentPrice;
+        /// <summary>
+        /// 加急费用
+        /// </summary>
+        public decimal UrgentPrice
+        {
+            get { return urgentPrice; }
+            set
+            {
+                Regex reg = new Regex(@"[^0-9]{1,17}([.]{1}[^0-9]{1,4})?$");
+                if (!reg.IsMatch(value.ToString()))
+                {
+                    urgentPrice = Convert.ToDecimal(value);
+                }
+                else
+                {
+                    urgentPrice = 0;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 加急费用描述 
+        /// </summary>
+        public string UrgentPriceDesc { get; set; }
+
+        /// <summary>
+        /// 签证地址
+        /// </summary>
+        public string VisaAddress { get; set; }
+        /// <summary>
+        /// 创建者Id
+        /// </summary>
+        public int CreateUserId { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+       
+    }
+    public class DelCountryFeeCostDto
+    {
+        public int Id { get; set; }
+        public int DeleteUserId { get; set; }
+    }
+}

+ 4 - 4
OASystem/OASystem.Domain/Entities/Resource/Res_CountryFeeCost.cs

@@ -58,8 +58,8 @@ namespace OASystem.Domain.Entities.Resource
         /// <summary>
         /// 一般签证时间
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(20)")]
-        public DateTime VisaTime { get; set; }
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
+        public string VisaTime { get; set; }
 
         /// <summary>
         /// 签证是否加急 0:加急  1: 不加急
@@ -70,8 +70,8 @@ namespace OASystem.Domain.Entities.Resource
         /// <summary>
         /// 加急时间 
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(20)")]
-        public DateTime UrgentTime { get; set; }
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
+        public string UrgentTime { get; set; }
 
         /// <summary>
         /// 加急费用

+ 13 - 0
OASystem/OASystem.Domain/ViewModels/Resource/CountryFeeCostView.cs

@@ -0,0 +1,13 @@
+using OASystem.Domain.Entities.Resource;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Resource
+{
+    public class CountryFeeCostView:Res_CountryFeeCost
+    {
+    }
+}

+ 87 - 0
OASystem/OASystem.Infrastructure/Repositories/Resource/CountryFeeRepository.cs

@@ -0,0 +1,87 @@
+using AutoMapper;
+using OASystem.Domain;
+using OASystem.Domain.Dtos.Resource;
+using OASystem.Domain.Entities.Resource;
+using OASystem.Domain.ViewModels.Resource;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Infrastructure.Repositories.Resource
+{
+    public class CountryFeeRepository : BaseRepository<Res_CountryFeeCost, CountryFeeCostView>
+    {
+        private readonly IMapper _mapper;
+        public CountryFeeRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
+        {
+            _mapper = mapper;
+        }
+
+        public async Task<Result> OperationCountryFeeCost(OperationCountryFeeCostDto dto)
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            try
+            {
+                if (dto.Status == 1)//添加
+                {
+                    string selectSql = string.Format(@"select * from Res_CountryFeeCost where VisaContinent='{0}' and VisaCountry='{1}' and IsDel='{2}'"
+                                                       , dto.VisaContinent,dto.VisaCountry, 0);
+                    var CountryFeeCost = await _sqlSugar.SqlQueryable<Res_CountryFeeCost>(selectSql).FirstAsync();//查询是否存在
+                    if (CountryFeeCost != null)
+                    {
+                        return result = new Result() { Code = -1, Msg = "该国家已存在,请勿重复添加!" };
+
+                    }
+                    else//不存在,可添加
+                    {
+                        Res_CountryFeeCost _CountryFeeCost = _mapper.Map<Res_CountryFeeCost>(dto);
+                        int id = await AddAsyncReturnId(_CountryFeeCost);
+                        if (id == 0)
+                        {
+                            return result = new Result() { Code = -1, Msg = "添加失败!" };
+
+                        }
+                        result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
+                    }
+                }
+                else if (dto.Status == 2)//修改
+                {
+                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_CountryFeeCost
+                    {
+                        VisaContinent = dto.VisaContinent,
+                        VisaCountry = dto.VisaCountry,
+                        IsVisaExemption = dto.IsVisaExemption,
+                        IsVisaOnArrival = dto.IsVisaOnArrival,
+                        IsElectronicSignature = dto.IsElectronicSignature,
+                        VisaPrice = dto.VisaPrice,
+                        VisaPriceDesc = dto.VisaPriceDesc,
+                        VisaType = dto.VisaType,
+                        VisaTime = dto.VisaTime,
+                        IsUrgent = dto.IsUrgent,
+                        UrgentTime = dto.UrgentTime,
+                        UrgentPrice = dto.UrgentPrice,
+                        UrgentPriceDesc = dto.UrgentPriceDesc,
+                        VisaAddress = dto.VisaAddress,
+                        Remark = dto.Remark
+                    });
+                    if (!res)
+                    {
+                        return result = new Result() { Code = -1, Msg = "修改失败!" };
+                    }
+                    result = new Result() { Code = 0, Msg = "修改成功!" };
+                }
+                else
+                {
+                    return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
+                }
+            }
+            catch (Exception ex)
+            {
+                return result = new Result() { Code = -2, Msg = "程序错误!" };
+            }
+            return result;
+        }
+    }
+}

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Resource/LocalGuideDataRepository.cs

@@ -98,7 +98,7 @@ namespace OASystem.Infrastructure.Repositories.Resource
                 }
                 if (!string.IsNullOrWhiteSpace(dto.UnitArea) && dto.UnitArea != "全部")
                 {
-                    sqlWhere += string.Format(@" And UnitArea like '%{0}%''", dto.UnitArea);
+                    sqlWhere += string.Format(@" And UnitArea like '%{0}%'", dto.UnitArea);
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Contact))
                 {