添加海康接口 优化票务服务
This commit is contained in:
parent
019a3f5be7
commit
b17fb5c6eb
@ -122,6 +122,12 @@
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hikvision.ga</groupId>
|
||||
<artifactId>artemis-http-client</artifactId>
|
||||
<version>1.1.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDTO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.RegionCameraListDTO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.region.vo.RegionDTO;
|
||||
import cn.iocoder.yudao.module.datacenter.service.camera.CameraService;
|
||||
import cn.iocoder.yudao.module.datacenter.service.region.RegionService;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -17,6 +21,8 @@ import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "大屏服务 - 监控点")
|
||||
@RestController
|
||||
@RequestMapping("/camera")
|
||||
@ -25,6 +31,9 @@ public class CameraApi {
|
||||
@Resource
|
||||
private CameraService cameraService;
|
||||
|
||||
@Resource
|
||||
private RegionService regionService;
|
||||
|
||||
@GetMapping("/selectCameraByPageAndCondition")
|
||||
@Operation(summary = "分页条件查询监控点信息")
|
||||
@DS("hiking")
|
||||
@ -36,9 +45,10 @@ public class CameraApi {
|
||||
List<CameraDTO> cameraDTOList = new ArrayList<>();
|
||||
cameraPage.getList().forEach(cameraDO -> {
|
||||
CameraDTO cameraDTO = new CameraDTO();
|
||||
cameraDTO.setCamera_type(cameraDO.getCameraType());
|
||||
cameraDTO.setName(cameraDO.getName());
|
||||
cameraDTO.setCameraType(cameraDO.getCameraType());
|
||||
cameraDTO.setCameraName(cameraDO.getCameraName());
|
||||
cameraDTO.setId(cameraDO.getId());
|
||||
cameraDTO.setStatus(cameraDO.getStatus());
|
||||
cameraDTOList.add(cameraDTO);
|
||||
});
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
@ -48,5 +58,81 @@ public class CameraApi {
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/selectPreviewUrlByCameraIndexCode")
|
||||
@Operation(summary = "获取监控点预览流URL")
|
||||
public Map<String, Object> selectPreviewUrlByCameraIndexCode(String cameraIndexCode, Integer streamType, String protocol, Integer transmode, String expand, String streamform) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
// String previewUrl = cameraService.getPreviewUrl(cameraIndexCode, streamType, protocol, transmode, expand, streamform);
|
||||
// result.put("previewUrl", previewUrl);
|
||||
result.put("previewUrl", "");
|
||||
result.put("传入的参数", "cameraIndexCode:" + cameraIndexCode + " streamType:" + streamType + " protocol:" + protocol + " transmode:" + transmode + " expand:" + expand + " streamform:" + streamform);
|
||||
result.put("status", "success");
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/selectPlayBackUrlByCameraIndexCode")
|
||||
@Operation(summary = "获取监控点回放流URL")
|
||||
public Map<String, Object> selectPlayBackUrlByCameraIndexCode(String cameraIndexCode, Integer recordLocation, String protocol, Integer transmode, String beginTime, String endTime, String uuid, String expand, String streamform, Integer lockType) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
// String playBack = cameraService.getPlayBackUrl(cameraIndexCode,recordLocation, protocol, transmode, beginTime, endTime, uuid, expand, streamform,lockType);
|
||||
// result.put("previewUrl", playBack);
|
||||
// result.put("playBackUrl", "");
|
||||
result.put("传入的参数", "cameraIndexCode:" + cameraIndexCode + " recordLocation:" + recordLocation + " protocol:" + protocol + " transmode:" + transmode + " beginTime:" + beginTime + " endTime:" + endTime + " uuid:" + uuid + " expand:" + expand + " streamform:" + streamform + " lockType:" + lockType);
|
||||
result.put("status", "success");
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/selZoom")
|
||||
@Operation(summary = "监控点3D缩放")
|
||||
public Map<String, Object> selZoom(String cameraIndexCode, Integer startX, Integer startY, Integer endX, Integer endY) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
String selZoomResult = cameraService.selZoom(cameraIndexCode, startX, startY, endX, endY);
|
||||
result.put("selZoomResult", selZoomResult);
|
||||
// result.put("selZoomResult", "");
|
||||
result.put("传入的参数", "cameraIndexCode:" + cameraIndexCode + " startX:" + startX + " startY:" + startY + " endX:" + endX + " endY:" + endY);
|
||||
result.put("status", "success");
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/controlling")
|
||||
@Operation(summary = "云台控制")
|
||||
public Map<String, Object> controlling(String cameraIndexCode, Integer action, String command, Integer speed, Integer presetIndex) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
// String controllingResult = cameraService.controlling(cameraIndexCode,action, command, speed, presetIndex);
|
||||
// result.put("selZoomResult", controllingResult);
|
||||
result.put("controllingResult", "");
|
||||
result.put("传入的参数", "cameraIndexCode:" + cameraIndexCode + " action:" + action + " command:" + command + " speed:" + speed + " presetIndex:" + presetIndex);
|
||||
result.put("status", "success");
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/selectCameraByRegionIndexCode")
|
||||
@Operation(summary = "根据区域编码获取监控点信息")
|
||||
@DS("hiking")
|
||||
public Map<String, Object> selectCameraByRegionIndexCode(String regionIndexCode) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
List<CameraDTO> cameraDTOS = cameraService.selectCameraByRegionIndexCode(regionIndexCode);
|
||||
result.put("cameraDTOS", cameraDTOS);
|
||||
System.out.println(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/rtspTest")
|
||||
@Operation(summary = "rtsp推流测试")
|
||||
public Map<String, Object> rtspTest() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("rtsp_url", "rtsp://192.168.1.7/stream");
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/selectCameraIndexCodeByCameraName")
|
||||
@Operation(summary = "根据监控点名称获取监控点编码")
|
||||
@DS("hiking")
|
||||
public Map<String, Object> selectCameraIndexCodeByCameraName(String cameraName) {
|
||||
System.out.println(cameraName);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
String cameraIndexCode = cameraService.selectCameraIndexCodeByCameraName(cameraName);
|
||||
result.put("cameraIndexCode", cameraIndexCode);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class CameraDO extends BaseDO {
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
private String name;
|
||||
private String cameraName;
|
||||
/**
|
||||
* 通道号
|
||||
*/
|
||||
|
@ -10,15 +10,19 @@ public class CameraDTO {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "监控点名称")
|
||||
private String name;
|
||||
private String cameraName;
|
||||
|
||||
@Schema(description = "监控点类型")
|
||||
private Integer camera_type;
|
||||
private Integer cameraType;
|
||||
|
||||
@Schema(description = "预览URL")
|
||||
private String previewUrl;
|
||||
@Schema(description = "监控点状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "回放URL")
|
||||
private String playBackUrl;
|
||||
private Integer leaf = 1;
|
||||
// @Schema(description = "预览URL")
|
||||
// private String previewUrl;
|
||||
//
|
||||
// @Schema(description = "回放URL")
|
||||
// private String playBackUrl;
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class CameraPageReqVO extends PageParam {
|
||||
private String treatyTypeName;
|
||||
|
||||
@Schema(description = "资源名称")
|
||||
private String name;
|
||||
private String cameraName;
|
||||
|
||||
@Schema(description = "安装位置")
|
||||
private String installLocation;
|
||||
|
@ -93,7 +93,7 @@ public class CameraRespVO {
|
||||
|
||||
@Schema(description = "资源名称")
|
||||
@ExcelProperty("资源名称")
|
||||
private String name;
|
||||
private String cameraName;
|
||||
|
||||
@Schema(description = "通道号")
|
||||
@ExcelProperty("通道号")
|
||||
|
@ -70,7 +70,7 @@ public class CameraSaveReqVO {
|
||||
private String externalIndexCode;
|
||||
|
||||
@Schema(description = "资源名称")
|
||||
private String name;
|
||||
private String cameraName;
|
||||
|
||||
@Schema(description = "通道号")
|
||||
private Integer chanNum;
|
||||
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.camera.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "区域 Response DTO")
|
||||
@Data
|
||||
public class RegionCameraListDTO {
|
||||
@Schema(description = "区域唯一编码")
|
||||
private String regionIndexCode;
|
||||
@Schema(description = "区域名称")
|
||||
private String regionName;
|
||||
@Schema(description = "父区域唯一编码")
|
||||
private String parentIndexCode;
|
||||
@Schema(description = "是否为叶子节点")
|
||||
private Integer leaf;
|
||||
@Schema(description = "子区域")
|
||||
private List<RegionCameraListDTO> children = new ArrayList<>();
|
||||
@Schema(description = "摄像头列表")
|
||||
private List<CameraDTO> cameraList = new ArrayList<>();
|
||||
}
|
@ -26,12 +26,20 @@ public class CheckTicketApi {
|
||||
@Resource
|
||||
private LoginClient loginClient;
|
||||
|
||||
// @GetMapping()
|
||||
// @Operation(summary = "获得日期当天的检票人数")
|
||||
// public Long checkTicketTotal(String starTime, String endTime, String checkStationName) {
|
||||
// String replace = starTime.replace("-", "");
|
||||
// String replace1 = endTime.replace("-", "");
|
||||
// return checkTicketService.checkTicketTotal(replace,replace1, checkStationName);
|
||||
// }
|
||||
|
||||
@GetMapping()
|
||||
@Operation(summary = "获得日期当天的检票人数")
|
||||
public Long checkTicketTotal(String starTime, String endTime) {
|
||||
@Operation(summary = "获得日期当天某检查点的检票人数")
|
||||
public Long checkTicketTotal(String starTime, String endTime, String checkStationName) {
|
||||
String replace = starTime.replace("-", "");
|
||||
String replace1 = endTime.replace("-", "");
|
||||
return checkTicketService.checkTicketTotal(replace,replace1);
|
||||
return checkTicketService.checkTicketTotal(replace,replace1, checkStationName);
|
||||
}
|
||||
|
||||
@GetMapping("/qushi")
|
||||
|
@ -0,0 +1,90 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.region.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 区域 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("hiking_region")
|
||||
@KeySequence("hiking_region_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RegionDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 区域唯一标识码
|
||||
*/
|
||||
private String indexCode;
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 父级区域唯一标识码
|
||||
*/
|
||||
private String parentIndexCode;
|
||||
/**
|
||||
* 树编号
|
||||
*/
|
||||
private String treeCode;
|
||||
/**
|
||||
* 区域类型
|
||||
*/
|
||||
private Integer regionType;
|
||||
/**
|
||||
* 区域完整路径
|
||||
*/
|
||||
private String regionPath;
|
||||
/**
|
||||
* 是否为叶子节点
|
||||
*/
|
||||
private Integer leaf;
|
||||
/**
|
||||
* 级联平台标识
|
||||
*/
|
||||
private String cascadeCode;
|
||||
/**
|
||||
* 区域标识
|
||||
*/
|
||||
private Integer cascadeType;
|
||||
/**
|
||||
* 区域类型
|
||||
*/
|
||||
private Integer catalogType;
|
||||
/**
|
||||
* 权限码
|
||||
*/
|
||||
private String authCodes;
|
||||
/**
|
||||
* 外码
|
||||
*/
|
||||
private String externalIndexCode;
|
||||
/**
|
||||
* 父外码
|
||||
*/
|
||||
private String parentExternalIndexCode;
|
||||
/**
|
||||
* 同级区域顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 资源状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.region.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "区域 Response DTO")
|
||||
@Data
|
||||
public class RegionDTO {
|
||||
@Schema(description = "区域唯一编码")
|
||||
private String regionIndexCode;
|
||||
@Schema(description = "区域名称")
|
||||
private String regionName;
|
||||
@Schema(description = "父区域唯一编码")
|
||||
private String parentIndexCode;
|
||||
@Schema(description = "是否为叶子节点")
|
||||
private Integer leaf;
|
||||
@Schema(description = "子区域")
|
||||
private List<RegionDTO> children = new ArrayList<>();
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.region.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 区域分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RegionPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "区域唯一标识码")
|
||||
private String indexCode;
|
||||
|
||||
@Schema(description = "区域名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "区域类型")
|
||||
private Integer regionType;
|
||||
|
||||
@Schema(description = "区域类型")
|
||||
private Integer catalogType;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] updateTime;
|
||||
|
||||
@Schema(description = "资源状态")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.region.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 区域 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RegionRespVO {
|
||||
|
||||
@Schema(description = "区域唯一标识码")
|
||||
@ExcelProperty("区域唯一标识码")
|
||||
private String indexCode;
|
||||
|
||||
@Schema(description = "区域名称")
|
||||
@ExcelProperty("区域名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "区域类型")
|
||||
@ExcelProperty("区域类型")
|
||||
private Integer regionType;
|
||||
|
||||
@Schema(description = "区域完整路径")
|
||||
@ExcelProperty("区域完整路径")
|
||||
private String regionPath;
|
||||
|
||||
@Schema(description = "区域类型")
|
||||
@ExcelProperty("区域类型")
|
||||
private Integer catalogType;
|
||||
|
||||
@Schema(description = "权限码")
|
||||
@ExcelProperty("权限码")
|
||||
private String authCodes;
|
||||
|
||||
@Schema(description = "外码")
|
||||
@ExcelProperty("外码")
|
||||
private String externalIndexCode;
|
||||
|
||||
@Schema(description = "父外码")
|
||||
@ExcelProperty("父外码")
|
||||
private String parentExternalIndexCode;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "资源状态")
|
||||
@ExcelProperty("资源状态")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.region.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 区域新增/修改 Request VO")
|
||||
@Data
|
||||
public class RegionSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "区域唯一标识码")
|
||||
private String indexCode;
|
||||
|
||||
@Schema(description = "区域名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "父级区域唯一标识码")
|
||||
private String parentIndexCode;
|
||||
|
||||
@Schema(description = "树编号")
|
||||
private String treeCode;
|
||||
|
||||
@Schema(description = "区域类型")
|
||||
private Integer regionType;
|
||||
|
||||
@Schema(description = "区域完整路径")
|
||||
private String regionPath;
|
||||
|
||||
@Schema(description = "是否为叶子节点")
|
||||
private Integer leaf;
|
||||
|
||||
@Schema(description = "级联平台标识")
|
||||
private String cascadeCode;
|
||||
|
||||
@Schema(description = "区域标识")
|
||||
private Integer cascadeType;
|
||||
|
||||
@Schema(description = "区域类型")
|
||||
private Integer catalogType;
|
||||
|
||||
@Schema(description = "权限码")
|
||||
private String authCodes;
|
||||
|
||||
@Schema(description = "外码")
|
||||
private String externalIndexCode;
|
||||
|
||||
@Schema(description = "父外码")
|
||||
private String parentExternalIndexCode;
|
||||
|
||||
@Schema(description = "同级区域顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "资源状态")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -27,6 +27,7 @@ public class SaleDataApi {
|
||||
@GetMapping()
|
||||
@Operation(summary = "获得输入日期的当天总售票数")
|
||||
public Long checkTicketTotal(String starTime, String endTime) {
|
||||
System.out.println("checkTicketTotal");
|
||||
String replace = starTime.replace("-", "");
|
||||
String replace1 = endTime.replace("-", "");
|
||||
return saleDataService.countBySddate(replace, replace1);
|
||||
@ -135,6 +136,13 @@ public class SaleDataApi {
|
||||
return saleDataService.findyearJun(saleDataService.findEventsLastYear());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/thisyear/nianjunCount")
|
||||
@Operation(summary = "查询某年年度售票数量")
|
||||
public Integer findCountthisyear(Integer year) {
|
||||
System.out.println(saleDataService.findEventsByYear(year));
|
||||
return saleDataService.findEventsByYear(year).size();
|
||||
}
|
||||
// @GetMapping("/test")
|
||||
// public void testMethod(){
|
||||
//
|
||||
|
@ -14,8 +14,8 @@ public interface CheckTicketRepository extends MongoRepository<CheckTicket,Strin
|
||||
@Query("{'name': {'$regex': '?0', '$options': 'i'}}")
|
||||
Page<CheckTicket> findByName(String q, PageRequest pageable);
|
||||
|
||||
@Query("{'checkticketdate':{'$gte': ?0, '$lt': ?1}}")
|
||||
List<CheckTicket> countByCheckticketdateBetween(String starTime, String endTime);
|
||||
@Query("{'checkticketdate':{'$gte': ?0, '$lt': ?1}, 'checkstationname': {'$regex': ?2, '$options': 'i'}}")
|
||||
List<CheckTicket> countByCheckticketdateBetween(String starTime, String endTime, String checkStationName);
|
||||
|
||||
@Query("{'checktickettime':{'$gte': ?0, '$lt': ?1},'checkticketdate':{'$dt': ?2}}")
|
||||
List<CheckTicket> findByTimestampBetweenAndCheckticketdate(String startTime, String endTime,String day);
|
||||
|
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源 Mapper
|
||||
*
|
||||
@ -22,11 +24,18 @@ public interface CameraMapper extends BaseMapperX<CameraDO> {
|
||||
.likeIfPresent(CameraDO::getChannelTypeName, reqVO.getChannelTypeName())
|
||||
.likeIfPresent(CameraDO::getTransTypeName, reqVO.getTransTypeName())
|
||||
.likeIfPresent(CameraDO::getTreatyTypeName, reqVO.getTreatyTypeName())
|
||||
.likeIfPresent(CameraDO::getName, reqVO.getName())
|
||||
.likeIfPresent(CameraDO::getCameraName, reqVO.getCameraName())
|
||||
.eqIfPresent(CameraDO::getInstallLocation, reqVO.getInstallLocation())
|
||||
.betweenIfPresent(CameraDO::getCreateTime, reqVO.getCreateTime())
|
||||
.betweenIfPresent(CameraDO::getUpdateTime, reqVO.getUpdateTime())
|
||||
.orderByDesc(CameraDO::getId));
|
||||
}
|
||||
|
||||
default List<CameraDO> selectCameraByRegionIndexCode(String regionIndexCode) {
|
||||
return selectList(new LambdaQueryWrapperX<CameraDO>().eq(CameraDO::getRegionIndexCode, regionIndexCode));
|
||||
}
|
||||
|
||||
default String selectCameraIndexCodeByCameraName(String cameraName) {
|
||||
return selectOne(new LambdaQueryWrapperX<CameraDO>().eq(CameraDO::getCameraName, cameraName)).getCameraIndexCode();
|
||||
}
|
||||
}
|
@ -2,10 +2,12 @@ package cn.iocoder.yudao.module.datacenter.service.camera;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDTO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraSaveReqVO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资源 Service 接口
|
||||
@ -52,4 +54,13 @@ public interface CameraService {
|
||||
*/
|
||||
PageResult<CameraDO> getCameraPage(CameraPageReqVO pageReqVO);
|
||||
|
||||
String getPreviewUrl(String cameraIndexCode, Integer streamType, String protocol, Integer transmode, String expand, String streamform);
|
||||
String getPlayBackUrl(String cameraIndexCode, Integer recordLocation, String protocol, Integer transmode, String beginTime, String endTime, String uuid, String expand, String streamform, Integer lockType);
|
||||
|
||||
String selZoom(String cameraIndexCode,int startX,int startY,int endX,int endY);
|
||||
String controlling(String cameraIndexCode, Integer action, String command, Integer speed, Integer presetIndex);
|
||||
|
||||
List<CameraDTO> selectCameraByRegionIndexCode(String regionIndexCode);
|
||||
|
||||
String selectCameraIndexCodeByCameraName(String cameraName);
|
||||
}
|
@ -1,17 +1,28 @@
|
||||
package cn.iocoder.yudao.module.datacenter.service.camera;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraDTO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraPageReqVO;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.camera.vo.CameraSaveReqVO;
|
||||
import cn.iocoder.yudao.module.datacenter.dal.mysql.camera.CameraMapper;
|
||||
import cn.iocoder.yudao.module.datacenter.utlis.IntegrationURL;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
@ -26,6 +37,57 @@ public class CameraServiceImpl implements CameraService {
|
||||
|
||||
@Resource
|
||||
private CameraMapper cameraMapper;
|
||||
private ObjectMapper objectMapper;
|
||||
@Resource
|
||||
private RedisTemplate redisTemplate;
|
||||
private static final String ACCESS_TOKEN_KEY = "hikingAPI:access_token";
|
||||
|
||||
|
||||
public String getAccessToken() {
|
||||
// 检查 Redis 中是否有 access_token
|
||||
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||
if (!StringUtils.isEmpty(accessToken)) {
|
||||
System.out.println("使用缓存的token:" + accessToken);
|
||||
return accessToken; // 如果存在则直接返回
|
||||
}
|
||||
|
||||
// 如果没有,调用 API 获取并存入 Redis
|
||||
System.out.println("获取新的token");
|
||||
String accessTokenUrlResp = IntegrationURL.getAccessTokenURL();
|
||||
try {
|
||||
|
||||
JsonNode jsonNode = objectMapper.readTree(accessTokenUrlResp);
|
||||
accessToken = jsonNode.get("access_token").asText();
|
||||
|
||||
// 将 access_token 存入 Redis,设置过期时间为 11 小时(有效期12小时)
|
||||
redisTemplate.opsForValue().set(ACCESS_TOKEN_KEY, accessToken, 11, TimeUnit.HOURS);
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void deleteAccessToken() {
|
||||
redisTemplate.delete(ACCESS_TOKEN_KEY);
|
||||
}
|
||||
|
||||
|
||||
public Boolean checkToken(String result) {
|
||||
try {
|
||||
|
||||
JsonNode jsonNode = objectMapper.readTree(result);
|
||||
String code = jsonNode.path("code").asText();
|
||||
if ("0x02401007".equals(code)) {
|
||||
System.out.println("token失效,重新获取");
|
||||
deleteAccessToken();
|
||||
return false;
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createCamera(CameraSaveReqVO createReqVO) {
|
||||
@ -69,4 +131,34 @@ public class CameraServiceImpl implements CameraService {
|
||||
return cameraMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreviewUrl(String cameraIndexCode, Integer streamType, String protocol, Integer transmode, String expand, String streamform) {
|
||||
return IntegrationURL.getPreviewURL(cameraIndexCode, streamType, protocol, transmode, expand, streamform, getAccessToken());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayBackUrl(String cameraIndexCode, Integer recordLocation, String protocol, Integer transmode, String beginTime, String endTime, String uuid, String expand, String streamform, Integer lockType) {
|
||||
return IntegrationURL.getPlaybackURL(cameraIndexCode,recordLocation, protocol, transmode, beginTime, endTime, uuid, expand, streamform,lockType, getAccessToken());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selZoom(String cameraIndexCode,int startX,int startY,int endX,int endY) {
|
||||
return IntegrationURL.getControlURL(cameraIndexCode, startX, startY, endX, endY, getAccessToken());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String controlling(String cameraIndexCode, Integer action, String command, Integer speed, Integer presetIndex) {
|
||||
return IntegrationURL.getYunTaiOperationURL(cameraIndexCode, action, command, speed, presetIndex, getAccessToken());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CameraDTO> selectCameraByRegionIndexCode(String regionIndexCode) {
|
||||
List<CameraDO> cameraDOS = cameraMapper.selectCameraByRegionIndexCode(regionIndexCode);
|
||||
return BeanUtil.copyToList(cameraDOS, CameraDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectCameraIndexCodeByCameraName(String cameraName) {
|
||||
return cameraMapper.selectCameraIndexCodeByCameraName(cameraName);
|
||||
}
|
||||
}
|
@ -24,5 +24,5 @@ public interface CheckTicketService {
|
||||
* @param starTime 日期
|
||||
* @return long 检票人数
|
||||
*/
|
||||
public long checkTicketTotal(String starTime, String endTime);
|
||||
public long checkTicketTotal(String starTime, String endTime, String checkStationName);
|
||||
}
|
@ -92,7 +92,7 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long checkTicketTotal(String starTime, String endTime) {
|
||||
public long checkTicketTotal(String starTime, String endTime, String checkStationName) {
|
||||
// 创建 DateTimeFormatter 实例以解析指定日期的格式
|
||||
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
// 解析指定日期字符串为 LocalDate 对象
|
||||
@ -102,7 +102,7 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
||||
// 格式化指定日期和下一天
|
||||
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
String formattedNextDay = nextDay.format(outputFormatter);
|
||||
return checkTicketRepository.countByCheckticketdateBetween(starTime,formattedNextDay).size();
|
||||
return checkTicketRepository.countByCheckticketdateBetween(starTime,formattedNextDay, checkStationName).size();
|
||||
}
|
||||
|
||||
public String publicMethod(String endTime){
|
||||
|
@ -44,6 +44,7 @@ public interface SaleDataService {
|
||||
* @return
|
||||
*/
|
||||
public List<SaleData> findEventsLastYear();
|
||||
public List<SaleData> findEventsByYear(int year);
|
||||
public List<SaleData> findEventsLastYear(String starTime, String endTime);
|
||||
/**
|
||||
* 查询今年1月1日到12月31日的全部数据
|
||||
|
@ -97,6 +97,7 @@ public class SaleDataServiceImpl implements SaleDataService {
|
||||
@Override
|
||||
public List<Map<String, String>> findByAge(String starTime, String endTime) {
|
||||
AgeVo byAge = saleDataRepository.findByAge(starTime,this.publicMethod(endTime));
|
||||
System.out.println("byAge = " + byAge);
|
||||
List<Map<String,String>>map=new ArrayList<>();
|
||||
Map<String,String>map1=new LinkedHashMap<>();
|
||||
Map<String,String>map2=new LinkedHashMap<>();
|
||||
@ -136,6 +137,24 @@ public class SaleDataServiceImpl implements SaleDataService {
|
||||
String end = date.format(endOfYear);
|
||||
return saleDataRepository.findBySddateBetween(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SaleData> findEventsByYear(int year) {
|
||||
// 定义日期格式:数据库使用yyyyMMdd,传入的日期使用yyyy-MM-dd
|
||||
DateTimeFormatter outputDateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
|
||||
// 获取指定年份的开始日期和结束日期
|
||||
LocalDate startOfYear = LocalDate.of(year, 1, 1);
|
||||
LocalDate endOfYear = LocalDate.of(year, 12, 31);
|
||||
|
||||
// 转换为yyyyMMdd格式的字符串
|
||||
String start = outputDateFormatter.format(startOfYear);
|
||||
String end = outputDateFormatter.format(endOfYear);
|
||||
|
||||
// 调用仓库方法查询指定年份范围内的数据
|
||||
return saleDataRepository.findBySddateBetween(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SaleData> findEventsLastYear(String starTime, String endTime) {
|
||||
// DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
@ -156,6 +175,8 @@ public class SaleDataServiceImpl implements SaleDataService {
|
||||
String end = date.format(endOfYear);
|
||||
return saleDataRepository.findBySddateBetween(start,end);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SaleData> findEventsThisYear(String starTime, String endTime) {
|
||||
// DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
@ -403,7 +424,7 @@ public class SaleDataServiceImpl implements SaleDataService {
|
||||
assert date1 != null;
|
||||
calendar.setTime(date1);
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -29);
|
||||
Map<String,String>map = new LinkedHashMap<>();
|
||||
Map<String,String> map = new LinkedHashMap<>();
|
||||
int count = 0;
|
||||
while (!calendar.getTime().after(date1)){
|
||||
String date = inputFormat.format(calendar.getTime());
|
||||
|
Loading…
Reference in New Issue
Block a user