zoukankan      html  css  js  c++  java
  • 将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;
    }

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

  • 相关阅读:
    JS对象—对象总结(创建、属性、方法)
    总结30个css选择器
    null、undefined、typeof、instanceof
    Hybrid App 原理解析
    promise与async-await
    你不知道的javascript
    Function.prototype.toString 的使用技巧
    Javascript中的valueOf与toString
    HTML5 Page Visibility
    深入理解css3中 nth-child 和 nth-of-type 的区别
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11291165.html
Copyright © 2011-2022 走看看