Commit a552fff2d748045a84c6a71fdf7939424f72e278
1 parent
4f386477a8
Exists in
master
and in
6 other branches
解决精度丢失问题
Showing 1 changed file with 2 additions and 2 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
a552fff
... | ... | @@ -1951,8 +1951,8 @@ |
1951 | 1951 | totalCount = okCount + errorCount; |
1952 | 1952 | double okPercentage = 0, errorPercentage = 0; |
1953 | 1953 | if (totalCount > 0) { |
1954 | - okPercentage = new BigDecimal(okCount.toString()).divide(new BigDecimal(totalCount.toString()), 3, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; | |
1955 | - errorPercentage = 100 - okPercentage; | |
1954 | + okPercentage = new BigDecimal(okCount.toString()).divide(new BigDecimal(totalCount.toString()), 4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; | |
1955 | + errorPercentage = new BigDecimal(100.00).subtract(new BigDecimal(okPercentage)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |
1956 | 1956 | } |
1957 | 1957 | matDeliverQuery.setVisitResult(matdeliverFollowRequest.getVisitResult()); |
1958 | 1958 | if (StringUtils.isNotEmpty(matdeliverFollowRequest.getNeed())) {//是否分页 |