Browse Source

Merge remote-tracking branch 'origin/dev' into dev

pull/7/head
吴远 2 weeks ago
parent
commit
25cbe9b201
  1. 2
      dk-api/api-system/src/main/java/org/dromara/system/api/RemoteDeptService.java
  2. 6
      dk-common/common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java
  3. 160
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoOssController.java
  4. 69
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessLayerController.java
  5. 5
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java
  6. 6
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java
  7. 74
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfoOss.java
  8. 49
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessLayer.java
  9. 2
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java
  10. 73
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoOssBo.java
  11. 13
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessLayerBo.java
  12. 23
      dk-modules/business/src/main/java/org/dromara/business/domain/model/enums/LayerTypeEnum.java
  13. 88
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoOssVo.java
  14. 5
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java
  15. 12
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java
  16. 29
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessLayerVo.java
  17. 20
      dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoOssMapper.java
  18. 4
      dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessLayerMapper.java
  19. 69
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoOssService.java
  20. 5
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessLayerService.java
  21. 193
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoOssServiceImpl.java
  22. 64
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java
  23. 16
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java
  24. 89
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessLayerServiceImpl.java
  25. 3
      dk-modules/business/src/main/java/org/dromara/business/utils/constants/MinIOConstants.java
  26. 12
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoOssMapper.xml
  27. 65
      dk-modules/business/src/main/resources/mapper/business/BusinessLayerMapper.xml
  28. 4
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceServiceImpl.java
  29. 1
      dk-modules/sample/src/main/java/org/dromara/sample/media/service/IFileService.java
  30. 33
      dk-modules/sample/src/main/java/org/dromara/sample/media/service/impl/FileServiceImpl.java
  31. 15
      dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java
  32. 29
      dk-modules/system/src/main/java/org/dromara/system/controller/system/SysDepartBoundaryController.java
  33. 39
      dk-modules/system/src/main/java/org/dromara/system/domain/SysDepartBoundary.java
  34. 4
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteDeptServiceImpl.java
  35. 1
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java
  36. 2
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteSubmailConfigServiceImpl.java
  37. 2
      dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java
  38. 2
      dk-modules/system/src/main/java/org/dromara/system/service/ISysDepartBoundaryService.java
  39. 5
      dk-modules/system/src/main/java/org/dromara/system/service/ISysDeptService.java
  40. 50
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java
  41. 19
      dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java
  42. 21
      dk-modules/system/src/main/resources/mapper/system/SysDepartBoundaryMapper.xml
  43. 16
      dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml

2
dk-api/api-system/src/main/java/org/dromara/system/api/RemoteDeptService.java

@ -24,7 +24,7 @@ public interface RemoteDeptService {
RemoteDeptVo selectDeptById(Long deptId);
List<Map<String,Object>> getNamePathList();
List<Map<String,Object>> getNamePathList(Long deptId);
List<RemoteDeptVo> selectListByParentId(String deptId);

6
dk-common/common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java

@ -363,6 +363,11 @@ public class OssClient {
return url;
}
//自定义上传prefix路径
public UploadResult uploadPrefix(byte[] data, String prefix, String suffix,String fileName, String contentType) {
return upload(new ByteArrayInputStream(data), getPath(prefix, suffix,fileName), Long.valueOf(data.length), contentType);
}
/**
* 上传 byte[] 数据到 Amazon S3使用指定的后缀构造对象键
*
@ -649,4 +654,5 @@ public class OssClient {
return policy.replaceAll("bucketName", bucketName);
}
}

160
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoOssController.java

@ -0,0 +1,160 @@
package org.dromara.business.controller;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import org.dromara.business.utils.MinioUntil;
import org.dromara.business.utils.constants.MinIOConstants;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.file.MimeTypeUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.oss.core.OssClient;
import org.dromara.common.oss.entity.UploadResult;
import org.dromara.common.oss.factory.OssFactory;
import org.dromara.business.domain.bo.BusinessAlertConstructInfoOssBo;
import org.dromara.business.service.IBusinessAlertConstructInfoOssService;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.springframework.web.multipart.MultipartFile;
/**
* 预警任务-施工信息-oss
* 前端访问路由地址为:/business/businessAlertConstructInfoOss
*
* @author szs
* @date 2025-06-04
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/alertConstructInfoOss")
public class BusinessAlertConstructInfoOssController extends BaseController {
private final IBusinessAlertConstructInfoOssService businessAlertConstructInfoOssService;
/**
* 查询预警任务-施工信息-oss列表
*/
// @SaCheckPermission("business:businessAlertConstructInfoOss:list")
@GetMapping("/list")
public TableDataInfo<BusinessAlertConstructInfoOss> list(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery) {
TableDataInfo<BusinessAlertConstructInfoOss> businessAlertConstructInfoOssVoTableDataInfo = businessAlertConstructInfoOssService.queryPageList(bo, pageQuery);
return businessAlertConstructInfoOssVoTableDataInfo;
}
/**
* 预警任务-施工信息-oss - 上传
*/
// @SaCheckPermission("business:businessAlertConstructInfoOss:upload")
// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.EXPORT)
@PostMapping("/upload")
public R<BusinessAlertConstructInfoOssBo> upload(@RequestPart("file") MultipartFile file, BusinessAlertConstructInfoOssBo bo, HttpServletResponse response) {
if (ObjectUtil.isNull(file)) {
return R.fail("上传文件不能为空");
}
if(ObjectUtil.isNull(bo.getAlertConstructInfoId())){
return R.fail("施工信息ID不能为空!");
}
//文件上传
// OssClient storage = OssFactory.instance(MinIOConstants.BUCKET_DKCY);
OssClient storage = OssFactory.instance(MinIOConstants.BUCKET_NANTONG);
String originalfileName = file.getOriginalFilename();
String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
UploadResult uploadResult;
try {
uploadResult = storage.uploadPrefix(file.getBytes(),"construct", suffix, originalfileName, file.getContentType());
} catch (IOException e) {
throw new ServiceException(e.getMessage());
}
//保存记录
BusinessAlertConstructInfoOssBo businessAlertConstructInfoOssBo = new BusinessAlertConstructInfoOssBo();
businessAlertConstructInfoOssBo.setAlertConstructInfoId(bo.getAlertConstructInfoId());
businessAlertConstructInfoOssBo.setFileName(file.getName());
businessAlertConstructInfoOssBo.setOriginalName(originalfileName);
businessAlertConstructInfoOssBo.setFileSuffix(suffix);
businessAlertConstructInfoOssBo.setUrl(uploadResult.getFilename()); //格式:construct/2025/06/05/46e26e2df3a94a2dabb0d445ad3438f2DJI_20250602104843_0001_V.jpeg
businessAlertConstructInfoOssBo.setService(storage.getConfigKey());
businessAlertConstructInfoOssService.insertByBo(businessAlertConstructInfoOssBo);
return R.ok(businessAlertConstructInfoOssBo);
}
/**
* 导出预警任务-施工信息-oss列表
*/
// @SaCheckPermission("business:businessAlertConstructInfoOss:export")
// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(BusinessAlertConstructInfoOssBo bo, HttpServletResponse response) {
List<BusinessAlertConstructInfoOssVo> list = businessAlertConstructInfoOssService.queryList(bo);
ExcelUtil.exportExcel(list, "预警任务-施工信息-oss", BusinessAlertConstructInfoOssVo.class, response);
}
/**
* 获取预警任务-施工信息-oss详细信息
*
* @param id 主键
*/
// @SaCheckPermission("business:businessAlertConstructInfoOss:query")
@GetMapping("/{id}")
public R<BusinessAlertConstructInfoOssVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(businessAlertConstructInfoOssService.queryById(id));
}
/**
* 新增预警任务-施工信息-oss
*/
// @SaCheckPermission("business:businessAlertConstructInfoOss:add")
// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusinessAlertConstructInfoOssBo bo) {
return toAjax(businessAlertConstructInfoOssService.insertByBo(bo));
}
/**
* 修改预警任务-施工信息-oss
*/
// @SaCheckPermission("business:businessAlertConstructInfoOss:edit")
// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusinessAlertConstructInfoOssBo bo) {
return toAjax(businessAlertConstructInfoOssService.updateByBo(bo));
}
/**
* 删除预警任务-施工信息-oss
*
* @param ids 主键串
*/
// @SaCheckPermission("business:businessAlertConstructInfoOss:remove")
// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
Boolean result = businessAlertConstructInfoOssService.deleteWithValidByIds(List.of(ids), true);
return toAjax(result);
}
}

69
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessLayerController.java

@ -2,35 +2,88 @@ package org.dromara.business.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotEmpty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.business.domain.bo.BusinessLayerBo;
import org.dromara.business.domain.vo.BusinessLayerVo;
import org.dromara.business.service.IBusinessLayerService;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
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.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@Validated
@RequiredArgsConstructor
@RestController
@Tag(name = "图层模块")
@RequestMapping("/layer")
public class BusinessLayerController {
public class BusinessLayerController extends BaseController {
private final IBusinessLayerService businessLayerService;
/**
* 图层模块列表
*/
@SaCheckPermission("business:task:list")
@Operation(summary ="图层模块列表",description = "图层模块列表")
@SaCheckPermission("business:layer:list")
@GetMapping("/list")
public TableDataInfo<BusinessLayerVo> list(BusinessLayerBo bo, PageQuery pageQuery) {
return businessLayerService.queryPageList(bo, pageQuery);
public R<TableDataInfo<BusinessLayerVo>> list(BusinessLayerBo bo, PageQuery pageQuery) {
return R.ok(businessLayerService.queryPageList(bo, pageQuery));
}
@Operation(summary ="图层下拉列表",description = "图层下拉列表")
@GetMapping("/optionSelect")
public R<List<BusinessLayerVo>> optionSelect() {
return R.ok(businessLayerService.optionSelect());
}
/**
* 图层新增
*/
@Operation(summary ="图层新增",description = "图层新增")
@SaCheckPermission("business:layer:add")
@Log(title = "图层新增", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusinessLayerBo bo) {
return toAjax(businessLayerService.insert(bo));
}
/**
* 图层修改
*/
@SaCheckPermission("business:layer:edit")
@Operation(summary ="图层修改",description = "图层修改")
@Log(title = "图层修改", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusinessLayerBo bo) {
return toAjax(businessLayerService.update(bo));
}
/**
* 删除
*
* @param id 主键
*/
@SaCheckPermission("business:task:remove")
@Operation(summary ="图层删除",description = "图层删除")
@Log(title = "图层删除", businessType = BusinessType.DELETE)
@GetMapping("/delete")
public R<Void> remove(@RequestParam("id") Long id) {
return toAjax(businessLayerService.delete(id));
}
}

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

@ -264,6 +264,11 @@ public class BusinessAlert {
@TableField(exist = false)
private String icon;
@TableField(exist = false)
private String postCategory; //类别编码,用来过滤预警查询返回值(南通的查询南通类,丰县查询丰县)
/**
* 无人机方向
*/

6
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java

@ -4,8 +4,10 @@ import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import java.io.Serial;
import java.util.List;
/**
* 预警任务-施工信息对象 business_alert_construct_info
@ -83,4 +85,8 @@ public class BusinessAlertConstructInfo extends TenantEntity {
private String remark;
@TableField(exist = false)
private List<BusinessAlertConstructInfoOss> alertConstructInfoOssList;
}

74
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfoOss.java

@ -0,0 +1,74 @@
package org.dromara.business.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 预警任务-施工信息-oss对象 business_alert_construct_info_oss
*
* @author szs
* @date 2025-06-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("business_alert_construct_info_oss")
public class BusinessAlertConstructInfoOss extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id")
private Long id;
/**
* 施工信息ID
*/
private Long alertConstructInfoId;
/**
* 施工信息
*/
private Long alertConstructInfoName;
/**
* 文件名
*/
private String fileName;
/**
* 原名
*/
private String originalName;
/**
* 文件后缀名
*/
private String fileSuffix;
/**
* URL地址
*/
private String url;
@TableField(exist = false)
private String previewUrl;
/**
* 备注
*/
private String remark;
/**
* 服务商
*/
private String service;
}

49
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessLayer.java

@ -4,6 +4,7 @@ package org.dromara.business.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
@ -11,11 +12,8 @@ import java.io.Serial;
import java.util.Date;
@Data
@EqualsAndHashCode
@TableName("business_layer")
public class BusinessLayer {
@Serial
private static final long serialVersionUID = 1L;
@TableName(value = "business_layer", autoResultMap = true)
public class BusinessLayer extends BaseEntity {
/**
* id
@ -24,7 +22,6 @@ public class BusinessLayer {
private Long id;
private String layerName;
@ -32,28 +29,42 @@ public class BusinessLayer {
private Boolean enable;
/**
* 时间
* */
private Date createTime;
* 0菜单 1三维 2矢量 3影像
*/
private Integer layerType;
@TableField(exist = false)
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "layerType", other = "layer_type")
private String layerTypeName;
//租户id
private String tenantId;
//部门id
/**
* 图层url
*/
private String layerUrl;
/**
* 部门id
*/
private Long deptId;
//部门名称
/**
* 部门名称
*/
private String deptName;
//备注
/**
* 备注
*/
private String remark;
//排序
/**
* 排序
*/
private Integer sort;
//父部门id
private Integer parentId;
/**
* 父类id
*/
private Long parentId;
}

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

@ -272,4 +272,6 @@ public class BusinessAlertBo {
*/
private String gimbalPitch;
private String postCategory; //类别编码,用来过滤预警查询返回值(南通的查询南通类,丰县查询丰县)
}

73
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoOssBo.java

@ -0,0 +1,73 @@
package org.dromara.business.domain.bo;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 预警任务-施工信息-oss业务对象 business_alert_construct_info_oss
*
* @author szs
* @date 2025-06-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = BusinessAlertConstructInfoOss.class, reverseConvertGenerate = false)
public class BusinessAlertConstructInfoOssBo extends BaseEntity {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
private Long id;
/**
* 施工信息ID
*/
@NotNull(message = "施工信息ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long alertConstructInfoId;
/**
* 施工信息
*/
private Long alertConstructInfoName;
/**
* 文件名
*/
@NotBlank(message = "文件名不能为空", groups = { AddGroup.class, EditGroup.class })
private String fileName;
/**
* 原名
*/
private String originalName;
/**
* 文件后缀名
*/
private String fileSuffix;
/**
* URL地址
*/
private String url;
/**
* 备注
*/
private String remark;
/**
* 服务商
*/
@NotBlank(message = "服务商不能为空", groups = { AddGroup.class, EditGroup.class })
private String service;
}

13
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessLayerBo.java

@ -37,9 +37,17 @@ public class BusinessLayerBo {
* */
private Date createTime;
/**
* 0目录 1地址
*/
@NotNull(message = "图层类型不能为空", groups = { AddGroup.class})
private Integer layerType;
/**
* 图层url
*/
private String layerUrl;
private String tenantId;
@NotNull(message = "部门id不能为空", groups = { AddGroup.class})
private Long deptId;
@ -52,6 +60,9 @@ public class BusinessLayerBo {
//排序
private Integer sort;
//父部门id
private Integer parentId;
private Long parentId;
private String startTime;
private String endTime;
}

23
dk-modules/business/src/main/java/org/dromara/business/domain/model/enums/LayerTypeEnum.java

@ -0,0 +1,23 @@
package org.dromara.business.domain.model.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum LayerTypeEnum {
menu(0,"目录"),
threeDimensional(1,"三维"),
vector(2,"矢量"),
image(3,"影像");
private Integer type;
private String desc;
}

88
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoOssVo.java

@ -0,0 +1,88 @@
package org.dromara.business.domain.vo;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 预警任务-施工信息-oss视图对象 business_alert_construct_info_oss
*
* @author szs
* @date 2025-06-04
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BusinessAlertConstructInfoOss.class)
public class BusinessAlertConstructInfoOssVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ExcelProperty(value = "主键")
private Long id;
/**
* 施工信息ID
*/
@ExcelProperty(value = "施工信息ID")
private Long alertConstructInfoId;
/**
* 施工信息
*/
@ExcelProperty(value = "施工信息")
private Long alertConstructInfoName;
/**
* 文件名
*/
@ExcelProperty(value = "文件名")
private String fileName;
/**
* 原名
*/
@ExcelProperty(value = "原名")
private String originalName;
/**
* 文件后缀名
*/
@ExcelProperty(value = "文件后缀名")
private String fileSuffix;
/**
* URL地址
*/
@ExcelProperty(value = "URL地址")
private String url;
private String previewUrl;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
/**
* 服务商
*/
@ExcelProperty(value = "服务商")
private String service;
}

5
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java

@ -7,11 +7,12 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -100,5 +101,7 @@ public class BusinessAlertConstructInfoVo implements Serializable {
@ExcelProperty(value = "备注")
private String remark;
private List<BusinessAlertConstructInfoOss> alertConstructInfoOssList;//文件列表
}

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

@ -232,4 +232,16 @@ public class BusinessAlertVo implements Serializable {
* 无人机俯视角
*/
private String gimbalPitch;
/**
* 画框的四个角度参数
*/
private Integer lx;
private Integer ly;
private Integer rx;
private Integer ry;
}

29
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessLayerVo.java

@ -6,15 +6,18 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.business.domain.BusinessLayer;
import org.dromara.business.domain.BusinessTask;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import java.io.Serial;
import java.util.Date;
import java.util.List;
@Data
@ExcelIgnoreUnannotated
@ -28,29 +31,43 @@ public class BusinessLayerVo {
*/
private Long id;
/**
* 用于前端渲染
*/
private Long key;
private String layerName;
/*0:禁用 1:启用*/
private Boolean enable;
/**
* 时间
* */
private Date createTime;
* 0菜单 1三维 2矢量 3影像
*/
private Integer layerType;
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "layerType", other = "layer_type")
private String layerTypeName;
private String tenantId;
private Long deptId;
/**
* 图层url
*/
private String layerUrl;
private String deptName;
private String remark;
//排序
private Integer sort;
//父部门id
private Integer parentId;
//父id
private Long parentId;
private List<BusinessLayerVo> children;
}

20
dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoOssMapper.java

@ -0,0 +1,20 @@
package org.dromara.business.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 预警任务-施工信息-ossMapper接口
*
* @author szs
* @date 2025-06-04
*/
public interface BusinessAlertConstructInfoOssMapper extends BaseMapperPlus<BusinessAlertConstructInfoOss, BusinessAlertConstructInfoOssVo> {
Page<BusinessAlertConstructInfoOss> selectVoPageData(@Param("page") Page<BusinessAlertConstructInfoOss> page,@Param("ew") QueryWrapper<BusinessAlertConstructInfoOss> qw);
}

4
dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessLayerMapper.java

@ -9,8 +9,12 @@ import org.dromara.business.domain.bo.BusinessLayerBo;
import org.dromara.business.domain.bo.BusinessTaskBo;
import org.dromara.business.domain.vo.BusinessLayerVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
public interface BusinessLayerMapper extends BaseMapperPlus<BusinessLayer, BusinessLayerVo> {
Page<BusinessLayerVo> queryPageList(@Param("page") Page<?> page, @Param("bo") BusinessLayerBo bo);
List<BusinessLayerVo> selectInfoByParent(@Param("parentId") Long parentId);
}

69
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoOssService.java

@ -0,0 +1,69 @@
package org.dromara.business.service;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo;
import org.dromara.business.domain.bo.BusinessAlertConstructInfoOssBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 预警任务-施工信息-ossService接口
*
* @author szs
* @date 2025-06-04
*/
public interface IBusinessAlertConstructInfoOssService {
/**
* 查询预警任务-施工信息-oss
*
* @param id 主键
* @return 预警任务-施工信息-oss
*/
BusinessAlertConstructInfoOssVo queryById(Long id);
/**
* 分页查询预警任务-施工信息-oss列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 预警任务-施工信息-oss分页列表
*/
TableDataInfo<BusinessAlertConstructInfoOss> queryPageList(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery);
/**
* 查询符合条件的预警任务-施工信息-oss列表
*
* @param bo 查询条件
* @return 预警任务-施工信息-oss列表
*/
List<BusinessAlertConstructInfoOssVo> queryList(BusinessAlertConstructInfoOssBo bo);
/**
* 新增预警任务-施工信息-oss
*
* @param bo 预警任务-施工信息-oss
* @return 是否新增成功
*/
Boolean insertByBo(BusinessAlertConstructInfoOssBo bo);
/**
* 修改预警任务-施工信息-oss
*
* @param bo 预警任务-施工信息-oss
* @return 是否修改成功
*/
Boolean updateByBo(BusinessAlertConstructInfoOssBo bo);
/**
* 校验并批量删除预警任务-施工信息-oss信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

5
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessLayerService.java

@ -5,6 +5,8 @@ import org.dromara.business.domain.vo.BusinessLayerVo;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import java.util.List;
public interface IBusinessLayerService {
/**
@ -19,4 +21,7 @@ public interface IBusinessLayerService {
Boolean insert(BusinessLayerBo bo);
Boolean update(BusinessLayerBo bo);
Boolean delete(Long id);
List<BusinessLayerVo> optionSelect();
}

193
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoOssServiceImpl.java

@ -0,0 +1,193 @@
package org.dromara.business.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.dromara.business.domain.BusinessAlert;
import org.dromara.business.service.IBusinessAlertConstructInfoOssService;
import org.dromara.business.utils.MinioUntil;
import org.dromara.business.utils.constants.MinIOConstants;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import org.dromara.business.domain.bo.BusinessAlertConstructInfoOssBo;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo;
import org.dromara.business.mapper.BusinessAlertConstructInfoOssMapper;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 预警任务-施工信息-ossService业务层处理
*
* @author szs
* @date 2025-06-04
*/
@RequiredArgsConstructor
@Service
public class BusinessAlertConstructInfoOssServiceImpl implements IBusinessAlertConstructInfoOssService {
private final BusinessAlertConstructInfoOssMapper baseMapper;
/**
* 查询预警任务-施工信息-oss
*
* @param id 主键
* @return 预警任务-施工信息-oss
*/
@Override
public BusinessAlertConstructInfoOssVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询预警任务-施工信息-oss列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 预警任务-施工信息-oss分页列表
*/
@Override
public TableDataInfo<BusinessAlertConstructInfoOss> queryPageList(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery) {
QueryWrapper<BusinessAlertConstructInfoOss> wrapper = buildQueryWrapperQuery(bo);
Page<BusinessAlertConstructInfoOss> result = baseMapper.selectVoPageData(pageQuery.build(), wrapper);
result.getRecords().forEach(item -> {
item.setPreviewUrl(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_NANTONG, item.getUrl(), 3600).toString());
});
return TableDataInfo.build(result);
}
/**
* 查询符合条件的预警任务-施工信息-oss列表
*
* @param bo 查询条件
* @return 预警任务-施工信息-oss列表
*/
@Override
public List<BusinessAlertConstructInfoOssVo> queryList(BusinessAlertConstructInfoOssBo bo) {
LambdaQueryWrapper<BusinessAlertConstructInfoOss> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<BusinessAlertConstructInfoOss> buildQueryWrapper(BusinessAlertConstructInfoOssBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<BusinessAlertConstructInfoOss> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getAlertConstructInfoId() != null, BusinessAlertConstructInfoOss::getAlertConstructInfoId, bo.getAlertConstructInfoId());
lqw.like(bo.getAlertConstructInfoName() != null, BusinessAlertConstructInfoOss::getAlertConstructInfoName, bo.getAlertConstructInfoName());
lqw.like(StringUtils.isNotBlank(bo.getFileName()), BusinessAlertConstructInfoOss::getFileName, bo.getFileName());
lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), BusinessAlertConstructInfoOss::getOriginalName, bo.getOriginalName());
lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), BusinessAlertConstructInfoOss::getFileSuffix, bo.getFileSuffix());
lqw.eq(StringUtils.isNotBlank(bo.getUrl()), BusinessAlertConstructInfoOss::getUrl, bo.getUrl());
lqw.eq(StringUtils.isNotBlank(bo.getService()), BusinessAlertConstructInfoOss::getService, bo.getService());
return lqw;
}
private QueryWrapper<BusinessAlertConstructInfoOss> buildQueryWrapperQuery(BusinessAlertConstructInfoOssBo bo) {
QueryWrapper<BusinessAlertConstructInfoOss> wrapper = new QueryWrapper<>();
if(ObjectUtil.isNotEmpty(bo.getId())){
wrapper.eq("t.id", bo.getId());
}
if(ObjectUtil.isNotEmpty(bo.getAlertConstructInfoId())){
wrapper.eq("t.alert_construct_info_id", bo.getAlertConstructInfoId());
}
if(ObjectUtil.isNotEmpty(bo.getAlertConstructInfoName())){
wrapper.eq("t.alert_construct_info_name", bo.getAlertConstructInfoName());
}
if(ObjectUtil.isNotEmpty(bo.getFileName())){
wrapper.eq("t.file_name", bo.getFileName());
}
if(ObjectUtil.isNotEmpty(bo.getOriginalName())){
wrapper.eq("t.original_name", bo.getOriginalName());
}
if(ObjectUtil.isNotEmpty(bo.getFileSuffix())){
wrapper.eq("t.file_suffix", bo.getFileSuffix());
}
if(ObjectUtil.isNotEmpty(bo.getUrl())){
wrapper.eq("t.url", bo.getUrl());
}
if(ObjectUtil.isNotEmpty(bo.getCreateDept())){
wrapper.eq("t.create_dept", bo.getCreateDept());
}
if(ObjectUtil.isNotEmpty(bo.getCreateTime())){
wrapper.eq("t.create_time", bo.getCreateTime());
}
if(ObjectUtil.isNotEmpty(bo.getCreateBy())){
wrapper.eq("t.create_by", bo.getCreateBy());
}
if(ObjectUtil.isNotEmpty(bo.getUpdateTime())){
wrapper.eq("t.update_time", bo.getUpdateTime());
}
if(ObjectUtil.isNotEmpty(bo.getUpdateBy())){
wrapper.eq("t.update_by", bo.getUpdateBy());
}
if(ObjectUtil.isNotEmpty(bo.getRemark())){
wrapper.eq("t.remark", bo.getRemark());
}
if(ObjectUtil.isNotEmpty(bo.getService())){
wrapper.eq("t.service", bo.getService());
}
return wrapper;
}
/**
* 新增预警任务-施工信息-oss
*
* @param bo 预警任务-施工信息-oss
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(BusinessAlertConstructInfoOssBo bo) {
BusinessAlertConstructInfoOss add = MapstructUtils.convert(bo, BusinessAlertConstructInfoOss.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改预警任务-施工信息-oss
*
* @param bo 预警任务-施工信息-oss
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(BusinessAlertConstructInfoOssBo bo) {
BusinessAlertConstructInfoOss update = MapstructUtils.convert(bo, BusinessAlertConstructInfoOss.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(BusinessAlertConstructInfoOss entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除预警任务-施工信息-oss信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}

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

@ -3,10 +3,12 @@ package org.dromara.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -18,6 +20,7 @@ import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.business.api.domain.bo.RemoteBusinessAlertBo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertConstructInfo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo;
@ -42,11 +45,14 @@ import org.dromara.common.core.utils.StreamUtils;
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.resource.api.RemoteMessageService;
import org.dromara.system.api.RemoteLabelPostService;
import org.dromara.system.api.RemoteSubmailConfigService;
import org.dromara.system.api.RemoteUserService;
import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import org.dromara.business.mapper.BusinessAlertConstructInfoOssMapper;
import org.dromara.workflow.api.RemoteWorkflowService;
import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.springframework.beans.BeanUtils;
@ -66,6 +72,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -84,6 +91,7 @@ import java.util.Base64;
@RequiredArgsConstructor
@Service
@Slf4j
@DubboService
public class BusinessAlertServiceImpl implements IBusinessAlertService {
private final BusinessAlertMapper baseMapper;
@ -93,6 +101,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
@Autowired
private BusinessAlertConstructInfoMapper businessAlertConstructInfoMapper;
@Autowired
private BusinessAlertConstructInfoOssMapper businessAlertConstructInfoOssMapper;
@DubboReference(timeout = 30000)
RemoteWorkflowService remoteWorkflowService;
@ -108,6 +119,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
@Autowired
FeignDeviceGroup feignDeviceGroup;
@DubboReference
private final RemoteMessageService remoteMessageService;
/**
* 新增预警任务
*
@ -172,6 +186,15 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
for (BusinessAlertVo alertVo : alertVoList) {
Map<String,Object>map=new HashMap<>();
alertVo.setBusinessType(2);
//构建pixel
JSONObject pixelJson = new JSONObject();
pixelJson.put("lef_x",alertVo.getLx());
pixelJson.put("lef_y",alertVo.getLy());
pixelJson.put("right_x",alertVo.getRx());
pixelJson.put("right_y",alertVo.getRy());
alertVo.setPixelCoordinate(pixelJson.toJSONString());
BusinessAlert alert = addBusinessAlert(alertVo);
RemoteStartProcess startProcess = new RemoteStartProcess();
startProcess.setBusinessId(String.valueOf(alert.getId()));
@ -187,6 +210,25 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
map.put("jobName",alert.getJobName());
noticeList.add(map);
remoteStartProcessList.add(startProcess);
//推送消息-基于部门-找用户 发送json格式
ArrayList<Long> deptIds = new ArrayList<>();
deptIds.add(Long.parseLong(alert.getDeptId()));
List<RemoteUserVo> remoteUserVos = remoteUserService.selectUsersByDeptIds(deptIds);
List<Long> userIds = remoteUserVos.stream().map(RemoteUserVo::getUserId).collect(Collectors.toList());
JSONObject jsonObject = new JSONObject();
String imagePreviewUrl = MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, alertVo.getImages(), 3600).toString();
jsonObject.put("deptId", alert.getDeptId());
jsonObject.put("deptName", alert.getDeptName());
jsonObject.put("images", imagePreviewUrl);
jsonObject.put("labelCn", alert.getLabelCn());
jsonObject.put("lat", alert.getLat());
jsonObject.put("lng", alert.getLng());
jsonObject.put("createTime", ObjectUtil.isNotEmpty(alert.getCreateTime()) ? alert.getCreateTime() : new Date());
jsonObject.put("jobName", alert.getJobName());
remoteMessageService.publishMessage(userIds, jsonObject.toString() );
System.out.println("已发送:"+ "预警内容:"+ jsonObject.toString());
}
int startIndex = 0; // 从第 0 条开始
@ -197,6 +239,14 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
});
remoteSubmailConfigService.remoteSend("smsMultixsend",noticeList);
//推送消息-基于部门-找用户-批量
// List<String> deptStrIds = alertVoList.stream().map(BusinessAlertVo::getDeptId).distinct().collect(Collectors.toList());
// List<Long> deptIds = deptStrIds.stream().map(Long::parseLong).collect(Collectors.toList());
// List<RemoteUserVo> remoteUserVos = remoteUserService.selectUsersByDeptIds(deptIds);
// List<Long> userIds = remoteUserVos.stream().map(RemoteUserVo::getUserId).collect(Collectors.toList());
//
// remoteMessageService.publishMessage(userIds, "预警");
}
/**
@ -524,9 +574,23 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
LambdaQueryWrapper<BusinessAlertConstructInfo> qw = new LambdaQueryWrapper<BusinessAlertConstructInfo>();
qw.in(BusinessAlertConstructInfo::getBusinessAlertId, alertIds);
List<BusinessAlertConstructInfoVo> constructInfoVoList = businessAlertConstructInfoMapper.selectVoList(qw,BusinessAlertConstructInfoVo.class);
List<Long> constructInfoIds = constructInfoVoList.stream().map(BusinessAlertConstructInfoVo::getId).collect(Collectors.toList());
List<BusinessAlertConstructInfoOss> alertConstructInfoOssList = new ArrayList<>();
if(!constructInfoIds.isEmpty()){
LambdaQueryWrapper<BusinessAlertConstructInfoOss> alertConstructOssQw = new LambdaQueryWrapper<>();
alertConstructOssQw.in(BusinessAlertConstructInfoOss::getAlertConstructInfoId,constructInfoIds);
alertConstructInfoOssList = businessAlertConstructInfoOssMapper.selectVoList(alertConstructOssQw, BusinessAlertConstructInfoOss.class);
}
for (BusinessAlert record : page.getRecords()) {
BusinessAlertConstructInfoVo businessAlertConstructInfoVo = constructInfoVoList.stream().filter(item -> item.getBusinessAlertId().equals(record.getId())).findFirst().orElse(null);
if(ObjectUtil.isNotNull(businessAlertConstructInfoVo)){
List<BusinessAlertConstructInfoOss> constructInfoOssList = alertConstructInfoOssList.stream().filter(item -> item.getAlertConstructInfoId().equals(businessAlertConstructInfoVo.getId())).collect(Collectors.toList());
businessAlertConstructInfoVo.setAlertConstructInfoOssList(constructInfoOssList);
}
record.setAlertConstructInfoVo(businessAlertConstructInfoVo);
}
}

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

@ -428,6 +428,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
if (ObjectUtil.isEmpty(postVoList)) {
return ListUtil.empty();
@ -457,6 +461,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
List<StatObj> result = new ArrayList<>();
@ -507,6 +515,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
List<StatObj> result = new ArrayList<>();
if (ObjectUtil.isEmpty(postVoList)) {
@ -547,6 +559,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
List<String> monthList = getLastSixMonths();

89
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessLayerServiceImpl.java

@ -2,46 +2,131 @@ package org.dromara.business.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.convert.impl.MapConverter;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.business.domain.BusinessLayer;
import org.dromara.business.domain.bo.BusinessLayerBo;
import org.dromara.business.domain.model.enums.LayerTypeEnum;
import org.dromara.business.domain.vo.BusinessLayerVo;
import org.dromara.business.mapper.BusinessLayerMapper;
import org.dromara.business.service.IBusinessLayerService;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.system.api.RemoteDeptService;
import org.dromara.system.api.domain.vo.RemoteDeptVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@RequiredArgsConstructor
@Service
public class BusinessLayerServiceImpl implements IBusinessLayerService {
private final BusinessLayerMapper baseMapper;
@DubboReference
RemoteDeptService remoteDeptService;
@Override
public TableDataInfo<BusinessLayerVo> queryPageList(BusinessLayerBo bo, PageQuery pageQuery) {
Page<BusinessLayerVo> result = baseMapper.queryPageList(pageQuery.build(), bo);
result.getRecords().forEach(businessLayerVo -> {
List<BusinessLayerVo> layerVoList = baseMapper.selectInfoByParent(businessLayerVo.getId());
businessLayerVo.setChildren(buildTree(layerVoList,businessLayerVo.getId()));
});
return TableDataInfo.build(result);
}
@Override
public Boolean insert(BusinessLayerBo bo) {
BusinessLayer layerVo = Convert.convert( BusinessLayer.class,bo);
RemoteDeptVo remoteDeptVo = remoteDeptService.selectDeptById(layerVo.getDeptId());
layerVo.setDeptName(remoteDeptVo.getDeptName());
return baseMapper.insert(layerVo)>0;
}
@Override
public Boolean update(BusinessLayerBo bo) {
BusinessLayer layerVo = Convert.convert( BusinessLayer.class,bo);
return baseMapper.updateById(layerVo)>0;
BusinessLayer businessLayer = baseMapper.selectById(bo.getId());
//判断是否修改部门
if (!businessLayer.getDeptId().equals(bo.getDeptId())) {
RemoteDeptVo remoteDeptVo = remoteDeptService.selectDeptById(bo.getDeptId());
bo.setDeptName(remoteDeptVo.getDeptName());
}
BeanUtils.copyProperties(bo,businessLayer);
return baseMapper.updateById(businessLayer)>0;
}
@Override
public Boolean delete(Long id) {
return baseMapper.deleteById(id)>0;
}
@Override
public List<BusinessLayerVo> optionSelect() {
List<BusinessLayerVo> layerVoList = baseMapper.selectInfoByParent(0L);
if (ObjectUtil.isEmpty(layerVoList)){
return List.of();
}
return layerVoList.stream().filter(p-> p.getLayerType().equals(LayerTypeEnum.menu.getType())).toList();
}
/**
* 构建树
* @param allNodes
* @return
*/
public static List<BusinessLayerVo> buildTree(List<BusinessLayerVo> allNodes, Long parentId) {
// 创建一个Map来存储所有节点,键为ID,值为节点
Map<Long, BusinessLayerVo> nodeMap = new HashMap<>();
for (BusinessLayerVo node : allNodes) {
nodeMap.put(node.getId(), node);
}
// 用来存储根节点(即 parentId 为传入值的节点)
List<BusinessLayerVo> rootNodes = new ArrayList<>();
// 遍历所有节点,将子节点添加到父节点的 children 列表中
for (BusinessLayerVo node : allNodes) {
if (node.getParentId().equals(parentId)) {
rootNodes.add(node); // 当前节点的 parentId 与传入的 parentId 匹配,作为根节点
} else {
BusinessLayerVo parentNode = nodeMap.get(node.getParentId());
if (parentNode != null) {
// 确保父节点的 children 列表已初始化
if (parentNode.getChildren() == null) {
parentNode.setChildren(new ArrayList<>());
}
parentNode.getChildren().add(node); // 将当前节点添加到父节点的 children 列表中
}
}
}
return rootNodes;
}
}

3
dk-modules/business/src/main/java/org/dromara/business/utils/constants/MinIOConstants.java

@ -17,4 +17,7 @@ public interface MinIOConstants {
String BUCKET_ALERT = "alert";
//桶名称 图斑
String BUCKET_PATTERN = "pattern";
//南通-丰县Buskcet
String BUCKET_NANTONG = "nantongsitebucket";
}

12
dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoOssMapper.xml

@ -0,0 +1,12 @@
<?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.BusinessAlertConstructInfoOssMapper">
<select id="selectVoPageData" resultType="org.dromara.business.domain.BusinessAlertConstructInfoOss">
select t.* from business_alert_construct_info_oss t
${ew.getCustomSqlSegment}
</select>
</mapper>

65
dk-modules/business/src/main/resources/mapper/business/BusinessLayerMapper.xml

@ -6,6 +6,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryPageList" resultType="org.dromara.business.domain.vo.BusinessLayerVo">
SELECT
t.id,
t.id as 'key',
t.layer_name as layerName,
t.enable,
t.remark,
t.layer_type as layerType,
t.layer_url as layerUrl,
t.dept_id as deptId,
t.dept_name AS deptName,
t.tenant_id as tenantId,
t.create_time AS createTime,
t.sort,
t.parent_id AS parentId
FROM
business_layer t
<where>
t.parent_id = 0
<if test="bo.parentId != null and bo.parentId != ''">
and t.parent_id = #{bo.parentId}
</if>
<if test="bo.layerType != null and bo.layerType != ''">
and t.layer_type = #{bo.layerType}
</if>
<if test="bo.deptId != null and bo.deptId != ''">
and t.dept_id = #{bo.deptId}
</if>
<if test="bo.enable != null and bo.enable != ''">
and t.enable = #{bo.enable}
</if>
<if test="bo.layerName != null and bo.layerName != ''">
and t.layer_name like CONCAT(#{bo.layerName}, '%')
</if>
<if test="bo.deptName != null and bo.deptName != ''">
and t.dept_name like CONCAT(#{bo.deptName}, '%')
</if>
<choose>
<when test="bo.startTime != null and bo.endTime != null">
and t.create_time between #{bo.startTime} and #{bo.endTime}
</when>
<when test="bo.startTime != null">
and t.create_time &gt;= #{bo.startTime}
</when>
<when test="bo.endTime != null">
and t.create_time &lt;= #{bo.endTime}
</when>
</choose>
</where>
order by t.parent_id , t.sort
</select>
<select id="selectInfoByParent" resultType="org.dromara.business.domain.vo.BusinessLayerVo">
WITH RECURSIVE business_hierarchy AS (
SELECT bl.*,bl.id as 'key'
FROM business_layer bl
WHERE parent_id = #{parentId}
UNION ALL
-- 递归查询,选择当前节点的子项
SELECT bla.*,bla.id as 'key'
FROM business_layer bla
JOIN business_hierarchy bh ON bla.parent_id = bh.id
)
-- 最终查询
SELECT * FROM business_hierarchy;
</select>
</mapper>

4
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceServiceImpl.java

@ -57,6 +57,7 @@ import org.springframework.util.StringUtils;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@ -247,6 +248,9 @@ public class DeviceServiceImpl implements IDeviceService {
if(proIds == null){
proIds = deviceProService.listDeviceGroup(loginUser.getUserId());
}
if(ObjectUtil.isEmpty(proIds)){
return new ArrayList<DeviceDTO>();
}
List<DeviceDTO> devicesList = this.getDevicesByParams(
DeviceQueryParam.builder()
.workspaceId(workspaceId)

1
dk-modules/sample/src/main/java/org/dromara/sample/media/service/IFileService.java

@ -88,6 +88,7 @@ public interface IFileService {
List<MediaFileDTO> getMediaFileDTO( String jobId,String fileType);
String copyFile(String sourceBucket, String originFileUrl, String targetBucket);
String copyFileHttp(String fileUrl, String originFileUrl, String bucketDkcy);
Double getGimbalYawDegree(String fileId);
}

33
dk-modules/sample/src/main/java/org/dromara/sample/media/service/impl/FileServiceImpl.java

@ -1,11 +1,14 @@
package org.dromara.sample.media.service.impl;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.dromara.common.core.utils.file.MimeTypeUtils;
import org.dromara.common.oss.core.OssClient;
import org.dromara.common.oss.entity.UploadResult;
import org.dromara.common.oss.factory.OssFactory;
import org.dromara.common.redis.utils.RedisOpsUtils;
import org.dromara.common.satoken.utils.LoginHelper;
@ -29,8 +32,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
import java.util.stream.Collectors;
@ -202,6 +208,33 @@ public class FileServiceImpl implements IFileService {
return fileUrl;
}
@Override
public String copyFileHttp(String aliyunUrl, String originFileUrl, String minioBucket) {
try {
URL url = new URL(aliyunUrl);
URLConnection conn = url.openConnection();
conn.setConnectTimeout(3_500);
conn.setReadTimeout(3_500);
InputStream inputStream = conn.getInputStream();
long fileSize = conn.getContentLengthLong();
String fileName = FileUtil.getName(url.getPath());
// String path = url.getPath().replace(fileName, deviceSn+ fileName); // eg: /ai/report/29847/{deviceSn+xxx.jpg}
// String originalFileName = path.substring(path.lastIndexOf("/") + 1); // qwfbGaBixI.jpg
// String suffix = originalFileName.contains(".") ? originalFileName.substring(originalFileName.lastIndexOf(".")) : ".jpg"; // fallback
// String newFileName = IdUtils.fastUUID() + suffix;
OssClient minioClient = OssFactory.instance(minioBucket);
UploadResult result = minioClient.upload(inputStream, originFileUrl, fileSize, MimeTypeUtils.IMAGE_JPG);
// MinioUtil.uploadFile(path,inputStream,);
inputStream.close();
return result.getUrl(); // 返回 MinIO 的访问地址
} catch (IOException e) {
throw new RuntimeException("上传图片失败", e);
}
}
@Override
public Double getGimbalYawDegree(String fileId) {
LambdaQueryWrapper<MediaFileEntity> wrapper = new LambdaQueryWrapper<>();

15
dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java

@ -214,7 +214,7 @@ public class AiCompareServiceImpl implements IAiCompareService {
aiCompareEntity.setId(frameDTO.getCompareId());
aiCompareMapper.updateById(aiCompareEntity);
frameDTO.setJobName(aiCompareEntity.getJobName());
String originFileUrl = frameDTO.getFileUrl();
String originFileUrl = frameDTO.getFileUrl();//waiwang/b0c5dc04-6232-4762-b748-16f8e6ea04ed/DJI_202506010857_001_b0c5dc04-6232-4762-b748-16f8e6ea04ed/DJI_20250601085925_0001_V.jpeg
String fileUrl = fileService.getObjectUrlOne(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, 3600).toString();
frameDTO.setFileUrl(fileUrl);
String originMateFileUrl = frameDTO.getMateFileUrl();
@ -234,9 +234,20 @@ public class AiCompareServiceImpl implements IAiCompareService {
//图片处理
// fileService.get(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, 3600);
//复制原图到指定bucket
//复制原图到指定bucket //mediafile
// originMateFileUrl:waiwang/b9e5ae94-e290-43af-9f66-12031580aba1/DJI_202506020949_001_b9e5ae94-e290-43af-9f66-12031580aba1/DJI_20250602095106_0001_V.jpeg
String linkType = "";
if(StrUtil.startWith(fileUrl,"http")){
linkType = "http";
//http://yq-dajiang.oss-cn-hangzhou.aliyuncs.com/waiwang/56055519-3189-4af9-b4ea-56fe06df3082/DJI_202506010952_001_56055519-3189-4af9-b4ea-56fe06df3082/DJI_20250601100131_0001_V.jpeg
String fileUrlStr = fileService.copyFileHttp(fileUrl, originFileUrl, MinIOConstants.BUCKET_DKCY);
String fileMateUrlStr = fileService.copyFileHttp(mateFileUrl, originMateFileUrl, MinIOConstants.BUCKET_DKCY);
}else{
String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, MinIOConstants.BUCKET_DKCY);
// String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, MinIOConstants.BUCKET_ALERT);
}
ArrayList<RemoteBusinessAlertVo> alertVoList = new ArrayList<>();
//手动简化逻辑,上传图片
int frameCount =0;

29
dk-modules/system/src/main/java/org/dromara/system/controller/system/SysDepartBoundaryController.java

@ -5,19 +5,17 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.domain.SysDepartBoundary ;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.SysDepartBoundary;
import org.dromara.system.domain.bo.SysDepartBoundaryBo;
import org.dromara.system.service.ISysDepartBoundaryService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 部门区域
@ -40,7 +38,6 @@ public class SysDepartBoundaryController extends BaseController {
@Operation(summary ="查询部门的地理位置",description = "查询部门的地理位置")
@GetMapping(value = "/listJson")
public R<List<SysDepartBoundaryBo>> listJson(SysDepartBoundary departBoundary) {
// departBoundary.setDeptId(String.valueOf(LoginHelper.getDeptId()));
List<SysDepartBoundaryBo> listJson = departBoundaryService.listJson(departBoundary);
return R.ok("查询成功!",listJson);
}
@ -61,22 +58,12 @@ public class SysDepartBoundaryController extends BaseController {
* 解析shp文件
* @return
*/
@Operation(summary ="批量新增部门区域",description = "批量新增部门区域")
@Operation(summary ="新增部门区域",description = "新增部门区域(areaType: 0:市级 1:区级(县) 2:镇级(街道) 3:村级)")
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public R<Void> uploadShpFile(@RequestParam("file") MultipartFile file,@RequestParam("areaType") Integer areaType) {
return toAjax(departBoundaryService.uploadShpFile(file,areaType));
}
/**
* 编辑
*
* @param
* @return
*/
@Operation(summary ="编辑部门区域",description = "编辑部门区域")
@RequestMapping(value = "/update", method = RequestMethod.POST)
public R<Void> updateDepartBoundary(@RequestBody SysDepartBoundary departBoundary) {
return toAjax(departBoundaryService.updateDepartBoundary(departBoundary));
public R<Void> uploadShpFile(@RequestParam("file") MultipartFile file,
@RequestParam("areaType") Integer areaType,
@RequestParam("parentId") Long parentId) {
return toAjax(departBoundaryService.uploadShpFile(file,areaType,parentId));
}
@ -91,8 +78,4 @@ public class SysDepartBoundaryController extends BaseController {
public R<Void> deleteDepartBoundary(@RequestParam(name = "id") String id) {
return toAjax(departBoundaryService.deleteDepartBoundary(id));
}
}

39
dk-modules/system/src/main/java/org/dromara/system/domain/SysDepartBoundary.java

@ -25,53 +25,24 @@ public class SysDepartBoundary extends BaseEntity {
@TableId(type = IdType.AUTO)
private String id;
/**
* 租户Id
*/
private String tenantId;
/**机构ID*/
private String deptId;
private Long deptId;
/**机构/部门名称*/
private String deptName;
/**是否显示0显示,1不显示*/
private Integer type;
/**边界*/
private String communityName;
/**部门全路径*/
private String namePath;
/**边界*/
private String boundary;
/**
* 周长
*/
private Double perimeter;
/**
* 面积平方公里
*/
private Double area;
/**
* 面积亩
*/
private Double areaMu;
/**
* 编号
*/
private String shpNo;
/**
* 区域类别
* 区域类别 areaType: 0市级 1区级() 2镇级(街道) 3村级
*/
private Integer areaType;
/**删除状态(0,正常,1已删除)*/
private String delFlag;
private List<String> deptIds;
}

4
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteDeptServiceImpl.java

@ -50,8 +50,8 @@ public class RemoteDeptServiceImpl implements RemoteDeptService {
}
@Override
public List<Map<String,Object>> getNamePathList() {
return sysDeptService.getNamePathList();
public List<Map<String,Object>> getNamePathList(Long deptId) {
return sysDeptService.getNamePathList(deptId);
}
@Override

1
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java

@ -41,6 +41,7 @@ public class RemotePostServiceImpl implements RemotePostService {
remotePostVo.setPostName(aiLabel.getPostName());
remotePostVo.setPostCode(aiLabel.getPostCode());
remotePostVo.setStatus(aiLabel.getStatus());
remotePostVo.setPostCategory(aiLabel.getPostCategory());
return remotePostVo;
})
.collect(Collectors.toList());

2
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteSubmailConfigServiceImpl.java

@ -17,6 +17,7 @@ import org.dromara.system.service.ISysUserService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -56,6 +57,7 @@ public class RemoteSubmailConfigServiceImpl implements RemoteSubmailConfigServic
public void remoteSend(String code, List<Map<String, Object>> alertList) {
if(!alertList.isEmpty()){
for (Map<String, Object> map : alertList) {
map.put("createTime",new Date());
Long deptId = Convert.toLong(map.get("deptId"));
List<SysUserVo> sysUserVos = userService.selectUserListByDept(Convert.toLong(deptId));
Set<String> phones = sysUserVos.stream().filter(u -> u.getNoticeType() == 1 && StrUtil.isNotEmpty(u.getPhonenumber())).map(SysUserVo::getPhonenumber).collect(Collectors.toSet());

2
dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java

@ -71,7 +71,7 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
})
Page<SysDeptVo> selectPageDeptList(@Param("page") Page<SysDeptVo> page, @Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
List<Map<String,Object>> getNamePathList();
List<Map<String,Object>> getNamePathList(@Param("deptId") Long deptId);
List<SysDeptVo> listTreeDept(@Param("deptId") Long deptId, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);
}

2
dk-modules/system/src/main/java/org/dromara/system/service/ISysDepartBoundaryService.java

@ -20,7 +20,7 @@ public interface ISysDepartBoundaryService extends IService<SysDepartBoundary>{
List<SysDepartBoundary> queryByDeptId(String deptId);
boolean uploadShpFile(MultipartFile file,Integer areaType);
boolean uploadShpFile(MultipartFile file,Integer areaType,Long parentId);
boolean deleteDepartBoundary(String id);

5
dk-modules/system/src/main/java/org/dromara/system/service/ISysDeptService.java

@ -1,6 +1,7 @@
package org.dromara.system.service;
import cn.hutool.core.lang.tree.Tree;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.vo.SysDeptVo;
@ -144,7 +145,7 @@ public interface ISysDeptService {
* 查询每个部门的所属的部门全路径
* @return
*/
List<Map<String,Object>> getNamePathList();
List<Map<String,Object>> getNamePathList(Long deptId);
/**
* 根据父级找子级
@ -157,4 +158,6 @@ public interface ISysDeptService {
SysDeptVo getByParentId(String deptId);
List<SysDeptVo> listTreeDept(Long deptId);
SysDept addBoundaryDept(SysDeptBo sysDeptBo);
}

50
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDepartBoundaryServiceImpl.java

@ -8,11 +8,15 @@ import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.system.api.domain.vo.RemoteDeptVo;
import org.dromara.system.domain.SysDepartBoundary;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.SysGeospatialVectors;
import org.dromara.system.domain.SysVectorDict;
import org.dromara.system.domain.bo.SysDepartBoundaryBo;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.mapper.SysDepartBoundaryMapper;
import org.dromara.system.service.ISysDepartBoundaryService;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysVectorDictService;
import org.dromara.system.utils.BatchProcessorUtil;
import org.dromara.system.utils.ShpAnalysisUtil;
@ -42,8 +46,7 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
private final ISysVectorDictService vectorDictService;
@DubboReference
RemoteDeptService remoteDeptService;
private final ISysDeptService deptService;
@Override
public TableDataInfo<SysDepartBoundary> listSysDepartBoundary(PageQuery pageQuery, SysDepartBoundary departBoundary) {
@ -65,12 +68,12 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
@Override
@Transactional(rollbackFor = Exception.class)
public boolean uploadShpFile(MultipartFile file,Integer areaType) {
public boolean uploadShpFile(MultipartFile file,Integer areaType,Long parentId) {
try {
List<SysGeospatialVectors> geospatialVectorsList = buildGeospatialVector(file);
//6、生成新的对象集合存储数据表中
List<SysDepartBoundary> boundaryList = buildBusinessDepartBoundary(geospatialVectorsList,areaType);
List<SysDepartBoundary> boundaryList = buildBusinessDepartBoundary(geospatialVectorsList,areaType,parentId);
// 分批处理
int startIndex = 0; // 从第 0 条开始
@ -176,20 +179,20 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
@Override
public List<SysDepartBoundaryBo> listJson(SysDepartBoundary departBoundary) {
if(StringUtils.isBlank(departBoundary.getDeptId())){
if(ObjectUtil.isEmpty(departBoundary.getDeptId())){
throw new ServiceException("部门【id】不存在");
}
SysDepartBoundaryBo child = new SysDepartBoundaryBo();
child.setDepartId(String.valueOf(departBoundary.getDeptId()));
child.setAreaType(SysDepartBoundaryBo.AreaType.DistrictLevel);
child.setLandCategoriesJson(this.baseMapper.listJson(departBoundary.getDeptId()));
child.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(departBoundary.getDeptId())));
RemoteDeptVo remoteDeptVo = remoteDeptService.getByParentId(departBoundary.getDeptId());
SysDeptVo sysDeptVo = deptService.getByParentId(String.valueOf(departBoundary.getDeptId()));
SysDepartBoundaryBo parent = new SysDepartBoundaryBo();
parent.setDepartId(String.valueOf(remoteDeptVo.getDeptId()));
parent.setDepartId(String.valueOf(sysDeptVo.getDeptId()));
parent.setAreaType(SysDepartBoundaryBo.AreaType.Municipal);
parent.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(remoteDeptVo.getDeptId())));
parent.setLandCategoriesJson(this.baseMapper.listJson(String.valueOf(sysDeptVo.getDeptId())));
return List.of(child,parent);
}
@ -202,6 +205,7 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
throw new ServiceException("实体不存在!");
}
return this.baseMapper.deleteById(departBoundary.getId())>0;
}
@ -211,12 +215,12 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
* @param geospatialVectorsList
* @return
*/
private List<SysDepartBoundary> buildBusinessDepartBoundary(List<SysGeospatialVectors> geospatialVectorsList, Integer areaType) {
private List<SysDepartBoundary> buildBusinessDepartBoundary(List<SysGeospatialVectors> geospatialVectorsList, Integer areaType,Long parentId) {
List<SysDepartBoundary> resultList = new ArrayList<>();
List<Map<String,Object>> namePathList = remoteDeptService.getNamePathList();
List<Map<String,Object>> namePathList = deptService.getNamePathList(null);
Map<String, List<Map<String, Object>>> namePathMap = namePathList.stream()
Map<String, List<Map<String, Object>>> namePathMap = namePathList.stream().filter(p-> Long.valueOf(p.get("parentId").toString()).equals(parentId))
.collect(Collectors.groupingBy(item -> item.get("deptName").toString()));
geospatialVectorsList.forEach(param->{
@ -225,14 +229,30 @@ public class SysDepartBoundaryServiceImpl extends ServiceImpl<SysDepartBoundaryM
String divisionName = param.getAdminDivisionName();
businessDepartBoundary.setBoundary(param.getLandCategories());
//判断是否存在表中,在表中更新部门区域中的部门id信息
if (ObjectUtil.isNotEmpty(namePathMap.get(divisionName))){
Map<String, Object> objectMap = namePathMap.get(divisionName).get(0);
businessDepartBoundary.setShpNo(ObjectUtil.isEmpty(objectMap.get("shpNo"))?null:(String)objectMap.get("shpNo"));
businessDepartBoundary.setDeptName(objectMap.get("deptName") + "");
businessDepartBoundary.setDeptId(objectMap.get("deptId") + "");
businessDepartBoundary.setCommunityName(objectMap.get("namePath") + "");
businessDepartBoundary.setDeptId(Long.valueOf(objectMap.get("deptId") + ""));
businessDepartBoundary.setNamePath(objectMap.get("namePath") + "");
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
}else {
//如果不存在在部门表中则添加
SysDeptBo sysDeptBo = new SysDeptBo();
sysDeptBo.setParentId(parentId);
sysDeptBo.setDeptName(param.getAdminDivisionName());
SysDept sysDept = deptService.addBoundaryDept(sysDeptBo);
List<Map<String,Object>> deptNamePath = deptService.getNamePathList(sysDept.getDeptId());
businessDepartBoundary.setDeptName(sysDept.getDeptName());
businessDepartBoundary.setDeptId(sysDept.getDeptId());
businessDepartBoundary.setNamePath(deptNamePath.getFirst().get("namePath").toString());
businessDepartBoundary.setAreaType(areaType);
resultList.add(businessDepartBoundary);
}
});
return resultList;

19
dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@ -365,8 +365,8 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override
public List<Map<String,Object>> getNamePathList() {
return baseMapper.getNamePathList();
public List<Map<String,Object>> getNamePathList(Long deptId) {
return baseMapper.getNamePathList(deptId);
}
@Override
@ -392,4 +392,19 @@ public class SysDeptServiceImpl implements ISysDeptService {
return baseMapper.listTreeDept(deptId, ptPrefix); //.getTableCloud()
}
@Override
public SysDept addBoundaryDept(SysDeptBo bo) {
SysDept info = baseMapper.selectById(bo.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
throw new ServiceException("部门停用,不允许新增");
}
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
baseMapper.insert(dept);
return dept;
}
}

21
dk-modules/system/src/main/resources/mapper/system/SysDepartBoundaryMapper.xml

@ -79,13 +79,9 @@
INSERT INTO sys_depart_boundary (
dept_id,
dept_name,
community_name,
name_path,
boundary,
perimeter,
area,
area_mu,
shp_no,
village_type,
area_type,
create_by,
create_time,
update_by,
@ -96,13 +92,9 @@
<foreach collection="list" item="item" separator=",">
(#{item.deptId},
#{item.deptName},
#{item.communityName},
#{item.namePath},
ST_GeomFromText(#{item.boundary}),
#{item.perimeter},
#{item.area},
#{item.areaMu},
#{item.shpNo},
#{item.villageType},
#{item.areaType},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
@ -126,9 +118,8 @@
JSON_OBJECT(
'deptId', l.dept_id,
'deptName', l.dept_name,
'adcode', l.shp_no,
'name', l.community_name,
'community_name', l.community_name
'name', l.name_path,
'community_name', l.name_path
),
'geometry',
ST_AsGeoJSON(l.boundary)

16
dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml

@ -52,7 +52,8 @@
sd.dept_name deptName,
CAST(sd.dept_name AS CHAR(500)) AS namePath,
sd.shp_no shpNo,
sd.tenant_id
sd.tenant_id,
sd.parent_id
FROM
sys_dept sd
WHERE
@ -66,7 +67,8 @@
d.dept_name deptName,
CONCAT(dp.namePath, '', d.dept_name) AS namePath,
d.shp_no shpNo,
d.tenant_id
d.tenant_id,
d.parent_id
FROM
sys_dept d
INNER JOIN
@ -77,9 +79,15 @@
namePath,
shpNo,
deptName,
tenant_id
tenant_id,
parent_id parentId
FROM
DeptPath
DeptPath dp
<where>
<if test="deptId != null and deptId != ''">
dp.deptId = #{deptId}
</if>
</where>
ORDER BY
deptId
</select>

Loading…
Cancel
Save