v2.0.3
1.增加设备设备模块,增加ten_video表 2.增加设备记录模块,增加ten_video_record表 3.车辆记录按时间倒序排列
This commit is contained in:
parent
bbeec0ecf6
commit
2090cffd3c
|
@ -75,8 +75,8 @@ public class XaImageTask implements ITask {
|
||||||
if (type.intValue() == 1) {
|
if (type.intValue() == 1) {
|
||||||
String appId = object.getString("appId");
|
String appId = object.getString("appId");
|
||||||
String appSecret = object.getString("appSecret");
|
String appSecret = object.getString("appSecret");
|
||||||
// String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
|
String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
|
||||||
String fwikUrl = "http://";
|
// String fwikUrl = "http://";
|
||||||
if (fwikUrl != null) {
|
if (fwikUrl != null) {
|
||||||
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper) (new QueryWrapper())
|
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper) (new QueryWrapper())
|
||||||
.eq("tenant_id", sysTenUser.getTenantId()));
|
.eq("tenant_id", sysTenUser.getTenantId()));
|
||||||
|
@ -449,8 +449,8 @@ public class XaImageTask implements ITask {
|
||||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","SYRK", "SYRK", appId, appSecret);
|
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","SYRK", "SYRK", appId, appSecret);
|
||||||
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
|
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
|
||||||
|
|
||||||
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYRK", "SYRK", appId, appSecret,tranId);
|
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYRK", "SYRK", appId, appSecret,tranId);
|
||||||
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
|
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
|
||||||
// String resJson = "23232";
|
// String resJson = "23232";
|
||||||
// System.out.println(s);
|
// System.out.println(s);
|
||||||
log.debug("processRealPersonImage:" + resJson);
|
log.debug("processRealPersonImage:" + resJson);
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
package net.shapelight.modules.ten.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import net.shapelight.common.utils.Constant;
|
||||||
|
import net.shapelight.modules.sys.controller.AbstractController;
|
||||||
|
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||||
|
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||||
|
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenVideoService;
|
||||||
|
import net.shapelight.common.utils.PageUtils;
|
||||||
|
import net.shapelight.common.utils.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频设备表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("ten/video")
|
||||||
|
@Api(value="视频设备",tags={"视频设备"})
|
||||||
|
public class TenVideoController extends AbstractController {
|
||||||
|
@Autowired
|
||||||
|
private TenVideoService tenVideoService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserRoleService sysUserRoleService;
|
||||||
|
@Autowired
|
||||||
|
private TenUserScopeService tenUserScopeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("ten:video")
|
||||||
|
@ApiOperation(value = "查询列表",response = TenVideoEntity.class)
|
||||||
|
public R list(@RequestParam Map<String, Object> params){
|
||||||
|
String tenantId = getUser().getTenantId()+"";
|
||||||
|
params.put("tenantId",tenantId+"");
|
||||||
|
SysUserEntity user = getUser();
|
||||||
|
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||||
|
//小区管理员
|
||||||
|
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
|
||||||
|
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
|
||||||
|
params.put("cellId",scope.getCellId().toString());
|
||||||
|
}
|
||||||
|
PageUtils page = tenVideoService.queryPage(params);
|
||||||
|
|
||||||
|
return R.ok().put("data", page);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/info/{id}")
|
||||||
|
@RequiresPermissions("ten:video")
|
||||||
|
@ApiOperation(value = "查询详情",response = TenVideoEntity.class)
|
||||||
|
public R info(@PathVariable("id") Long id){
|
||||||
|
TenVideoEntity tenVideo = tenVideoService.getById(id);
|
||||||
|
|
||||||
|
return R.ok().put("data", tenVideo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@PostMapping("/save")
|
||||||
|
@RequiresPermissions("ten:video")
|
||||||
|
@ApiOperation(value = "保存",response = TenVideoEntity.class)
|
||||||
|
public R save(@RequestBody TenVideoEntity tenVideo){
|
||||||
|
tenVideoService.save(tenVideo);
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
@RequiresPermissions("ten:video")
|
||||||
|
@ApiOperation(value = "修改",response = TenVideoEntity.class)
|
||||||
|
public R update(@RequestBody TenVideoEntity tenVideo){
|
||||||
|
tenVideoService.updateById(tenVideo);
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@RequiresPermissions("ten:video")
|
||||||
|
@ApiOperation(value = "删除",response = TenVideoEntity.class)
|
||||||
|
public R delete(@RequestBody Long[] ids){
|
||||||
|
tenVideoService.removeByIds(Arrays.asList(ids));
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package net.shapelight.modules.ten.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import net.shapelight.common.utils.Constant;
|
||||||
|
import net.shapelight.modules.sys.controller.AbstractController;
|
||||||
|
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||||
|
import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||||
|
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenUserScopeService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoRecordEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenVideoRecordService;
|
||||||
|
import net.shapelight.common.utils.PageUtils;
|
||||||
|
import net.shapelight.common.utils.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频抓拍表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("ten/videorecord")
|
||||||
|
@Api(value="视频抓拍记录",tags={"视频抓拍记录"})
|
||||||
|
public class TenVideoRecordController extends AbstractController {
|
||||||
|
@Autowired
|
||||||
|
private TenVideoRecordService tenVideoRecordService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserRoleService sysUserRoleService;
|
||||||
|
@Autowired
|
||||||
|
private TenUserScopeService tenUserScopeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("ten:videorecord")
|
||||||
|
@ApiOperation(value = "查询列表",response = TenVideoEntity.class)
|
||||||
|
public R list(@RequestParam Map<String, Object> params){
|
||||||
|
String tenantId = getUser().getTenantId()+"";
|
||||||
|
params.put("tenantId",tenantId+"");
|
||||||
|
SysUserEntity user = getUser();
|
||||||
|
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||||
|
//小区管理员
|
||||||
|
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
|
||||||
|
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
|
||||||
|
params.put("cellId",scope.getCellId().toString());
|
||||||
|
}
|
||||||
|
PageUtils page = tenVideoRecordService.queryPage(params);
|
||||||
|
|
||||||
|
return R.ok().put("data", page);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package net.shapelight.modules.ten.dao;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoEntity;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频设备表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TenVideoDao extends BaseMapper<TenVideoEntity> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package net.shapelight.modules.ten.dao;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoRecordEntity;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频抓拍表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TenVideoRecordDao extends BaseMapper<TenVideoRecordEntity> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package net.shapelight.modules.ten.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频设备表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("ten_video")
|
||||||
|
public class TenVideoEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String sn;
|
||||||
|
/**
|
||||||
|
* 小区
|
||||||
|
*/
|
||||||
|
private Long cellId;
|
||||||
|
/**
|
||||||
|
* 运营商id
|
||||||
|
*/
|
||||||
|
private Long tenantId;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 安装位置
|
||||||
|
*/
|
||||||
|
private String location;
|
||||||
|
/**
|
||||||
|
* 厂家
|
||||||
|
*/
|
||||||
|
private String factory;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String note;
|
||||||
|
/**
|
||||||
|
* 状态1在线0离线
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* ip
|
||||||
|
*/
|
||||||
|
private String ip;
|
||||||
|
/**
|
||||||
|
* 最后在线时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date lastOnlineTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty("小区名称")
|
||||||
|
private String cellName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package net.shapelight.modules.ten.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频抓拍表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("ten_video_record")
|
||||||
|
public class TenVideoRecordEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long recordId;
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String sn;
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private Date captureTime;
|
||||||
|
/**
|
||||||
|
* 小图
|
||||||
|
*/
|
||||||
|
private String facePicture;
|
||||||
|
/**
|
||||||
|
* 大图
|
||||||
|
*/
|
||||||
|
private String backgroudPicture;
|
||||||
|
/**
|
||||||
|
* 小区id
|
||||||
|
*/
|
||||||
|
private Long cellId;
|
||||||
|
/**
|
||||||
|
* 运营商id
|
||||||
|
*/
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty("小区名称")
|
||||||
|
private String cellName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package net.shapelight.modules.ten.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import net.shapelight.common.utils.PageUtils;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoRecordEntity;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频抓拍表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface TenVideoRecordService extends IService<TenVideoRecordEntity> {
|
||||||
|
|
||||||
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package net.shapelight.modules.ten.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import net.shapelight.common.utils.PageUtils;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoEntity;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频设备表
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface TenVideoService extends IService<TenVideoEntity> {
|
||||||
|
|
||||||
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,8 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl<TenPackRecordEnte
|
||||||
new QueryWrapper<TenPackRecordEnterEntity>()
|
new QueryWrapper<TenPackRecordEnterEntity>()
|
||||||
.eq("tenant_id",params.get("tenantId"))
|
.eq("tenant_id",params.get("tenantId"))
|
||||||
.in("cell_id",cellIds)
|
.in("cell_id",cellIds)
|
||||||
|
.orderByDesc("enter_time")
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for(TenPackRecordEnterEntity entity: page.getRecords()){
|
for(TenPackRecordEnterEntity entity: page.getRecords()){
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitD
|
||||||
new QueryWrapper<TenPackRecordExitEntity>()
|
new QueryWrapper<TenPackRecordExitEntity>()
|
||||||
.eq("tenant_id",params.get("tenantId"))
|
.eq("tenant_id",params.get("tenantId"))
|
||||||
.in("cell_id",cellIds)
|
.in("cell_id",cellIds)
|
||||||
|
.orderByDesc("exit_time")
|
||||||
);
|
);
|
||||||
|
|
||||||
for(TenPackRecordExitEntity entity: page.getRecords()){
|
for(TenPackRecordExitEntity entity: page.getRecords()){
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package net.shapelight.modules.ten.service.impl;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenCellService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import net.shapelight.common.utils.PageUtils;
|
||||||
|
import net.shapelight.common.utils.Query;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.dao.TenVideoRecordDao;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoRecordEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenVideoRecordService;
|
||||||
|
|
||||||
|
import javax.xml.ws.Action;
|
||||||
|
|
||||||
|
|
||||||
|
@Service("tenVideoRecordService")
|
||||||
|
public class TenVideoRecordServiceImpl extends ServiceImpl<TenVideoRecordDao, TenVideoRecordEntity> implements TenVideoRecordService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenCellService tenCellService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
|
|
||||||
|
List<Long> cellIds = new ArrayList<>();
|
||||||
|
// cellIds.add(709832651506188289L);
|
||||||
|
String cellId = (String)params.get("cellId");
|
||||||
|
if (cellId!=null && !cellId.isEmpty()){
|
||||||
|
Long cellLong = Long.parseLong(cellId);
|
||||||
|
cellIds.add(cellLong);
|
||||||
|
}else {
|
||||||
|
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||||
|
for (TenCellEntity cell : cells) {
|
||||||
|
cellIds.add(cell.getCellId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cellIds.size() == 0) {
|
||||||
|
return new PageUtils(new ArrayList<>(),0,0,0);
|
||||||
|
}
|
||||||
|
IPage<TenVideoRecordEntity> page = this.page(
|
||||||
|
new Query<TenVideoRecordEntity>().getPage(params),
|
||||||
|
new QueryWrapper<TenVideoRecordEntity>()
|
||||||
|
// .eq("tenant_id",params.get("tenantId"))
|
||||||
|
.in("cell_id",cellIds)
|
||||||
|
.orderByDesc("capture_time")
|
||||||
|
);
|
||||||
|
|
||||||
|
for(TenVideoRecordEntity videoEntity: page.getRecords()){
|
||||||
|
String cellName = tenCellService.getCellName(videoEntity.getCellId()+"");
|
||||||
|
videoEntity.setCellName(cellName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PageUtils(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package net.shapelight.modules.ten.service.impl;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenCellService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import net.shapelight.common.utils.PageUtils;
|
||||||
|
import net.shapelight.common.utils.Query;
|
||||||
|
|
||||||
|
import net.shapelight.modules.ten.dao.TenVideoDao;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenVideoService;
|
||||||
|
|
||||||
|
|
||||||
|
@Service("tenVideoService")
|
||||||
|
public class TenVideoServiceImpl extends ServiceImpl<TenVideoDao, TenVideoEntity> implements TenVideoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenCellService tenCellService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
|
|
||||||
|
List<Long> cellIds = new ArrayList<>();
|
||||||
|
// cellIds.add(709832651506188289L);
|
||||||
|
String cellId = (String)params.get("cellId");
|
||||||
|
if (cellId!=null && !cellId.isEmpty()){
|
||||||
|
Long cellLong = Long.parseLong(cellId);
|
||||||
|
cellIds.add(cellLong);
|
||||||
|
}else {
|
||||||
|
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||||
|
for (TenCellEntity cell : cells) {
|
||||||
|
cellIds.add(cell.getCellId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cellIds.size() == 0) {
|
||||||
|
return new PageUtils(new ArrayList<>(),0,0,0);
|
||||||
|
}
|
||||||
|
IPage<TenVideoEntity> page = this.page(
|
||||||
|
new Query<TenVideoEntity>().getPage(params),
|
||||||
|
new QueryWrapper<TenVideoEntity>()
|
||||||
|
// .eq("tenant_id",params.get("tenantId"))
|
||||||
|
.in("cell_id",cellIds)
|
||||||
|
);
|
||||||
|
|
||||||
|
for(TenVideoEntity videoEntity: page.getRecords()){
|
||||||
|
String cellName = tenCellService.getCellName(videoEntity.getCellId()+"");
|
||||||
|
videoEntity.setCellName(cellName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PageUtils(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
package net.shapelight.modules.video.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.minio.MinioClient;
|
||||||
|
import io.minio.PutObjectOptions;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
import net.shapelight.common.config.GlobalValue;
|
||||||
|
import net.shapelight.common.config.MinioConfig;
|
||||||
|
import net.shapelight.common.utils.*;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoEntity;
|
||||||
|
import net.shapelight.modules.ten.entity.TenVideoRecordEntity;
|
||||||
|
import net.shapelight.modules.ten.service.TenVideoRecordService;
|
||||||
|
import net.shapelight.modules.ten.service.TenVideoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping({"/api/video/v1"})
|
||||||
|
@Api("视频接口")
|
||||||
|
public class VideoOpenApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenVideoService tenVideoService;
|
||||||
|
@Autowired
|
||||||
|
private MinioConfig minioConfig;
|
||||||
|
@Autowired
|
||||||
|
private MinioClient minioClient;
|
||||||
|
@Autowired
|
||||||
|
private GlobalValue globalValue;
|
||||||
|
@Autowired
|
||||||
|
private TenVideoRecordService tenVideoRecordService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"TimeStamp": "2020-12-11 18:06:33",
|
||||||
|
"Data": {
|
||||||
|
"DeviceInfo": {
|
||||||
|
"DeviceId": "01234567891234567"
|
||||||
|
},
|
||||||
|
"CaptureInfo": {
|
||||||
|
"CaptureTime": "2020-12-11 18:06:33",
|
||||||
|
"FacePicture": "/9j/4AAQSkZJRgABAQAAAQABAAD",
|
||||||
|
"BackgroundPicture": "/9j/4AAQSkZJRgABAQAAAQABAAD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@PostMapping({"/personZpCallback"})
|
||||||
|
@ApiOperation("第三方推送")
|
||||||
|
public Map personZpCallback(@RequestBody Object object) {
|
||||||
|
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(object);
|
||||||
|
String deviceId = jsonObject.getJSONObject("Data").getJSONObject("DeviceInfo").getString("DeviceId");
|
||||||
|
String captureTimeStr = jsonObject.getJSONObject("Data").getJSONObject("CaptureInfo").getString("CaptureTime");
|
||||||
|
String facePicture = jsonObject.getJSONObject("Data").getJSONObject("CaptureInfo").getString("FacePicture");
|
||||||
|
String backgroundPicture = jsonObject.getJSONObject("Data").getJSONObject("CaptureInfo").getString("BackgroundPicture");
|
||||||
|
TenVideoEntity videoEntity = tenVideoService.getOne(new QueryWrapper<TenVideoEntity>()
|
||||||
|
.eq("sn",deviceId));
|
||||||
|
if(videoEntity!=null){
|
||||||
|
TenVideoRecordEntity recordEntity = new TenVideoRecordEntity();
|
||||||
|
recordEntity.setSn(deviceId);
|
||||||
|
recordEntity.setCaptureTime(DateUtils.stringToDate(captureTimeStr,DateUtils.DATE_TIME_PATTERN));
|
||||||
|
recordEntity.setCellId(videoEntity.getCellId());
|
||||||
|
recordEntity.setTenantId(videoEntity.getTenantId());
|
||||||
|
|
||||||
|
|
||||||
|
if(facePicture!=null && !facePicture.isEmpty()){
|
||||||
|
try {
|
||||||
|
byte[] b = Base64.getDecoder().decode(facePicture.replace("\n", ""));
|
||||||
|
InputStream inputStream = new ByteArrayInputStream(b);
|
||||||
|
String userFileUrl = "video/" +
|
||||||
|
recordEntity.getCellId().toString() + "/" +
|
||||||
|
DateUtils.format(new Date(),DateUtils.DATE_YEAR_MONTH) + "/";
|
||||||
|
String fileName = userFileUrl + UUIDUtil.uuid() + ".jpg";
|
||||||
|
// String fileName = "t_"+UUIDUtil.uuid()+ "." +extension;
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(b.length, -1);
|
||||||
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
|
minioClient.putObject(
|
||||||
|
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions);
|
||||||
|
inputStream.close();
|
||||||
|
recordEntity.setFacePicture(fileName);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(backgroundPicture!=null && !backgroundPicture.isEmpty()){
|
||||||
|
try {
|
||||||
|
byte[] b = Base64.getDecoder().decode(backgroundPicture.replace("\n", ""));
|
||||||
|
InputStream inputStream = new ByteArrayInputStream(b);
|
||||||
|
String userFileUrl = "video/" +
|
||||||
|
recordEntity.getCellId().toString() + "/" +
|
||||||
|
DateUtils.format(new Date(),DateUtils.DATE_YEAR_MONTH) + "/";
|
||||||
|
String fileName = userFileUrl + UUIDUtil.uuid() + ".jpg";
|
||||||
|
// String fileName = "t_"+UUIDUtil.uuid()+ "." +extension;
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(b.length, -1);
|
||||||
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
|
minioClient.putObject(
|
||||||
|
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions);
|
||||||
|
inputStream.close();
|
||||||
|
recordEntity.setBackgroudPicture(fileName);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tenVideoRecordService.save(recordEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map res = new HashMap();
|
||||||
|
res.put("code","0");
|
||||||
|
res.put("msg","上传成功");
|
||||||
|
res.put("result","success");
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping({"/zpPersonHeartbeat"})
|
||||||
|
@ApiOperation("第三方心跳")
|
||||||
|
public Map zpPersonHeartbeat(@RequestBody Object object) {
|
||||||
|
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(object);
|
||||||
|
String deviceId = jsonObject.getJSONObject("Data").getJSONObject("DeviceInfo").getString("DeviceId");
|
||||||
|
String deviceIp = jsonObject.getJSONObject("Data").getJSONObject("DeviceInfo").getString("DeviceIp");
|
||||||
|
TenVideoEntity videoEntity = tenVideoService.getOne(new QueryWrapper<TenVideoEntity>()
|
||||||
|
.eq("sn",deviceId));
|
||||||
|
if(videoEntity!=null){
|
||||||
|
// videoEntity.setIp(deviceIp);
|
||||||
|
// videoEntity.setLastOnlineTime(new Date());
|
||||||
|
// tenVideoService.updateById(videoEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map res = new HashMap();
|
||||||
|
res.put("code","0");
|
||||||
|
res.put("msg","上传成功");
|
||||||
|
res.put("result","success");
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
|
@ -393,16 +393,16 @@ public class XaApi {
|
||||||
//伟丰花园:610113600000000005977 欧风园:610113600000000004538
|
//伟丰花园:610113600000000005977 欧风园:610113600000000004538
|
||||||
//西安文理学院:610113630000000010348 绿地花都:610113610000000017653
|
//西安文理学院:610113630000000010348 绿地花都:610113610000000017653
|
||||||
String xqid = "610113600000000004538";
|
String xqid = "610113600000000004538";
|
||||||
String address = getAddress(xqid, appid, appsecret);
|
// String address = getAddress(xqid, appid, appsecret);
|
||||||
System.out.println(address);
|
// System.out.println(address);
|
||||||
|
|
||||||
|
|
||||||
//6.2 获取数据对接接口---------------------------------------------------------------------------
|
//6.2 获取数据对接接口---------------------------------------------------------------------------
|
||||||
String apiUrl = getFwikUrl(appid, appsecret);
|
String apiUrl = getFwikUrl(appid, appsecret);
|
||||||
System.out.println(apiUrl);
|
System.out.println(apiUrl);
|
||||||
//6.1 获取标准地址接口---------------------------------------------------------------------------
|
//6.1 获取标准地址接口---------------------------------------------------------------------------
|
||||||
String addressCell = getAddress(xqid, appid, appsecret);
|
// String addressCell = getAddress(xqid, appid, appsecret);
|
||||||
System.out.println(addressCell);
|
// System.out.println(addressCell);
|
||||||
//6.3.1 实有房屋信息----------------------------------------------------------------------------
|
//6.3.1 实有房屋信息----------------------------------------------------------------------------
|
||||||
// 1820591355 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号4栋1单元3层4131号 长安南路 108.942481 34.207741 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000013000001000003000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
// 1820591355 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号4栋1单元3层4131号 长安南路 108.942481 34.207741 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000013000001000003000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
|
||||||
/*
|
/*
|
||||||
|
@ -420,7 +420,7 @@ public class XaApi {
|
||||||
//6.3.2 实有人口信息----------------------------------------------------------------------------
|
//6.3.2 实有人口信息----------------------------------------------------------------------------
|
||||||
// syncPerson();
|
// syncPerson();
|
||||||
//6.3.9 车辆出入记录-------------------------------------------------------------
|
//6.3.9 车辆出入记录-------------------------------------------------------------
|
||||||
// processRecordCarEnter();
|
processRecordCarEnter();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ spring:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://192.168.50.232:3306/cell_db_tcp?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
url: jdbc:mysql://192.168.50.232:3306/cell_db_0427?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
|
||||||
username: user
|
username: user
|
||||||
password: user@server001
|
password: user@server001
|
||||||
initial-size: 10
|
initial-size: 10
|
||||||
|
|
|
@ -78,7 +78,7 @@ global:
|
||||||
opt_dir: opt
|
opt_dir: opt
|
||||||
db_bak:
|
db_bak:
|
||||||
db_filepath: db_bak
|
db_filepath: db_bak
|
||||||
db_name: cell_db
|
db_name: cell_db_0427
|
||||||
db_username: root
|
db_username: root
|
||||||
db_password: root
|
db_password: root
|
||||||
db_host: localhost
|
db_host: localhost
|
||||||
|
|
|
@ -412,6 +412,7 @@
|
||||||
select * from ten_record_${tenantId}
|
select * from ten_record_${tenantId}
|
||||||
where cell_id = #{cellId}
|
where cell_id = #{cellId}
|
||||||
and xa_sync = 0
|
and xa_sync = 0
|
||||||
|
and record_face is not null
|
||||||
and TO_DAYS(record_time) = TO_DAYS(NOW())
|
and TO_DAYS(record_time) = TO_DAYS(NOW())
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -420,6 +421,7 @@
|
||||||
where cell_id = #{cellId}
|
where cell_id = #{cellId}
|
||||||
and xa_sync_image = 0
|
and xa_sync_image = 0
|
||||||
and xa_sync = 1
|
and xa_sync = 1
|
||||||
|
and record_face is not null
|
||||||
and TO_DAYS(record_time) = TO_DAYS(NOW())
|
and TO_DAYS(record_time) = TO_DAYS(NOW())
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?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="net.shapelight.modules.ten.dao.TenVideoDao">
|
||||||
|
|
||||||
|
<!-- 可根据自己的需求,是否要使用 -->
|
||||||
|
<resultMap type="net.shapelight.modules.ten.entity.TenVideoEntity" id="tenVideoMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="sn" column="sn"/>
|
||||||
|
<result property="cellId" column="cell_id"/>
|
||||||
|
<result property="tenantId" column="tenant_id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="location" column="location"/>
|
||||||
|
<result property="factory" column="factory"/>
|
||||||
|
<result property="note" column="note"/>
|
||||||
|
<result property="status" column="status"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?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="net.shapelight.modules.ten.dao.TenVideoRecordDao">
|
||||||
|
|
||||||
|
<!-- 可根据自己的需求,是否要使用 -->
|
||||||
|
<resultMap type="net.shapelight.modules.ten.entity.TenVideoRecordEntity" id="tenVideoRecordMap">
|
||||||
|
<result property="recordId" column="record_id"/>
|
||||||
|
<result property="sn" column="sn"/>
|
||||||
|
<result property="captureTime" column="capture_time"/>
|
||||||
|
<result property="facePicture" column="face_picture"/>
|
||||||
|
<result property="backgroudPicture" column="backgroud_picture"/>
|
||||||
|
<result property="cellId" column="cell_id"/>
|
||||||
|
<result property="tenantId" column="tenant_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -22,6 +22,7 @@ public class DateUtils {
|
||||||
/** 时间格式(yyyy-MM-dd HH:mm:ss) */
|
/** 时间格式(yyyy-MM-dd HH:mm:ss) */
|
||||||
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||||
public final static String DATE_TIME_DB= "yyyyMMddHHmmss";
|
public final static String DATE_TIME_DB= "yyyyMMddHHmmss";
|
||||||
|
public final static String DATE_YEAR_MONTH= "yyyyMMdd";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期格式化 日期格式为:yyyy-MM-dd
|
* 日期格式化 日期格式为:yyyy-MM-dd
|
||||||
|
|
Loading…
Reference in New Issue