|
@@ -1,9 +1,13 @@
|
|
|
package com.slibra.web.controller.business;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+
|
|
|
+import com.slibra.common.DecimalUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
@@ -21,6 +25,9 @@ import com.slibra.business.service.ITXinyiForecastComparisonService;
|
|
|
import com.slibra.common.utils.poi.ExcelUtil;
|
|
|
import com.slibra.common.core.page.TableDataInfo;
|
|
|
|
|
|
+import static com.slibra.common.constant.MyConstants.BigDecimal_100;
|
|
|
+import static com.slibra.common.constant.MyConstants.PERCENT_SYMBOL;
|
|
|
+
|
|
|
/**
|
|
|
* 信义预测对比Controller
|
|
|
*
|
|
@@ -43,6 +50,7 @@ public class TXinyiForecastComparisonController extends BaseController
|
|
|
{
|
|
|
startPage();
|
|
|
List<TXinyiForecastComparison> list = tXinyiForecastComparisonService.selectTXinyiForecastComparisonList(tXinyiForecastComparison);
|
|
|
+ this.addListExtra(list);//处理误差率 乘以100,取绝对值 保留2位小数
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
@@ -55,10 +63,36 @@ public class TXinyiForecastComparisonController extends BaseController
|
|
|
public void export(HttpServletResponse response, TXinyiForecastComparison tXinyiForecastComparison)
|
|
|
{
|
|
|
List<TXinyiForecastComparison> list = tXinyiForecastComparisonService.selectTXinyiForecastComparisonList(tXinyiForecastComparison);
|
|
|
+ this.addListExtra(list);//处理误差率 乘以100,取绝对值 保留2位小数
|
|
|
ExcelUtil<TXinyiForecastComparison> util = new ExcelUtil<TXinyiForecastComparison>(TXinyiForecastComparison.class);
|
|
|
util.exportExcel(response, list, "信义预测对比数据");
|
|
|
}
|
|
|
|
|
|
+ private void addListExtra(List<TXinyiForecastComparison> list) {
|
|
|
+ if(!CollectionUtils.isEmpty(list)){
|
|
|
+ for (TXinyiForecastComparison tXinyiForecastComparison : list) {
|
|
|
+ BigDecimal hsErrorRateOne = tXinyiForecastComparison.getHsErrorRateOne();
|
|
|
+ if(!Objects.isNull(hsErrorRateOne))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateOneStr(DecimalUtils.getAbsAndScale(BigDecimal_100.multiply(hsErrorRateOne), 2) + PERCENT_SYMBOL);
|
|
|
+ BigDecimal hsErrorRateTwo = tXinyiForecastComparison.getHsErrorRateTwo();
|
|
|
+ if(!Objects.isNull(hsErrorRateTwo))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateTwoStr(DecimalUtils.getAbsAndScale(BigDecimal_100.multiply(hsErrorRateTwo), 2) + PERCENT_SYMBOL);
|
|
|
+ BigDecimal hsErrorRateThree = tXinyiForecastComparison.getHsErrorRateThree();
|
|
|
+ if(!Objects.isNull(hsErrorRateThree))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateThreeStr(DecimalUtils.getAbsAndScale(BigDecimal_100.multiply(hsErrorRateThree), 2) + PERCENT_SYMBOL);
|
|
|
+ BigDecimal yyErrorRateOne = tXinyiForecastComparison.getYyErrorRateOne();
|
|
|
+ if(!Objects.isNull(yyErrorRateOne))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateOneStr(DecimalUtils.getAbsAndScale(BigDecimal_100.multiply(yyErrorRateOne), 2) + PERCENT_SYMBOL);
|
|
|
+ BigDecimal yyErrorRateTwo = tXinyiForecastComparison.getYyErrorRateTwo();
|
|
|
+ if(!Objects.isNull(yyErrorRateTwo))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateTwoStr(DecimalUtils.getAbsAndScale(BigDecimal_100.multiply(yyErrorRateTwo), 2) + PERCENT_SYMBOL);
|
|
|
+ BigDecimal yyErrorRateThree = tXinyiForecastComparison.getYyErrorRateThree();
|
|
|
+ if(!Objects.isNull(yyErrorRateThree))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateThreeStr(DecimalUtils.getAbsAndScale(BigDecimal_100.multiply(yyErrorRateThree), 2) + PERCENT_SYMBOL);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取信义预测对比详细信息
|
|
|
*/
|