From 8994f3f7034a3adb50857364922b040e19bb4c7e Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Wed, 3 Apr 2024 17:54:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=9C=BA=E8=AE=B0=E5=BD=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/constant/Constant.java | 12 ++++++-- .../entity/background/dto/ParamDto.java | 6 ++++ .../entity/background/vo/UserAccessVo.java | 2 ++ .../background/mapper/HumanManageMapper.java | 27 +++++++++++++++++ .../service/impl/HumanServiceImpl.java | 30 +++++++++++++++++++ .../resources/mapper/HumanManageMapper.xml | 28 ++++++++++++----- 6 files changed, 95 insertions(+), 10 deletions(-) diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java index 400c43e..56ed1e9 100644 --- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java @@ -58,12 +58,20 @@ public class Constant { public final static String TG = "停工"; public final static String ONLINE = "1"; - public final static String AIR_QUALITY = "PM2.5,PM10"; + public final static String AIR_QUALITY = "气压,含氧量,二氧化碳,硫化氢"; public final static String NOISE_LEVEL= "噪声"; - public final static String GRAY_LAYER = "二氧化碳"; + public final static String GRAY_LAYER = "PM2.5,PM10"; public final static String WARN = "1"; public final static String NOT_WARN = "0"; + /**车辆闸机、人员闸机 编码*/ + public final static String PERSON_CAR_TYPE = "1907"; + /**人员闸机检测名称*/ + public final static String PERSON = "绑定人"; + public final static String ACCESS_TIME = "出入时间"; + public final static String ACCESS_TYPE = "出入类型"; + + diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java index 6e7cad7..b7e9f3c 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java @@ -61,4 +61,10 @@ public class ParamDto { @ApiModelProperty(value = "单项编码") private String signNo; + + @ApiModelProperty(value = "字典编码") + private String typeCode; + + @ApiModelProperty(value = "检测名称") + private String modeName; } diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/UserAccessVo.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/UserAccessVo.java index 605b050..b0e9af1 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/UserAccessVo.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/UserAccessVo.java @@ -29,4 +29,6 @@ public class UserAccessVo { @ApiModelProperty(value = "手机号") private String userPhone; + + private String value; } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java index 2ca6e40..8e4323e 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java @@ -105,6 +105,7 @@ public interface HumanManageMapper { /** * 获取人员出入记录 + * * @param dto * @return List * @description @@ -115,6 +116,7 @@ public interface HumanManageMapper { /** * 绑定安全帽 + * * @param dto * @return */ @@ -122,6 +124,7 @@ public interface HumanManageMapper { /** * 接触安全帽绑定 + * * @param dto * @return */ @@ -129,6 +132,7 @@ public interface HumanManageMapper { /** * 查询绑定记录 + * * @param dto * @return */ @@ -136,6 +140,7 @@ public interface HumanManageMapper { /** * 查询已绑定设备 + * * @param dto * @return */ @@ -143,8 +148,30 @@ public interface HumanManageMapper { /** * 修改成功 + * * @param dto * @return */ int updateDev(ParamDto dto); + + /** + * 人员详情 + * + * @param dto + * @return UserAccessVo + * @description + * @author cwchen + * @date 2024/4/3 17:13 + */ + UserAccessVo getUserDeatail(ParamDto dto); + + /** + * 获取人员出入场记录 + * @param value + * @return String + * @description + * @author cwchen + * @date 2024/4/3 17:44 + */ + String getUserAccessLists(String value); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java index 3b2edc4..1983d7f 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.securitycontrol.background.mapper.HumanManageMapper; import com.securitycontrol.background.service.HumanService; +import com.securitycontrol.common.core.constant.Constant; import com.securitycontrol.common.core.constant.HttpStatus; import com.securitycontrol.common.core.constant.SecurityConstants; import com.securitycontrol.common.core.domain.Result; @@ -250,13 +251,42 @@ public class HumanServiceImpl implements HumanService { public List getPersonnelAccessLists(ParamDto dto) { List list = new ArrayList<>(); try { + dto.setTypeCode(Constant.PERSON_CAR_TYPE); + dto.setModeName(Constant.PERSON); list = mapper.getPersonnelAccessLists(dto); + UserAccessVo userDetail = mapper.getUserDeatail(dto); + String decryptIdNumber = AesCbcUtils.decrypt(userDetail.getIdNumber()); + if(decryptIdNumber != null){ + userDetail.setIdNumber(decryptIdNumber); + } + for (UserAccessVo vo : list) { + String value = vo.getValue(); + vo.setIdNumber(userDetail.getIdNumber()); + vo.setUserPhone(userDetail.getUserPhone()); + vo.setUserName(userDetail.getUserName()); + String data = mapper.getUserAccessLists(value); + if(StringUtils.isNotEmpty(data)){ + String[] dataArr = data.split(","); + setUserAccessData(vo,dataArr); + } + } } catch (Exception e) { log.error("获取人员出入记录",e); } return list; } + public UserAccessVo setUserAccessData(UserAccessVo vo,String[] valArr){ + for (String str : valArr) { + String[] splitStr = str.split("@"); + if(Objects.equals(splitStr[0],Constant.ACCESS_TIME)){ + vo.setAccessTime(splitStr[1]); + }else if(Objects.equals(splitStr[0],Constant.ACCESS_TYPE)){ + vo.setAccessType(splitStr[1]); + } + } + return vo; + } /** * 人员绑定安全膜 * @param dto diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml index 9316f95..56a576c 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml @@ -154,14 +154,11 @@ + + + + \ No newline at end of file From f88f1afa222a2c59d5ee0abca276ac1d818b44ae Mon Sep 17 00:00:00 2001 From: sliang <1589399930@qq.com> Date: Wed, 3 Apr 2024 18:17:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A4=A7=E5=B1=8F-=E5=87=BA=E5=85=A5?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/AccessMgeMapper.xml | 162 ++++++++++++------ 1 file changed, 112 insertions(+), 50 deletions(-) diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml index deec1d2..8cfbff6 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml @@ -4,31 +4,62 @@ SELECT - LPAD(SUM(jtrNum), 3, '0') AS jtrNum, - LPAD(SUM(jrcNum), 3, '0') AS jrcNum, - LPAD(SUM(dyrNum), 4, '0') AS dyrNum, - LPAD(SUM(dycNum), 4, '0') AS dycNum - FROM ( - SELECT - sum( case when tua.access_type = '1' then 1 else 0 end ) as jtrNum, - sum( case when tua.access_type = '2' then 1 else 0 end ) as jrcNUm, - 0 as dyrNum, - 0 as dycNUm - FROM tb_work_team twt - LEFT JOIN t_team_people ttp on twt.team_id = ttp.team_id - LEFT JOIN tb_user_access tua ON ttp.user_id = tua.user_id - WHERE twt.bid_code = #{bidCode} and to_days(tua.access_time) = to_days(NOW()) - UNION ALL - SELECT - 0 as jtrNum, - 0 as jrcNUm, - sum( case when tua.access_type = '1' then 1 else 0 end ) as dyrNum, - sum( case when tua.access_type = '2' then 1 else 0 end ) as dycNUm - FROM tb_work_team twt - LEFT JOIN t_team_people ttp on twt.team_id = ttp.team_id - LEFT JOIN tb_user_access tua ON ttp.user_id = tua.user_id - WHERE twt.bid_code = #{bidCode} and DATE_FORMAT(tua.access_time, '%Y%m') = DATE_FORMAT(NOW(), '%Y%m') - )a + LPAD( SUM( jtrNum ), 3, '0' ) AS jtrNum, + LPAD( SUM( jrcNum ), 3, '0' ) AS jrcNum, + LPAD( SUM( dyrNum ), 4, '0' ) AS dyrNum, + LPAD( SUM( dycNum ), 4, '0' ) AS dycNum + FROM + ( + SELECT + sum( CASE WHEN aa.val LIKE '%入%' THEN 1 ELSE 0 END ) jtrNum, + sum( CASE WHEN aa.val LIKE '%出%' THEN 1 ELSE 0 END ) jrcNum, + 0 AS dyrNum, + 0 AS dycNUm + FROM + ( + SELECT + thdv.source_type, + thdv.create_time, + tpb.bid_code, + GROUP_CONCAT( thdv.val ) AS val + FROM + `tb_pro_bd` tpb + LEFT JOIN tb_bd_device tbd ON tpb.id = tbd.bd_id + LEFT JOIN tb_device_detail tdd ON tbd.device_id = tdd.device_id + LEFT JOIN tb_his_device_value thdv ON tdd.id = thdv.attribute_id + WHERE + tpb.bid_code = #{bidCode} + AND tbd.device_code = '1907002' + AND to_days( thdv.create_time ) = to_days( + NOW()) + GROUP BY + thdv.source_type + ) aa UNION ALL + SELECT + 0 AS jtrNum, + 0 AS jrcNUm, + sum( CASE WHEN bb.val LIKE '%入%' THEN 1 ELSE 0 END ) dyrNum, + sum( CASE WHEN bb.val LIKE '%出%' THEN 1 ELSE 0 END ) dycNUm + FROM + ( + SELECT + thdv.source_type, + thdv.create_time, + tpb.bid_code, + GROUP_CONCAT( thdv.val ) AS val + FROM + `tb_pro_bd` tpb + LEFT JOIN tb_bd_device tbd ON tpb.id = tbd.bd_id + LEFT JOIN tb_device_detail tdd ON tbd.device_id = tdd.device_id + LEFT JOIN tb_his_device_value thdv ON tdd.id = thdv.attribute_id + WHERE + tpb.bid_code = #{bidCode} + AND tbd.device_code = '1907002' + AND DATE_FORMAT( thdv.create_time, '%Y%m' ) = DATE_FORMAT( NOW(), '%Y%m' ) + GROUP BY + thdv.source_type + ) bb + ) ab