Commit 9cce7838 authored by suhuiguang's avatar suhuiguang

1.赋码统计百分比计算错误及四射5入

parent fd28d54d
...@@ -165,10 +165,10 @@ public class PersonQrCodeController extends BaseController { ...@@ -165,10 +165,10 @@ public class PersonQrCodeController extends BaseController {
} else if ("job".equals(dataType)) { } else if ("job".equals(dataType)) {
countAll = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, null, null, null); countAll = sjglZsjZsbtzMapper.getJobYardByPageCount(parentCode, null, null, null);
} }
result.put("redToGreenPercent", getPercent(new BigDecimal(red), new BigDecimal(countAll))); result.put("redPercent", getPercent(new BigDecimal(red), new BigDecimal(countAll)));
result.put("redPercent", getPercent(new BigDecimal(redToGreen), new BigDecimal(countAll))); result.put("redToGreenPercent", getPercent(new BigDecimal(redToGreen), new BigDecimal(countAll)));
result.put("yellowToGreenPercent", getPercent(new BigDecimal(yellow), new BigDecimal(countAll))); result.put("yellowPercent", getPercent(new BigDecimal(yellow), new BigDecimal(countAll)));
result.put("yellowPercent", getPercent(new BigDecimal(yellowToGreen), new BigDecimal(countAll))); result.put("yellowToGreenPercent", getPercent(new BigDecimal(yellowToGreen), new BigDecimal(countAll)));
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
...@@ -217,7 +217,7 @@ public class PersonQrCodeController extends BaseController { ...@@ -217,7 +217,7 @@ public class PersonQrCodeController extends BaseController {
* @return 百分比 * @return 百分比
*/ */
private double getPercent(BigDecimal numerator, BigDecimal denominator) { private double getPercent(BigDecimal numerator, BigDecimal denominator) {
BigDecimal multiply = numerator.divide(denominator.compareTo(BigDecimal.ZERO) != 0 ? denominator : new BigDecimal(1), 4, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)); BigDecimal multiply = numerator.divide(denominator.compareTo(BigDecimal.ZERO) != 0 ? denominator : new BigDecimal(1), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
return Math.abs(multiply.doubleValue()); return Math.abs(multiply.doubleValue());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment