package com.changhong.epc.parsing.service.asset.formula;
|
|
import com.changhong.epc.bean.form.Asset;
|
import com.changhong.epc.bean.tenant.asset.FixedAsset;
|
import com.changhong.epc.constter.parsing.asset.AssetStatic;
|
import lombok.extern.slf4j.Slf4j;
|
|
import java.util.Collections;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
@Slf4j
|
public class DepreciationFactory {
|
|
public static final Map<String, Depreciation> DEPRECIATION_MAP;
|
|
static {
|
Map<String, Depreciation> depreciation = new HashMap<>();
|
depreciation.put(AssetStatic.DUBLEdDECLININGBALANCEMETHODCODE, new DoubleMoney());
|
depreciation.put(AssetStatic.AVERAGELIFEMETHODCODE, new AvgYear());
|
depreciation.put(AssetStatic.SUMOFYEARSMETHODCODE, new YearSum());
|
DEPRECIATION_MAP = Collections.unmodifiableMap(depreciation);
|
}
|
|
public static FixedAsset count(Asset money, String type){
|
FixedAsset fixedAsset = DEPRECIATION_MAP.get(type).doCount(money);
|
log.debug("月折旧率\t:{}", fixedAsset.getDepreciationRate());
|
log.debug("本期折旧额\t:{}", fixedAsset.getCurrentDepreciation());
|
log.debug("累计折旧额\t:{}", fixedAsset.getCumulativeDepreciation());
|
log.debug("净值\t\t:{}", fixedAsset.getNetMoney());
|
return fixedAsset;
|
}
|
|
public static FixedAsset count(Asset money){
|
return count(money, money.getDepreciationMethod());
|
}
|
|
}
|