Browse Source

[feat]

1、修改预警统计接口,增加预警对比统计接口
2、开发视频流开始录制、停止录制、是否录制、获取截图相关接口,并且测试。
pull/1/head
杨威 3 months ago
parent
commit
7fcc84aa41
  1. 2
      dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java
  2. 10
      dk-api/api-workflow/src/main/java/org/dromara/workflow/api/event/ProcessCreateTaskEvent.java
  3. 10
      dk-api/api-workflow/src/main/java/org/dromara/workflow/api/event/ProcessEvent.java
  4. 88
      dk-modules/business/src/main/java/org/dromara/business/config/ZlmConfig.java
  5. 16
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java
  6. 8
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessDepartBoundaryController.java
  7. 90
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessVideoController.java
  8. 12
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java
  9. 4
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessDepartBoundary.java
  10. 10
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java
  11. 12
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java
  12. 4
      dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java
  13. 26
      dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java
  14. 4
      dk-modules/business/src/main/java/org/dromara/business/service/BusinessAlertStatisticsService.java
  15. 16
      dk-modules/business/src/main/java/org/dromara/business/service/BusinessVideoService.java
  16. 2
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java
  17. 2
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessDepartBoundaryService.java
  18. 11
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java
  19. 21
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java
  20. 8
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessDepartBoundaryServiceImpl.java
  21. 188
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessVideoServiceImpl.java
  22. 161
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml
  23. 5
      dk-modules/sample/src/main/java/org/dromara/sample/wayline/model/entity/WaylineFileEntity.java
  24. 4
      dk-modules/workflow/src/main/java/org/dromara/workflow/handler/FlwAlertHandler.java

2
dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java

@ -15,5 +15,5 @@ public interface RemoteBusinessAlertService {
* @param businessId 业务id(预警工单)
* @param flowStatus 流程状态
*/
void updateAlertStatus(String businessId, String flowStatus);
void updateAlertStatus(String businessId, String flowStatus,Boolean isIllegal,String alertType);
}

10
dk-api/api-workflow/src/main/java/org/dromara/workflow/api/event/ProcessCreateTaskEvent.java

@ -44,6 +44,16 @@ public class ProcessCreateTaskEvent extends RemoteApplicationEvent {
*/
private String businessId;
/**
* 处置预警类型
*/
private String alertType;
/**
* 是否违建
*/
private Boolean isIllegal;
public ProcessCreateTaskEvent() {
super(new Object(), SpringUtils.getApplicationName(), DEFAULT_DESTINATION_FACTORY.getDestination(null));
}

10
dk-api/api-workflow/src/main/java/org/dromara/workflow/api/event/ProcessEvent.java

@ -45,6 +45,16 @@ public class ProcessEvent extends RemoteApplicationEvent {
*/
private Map<String, Object> params;
/**
* 预警类型
*/
private String alertType;
/**
* 是否违建
*/
private Boolean isIllegal;
/**
* 当为true时为申请人节点办理
*/

88
dk-modules/business/src/main/java/org/dromara/business/config/ZlmConfig.java

@ -0,0 +1,88 @@
package org.dromara.business.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* 视频流配置类
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "zlm")
public class ZlmConfig {
/**
* 请求url
*/
private String apiUrl;
/**
*应用名
*/
private String app;
/**
* id
*/
private String stream;
/**
* 0 hls1 mp4
*/
private String type;
/**
* api 操作密钥
*/
private String secret;
/**
* 虚拟主机
*/
private String vhost;
/**
* mp4 录像切片时间大小,单位秒 0 则采用配置项
*/
private Integer maxSecond;
/**
* 截图需要的url
*/
private String rtmp;
/**
* 开始录制url
*/
private String startRecordUrl;
/**
* 停止录制url
*/
private String stopRecordUrl;
/**
* 录制状态url
*/
private String isRecordUrl;
/**
* 设置录像速度url
*/
private String recordSpeedUrl;
/**
* 获取截图url
*/
private String snapUrl;
/**
* 设置录像流播放位置
*/
private String seekRecordStampUrl;
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}

16
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java

@ -32,8 +32,6 @@ public class BusinessAlertStatisticsController extends BaseController {
return R.ok(statisticsService.countPanelAlert(businessAlertBo));
}
//饼图显示每个月根据部门
@Operation(summary="根据月份显示预警个数", description="根据月份显示预警个数")
@GetMapping(value = "/month/count")
@ -65,9 +63,15 @@ public class BusinessAlertStatisticsController extends BaseController {
//预警对比统计
//1、处理状态柱状图,x轴为选中的部门
//2、预警类型柱状图,x轴为选中的部门
@Operation(summary="预警对比统计", description="预警对比统计")
@GetMapping(value = "/compare/count")
public R<List<Map<String, Object>>> countAlertCompare(BusinessAlertBo businessAlertBo) {
return R.ok(statisticsService.countAlertCompare(businessAlertBo));
@Operation(summary="预警对比统计(预警状态)", description="预警对比统计(预警状态)")
@GetMapping(value = "/compare/status/count")
public R<List<Map<String, Object>>> countAlertStatusCompare(BusinessAlertBo businessAlertBo) {
return R.ok(statisticsService.countAlertStatusCompare(businessAlertBo));
}
@Operation(summary="预警对比统计(预警类型)", description="预警对比统计(预警类型)")
@GetMapping(value = "/compare/type/count")
public R<List<Map<String, Object>>> countAlertTypeCompare(BusinessAlertBo businessAlertBo) {
return R.ok(statisticsService.countAlertTypeCompare(businessAlertBo));
}
}

8
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessDepartBoundaryController.java

@ -57,8 +57,8 @@ public class BusinessDepartBoundaryController extends BaseController {
*/
@Operation(summary ="批量新增部门区域",description = "批量新增部门区域")
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public R<Void> uploadShpFile(@RequestParam("file") MultipartFile file) {
return toAjax(departBoundaryService.uploadShpFile(file));
public R<Void> uploadShpFile(@RequestParam("file") MultipartFile file,@RequestParam("areaType") Integer areaType) {
return toAjax(departBoundaryService.uploadShpFile(file,areaType));
}
/**
@ -85,4 +85,8 @@ public class BusinessDepartBoundaryController extends BaseController {
public R<Void> deleteDepartBoundary(@RequestParam(name = "id") String id) {
return toAjax(departBoundaryService.deleteDepartBoundary(id));
}
}

90
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessVideoController.java

@ -0,0 +1,90 @@
package org.dromara.business.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.dromara.business.service.BusinessVideoService;
import org.dromara.common.core.domain.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* rtmp默认端口1935, rtsp默认端口554
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/video")
@Tag(name = "ZLMediaKit视频流相关操作")
public class BusinessVideoController {
private final BusinessVideoService businessVideoService;
/**
* 开始录制
*/
@Operation(summary ="开始录制",description = "开始录制")
@GetMapping("/startRecord")
public R<?> startRecording() {
return businessVideoService.startRecording()?R.ok("启动成功!"):R.fail("启动失败!");
}
/**
* 停止录制
*/
@Operation(summary ="停止录制",description = "停止录制")
@GetMapping("/stopRecord")
public R<?> stopRecording() {
return businessVideoService.stopRecording()?R.ok("停止成功!"):R.fail("停止失败!");
}
/**
* 获取录制状态
*/
@Operation(summary ="获取录制状态",description = "获取录制状态")
@GetMapping("/isRecording")
public R<?> isRecording() {
return R.ok("获取录制状态!",businessVideoService.isRecording());
}
/**
* 获取截图
*/
@Operation(summary ="获取截图",description = "获取截图",parameters = {
@Parameter(name = "timeoutSec",description = "截图失败超时时间"),
@Parameter(name = "expireSec",description = "截图的过期时间,该时间内产生的截图都会作为缓存返回")
})
@GetMapping("/getSnap")
public R<?> getSnap(@RequestParam("timeoutSec") Integer timeoutSec,@RequestParam("expireSec") Integer expireSec) {
return R.ok("截图成功!",businessVideoService.getSnap(timeoutSec,expireSec));
}
/**
* 设置录像流播放位置(官方提供的接口有问题)暂时不用
*/
@Operation(summary ="设置录像流播放位置",description = "设置录像流播放位置",parameters = {
@Parameter(name = "stamp",description = "要设置的录像播放位置")
})
@GetMapping("/seekRecordStamp")
public R<?> seekRecordStamp(@RequestParam("stamp") Integer stamp) {
return businessVideoService.seekRecordStamp(stamp)?R.ok("设置成功!"):R.fail("设置失败!");
}
/**
* 设置录像速度(官方提供的接口有问题)暂时不用
*/
@Operation(summary ="设置录像速度",description = "设置录像速度",parameters = {
@Parameter(name = "speed",description = "要设置的录像倍速")
})
@GetMapping("/setRecordSpeed")
public R<?> setRecordSpeed(@RequestParam("speed") Double speed) {
return businessVideoService.setRecordSpeed(speed)?R.ok("获取成功!"):R.fail("获取失败!");
}
}

12
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java

@ -64,10 +64,10 @@ public class BusinessAlert extends BaseEntity {
private String images;
/**
* 预警类型
* 识别类型
*/
@TableField(value = "alert_type",typeHandler = JacksonTypeHandler.class)
private List<String> alertType;
@TableField(value = "identify_type",typeHandler = JacksonTypeHandler.class)
private List<String> identifyType;
/**
* 纬度
@ -80,9 +80,9 @@ public class BusinessAlert extends BaseEntity {
private Long lng;
/**
* 任务类型
* 预警类型
*/
private String taskHandleType;
private String alertType;
/**
@ -140,7 +140,7 @@ public class BusinessAlert extends BaseEntity {
/**
* 是否违建 01
*/
private Long isIllegal;
private Boolean isIllegal;
/**
* 部门id

4
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessDepartBoundary.java

@ -65,9 +65,9 @@ public class BusinessDepartBoundary extends BaseEntity {
private String shpNo;
/**
* 0不为村级别1为村级
* 区域类
*/
private Integer villageType;
private Integer areaType;
/**删除状态(0,正常,1已删除)*/
private String delFlag;

10
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java

@ -47,9 +47,9 @@ public class BusinessAlertBo {
private String images;
/**
* 预警类型
* 识别类型
*/
private List<String> alertType;
private List<String> identifyType;
/**
* 纬度
@ -62,9 +62,9 @@ public class BusinessAlertBo {
private Long lng;
/**
* 任务类型
* 预警类型
*/
private String taskHandleType;
private String alertType;
/**
* 流程处置状态(verify:验证,cancel:已撤销,draft:草稿,waiting:待审核,finish:已完成,invalid:已作废,back:已退回,termination:已终止)
@ -117,7 +117,7 @@ public class BusinessAlertBo {
/**
* 是否违建 01
*/
private Long isIllegal;
private Boolean isIllegal;
/**
* 部门id

12
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java

@ -59,9 +59,9 @@ public class BusinessAlertVo implements Serializable {
/**
* 预警类型
* 识别类型
*/
private List<String> alertType;
private List<String> identifyType;
/**
* 纬度
@ -76,10 +76,10 @@ public class BusinessAlertVo implements Serializable {
private Long lng;
/**
* 任务类型
* 预警类型
*/
@ExcelProperty(value = "任务类型")
private String taskHandleType;
@ExcelProperty(value = "预警类型")
private String alertType;
/**
@ -139,7 +139,7 @@ public class BusinessAlertVo implements Serializable {
* 是否违建 01
*/
@ExcelProperty(value = "是否违建 0:否,1:是")
private Long isIllegal;
private Boolean isIllegal;
/**
* 部门id

4
dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java

@ -23,7 +23,7 @@ public class RemoteBusinessAlertServiceImpl implements RemoteBusinessAlertServic
* @param flowStatus 流程状态
*/
@Override
public void updateAlertStatus(String businessId, String flowStatus) {
businessAlertService.updateAlertStatus(businessId,flowStatus);
public void updateAlertStatus(String businessId, String flowStatus,Boolean isIllegal,String alertType) {
businessAlertService.updateAlertStatus(businessId,flowStatus,isIllegal,alertType);
}
}

26
dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java

@ -23,22 +23,32 @@ import java.util.Map;
*/
public interface BusinessAlertMapper extends BaseMapperPlus<BusinessAlert, BusinessAlertVo> {
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
Page<BusinessAlert> pageBusinessAlert(Page<BusinessAlert> page, QueryWrapper<BusinessAlert> ew);
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
Page<BusinessAlert> pageAlertFinish(Page<BusinessAlert> page, QueryWrapper<BusinessAlert> ew);
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
Page<BusinessAlert> pageAlertTodo(Page<BusinessAlert> page, QueryWrapper<BusinessAlert> ew);
Page<BusinessAlert> pageBusinessAlertCancel(Page<BusinessAlert> build, QueryWrapper<BusinessAlert> ew);
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
List<Map<String, Object>> listMonthAlert(@Param("param") BusinessAlertBo businessAlertBo);
Page<BusinessAlert> pageBusinessAlertCancel(Page<BusinessAlert> build, QueryWrapper<BusinessAlert> ew);
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
List<Map<String, Object>> listMonthAlert(@Param("param") BusinessAlertBo businessAlertBo);
List<Map<String, Object>> listDepartAlert(@Param("param") BusinessAlertBo businessAlertBo);
@DataPermission(
@ -46,9 +56,7 @@ public interface BusinessAlertMapper extends BaseMapperPlus<BusinessAlert, Busin
)
List<Map<String, Object>> listMonthAlertStatus(@Param("param")BusinessAlertBo businessAlertBo);
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
List<Map<String, Object>> listDepartAlertStatus(@Param("param") BusinessAlertBo businessAlertBo);
@DataPermission(
@ -59,6 +67,10 @@ public interface BusinessAlertMapper extends BaseMapperPlus<BusinessAlert, Busin
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
List<Map<String, Object>> countPanelAlert(BusinessAlertBo businessAlertBo);
List<Map<String, Object>> countPanelAlert(@Param("param")BusinessAlertBo businessAlertBo);
@DataPermission(
@DataColumn(key = "deptName", value = "ba.dept_id")
)
List<Map<String, Object>> countAlertTypeCompare(@Param("param") BusinessAlertBo businessAlertBo);
}

4
dk-modules/business/src/main/java/org/dromara/business/service/BusinessAlertStatisticsService.java

@ -16,7 +16,9 @@ public interface BusinessAlertStatisticsService {
List<StatObj> countDepartAlertStatus(BusinessAlertBo businessAlertBo);
List<Map<String, Object>> countAlertCompare(BusinessAlertBo businessAlertBo);
List<Map<String, Object>> countAlertStatusCompare(BusinessAlertBo businessAlertBo);
List<StatObj> countPanelAlert(BusinessAlertBo businessAlertBo);
List<Map<String, Object>> countAlertTypeCompare(BusinessAlertBo businessAlertBo);
}

16
dk-modules/business/src/main/java/org/dromara/business/service/BusinessVideoService.java

@ -0,0 +1,16 @@
package org.dromara.business.service;
public interface BusinessVideoService {
Boolean startRecording();
Boolean stopRecording();
String isRecording();
Boolean setRecordSpeed(Double speed);
String getSnap(Integer timeoutSec, Integer expireSec);
Boolean seekRecordStamp(Integer stamp);
}

2
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java

@ -62,7 +62,7 @@ public interface IBusinessAlertService {
* @param businessId
* @param flowStatus
*/
void updateAlertStatus(String businessId, String flowStatus);
void updateAlertStatus(String businessId, String flowStatus,Boolean isIllegal,String alertType);
TableDataInfo<BusinessAlert> getInfo(BusinessAlertBo bo, PageQuery pageQuery, String alertCode);
}

2
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessDepartBoundaryService.java

@ -18,7 +18,7 @@ public interface IBusinessDepartBoundaryService extends IService<BusinessDepartB
List<BusinessDepartBoundary> queryByDeptId(String deptId);
boolean uploadShpFile(MultipartFile file);
boolean uploadShpFile(MultipartFile file,Integer areaType);
boolean deleteDepartBoundary(String id);

11
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java

@ -102,10 +102,15 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
* @param flowStatus
*/
@Override
public void updateAlertStatus(String businessId, String flowStatus) {
public void updateAlertStatus(String businessId, String flowStatus,Boolean isIllegal,String alertType) {
LambdaUpdateWrapper<BusinessAlert> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(BusinessAlert::getHandleType, BusinessStatusEnum.getByStatus(flowStatus));
wrapper.set(BusinessAlert::getHandleType, BusinessStatusEnum.getByStatus(flowStatus).getStatus());
if (ObjectUtil.isNotEmpty(isIllegal)){
wrapper.set(BusinessAlert::getIsIllegal, isIllegal);
}
if (ObjectUtil.isNotEmpty(alertType)){
wrapper.set(BusinessAlert::getAlertType, alertType);
}
wrapper.eq(BusinessAlert::getId, businessId);
this.baseMapper.update(wrapper);

21
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java

@ -55,13 +55,7 @@ public class BusinessAlertStatisticsServiceImpl implements BusinessAlertStatisti
@Override
public List<StatObj>countDepartAlert(BusinessAlertBo businessAlertBo) {
if (ObjectUtil.isNotEmpty(LoginHelper.getDeptId())){
List<RemoteDeptVo> remoteDeptVoList = remoteDeptService.selectListByParentId(LoginHelper.getDeptId() + "");
businessAlertBo.setDeptIdList(remoteDeptVoList.stream().map(RemoteDeptVo::getDeptId).toList());
}else {
//TODO
}
businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId()));
List<Map<String, Object>> mapList = baseMapper.listDepartAlert(businessAlertBo);
return mapList.stream().map(data -> new StatObj(data.get("deptName") + "", Long.parseLong(data.get("total") + ""),"deptId",data.get("deptId"))).collect(Collectors.toList());
@ -109,12 +103,9 @@ public class BusinessAlertStatisticsServiceImpl implements BusinessAlertStatisti
* @return
*/
@Override
public List<Map<String, Object>> countAlertCompare(BusinessAlertBo businessAlertBo) {
public List<Map<String, Object>> countAlertStatusCompare(BusinessAlertBo businessAlertBo) {
businessAlertBo.setDateList(buildDateList(businessAlertBo));
List<Map<String, Object>> mapList = baseMapper.countAlertCompare(businessAlertBo);
return mapList;
return baseMapper.countAlertCompare(businessAlertBo);
}
@Override
@ -131,6 +122,12 @@ public class BusinessAlertStatisticsServiceImpl implements BusinessAlertStatisti
.collect(Collectors.toList());
}
@Override
public List<Map<String, Object>> countAlertTypeCompare(BusinessAlertBo businessAlertBo) {
businessAlertBo.setDateList(buildDateList(businessAlertBo));
return baseMapper.countAlertTypeCompare(businessAlertBo);
}
private List<String> buildDateList(BusinessAlertBo businessAlertBo) {
List<String> resultList = new ArrayList<>();
String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));

8
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessDepartBoundaryServiceImpl.java

@ -77,12 +77,12 @@ public class BusinessDepartBoundaryServiceImpl extends ServiceImpl<BusinessDepar
@Override
@Transactional(rollbackFor = Exception.class)
public boolean uploadShpFile(MultipartFile file) {
public boolean uploadShpFile(MultipartFile file,Integer areaType) {
try {
List<BusinessGeospatialVectors> geospatialVectorsList = buildGeospatialVector(file);
//6、生成新的对象集合存储数据表中
List<BusinessDepartBoundary> boundaryList = buildBusinessDepartBoundary(geospatialVectorsList);
List<BusinessDepartBoundary> boundaryList = buildBusinessDepartBoundary(geospatialVectorsList,areaType);
// 分批处理
int startIndex = 0; // 从第 0 条开始
@ -212,7 +212,7 @@ public class BusinessDepartBoundaryServiceImpl extends ServiceImpl<BusinessDepar
* @param geospatialVectorsList
* @return
*/
private List<BusinessDepartBoundary> buildBusinessDepartBoundary(List<BusinessGeospatialVectors> geospatialVectorsList) {
private List<BusinessDepartBoundary> buildBusinessDepartBoundary(List<BusinessGeospatialVectors> geospatialVectorsList,Integer areaType) {
List<BusinessDepartBoundary> resultList = new ArrayList<>();
List<Map<String,Object>> namePathList = remoteDeptService.getNamePathList();
@ -232,7 +232,7 @@ public class BusinessDepartBoundaryServiceImpl extends ServiceImpl<BusinessDepar
businessDepartBoundary.setDeptName(objectMap.get("deptName") + "");
businessDepartBoundary.setDeptId(objectMap.get("deptId") + "");
businessDepartBoundary.setCommunityName(objectMap.get("namePath") + "");
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
}
});

188
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessVideoServiceImpl.java

@ -0,0 +1,188 @@
package org.dromara.business.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.business.config.ZlmConfig;
import org.dromara.business.service.BusinessVideoService;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
@Service
@Slf4j
@RequiredArgsConstructor
public class BusinessVideoServiceImpl implements BusinessVideoService {
private final ZlmConfig zlmConfig;
private static final ObjectMapper objectMapper = new ObjectMapper();
private final RestTemplate restTemplate;
@Override
public Boolean startRecording() {
String url = String.format("%s%s?app=%s&stream=%s&type=%s&vhost=%s&secret=%s",
zlmConfig.getApiUrl(),
zlmConfig.getStartRecordUrl(),
zlmConfig.getApp(),
zlmConfig.getStream(),
zlmConfig.getType(),
zlmConfig.getVhost(),
zlmConfig.getSecret());
//是否需要切片视频
if (ObjectUtil.isNotEmpty(zlmConfig.getMaxSecond())){
url = url + "&max_second=" + zlmConfig.getMaxSecond();
}
try {
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
if (response.getStatusCode().is2xxSuccessful()) {
Map<String, Object> result = objectMapper.readValue(response.getBody(), Map.class);
log.info("录制启动成功: {}", result);
}
} catch (Exception e) {
log.error("请求异常: {}", e.getMessage(), e);
return false;
}
return true;
}
@Override
public Boolean stopRecording() {
String url = String.format("%s%s?app=%s&stream=%s&type=%s&vhost=%s&secret=%s",
zlmConfig.getApiUrl(),
zlmConfig.getStopRecordUrl(),
zlmConfig.getApp(),
zlmConfig.getStream(),
zlmConfig.getType(),
zlmConfig.getVhost(),
zlmConfig.getSecret());
try {
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
if (response.getStatusCode().is2xxSuccessful()) {
Map<String, Object> result = objectMapper.readValue(response.getBody(), Map.class);
log.info("录制停止成功: {}", result);
}
} catch (Exception e) {
log.error("请求异常: {}", e.getMessage(), e);
return false;
}
return true;
}
@Override
public String isRecording() {
String result = null;
String url = String.format("%s%s?app=%s&stream=%s&type=%s&vhost=%s&secret=%s",
zlmConfig.getApiUrl(),
zlmConfig.getIsRecordUrl(),
zlmConfig.getApp(),
zlmConfig.getStream(),
zlmConfig.getType(),
zlmConfig.getVhost(),
zlmConfig.getSecret());
try {
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
if (response.getStatusCode().is2xxSuccessful()) {
Map<String, Object> resultMap = objectMapper.readValue(response.getBody(), Map.class);
result = resultMap.get("status") + "";
log.info("获取录制状态成功: {}", resultMap);
}
return result;
} catch (Exception e) {
log.error("请求异常: {}", e.getMessage(), e);
}
return result;
}
@Override
public Boolean setRecordSpeed(Double speed) {
String url = String.format("%s%s?app=%s&stream=%s&type=%s&vhost=%s&secret=%s&speed=%s",
zlmConfig.getApiUrl(),
zlmConfig.getRecordSpeedUrl(),
zlmConfig.getApp(),
zlmConfig.getStream(),
zlmConfig.getType(),
zlmConfig.getVhost(),
zlmConfig.getSecret(),
speed);
try {
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
if (response.getStatusCode().is2xxSuccessful()) {
Map<String, Object> result = objectMapper.readValue(response.getBody(), Map.class);
log.info("设置录制速度成功: {}", result);
}
} catch (Exception e) {
log.error("请求异常: {}", e.getMessage(), e);
return false;
}
return true;
}
@Override
public String getSnap(Integer timeoutSec, Integer expireSec) {
String url = String.format("rtmp://%s/%s/%s",zlmConfig.getRtmp(),zlmConfig.getApp(),zlmConfig.getStream());
String apiUrl = String.format("%s%s?secret=%s&url=%s&timeout_sec=%s&expire_sec=%s",
zlmConfig.getApiUrl(),
zlmConfig.getSnapUrl(),
zlmConfig.getSecret(),
url,
timeoutSec,
expireSec);
try {
ResponseEntity<String> response = restTemplate.getForEntity(apiUrl, String.class);
if (response.getStatusCode().is2xxSuccessful()) {
log.info("获取截图成功: {}", response.getBody());
}
return response.getBody();
} catch (Exception e) {
log.error("请求异常: {}", e.getMessage(), e);
}
return "";
}
@Override
public Boolean seekRecordStamp(Integer stamp) {
String url = String.format("%s%s?app=%s&stream=%s&vhost=%s&secret=%s&stamp=%s",
zlmConfig.getApiUrl(),
zlmConfig.getSeekRecordStampUrl(),
zlmConfig.getApp(),
zlmConfig.getStream(),
zlmConfig.getVhost(),
zlmConfig.getSecret(),
stamp);
try {
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
if (response.getStatusCode().is2xxSuccessful()) {
Map<String, Object> result = objectMapper.readValue(response.getBody(), Map.class);
log.info("设置录像流播放位置成功: {}", result);
}
} catch (Exception e) {
log.error("请求异常: {}", e.getMessage(), e);
return false;
}
return true;
}
}

161
dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml

@ -118,11 +118,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="listDepartAlert" resultType="java.util.Map">
select ba.dept_name deptName, ba.dept_id deptId,count(1) total
from business_alert ba
where 1=1
WITH RECURSIVE districts AS (
SELECT dept_id, dept_name,tenant_id FROM dk_cloud.sys_dept <where>
<if test="param.deptId != null and param.deptId != ''">
parent_id = #{param.deptId}
</if>
<if test="param.deptId == null or param.deptId == ''">
parent_id in (select dsd.dept_id from dk_cloud.sys_dept dsd where dsd.parent_id = '0')
</if>
</where>
),
sub_depts AS ( SELECT
sda.dept_id,
sda.parent_id,
sda.tenant_id
FROM
dk_cloud.sys_dept sda
WHERE
sda.parent_id IN (SELECT dd.dept_id FROM districts dd)
UNION ALL
SELECT
d.dept_id,
d.parent_id,
d.tenant_id
FROM
dk_cloud.sys_dept d
INNER JOIN sub_depts st ON d.parent_id = st.dept_id
),
warning_summary AS (
SELECT
d.parent_id AS district_id,
COUNT( ba.id ) AS total_warnings
FROM
business_alert ba
INNER JOIN sub_depts d ON ba.dept_id = d.dept_id
<include refid="searchSql"></include>
GROUP BY ba.dept_name,ba.dept_id
GROUP BY
d.parent_id
)
SELECT
d.dept_id deptId,
d.dept_name deptName,
COALESCE ( w.total_warnings, 0 ) AS total
FROM
districts d
LEFT JOIN warning_summary w ON d.dept_id = w.district_id
</select>
<select id="listMonthAlertStatus" resultType="java.util.Map">
@ -148,19 +188,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="listDepartAlertStatus" resultType="java.util.Map">
WITH RECURSIVE districts AS (
SELECT dept_id, dept_name,tenant_id FROM dk_cloud.sys_dept <where>
<if test="param.deptId != null and param.deptId != ''">
parent_id = #{param.deptId}
</if>
<if test="param.deptId == null or param.deptId == ''">
parent_id in (select dsd.dept_id from dk_cloud.sys_dept dsd where dsd.parent_id = '0')
</if>
</where>
),
sub_depts AS (
SELECT
ba.dept_name deptName,
ba.dept_id deptId,
count( 1 ) total,
IFNULL(SUM( handle_type = 'waiting' ),0) AS todoCount,
IFNULL(SUM( handle_type = 'finish' ),0) AS finishCount,
IFNULL(SUM( ba.handle_type = 'cancel' ),0) AS cancelCount
sda.dept_id,
sda.parent_id,
sda.tenant_id
FROM
dk_cloud.sys_dept sda
WHERE
sda.parent_id IN (SELECT dd.dept_id FROM districts dd)
UNION ALL
SELECT
d.dept_id,
d.parent_id,
d.tenant_id
FROM
dk_cloud.sys_dept d
INNER JOIN sub_depts st ON d.parent_id = st.dept_id
),
warning_summary AS (
SELECT
d.parent_id AS district_id,
COUNT(ba.id) AS total_warnings,
IFNULL(SUM(handle_type = 'waiting'), 0) AS todoCount,
IFNULL(SUM(handle_type = 'finish'), 0) AS finishCount,
IFNULL(SUM(ba.handle_type = 'cancel'), 0) AS cancelCount
FROM
business_alert ba
where 1=1
INNER JOIN sub_depts d ON ba.dept_id = d.dept_id
AND ba.handle_type != 'verify'
<include refid="searchSql"></include>
GROUP BY
ba.dept_name,ba.dept_id
d.parent_id
)
SELECT
d.dept_id deptId,
d.dept_name deptName,
IFNULL(w.total_warnings, 0) AS total,
IFNULL(w.todoCount, 0) AS todoCount,
IFNULL(w.finishCount, 0) AS finishCount,
IFNULL(w.cancelCount, 0) AS cancelCount
FROM
districts d
LEFT JOIN warning_summary w ON d.dept_id = w.district_id
</select>
<select id="countAlertCompare" resultType="java.util.Map">
@ -229,4 +309,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="searchSql"></include>
</select>
<select id="countAlertTypeCompare" resultType="java.util.Map">
WITH RECURSIVE months AS (
SELECT LAST_DAY(
IFNULL(
MAKEDATE(#{param.year}, 1),
DATE_SUB(NOW(), INTERVAL 11 MONTH)
)
) AS dateMonth
UNION ALL
SELECT LAST_DAY(DATE_ADD(dateMonth, INTERVAL 1 MONTH))
FROM months
WHERE <![CDATA[ dateMonth < LAST_DAY(
IFNULL(
MAKEDATE(#{param.year}, 1) + INTERVAL 11 MONTH,
NOW()
)
)]]>
),
param_departments AS (
SELECT dept_id, dept_name,tenant_id
FROM business_alert
WHERE dept_id IN
<foreach collection="param.deptIdList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
),
month_department AS (
SELECT d.dept_id, m.dateMonth, d.dept_name,d.tenant_id
FROM param_departments d
CROSS JOIN months m
<where>
<if test="param.dateList != null and param.dateList.size > 0">
DATE_FORMAT(m.dateMonth, '%Y-%m') IN
<foreach collection="param.dateList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
</where>
)
SELECT
md.dept_id deptId,
md.dept_name deptName,
DATE_FORMAT(md.dateMonth, '%Y-%m') AS date,
COUNT(DISTINCT ba.id) AS total,
IFNULL(SUM( ba.alert_type = 'illegal_land' ),0) AS landCount,
IFNULL(SUM( ba.alert_type = 'illegal_construction' ),0) AS constructionCount,
IFNULL(SUM( ba.alert_type = 'other' ),0) AS otherCount
FROM month_department md
LEFT JOIN business_alert ba
ON md.dept_id = ba.dept_id
AND DATE_FORMAT(ba.create_time, '%Y-%m') = DATE_FORMAT(md.dateMonth, '%Y-%m')
AND ba.handle_type != 'verify'
AND ba.alert_type in ('illegal_land','illegal_construction','other')
GROUP BY md.dept_id, md.dateMonth, md.dept_name
ORDER BY md.dept_id, md.dateMonth
</select>
</mapper>

5
dk-modules/sample/src/main/java/org/dromara/sample/wayline/model/entity/WaylineFileEntity.java

@ -7,6 +7,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @author sean
@ -54,9 +55,9 @@ public class WaylineFileEntity implements Serializable {
private String username;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Long createTime;
private Date createTime;
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private Long updateTime;
private Date updateTime;
}

4
dk-modules/workflow/src/main/java/org/dromara/workflow/handler/FlwAlertHandler.java

@ -31,7 +31,7 @@ public class FlwAlertHandler implements FlwCommonHandler {
@EventListener(condition = "#processEvent.flowCode.startsWith('alert')")
@Override
public void processHandler(ProcessEvent processEvent) {
alertService.updateAlertStatus(processEvent.getBusinessId(),processEvent.getStatus());
alertService.updateAlertStatus(processEvent.getBusinessId(),processEvent.getStatus(),processEvent.getIsIllegal(),processEvent.getAlertType());
}
/**
@ -43,7 +43,7 @@ public class FlwAlertHandler implements FlwCommonHandler {
@EventListener(condition = "#processCreateTaskEvent.flowCode.startsWith('alert')")
@Override
public void processCreateTaskHandler(ProcessCreateTaskEvent processCreateTaskEvent) {
alertService.updateAlertStatus(processCreateTaskEvent.getBusinessId(), BusinessStatusEnum.WAITING.getStatus());
alertService.updateAlertStatus(processCreateTaskEvent.getBusinessId(), BusinessStatusEnum.WAITING.getStatus(),processCreateTaskEvent.getIsIllegal(),processCreateTaskEvent.getAlertType());
}
/**

Loading…
Cancel
Save