获取通行记录接口编写

This commit is contained in:
Administrator 2023-03-17 17:19:39 +08:00
parent af6c08bad1
commit 9810dbc02e
7 changed files with 128 additions and 22 deletions

View File

@ -10,6 +10,7 @@ import com.zhgd.xmgl.base.WorkerVo;
import com.zhgd.xmgl.modules.basicdata.service.UploadFileService;
import com.zhgd.xmgl.modules.project.service.IProjectEnterpriseService;
import com.zhgd.xmgl.modules.worker.entity.*;
import com.zhgd.xmgl.modules.worker.entity.dto.GetPassRecordDto;
import com.zhgd.xmgl.modules.worker.entity.dto.ModGroupDto;
import com.zhgd.xmgl.modules.worker.service.*;
import io.swagger.annotations.Api;
@ -342,18 +343,8 @@ public class ProjectWorkerApiController {
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@PostMapping(value = "/getPassRecord")
public Map<String, Object> getPassRecord(@RequestBody Map<String, Object> map) {
Map<String, Object> resultMap = new HashMap<>();
try {
resultMap.put("data", "");
resultMap.put("msg", "操作成功");
resultMap.put("status", "1");
} catch (Exception e) {
e.printStackTrace();
resultMap.put("msg", "操作失败");
resultMap.put("status", "0");
}
return resultMap;
public Map<String, Object> getPassRecord(@RequestBody GetPassRecordDto dto) {
return workerAttendanceService.getPassRecord(dto);
}
@ApiOperation(value = " 变更人员证书", notes = "变更人员证书", httpMethod = "POST")

View File

@ -0,0 +1,19 @@
package com.zhgd.xmgl.modules.worker.entity.bo;
import lombok.Data;
@Data
public class WorkerAttendanceBo {
/*passTime 通行时间 string
direction 通行方向 int 1: 2出
passType 通行方式 int 1IC卡2人脸识别3指纹识别5二维码6蓝牙
devCode 通行设备编码 string
faceUrl 人脸通行抓拍照片http地址 string
idCard 通行人员身份证号码 string;*/
private String passTime;
private int direction;
private int passType;
private String devCode;
private String faceUrl;
private String idCard;
}

View File

@ -0,0 +1,24 @@
package com.zhgd.xmgl.modules.worker.entity.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class GetPassRecordDto {
/*
projectCode 项目编码 String
idCard 人员身份证号 String
startTime 通行开始时间 String 格式2020-03-10 00:00:00
endTime 通行结束时间 String 格式2020-03-10 23:59:59 按项目获取通行记录通行时间只能在一天之内
pageIndex 当前页 int 默认1
pageSize 每页大小 int 默认500
*/
@NotBlank(message = "projectCode不能为空")
private String projectCode;
private String idCard;
private String startTime;
private String endTime;
private Integer pageIndex;
private Integer pageSize;
}

View File

@ -5,6 +5,8 @@ import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.bo.WorkerAttendanceBo;
import com.zhgd.xmgl.modules.worker.entity.dto.GetPassRecordDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
@ -76,4 +78,6 @@ public interface WorkerAttendanceMapper extends BaseMapper<WorkerAttendance> {
List<EntityMap> selectDayAttendanceWorkerInfoList(Map<String, Object> map);
EntityMap selectTodayAttendanceWorkerCount(@Param("projectSn")String projectSn );
Page<WorkerAttendanceBo> getPassRecord(@Param("q") GetPassRecordDto dto, Page<WorkerAttendanceBo> page);
}

View File

@ -605,15 +605,43 @@
</select>
<select id="selectTodayAttendanceWorkerCount" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT
COUNT(DISTINCT w1.id) total_attendance_person,
IFNULL(sum((CASE WHEN person_type=1 then 1 ELSE 0 END)),0) lw_person_total,
IFNULL(sum((CASE WHEN person_type=2 then 1 ELSE 0 END)),0) gl_person_total
from worker_info w1 INNER JOIN
(SELECT DISTINCT person_sn FROM worker_attendance
WHERE create_time>=CONCAT(DATE_FORMAT(now(),"%Y-%m-%d"),' 00:00:00') AND is_statistics=0
and project_sn=#{projectSn}
) p ON w1.person_sn=p.person_sn
WHERE w1.inService_type=1 and w1.person_type in (1,2)
and w1.project_sn=#{projectSn}
COUNT(DISTINCT w1.id) total_attendance_person,
IFNULL(sum((CASE WHEN person_type = 1 then 1 ELSE 0 END)), 0) lw_person_total,
IFNULL(sum((CASE WHEN person_type = 2 then 1 ELSE 0 END)), 0) gl_person_total
from worker_info w1
INNER JOIN
(SELECT DISTINCT person_sn
FROM worker_attendance
WHERE create_time >= CONCAT(DATE_FORMAT(now(), "%Y-%m-%d"), ' 00:00:00')
AND is_statistics = 0
and project_sn = #{projectSn}
) p ON w1.person_sn = p.person_sn
WHERE w1.inService_type = 1
and w1.person_type in (1, 2)
and w1.project_sn = #{projectSn}
</select>
<select id="getPassRecord" resultType="com.zhgd.xmgl.modules.worker.entity.bo.WorkerAttendanceBo">
SELECT
wa.create_time AS pass_time,
wa.pass_type AS direction,
wa.card_type as pass_type,
wa.dev_sn AS dev_code,
wa.image_url AS face_url,
wi.id_card as id_card
FROM
`worker_attendance` wa
INNER JOIN worker_info wi ON wi.person_sn = wa.person_sn
<if test="q.startTime!=null and q.startTime!=''">
and wa.create_time <![CDATA[>=]]> #{q.startTime}
</if>
<if test="q.endTime!=null and q.endTime!=''">
and wa.create_time <![CDATA[<=]]> #{q.endTime}
</if>
<if test="q.idCard!=null and q.idCard!=''">
and wi.id_card = #{q.idCard}
</if>
<if test="q.projectCode!=null and q.projectCode!=''">
and wa.project_sn = #{q.projectCode}
</if>
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.worker.entity.dto.GetPassRecordDto;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -63,4 +64,6 @@ public interface IWorkerAttendanceService extends IService<WorkerAttendance> {
List<Map<String,Object>> selectTenDaysWorkerAttendanceCountList(Map<String, Object> map);
void ufaceHikCallbackUrl(Map<String, Object> map);
Map<String, Object> getPassRecord(GetPassRecordDto dto);
}

View File

@ -17,6 +17,8 @@ import com.zhgd.xmgl.modules.basicdata.service.UploadFileService;
import com.zhgd.xmgl.modules.project.entity.ProjectUfaceConfig;
import com.zhgd.xmgl.modules.project.mapper.ProjectUfaceConfigMapper;
import com.zhgd.xmgl.modules.worker.entity.*;
import com.zhgd.xmgl.modules.worker.entity.bo.WorkerAttendanceBo;
import com.zhgd.xmgl.modules.worker.entity.dto.GetPassRecordDto;
import com.zhgd.xmgl.modules.worker.mapper.*;
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
import com.zhgd.xmgl.modules.worker.service.IWorkerMonthAttendanceStatisticsService;
@ -900,6 +902,41 @@ public class WorkerAttendanceServiceImpl extends ServiceImpl<WorkerAttendanceMap
}
}
@Override
public Map<String, Object> getPassRecord(GetPassRecordDto dto) {
/*
projectCode 项目编码 String
idCard 人员身份证号 String
startTime 通行开始时间 String 格式2020-03-10 00:00:00
endTime 通行结束时间 String 格式2020-03-10 23:59:59 按项目获取通行记录通行时间只能在一天之内
pageIndex 当前页 int 默认1
pageSize 每页大小 int 默认500
passTime 通行时间 string
direction 通行方向 int 1: 2出
passType 通行方式 int 1IC卡2人脸识别3指纹识别5二维码6蓝牙
devCode 通行设备编码 string
faceUrl 人脸通行抓拍照片http地址 string
idCard 通行人员身份证号码 string
msg 错误信息 String
status 状态码 String 1表示成功其余表示失败
*/
Page<WorkerAttendanceBo> page = new Page<WorkerAttendanceBo>(dto.getPageIndex(), dto.getPageSize());
IPage<WorkerAttendanceBo> list = workerAttendanceMapper.getPassRecord(dto, page);
Map<String, Object> resultMap = new HashMap<>();
try {
resultMap.put("data", list.getRecords());
resultMap.put("total", list.getTotal());
resultMap.put("msg", "操作成功");
resultMap.put("status", "1");
} catch (Exception e) {
log.error("err", e);
resultMap.put("msg", "操作失败");
resultMap.put("status", "0");
}
return resultMap;
}
public WorkerInfo getWorkerInfoByImage(String personImage, String projectSn) {
WorkerInfo info = null;