|
@@ -376,6 +376,32 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //雷电公司,需要显示工时占比,临时计算一下
|
|
|
|
+ if (companyId == 7030) {
|
|
|
|
+ for (Map map : nameList) {
|
|
|
|
+ List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
|
+ double total = 0;
|
|
|
|
+ for (Map<String, Object> report : reportList) {
|
|
|
|
+ total += (double)report.get("time");
|
|
|
|
+ }
|
|
|
|
+ //计算占比
|
|
|
|
+ int progressTotal = 0;
|
|
|
|
+ for (int i = 0; i< reportList.size(); i++) {
|
|
|
|
+ Map<String, Object> report = reportList.get(i);
|
|
|
|
+ double progress = 100*(double)report.get("time")/total;
|
|
|
|
+ int pInt = new BigDecimal(progress).setScale(0, RoundingMode.HALF_UP).intValue();
|
|
|
|
+ if (i < reportList.size() -1) {
|
|
|
|
+ progressTotal += pInt;
|
|
|
|
+ //对progress四舍五入到整数位
|
|
|
|
+ report.put("progress", pInt);
|
|
|
|
+ } else {
|
|
|
|
+ //最后一个,反算,避免四舍五入造成的误差导致总和不是100
|
|
|
|
+ report.put("progress", 100 - progressTotal);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//设置照片
|
|
//设置照片
|
|
for (Map map : nameList) {
|
|
for (Map map : nameList) {
|
|
List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|