java:
BigDecimal totalConnectRate = new BigDecimal(totalConnectNum * 100)
.divide(new BigDecimal(totalCallNum), 2, BigDecimal.ROUND_HALF_UP);
collectData.put("totalConnectNum", totalConnectNum);
collectData.put("totalCallNum", totalCallNum);
collectData.put("totalConnectRate", String.format("%.2f", totalConnectRate));
pgsql:
to_char(sum(case when passing_time > 0 then 1 else 0 end) * 100.0 / count(1), 'FM99999990.00') as "connectRate"