Browse Source

驾驶舱 项目画像接口

tags/24080901
PoffyZhang 1 year ago
parent
commit
abcf3f41d4
2 changed files with 8 additions and 4 deletions
  1. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java
  2. +5
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java View File

@@ -20,6 +20,9 @@ public class DashboardConstant {
public static final String LOG_OFF = "注销"; public static final String LOG_OFF = "注销";


public static final String PROJECT_SIGNS = "项目体征"; public static final String PROJECT_SIGNS = "项目体征";
public static final String FEILD_SAFETYMONEY = "safetyInputAmount";

public static final String ZREO_PERCEN = "0%";
} }


} }

+ 5
- 4
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java View File

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum;
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; import com.ningdatech.pmapi.dashboard.constant.DashboardConstant;
import com.ningdatech.pmapi.dashboard.handle.ApplicationHandler; import com.ningdatech.pmapi.dashboard.handle.ApplicationHandler;
@@ -379,21 +380,21 @@ public class DashboardProjectManage {
final Integer[] total = {0}; final Integer[] total = {0};
array.forEach(j -> { array.forEach(j -> {
JSONObject json = JSON.parseObject(JSON.toJSONString(j)); JSONObject json = JSON.parseObject(JSON.toJSONString(j));
Integer safetyInputAmount = json.getInteger("safetyInputAmount");
Integer safetyInputAmount = json.getInteger(DashboardConstant.Protrait.FEILD_SAFETYMONEY);
total[0] += safetyInputAmount; total[0] += safetyInputAmount;
}); });
Integer totalAmount = total[0]; Integer totalAmount = total[0];
//申报金额 //申报金额
BigDecimal declareAmount = project.getDeclareAmount(); BigDecimal declareAmount = project.getDeclareAmount();
if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){ if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){
return "0%";
return DashboardConstant.Protrait.ZREO_PERCEN;
} }
BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100))
.divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) .divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP)
.stripTrailingZeros(); .stripTrailingZeros();
return rate.toPlainString() + "%";
return rate.toPlainString() + StrPool.PERCENT;
} }
return "0%";
return DashboardConstant.Protrait.ZREO_PERCEN;
} }


/** /**


Loading…
Cancel
Save