Ver código fonte

修改签证费用录入相关接口

wangh 1 ano atrás
pai
commit
5834fda073

+ 96 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -48,6 +48,7 @@ namespace OASystem.API.Controllers
         private readonly DelegationEnDataRepository _delegationEnDataRep;
         private readonly DelegationVisaRepository _delegationVisaRep;
         private readonly VisaPriceRepository _visaPriceRep;
+        private readonly CarTouristGuideGroundRepository _carTouristGuideGroundRep;
         private readonly MessageRepository _message;
         private readonly SqlSugarClient _sqlSugar;
         private string url;
@@ -58,7 +59,7 @@ namespace OASystem.API.Controllers
         public GroupsController(IMapper mapper, SqlSugarClient sqlSugar, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository,
             TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep, DecreasePaymentsRepository decreasePaymentsRep,
             InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, DelegationEnDataRepository delegationEnDataRep, EnterExitCostRepository enterExitCostRep
-            , DelegationVisaRepository delegationVisaRep, MessageRepository message,VisaPriceRepository visaPriceRep)
+            , DelegationVisaRepository delegationVisaRep, MessageRepository message,VisaPriceRepository visaPriceRep,CarTouristGuideGroundRepository carTouristGuideGroundRep)
         {
             _mapper = mapper;
             _grpScheduleRep = grpScheduleRep;
@@ -79,6 +80,7 @@ namespace OASystem.API.Controllers
             _delegationVisaRep = delegationVisaRep;
             _message = message;
             _visaPriceRep= visaPriceRep;
+            _carTouristGuideGroundRep= carTouristGuideGroundRep;
         }
 
         
@@ -2957,5 +2959,98 @@ namespace OASystem.API.Controllers
             }
         }
         #endregion
+
+        #region op费用录入
+        /// <summary>
+        /// 根据diid查询op费用列表
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> QueryCarTouristGuideGroundByDiId(CarTouristGuideGroundDto dto)
+        {
+            try
+            {
+                Result groupData = await _carTouristGuideGroundRep.QueryCarTouristGuideGroundByDiId(dto);
+                if (groupData.Code != 0)
+                {
+                    return Ok(JsonView(false, groupData.Msg));
+                }
+                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+        /// <summary>
+        /// 根据op费用Id查询单条数据及c表数据
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> QueryCarTouristGuideGroundById(CarTouristGuideGroundIdDto dto)
+        {
+            try
+            {
+                Grp_CarTouristGuideGroundReservations groupData = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().FirstAsync(a=>a.Id==dto.Id && a.IsDel==0);
+                return Ok(JsonView(true, "查询成功!", groupData));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+            }
+        }
+        /// <summary>
+        /// op费用删除
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> DelCarTouristGuideGround(DelBaseDto dto)
+        {
+            try
+            {
+                var res = await _carTouristGuideGroundRep.SoftDeleteByIdAsync<Grp_CarTouristGuideGroundReservations>(dto.Id.ToString(), dto.DeleteUserId);
+                if (!res)
+                {
+                    return Ok(JsonView(false, "删除失败"));
+                }
+                return Ok(JsonView(true, "删除成功!"));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// op费用录入操作(Status:1.新增,2.修改)
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> OpCarTouristGuideGround(OpCarTouristGuideGroundDto dto)
+        {
+            try
+            {
+                Result groupData = await _visaPriceRep.OpVisaPrice(dto);
+                if (groupData.Code != 0)
+                {
+                    return Ok(JsonView(false, groupData.Msg));
+                }
+                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+        #endregion
     }
 }

+ 109 - 0
OASystem/OASystem.Domain/Dtos/Groups/CarTouristGuideGroundDto.cs

@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Groups
+{
+    /// <summary>
+    /// Op费用根据diid查询列表
+    /// </summary>
+    public class CarTouristGuideGroundDto: DtoBase
+    {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+    }
+    /// <summary>
+    /// 根据id查询单挑数据
+    /// </summary>
+    public class CarTouristGuideGroundIdDto
+    {
+        public int Id { get; set; }
+    }
+    /// <summary>
+    /// op费用新增、修改
+    /// </summary>
+    public class OpCarTouristGuideGroundDto
+    {
+        /// <summary>
+        /// 编号
+        /// </summary>
+        public int Id { get; set; }
+        /// <summary>
+        /// 团组外键编号
+        /// </summary>
+        public int DiId { get; set; }
+
+        /// <summary>
+        /// 地接地区
+        /// </summary>
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 服务公司
+        /// </summary>
+        public string ServiceCompany { get; set; }
+
+        /// <summary>
+        /// 服务导游
+        /// </summary>
+        public string ServiceGuide { get; set; }
+
+        /// <summary>
+        /// 导游地接联系电话
+        /// </summary>
+        public string ServiceTel { get; set; }
+
+        /// <summary>
+        /// Bus名称
+        /// </summary>
+        public string BusName { get; set; }
+
+        /// <summary>
+        /// Bus描述
+        /// </summary>
+        public string BusDescription { get; set; }
+
+        /// <summary>
+        /// 车公司联系电话
+        /// </summary>
+        /// 
+        public string BusTel { get; set; }
+
+        /// <summary>
+        /// 服务时间起
+        /// </summary>
+        public string ServiceStartTime { get; set; }
+        /// <summary>
+        /// 服务时间止
+        /// </summary>
+        public string ServiceEndTime { get; set; }
+        /// <summary>
+        /// 服务描述
+        /// </summary>
+        public string ServiceDescription { get; set; }
+        /// <summary>
+        /// 报价说明
+        /// </summary>
+        public string QuotedPriceExplanation { get; set; }
+        /// <summary>
+        /// 公转私转标识
+        /// </summary>
+        public int OrbitalPrivateTransfer { get; set; }
+        /// <summary>
+        /// 创建者Id
+        /// </summary>
+        public int CreateUserId { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+        /// <summary>
+        /// 是否删除
+        /// </summary>
+        public int IsDel { get; set; } = 0;
+    }
+}

+ 37 - 0
OASystem/OASystem.Domain/ViewModels/Groups/Grp_CarTouristGuideGroundView.cs

@@ -0,0 +1,37 @@
+using OASystem.Domain.Entities.Groups;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Groups
+{
+    public class Grp_CarTouristGuideGroundView:Grp_CarTouristGuideGroundReservations
+    {
+        /// <summary>
+        /// 行号
+        /// </summary>
+        public int RowNumber { get; set; }
+        /// <summary>
+        /// 此次付款百分百
+        /// </summary>
+        public decimal PayPercentage { get; set; }
+        /// <summary>
+        /// 此次付款金额
+        /// </summary>
+        public decimal PayThenMoney { get; set; }
+        /// <summary>
+        /// 剩余尾款
+        /// </summary>
+        public decimal RemainingBalance { get; set; }
+        /// <summary>
+        /// 总经理是否审核
+        /// </summary>
+        public int IsAuditGM { get; set; }
+        /// <summary>
+        /// 币种
+        /// </summary>
+        public string CurrencyStr { get; set; }
+    }
+}

+ 4 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -89,6 +89,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     UserId = UserId.Substring(0, UserId.Length - 1);
                 }
+                else
+                {
+                    UserId = "0";
+                }
                 string sql = string.Format(@"select a.*,c.IsAuditGM,(select Name from Sys_SetData where Id=a.cType) as 'CTypeName',(select Name from 
                                                 Sys_SetData where Id=a.PreCurrency) as 'PreCurrencyStr',(select Name from Sys_SetData where Id=a.Currency)
                                                 as 'CurrencyStr' from Grp_AirTicketReservations a,Grp_CreditCardPayment c where  a.id=c.CId  and a.isdel={1} and c.IsDel={1}

+ 124 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -0,0 +1,124 @@
+using AutoMapper;
+using OASystem.Domain;
+using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.ViewModels.Groups;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Infrastructure.Repositories.Groups
+{
+    public class CarTouristGuideGroundRepository:BaseRepository<Grp_CarTouristGuideGroundReservations, Grp_CarTouristGuideGroundReservationsContent>
+    {
+        private readonly IMapper _mapper;
+
+        public CarTouristGuideGroundRepository(SqlSugarClient sqlSugar, IMapper mapper)
+            : base(sqlSugar)
+        {
+            _mapper = mapper;
+        }
+
+        public async Task<Result> QueryCarTouristGuideGroundByDiId(CarTouristGuideGroundDto dto)
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            if (dto.PortType == 0 || string.IsNullOrWhiteSpace(dto.PortType.ToString()))
+            {
+                return result = new Result() { Code = -1, Msg = "请传入PortType参数,请求端口分类 1 Web 2 Android 3 IOS" };
+            }
+            try
+            {
+                #region SQL条件拼接
+
+                string sqlWhere = string.Empty;
+                sqlWhere += string.Format(@"And t.DIId={0} and t.isdel={1}", dto.DiId, 0);
+                string UserId = "";
+                List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 79).ToList();
+                foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
+                    UserId += gta.UId + ",";
+
+                if (!string.IsNullOrWhiteSpace(UserId))
+                {
+                    UserId = UserId.Substring(0, UserId.Length - 1);
+                }
+                else
+                {
+                    UserId = "0";
+                }
+                
+                sqlWhere += string.Format(@" And t.CreateUserId in ({0})", UserId);
+                if (!string.IsNullOrEmpty(sqlWhere.Trim()))
+                {
+                    Regex r = new Regex("And");
+                    sqlWhere = r.Replace(sqlWhere, "Where", 1);
+                }
+
+                #endregion
+                int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
+                int endIndex = startIndex + dto.PageSize - 1;
+                if (dto.PortType == 1)
+                {
+                    string sql = string.Format(@"select t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage,c.PayMoney from 
+                                                Grp_CarTouristGuideGroundReservations t
+                                                left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id
+                                                left Join Sys_SetData s on s.Id=t.CId {0}
+                                                order by CreateTime desc", sqlWhere);
+                    List<Grp_CarTouristGuideGroundView> infoViews = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
+                    foreach (var item in infoViews)
+                    {
+                        item.PayThenMoney = Math.Round(item.PayPercentage/100 * item.ServiceQuotedPrice, 2);
+                        item.RemainingBalance = Math.Round(item.ServiceQuotedPrice- item.PayPercentage / 100 * item.ServiceQuotedPrice);
+                    }
+                    return result = new Result() { Code = 0, Msg = "查询成功!", Data = infoViews };
+                }
+                else if (dto.PortType == 2 || dto.PortType == 3)
+                {
+                    string sql = string.Format(@"Select * From (	
+                                            Select row_number() over (order by t.Id Desc) as RowNumber,t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage
+                                            from 
+                                            Grp_CarTouristGuideGroundReservations t
+                                            left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id
+                                            left Join Sys_SetData s on s.Id=t.CId {0}
+                                            ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
+
+                    List<Grp_CarTouristGuideGroundView> grp_CarTourists = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
+                    foreach (var item in grp_CarTourists)
+                    {
+                        item.PayThenMoney = Math.Round(item.PayPercentage / 100 * item.ServiceQuotedPrice, 2);
+                        item.RemainingBalance = Math.Round(item.ServiceQuotedPrice - item.PayPercentage / 100 * item.ServiceQuotedPrice);
+                    }
+                    string CountSql = string.Format(@"Select COUNT(1) as Count From (	
+                                                        select t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage from 
+                                                        Grp_CarTouristGuideGroundReservations t
+                                                        left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id
+                                                        left Join Sys_SetData s on s.Id=t.CId {0}
+                                                        ) temp ", sqlWhere);
+                    DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();
+                    if (dataCount != null)
+                    {
+                        int count = dataCount.Count;
+                        float totalPage = (float)count / dto.PageSize;//总页数
+                        if (totalPage == 0) totalPage = 1;
+                        else totalPage = (int)Math.Ceiling((double)totalPage);
+
+
+                        ListViewBase<Grp_CarTouristGuideGroundView> rst = new ListViewBase<Grp_CarTouristGuideGroundView>();
+                        rst.DataList = grp_CarTourists;
+                        rst.DataCount = count;
+                        rst.CurrPageIndex = dto.PageIndex;
+                        rst.CurrPageSize = dto.PageSize;
+                        return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
+                    }
+                }
+            }
+            catch (Exception)
+            {
+                return result = new Result() { Code = -2, Msg = "未知错误" };
+                throw;
+            }
+            return result;
+        }
+    }
+}

+ 4 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -43,6 +43,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     UserId = UserId.Substring(0, UserId.Length - 1);
                 }
+                else
+                {
+                    UserId = "0";
+                }
                 string sql = string.Format(@"select Id,DiId,PriceName,Price,(select name from Sys_SetData where id=s.Currency) as Currency,FilePath,
                                             (select CnName from Sys_Users where Id=s.CreateUserId) as 'CreateUserName',CreateTime,(select IsAuditGM from 
                                             Grp_CreditCardPayment where CTable=98 and CId=s.Id and IsDel=0) as 'isAudit' from Grp_DecreasePayments s where DIID={0} and IsDel=0 and s.CreateUserId in ({1}) ", dto.DiId,UserId);

+ 4 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -126,6 +126,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     UserId = UserId.Substring(0, UserId.Length - 1);
                 }
+                else
+                {
+                    UserId = "0";
+                }
                 sqlWhere += string.Format(@" And i.CreateUserId in ({0})", UserId);
                 if (!string.IsNullOrEmpty(sqlWhere.Trim()))
                 {

+ 6 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -63,6 +63,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 {
                     UserId = UserId.Substring(0, UserId.Length - 1);
                 }
+                else
+                {
+                    UserId = "0";
+                }
                 sqlWhere += string.Format(@" And v.CreateUserId in ({0})", UserId);
                 if (!string.IsNullOrEmpty(sqlWhere.Trim()))
                 {
@@ -86,7 +90,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     string sql = string.Format(@"Select * From (	
                                             Select row_number() over (order by v.Id Desc) as RowNumber,v.*,c.IsAuditGM,s.Name as VisaCurrencyStr
                                             From Grp_VisaInfo v
-                                            Inner Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
+                                            left Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
                                             Left Join Sys_SetData s On v.VisaCurrency = s.Id {0}
                                             ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
 
@@ -95,7 +99,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     string CountSql = string.Format(@"Select COUNT(1) as Count From (	
                                             Select v.*,c.IsAuditGM,s.Name as VisaCurrencyStr
                                             From Grp_VisaInfo v
-                                            Inner Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
+                                            left Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
                                             Left Join Sys_SetData s On v.VisaCurrency = s.Id {0}
                                             ) temp", sqlWhere);
                     DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();

+ 3 - 3
OASystem/OASystem.Infrastructure/Repositories/System/UsersRepository.cs

@@ -146,9 +146,9 @@ namespace OASystem.Infrastructure.Repositories.System
         public async Task<List<UserInfo>> QueryUser(string sqlWhere)
         {
             string sql = string.Format(@"Select sc.CompanyName,sd.DepName,sjp.JobName,su.* From Sys_Users su 
-                                                        Inner Join Sys_Company sc On su.CompanyId = sc.Id
-                                                        Inner Join Sys_Department sd On su.DepId = sd.Id
-                                                        Inner Join Sys_JobPost sjp On su.JobPostId = sjp.Id {0}", sqlWhere);
+                                                        left Join Sys_Company sc On su.CompanyId = sc.Id
+                                                        left Join Sys_Department sd On su.DepId = sd.Id
+                                                        left Join Sys_JobPost sjp On su.JobPostId = sjp.Id {0}", sqlWhere);
             return await _sqlSugar.SqlQueryable<UserInfo>(sql).ToListAsync();
 
         }