施工管控

This commit is contained in:
cwchen 2024-08-10 14:54:05 +08:00
parent c0f0ea7f8d
commit d0ee2bf132
7 changed files with 184 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @className:ParamsDto
@ -106,4 +107,19 @@ public class BraceletParamsDto {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date backTime = new Date();
/**人员抽检LIST*/
private List<SpotCheckInfo> spotCheckList;
@Data
public static class SpotCheckInfo{
/**人员ID*/
private Long userId;
/**人员类型*/
private Integer userType;
/**手环编码*/
private String devCode;
/**手环设备级联编码*/
private String shCode;
}
}

View File

@ -0,0 +1,31 @@
package com.bonus.common.entity.bracelet.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @className:TeamPeopleTreeVo
* @author:cwchen
* @date:2024-08-10-13:17
* @version:1.0
* @description:班组成员-
*/
@Data
public class TeamPeopleTreeVo {
/**id*/
private Long id;
/**名称*/
private String label;
/**手环编号*/
private String shCode;
/**手环级联编号*/
private String devCode;
/**父ID*/
private Long parentId;
/**人员类型*/
private Integer userType;
private List<TeamPeopleTreeVo> children = new ArrayList<>();
}

View File

@ -10,9 +10,7 @@ import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@ -102,4 +100,22 @@ public class ConsControlController extends BaseController {
public AjaxResult getPersonsInfo(BraceletParamsDto dto){
return service.getPersonsInfo(dto);
}
/**
* 根据杆塔获取班组人员/临时人员-已绑定手环
* @param dto
* @return AjaxResult
* @author cwchen
* @date 2024/8/10 13:09
*/
@GetMapping("getTeamPersonByTower")
public AjaxResult getTeamPersonByTower(BraceletParamsDto dto){
return service.getTeamPersonByTower(dto);
}
@PostMapping("spotCheck")
@SysLog(title = "施工管控", businessType = OperaType.QUERY, logType = 0, module = "施工管控->人员管控", details = "手环人脸验证抽检")
public AjaxResult spotCheck(@RequestBody BraceletParamsDto dto){
return service.spotCheck(dto);
}
}

View File

@ -3,6 +3,7 @@ package com.bonus.bracelet.mapper;
import com.bonus.common.entity.bracelet.BraceletParamsDto;
import com.bonus.common.entity.bracelet.vo.BallTreeVo;
import com.bonus.common.entity.bracelet.vo.PersonTreeVo;
import com.bonus.common.entity.bracelet.vo.TeamPeopleTreeVo;
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
@ -111,4 +112,13 @@ public interface ConsControlMapper {
*/
@MapKey("id")
List<Map<String, Object>> getShDeviceInfo(Map<String, Object> map);
/**
* 根据杆塔获取班组人员-已绑定手环
* @param dto
* @return List<TeamPeopleTreeVo>
* @author cwchen
* @date 2024/8/10 13:12
*/
List<TeamPeopleTreeVo> getTeamPersonByTower(BraceletParamsDto dto);
}

View File

@ -67,4 +67,22 @@ public interface IConsControlService {
* @date 2024/8/9 14:40
*/
AjaxResult getPersonsInfo(BraceletParamsDto dto);
/**
* 根据杆塔获取班组人员-已绑定手环
* @param dto
* @return AjaxResult
* @author cwchen
* @date 2024/8/10 13:09
*/
AjaxResult getTeamPersonByTower(BraceletParamsDto dto);
/**
* 手环验证人脸抽检
* @param dto
* @return AjaxResult
* @author cwchen
* @date 2024/8/10 14:27
*/
AjaxResult spotCheck(BraceletParamsDto dto);
}

View File

@ -3,7 +3,6 @@ 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;
@ -11,13 +10,13 @@ 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.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;
import com.bonus.common.core.utils.BuildTreeUtil;
import com.bonus.common.entity.bracelet.vo.BallTreeVo;
import com.bonus.common.entity.bracelet.vo.PersonTreeVo;
import com.bonus.common.entity.bracelet.vo.TeamPeopleTreeVo;
import com.bonus.common.entity.bracelet.vo.WarnInfoVo;
import com.bonus.system.api.RemoteFileService;
import com.bonus.system.api.domain.SysFile;
@ -185,7 +184,7 @@ public class ConsControlServiceImpl implements IConsControlService {
}
// 获取已绑手环的定位信息
List<Map<String, Object>> shMapDataList = mapper.getShDeviceInfo(map);
map = getLatAndLon(shMapDataList,map);
map = getLatAndLon(shMapDataList, map);
// 验证施工人员是否超出施工范围
Integer isAbnormal = isAbnormal(distanceValue, map, towerMap);
map.put("isWarn", isAbnormal);
@ -200,6 +199,57 @@ public class ConsControlServiceImpl implements IConsControlService {
return AjaxResult.success(mapData);
}
@Override
public AjaxResult getTeamPersonByTower(BraceletParamsDto dto) {
JSONArray resultTree = new JSONArray();
try {
List<TeamPeopleTreeVo> list = new ArrayList<>();
list = mapper.getTeamPersonByTower(dto);
for (TeamPeopleTreeVo vo : list) {
//忽略工程数据
if (Objects.equals(vo.getParentId(), BusinessConstants.PARENT_ID)) {
continue;
}
String[] valArr = vo.getLabel().split("-");
if (StringUtils.isNotEmpty(valArr[1])) {
vo.setLabel(valArr[0] + "-" + Sm4Utils.decode(valArr[1]));
}
}
//构建班组人员树
resultTree = BuildTreeUtil.listInfoToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentId", "children");
} catch (Exception e) {
log.error(e.toString(), e);
}
return AjaxResult.success(resultTree);
}
@Override
public AjaxResult spotCheck(BraceletParamsDto dto) {
try {
if (CollectionUtils.isEmpty(dto.getSpotCheckList())) {
return AjaxResult.error("未选择班组人员,进行手环人脸验证");
}
for (BraceletParamsDto.SpotCheckInfo info : dto.getSpotCheckList()) {
if (info.getUserId() == null) {
return AjaxResult.error("人员ID不能为空");
}
if (info.getUserType() == null) {
return AjaxResult.error("人员类型不能为空");
}
if (StringUtils.isBlank(info.getDevCode())) {
return AjaxResult.error("设备级联编码不能为空");
}
if (StringUtils.isBlank(info.getShCode())) {
return AjaxResult.error("手环编码不能为空");
}
}
// 批量下发手环人脸验证指令-未对接
} catch (Exception e) {
log.error(e.toString(), e);
}
return AjaxResult.success("已下达手环人脸验证抽检指令");
}
/**
* 班组人员/临时人员 是否超出正常施工范围
*
@ -211,7 +261,7 @@ public class ConsControlServiceImpl implements IConsControlService {
*/
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){
if (map.get("lon") == null || map.get("lat") == null) {
return isWarn;
}
Double lat = Double.parseDouble(String.valueOf(towerMap.get("lat")));
@ -227,6 +277,7 @@ public class ConsControlServiceImpl implements IConsControlService {
/**
* 赋值手环设备的经纬度
*
* @param shMapDataList
* @param map
* @return Map<String, Object>

View File

@ -275,4 +275,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM tb_dev_details
WHERE dev_id=#{devId}
</select>
<!--根据杆塔获取班组人员-已绑定手环-->
<select id="getTeamPersonByTower" resultType="com.bonus.common.entity.bracelet.vo.TeamPeopleTreeVo">
SELECT twt.team_id AS id,
twt.team_name AS label,
0 AS parentId,
null AS shCode,
null AS devCode,
null AS userType
FROM tb_sh_box sbx
INNER JOIN t_work_team twt on twt.team_id=sbx.team_id AND twt.del_flag = 0
WHERE sbx.gt_id = #{id} AND sbx.del_flag = 0
UNION ALL
SELECT tpe.id,
CONCAT(tpe.name,'-',tpe.phone) AS label,
tpe.team_id AS parentId,
tb.sh_code AS shCode,
IFNULL(tb.dev_code,'') AS devCode,
0 AS userType
FROM tb_bracelet tb
LEFT JOIN tb_sh_box sbx ON tb.box_id=sbx.id AND sbx.del_flag = 0
LEFT JOIN tb_people tpe ON tpe.id= tb.bid_id AND tpe.del_flag = 0
WHERE sbx.gt_id = #{id} AND tb.peopel_type = 0 AND tb.bid_id IS NOT NULL AND sbx.del_flag = 0
UNION ALL
SELECT tlu.id,
CONCAT(tlu.name,'-',tlu.phone) AS label,
tlu.team_id AS parentId,
tb.sh_code AS shCode,
IFNULL(tb.dev_code,'') AS devCode,
1 AS userType
FROM tb_bracelet tb
LEFT JOIN tb_sh_box sbx ON tb.box_id=sbx.id AND sbx.del_flag = 0
LEFT JOIN tb_ls_user tlu ON tlu.id= tb.bid_id
WHERE sbx.gt_id = #{id} AND tb.peopel_type = 1 AND sbx.del_flag = 0
</select>
</mapper>