|
|
@@ -447,25 +447,27 @@ public class DashboardProjectManage { |
|
|
|
public static String convertSafetyInputRate(Project project) { |
|
|
|
String safetyInputDescribe = project.getSafetyInputDescribe(); |
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(safetyInputDescribe)){ |
|
|
|
JSONArray array = JSON.parseArray(safetyInputDescribe); |
|
|
|
final Double[] total = {0.0}; |
|
|
|
array.forEach(j -> { |
|
|
|
JSONObject json = JSON.parseObject(JSON.toJSONString(j)); |
|
|
|
Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); |
|
|
|
if(Objects.nonNull(safetyInputAmount)){ |
|
|
|
total[0] += safetyInputAmount; |
|
|
|
try{ |
|
|
|
JSONArray array = JSON.parseArray(safetyInputDescribe); |
|
|
|
final Double[] total = {0.0}; |
|
|
|
array.forEach(j -> { |
|
|
|
JSONObject json = JSON.parseObject(JSON.toJSONString(j)); |
|
|
|
Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); |
|
|
|
if(Objects.nonNull(safetyInputAmount)){ |
|
|
|
total[0] += safetyInputAmount; |
|
|
|
} |
|
|
|
}); |
|
|
|
Double totalAmount = total[0]; |
|
|
|
//申报金额 |
|
|
|
BigDecimal declareAmount = project.getDeclareAmount(); |
|
|
|
if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){ |
|
|
|
return DashboardConstant.Protrait.ZREO_PERCEN; |
|
|
|
} |
|
|
|
}); |
|
|
|
Double totalAmount = total[0]; |
|
|
|
//申报金额 |
|
|
|
BigDecimal declareAmount = project.getDeclareAmount(); |
|
|
|
if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){ |
|
|
|
return DashboardConstant.Protrait.ZREO_PERCEN; |
|
|
|
} |
|
|
|
BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) |
|
|
|
.divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) |
|
|
|
.stripTrailingZeros(); |
|
|
|
return rate.toPlainString(); |
|
|
|
BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) |
|
|
|
.divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) |
|
|
|
.stripTrailingZeros(); |
|
|
|
return rate.toPlainString(); |
|
|
|
}catch (Exception e){} |
|
|
|
} |
|
|
|
return DashboardConstant.Protrait.ZREO_PERCEN; |
|
|
|
} |
|
|
|