|
|
@@ -108,10 +108,22 @@ public class WorkReportController extends BaseController {
|
|
108
|
108
|
{
|
|
109
|
109
|
double Answer = ((double)report.getAnswer() / report.getLdCount());//结果的百分比
|
|
110
|
110
|
report.setAnswerRate(String.format("%.2f", Answer*100)+ "%"); ;
|
|
111
|
|
- if ((report.getSatisfied()+report.getNoSatisfied())>0)
|
|
|
111
|
+ if ((report.getSatisfied()+report.getNoSatisfied()+ report.getSatisfactory())>0)
|
|
112
|
112
|
{
|
|
113
|
|
- double myd = ((double)report.getSatisfied()+report.getSatisfactory()/(report.getSatisfied()+report.getNoSatisfied()+report.getSatisfactory()));//结果的百分比
|
|
114
|
|
- report.setMydRate(String.format("%.2f", myd*100)+ "%");
|
|
|
113
|
+// double myd = ((double)report.getSatisfied()+report.getSatisfactory()/(report.getSatisfied()+report.getNoSatisfied()+report.getSatisfactory()));//结果的百分比
|
|
|
114
|
+// report.setMydRate(String.format("%.2f", myd*100)+ "%");
|
|
|
115
|
+
|
|
|
116
|
+ long total = report.getSatisfied() + report.getNoSatisfied() + report.getSatisfactory();
|
|
|
117
|
+
|
|
|
118
|
+
|
|
|
119
|
+
|
|
|
120
|
+// 3. 正确计算分子和分母
|
|
|
121
|
+ double numerator = report.getSatisfied() + report.getSatisfactory();
|
|
|
122
|
+ double myd = numerator / total; // 自动转换为浮点除法
|
|
|
123
|
+
|
|
|
124
|
+ // 4. 格式化输出(直接使用%%表示百分号)
|
|
|
125
|
+ report.setMydRate(String.format("%.2f%%", myd * 100));
|
|
|
126
|
+
|
|
115
|
127
|
}
|
|
116
|
128
|
}
|
|
117
|
129
|
}
|