施工管控
This commit is contained in:
parent
e40e5163fb
commit
354ce0dbd3
|
|
@ -45,6 +45,9 @@ public class BusinessConstants {
|
|||
/** 在施状态值*/
|
||||
public final static Integer WORK_STATUS = 0;
|
||||
|
||||
public static final String LAT = "纬度";
|
||||
public static final String LON = "经度";
|
||||
|
||||
|
||||
public final static Integer CELL_1 = 1;
|
||||
public final static Integer CELL_2 = 2;
|
||||
|
|
|
|||
|
|
@ -90,4 +90,16 @@ public class ConsControlController extends BaseController {
|
|||
public AjaxResult getWorkInfo(BraceletParamsDto dto){
|
||||
return service.getWorkInfo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取整个班组人员/班组临时人员的定位/杆塔的定位以及施工范围的半径
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 14:36
|
||||
*/
|
||||
@GetMapping("getPersonsInfo")
|
||||
public AjaxResult getPersonsInfo(BraceletParamsDto dto){
|
||||
return service.getPersonsInfo(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.bonus.common.entity.bracelet.vo.BallTreeVo;
|
|||
import com.bonus.common.entity.bracelet.vo.PersonTreeVo;
|
||||
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -73,4 +74,41 @@ public interface ConsControlMapper {
|
|||
*/
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> getSafetyHatInfo(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 获取杆塔坐标
|
||||
* @return Map<String,Object>
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 15:13
|
||||
*/
|
||||
@MapKey("id")
|
||||
Map<String, Object> getTowerInfo(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 获取施工距离
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 15:16
|
||||
*/
|
||||
String getDistance();
|
||||
|
||||
/**
|
||||
* 获取绑定手环的施工班组人员、临时人员信息
|
||||
* @param dto
|
||||
* @return List<Map<String,Object>>
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 15:23
|
||||
*/
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> getWorkPersonInfo(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 获取已绑手环的定位信息
|
||||
* @param map
|
||||
* @return Map<String,Object>
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 16:30
|
||||
*/
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> getShDeviceInfo(Map<String, Object> map);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,4 +58,13 @@ public interface IConsControlService {
|
|||
* @date 2024/8/9 13:14
|
||||
*/
|
||||
AjaxResult getWorkInfo(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 获取整个班组人员/班组临时人员的定位/杆塔的定位以及施工范围的半径
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 14:40
|
||||
*/
|
||||
AjaxResult getPersonsInfo(BraceletParamsDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,15 @@ package com.bonus.bracelet.service.impl;
|
|||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.app.entity.BraceletEntity;
|
||||
import com.bonus.bracelet.mapper.ConsControlMapper;
|
||||
import com.bonus.bracelet.service.IConsControlService;
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import com.bonus.common.core.constant.HttpStatus;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.HaversineUtil;
|
||||
import com.bonus.common.core.utils.StringHelper;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
|
|
@ -21,6 +23,7 @@ import com.bonus.system.api.RemoteFileService;
|
|||
import com.bonus.system.api.domain.SysFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -162,4 +165,85 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
}
|
||||
return AjaxResult.success(mapData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getPersonsInfo(BraceletParamsDto dto) {
|
||||
Map<String, Object> mapData = new HashMap<>();
|
||||
try {
|
||||
// 获取杆塔信息、施工距离、绑定手环的班组施工人员/临时人员 位置信息
|
||||
Map<String, Object> towerMap = mapper.getTowerInfo(dto);
|
||||
String distance = mapper.getDistance();
|
||||
Double distanceValue = 0D;
|
||||
if (StringUtils.isEmpty(distance)) {
|
||||
distanceValue = StringUtils.isEmpty(distance) ? 50 : Double.parseDouble(distance);
|
||||
}
|
||||
List<Map<String, Object>> personList = mapper.getWorkPersonInfo(dto);
|
||||
if (CollectionUtils.isNotEmpty(personList)) {
|
||||
for (Map<String, Object> map : personList) {
|
||||
if (map.get("phone") != null) {
|
||||
map.put("phone", Sm4Utils.decode(String.valueOf(map.get("phone"))));
|
||||
}
|
||||
// 获取已绑手环的定位信息
|
||||
List<Map<String, Object>> shMapDataList = mapper.getShDeviceInfo(map);
|
||||
map = getLatAndLon(shMapDataList,map);
|
||||
// 验证施工人员是否超出施工范围
|
||||
Integer isAbnormal = isAbnormal(distanceValue, map, towerMap);
|
||||
map.put("isWarn", isAbnormal);
|
||||
}
|
||||
}
|
||||
mapData.put("towerInfo", towerMap);
|
||||
mapData.put("distance", distanceValue);
|
||||
mapData.put("personList", personList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success(mapData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组人员/临时人员 是否超出正常施工范围
|
||||
*
|
||||
* @param distance
|
||||
* @param map
|
||||
* @return Integer
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 15:56
|
||||
*/
|
||||
public Integer isAbnormal(Double distance, Map<String, Object> map, Map<String, Object> towerMap) {
|
||||
Integer isWarn = 0;
|
||||
if(map.get("lon") == null || map.get("lat") == null){
|
||||
return isWarn;
|
||||
}
|
||||
Double lat = Double.parseDouble(String.valueOf(towerMap.get("lat")));
|
||||
Double lon = Double.parseDouble(String.valueOf(towerMap.get("lon")));
|
||||
Double sgLat = Double.parseDouble(String.valueOf(map.get("lat")));
|
||||
Double sgLon = Double.parseDouble(String.valueOf(map.get("lon")));
|
||||
double len = HaversineUtil.vincentyDistance(sgLat, sgLon, lat, lon);
|
||||
if (len > distance) {
|
||||
isWarn = 1;
|
||||
}
|
||||
return isWarn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 赋值手环设备的经纬度
|
||||
* @param shMapDataList
|
||||
* @param map
|
||||
* @return Map<String, Object>
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 16:56
|
||||
*/
|
||||
public Map<String, Object> getLatAndLon(List<Map<String, Object>> shMapDataList, Map<String, Object> map) {
|
||||
if (CollectionUtils.isEmpty(shMapDataList)) {
|
||||
return map;
|
||||
}
|
||||
for (Map<String, Object> mapData : shMapDataList) {
|
||||
if (Objects.equals(String.valueOf(map.get("dataCode")), BusinessConstants.LAT)) {
|
||||
map.put("lat", mapData.get("dataVal"));
|
||||
} else if (Objects.equals(String.valueOf(map.get("dataCode")), BusinessConstants.LON)) {
|
||||
map.put("lon", mapData.get("dataVal"));
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,4 +234,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
AND tp.depart_id IS NOT NULL
|
||||
</select>
|
||||
<!--获取杆塔坐标-->
|
||||
<select id="getTowerInfo" resultType="java.util.Map">
|
||||
SELECT id,
|
||||
power_name AS powerName,
|
||||
lon,
|
||||
lat
|
||||
FROM tb_project_power
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
<!--获取施工距离-->
|
||||
<select id="getDistance" resultType="java.lang.String">
|
||||
SELECT dict_value
|
||||
FROM sys_dict_data
|
||||
WHERE dict_type = 'sys_sg_distance'
|
||||
LIMIT 1
|
||||
</select>
|
||||
<!--获取绑定手环的施工班组人员、临时人员信息-->
|
||||
<select id="getWorkPersonInfo" resultType="java.util.Map">
|
||||
SELECT tpe.id,tpe.name,tpe.phone,tb.id AS devId,0 AS type
|
||||
FROM t_work_team twt
|
||||
LEFT JOIN tb_people tpe ON twt.team_id = tpe.team_id AND tpe.del_flag = 0
|
||||
INNER JOIN tb_bracelet tb ON tpe.id = tb.bid_id AND tb.del_flag = 0 AND tb.peopel_type = 0
|
||||
WHERE twt.team_id = #{teamId}
|
||||
UNION ALL
|
||||
SELECT tls.id,tls.name,tls.phone,tb.id AS devId,1 AS type
|
||||
FROM t_work_team twt
|
||||
LEFT JOIN tb_ls_user tls ON twt.team_id = tls.team_id
|
||||
INNER JOIN tb_bracelet tb ON tls.id = tb.bid_id AND tb.del_flag = 0 AND tb.peopel_type = 1
|
||||
WHERE twt.team_id = #{teamId}
|
||||
</select>
|
||||
<!--获取已绑手环的信息-->
|
||||
<select id="getShDeviceInfo" resultType="java.util.Map">
|
||||
SELECT id ,
|
||||
data_name AS dataName,
|
||||
data_val AS dataVal,
|
||||
data_unit AS dataUnit,
|
||||
data_code AS dataCode,
|
||||
data_time AS dataTime
|
||||
FROM tb_dev_details
|
||||
WHERE dev_id=#{devId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue