示例#1
0
        /// <summary>
        /// 获取保险统计报表
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        public Jinher.AMP.YJB.Deploy.CustomDTO.ListResultDTO <Jinher.AMP.BTP.Deploy.YJBCarInsuranceReportDTO> GetCarInsuranceReportExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceReportSearchDTO arg)
        {
            var result = new Jinher.AMP.YJB.Deploy.CustomDTO.ListResultDTO <Jinher.AMP.BTP.Deploy.YJBCarInsuranceReportDTO>()
            {
                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 = YJBCarInsuranceReport.ObjectSet();
                var count = query.Count();

                var Data = new BE.YJBCarInsuranceReport().ToEntityDataList(query.OrderByDescending(o => o.InsuranceTime).Skip((arg.PageIndex - 1) * arg.PageSize).Take(arg.PageSize).ToList());

                return(Jinher.AMP.YJB.Deploy.CustomDTO.ListResultDTO <Jinher.AMP.BTP.Deploy.YJBCarInsuranceReportDTO> .Success(count, Data));
            }
            catch (Exception ex)
            {
                result.Code      = "";
                result.IsSuccess = false;
                result.Message   = "fail";
                LogHelper.Error("查询车险报表信息发生错误:参数信息:" + JsonHelper.JsonSerializer(arg), ex);
            }
            return(result);
        }
示例#2
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);
        }
示例#3
0
        /// <summary>
        /// 查询统计报表
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        public ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceReportDTO> > GetCarInsuranceReportExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceReportSearchDTO arg)
        {
            var result = new ResultDTO <List <Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceReportDTO> >()
            {
                isSuccess = true,
                Message   = "sucess"
            };

            if (arg == null)
            {
                result.isSuccess = false;
                result.Message   = "参数信息不正确";

                LogHelper.Error("查询车险报表信息发生错误:参数信息不正确");
            }

            LogHelper.Debug("查询车险报表信息查询依据" + JsonHelper.JsonSerializer(arg));

            try
            {
                var query = from r in YJBCarInsuranceReport.ObjectSet()
                            join d in YJBCarInsReportDetail.ObjectSet() on r.DetailId equals d.Id
                            select new Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceReportDTO
                {
                    OrderNo                  = r.OrderNo,
                    MemberPhone              = r.MemberPhone,
                    CustomPhone              = r.CustomPhone,
                    InsuranceAmount          = r.InsuranceAmount.Value,
                    InsuranceTime            = r.InsuranceTime,
                    State                    = r.State,
                    RecommendName            = r.RecommendName,
                    RecommendAmount          = SqlFunctions.StringConvert(r.RecommendAmount.Value),
                    CustomAmount             = r.CustomAmount.Value,
                    SinopecAmount            = r.SinopecAmount.Value,
                    RebateState              = (CarInsuranceStateEnum)r.RebateState.Value,
                    StrongInsuranceAmount    = d.StrongInsuranceAmount.Value,
                    BusinessAmount           = d.BusinessAmount.Value,
                    StrongInsuranceOrderId   = d.StrongInsuranceOrderId,
                    StrongInsuranceStartTime = d.StrongInsuranceStartTime,
                    StrongInsuranceEndTime   = d.StrongInsuranceEndTime,
                    BusinessOrderId          = d.BusinessOrderId,
                    BusinessStartTime        = d.BusinessStartTime,
                    BusinessEndTime          = d.BusinessEndTime,
                    PlateNumber              = d.PlateNumber,
                    ChassisNumber            = d.ChassisNumber,
                    EngineNumber             = d.EngineNumber,
                    CarTypeName              = d.CarTypeName,
                    RegisterTime             = d.RegisterTime,
                    IsTransfer               = d.IsTransfer,
                    CarOwnerName             = d.CarOwnerName,
                    CarOwnerIdType           = d.CarOwnerIdType,
                    CarOwnerId               = d.CarOwnerId,
                    CarOwnerAddress          = d.CarOwnerAddress,
                    CarOwnerPhone            = d.CarOwnerPhone,
                    PolicyHolderName         = d.PolicyHolderName,
                    PolicyHolderIdType       = d.PolicyHolderIdType,
                    PolicyHolderId           = d.PolicyHolderId,
                    PolicyHolderPhone        = d.PolicyHolderPhone,
                    PolicyHolderAddress      = d.PolicyHolderAddress,
                    StrongInsurance_SI       = d.StrongInsurance_SI,
                    StrongInsurance_Car      = d.StrongInsurance_Car,
                    Business_Car             = d.Business_Car,
                    Business_Three           = d.Business_Three,
                    Business_Driver          = d.Business_Driver,
                    Business_Passenger       = d.Business_Passenger,
                    Business_AllCar          = d.Business_AllCar,
                    Business_Glass           = d.Business_Glass,
                    Business_Body            = d.Business_Body,
                    Business_Engine          = d.Business_Engine,
                    Business_Natural         = d.Business_Natural,
                    Business_Garage          = d.Business_Garage,
                    Business_Third           = d.Business_Third,
                    Business_Spirit          = d.Business_Spirit,
                    NoDeductibles_Car        = d.NoDeductibles_Car,
                    NoDeductibles_Three      = d.NoDeductibles_Three,
                    NoDeductibles_Driver     = d.NoDeductibles_Driver,
                    NoDeductibles_Passenger  = d.NoDeductibles_Passenger,
                    NoDeductibles_AllCar     = d.NoDeductibles_AllCar,
                    NoDeductibles_Body       = d.NoDeductibles_Body,
                    NoDeductibles_Engine     = d.NoDeductibles_Engine,
                    NoDeductibles_Natural    = d.NoDeductibles_Natural,
                    NoDeductibles__Spirit    = d.NoDeductibles__Spirit,
                    InsuranceCompanyCode     = r.InsuranceCompanyCode,
                    SubTime                  = r.SubTime
                };
                if (arg.BeginTime != null)
                {
                    //DateTime begintime = DateTime.Parse(arg.BeginTime);
                    query = query.Where(x => x.SubTime >= arg.BeginTime);
                }
                if (arg.EndTime != null)
                {
                    DateTime endtime = arg.EndTime.Value.AddDays(1);
                    query = query.Where(x => x.SubTime < endtime);
                }
                if (arg.CompanyCode != null && arg.CompanyCode.Any())
                {
                    query = query.Where(x => x.InsuranceCompanyCode != null && x.InsuranceCompanyCode != "");
                    query = query.Where(x => arg.CompanyCode.Contains(x.InsuranceCompanyCode));
                    //var ss = LinqHelper.GetEFCommandSql(query);
                }
                if (!string.IsNullOrEmpty(arg.Status) && arg.Status != "-1")
                {
                    query = query.Where(x => x.State.Equals(arg.Status));
                }
                var count = query.Count();

                var Data = query.OrderByDescending(o => o.InsuranceTime).Skip((arg.PageIndex - 1) * arg.PageSize).Take(arg.PageSize).ToList();
                result.isSuccess  = true;
                result.ResultCode = count;
                result.Data       = Data;
            }
            catch (Exception ex)
            {
                result.isSuccess = false;
                result.Message   = "fail";
                LogHelper.Error("查询车险报表信息发生错误:参数信息:" + JsonHelper.JsonSerializer(arg), ex);
            }
            return(result);
        }
示例#4
0
        /// <summary>
        /// 插入保险统计报表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Jinher.AMP.YJB.Deploy.CustomDTO.ResultDTO InsertTOCarInsuranceReportExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJBCarInsuranceReportDTO 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
            {
                var Report = YJBCarInsuranceReport.ObjectSet().Where(x => x.OrderNo == model.OrderNo).ToList();

                YJBCarInsReportDetailDTO detaildto = new YJBCarInsReportDetailDTO();
                var DetailId = Guid.NewGuid();
                if (Report.Any() && Report != null && Report.Count > 0)
                {
                    detaildto.Id          = Report[0].DetailId.Value;
                    detaildto.EntityState = System.Data.EntityState.Modified;
                }
                else
                {
                    detaildto.Id          = DetailId;
                    detaildto.EntityState = System.Data.EntityState.Added;
                }
                detaildto.StrongInsuranceAmount = model.StrongInsuranceAmount;
                detaildto.BusinessAmount        = model.BusinessAmount;
                //detaildto.BusinessFreeAmount = model.BusinessFreeAmount;
                detaildto.StrongInsuranceOrderId   = model.StrongInsuranceOrderId;
                detaildto.BusinessStartTime        = model.BusinessStartTime;
                detaildto.BusinessEndTime          = model.BusinessEndTime;
                detaildto.BusinessOrderId          = model.BusinessOrderId;
                detaildto.StrongInsuranceStartTime = model.StrongInsuranceStartTime;
                detaildto.StrongInsuranceEndTime   = model.StrongInsuranceEndTime;
                detaildto.PlateNumber             = model.PlateNumber;
                detaildto.ChassisNumber           = model.ChassisNumber;
                detaildto.EngineNumber            = model.EngineNumber;
                detaildto.CarTypeName             = model.CarTypeName;
                detaildto.RegisterTime            = model.RegisterTime;
                detaildto.IsTransfer              = model.IsTransfer;
                detaildto.CarOwnerName            = model.CarOwnerName;
                detaildto.CarOwnerIdType          = model.CarOwnerIdType;
                detaildto.CarOwnerId              = model.CarOwnerId;
                detaildto.CarOwnerAddress         = model.CarOwnerAddress;
                detaildto.CarOwnerPhone           = model.CarOwnerPhone;
                detaildto.PolicyHolderName        = model.PolicyHolderName;
                detaildto.PolicyHolderIdType      = model.PolicyHolderIdType;
                detaildto.PolicyHolderId          = model.PolicyHolderId;
                detaildto.PolicyHolderPhone       = model.PolicyHolderPhone;
                detaildto.PolicyHolderAddress     = model.PolicyHolderAddress;
                detaildto.StrongInsurance_SI      = model.StrongInsurance_SI;
                detaildto.StrongInsurance_Car     = model.StrongInsurance_Car;
                detaildto.Business_Car            = model.Business_Car;
                detaildto.Business_Three          = model.Business_Three;
                detaildto.Business_Driver         = model.Business_Driver;
                detaildto.Business_Passenger      = model.Business_Passenger;
                detaildto.Business_AllCar         = model.Business_AllCar;
                detaildto.Business_Glass          = model.Business_Glass;
                detaildto.Business_Body           = model.Business_Body;
                detaildto.Business_Engine         = model.Business_Engine;
                detaildto.Business_Natural        = model.Business_Natural;
                detaildto.Business_Garage         = model.Business_Garage;
                detaildto.Business_Third          = model.Business_Third;
                detaildto.Business_Spirit         = model.Business_Spirit;
                detaildto.NoDeductibles_Car       = model.NoDeductibles_Car;
                detaildto.NoDeductibles_Three     = model.NoDeductibles_Three;
                detaildto.NoDeductibles_Driver    = model.NoDeductibles_Driver;
                detaildto.NoDeductibles_Passenger = model.NoDeductibles_Passenger;
                detaildto.NoDeductibles_AllCar    = model.NoDeductibles_AllCar;
                detaildto.NoDeductibles_Body      = model.NoDeductibles_Body;
                detaildto.NoDeductibles_Engine    = model.NoDeductibles_Engine;
                detaildto.NoDeductibles_Natural   = model.NoDeductibles_Natural;
                detaildto.NoDeductibles__Spirit   = model.NoDeductibles__Spirit;

                var detailmodel = YJBCarInsReportDetail.FromDTO(detaildto);

                ContextSession contextSession = ContextFactory.CurrentThreadContext;
                contextSession.SaveObject(detailmodel);

                BTP.Deploy.YJBCarInsuranceReportDTO dto = new BTP.Deploy.YJBCarInsuranceReportDTO();
                if (Report.Any() && Report != null && Report.Count > 0)
                {
                    dto.Id          = Report[0].Id;
                    dto.EntityState = System.Data.EntityState.Modified;
                    dto.DetailId    = Report[0].DetailId;
                    dto.ModifiedOn  = DateTime.Now;
                }
                else
                {
                    dto.Id          = Guid.NewGuid();
                    dto.DetailId    = DetailId;
                    dto.EntityState = System.Data.EntityState.Added;
                    dto.SubTime     = DateTime.Now;
                }

                dto.InsuranceCompanyCode = model.InsuranceCompanyCode;
                dto.OrderNo         = model.OrderNo;
                dto.MemberPhone     = model.MemberPhone;
                dto.CustomPhone     = model.CustomPhone;
                dto.InsuranceAmount = model.InsuranceAmount;

                dto.InsuranceTime   = model.InsuranceTime;
                dto.State           = model.State;
                dto.RecommendName   = model.RecommendName;
                dto.RecommendAmount = model.CustomAmount;
                dto.CustomAmount    = model.CustomAmount;
                dto.SinopecAmount   = model.SinopecAmount;
                dto.SubId           = Guid.Empty;
                dto.RebateState     = 0;

                var dbmodel = YJBCarInsuranceReport.FromDTO(dto);

                contextSession.SaveObject(dbmodel);
                var count = contextSession.SaveChanges();
                LogHelper.Info("增加车险报表信息数据更新数据:" + count);
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = "fail";
                result.Code      = "";
                LogHelper.Error("增加车险报表信息数据发生错误:参数信息:" + JsonHelper.JsonSerializer(model), ex);
            }

            return(result);
        }
示例#5
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);
        }