|
@@ -601,7 +601,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
String lastContractCurrency = "";
|
|
|
BigDecimal lastContractRmbAmount = BigDecimal.ZERO;
|
|
|
BigDecimal lastPurchaseAmount = BigDecimal.ZERO;
|
|
|
- for (ContractBudgetVo.GrossProfitInfo grossProfitInfo : grossProfitInfoList) {
|
|
|
+ for (int i = 0; i < grossProfitInfoList.size(); i++) {
|
|
|
+ ContractBudgetVo.GrossProfitInfo grossProfitInfo = grossProfitInfoList.get(i);
|
|
|
if (grossProfitInfo.getType() == 2) {
|
|
|
//如果是采购节点
|
|
|
BigDecimal purchaseAmount = BigDecimal.ZERO;
|
|
@@ -682,6 +683,18 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
BigDecimal grossProfit = incomeAmount.subtract(expenditureAmount);
|
|
|
grossProfitInfo.setGross(grossProfit.setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
+ //毛利率(毛利/合同金额*100%)
|
|
|
+ BigDecimal grossRate = grossProfitInfo.getGross()
|
|
|
+ .divide(grossProfitInfo.getContractRmbAmount(), 2, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .multiply(BigDecimal.valueOf(100));
|
|
|
+ grossProfitInfo.setGrossRate(grossRate);
|
|
|
+ //对比上一版本利润
|
|
|
+ grossProfitInfo.setCompareLastGross(BigDecimal.ZERO);
|
|
|
+ if ((i - 1) >= 0) {
|
|
|
+ ContractBudgetVo.GrossProfitInfo lastGrossProfitInfo = grossProfitInfoList.get(i - 1);
|
|
|
+ BigDecimal subtract = lastGrossProfitInfo.getGross().subtract(grossProfitInfo.getGross());
|
|
|
+ grossProfitInfo.setCompareLastGross(subtract);
|
|
|
+ }
|
|
|
}
|
|
|
contractBudgetVo.setGrossProfitInfoList(grossProfitInfoList);
|
|
|
}
|