|
@@ -11975,10 +11975,38 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<UserCateTimeVo> value = entry.getValue();
|
|
List<UserCateTimeVo> value = entry.getValue();
|
|
map.put("userName", value.get(0).getName());
|
|
map.put("userName", value.get(0).getName());
|
|
map.put("cateTimeList", value);
|
|
map.put("cateTimeList", value);
|
|
|
|
+ //计算这个人的总工时
|
|
|
|
+ double sum = value.stream().mapToDouble(UserCateTimeVo::getWorkingTime).sum();
|
|
|
|
+ map.put("workingTime", sum);
|
|
|
|
+ //计算占比
|
|
|
|
+ value.forEach(v->{
|
|
|
|
+ if (sum > 0) {
|
|
|
|
+ double v1 = v.getWorkingTime() * 100 / sum;
|
|
|
|
+ v.setPercent(v1);
|
|
|
|
+ } else {
|
|
|
|
+ v.setPercent(0.0);
|
|
|
|
+ }
|
|
|
|
+ if (categoryRatioTblSetting != null && categoryRatioTblSetting.getRatio() != null) {
|
|
|
|
+ UserCateTimeVo userCateTimeVo = v;
|
|
|
|
+ //获取用户的总工时预警
|
|
|
|
+ int ratio = categoryRatioTblSetting.getRatio();
|
|
|
|
+ if (categoryRatioTblSetting.getMoreOrLess() == 1) {
|
|
|
|
+ //大于预设比例的需要预警
|
|
|
|
+ if (userCateTimeVo.getPercent() > ratio) {
|
|
|
|
+ v.setWarning(true);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //小于预设比例的需要预警;
|
|
|
|
+ if (userCateTimeVo.getPercent() < ratio) {
|
|
|
|
+ v.setWarning(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
//是否仅达到预警的用户列表
|
|
//是否仅达到预警的用户列表
|
|
if (onlyShowWarning == 1) {
|
|
if (onlyShowWarning == 1) {
|
|
//获取用户的总工时
|
|
//获取用户的总工时
|
|
- Double sum = value.stream().mapToDouble(UserCateTimeVo::getWorkingTime).sum();
|
|
|
|
if (categoryRatioTblSetting != null && categoryRatioTblSetting.getRatio() != null) {
|
|
if (categoryRatioTblSetting != null && categoryRatioTblSetting.getRatio() != null) {
|
|
Optional<UserCateTimeVo> first = value.stream().filter(v -> categoryRatioTblSetting.getMonitorCategoryId().equals(v.getCategory())).findFirst();
|
|
Optional<UserCateTimeVo> first = value.stream().filter(v -> categoryRatioTblSetting.getMonitorCategoryId().equals(v.getCategory())).findFirst();
|
|
if (first.isPresent()) {
|
|
if (first.isPresent()) {
|