施工管控
This commit is contained in:
parent
60630b3791
commit
693c1c2114
|
|
@ -12,7 +12,8 @@ public class BusinessConstants {
|
|||
public static final int TYPE = 1;
|
||||
public static final int TYPE2 = 2;
|
||||
public static final int TYPE3 = 0;
|
||||
public static final Long PARENT_ID = 0l;
|
||||
public static final Long PARENT_ID = 0L;
|
||||
public static final Integer LEVEL = 4;
|
||||
|
||||
/** 资源类型 1-人员*/
|
||||
public static final String RESOURCE_TYPE_USER = "1";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.common.entity.bracelet.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:PersonTreeVo
|
||||
* @author:cwchen
|
||||
* @date:2024-08-09-10:38
|
||||
* @version:1.0
|
||||
* @description:班组人员树
|
||||
*/
|
||||
@Data
|
||||
public class PersonTreeVo {
|
||||
|
||||
/**id*/
|
||||
private String id;
|
||||
/**名称*/
|
||||
private String label;
|
||||
/**是否班组长*/
|
||||
private Long isTeamLeader;
|
||||
/**是否告警*/
|
||||
private Integer isWarn;
|
||||
|
||||
/**层级*/
|
||||
private Integer level;
|
||||
/**父ID*/
|
||||
private String parentId;
|
||||
|
||||
private List<PersonTreeVo> children = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -65,4 +65,29 @@ public class ConsControlController extends BaseController {
|
|||
List<WarnInfoVo> list = service.getWarnLists(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员管控-人员树
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 10:34
|
||||
*/
|
||||
@GetMapping("getPersonsTree")
|
||||
@SysLog(title = "施工管控", businessType = OperaType.QUERY, logType = 0, module = "施工管控->人员管控", details = "人员管控")
|
||||
public AjaxResult getPersonsTree(BraceletParamsDto dto){
|
||||
return service.getPersonsTree(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 今日施工班组/施工人数/安全帽信息
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 13:12
|
||||
*/
|
||||
@GetMapping("getWorkInfo")
|
||||
public AjaxResult getWorkInfo(BraceletParamsDto dto){
|
||||
return service.getWorkInfo(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ 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.WarnInfoVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @className:ConsControlMapper
|
||||
|
|
@ -42,4 +45,32 @@ public interface ConsControlMapper {
|
|||
* @date 2024/8/9 9:45
|
||||
*/
|
||||
List<WarnInfoVo> getWarnLists(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 人员管控-人员树
|
||||
* @param dto
|
||||
* @return List<PersonTreeVo>
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 10:44
|
||||
*/
|
||||
List<PersonTreeVo> getPersonsTree(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 获取今日施工班组
|
||||
* @param dto
|
||||
* @return List<Integer>
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 13:16
|
||||
*/
|
||||
List<Integer> getWorkNum(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 安全帽绑定信息
|
||||
* @param dto
|
||||
* @return List<Map<String,Object>>
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 13:49
|
||||
*/
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> getSafetyHatInfo(BraceletParamsDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,4 +40,22 @@ public interface IConsControlService {
|
|||
* @date 2024/8/9 9:44
|
||||
*/
|
||||
List<WarnInfoVo> getWarnLists(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 人员管控-人员树
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 10:36
|
||||
*/
|
||||
AjaxResult getPersonsTree(BraceletParamsDto dto);
|
||||
|
||||
/**
|
||||
* 今日施工班组/施工人数/安全帽信息
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2024/8/9 13:14
|
||||
*/
|
||||
AjaxResult getWorkInfo(BraceletParamsDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ 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.WarnInfoVo;
|
||||
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.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @className:ConsControlServiceImpl
|
||||
|
|
@ -77,19 +77,20 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
vo.setBase64Url(imgBase64);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return warnInfoVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取违章识别图片的base64
|
||||
*
|
||||
* @param base64Url
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/8/8 18:36
|
||||
*/
|
||||
public String getImgBase64(String base64Url){
|
||||
public String getImgBase64(String base64Url) {
|
||||
try {
|
||||
R<SysFile> result = remoteFileService.getImgBase64(base64Url, SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
|
|
@ -99,7 +100,7 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
return base64;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -110,8 +111,55 @@ public class ConsControlServiceImpl implements IConsControlService {
|
|||
try {
|
||||
warnInfoVoList = mapper.getWarnLists(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return warnInfoVoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getPersonsTree(BraceletParamsDto dto) {
|
||||
JSONArray resultTree = new JSONArray();
|
||||
try {
|
||||
List<PersonTreeVo> list = new ArrayList<>();
|
||||
list = mapper.getPersonsTree(dto);
|
||||
for (PersonTreeVo vo : list) {
|
||||
//忽略工程数据、杆塔、班组数据 1.工程 2.杆塔 3.班组 4.班组成员/临时人员
|
||||
if (!Objects.equals(vo.getLevel(), BusinessConstants.LEVEL)) {
|
||||
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 getWorkInfo(BraceletParamsDto dto) {
|
||||
Map<String, Object> mapData = new HashMap<>();
|
||||
try {
|
||||
// 获取施工班组、施工人数(包含班组人员和临时人员))、安全帽绑定信息
|
||||
List<Integer> workTeamList = mapper.getWorkNum(dto);
|
||||
List<Map<String, Object>> safetyHatLists = mapper.getSafetyHatInfo(dto);
|
||||
if (CollectionUtils.isNotEmpty(safetyHatLists)) {
|
||||
for (Map<String, Object> map : safetyHatLists) {
|
||||
if (map.get("phone") != null) {
|
||||
map.put("phone", Sm4Utils.decode(String.valueOf(map.get("phone"))));
|
||||
}
|
||||
}
|
||||
}
|
||||
mapData.put("workTeamNum", workTeamList.get(0));
|
||||
mapData.put("workUserNum", workTeamList.get(1) + workTeamList.get(2));
|
||||
mapData.put("safetyHatList", safetyHatLists);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return AjaxResult.success(mapData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="roleCode=='depart'">
|
||||
AND a.departId = #{departId}
|
||||
</if>
|
||||
AND a.departId IS NOT NULL
|
||||
</where>
|
||||
ORDER BY a.orderTime DESC
|
||||
</select>
|
||||
|
|
@ -94,4 +95,143 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
ORDER BY tw.create_time DESC
|
||||
</select>
|
||||
<!--人员管控-人员树-->
|
||||
<select id="getPersonsTree" resultType="com.bonus.common.entity.bracelet.vo.PersonTreeVo">
|
||||
SELECT * FROM (
|
||||
SELECT tp.id,
|
||||
tp.pro_name AS label,
|
||||
tp.depart_id AS departId,
|
||||
0 AS parentId,
|
||||
1 AS level,
|
||||
0 AS isTeamLeader,
|
||||
0 AS isWarn
|
||||
FROM tb_project tp
|
||||
WHERE tp.del_flag = 0
|
||||
UNION ALL
|
||||
SELECT CONCAT('tower','-',tpp.id),
|
||||
tpp.power_name AS label,
|
||||
tp.depart_id AS departId,
|
||||
tpp.pro_id AS parentId,
|
||||
2 AS level,
|
||||
0 AS isTeamLeader,
|
||||
0 AS isWarn
|
||||
FROM tb_project_power tpp
|
||||
LEFT JOIN tb_project tp ON tpp.pro_id = tp.id AND tp.del_flag = 0
|
||||
WHERE tpp.del_flag = 0
|
||||
UNION ALL
|
||||
SELECT CONCAT('team','-',twt.team_id) AS id,
|
||||
twt.team_name AS label,
|
||||
tp.depart_id AS departId,
|
||||
CONCAT('tower','-',tdu.gt_id) AS parentId,
|
||||
3 AS level,
|
||||
0 AS isTeamLeader,
|
||||
0 AS isWarn
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN t_work_team twt ON tdu.team_id = twt.team_id AND twt.del_flag = 0
|
||||
LEFT JOIN tb_project tp ON twt.pro_id = tp.id AND tp.del_flag = 0
|
||||
WHERE tdub.dev_type = 'shx' AND tdub.gh_time IS NULL
|
||||
UNION ALL
|
||||
SELECT tpe.id,
|
||||
CONCAT(tpe.name,'-',tpe.phone) AS label,
|
||||
tp.depart_id AS departId,
|
||||
CONCAT('team','-',tpe.team_id) AS parentId,
|
||||
4 AS level,
|
||||
IF(twt.team_leader_id = tpe.id,1,0) AS isTeamLeader,
|
||||
0 AS isWarn
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN t_work_team twt ON tdu.team_id = twt.team_id AND twt.del_flag = 0
|
||||
LEFT JOIN tb_people tpe ON twt.team_id = tpe.team_id AND tpe.del_flag = 0
|
||||
LEFT JOIN tb_project tp ON twt.pro_id = tp.id AND tp.del_flag = 0
|
||||
WHERE tdub.dev_type = 'shx' AND tdub.gh_time IS NULL
|
||||
UNION ALL
|
||||
SELECT tlu.id,
|
||||
CONCAT(tlu.name,'-',tlu.phone) AS label,
|
||||
tp.depart_id AS departId,
|
||||
CONCAT('team','-',tlu.team_id) AS parentId,
|
||||
4 AS level,
|
||||
0 AS isTeamLeader,
|
||||
0 AS isWarn
|
||||
FROM tb_dev_use tdu
|
||||
LEFT JOIN tb_dev_use_bid tdub ON tdu.id = tdub.id
|
||||
LEFT JOIN t_work_team twt ON tdu.team_id = twt.team_id AND twt.del_flag = 0
|
||||
LEFT JOIN tb_ls_user tlu ON twt.team_id = tlu.team_id
|
||||
LEFT JOIN tb_project tp ON twt.pro_id = tp.id AND tp.del_flag = 0
|
||||
WHERE tdub.dev_type = 'shx' AND tdub.gh_time IS NULL
|
||||
) a
|
||||
<where>
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
a.departId = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND a.departId = #{departId}
|
||||
</if>
|
||||
AND a.departId IS NOT NULL
|
||||
</where>
|
||||
</select>
|
||||
<!--获取今日施工班组/班组施工人数/临时人员施工数量-->
|
||||
<select id="getWorkNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM t_work_team twt
|
||||
LEFT JOIN tb_project tp ON twt.pro_id = tp.id AND tp.del_flag = 0
|
||||
WHERE twt.team_status = 1 AND twt.del_flag = 0
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
AND tp.depart_id = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND tp.depart_id = #{departId}
|
||||
</if>
|
||||
AND tp.depart_id IS NOT NULL
|
||||
UNION ALL
|
||||
SELECT COUNT(*)
|
||||
FROM t_work_team twt
|
||||
LEFT JOIN tb_project tp ON twt.pro_id = tp.id AND tp.del_flag = 0
|
||||
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_status = 1 AND twt.del_flag = 0
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
AND tp.depart_id = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND tp.depart_id = #{departId}
|
||||
</if>
|
||||
AND tp.depart_id IS NOT NULL
|
||||
UNION ALL
|
||||
SELECT COUNT(*)
|
||||
FROM t_work_team twt
|
||||
LEFT JOIN tb_project tp ON twt.pro_id = tp.id AND tp.del_flag = 0
|
||||
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_status = 1 AND twt.del_flag = 0
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
AND tp.depart_id = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND tp.depart_id = #{departId}
|
||||
</if>
|
||||
AND tp.depart_id IS NOT NULL
|
||||
</select>
|
||||
<!--安全帽绑定信息-->
|
||||
<select id="getSafetyHatInfo" resultType="java.util.Map">
|
||||
SELECT td.id,
|
||||
tpe.name,
|
||||
tpe.phone,
|
||||
td.dev_name AS devName,
|
||||
td.dev_code AS devCode,
|
||||
td.dev_index AS devIndex,
|
||||
td.dev_status AS devStatus
|
||||
FROM tb_device td
|
||||
LEFT JOIN tb_dev_ly tdl ON td.id = tdl.dev_id
|
||||
LEFT JOIN tb_project tp ON tdl.pro_id = tp.id AND tp.del_flag = 0
|
||||
LEFT JOIN tb_people tpe ON tdl.ly_user = tpe.id AND tpe.del_flag = 0
|
||||
WHERE td.dev_type = 'aqm' AND tdl.ly_user IS NOT NULL
|
||||
<if test="roleCode!='administrators' and roleCode!='depart'">
|
||||
AND tp.depart_id = -1
|
||||
</if>
|
||||
<if test="roleCode=='depart'">
|
||||
AND tp.depart_id = #{departId}
|
||||
</if>
|
||||
AND tp.depart_id IS NOT NULL
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue