车辆出入记录
This commit is contained in:
parent
f265bcbdd6
commit
9016d980e9
|
|
@ -78,6 +78,7 @@ public class Constant {
|
|||
public final static String PERSON_CAR_TYPE = "1907";
|
||||
/**人员闸机检测名称*/
|
||||
public final static String PERSON = "绑定人";
|
||||
public final static String CAR = "车牌号";
|
||||
public final static String ACCESS_TIME = "出入时间";
|
||||
public final static String ACCESS_TYPE = "出入类型";
|
||||
|
||||
|
|
|
|||
|
|
@ -67,4 +67,7 @@ public class ParamDto {
|
|||
|
||||
@ApiModelProperty(value = "检测名称")
|
||||
private String modeName;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String idNumber;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,5 +53,11 @@ public class VehicleVo {
|
|||
private String startDate;
|
||||
private String endDate;
|
||||
|
||||
private String typeCode;
|
||||
|
||||
private String modeName;
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.securitycontrol.entity.background.vo.UserAccessVo;
|
|||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -167,6 +168,7 @@ public interface HumanManageMapper {
|
|||
|
||||
/**
|
||||
* 获取人员出入场记录
|
||||
*
|
||||
* @param value
|
||||
* @return String
|
||||
* @description
|
||||
|
|
@ -174,4 +176,16 @@ public interface HumanManageMapper {
|
|||
* @date 2024/4/3 17:44
|
||||
*/
|
||||
String getUserAccessLists(String value);
|
||||
|
||||
/**
|
||||
* 获取人员入场 离场状态
|
||||
* @param userId
|
||||
* @param accessType
|
||||
* @param type
|
||||
* @return String
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/18 10:13
|
||||
*/
|
||||
String getUserAccessStatus(@Param("userId") String userId, @Param("accessType") String accessType, @Param("type") int type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,14 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 车辆管理
|
||||
*
|
||||
* @author 黑子
|
||||
*/
|
||||
@Repository(value = "VehicleMapper")
|
||||
public interface VehicleMapper {
|
||||
/**
|
||||
* 获取车辆
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -21,18 +23,21 @@ public interface VehicleMapper {
|
|||
|
||||
/**
|
||||
* 新增/修改车辆
|
||||
*
|
||||
* @param vo
|
||||
*/
|
||||
void addOrUpdateVehicle(VehicleVo vo);
|
||||
|
||||
/**
|
||||
* 删除车辆
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
void delVehicleById(VehicleVo dto);
|
||||
|
||||
/**
|
||||
* 查询集合
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -40,8 +45,19 @@ public interface VehicleMapper {
|
|||
|
||||
/**
|
||||
* 查询集合
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<VehicleDto> getListsDto(VehicleDto dto);
|
||||
|
||||
/**
|
||||
* 获取车辆入场 离场状态
|
||||
* @param value
|
||||
* @return String
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/4/18 11:00
|
||||
*/
|
||||
String getCarAccessLists(String value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ public class AppServiceImpl implements IAppService {
|
|||
if (StringUtils.isNotEmpty(data)) {
|
||||
String value = mapper.getUserAccessStatus(data, Constant.ACCESS_TYPE, 2);
|
||||
vo.setStatus(StringUtils.isEmpty(value) ? "离场" : value);
|
||||
}else{
|
||||
vo.setStatus("离场");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -134,6 +136,8 @@ public class AppServiceImpl implements IAppService {
|
|||
if (StringUtils.isNotEmpty(data)) {
|
||||
String value = mapper.getUserAccessStatus(data, Constant.ACCESS_TYPE, 2);
|
||||
vo.setAccessType(StringUtils.isEmpty(value) ? "离场" : value);
|
||||
}else{
|
||||
vo.setAccessType("离场");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,15 @@ public class HumanServiceImpl implements HumanService {
|
|||
List<HumanManageVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getHumanLists(dto);
|
||||
for (HumanManageVo vo : list) {
|
||||
String data = mapper.getUserAccessStatus(vo.getUserId(), Constant.ACCESS_TYPE, 1);
|
||||
if (StringUtils.isNotEmpty(data)) {
|
||||
String value = mapper.getUserAccessStatus(data, Constant.ACCESS_TYPE, 2);
|
||||
vo.setStatus(StringUtils.isEmpty(value) ? "离场" : value);
|
||||
}else{
|
||||
vo.setStatus("离场");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取人员列表",e);
|
||||
}
|
||||
|
|
@ -253,12 +262,12 @@ public class HumanServiceImpl implements HumanService {
|
|||
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);
|
||||
}
|
||||
list = mapper.getPersonnelAccessLists(dto);
|
||||
for (UserAccessVo vo : list) {
|
||||
String value = vo.getValue();
|
||||
vo.setIdNumber(userDetail.getIdNumber());
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ package com.securitycontrol.background.service.impl;
|
|||
|
||||
import com.securitycontrol.background.mapper.VehicleMapper;
|
||||
import com.securitycontrol.background.service.VehicleService;
|
||||
import com.securitycontrol.common.core.constant.Constant;
|
||||
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
|
||||
import com.securitycontrol.common.core.utils.uuid.IdUtils;
|
||||
import com.securitycontrol.entity.background.dto.VehicleDto;
|
||||
import com.securitycontrol.entity.background.vo.UserAccessVo;
|
||||
import com.securitycontrol.entity.background.vo.VehicleVo;
|
||||
|
||||
import com.securitycontrol.common.core.utils.StringUtils;
|
||||
|
|
@ -98,15 +101,40 @@ public class VehicleServiceImpl implements VehicleService {
|
|||
String[] arr = date.split("@");
|
||||
dto.setStartDate(arr[0]);
|
||||
dto.setEndDate(arr[1]);
|
||||
}else{
|
||||
dto.setStartDate(DateTimeHelper.getNowDate());
|
||||
dto.setEndDate(DateTimeHelper.getNowDate());
|
||||
}
|
||||
try {
|
||||
dto.setTypeCode(Constant.PERSON_CAR_TYPE);
|
||||
dto.setModeName(Constant.CAR);
|
||||
list = mapper.getLists(dto);
|
||||
for (VehicleVo vo : list) {
|
||||
String value = vo.getValue();
|
||||
String data = mapper.getCarAccessLists(value);
|
||||
if(StringUtils.isNotEmpty(data)){
|
||||
String[] dataArr = data.split(",");
|
||||
setCarAccessData(vo,dataArr);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取进出场记录列表",e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public VehicleVo setCarAccessData(VehicleVo vo,String[] valArr){
|
||||
for (String str : valArr) {
|
||||
String[] splitStr = str.split("@");
|
||||
if(Objects.equals(splitStr[0],Constant.ACCESS_TIME)){
|
||||
vo.setAccesssTime(splitStr[1]);
|
||||
}else if(Objects.equals(splitStr[0],Constant.ACCESS_TYPE)){
|
||||
vo.setAccessType(splitStr[1]);
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VehicleDto> getListsDto(VehicleDto dto) {
|
||||
List<VehicleDto> list = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@
|
|||
SELECT thdv.source_type AS value
|
||||
FROM tb_bd_device tbd
|
||||
INNER JOIN tb_device_detail tdd ON tbd.device_id = tdd.device_id AND tdd.del_flag = 0
|
||||
INNER JOIN tb_his_device_value thdv ON tdd.id = thdv.attribute_id AND thdv.val = #{id}
|
||||
INNER JOIN tb_his_device_value thdv ON tdd.id = thdv.attribute_id AND thdv.val = #{id} AND thdv.create_time BETWEEN CONCAT(#{startTime},' 00:00:00') AND CONCAT(#{endTime},' 23:59:59')
|
||||
WHERE tbd.devic_type = #{typeCode} AND tdd.mode_name = #{modeName} AND tbd.del_flag = 0
|
||||
</select>
|
||||
<select id="getBindHis" resultType="java.lang.Integer">
|
||||
|
|
@ -186,4 +186,19 @@
|
|||
WHERE thdv.source_type = #{value}
|
||||
GROUP BY thdv.source_type
|
||||
</select>
|
||||
<!--获取人员入场 离场状态-->
|
||||
<select id="getUserAccessStatus" resultType="java.lang.String">
|
||||
<if test="type == 1">
|
||||
SELECT tdd.device_id
|
||||
FROM tb_device_value tdv
|
||||
LEFT JOIN tb_device_detail tdd ON tdv.attribute_id = tdd.id AND tdd.del_flag = 0
|
||||
WHERE tdv.val = #{userId}
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
SELECT tdv.val
|
||||
FROM tb_device_detail tdd
|
||||
LEFT JOIN tb_device_value tdv ON tdd.id = tdv.attribute_id
|
||||
WHERE tdd.device_id = #{userId} AND tdd.mode_name = #{accessType} AND tdd.del_flag = 0
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -20,13 +20,12 @@
|
|||
</select>
|
||||
|
||||
<select id="getLists" resultType="com.securitycontrol.entity.background.vo.VehicleVo">
|
||||
SELECT accesss_time as accesssTime,
|
||||
case WHEN access_type= '0' then '入场' ELSE '出场' end accessType
|
||||
FROM `tb_car_access`
|
||||
WHERE car_id = #{id}
|
||||
<if test="date != null and date != ''">
|
||||
AND accesss_time BETWEEN CONCAT(#{startDate},' 00:00:00') AND CONCAT(#{endDate},' 23:59:59')
|
||||
</if>
|
||||
SELECT thdv.source_type AS value
|
||||
FROM tb_bd_device tbd
|
||||
INNER JOIN tb_device_detail tdd ON tbd.device_id = tdd.device_id AND tdd.del_flag = 0
|
||||
INNER JOIN tb_his_device_value thdv ON tdd.id = thdv.attribute_id AND thdv.create_time BETWEEN CONCAT(#{startDate},' 00:00:00') AND CONCAT(#{endDate},' 23:59:59')
|
||||
INNER JOIN tb_car tc ON tc.car_num = thdv.val AND tc.id = #{id}
|
||||
WHERE tbd.devic_type = #{typeCode} AND tdd.mode_name = #{modeName} AND tbd.del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="getListsDto" resultType="com.securitycontrol.entity.background.dto.VehicleDto">
|
||||
|
|
@ -38,6 +37,14 @@
|
|||
AND accesss_time BETWEEN CONCAT(#{startDate},' 00:00:00') AND CONCAT(#{endDate},' 23:59:59')
|
||||
</if>
|
||||
</select>
|
||||
<!--获取车辆入场 离场状态-->
|
||||
<select id="getCarAccessLists" resultType="java.lang.String">
|
||||
SELECT GROUP_CONCAT(CONCAT(tdd.mode_name,'@',thdv.val)) AS value
|
||||
FROM tb_his_device_value thdv
|
||||
INNER JOIN tb_device_detail tdd ON thdv.attribute_id = tdd.id AND tdd.del_flag = 0
|
||||
WHERE thdv.source_type = #{value}
|
||||
GROUP BY thdv.source_type
|
||||
</select>
|
||||
|
||||
<!--新增/修改-->
|
||||
<insert id="addOrUpdateVehicle">
|
||||
|
|
|
|||
Loading…
Reference in New Issue