package com.changhong.epc.parsing.service.asset.formula; import com.changhong.epc.bean.form.Asset; import com.changhong.epc.bean.tenant.asset.FixedAsset; import java.text.DecimalFormat; /** * 折旧接口 */ public interface Depreciation { DecimalFormat DF = new DecimalFormat("#.00"); FixedAsset count(Asset money); default Double toNoun(Double number){ Double val = Double.parseDouble(DF.format(number)); if(val < 0){ return 0D; }else{ return val; } } default FixedAsset doCount(Asset money){ FixedAsset fixedAsset = count(money); if(fixedAsset.getNetMoney() > 0){ return fixedAsset; } fixedAsset.setCurrentDepreciation(money.getOriginalMoney() - money.getCumulativeDepreciation()); fixedAsset.setCumulativeDepreciation(money.getOriginalMoney()); fixedAsset.setNetMoney(0D); return fixedAsset; } }