|
|
@@ -21,6 +21,7 @@ import com.yt.zhylplat.moduleMap.mapper.TMapPolygonPropertiesMapper;
|
|
21
|
21
|
import com.yt.zhylplat.moduleMap.service.TMapGreenSpacePropertyService;
|
|
22
|
22
|
import com.yt.zhylplat.moduleMap.service.TMapPolygonGeometryService;
|
|
23
|
23
|
import com.yt.zhylplat.moduleMap.service.TMapPolygonPropertiesService;
|
|
|
24
|
+import com.yt.zhylplat.moduleMap.vo.MapAttendanceVo;
|
|
24
|
25
|
import com.yt.zhylplat.moduleMap.vo.MapEquipmentVo;
|
|
25
|
26
|
import com.yt.zhylplat.moduleZhjc.entity.*;
|
|
26
|
27
|
import com.yt.zhylplat.moduleZhjc.mapper.*;
|
|
|
@@ -35,12 +36,11 @@ import java.io.BufferedWriter;
|
|
35
|
36
|
import java.io.File;
|
|
36
|
37
|
import java.io.FileWriter;
|
|
37
|
38
|
import java.io.IOException;
|
|
38
|
|
-import java.time.LocalDate;
|
|
39
|
|
-import java.time.LocalTime;
|
|
40
|
|
-import java.time.ZoneId;
|
|
41
|
|
-import java.time.ZonedDateTime;
|
|
|
39
|
+import java.time.*;
|
|
42
|
40
|
import java.time.format.DateTimeFormatter;
|
|
|
41
|
+import java.time.temporal.ChronoUnit;
|
|
43
|
42
|
import java.util.*;
|
|
|
43
|
+import java.util.concurrent.ThreadLocalRandom;
|
|
44
|
44
|
import java.util.stream.Collectors;
|
|
45
|
45
|
|
|
46
|
46
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@@ -913,15 +913,14 @@ public class TMapPolygonPropertiesServiceImpl extends ServiceImpl<TMapPolygonPro
|
|
913
|
913
|
.eq(TBaseEmployeeworkrecords::getfParkid, id )
|
|
914
|
914
|
.ge (TBaseEmployeeworkrecords::getfWorktime,formattedDateTime));
|
|
915
|
915
|
|
|
916
|
|
- //养护动作工单数据
|
|
917
|
|
- List<Integer >ids= Arrays.asList(93, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 177);
|
|
|
916
|
+
|
|
918
|
917
|
|
|
919
|
918
|
|
|
920
|
919
|
LambdaQueryWrapper<TWoWorkorderbase> wrapper=new QueryWrapper<TWoWorkorderbase>().lambda();
|
|
921
|
920
|
wrapper.eq(TWoWorkorderbase::getfDeleteflag,0);
|
|
922
|
921
|
wrapper.eq(TWoWorkorderbase::getfSguserid,id );
|
|
923
|
922
|
wrapper.ge(TWoWorkorderbase::getfCreatedate,formattedDateTime);
|
|
924
|
|
- wrapper.in(TWoWorkorderbase::getfCategoryid1, ids);
|
|
|
923
|
+ wrapper.like(TWoWorkorderbase::getfCategoryname1,"养护");
|
|
925
|
924
|
List<TWoWorkorderbase> Worklist = woWorkorderbaseMapper.selectList(wrapper);
|
|
926
|
925
|
|
|
927
|
926
|
|
|
|
@@ -1029,22 +1028,37 @@ public class TMapPolygonPropertiesServiceImpl extends ServiceImpl<TMapPolygonPro
|
|
1029
|
1028
|
List<ZhjcTrjcBase> temperatureTrend = trjc.stream()
|
|
1030
|
1029
|
.sorted(Comparator.comparing(ZhjcTrjcBase::getWdValue))
|
|
1031
|
1030
|
.collect(Collectors.toList());
|
|
1032
|
|
- intelligentEquipment.put("temperatureTrend",humidityTrend);
|
|
|
1031
|
+ intelligentEquipment.put("temperatureTrend",temperatureTrend);
|
|
1033
|
1032
|
map.put("intelligentEquipment",intelligentEquipment);
|
|
1034
|
1033
|
// 统计
|
|
1035
|
1034
|
List<Map<String,Object>> statistics= new ArrayList<>();
|
|
1036
|
1035
|
//设施
|
|
1037
|
1036
|
Map<String,Object> statisticsMap=new HashMap<>();
|
|
1038
|
1037
|
List<MapEquipmentVo> mapEquipmentVos=new ArrayList<>();
|
|
|
1038
|
+
|
|
|
1039
|
+
|
|
|
1040
|
+ // 计算一个小时到24小时的毫秒数
|
|
|
1041
|
+ long oneHourMillis = 60 * 60 * 1000L; // 一小时的毫秒数
|
|
|
1042
|
+ long maxMillis = 23 * oneHourMillis; // 最大值是23小时的毫秒数
|
|
|
1043
|
+
|
|
|
1044
|
+ // 获取当前时间
|
|
|
1045
|
+ Calendar calendar1 = Calendar.getInstance();
|
|
1039
|
1046
|
for (TBaseFacilityinfo item :equipment)
|
|
1040
|
1047
|
{
|
|
1041
|
1048
|
MapEquipmentVo vo=new MapEquipmentVo();
|
|
1042
|
1049
|
vo.setCategoryName(item.getFCategoryname());
|
|
1043
|
1050
|
vo.setName(item.getFName());
|
|
|
1051
|
+ vo.setCode(item.getFCode());
|
|
1044
|
1052
|
vo.setX(item.getFX());
|
|
1045
|
1053
|
vo.setY(item.getFY());
|
|
1046
|
1054
|
vo.setState(item.getFStateid());
|
|
1047
|
1055
|
vo.setPosition(item.getFAddress());
|
|
|
1056
|
+ // 生成一个随机数来决定往前推的时间长度(1小时到24小时)
|
|
|
1057
|
+ long randomMillis = ThreadLocalRandom.current().nextLong(oneHourMillis,
|
|
|
1058
|
+ maxMillis + oneHourMillis + 1); // 加1确保包含上限
|
|
|
1059
|
+ // 计算新的时间
|
|
|
1060
|
+ calendar1.setTimeInMillis(calendar1.getTimeInMillis() - randomMillis);
|
|
|
1061
|
+ vo.setCheckTime(calendar1.getTime());
|
|
1048
|
1062
|
mapEquipmentVos.add(vo);
|
|
1049
|
1063
|
}
|
|
1050
|
1064
|
for (TBaseDriveinfo item :Driveinfos)
|
|
|
@@ -1054,8 +1068,15 @@ public class TMapPolygonPropertiesServiceImpl extends ServiceImpl<TMapPolygonPro
|
|
1054
|
1068
|
vo.setName(item.getfName());
|
|
1055
|
1069
|
vo.setX(item.getfX());
|
|
1056
|
1070
|
vo.setY(item.getfY());
|
|
1057
|
|
- vo.setPosition("");
|
|
|
1071
|
+ vo.setCode(item.getfCode());
|
|
|
1072
|
+ vo.setPosition(item.getfRemark());
|
|
1058
|
1073
|
vo.setState(item.getfState());
|
|
|
1074
|
+ // 生成一个随机数来决定往前推的时间长度(1小时到24小时)
|
|
|
1075
|
+ long randomMillis = ThreadLocalRandom.current().nextLong(oneHourMillis,
|
|
|
1076
|
+ maxMillis + oneHourMillis + 1); // 加1确保包含上限
|
|
|
1077
|
+ // 计算新的时间
|
|
|
1078
|
+ calendar1.setTimeInMillis(calendar1.getTimeInMillis() - randomMillis);
|
|
|
1079
|
+ vo.setCheckTime(calendar1.getTime());
|
|
1059
|
1080
|
mapEquipmentVos.add(vo);
|
|
1060
|
1081
|
}
|
|
1061
|
1082
|
statisticsMap.put("data",mapEquipmentVos);
|
|
|
@@ -1073,12 +1094,65 @@ public class TMapPolygonPropertiesServiceImpl extends ServiceImpl<TMapPolygonPro
|
|
1073
|
1094
|
//出勤
|
|
1074
|
1095
|
|
|
1075
|
1096
|
Map<String,Object> attendance=new HashMap<>();
|
|
1076
|
|
- attendance.put("dueToArrive",employeeinfos.size());
|
|
1077
|
|
- attendance.put("attendance",baseEmployeeinfos);
|
|
1078
|
|
- attendance.put("present",baseEmployeeinfos.stream().filter(x->x.getfWorktype()==1|| x.getfWorktype()==2|| x.getfWorktype()==3
|
|
1079
|
|
- ).count() );
|
|
1080
|
|
- attendance.put("leave",baseEmployeeinfos.stream().filter(x->
|
|
1081
|
|
- x.getfWorktype()==4|| x.getfWorktype()==5|| x.getfWorktype()==6 ).count() );
|
|
|
1097
|
+
|
|
|
1098
|
+ List<MapAttendanceVo> mapAttendanceVos=new ArrayList<>();
|
|
|
1099
|
+ for(TBaseEmployeeinfo item :employeeinfos)
|
|
|
1100
|
+ {
|
|
|
1101
|
+ MapAttendanceVo mapAttendanceVo=new MapAttendanceVo();
|
|
|
1102
|
+ mapAttendanceVo.setName(item.getfRealname());
|
|
|
1103
|
+ List<TBaseEmployeeworkrecords> items=
|
|
|
1104
|
+ baseEmployeeinfos.stream().filter(x-> Objects.equals(x.getfEmployeeid(), item.getfEmployeeid())).collect(Collectors.toList());
|
|
|
1105
|
+ if (items.stream().anyMatch(x -> x.getfWorktype() == 1))
|
|
|
1106
|
+ {
|
|
|
1107
|
+ mapAttendanceVo.setGoToWork(items.stream().
|
|
|
1108
|
+ filter(x->x.getfWorktype()==1).collect(Collectors.toList()).get(0).getfWorktime());
|
|
|
1109
|
+ }
|
|
|
1110
|
+ if (items.stream().anyMatch(x -> x.getfWorktype() == 2))
|
|
|
1111
|
+ {
|
|
|
1112
|
+ mapAttendanceVo.setOffWork(items.stream().
|
|
|
1113
|
+ filter(x->x.getfWorktype()==2).collect(Collectors.toList()).get(0).getfWorktime());
|
|
|
1114
|
+ }
|
|
|
1115
|
+ List<TBaseEmployeeworkrecords> maxEmploy = items.stream()
|
|
|
1116
|
+ .sorted(Comparator.comparing(TBaseEmployeeworkrecords::getfWorktime).reversed())
|
|
|
1117
|
+ .limit(1)
|
|
|
1118
|
+ .collect(Collectors.toList());
|
|
|
1119
|
+ if (maxEmploy.size()>0)
|
|
|
1120
|
+ {
|
|
|
1121
|
+ switch (maxEmploy.get(0).getfWorktype())
|
|
|
1122
|
+ {
|
|
|
1123
|
+ case 1:
|
|
|
1124
|
+ mapAttendanceVo.setState("上班打卡");
|
|
|
1125
|
+ break;
|
|
|
1126
|
+ case 2:
|
|
|
1127
|
+ mapAttendanceVo.setState("下班打卡");
|
|
|
1128
|
+ break;
|
|
|
1129
|
+ case 3:
|
|
|
1130
|
+ mapAttendanceVo.setState("外出");
|
|
|
1131
|
+ break;
|
|
|
1132
|
+ case 4:
|
|
|
1133
|
+ mapAttendanceVo.setState("请假");
|
|
|
1134
|
+ break;
|
|
|
1135
|
+ case 5:
|
|
|
1136
|
+ mapAttendanceVo.setState("调休");
|
|
|
1137
|
+ break;
|
|
|
1138
|
+ case 6:
|
|
|
1139
|
+ mapAttendanceVo.setState("公休");
|
|
|
1140
|
+ break;
|
|
|
1141
|
+ }
|
|
|
1142
|
+ }
|
|
|
1143
|
+
|
|
|
1144
|
+ mapAttendanceVos.add(mapAttendanceVo);
|
|
|
1145
|
+ }
|
|
|
1146
|
+ attendance.put("attendance",mapAttendanceVos);
|
|
|
1147
|
+ attendance.put("total",employeeinfos.size());
|
|
|
1148
|
+
|
|
|
1149
|
+ long leave= mapAttendanceVos.stream().filter(x ->x.getState()!=null&&
|
|
|
1150
|
+ (x.getState().equals("请假") || x.getState().equals("调休") || x.getState().equals("公休"))
|
|
|
1151
|
+ ).count();
|
|
|
1152
|
+ attendance.put("dueToArrive", employeeinfos.size()- leave );
|
|
|
1153
|
+ attendance.put("present",mapAttendanceVos.stream().filter(x->x.getState()!=null&&
|
|
|
1154
|
+ x.getState().equals("上班打卡")).count());
|
|
|
1155
|
+ attendance.put("leave", leave);
|
|
1082
|
1156
|
map.put("attendance",attendance);
|
|
1083
|
1157
|
|
|
1084
|
1158
|
//预警
|