示例#1
0
        /// <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);
        }
示例#2
0
        /// <summary>
        /// 根据订单号获取订单数据
        /// </summary>
        /// <param name="OrderNos"></param>
        /// <returns></returns>
        public ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.OrderInfoAndCarRebateDTO> > GetDSFOrderInfoByOrderNosExt(System.Collections.Generic.List <string> OrderNos)
        {
            var result = new ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.OrderInfoAndCarRebateDTO> >()
            {
                isSuccess = true,
                Message   = "sucess"
            };

            if (OrderNos == null || OrderNos.Count <= 0)
            {
                result.isSuccess = false;
                result.Message   = "参数信息不正确";

                LogHelper.Error("查询车险返利信息发生错误:参数信息不正确");
            }
            else
            {
                try
                {
                    var query = from o in YJBDSFOrderInfo.ObjectSet()
                                join r in YJBCarInsuranceRebate.ObjectSet() on o.OrderNo equals r.OrderNo
                                where OrderNos.Contains(o.OrderNo)
                                select new Jinher.AMP.BTP.Deploy.CustomDTO.OrderInfoAndCarRebateDTO
                    {
                        OrderNo         = o.OrderNo,
                        OrderPayMoney   = o.OrderPayMoney.Value,
                        OrderPayState   = o.OrderPayState,
                        OrderPayDate    = o.OrderPayDate.Value,
                        PlatformName    = o.PlatformName,
                        Commodity       = o.Commodity,
                        RebateMoney     = r.RebateMoney.Value,
                        RebateNum       = r.RebateNum.Value,
                        RebateDate      = r.RebateDate.Value,
                        RebateState     = (Jinher.AMP.YJB.Deploy.Enums.CarInsuranceStateEnum)r.RebateState.Value,
                        RemittanceNo    = r.RemittanceNo,
                        AuditDate       = r.AuditDate.Value,
                        PhoneNum        = r.PhoneNum,
                        InsuranceAmount = r.InsuranceAmount.Value
                    };
                    result.ResultCode = query.Count();
                    result.Data       = query.ToList();
                }
                catch (Exception ex)
                {
                    result.isSuccess = false;
                    result.Message   = "fail";
                    LogHelper.Error("查询第三方订单发生错误:参数信息:" + JsonHelper.JsonSerializer(OrderNos), ex);
                }
            }
            return(result);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateCarRebateStateExt(string OrderNO, int State)
        {
            var result = new ResultDTO
            {
                isSuccess = true
            };

            try
            {
                ContextSession contextSession = ContextFactory.CurrentThreadContext;
                var            rebate         = YJBCarInsuranceRebate.ObjectSet().Where(x => x.OrderNo == OrderNO).FirstOrDefault();
                if (rebate != null)
                {
                    //Deploy.YJBCarInsuranceRebateDTO dto = new Deploy.YJBCarInsuranceRebateDTO();
                    //dto.Id = rebate.Id;
                    //dto.EntityState = System.Data.EntityState.Modified;
                    //dto.OrderNo = rebate.OrderNo;
                    //dto.RebateDate = rebate.RebateDate;
                    //dto.RebateMoney = rebate.RebateMoney;
                    //dto.RebateNum = rebate.RebateNum;
                    //dto.RemittanceNo = rebate.RemittanceNo;
                    //dto.PhoneNum = rebate.PhoneNum;
                    //dto.RebateState = State;
                    //dto.AuditDate = DateTime.Now;
                    //dto.InsuranceAmount = rebate.InsuranceAmount;
                    //dto.AuditFlag = 1;
                    //var dbmodel = YJBCarInsuranceRebate.FromDTO(dto);
                    //contextSession.SaveObject(dbmodel);
                    rebate.RebateState = State;
                    rebate.AuditFlag   = 1;
                    rebate.AuditDate   = DateTime.Now;
                }

                var report = YJBCarInsuranceReport.ObjectSet().Where(x => x.OrderNo == OrderNO).FirstOrDefault();
                if (report != null)
                {
                    //Deploy.YJBCarInsuranceReportDTO dto = new BTP.Deploy.YJBCarInsuranceReportDTO();
                    //dto.Id = report.Id;
                    //dto.EntityState = System.Data.EntityState.Modified;
                    //dto.DetailId = report.DetailId;
                    //dto.ModifiedOn = DateTime.Now;

                    //dto.OrderNo = report.OrderNo;
                    //dto.MemberPhone = report.MemberPhone;
                    //dto.CustomPhone = report.CustomPhone;
                    //dto.InsuranceAmount = report.InsuranceAmount;

                    //dto.InsuranceTime = report.InsuranceTime;
                    //dto.State = report.State;
                    //dto.RecommendName = report.RecommendName;
                    //dto.RecommendAmount = report.CustomAmount;
                    //dto.CustomAmount = report.CustomAmount;
                    //dto.SinopecAmount = report.SinopecAmount;
                    //dto.SubId = Guid.Empty;
                    //dto.RebateState = (short)State;

                    //var dbreport = YJBCarInsuranceReport.FromDTO(dto);

                    //contextSession.SaveObject(dbreport);
                    report.RebateState = (short)State;
                    report.ModifiedOn  = DateTime.Now;
                }

                var count = contextSession.SaveChanges();
                if (count <= 0)
                {
                    result.isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                result.isSuccess = false;
            }
            return(result);
        }
示例#5
0
        /// <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);
        }
示例#6
0
        /// <summary>
        /// 插入汇款单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Jinher.AMP.YJB.Deploy.CustomDTO.ResultDTO InsertTOCarInsuranceRebateExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceRebateDTO model)
        {
            LogHelper.Info("开始访问车险返利数据接口!");
            var result = new Jinher.AMP.YJB.Deploy.CustomDTO.ResultDTO()
            {
                Code      = "200",
                Message   = "",
                IsSuccess = true
            };

            if (model == null)
            {
                result.IsSuccess = false;
                result.Message   = "参数信息不正确";
                result.Code      = "404";
                LogHelper.Error("增加车险返利数据发生错误:参数信息不正确");
            }

            try
            {
                if (model.OrderInfoList.Any() && model.OrderInfoList.Count > 0)
                {
                    var     RebateTime   = DateTime.Parse(model.RebateDate);
                    decimal BusinessRate = 0;
                    decimal StrongRate   = 0;
                    decimal CarShipRate  = 0;
                    decimal TaxRate      = 0;
                    foreach (var item in model.OrderInfoList)
                    {
                        BusinessRate = 0;
                        StrongRate   = 0;
                        CarShipRate  = 0;
                        TaxRate      = 1.06M;
                        if (item != null && !string.IsNullOrEmpty(item.InsuranceCompanyCode))
                        {
                            var activity = InsuranceCompanyActivity.ObjectSet().Where(p => p.InsuranceCompanyCode == item.InsuranceCompanyCode && p.IsAvailable == 1).FirstOrDefault();
                            BusinessRate = activity.BusinessRate;
                            StrongRate   = activity.StrongRate;
                            CarShipRate  = activity.CarShipRate;
                            TaxRate      = activity.TaxRate;
                        }
                        BTP.Deploy.YJBCarInsuranceRebateDTO dto = new BTP.Deploy.YJBCarInsuranceRebateDTO();
                        dto.Id                 = Guid.NewGuid();
                        dto.EntityState        = System.Data.EntityState.Added;
                        dto.OrderNo            = item.OrderNo;
                        dto.RebateDate         = RebateTime;
                        dto.RebateNum          = item.RebateNum;
                        dto.RemittanceNo       = model.RemittanceNo;
                        dto.PhoneNum           = item.PhoneNum;
                        dto.RebateState        = (short)CarInsuranceStateEnum.NOAUDIT;
                        dto.AuditDate          = null;
                        dto.InsuranceAmount    = item.InsuranceAmount;
                        dto.DouRebateMoney     = item.RebateMoney;
                        dto.CompanyRebateMoney = Math.Round((item.BusinessInsuranceAmount * (BusinessRate / 100) + item.StrongInsuranceAmount * (StrongRate / 100) + item.CarShipAmount * (CarShipRate / 100)) / TaxRate, 2);
                        dto.RebateMoney        = item.RebateMoney + dto.CompanyRebateMoney;
                        //dto.DouRebatePersent = Math.Round(item.RebateMoney / item.InsuranceAmount,2);
                        dto.DouRebatePersent        = 11.7M;
                        dto.CompanyRebatePersent    = Math.Round(BusinessRate / 100, 2);
                        dto.BusinessInsuranceAmount = item.BusinessInsuranceAmount;
                        dto.StrongInsuranceAmount   = item.StrongInsuranceAmount;
                        dto.InsuranceCompanyCode    = item.InsuranceCompanyCode;
                        dto.CarShipAmount           = item.CarShipAmount;
                        var dbmodel = YJBCarInsuranceRebate.FromDTO(dto);
                        ContextFactory.CurrentThreadContext.SaveObject(dbmodel);
                        var count  = ContextFactory.CurrentThreadContext.SaveChanges();
                        var report = YJBCarInsuranceReport.ObjectSet().Where(x => x.OrderNo == item.OrderNo).FirstOrDefault();
                        if (report != null)
                        {
                            ContextSession contextSession = ContextFactory.CurrentThreadContext;
                            report.ModifiedOn  = DateTime.Now;
                            report.RebateState = (short)CarInsuranceStateEnum.NOAUDIT;
                            report.EntityState = System.Data.EntityState.Modified;
                            contextSession.SaveObject(report);
                            contextSession.SaveChanges();
                        }
                        LogHelper.Info("增加车险返利数据更新数据:" + count);
                    }
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = "fail";
                result.Code      = "";
                LogHelper.Error("增加车险返利数据发生错误:参数信息:" + JsonHelper.JsonSerializer(model), ex);
            }

            return(result);
        }