增加人员定位统计
This commit is contained in:
parent
0f05f8e7b0
commit
fcb45af0ea
@ -15,6 +15,8 @@ import com.zhgd.xmgl.modules.project.entity.ProjectDevStatistics;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectDevStatisticsMapper;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectDevStatisticsService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDevMapper;
|
||||
import com.zhgd.xmgl.modules.video.mapper.VideoItemMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerAttendanceMapper;
|
||||
@ -58,6 +60,8 @@ public class ProjectDevStatisticsServiceImpl extends ServiceImpl<ProjectDevStati
|
||||
private EnvironmentAlarmMapper environmentAlarmMapper;
|
||||
@Autowired
|
||||
private ProjectMapper projectMapper;
|
||||
@Autowired
|
||||
private SafetyHatDevMapper safetyHatDevMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProjectDevStatisticsCount(Map<String, Object> param) {
|
||||
@ -69,10 +73,13 @@ public class ProjectDevStatisticsServiceImpl extends ServiceImpl<ProjectDevStati
|
||||
List<Map<String, Object>> ufaceList = projectDevStatisticsMapper.getProjectDevStatisticsCount(map);
|
||||
map.put("devType", "3");
|
||||
List<Map<String, Object>> environmentList = projectDevStatisticsMapper.getProjectDevStatisticsCount(map);
|
||||
map.put("devType", "6");
|
||||
List<Map<String, Object>> hatList = projectDevStatisticsMapper.getProjectDevStatisticsCount(map);
|
||||
data.put("videoList", videoList);
|
||||
data.put("ufaceList", ufaceList);
|
||||
data.put("environmentList", environmentList);
|
||||
completionDate(videoList, ufaceList, environmentList);
|
||||
data.put("hatList", hatList);
|
||||
completionDate(videoList, ufaceList, environmentList, hatList);
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -83,7 +90,7 @@ public class ProjectDevStatisticsServiceImpl extends ServiceImpl<ProjectDevStati
|
||||
* @param ufaceList
|
||||
* @param environmentList
|
||||
*/
|
||||
private void completionDate(List<Map<String, Object>> videoList, List<Map<String, Object>> ufaceList, List<Map<String, Object>> environmentList) {
|
||||
private void completionDate(List<Map<String, Object>> videoList, List<Map<String, Object>> ufaceList, List<Map<String, Object>> environmentList, List<Map<String, Object>> hatList) {
|
||||
ArrayList<String> dateList = new ArrayList<>();
|
||||
Date date = new Date();
|
||||
int ten = 10;
|
||||
@ -97,9 +104,11 @@ public class ProjectDevStatisticsServiceImpl extends ServiceImpl<ProjectDevStati
|
||||
Map<String, Map<String, Object>> videoMap = videoList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, queryTime), m -> m));
|
||||
Map<String, Map<String, Object>> ufaceMap = ufaceList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, queryTime), m -> m));
|
||||
Map<String, Map<String, Object>> environmentMap = environmentList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, queryTime), m -> m));
|
||||
Map<String, Map<String, Object>> hatMap = hatList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, queryTime), m -> m));
|
||||
videoList.clear();
|
||||
ufaceList.clear();
|
||||
environmentList.clear();
|
||||
hatList.clear();
|
||||
for (String dateStr : dateList) {
|
||||
Map<String, Object> map = videoMap.get(dateStr);
|
||||
if (map == null) {
|
||||
@ -131,10 +140,21 @@ public class ProjectDevStatisticsServiceImpl extends ServiceImpl<ProjectDevStati
|
||||
} else {
|
||||
environmentList.add(map2);
|
||||
}
|
||||
Map<String, Object> map3 = hatMap.get(dateStr);
|
||||
if (map == null) {
|
||||
Map<String, Object> m = new HashMap<>(16);
|
||||
m.put(queryTime, dateStr);
|
||||
m.put(devNum, 0);
|
||||
m.put(devOnlineNum, 0);
|
||||
hatList.add(m);
|
||||
} else {
|
||||
hatList.add(map3);
|
||||
}
|
||||
}
|
||||
Collections.reverse(videoList);
|
||||
Collections.reverse(ufaceList);
|
||||
Collections.reverse(environmentList);
|
||||
Collections.reverse(hatList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -144,12 +164,13 @@ public class ProjectDevStatisticsServiceImpl extends ServiceImpl<ProjectDevStati
|
||||
List<Map<String, Object>> ufaceList = ufaceDevMapper.selectAllDevCount();
|
||||
List<Map<String, Object>> towerList = towerMapper.selectAllDevCount();
|
||||
List<Map<String, Object>> lifterList = lifterMapper.selectAllDevCount();
|
||||
List<Map<String, Object>> hatList = safetyHatDevMapper.selectAllDevCount();
|
||||
addSpellData(videoList, queryTime, 1);
|
||||
addSpellData(ufaceList, queryTime, 2);
|
||||
addSpellData(environmentList, queryTime, 3);
|
||||
addSpellData(towerList, queryTime, 4);
|
||||
addSpellData(lifterList, queryTime, 5);
|
||||
|
||||
addSpellData(hatList, queryTime, 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 智能安全帽-设备
|
||||
@ -49,4 +50,6 @@ public interface SafetyHatDevMapper extends BaseMapper<SafetyHatDev> {
|
||||
* @return
|
||||
*/
|
||||
List<SafetyHatDev> selectDevListByIdCard(String idCard);
|
||||
|
||||
List<Map<String, Object>> selectAllDevCount();
|
||||
}
|
||||
|
||||
@ -29,4 +29,14 @@
|
||||
join worker_info wi on shd.worker_info_id = wi.id
|
||||
where wi.id_card = #{idCard}
|
||||
</select>
|
||||
|
||||
<select id="selectAllDevCount" resultType="java.util.Map">
|
||||
SELECT project_sn projectSn,
|
||||
COUNT(1) devNum,
|
||||
SUM((case
|
||||
when online = 1 then 1
|
||||
else 0 end)) devOnline
|
||||
FROM safety_hat_dev
|
||||
GROUP BY project_sn
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user