长庆项目修改

This commit is contained in:
张博 2024-10-20 00:15:43 +08:00
parent 6a7d0bb746
commit 16352dcbd0
19 changed files with 152 additions and 45 deletions

View File

@ -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<TenPersonEntity>()
.set(TenPersonEntity::getIsWatchSafeVideo,1)
.eq(TenPersonEntity::getPersonId,userCompareInfo.getFaceId()));
}*/
}
}

View File

@ -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<EnterVo> enterVoList = cqEnterMapper.queryByCellId(deviceEntity.getCellId());
return R.ok().put("data",enterVoList);
}
}

View File

@ -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> 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());
}

View File

@ -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;
}

View File

@ -11,7 +11,7 @@ import java.util.Date;
@NoArgsConstructor
public class FTo {
private long cellId;
private String cellId;
private Date operateTime;
}

View File

@ -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;

View File

@ -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());

View File

@ -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;
/**
* 部门名称

View File

@ -20,7 +20,6 @@ public class FileEntity implements Serializable {
/**
* 文件id
*/
@TableId
private String fileId;
/**
* 文件名称

View File

@ -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;
/**
* 上传人姓名

View File

@ -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<TenEnterConfigEntity> {
List<FTo> classifiedQuery(@Param("cellId")long cellId);
List<FTo> classifiedQuery(@Param("cellId")String cellId);
List<PeronType> getPersonType();
List<TypeRules> rulesByType(long typeId, @Param("cellId") Long cellId);
List<TypeRules> rulesByType(String typeId, @Param("cellId") String cellId);
int changeState(int ruleId);
List<EnterVo> queryByCellId(Long cellId);
}

View File

@ -11,5 +11,5 @@ public interface CqSafeVideoMapper extends BaseMapper<TenSafeVideoEntity> {
String findTheNameById(long cellId);
String findTheNameById(String cellId);
}

View File

@ -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<TenCellEntity>()
.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);

View File

@ -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<String, Object> 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<TenDoorCardEntity>()
@ -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<TenDeviceVo> 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<TenPersonOperationVo> 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();
}

View File

@ -98,19 +98,6 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
String cellName = tenCellService.getCellName(dev.getCellId().toString());
scope.append(cellName);
}
if (dev.getBuildId() != null) {
TenBuildEntity build = tenBuildService.getById(dev.getBuildId(), dev.getCellId());
// dev.setBuildName(build.getName());
// dev.setBuildUnit(build.getUnit());
scope.append(build.getName());
scope.append(build.getUnit());
scope.append("单元");
}
if (dev.getRoomId() != null) {
String roomName = tenRoomService.getRoomName(dev.getRoomId(), dev.getCellId());
// dev.setRoomName(roomName);
scope.append(roomName);
}
dev.setScope(scope.toString());
// boolean onlineFlag = emqHttpApi.getClient(dev.getSn());

View File

@ -607,7 +607,7 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
if (flag == 1) {
//保存卡号
if (entity.getDoorCardEntity() != null && !entity.getDoorCardEntity().getDoorCard().isEmpty()) {
/* if (entity.getDoorCardEntity() != null && !entity.getDoorCardEntity().getDoorCard().isEmpty()) {
TenDoorCardEntity card = new TenDoorCardEntity();
card.setCellId(entity.getCellId());
card.setDoorCard(entity.getDoorCardEntity().getDoorCard());
@ -621,8 +621,8 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
card.setLastUpdateTime(now);
// tenDoorCardService.save(doorCardEntity);
tenDoorCardService.save(card);
}
//保存App用户
}*/
/* //保存App用户
if (entity.getAppFlag() == Constant.APP_LOGIN_YES) {
AppUserEntity appUser = new AppUserEntity();
appUser.setUsername(entity.getUsername());
@ -647,7 +647,7 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
appUser.setCurrentScopeId(appScope.getUserScopeId());
appUserService.updateById(appUser);
}
}*/
//发送设备通知
// List<TenDeviceVo> devList = tenDeviceService.findByCellId(entity.getCellId());

View File

@ -56,6 +56,7 @@ public class TenUserVo {
private Integer isEnterSulfurArea;
private Integer isProtectDevice;
private Integer isWatchSafeVideo;
private Integer isBlacklistPersonnel;
private List<TenPersonCert> tenPersonCertList;
private List<TenPersonTrain> tenPersonTrainList;

View File

@ -38,8 +38,15 @@
WHERE
tect.type_id = #{typeId}
<if test="cellId != null and cellId != ''">
and cell_id = #{cell_id};
and tect.cell_id = #{cellId};
</if>
</select>
<select id="queryByCellId" resultType="net.shapelight.modules.iCq.controller.enter.to.EnterVo">
SELECT
enter_config_id,type_id,state,check_item as configName
FROM
ten_enter_config_type a left join ten_enter_config b on a.enter_config_id = b.id
WHERE cell_id = #{cellId}
</select>
</mapper>

View File

@ -62,6 +62,10 @@
<result column="ic" jdbcType="VARCHAR" property="ic" />
<result column="householder" jdbcType="VARCHAR" property="householder" />
<result column="relation" jdbcType="VARCHAR" property="relation" />
<result column="is_enter_sulfur_area" jdbcType="INTEGER" property="isEnterSulfurArea" />
<result column="is_protect_device" jdbcType="INTEGER" property="isProtectDevice" />
<result column="is_watch_safe_video" jdbcType="INTEGER" property="isWatchSafeVideo" />
<result column="is_blacklist_personnel" jdbcType="INTEGER" property="isBlacklistPersonnel" />
<association property="cellName" javaType="String"
select="net.shapelight.modules.ten.dao.TenCellDao.getCellName"
@ -312,6 +316,19 @@
<if test="relation != null">
relation,
</if>
<if test="isEnterSulfurArea != null">
is_enter_sulfur_area,
</if>
<if test="isProtectDevice != null">
is_protect_device,
</if>
<if test="isWatchSafeVideo != null">
is_watch_safe_video,
</if>
<if test="isBlacklistPersonnel != null">
is_blacklist_personnel,
</if>
</trim>
@ -486,6 +503,18 @@
<if test="relation != null">
#{relation},
</if>
<if test="isEnterSulfurArea != null">
#{isEnterSulfurArea},
</if>
<if test="isProtectDevice != null">
#{isProtectDevice},
</if>
<if test="isWatchSafeVideo != null">
#{isWatchSafeVideo},
</if>
<if test="isBlacklistPersonnel != null">
#{is_blacklist_personnel},
</if>
</trim>
</insert>
@ -664,6 +693,18 @@
<if test="relation != null">
relation = #{relation},
</if>
<if test="isEnterSulfurArea != null">
is_enter_sulfur_area = #{isEnterSulfurArea},
</if>
<if test="isProtectDevice != null">
is_protect_device = #{isProtectDevice},
</if>
<if test="isWatchSafeVideo != null">
is_watch_safe_video = #{isWatchSafeVideo},
</if>
<if test="isBlacklistPersonnel != null">
is_blacklist_personnel = #{isBlacklistPersonnel},
</if>
</set>
@ -840,6 +881,15 @@
<if test="params.labelId != null and params.labelId!=''">
and p.label_id = #{params.labelId}
</if>
<if test="params.isWatchSafeVideo != null and params.isWatchSafeVideo!=''">
and p.is_watch_safe_video = #{params.isWatchSafeVideo}
</if>
<if test="params.liveStart != null and params.liveStart!=''">
and p.live_start &gt; #{params.liveStart}
</if>
<if test="params.liveEnd != null and params.liveEnd!=''">
and p.live_end &lt; #{params.liveEnd}
</if>
order by p.create_time desc