59 changed files with 1083 additions and 692 deletions
@ -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 为 hls,1 为 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(); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,100 @@ |
|||||
|
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.IBusinessVideoService; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* rtmp默认端口1935, rtsp默认端口554 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/video") |
||||
|
@Tag(name = "ZLMediaKit视频流相关操作") |
||||
|
public class BusinessVideoController { |
||||
|
|
||||
|
private final IBusinessVideoService 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("设置录像速度失败!"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 回调事件 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping(value = "/index/hook/on_record_mp4") |
||||
|
public R<?> hookOnRecordMp4(@RequestBody Map<String,Object> map) { |
||||
|
return R.ok(map); |
||||
|
} |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package org.dromara.business.controller; |
||||
|
|
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* ZLMediaKit视频流事件回调 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/index/hook") |
||||
|
@Tag(name = "ZLMediaKit视频流事件回调") |
||||
|
@Slf4j |
||||
|
public class WebhookController { |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 处理播放事件 |
||||
|
*/ |
||||
|
@PostMapping("/on_play") |
||||
|
public String onPlay(@RequestBody String body) { |
||||
|
log.info("on_play event: {}", body); |
||||
|
|
||||
|
return "{\"code\": 0}"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理录制 MP4 文件事件 |
||||
|
*/ |
||||
|
@PostMapping("/on_record_mp4") |
||||
|
public String onRecordMp4(@RequestBody String body) { |
||||
|
log.info("on_record_mp4 event: {}", body); |
||||
|
|
||||
|
return "{\"code\": 0}"; |
||||
|
} |
||||
|
} |
@ -1,30 +0,0 @@ |
|||||
package org.dromara.business.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
import org.dromara.business.domain.BusinessDepartBoundary; |
|
||||
import org.dromara.common.mybatis.annotation.DataColumn; |
|
||||
import org.dromara.common.mybatis.annotation.DataPermission; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* 部门 Mapper 接口 |
|
||||
*/ |
|
||||
public interface BusinessDepartBoundaryMapper extends BaseMapper<BusinessDepartBoundary> { |
|
||||
Page<BusinessDepartBoundary> listSysDepartBoundary(Page<BusinessDepartBoundary> page,@Param("condition") BusinessDepartBoundary sysDepartBoundary); |
|
||||
|
|
||||
List<BusinessDepartBoundary> listSysDepartBoundaryGeomFromText(@Param("condition") BusinessDepartBoundary sysDepartBoundary); |
|
||||
/** |
|
||||
* 通过部门编码获取部门边界数据 |
|
||||
* @param deptId 部门编码 |
|
||||
* @return String |
|
||||
*/ |
|
||||
List<BusinessDepartBoundary> queryByDeptId(@Param("deptId") String deptId); |
|
||||
|
|
||||
void saveBatchBoundary(@Param("list") List<BusinessDepartBoundary> boundaryList); |
|
||||
|
|
||||
String listJson(@Param("param") BusinessDepartBoundary departBoundary); |
|
||||
|
|
||||
} |
|
@ -1,22 +0,0 @@ |
|||||
package org.dromara.business.mapper; |
|
||||
|
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
import org.dromara.business.domain.BusinessPatrolAreas; |
|
||||
import org.dromara.business.domain.bo.BusinessPatrolAreasBo; |
|
||||
|
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* @Description: 巡查区域 |
|
||||
*/ |
|
||||
public interface BusinessPatrolAreasMapper extends BaseMapper<BusinessPatrolAreas> { |
|
||||
|
|
||||
IPage<BusinessPatrolAreas> listPatrolAreas(Page<BusinessPatrolAreas> page, @Param("condition") BusinessPatrolAreasBo patrolAreasBo, @Param("deptIds") List<String> deptIds); |
|
||||
|
|
||||
List<BusinessPatrolAreas> listPatrolAreas(@Param("condition") BusinessPatrolAreasBo patrolAreasBo, @Param("deptIds") List<String> deptIds); |
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
package org.dromara.business.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||
import org.dromara.business.domain.BusinessVectorDictItem; |
|
||||
|
|
||||
public interface BusinessVectorDictItemMapper extends BaseMapper<BusinessVectorDictItem> { |
|
||||
|
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
package org.dromara.business.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||
import org.dromara.business.domain.BusinessVectorDict; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
public interface BusinessVectorDictMapper extends BaseMapper<BusinessVectorDict> { |
|
||||
List<BusinessVectorDict> listVectorField(); |
|
||||
} |
|
@ -1,30 +0,0 @@ |
|||||
package org.dromara.business.service; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||
import org.dromara.business.domain.BusinessDepartBoundary; |
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.springframework.web.multipart.MultipartFile; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* 部门区域 服务实现类 |
|
||||
*/ |
|
||||
public interface IBusinessDepartBoundaryService extends IService<BusinessDepartBoundary>{ |
|
||||
TableDataInfo<BusinessDepartBoundary> listSysDepartBoundary(PageQuery page, BusinessDepartBoundary departBoundary); |
|
||||
|
|
||||
List<BusinessDepartBoundary> listSysDepartBoundaryGeomFromText(BusinessDepartBoundary departBoundary); |
|
||||
|
|
||||
List<BusinessDepartBoundary> queryByDeptId(String deptId); |
|
||||
|
|
||||
boolean uploadShpFile(MultipartFile file); |
|
||||
|
|
||||
boolean deleteDepartBoundary(String id); |
|
||||
|
|
||||
boolean updateDepartBoundary(BusinessDepartBoundary departBoundary); |
|
||||
|
|
||||
boolean addDepartBoundary(BusinessDepartBoundary departBoundary); |
|
||||
|
|
||||
String listJson(BusinessDepartBoundary departBoundary); |
|
||||
} |
|
@ -1,29 +0,0 @@ |
|||||
package org.dromara.business.service; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
import org.dromara.business.domain.BusinessPatrolAreas; |
|
||||
import org.dromara.business.domain.bo.BusinessPatrolAreasBo; |
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.springframework.web.multipart.MultipartFile; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* @Description: 巡查区域 |
|
||||
*/ |
|
||||
public interface IBusinessPatrolAreasService extends IService<BusinessPatrolAreas> { |
|
||||
TableDataInfo<BusinessPatrolAreas> pagePatrolAreas(PageQuery pageQuery, BusinessPatrolAreasBo patrolAreasBo); |
|
||||
|
|
||||
List<BusinessPatrolAreas> listPatrolAreas(BusinessPatrolAreasBo patrolAreasBo); |
|
||||
|
|
||||
void addPatrolAreas(MultipartFile file); |
|
||||
|
|
||||
boolean updatePatrolAreas(BusinessPatrolAreas patrolAreas); |
|
||||
|
|
||||
List<BusinessPatrolAreas> exportXls(BusinessPatrolAreas patrolAreas); |
|
||||
|
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
package org.dromara.business.service; |
|
||||
|
|
||||
|
|
||||
import org.dromara.business.domain.BusinessVectorDictItem; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
public interface IBusinessVectorDictItemService { |
|
||||
|
|
||||
List<BusinessVectorDictItem> findDictItemByDictId(String dictId); |
|
||||
|
|
||||
} |
|
@ -1,17 +0,0 @@ |
|||||
package org.dromara.business.service; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import org.dromara.business.domain.BusinessVectorDict; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
public interface IBusinessVectorDictService { |
|
||||
|
|
||||
List<BusinessVectorDict> listVectorField(); |
|
||||
|
|
||||
BusinessVectorDict findVectorDictById(String dictId); |
|
||||
|
|
||||
|
|
||||
} |
|
@ -0,0 +1,36 @@ |
|||||
|
package org.dromara.business.service; |
||||
|
|
||||
|
|
||||
|
public interface IBusinessVideoService { |
||||
|
/** |
||||
|
* 开始录制 |
||||
|
*/ |
||||
|
Boolean startRecording(); |
||||
|
|
||||
|
/** |
||||
|
* 停止录制 |
||||
|
*/ |
||||
|
Boolean stopRecording(); |
||||
|
|
||||
|
/** |
||||
|
* 获取录制状态 |
||||
|
*/ |
||||
|
Boolean isRecording(); |
||||
|
|
||||
|
/** |
||||
|
* 获取截图 |
||||
|
*/ |
||||
|
String getSnap(Integer timeoutSec, Integer expireSec); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 设置录像速度(官方提供的接口有问题)暂时不用 |
||||
|
*/ |
||||
|
Boolean setRecordSpeed(Double speed); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 设置录像速度(官方提供的接口有问题)暂时不用 |
||||
|
*/ |
||||
|
Boolean seekRecordStamp(Integer stamp); |
||||
|
} |
@ -1,197 +0,0 @@ |
|||||
package org.dromara.business.service.impl; |
|
||||
|
|
||||
import cn.hutool.core.util.ObjectUtil; |
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.apache.commons.lang.StringUtils; |
|
||||
import org.apache.dubbo.config.annotation.DubboReference; |
|
||||
import org.dromara.business.domain.*; |
|
||||
import org.dromara.business.domain.bo.BusinessPatrolAreasBo; |
|
||||
import org.dromara.business.mapper.BusinessPatrolAreasMapper; |
|
||||
import org.dromara.business.service.*; |
|
||||
import org.dromara.business.utils.ShpAnalysisUtil; |
|
||||
import org.dromara.common.core.exception.ServiceException; |
|
||||
import org.dromara.common.mybatis.core.page.PageQuery; |
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
||||
import org.dromara.common.satoken.utils.LoginHelper; |
|
||||
import org.dromara.system.api.RemoteDeptService; |
|
||||
import org.dromara.system.api.RemoteUserService; |
|
||||
import org.dromara.system.api.domain.vo.RemoteDeptVo; |
|
||||
import org.dromara.system.api.model.LoginUser; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
import org.springframework.transaction.annotation.Transactional; |
|
||||
import org.springframework.web.multipart.MultipartFile; |
|
||||
|
|
||||
import java.io.InputStream; |
|
||||
import java.lang.reflect.Method; |
|
||||
import java.util.*; |
|
||||
import java.util.stream.Collectors; |
|
||||
|
|
||||
/** |
|
||||
* @Description: 巡查区域 |
|
||||
*/ |
|
||||
@RequiredArgsConstructor |
|
||||
@Service |
|
||||
public class BusinessPatrolAreasServiceImpl extends ServiceImpl<BusinessPatrolAreasMapper, BusinessPatrolAreas> implements IBusinessPatrolAreasService { |
|
||||
|
|
||||
private final IBusinessVectorDictService vectorDictService; |
|
||||
|
|
||||
@DubboReference |
|
||||
private RemoteUserService remoteUserService; |
|
||||
@DubboReference |
|
||||
private RemoteDeptService remoteDeptService; |
|
||||
|
|
||||
@Override |
|
||||
public TableDataInfo<BusinessPatrolAreas> pagePatrolAreas(PageQuery pageQuery, BusinessPatrolAreasBo patrolAreasBo) { |
|
||||
LoginUser user = LoginHelper.getLoginUser(); |
|
||||
List<String> deptIds = new ArrayList<>(); |
|
||||
String departIds = null; |
|
||||
if(StringUtils.isBlank(patrolAreasBo.getDeptId())){ |
|
||||
RemoteDeptVo remoteDeptVo = remoteDeptService.selectDeptById(user.getDeptId()); |
|
||||
if(ObjectUtil.isEmpty(remoteDeptVo)){ |
|
||||
throw new ServiceException("部门不存在"); |
|
||||
} |
|
||||
departIds = user.getDeptId() + ""; |
|
||||
}else { |
|
||||
departIds = patrolAreasBo.getDeptId(); |
|
||||
} |
|
||||
|
|
||||
deptIds.add(departIds); |
|
||||
|
|
||||
return TableDataInfo.build(this.baseMapper.listPatrolAreas(pageQuery.build(), patrolAreasBo, deptIds)); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public List<BusinessPatrolAreas> listPatrolAreas(BusinessPatrolAreasBo patrolAreasBo) { |
|
||||
return this.baseMapper.listPatrolAreas(patrolAreasBo, patrolAreasBo.getDeptIds()); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
@Transactional(rollbackFor = Exception.class) |
|
||||
public boolean updatePatrolAreas(BusinessPatrolAreas patrolAreas) { |
|
||||
patrolAreas.setUserName(remoteUserService.selectUserNameById(Long.valueOf(patrolAreas.getUserId()))); |
|
||||
return this.updateById(patrolAreas); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public List<BusinessPatrolAreas> exportXls(BusinessPatrolAreas patrolAreas) { |
|
||||
LambdaQueryWrapper<BusinessPatrolAreas> wrapper = buildWrapper(patrolAreas); |
|
||||
|
|
||||
return this.list(wrapper); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void addPatrolAreas(MultipartFile file) { |
|
||||
List<BusinessGeospatialVectors> geospatialVectorsList = new ArrayList<>(); |
|
||||
try { |
|
||||
//1、首先调用解析工具拿到解析的字段集合
|
|
||||
InputStream inputStream = file.getInputStream(); |
|
||||
List<Map<String, String>> mapList = ShpAnalysisUtil.analysisShpFile(inputStream); |
|
||||
|
|
||||
// 3. 构建字典map
|
|
||||
List<BusinessVectorDict> fieldsInfoList = vectorDictService.listVectorField(); |
|
||||
|
|
||||
Map<String, List<String>> dictMap = fieldsInfoList |
|
||||
.stream() |
|
||||
.collect(Collectors.toMap( |
|
||||
BusinessVectorDict::getDictCode, |
|
||||
v -> v.getFieldMappingsList().stream() |
|
||||
.map(mapping -> mapping.getItemValue().toLowerCase()) // 转小写
|
|
||||
.collect(Collectors.toList()) |
|
||||
)); |
|
||||
|
|
||||
// 4. 遍历 mapList,替换映射关系并只保留有效条目
|
|
||||
List<Map<String, String>> resultList = mapList.stream() |
|
||||
.map(originalMap -> originalMap.entrySet().stream() |
|
||||
.filter(entry -> { |
|
||||
String keyLower = entry.getKey().toLowerCase(); // 将 mapList 中的 key 转换为小写
|
|
||||
// 遍历 dictMap 的所有 List<String>,检查其中是否包含该 key
|
|
||||
return dictMap.values().stream() |
|
||||
.anyMatch(list -> list.contains(keyLower)); // 判断 dictMap 中的 List<String> 是否包含该 key
|
|
||||
}) |
|
||||
.collect(Collectors.toMap( |
|
||||
entry -> { |
|
||||
// 根据匹配的 key 查找 dictMap 中对应的 key
|
|
||||
return dictMap.entrySet().stream() |
|
||||
.filter(mapEntry -> mapEntry.getValue().contains(entry.getKey().toLowerCase())) |
|
||||
.map(Map.Entry::getKey) |
|
||||
.findFirst() |
|
||||
.orElse(""); // 如果没有匹配到,则返回空字符串
|
|
||||
}, |
|
||||
Map.Entry::getValue |
|
||||
)) |
|
||||
) |
|
||||
.filter(transformedMap -> !transformedMap.isEmpty()) // 过滤空的 Map
|
|
||||
.collect(Collectors.toList()); |
|
||||
|
|
||||
|
|
||||
// 5. 通过反射设置 GeospatialVectors 对象的属性
|
|
||||
for (Map<String, String> transformedMap : resultList) { |
|
||||
BusinessGeospatialVectors geoVector = new BusinessGeospatialVectors(); |
|
||||
|
|
||||
transformedMap.forEach((key, value) -> { |
|
||||
try { |
|
||||
// 尝试通过反射找到相应的Setter方法,并调用
|
|
||||
Method setterMethod = BusinessGeospatialVectors.class.getMethod("set" + capitalizeFirstLetter(key), String.class); |
|
||||
|
|
||||
setterMethod.invoke(geoVector, value); |
|
||||
} catch (Exception e) { |
|
||||
e.printStackTrace(); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
geoVector.setCreateTime(new Date()); |
|
||||
geospatialVectorsList.add(geoVector); |
|
||||
} |
|
||||
|
|
||||
//6、生成新的对象集合存储数据表中
|
|
||||
//todo 处理这个集合geospatialVectorsList
|
|
||||
List<BusinessPatrolAreas> areasList = buildBusinessPatrolAreas(geospatialVectorsList); |
|
||||
|
|
||||
|
|
||||
} catch (Exception e) { |
|
||||
e.printStackTrace(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 根据解析shp得到的内容封装到BusinessPatrolAreas这个类里面 |
|
||||
* @param paramList |
|
||||
* @return |
|
||||
*/ |
|
||||
private List<BusinessPatrolAreas> buildBusinessPatrolAreas(List<BusinessGeospatialVectors> paramList) { |
|
||||
List<BusinessPatrolAreas> resultList = new ArrayList<>(); |
|
||||
|
|
||||
return resultList; |
|
||||
} |
|
||||
|
|
||||
private static String capitalizeFirstLetter(String str) { |
|
||||
if (str == null || str.isEmpty()) { |
|
||||
return str; |
|
||||
} |
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1); |
|
||||
} |
|
||||
|
|
||||
private LambdaQueryWrapper<BusinessPatrolAreas> buildWrapper(BusinessPatrolAreas patrolAreas) { |
|
||||
LambdaQueryWrapper<BusinessPatrolAreas> wrapper = new LambdaQueryWrapper<>(); |
|
||||
|
|
||||
if (ObjectUtil.isNotEmpty(patrolAreas.getName())){ |
|
||||
wrapper.like(BusinessPatrolAreas::getName, patrolAreas.getName()); |
|
||||
} |
|
||||
|
|
||||
if (ObjectUtil.isNotEmpty(patrolAreas.getDeptId())){ |
|
||||
wrapper.eq(BusinessPatrolAreas::getDeptId, patrolAreas.getDeptId()); |
|
||||
} |
|
||||
|
|
||||
if (ObjectUtil.isNotEmpty(patrolAreas.getAreasIdList())){ |
|
||||
wrapper.in(BusinessPatrolAreas::getId, patrolAreas.getAreasIdList()); |
|
||||
} |
|
||||
|
|
||||
return wrapper; |
|
||||
} |
|
||||
} |
|
@ -1,28 +0,0 @@ |
|||||
package org.dromara.business.service.impl; |
|
||||
|
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import org.dromara.business.domain.BusinessVectorDictItem; |
|
||||
import org.dromara.business.mapper.BusinessVectorDictItemMapper; |
|
||||
import org.dromara.business.service.IBusinessVectorDictItemService; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 矢量数据字段映射关联服务类 |
|
||||
*/ |
|
||||
@Service |
|
||||
public class BusinessVectorDictItemServiceImpl extends ServiceImpl<BusinessVectorDictItemMapper, BusinessVectorDictItem> implements IBusinessVectorDictItemService { |
|
||||
|
|
||||
|
|
||||
@Override |
|
||||
public List<BusinessVectorDictItem> findDictItemByDictId(String dictId) { |
|
||||
LambdaQueryWrapper<BusinessVectorDictItem> wrapper = new LambdaQueryWrapper<>(); |
|
||||
wrapper.eq(BusinessVectorDictItem::getDictId, dictId); |
|
||||
|
|
||||
return this.baseMapper.selectList(wrapper); |
|
||||
} |
|
||||
} |
|
@ -1,37 +0,0 @@ |
|||||
package org.dromara.business.service.impl; |
|
||||
|
|
||||
import cn.hutool.core.util.ObjectUtil; |
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import org.dromara.business.domain.BusinessVectorDict; |
|
||||
import org.dromara.business.mapper.BusinessVectorDictMapper; |
|
||||
import org.dromara.business.service.IBusinessVectorDictService; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* 矢量数据字段映射主表服务类 |
|
||||
*/ |
|
||||
@Service |
|
||||
public class BusinessVectorDictServiceImpl extends ServiceImpl<BusinessVectorDictMapper, BusinessVectorDict> implements IBusinessVectorDictService { |
|
||||
|
|
||||
|
|
||||
@Override |
|
||||
public List<BusinessVectorDict> listVectorField() { |
|
||||
return this.baseMapper.listVectorField(); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public BusinessVectorDict findVectorDictById(String dictId) { |
|
||||
if (ObjectUtil.isEmpty(dictId)){ |
|
||||
throw new RuntimeException("【dictId】为空,参数为空!"); |
|
||||
} |
|
||||
|
|
||||
LambdaQueryWrapper<BusinessVectorDict> wrapper = new LambdaQueryWrapper<>(); |
|
||||
wrapper.eq(BusinessVectorDict::getId, dictId); |
|
||||
|
|
||||
return this.baseMapper.selectOne(wrapper); |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,196 @@ |
|||||
|
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.IBusinessVideoService; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
@Slf4j |
||||
|
@RequiredArgsConstructor |
||||
|
public class BusinessVideoServiceImpl implements IBusinessVideoService { |
||||
|
|
||||
|
private final ZlmConfig zlmConfig; |
||||
|
private static final ObjectMapper objectMapper = new ObjectMapper(); |
||||
|
private final RestTemplate restTemplate; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Boolean startRecording() { |
||||
|
|
||||
|
Boolean result = false; |
||||
|
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> resultMap = objectMapper.readValue(response.getBody(), Map.class); |
||||
|
result = (Boolean) resultMap.get("result"); |
||||
|
log.info("录制启动成功: {}", resultMap); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("请求异常: {}", e.getMessage(), e); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean stopRecording() { |
||||
|
Boolean result = false; |
||||
|
|
||||
|
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> resultMap = objectMapper.readValue(response.getBody(), Map.class); |
||||
|
result = (Boolean) resultMap.get("result"); |
||||
|
log.info("录制停止成功: {}", resultMap); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("请求异常: {}", e.getMessage(), e); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean isRecording() { |
||||
|
Boolean result = false; |
||||
|
|
||||
|
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 = (Boolean) resultMap.get("status"); |
||||
|
log.info("获取录制状态成功: {}", resultMap); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("请求异常: {}", e.getMessage(), e); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@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 setRecordSpeed(Double speed) { |
||||
|
Boolean result = false; |
||||
|
|
||||
|
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> resultMap = objectMapper.readValue(response.getBody(), Map.class); |
||||
|
result = (Boolean) resultMap.get("result"); |
||||
|
log.info("设置录制速度成功: {}", result); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("请求异常: {}", e.getMessage(), e); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Boolean seekRecordStamp(Integer stamp) { |
||||
|
Boolean result = false; |
||||
|
|
||||
|
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> resultMap = objectMapper.readValue(response.getBody(), Map.class); |
||||
|
result = (Boolean) resultMap.get("result"); |
||||
|
log.info("设置录像流播放位置成功: {}", resultMap); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("请求异常: {}", e.getMessage(), e); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
} |
@ -1,55 +0,0 @@ |
|||||
<?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="org.dromara.business.mapper.BusinessPatrolAreasMapper"> |
|
||||
<resultMap id="listPatrolAreasMap" type="org.dromara.business.domain.BusinessPatrolAreas"> |
|
||||
<result column="id" property="id" jdbcType="VARCHAR"/> |
|
||||
<result column="name" property="name" jdbcType="VARCHAR"/> |
|
||||
<result column="number" property="number" jdbcType="VARCHAR"/> |
|
||||
<result column="dept_id" property="deptId" jdbcType="VARCHAR"/> |
|
||||
<result column="dept_ids" property="deptIds" jdbcType="VARCHAR"/> |
|
||||
<result column="platform_type" property="platformType" jdbcType="VARCHAR"/> |
|
||||
<result column="dept_name" property="deptName" jdbcType="VARCHAR"/> |
|
||||
<result column="leader_dept_id" property="leaderDeptId" jdbcType="VARCHAR"/> |
|
||||
<result column="user_id" property="userId" jdbcType="VARCHAR"/> |
|
||||
<result column="user_name" property="userName" jdbcType="VARCHAR"/> |
|
||||
<result column="create_by" property="createBy" jdbcType="VARCHAR"/> |
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
|
||||
<collection column="{areaId=id}" |
|
||||
property="patrolAreasUsers" ofType="org.dromara.business.domain.BusinessPatrolAreasUser" |
|
||||
javaType="java.util.ArrayList" |
|
||||
select="org.dromara.business.mapper.BusinessPatrolAreasUserMapper.listPatrolAreasUserByAreaId"/> |
|
||||
<collection column="{areaId=id}" |
|
||||
property="patrolAreasPoints" ofType="org.dromara.business.domain.BusinessPatrolAreasPoints" |
|
||||
javaType="java.util.ArrayList" |
|
||||
select="org.dromara.business.mapper.BusinessPatrolAreasPointsMapper.listPatrolAreasPointByAreaId"/> |
|
||||
</resultMap> |
|
||||
<select id="listPatrolAreas" resultMap="listPatrolAreasMap"> |
|
||||
select pa.*,sd.dept_name as dept_name from business_patrol_areas pa |
|
||||
LEFT JOIN dk_cloud.sys_dept sd ON pa.dept_id = sd.dept_id |
|
||||
where |
|
||||
pa.del_flag = 0 |
|
||||
<if test="deptIds.size > 0"> |
|
||||
and pa.dept_id in |
|
||||
<foreach item="id" collection="deptIds" open="(" separator="," close=")"> |
|
||||
#{id} |
|
||||
</foreach> |
|
||||
</if> |
|
||||
<if test="condition.name != null and condition.name != ''"> |
|
||||
and pa.name LIKE concat(concat('%',#{condition.name}),'%') |
|
||||
</if> |
|
||||
<if test="condition.platformType != null and condition.platformType != ''"> |
|
||||
AND pa.id IN ( |
|
||||
SELECT api.patrol_areas_id |
|
||||
FROM business_patrol_areas_platform_info api |
|
||||
|
|
||||
WHERE api.platform_type = 'plough' |
|
||||
) |
|
||||
</if> |
|
||||
<if test="condition.name != null and condition.name != ''"> |
|
||||
and pa.name LIKE concat(concat('%',#{condition.name}),'%') |
|
||||
</if> |
|
||||
<if test="condition.isDisable != null and condition.isDisable != ''"> |
|
||||
and pa.is_disable =#{condition.isDisable} |
|
||||
</if> |
|
||||
</select> |
|
||||
</mapper> |
|
@ -0,0 +1,28 @@ |
|||||
|
package org.dromara.system.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.dromara.system.domain.SysDepartBoundary; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 部门 Mapper 接口 |
||||
|
*/ |
||||
|
public interface SysDepartBoundaryMapper extends BaseMapper<SysDepartBoundary> { |
||||
|
Page<SysDepartBoundary> listSysDepartBoundary(Page<SysDepartBoundary> page,@Param("condition") SysDepartBoundary sysDepartBoundary); |
||||
|
|
||||
|
List<SysDepartBoundary> listSysDepartBoundaryGeomFromText(@Param("condition") SysDepartBoundary sysDepartBoundary); |
||||
|
/** |
||||
|
* 通过部门编码获取部门边界数据 |
||||
|
* @param deptId 部门编码 |
||||
|
* @return String |
||||
|
*/ |
||||
|
List<SysDepartBoundary> queryByDeptId(@Param("deptId") String deptId); |
||||
|
|
||||
|
void saveBatchBoundary(@Param("list") List<SysDepartBoundary> boundaryList); |
||||
|
|
||||
|
String listJson(@Param("param") SysDepartBoundary departBoundary); |
||||
|
|
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
package org.dromara.system.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.dromara.system.domain.SysVectorDictItem; |
||||
|
|
||||
|
public interface SysVectorDictItemMapper extends BaseMapper<SysVectorDictItem> { |
||||
|
|
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
package org.dromara.system.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.dromara.system.domain.SysVectorDict; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface SysVectorDictMapper extends BaseMapper<SysVectorDict> { |
||||
|
List<SysVectorDict> listVectorField(); |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package org.dromara.system.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import org.dromara.system.domain.SysDepartBoundary; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 部门区域 服务实现类 |
||||
|
*/ |
||||
|
public interface ISysDepartBoundaryService extends IService<SysDepartBoundary>{ |
||||
|
TableDataInfo<SysDepartBoundary> listSysDepartBoundary(PageQuery page, SysDepartBoundary departBoundary); |
||||
|
|
||||
|
List<SysDepartBoundary> listSysDepartBoundaryGeomFromText(SysDepartBoundary departBoundary); |
||||
|
|
||||
|
List<SysDepartBoundary> queryByDeptId(String deptId); |
||||
|
|
||||
|
boolean uploadShpFile(MultipartFile file,Integer areaType); |
||||
|
|
||||
|
boolean deleteDepartBoundary(String id); |
||||
|
|
||||
|
boolean updateDepartBoundary(SysDepartBoundary departBoundary); |
||||
|
|
||||
|
boolean addDepartBoundary(SysDepartBoundary departBoundary); |
||||
|
|
||||
|
String listJson(SysDepartBoundary departBoundary); |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package org.dromara.system.service; |
||||
|
|
||||
|
|
||||
|
import org.dromara.system.domain.SysVectorDictItem; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ISysVectorDictItemService { |
||||
|
|
||||
|
List<SysVectorDictItem> findDictItemByDictId(String dictId); |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package org.dromara.system.service; |
||||
|
|
||||
|
import org.dromara.system.domain.SysVectorDict; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ISysVectorDictService { |
||||
|
|
||||
|
List<SysVectorDict> listVectorField(); |
||||
|
|
||||
|
SysVectorDict findVectorDictById(String dictId); |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package org.dromara.system.service.impl; |
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import org.dromara.system.domain.SysVectorDictItem; |
||||
|
import org.dromara.system.mapper.SysVectorDictItemMapper; |
||||
|
import org.dromara.system.service.ISysVectorDictItemService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 矢量数据字段映射关联服务类 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysVectorDictItemServiceImpl extends ServiceImpl<SysVectorDictItemMapper, SysVectorDictItem> implements ISysVectorDictItemService { |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public List<SysVectorDictItem> findDictItemByDictId(String dictId) { |
||||
|
LambdaQueryWrapper<SysVectorDictItem> wrapper = new LambdaQueryWrapper<>(); |
||||
|
wrapper.eq(SysVectorDictItem::getDictId, dictId); |
||||
|
|
||||
|
return this.baseMapper.selectList(wrapper); |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package org.dromara.system.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import org.dromara.system.domain.SysVectorDict; |
||||
|
import org.dromara.system.mapper.SysVectorDictMapper; |
||||
|
import org.dromara.system.service.ISysVectorDictService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 矢量数据字段映射主表服务类 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysVectorDictServiceImpl extends ServiceImpl<SysVectorDictMapper, SysVectorDict> implements ISysVectorDictService { |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public List<SysVectorDict> listVectorField() { |
||||
|
return this.baseMapper.listVectorField(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public SysVectorDict findVectorDictById(String dictId) { |
||||
|
if (ObjectUtil.isEmpty(dictId)){ |
||||
|
throw new RuntimeException("【dictId】为空,参数为空!"); |
||||
|
} |
||||
|
|
||||
|
LambdaQueryWrapper<SysVectorDict> wrapper = new LambdaQueryWrapper<>(); |
||||
|
wrapper.eq(SysVectorDict::getId, dictId); |
||||
|
|
||||
|
return this.baseMapper.selectOne(wrapper); |
||||
|
} |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package org.dromara.system.utils; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.function.Consumer; |
||||
|
|
||||
|
/** |
||||
|
* 分批处理工具类 |
||||
|
*/ |
||||
|
public class BatchProcessorUtil { |
||||
|
|
||||
|
/** |
||||
|
* 分批处理数据 |
||||
|
* |
||||
|
* @param dataList 数据集合 |
||||
|
* @param batchSize 每批处理的数据量 |
||||
|
* @param startIndex 起始位置 |
||||
|
* @param batchHandler 每批数据的处理逻辑 |
||||
|
* @return 下一次的起始位置 |
||||
|
*/ |
||||
|
public static <T> boolean processBatches(List<T> dataList, int batchSize, int startIndex, Consumer<List<T>> batchHandler) { |
||||
|
if (dataList == null || dataList.isEmpty()) { |
||||
|
return true; // 数据为空,直接返回当前起始位置
|
||||
|
} |
||||
|
|
||||
|
int totalSize = dataList.size(); |
||||
|
while (startIndex < totalSize) { |
||||
|
int endIndex = Math.min(startIndex + batchSize, totalSize); |
||||
|
List<T> batch = dataList.subList(startIndex, endIndex); |
||||
|
|
||||
|
// 处理当前批次的数据
|
||||
|
batchHandler.accept(batch); |
||||
|
|
||||
|
// 更新起始位置
|
||||
|
startIndex = endIndex; |
||||
|
} |
||||
|
|
||||
|
return startIndex >= totalSize; // 返回下一次的起始位置
|
||||
|
} |
||||
|
} |
@ -1,4 +1,4 @@ |
|||||
package org.dromara.business.utils; |
package org.dromara.system.utils; |
||||
|
|
||||
import cn.hutool.core.util.ObjectUtil; |
import cn.hutool.core.util.ObjectUtil; |
||||
import org.geotools.data.FileDataStore; |
import org.geotools.data.FileDataStore; |
@ -1,6 +1,6 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?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"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.dromara.business.mapper.BusinessVectorDictItemMapper"> |
<mapper namespace="org.dromara.system.mapper.SysVectorDictItemMapper"> |
||||
|
|
||||
|
|
||||
|
|
Loading…
Reference in new issue