• 将totalCost用insurance的set方法set到保险总费用的字段中,然后进行插入操作。代码如下


    (后台中计费的方法写在Service中的新增方法中/**
    * 车辆保险新增
    * 陈通
    * @param insurance
    * @param request
    * @return
    * @throws IOException
    */
    public Result insertVehicleInsurance(VehicleInsurance insurance,HttpServletRequest request) throws IOException{
    Result result = Result.getInstance();
    insurance.setKeyID(IDGenerator.uuid());
    //计费方法开始
    BigDecimal totalCost = new BigDecimal("0");
    if(insurance.getTrafficCompulsoryInsuranceCost()!=null){
    totalCost=totalCost.add(insurance.getTrafficCompulsoryInsuranceCost());
    }
    if(insurance.getCommercialInsuranceCost()!=null){
    totalCost=totalCost.add(insurance.getCommercialInsuranceCost());
    }
    if(insurance.getCarrierInsuranceCost()!=null){
    totalCost=totalCost.add(insurance.getCarrierInsuranceCost());
    }
    if(insurance.getVehicleAndVesselTaxCost(http://www.amjmh.com)!=null){
    totalCost=totalCost.add(insurance.getVehicleAndVesselTaxCost());
    }
    insurance.setTotalCost(totalCost);
    //计费方法结束
    //插入车辆保险信息,返回受影响的行数
    int count=vehicleInsuranceDao.insertVehicleInsurance(insurance);
    //插入附件
    sysFileService.saveFile(insurance.getKeyID(), Enums.FILE_CATALOG.INSURANCEFILE.getValue(), request);
    if (count>0) {
    result.setFlag(true);
    result.setMessage("车辆保险新增成功!");
    }else{
    result.setFlag(false);
    result.setMessage("车辆保险新增失败!");
    }
    return result;
    }

    ---------------------

  • 相关阅读:
    Building Forest CodeForces
    欢迎使用CSDN-markdown编辑器
    Travelling HDU
    Card Collector HDU
    Doing Homework HDU
    Mirror Number SPOJ
    Palindromic Numbers LightOJ
    Magic Numbers CodeForces
    Xor-sequences CodeForces
    Little Elephant and Elections CodeForces
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11291165.html
Copyright © 2020-2023  润新知