Commit b37cb2dd authored by 18310373984@163.com's avatar 18310373984@163.com

人脸识别配置白名单接口

parent 15b66817
package com.hungraim.ltc.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.disable.ChDisableApply;
import com.hungraim.ltc.pojo.entity.facelocation.FaceLocationWhiteList;
import com.hungraim.ltc.pojo.vo.disable.DisableUpdateDetailVO;
import com.hungraim.ltc.pojo.vo.facelocation.FaceLocationWhiteListVo;
import com.hungraim.ltc.service.FaceLocationWhiteListService;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 人脸识别和定位白名单Controller
*
* @author czz
*/
@RestController
@RequestMapping("/api.apply/facelocation")
@Slf4j
public class FaceLocationWhiteListController {
@Autowired
private FaceLocationWhiteListService faceLocationWhiteListService;
/**
* 失能人员信息退出列表
*
* @param pageNum 当前页
* @param pageSize 每页几条数据
* @return 失能人员信息列表
*/
@RequestMapping("/whiteList")
public Result<Page<FaceLocationWhiteListVo>> whiteList(@RequestHeader("Authorization")String token,
Integer pageNum,
Integer pageSize, Long srvOrganId,
String certiCode, String realName,
String empName) {
if (pageNum == null || pageNum < 1) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (pageSize == null || pageSize < 1) {
pageSize = 10;
}
long srvOrganIdL = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if(srvOrganIdL != 0) {
srvOrganId = new Long(srvOrganIdL);
}
Page<FaceLocationWhiteListVo> page = new Page<>(pageNum, pageSize);
page = faceLocationWhiteListService.getFaceLocationWhiteList(page,
srvOrganId,certiCode,realName,empName);
return Result.success(page);
}
/**
* 白名单详情
* @param listId 详情id
* @return
*/
@RequestMapping("/getFaceLocationWhiteDetail")
public Result<FaceLocationWhiteListVo> getFaceLocationWhiteDetail(Long listId) {
if (null == listId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
FaceLocationWhiteListVo disableUpdateDetailVO = faceLocationWhiteListService.getFaceLocationWhiteDetail(listId);
return Result.success(disableUpdateDetailVO);
}
/**
* 新增人脸识别定位配置
*/
@RequestMapping("/addFaceLocationWhiteList")
public Result addFaceLocationWhiteList(@RequestHeader("Authorization") String token, FaceLocationWhiteList faceLocationWhiteList) {
if (faceLocationWhiteList.getSrvOrganId()==null) {
return Result.failed("护理机构不能为空!");
}
if (faceLocationWhiteList.getDisabInfoId()==null) {
return Result.failed("失能人员不能为空!");
}
if (faceLocationWhiteList.getEmpId()== null) {
return Result.failed("护理人员不能为空!");
}
if (StringUtils.isBlank(faceLocationWhiteList.getIsPrecisePositioning())) {
return Result.failed("是否精确定位配置的距离不能为空!");
}
if (StringUtils.isBlank(faceLocationWhiteList.getIsFace())) {
return Result.failed("是否人脸识别不能为空!");
}
if (faceLocationWhiteList.getPositioningDistance()== null) {
return Result.failed("定位距离不能为空!");
}
Integer userId = TokenParsingUtil.TokenParsing(token, "userId");
if(faceLocationWhiteList.getListId()==null){//如果已经新增过,则无需修改新增人,只需要修改人变更
faceLocationWhiteList.setFcu(userId);
}
faceLocationWhiteList.setLcu(userId);
return faceLocationWhiteListService.addOrUpdateFaceLocationWhiteList(faceLocationWhiteList);
}
}
package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.facelocation.FaceLocationWhiteList;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoRespDTO;
import com.hungraim.ltc.pojo.vo.disable.ProgramRespDTO;
import com.hungraim.ltc.pojo.vo.facelocation.FaceLocationWhiteListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 人工识别/定位配置Mapper
*
* @author czz
*/
@Mapper
@Repository
public interface FaceLocationWhiteListMapper extends BaseMapper<FaceLocationWhiteList> {
/**
* 列表查询
*
* @param page 分页参数
* @param srvOrganId 服务机构id
* @return 返回列表
*/
Page<FaceLocationWhiteListVo> getFaceLocationWhiteList(Page<FaceLocationWhiteListVo> page,
@Param("srvOrganId") Long srvOrganId,//护理机构ID
String certiCode,//失能人员身份证号
String realName,//失能人员姓名
String empName);//护理人员姓名
FaceLocationWhiteListVo getFaceLocationWhiteDetail(Long listId);
}
package com.hungraim.ltc.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.disable.*;
import com.hungraim.ltc.pojo.entity.facelocation.FaceLocationWhiteList;
import com.hungraim.ltc.pojo.vo.disable.*;
import com.hungraim.ltc.pojo.vo.facelocation.FaceLocationWhiteListVo;
import com.hungraim.ltc.util.Result;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 失能申请Service
*
* @author czz
*/
@Service
public interface FaceLocationWhiteListService {
Page<FaceLocationWhiteListVo> getFaceLocationWhiteList(Page<FaceLocationWhiteListVo> page,
@Param("srvOrganId") Long srvOrganId,//护理机构ID
String certiCode,//失能人员身份证号
String realName,//失能人员姓名
String empName);//护理人员姓名
FaceLocationWhiteListVo getFaceLocationWhiteDetail(Long listId);
Result addOrUpdateFaceLocationWhiteList(FaceLocationWhiteList faceLocationWhiteList);
}
package com.hungraim.ltc.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.*;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.assessment.ChAprTask;
import com.hungraim.ltc.pojo.entity.assessment.ChDisableInfoHis;
import com.hungraim.ltc.pojo.entity.disable.*;
import com.hungraim.ltc.pojo.entity.facelocation.FaceLocationWhiteList;
import com.hungraim.ltc.pojo.entity.riskLevel.ChDisableRiskLevel;
import com.hungraim.ltc.pojo.entity.serviceManage.ChCfgPara;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetailAuditLog;
import com.hungraim.ltc.pojo.vo.disable.*;
import com.hungraim.ltc.pojo.vo.facelocation.FaceLocationWhiteListVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.service.DisableService;
import com.hungraim.ltc.service.FaceLocationWhiteListService;
import com.hungraim.ltc.service.OrganService;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import oracle.sql.DATE;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
@Service
@Slf4j
@AllArgsConstructor
public class FaceLocationWhiteListServiceImpl implements FaceLocationWhiteListService {
private final FaceLocationWhiteListMapper faceLocationWhiteListMapper;
@Override
public Page<FaceLocationWhiteListVo> getFaceLocationWhiteList(Page<FaceLocationWhiteListVo> page
, Long srvOrganId, String certiCode, String realName, String empName) {
Page<FaceLocationWhiteListVo> whiteListVOPage = faceLocationWhiteListMapper.getFaceLocationWhiteList(page,srvOrganId,certiCode,
realName,empName);
return whiteListVOPage;
}
@Override
public FaceLocationWhiteListVo getFaceLocationWhiteDetail(Long listId) {
return faceLocationWhiteListMapper.getFaceLocationWhiteDetail(listId);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result addOrUpdateFaceLocationWhiteList(FaceLocationWhiteList faceLocationWhiteList) {
//添加或修改记录
Long listId = faceLocationWhiteList.getListId();
if (null == listId) {
Integer count=faceLocationWhiteListMapper.selectCount(new LambdaQueryWrapper<FaceLocationWhiteList>()//计划次数
.eq(FaceLocationWhiteList::getSrvOrganId, faceLocationWhiteList.getSrvOrganId())
.eq(FaceLocationWhiteList::getDisabInfoId,faceLocationWhiteList.getDisabInfoId())
.eq(FaceLocationWhiteList::getEmpId,faceLocationWhiteList.getEmpId()));
if(count>0){
return Result.failed("该护理人员及失能人员在系统内已经配置了白名单,不能重复配置!");
}
// 新增
faceLocationWhiteListMapper.insert(faceLocationWhiteList);
} else {
// 修改
faceLocationWhiteListMapper.updateById(faceLocationWhiteList);
}
return Result.success();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hungraim.ltc.dao.FaceLocationWhiteListMapper">
<select id="getFaceLocationWhiteList" resultType="com.hungraim.ltc.pojo.vo.facelocation.FaceLocationWhiteListVo">
select l.*,o.srv_organ_name,e.emp_name,info.real_name,info.certi_code
from ch_face_location_White_List l,ch_srv_organ o,ch_srv_organ_emp e,ch_disable_info info
<where>
l.srv_organ_id=o.srv_organ_id
and l.emp_id=e.emp_id
and l.disab_info_id=info.disab_info_id
<if test="srvOrganId != null and srvOrganId != '' and srvOrganId!=0">
and o.SRV_ORGAN_ID = #{srvOrganId}
</if>
<if test="certiCode != null and certiCode != ''">
and t.CERTI_CODE = #{certiCode}
</if>
<if test="realName != null and realName != ''">
and t.real_Name like CONCAT(CONCAT('%',#{realName}) ,'%')
</if>
<if test="empName != null and empName != ''">
and e.emp_name like CONCAT(CONCAT('%',#{empName}) ,'%')
</if>
</where>
</select>
<select id="getFaceLocationWhiteDetail" resultType="com.hungraim.ltc.pojo.vo.facelocation.FaceLocationWhiteListVo">
select l.*,o.srv_organ_name,e.emp_name,info.real_name,info.certi_code
from ch_face_location_White_List l,ch_srv_organ o,ch_srv_organ_emp e,ch_disable_info info
<where>
l.srv_organ_id=o.srv_organ_id
and l.emp_id=e.emp_id
and l.disab_info_id=info.disab_info_id
<if test="listId != null and listId != ''">
and l.list_Id = #{listId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
package com.hungraim.ltc.pojo.entity.facelocation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("ch_face_location_White_List")
@KeySequence("S_ch_face_location_White_List")
public class FaceLocationWhiteList implements Serializable{
@TableId(type = IdType.INPUT)
private Long listId;
private Integer srvOrganId;
private Integer disabInfoId;
private Integer empId;
private String isPrecisePositioning;
private String isFace;
private Integer positioningDistance;
private Date fcd;
private Integer fcu;
private Date lcd;
private Integer lcu;
}
package com.hungraim.ltc.pojo.vo.facelocation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 列表页回显对象
*/
@Data
public class FaceLocationWhiteListVo {
private Long listId;
private Integer srvOrganId;
private String srvOrganName;
private Integer disabInfoId;
private String realName;//失能人员姓名
private String certiCode;//失能人员身份证号
private Integer empId;
private String empName;//护理人员姓名
private String isPrecisePositioning;//是否精准定位,Y=是,N等于否
private String isFace;//是否人脸识别,Y=是,N等于否
private Integer positioningDistance;//定位距离
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment