diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java b/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java index d3e9cbd..1f4f347 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/face/rtsp/RtspFrameGrabber.java @@ -26,6 +26,7 @@ import net.shapelight.modules.face.util.UserRamGroup; import net.shapelight.modules.feignClient.CxFeignClient; import net.shapelight.modules.ten.entity.TenPersonEntity; import net.shapelight.modules.ten.service.TenPersonService; +import net.shapelight.modules.ten.service.impl.TenPersonServiceImpl; import org.apache.commons.pool2.impl.GenericObjectPool; import org.bytedeco.javacpp.avutil; import org.bytedeco.javacv.*; @@ -92,6 +93,8 @@ public class RtspFrameGrabber { * 视频高度 */ private int frameHeight = 270; + @Autowired + private TenPersonServiceImpl tenPersonService; private void createGrabber() { try { @@ -235,12 +238,13 @@ public class RtspFrameGrabber { params.put("dictSex",tenPerson.getGender()==0?"女":"男"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); params.put("watchVideoTime",sdf.format(System.currentTimeMillis())); - /*JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params); + tenPerson.setIsWatchSafeVideo(1); + JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params); if(jsonObject.getBool("success")!=null&&jsonObject.getBool("success")) { personService.update(new LambdaUpdateWrapper() .set(TenPersonEntity::getIsWatchSafeVideo,1) .eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId())); - }*/ + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java index a27a67a..9c7cd1f 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java @@ -34,6 +34,8 @@ import net.shapelight.modules.face.util.UserRamGroup; import net.shapelight.modules.feignClient.CxFeignClient; import net.shapelight.modules.httpapi.service.AuthService; import net.shapelight.modules.httpapi.service.RecordSaveSyncService; +import net.shapelight.modules.iCq.controller.enter.to.EnterVo; +import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterMapper; import net.shapelight.modules.nettyapi.config.CmdConstant; import net.shapelight.modules.nettyapi.config.MyMessage; import net.shapelight.modules.nettyapi.utils.Result; @@ -43,6 +45,7 @@ import net.shapelight.modules.ten.entity.*; import net.shapelight.modules.ten.service.*; import net.shapelight.modules.vo.*; import org.apache.commons.io.FilenameUtils; +import org.apache.ibatis.annotations.Param; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -119,6 +122,8 @@ public class HttpApiController { private TenPersonCertService certService; @Autowired private TenPersonTrainService trainService; + @Autowired + private CqEnterMapper cqEnterMapper; /** * @@ -459,6 +464,7 @@ public class HttpApiController { puser.setTenPersonCertList(tenPersonCertList); puser.setTenPersonTrainList(tenPersonTrainList); + puser.setIsBlacklistPersonnel(p.getIsBlacklistPersonnel()); TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), p.getPersonId(),deviceEntity.getTenantId()); syncEntity.setState(Constant.PERSON_SYNC_OK); @@ -730,6 +736,7 @@ public class HttpApiController { Float distance = dataJson.getFloat("distance"); Float temperature = dataJson.getFloat("temperature"); String cameraParam = dataJson.getString("cameraParam"); + String failureReason = dataJson.getString("Lock_msg"); record.setScore3d(score3d); // record.setSourceFileStr(sourceFileStr); @@ -738,6 +745,7 @@ public class HttpApiController { record.setDistance(distance); record.setTemperature(temperature); record.setCameraParam(cameraParam); + record.setFailureReason(failureReason); try { //保存图片 @@ -844,12 +852,12 @@ public class HttpApiController { params.put("accessControlName",memberEntity.getOpenId()); params.put("state",""); params.put("failureReason",""); - cn.hutool.json.JSONObject jsonObject = cxFeignClient.savePmEntryExitRecord(params); + /*cn.hutool.json.JSONObject jsonObject = cxFeignClient.savePmEntryExitRecord(params); if(jsonObject.getBool("success")!=null && jsonObject.getBool("success")){ log.debug("同步进出场记录成功"); }else { log.debug("同步进出场记录失败"+"姓名:"+memberEntity.getName()+",errorMessage"+jsonObject.getStr("message")); - } + }*/ return R.ok(); } @@ -2082,9 +2090,10 @@ public class HttpApiController { return R.ok().put("data", page); } - @GetMapping("/role") - public R roleList() { - - return R.ok(); + @PostMapping("/role") + public R roleList(@Param(value = "sn")String sn) { + TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); + List enterVoList = cqEnterMapper.queryByCellId(deviceEntity.getCellId()); + return R.ok().put("data",enterVoList); } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java index 302f01a..03924d7 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java @@ -30,9 +30,8 @@ public class CqEnterController { @GetMapping("list") - public R find(String operator, long cellId){ + public R find(String operator, String cellId){ System.out.println("cellId = " + cellId); - List fTo = cqEnterMapper.classifiedQuery(cellId); System.out.println(fTo); @@ -57,9 +56,9 @@ public class CqEnterController { } @GetMapping("/rulesByType") - public R rulesByType(Long typeId, Long cellId){ + public R rulesByType(String typeId, String cellId){ if(typeId == null){ - typeId = cqMemberMapper.speciallyForVisitors2(); + typeId = String.valueOf(cqMemberMapper.speciallyForVisitors2()); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/EnterVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/EnterVo.java new file mode 100644 index 0000000..ac3a7af --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/EnterVo.java @@ -0,0 +1,15 @@ +package net.shapelight.modules.iCq.controller.enter.to; + +import lombok.Data; + +@Data +public class EnterVo { + //配置ID + Integer enterConfigId; + //类型ID + Integer typeId; + //状态(1是2否) + Integer state; + //配置名称 + String configName; +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/FTo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/FTo.java index ca76bf0..cbb1999 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/FTo.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/to/FTo.java @@ -11,7 +11,7 @@ import java.util.Date; @NoArgsConstructor public class FTo { - private long cellId; + private String cellId; private Date operateTime; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/FirstVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/FirstVo.java index 80f2fec..8419896 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/FirstVo.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/vo/FirstVo.java @@ -10,7 +10,7 @@ import java.util.Date; @AllArgsConstructor @NoArgsConstructor public class FirstVo { - private long cellId; + private String cellId; private String unitName; private String person; private Date configurationTime; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java index d68fc12..d2c4b6c 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java @@ -10,6 +10,7 @@ import io.swagger.models.auth.In; import lombok.Builder; import lombok.RequiredArgsConstructor; import net.shapelight.common.config.MinioConfig; +import net.shapelight.common.utils.Constant; import net.shapelight.common.utils.R; import net.shapelight.common.utils.SnowflakeIdWorker; import net.shapelight.common.utils.UUIDUtil; @@ -376,6 +377,7 @@ public class CqMemberController { tenPersonEntity.setIsProtectDevice(visitorDto.getIsProtectDevice()); tenPersonEntity.setIsEnterSulfurArea(visitorDto.getIsEnterSulfurArea()); tenPersonEntity.setIsWatchSafeVideo(visitorDto.getIsWatchSafeVideo()); + tenPersonEntity.setPersonType(cqMemberMapper.speciallyForVisitors()); if(visitorDto.getStartDate()!=null){ //tenPersonEntity.setLiveStart(visitorDto.getStartDate()); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/vo/CellVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/vo/CellVo.java index bd9d9eb..992b2c4 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/vo/CellVo.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/vo/CellVo.java @@ -1,6 +1,8 @@ package net.shapelight.modules.iCq.controller.video.vo; //前端查询部门返回Vo +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -14,6 +16,7 @@ public class CellVo { /** * 部门Id */ + @JsonSerialize(using = ToStringSerializer.class) private Long cellId; /** * 部门名称 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/FileEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/FileEntity.java index e872232..5961607 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/FileEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/FileEntity.java @@ -20,7 +20,6 @@ public class FileEntity implements Serializable { /** * 文件id */ - @TableId private String fileId; /** * 文件名称 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java index c7e5ed9..468d020 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/dataobject/video/TenSafeVideoEntity.java @@ -30,7 +30,7 @@ public class TenSafeVideoEntity implements Serializable { /** * 单位ID */ - private Long cellId; + private String cellId; /** * 单位名称 @@ -40,7 +40,7 @@ public class TenSafeVideoEntity implements Serializable { /** * 上传人ID */ - private Long uploadId; + private String uploadId; /** * 上传人姓名 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterMapper.java index b3136b1..245255d 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterMapper.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/enter/CqEnterMapper.java @@ -1,6 +1,7 @@ package net.shapelight.modules.iCq.dal.mysql.enter; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import net.shapelight.modules.iCq.controller.enter.to.EnterVo; import net.shapelight.modules.iCq.controller.enter.to.FTo; import net.shapelight.modules.iCq.controller.enter.vo.PeronType; import net.shapelight.modules.iCq.controller.enter.vo.TypeRules; @@ -14,11 +15,13 @@ import java.util.List; public interface CqEnterMapper extends BaseMapper { - List classifiedQuery(@Param("cellId")long cellId); + List classifiedQuery(@Param("cellId")String cellId); List getPersonType(); - List rulesByType(long typeId, @Param("cellId") Long cellId); + List rulesByType(String typeId, @Param("cellId") String cellId); int changeState(int ruleId); + + List queryByCellId(Long cellId); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java index b5f642f..41ceacc 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/dal/mysql/video/CqSafeVideoMapper.java @@ -11,5 +11,5 @@ public interface CqSafeVideoMapper extends BaseMapper { - String findTheNameById(long cellId); + String findTheNameById(String cellId); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java index c8b0058..c9d25ad 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/video/CqSafeVideoServiceImpl.java @@ -52,7 +52,7 @@ public class CqSafeVideoServiceImpl { public int insert(UploadVideoDto uploadVideoDto) { TenSafeVideoEntity tenSafeVideoEntity = new TenSafeVideoEntity(); BeanUtils.copyProperties(uploadVideoDto, tenSafeVideoEntity); - BeanUtils.copyProperties(cqFileMapper.selectById(uploadVideoDto.getFileId()), tenSafeVideoEntity); + BeanUtils.copyProperties(cqFileMapper.selectByFileId(uploadVideoDto.getFileId()), tenSafeVideoEntity); tenSafeVideoEntity.setCellName(cqCellMapper.selectOne(new QueryWrapper() .select("name") .eq("cell_id", uploadVideoDto.getCellId())).getName()); @@ -81,7 +81,7 @@ public class CqSafeVideoServiceImpl { FileEntity fileEntity = cqFileMapper.selectById(updateVideoDto.getFileId()); BeanUtils.copyProperties(fileEntity, tenSafeVideoEntity); tenSafeVideoEntity.setId(updateVideoDto.getVideoId()); - tenSafeVideoEntity.setCellId(updateVideoDto.getCellId()); + tenSafeVideoEntity.setCellId(String.valueOf(updateVideoDto.getCellId())); tenSafeVideoEntity.setCellName(cqCellMapper.selectById(updateVideoDto.getCellId()).getName()); tenSafeVideoEntity.setUploadTime(new Date()); return cqSafeVideoMapper.updateById(tenSafeVideoEntity); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java index 4f1310c..22fe0b1 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java @@ -128,6 +128,9 @@ public class TenPersonController extends AbstractController { @ApiImplicitParam(name = "idCard", value = "证件号", paramType = "query", dataType = "String", required = true), @ApiImplicitParam(name = "personType", value = "类型", paramType = "query", dataType = "String", required = true), @ApiImplicitParam(name = "faceFailure", value = "人脸提取标志", paramType = "query", dataType = "String", required = true), + @ApiImplicitParam(name = "isWatchSafeVideo", value = "是否观看", paramType = "query", dataType = "String", required = true), + @ApiImplicitParam(name = "liveStart", value = "人脸提取标志", paramType = "query", dataType = "String", required = true), + @ApiImplicitParam(name = "liveEnd", value = "人脸提取标志", paramType = "query", dataType = "String", required = true), }) public R list(@RequestParam Map params) { String tenantId = getUser().getTenantId() + ""; @@ -452,7 +455,7 @@ public class TenPersonController extends AbstractController { tenPerson.setIdCard(id18); } } - //验证app人员是否注册 + /* //验证app人员是否注册 if (tenPerson.getAppFlag() == Constant.APP_LOGIN_YES) { //1.验证用户名 AppUserEntity appUser = appUserService.findByUsername(tenPerson.getUsername()); @@ -464,8 +467,8 @@ public class TenPersonController extends AbstractController { if (appUser != null) { return R.error("手机号已经注册"); } - } - //验证卡号 + }*/ + /*//验证卡号 if(tenPerson.getDoorCardEntity()!=null && tenPerson.getDoorCardEntity().getDoorCard().isEmpty()){ //1. 检查当前钥匙是否已经使用 TenDoorCardEntity card = tenDoorCardService.getOne(new QueryWrapper() @@ -475,7 +478,7 @@ public class TenPersonController extends AbstractController { return R.error("卡号已录入"); } // tenDoorCardService.save(tenPerson); - } + }*/ /*TenPersonEntity tenPersonEntity = tenPersonService.findByName(tenPerson.getName(), @@ -528,7 +531,7 @@ public class TenPersonController extends AbstractController { params.put("isBlacklistPersonnel","否"); params.put("isWatchSafeVideo",tenPerson.getIsWatchSafeVideo()==1?"是":"否"); params.put("attachment",tenPerson.getIsWatchSafeVideo()); - cxFeignClient.savePmVisitorPersonnel(params); + //cxFeignClient.savePmVisitorPersonnel(params); } return R.ok(); } @@ -1429,6 +1432,31 @@ public class TenPersonController extends AbstractController { if (res==2) { return R.error("照片未检测到人脸"); } + //发送设备通知 + List devList = tenDeviceService.findByCellId(tenPerson.getCellId()); + //状态是0正常,发送推送 + if (tenPerson.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR) { + for (TenDeviceVo dev : devList) { + //添加到同步表,下发设备通知 + TenPersonSyncEntity syncEntity = new TenPersonSyncEntity(); + syncEntity.setPersonId(tenPerson.getPersonId()); + syncEntity.setTenantId(tenPerson.getTenantId()); + syncEntity.setDeviceSn(dev.getSn()); + syncEntity.setDeviceId(dev.getDeviceId()); + syncEntity.setState(1); + syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); + tenPersonSyncService.insert(syncEntity); + + //下发通知 + List list = new ArrayList<>(); + TenPersonOperationVo vo = new TenPersonOperationVo(); + vo.setUid(syncEntity.getPersonId()); + vo.setOperation(1); + vo.setLast_update_stamp(syncEntity.getLastUpdateTime()); + list.add(vo); + serverApiService.personOperation(dev.getSn(), list); + } + } return R.ok(); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java index be0d1d3..07c88fb 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java @@ -98,19 +98,6 @@ public class TenDeviceServiceImpl extends ServiceImpl devList = tenDeviceService.findByCellId(entity.getCellId()); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/vo/TenUserVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/vo/TenUserVo.java index e7c078c..91ac3fe 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/vo/TenUserVo.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/vo/TenUserVo.java @@ -56,6 +56,7 @@ public class TenUserVo { private Integer isEnterSulfurArea; private Integer isProtectDevice; private Integer isWatchSafeVideo; + private Integer isBlacklistPersonnel; private List tenPersonCertList; private List tenPersonTrainList; diff --git a/shapelight-admin/src/main/resources/mapper/iCq/CqEnterMapper.xml b/shapelight-admin/src/main/resources/mapper/iCq/CqEnterMapper.xml index b544044..d566783 100644 --- a/shapelight-admin/src/main/resources/mapper/iCq/CqEnterMapper.xml +++ b/shapelight-admin/src/main/resources/mapper/iCq/CqEnterMapper.xml @@ -38,8 +38,15 @@ WHERE tect.type_id = #{typeId} - and cell_id = #{cell_id}; + and tect.cell_id = #{cellId}; + \ No newline at end of file diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml index ce89582..3b527b5 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml @@ -62,6 +62,10 @@ + + + + relation, + + is_enter_sulfur_area, + + + is_protect_device, + + + is_watch_safe_video, + + + is_blacklist_personnel, + + @@ -486,6 +503,18 @@ #{relation}, + + #{isEnterSulfurArea}, + + + #{isProtectDevice}, + + + #{isWatchSafeVideo}, + + + #{is_blacklist_personnel}, + @@ -664,6 +693,18 @@ relation = #{relation}, + + is_enter_sulfur_area = #{isEnterSulfurArea}, + + + is_protect_device = #{isProtectDevice}, + + + is_watch_safe_video = #{isWatchSafeVideo}, + + + is_blacklist_personnel = #{isBlacklistPersonnel}, + @@ -840,6 +881,15 @@ and p.label_id = #{params.labelId} + + and p.is_watch_safe_video = #{params.isWatchSafeVideo} + + + and p.live_start > #{params.liveStart} + + + and p.live_end < #{params.liveEnd} + order by p.create_time desc