/// <summary> /// 根据汇款单号获取返利数据 /// </summary> /// <param name="arg"></param> /// <returns></returns> public ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateDataDTO> > GetCarRebateByRemittanceNoExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateSearchDTO arg) { var result = new ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateDataDTO> >() { isSuccess = true, Message = "sucess" }; if (arg == null) { result.isSuccess = false; result.Message = "参数信息不正确"; LogHelper.Error("根据汇款单号查询车险返利信息发生错误:参数信息不正确"); } LogHelper.Debug("根据汇款单号查询车险返利信息;查询依据" + JsonHelper.JsonSerializer(arg)); try { var query = YJBCarInsuranceRebate.ObjectSet() .Select(x => new Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateDataDTO() { OrderNo = x.OrderNo, RebateDate = x.RebateDate.Value, RebateNum = x.RebateNum.Value, RebateMoney = x.RebateMoney.Value, RemittanceNo = x.RemittanceNo, PhoneNum = x.PhoneNum, AuditDate = x.AuditDate.Value, InsuranceAmount = x.InsuranceAmount.Value, RebateState = (CarInsuranceStateEnum)x.RebateState, DouRemittanceAmount = Math.Round(x.DouRebateMoney * (decimal)1.06, 2), CompanyRemittanceMoney = Math.Round(x.CompanyRebateMoney * (decimal)1.06, 2), BusinessInsuranceAmount = x.BusinessInsuranceAmount, StrongInsuranceAmount = x.StrongInsuranceAmount, CarShipAmount = x.CarShipAmount, InsuranceCompanyCode = x.InsuranceCompanyCode, DouRebateMoney = x.DouRebateMoney, DouRebatePersent = x.DouRebatePersent, CompanyRebateMoney = x.CompanyRebateMoney, CompanyRebatePersent = x.CompanyRebatePersent }); if (!string.IsNullOrEmpty(arg.RemittanceNo)) { query = query.Where(x => x.RemittanceNo == arg.RemittanceNo); } var count = query.Count(); var Data = new List <Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateDataDTO>(); if (arg.PageIndex > 0) { Data = query.OrderByDescending(o => o.RebateDate).Skip((arg.PageIndex - 1) * arg.PageSize).Take(arg.PageSize).ToList(); } else { Data = query.OrderByDescending(o => o.RebateDate).ToList(); } result.ResultCode = count; result.Data = Data; } catch (Exception ex) { result.isSuccess = false; result.Message = "fail"; LogHelper.Error("根据汇款单号查询车险返利信息发生错误:参数信息:" + JsonHelper.JsonSerializer(arg), ex); } return(result); }
/// <summary> /// 获取保险返利数据 /// </summary> /// <param name="arg"></param> /// <returns></returns> public ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.CarInsurancePolymerizationDTO> > GetCarInsuranceRebateExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateSearchDTO arg) { var result = new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.CarInsurancePolymerizationDTO> >() { isSuccess = true, Message = "sucess" }; if (arg == null) { result.isSuccess = false; result.Message = "参数信息不正确"; LogHelper.Error("查询车险返利信息发生错误:参数信息不正确"); } LogHelper.Debug("查询车险返利信息;查询依据" + JsonHelper.JsonSerializer(arg)); try { var query = YJBCarInsuranceRebate.ObjectSet() .GroupBy(x => new { x.RemittanceNo }).Select(x => new CarInsurancePolymerizationDTO() { RemittanceNo = x.Key.RemittanceNo, RebateDate = x.Max(o => o.RebateDate), RebateMoney = x.Sum(o => o.RebateMoney.Value), RebateNum = x.Sum(o => o.RebateNum.Value), AfterTaxMoney = Math.Round(x.Sum(o => o.DouRebateMoney) * (decimal)1.06, 2), AuditFlag = x.Max(o => o.AuditFlag ?? 0), DouRebateMoney = x.Sum(o => o.DouRebateMoney), //DouRebatePersent = Math.Round(x.Sum(o => o.DouRebateMoney) / x.Sum(o => o.InsuranceAmount.Value), 2), DouRebatePersent = x.Max(o => o.DouRebatePersent), CompanyRemittanceMoney = Math.Round(x.Sum(o => o.CompanyRebateMoney) * (decimal)1.06, 2), CompanyRebateMoney = x.Sum(o => o.CompanyRebateMoney), InsuranceCompanyCode = x.Max(o => o.InsuranceCompanyCode), BusinessInsuranceAmount = x.Sum(o => o.BusinessInsuranceAmount), StrongInsuranceAmount = x.Sum(o => o.StrongInsuranceAmount), CarShipAmount = x.Sum(o => o.CarShipAmount), InsuranceAmount = x.Sum(o => o.InsuranceAmount.Value), //CompanyRebatePersent = Math.Round(x.Sum(o => o.CompanyRebateMoney) / x.Sum(o => o.InsuranceAmount.Value), 2) CompanyRebatePersent = x.Max(o => o.CompanyRebatePersent) }); var count = query.Count(); var Data = query.OrderByDescending(o => o.RebateDate).Skip((arg.PageIndex - 1) * arg.PageSize).Take(arg.PageSize).ToList(); result.ResultCode = count; result.Data = Data; } catch (Exception ex) { result.isSuccess = false; result.Message = "fail"; LogHelper.Error("查询车险返利信息发生错误:参数信息:" + JsonHelper.JsonSerializer(arg), ex); } return(result); }
/// <summary> /// 获取汇款单 /// </summary> /// <param name="arg"></param> /// <returns></returns> public Jinher.AMP.YJB.Deploy.CustomDTO.ListResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.CarInsurancePolymerizationDTO> GetCarInsuranceRebateExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateSearchDTO arg) { var result = new Jinher.AMP.YJB.Deploy.CustomDTO.ListResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.CarInsurancePolymerizationDTO>() { IsSuccess = true, Message = "sucess", Code = "200" }; if (arg == null) { result.IsSuccess = false; result.Message = "参数信息不正确"; result.Code = "404"; LogHelper.Error("查询车险返利信息发生错误:参数信息不正确"); } LogHelper.Debug("查询车险返利信息;查询依据" + JsonHelper.JsonSerializer(arg)); try { var query = YJBCarInsuranceRebate.ObjectSet() .GroupBy(x => new { x.RemittanceNo, x.RebateDate, x.RebateMoney, x.RebateNum }).Select(x => new CarInsurancePolymerizationDTO() { RemittanceNo = x.Key.RemittanceNo, RebateDate = x.Key.RebateDate, RebateMoney = x.Sum(o => o.RebateMoney), RebateNum = x.Sum(o => o.RebateNum.Value), AfterTaxMoney = x.Sum(o => o.RebateMoney.Value) * (decimal)1.06 }); var count = query.Count(); var Data = query.OrderByDescending(o => o.RebateDate).Skip((arg.PageIndex - 1) * arg.PageSize).Take(arg.PageSize).ToList(); return(Jinher.AMP.YJB.Deploy.CustomDTO.ListResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.CarInsurancePolymerizationDTO> .Success(count, Data)); } catch (Exception ex) { result.Code = ""; result.IsSuccess = false; result.Message = "fail"; LogHelper.Error("查询车险返利信息发生错误:参数信息:" + JsonHelper.JsonSerializer(arg), ex); } return(result); }