(后台中计费的方法写在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;
}
---------------------