Browse Source

预警统计

master
PoffyZhang 11 months ago
parent
commit
232552b5f9
1 changed files with 20 additions and 18 deletions
  1. +20
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java

+ 20
- 18
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java View File

@@ -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;
}


Loading…
Cancel
Save