diff --git a/dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java b/dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java index 39f16f0..4efeaad 100644 --- a/dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java +++ b/dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java @@ -16,8 +16,9 @@ public interface RemoteBusinessAlertService { /** * 生成预警,待验证状态 + * activeProfile :用于处理南通/丰县数据类型, default是原始处理流,如果非default就会将businessType处理为2 */ - Boolean saveBusinessAlert(List alertVoList); + Boolean saveBusinessAlert(List alertVoList,String activeProfile); /** * 更新此条预警审批时候的状态 * @param businessId 业务id(预警、工单) diff --git a/dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertConstructInfo.java b/dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertConstructInfo.java new file mode 100644 index 0000000..193ff00 --- /dev/null +++ b/dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertConstructInfo.java @@ -0,0 +1,85 @@ +package org.dromara.business.api.domain.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 预警任务-施工信息对象 business_alert_construct_info + * + * @author szs + * @date 2025-05-21 + */ +@Data +public class RemoteBusinessAlertConstructInfo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + /** + * + */ + private Long id; + + private String tenantId; + + + /** + * 1:图片比对预警 2:AI实时预警 + */ + private Long businessType; + + /** + * job任务id + */ + private String jobId; + + /** + * 预警名称 + */ + private String jobName; + + /** + * 预警任务id + */ + private Long businessAlertId; + + /** + * 施工名称 + */ + private String constructName; + + /** + * 施工单位 + */ + private String constructDept; + + /** + * 施工单位负责人 + */ + private String constructLeader; + + /** + * 联系电话 + */ + private String phonenumber; + + /** + * 施工地址 + */ + private String address; + + /** + * 所属管道 + */ + private String pipeline; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertVo.java b/dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertVo.java index f75e6a4..37958aa 100644 --- a/dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertVo.java +++ b/dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertVo.java @@ -189,5 +189,9 @@ public class RemoteBusinessAlertVo implements Serializable { */ private Integer handleSource; + //预警扩展施工信息 + private RemoteBusinessAlertConstructInfo remoteAlertConstructInfo; +// private Map infoMap; + } diff --git a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/media/api/IHttpMediaService.java b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/media/api/IHttpMediaService.java index b100045..84dbc89 100644 --- a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/media/api/IHttpMediaService.java +++ b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/media/api/IHttpMediaService.java @@ -70,9 +70,10 @@ public interface IHttpMediaService { value = "{\"code\": 0, \"message\":\"success\", \"data\": \"media/DJI_20220831151616_0004_W_Waypoint4.JPG\"}" )}))) - @PostMapping(PREFIX + "/workspaces/{workspace_id}/upload-callback") + @PostMapping(PREFIX + "/workspaces/{workspace_id}/{pro_id}/upload-callback") HttpResultResponse mediaUploadCallback( @PathVariable(name = "workspace_id") String workspaceId, + @PathVariable(name = "pro_id") Integer proId, @Valid @RequestBody MediaUploadCallbackRequest request, HttpServletRequest req, HttpServletResponse rsp); diff --git a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/wayline/api/IHttpWaylineService.java b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/wayline/api/IHttpWaylineService.java index d826853..3815570 100644 --- a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/wayline/api/IHttpWaylineService.java +++ b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/cloudapi/wayline/api/IHttpWaylineService.java @@ -45,9 +45,21 @@ public interface IHttpWaylineService { @Parameter(name = "workspace_id", description = "workspace_id", schema = @Schema(format = "uuid")) }) @GetMapping(PREFIX + "/workspaces/{workspace_id}/waylines") - HttpResultResponse> getWaylineList( + HttpResultResponse> getWaylines( @Valid @ParameterObject GetWaylineListRequest request, @PathVariable(name = "workspace_id") String workspaceId, + @RequestParam(name = "proIds",required = false) List proIds, + HttpServletRequest req, HttpServletResponse rsp); + + + @Operation(summary = "获取航线路线列表", description = "根据查询条件査询路线文件的基本数据。飞行员中的查询条件字段是固定的。", + parameters = { + @Parameter(name = "workspace_id", description = "workspace_id", schema = @Schema(format = "uuid")) + }) + @GetMapping(PREFIX + "/workspaces/{workspace_id}/waylinesList") + HttpResultResponse> getWaylineList( + @PathVariable(name = "workspace_id") String workspaceId, + @RequestParam(name = "pro_id",required = false) Integer proId, HttpServletRequest req, HttpServletResponse rsp); /** diff --git a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock2ThingVersionEnum.java b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock2ThingVersionEnum.java index 0ec0755..4278a9b 100644 --- a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock2ThingVersionEnum.java +++ b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock2ThingVersionEnum.java @@ -12,6 +12,7 @@ import java.util.Arrays; */ public enum Dock2ThingVersionEnum implements IThingVersion { + V1_0_0("1.0.0", CloudSDKVersionEnum.V0_0_1), V1_1_0("1.1.0", CloudSDKVersionEnum.V1_0_0), @@ -24,6 +25,8 @@ public enum Dock2ThingVersionEnum implements IThingVersion { V1_2_3("1.2.3", CloudSDKVersionEnum.V1_0_3), + V1_2_4("1.2.4", CloudSDKVersionEnum.V1_0_3), + V1_3_0("1.3.0", CloudSDKVersionEnum.V1_0_3), diff --git a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock3ThingVersionEnum.java b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock3ThingVersionEnum.java index 68c3fc4..9fde53c 100644 --- a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock3ThingVersionEnum.java +++ b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/Dock3ThingVersionEnum.java @@ -24,6 +24,8 @@ public enum Dock3ThingVersionEnum implements IThingVersion { V1_2_3("1.2.3", CloudSDKVersionEnum.V1_0_3), + V1_2_4("1.2.4", CloudSDKVersionEnum.V1_0_3), + V1_3_0("1.3.0", CloudSDKVersionEnum.V1_0_3), V1_3_1("1.3.1", CloudSDKVersionEnum.V1_0_3), diff --git a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DockThingVersionEnum.java b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DockThingVersionEnum.java index 8b4b807..7876fb1 100644 --- a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DockThingVersionEnum.java +++ b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DockThingVersionEnum.java @@ -24,6 +24,8 @@ public enum DockThingVersionEnum implements IThingVersion { V1_2_3("1.2.3", CloudSDKVersionEnum.V1_0_3), + V1_2_4("1.2.4", CloudSDKVersionEnum.V1_0_3), + V1_3_0("1.3.0", CloudSDKVersionEnum.V1_0_3), V1_3_1("1.3.1", CloudSDKVersionEnum.V1_0_3), diff --git a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DroneThingVersionEnum.java b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DroneThingVersionEnum.java index e662a59..bbdef82 100644 --- a/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DroneThingVersionEnum.java +++ b/dk-common/common-cloudsdk/src/main/java/org/dromara/common/sdk/config/version/DroneThingVersionEnum.java @@ -27,6 +27,8 @@ public enum DroneThingVersionEnum implements IThingVersion { V1_2_3("1.2.3", CloudSDKVersionEnum.V1_0_3), + V1_2_4("1.2.4", CloudSDKVersionEnum.V1_0_3), + V1_3_0("1.3.0", CloudSDKVersionEnum.V1_0_3), V1_3_1("1.3.1", CloudSDKVersionEnum.V1_3_1), diff --git a/dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java b/dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java new file mode 100644 index 0000000..fe48643 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/config/ProjectTablePrefixConfig.java @@ -0,0 +1,26 @@ +package org.dromara.business.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * szs + * 系统-表名配置 + * 多个profile环境中会查询不同表,需要处理拼接表名 ,比如 dk_business变成 w_dk_business + */ +@Data +@Configuration +@ConfigurationProperties(prefix = "projecttableprefix") +public class ProjectTablePrefixConfig { + + @Value("${projectTablePrefix.tableBusiness:dk_business}") + private String tableBusiness; + + @Value("${projectTablePrefix.tableCloud:dk_cloud}") + private String tableCloud; + + @Value("${projectTablePrefix.tableWorkflow:dk_workflow}") + private String tableWorkflow; +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoController.java b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoController.java new file mode 100644 index 0000000..df059f2 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoController.java @@ -0,0 +1,106 @@ +package org.dromara.business.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +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.dromara.business.domain.vo.BusinessAlertConstructInfoVo; +import org.dromara.business.domain.bo.BusinessAlertConstructInfoBo; +import org.dromara.business.service.IBusinessAlertConstructInfoService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 预警任务-施工信息 + * 前端访问路由地址为:/business/alertConstructInfo + * + * @author szs + * @date 2025-05-21 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/alertConstructInfo") +public class BusinessAlertConstructInfoController extends BaseController { + + private final IBusinessAlertConstructInfoService businessAlertConstructInfoService; + + /** + * 查询预警任务-施工信息列表 + */ + @SaCheckPermission("business:businessAlertConstructInfo:list") + @GetMapping("/list") + public TableDataInfo list(BusinessAlertConstructInfoBo bo, PageQuery pageQuery) { + return businessAlertConstructInfoService.queryPageList(bo, pageQuery); + } + + /** + * 导出预警任务-施工信息列表 + */ + @SaCheckPermission("business:businessAlertConstructInfo:export") + @Log(title = "预警任务-施工信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(BusinessAlertConstructInfoBo bo, HttpServletResponse response) { + List list = businessAlertConstructInfoService.queryList(bo); + ExcelUtil.exportExcel(list, "预警任务-施工信息", BusinessAlertConstructInfoVo.class, response); + } + + /** + * 获取预警任务-施工信息详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("business:businessAlertConstructInfo:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(businessAlertConstructInfoService.queryById(id)); + } + + /** + * 新增预警任务-施工信息 + */ + @SaCheckPermission("business:businessAlertConstructInfo:add") + @Log(title = "预警任务-施工信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody BusinessAlertConstructInfoBo bo) { + return toAjax(businessAlertConstructInfoService.insertByBo(bo)); + } + + /** + * 修改预警任务-施工信息 + */ + @SaCheckPermission("business:businessAlertConstructInfo:edit") + @Log(title = "预警任务-施工信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody BusinessAlertConstructInfoBo bo) { + return toAjax(businessAlertConstructInfoService.updateByBo(bo)); + } + + /** + * 删除预警任务-施工信息 + * + * @param ids 主键串 + */ + @SaCheckPermission("business:businessAlertConstructInfo:remove") + @Log(title = "预警任务-施工信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(businessAlertConstructInfoService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java index 01079b0..aa6233a 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java +++ b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java @@ -1,6 +1,8 @@ package org.dromara.business.controller; import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.nacos.client.utils.TenantUtil; import io.swagger.v3.oas.annotations.Operation; @@ -14,6 +16,7 @@ import org.dromara.business.service.IBusinessAlertService; import org.dromara.business.utils.MinioUntil; import org.dromara.business.utils.constants.MinIOConstants; import org.dromara.common.core.domain.R; +import org.dromara.common.core.utils.DateUtils; import org.dromara.common.log.annotation.Log; import org.dromara.common.log.enums.BusinessType; import org.dromara.common.mybatis.core.page.PageQuery; @@ -105,30 +108,48 @@ public class BusinessAlertController extends BaseController { */ @Operation(summary ="ai实时流预警保存-用于演示",description = "ai实时流预警保存-用于演示") @PostMapping("/saveAlert") - public R saveAlert(@RequestBody BusinessAlertVo vo) { + public R saveAlert(@RequestBody BusinessAlert vo) { vo.setBusinessType(2); - BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo); + vo.setHandleType("verify"); + BusinessAlert businessAlert = businessAlertService.addAlert(vo); + return R.ok(businessAlert); + } + + /** + * ai实时流预警保存 + */ + @Operation(summary ="预警推送-实时预警模块专用",description = "预警推送-实时预警模块专用") + @GetMapping("/pushAlert") + public R pushAlert(Long alertId,@RequestParam(required = false) String deptId,@RequestParam(required = false)String deptName) { + BusinessAlert businessAlert= businessAlertService.getBusinessAlert(alertId); + if(!ObjectUtil.hasEmpty(deptId,deptName)){ + businessAlert.setDeptName(deptName); + businessAlert.setDeptId(deptId); + } + businessAlert.setCreateTime(new Date()); + //businessAlert.setJobName(deptName + businessAlert.getLabelCn() + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",businessAlert.getCreateTime())); + businessAlertService.updateBusinessAlert(businessAlert); RemoteStartProcess startProcess = new RemoteStartProcess(); startProcess.setBusinessId(String.valueOf(businessAlert.getId())); startProcess.setFlowCode("alertChz"); remoteWorkflowService.startWorkFlowBatch(List.of(startProcess)); RemoteNoticeBo remoteNoticeBo = new RemoteNoticeBo(); - remoteNoticeBo.setNoticeTitle(vo.getDeptName()+"产生预警,预警类型["+vo.getLabelCn()+"],请立即查看"); + remoteNoticeBo.setNoticeTitle(businessAlert.getDeptName()+"产生预警,预警类型["+businessAlert.getLabelCn()+"],请立即查看"); remoteNoticeBo.setNoticeType("3"); - remoteNoticeBo.setNoticeContent(vo.getDeptName()+"产生预警,预警类型["+vo.getLabelCn()+"],请立即查看"); + remoteNoticeBo.setNoticeContent(businessAlert.getDeptName()+"产生预警,预警类型["+businessAlert.getLabelCn()+"],请立即查看"); remoteNoticeBo.setStatus("0"); remoteNoticeBo.setIsRead(0); remoteNoticeBo.setCreateBy(1L); remoteNoticeBo.setCreateDept(1L); remoteNoticeBo.setCreateTime(businessAlert.getCreateTime()); if (businessAlert.getBusinessType() == 2){ - businessAlert.setImages(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, vo.getImages(), 3600).toString()); + businessAlert.setImages(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlert.getImages(), 3600).toString()); } - remoteNoticeBo.setDeviceSn(vo.getDeviceSn()); - businessAlert.setDeviceSn(vo.getDeviceSn()); + remoteNoticeBo.setDeviceSn(businessAlert.getDeviceSn()); + businessAlert.setDeviceSn(businessAlert.getDeviceSn()); remoteNoticeBo.setParam(JSON.toJSONString(businessAlert)); remoteNoticeService.saveNotice(remoteNoticeBo); - remoteSubmailConfigService.remoteCmdSend("smsMultixsend", JSON.toJSONString(vo)); + remoteSubmailConfigService.remoteCmdSend("smsMultixsend", JSON.toJSONString(businessAlert)); return R.ok(); } @@ -154,4 +175,45 @@ public class BusinessAlertController extends BaseController { } + /** + * 查询实时流预警 + */ +// @SaCheckPermission("business:alertAi:list") + @Operation(summary ="查询实时流预警",description = "查询实时流预警") + @GetMapping("/ai/verify/alert") + public R> listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery) { + return R.ok(businessAlertService.listAiVerifyAlert(vo,pageQuery)); + } + + + + + @Operation(summary ="ai实时流预警保存-用于演示",description = "ai实时流预警保存-用于演示") + @PostMapping("/saveAlert") + public R selectAlert(@RequestBody BusinessAlertVo vo) { + vo.setBusinessType(2); + BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo); + RemoteStartProcess startProcess = new RemoteStartProcess(); + startProcess.setBusinessId(String.valueOf(businessAlert.getId())); + startProcess.setFlowCode("alertChz"); + remoteWorkflowService.startWorkFlowBatch(List.of(startProcess)); + RemoteNoticeBo remoteNoticeBo = new RemoteNoticeBo(); + remoteNoticeBo.setNoticeTitle(vo.getDeptName()+"产生预警,预警类型["+vo.getLabelCn()+"],请立即查看"); + remoteNoticeBo.setNoticeType("3"); + remoteNoticeBo.setNoticeContent(vo.getDeptName()+"产生预警,预警类型["+vo.getLabelCn()+"],请立即查看"); + remoteNoticeBo.setStatus("0"); + remoteNoticeBo.setIsRead(0); + remoteNoticeBo.setCreateBy(1L); + remoteNoticeBo.setCreateDept(1L); + remoteNoticeBo.setCreateTime(businessAlert.getCreateTime()); + if (businessAlert.getBusinessType() == 2){ + businessAlert.setImages(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, vo.getImages(), 3600).toString()); + } + remoteNoticeBo.setDeviceSn(vo.getDeviceSn()); + businessAlert.setDeviceSn(vo.getDeviceSn()); + remoteNoticeBo.setParam(JSON.toJSONString(businessAlert)); + remoteNoticeService.saveNotice(remoteNoticeBo); + remoteSubmailConfigService.remoteCmdSend("smsMultixsend", JSON.toJSONString(vo)); + return R.ok(); + } } diff --git a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java index be9c2c6..3db95c8 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java +++ b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java @@ -84,6 +84,12 @@ public class BusinessAlertStatisticsController extends BaseController { return R.ok(statisticsService.countPostAlert(businessAlertBo)); } + @Operation(summary="各大类全部预警数", description="各大类全部预警数") + @GetMapping(value = "/post/count/all") + public R> countPostAll(BusinessAlertBo businessAlertBo) { + return R.ok(statisticsService.countPostAllAlert(businessAlertBo)); + } + /** * 出警效率 @@ -198,6 +204,7 @@ public class BusinessAlertStatisticsController extends BaseController { @Operation(summary="预警对比统计(预警状态)", description="预警对比统计(预警状态)") @GetMapping(value = "/compare/status/count") public R>> countAlertStatusCompare(BusinessAlertBo businessAlertBo) { + return R.ok(statisticsService.countAlertStatusCompare(businessAlertBo)); } diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java index 84d7ef2..e98774b 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo; import org.dromara.common.translation.annotation.Translation; import org.dromara.common.translation.constant.TransConstant; @@ -252,4 +253,8 @@ public class BusinessAlert { @TableField(exist = false) private String deviceSn; + + //预警扩展施工信息 + @TableField(exist = false) + private BusinessAlertConstructInfoVo alertConstructInfoVo; } diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java new file mode 100644 index 0000000..4c349fc --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java @@ -0,0 +1,86 @@ +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; + +/** + * 预警任务-施工信息对象 business_alert_construct_info + * + * @author szs + * @date 2025-05-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("business_alert_construct_info") +public class BusinessAlertConstructInfo extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @TableId(value = "id") + private Long id; + + /** + * 1:图片比对预警 2:AI实时预警 + */ + private Long businessType; + + /** + * job任务id + */ + private String jobId; + + /** + * 预警名称 + */ + private String jobName; + + /** + * 预警任务id + */ + private Long businessAlertId; + + /** + * 施工名称 + */ + private String constructName; + + /** + * 施工单位 + */ + private String constructDept; + + /** + * 施工单位负责人 + */ + private String constructLeader; + + /** + * 联系电话 + */ + private String phonenumber; + + /** + * 施工地址 + */ + private String address; + + /** + * 所属管道 + */ + private String pipeline; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoBo.java b/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoBo.java new file mode 100644 index 0000000..377c543 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoBo.java @@ -0,0 +1,87 @@ +package org.dromara.business.domain.bo; + +import org.dromara.business.domain.BusinessAlertConstructInfo; +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.*; + +/** + * 预警任务-施工信息业务对象 business_alert_construct_info + * + * @author szs + * @date 2025-05-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = BusinessAlertConstructInfo.class, reverseConvertGenerate = false) +public class BusinessAlertConstructInfoBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 1:图片比对预警 2:AI实时预警 + */ + private Long businessType; + + /** + * job任务id + */ + private String jobId; + + /** + * 预警名称 + */ + private String jobName; + + /** + * 预警任务id + */ + @NotNull(message = "预警任务id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long businessAlertId; + + /** + * 施工名称 + */ + @NotBlank(message = "施工名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String constructName; + + /** + * 施工单位 + */ + private String constructDept; + + /** + * 施工单位负责人 + */ + private String constructLeader; + + /** + * 联系电话 + */ + private String phonenumber; + + /** + * 施工地址 + */ + private String address; + + /** + * 所属管道 + */ + private String pipeline; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java b/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java new file mode 100644 index 0000000..b4d48af --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java @@ -0,0 +1,104 @@ +package org.dromara.business.domain.vo; + +import org.dromara.business.domain.BusinessAlertConstructInfo; +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; + + + +/** + * 预警任务-施工信息视图对象 business_alert_construct_info + * + * @author szs + * @date 2025-05-21 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BusinessAlertConstructInfo.class) +public class BusinessAlertConstructInfoVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 1:图片比对预警 2:AI实时预警 + */ + @ExcelProperty(value = "1:图片比对预警 2:AI实时预警") + private Long businessType; + + /** + * job任务id + */ + @ExcelProperty(value = "job任务id") + private String jobId; + + /** + * 预警名称 + */ + @ExcelProperty(value = "预警名称") + private String jobName; + + /** + * 预警任务id + */ + @ExcelProperty(value = "预警任务id") + private Long businessAlertId; + + /** + * 施工名称 + */ + @ExcelProperty(value = "施工名称") + private String constructName; + + /** + * 施工单位 + */ + @ExcelProperty(value = "施工单位") + private String constructDept; + + /** + * 施工单位负责人 + */ + @ExcelProperty(value = "施工单位负责人") + private String constructLeader; + + /** + * 联系电话 + */ + @ExcelProperty(value = "联系电话") + private String phonenumber; + + /** + * 施工地址 + */ + @ExcelProperty(value = "施工地址") + private String address; + + /** + * 所属管道 + */ + @ExcelProperty(value = "所属管道") + private String pipeline; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java index b333a93..e139e1e 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java +++ b/dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java @@ -29,8 +29,8 @@ public class RemoteBusinessAlertServiceImpl implements RemoteBusinessAlertServic @Override - public Boolean saveBusinessAlert(List alertVoList) { - return businessAlertService.batchAddBusinessAlert(alertVoList); + public Boolean saveBusinessAlert(List alertVoList, String activeProfile) { + return businessAlertService.batchAddBusinessAlert(alertVoList, activeProfile); } /** diff --git a/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoMapper.java b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoMapper.java new file mode 100644 index 0000000..748591a --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoMapper.java @@ -0,0 +1,15 @@ +package org.dromara.business.mapper; + +import org.dromara.business.domain.BusinessAlertConstructInfo; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 预警任务-施工信息Mapper接口 + * + * @author szs + * @date 2025-05-21 + */ +public interface BusinessAlertConstructInfoMapper extends BaseMapperPlus { + +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java index 97c2a2d..e2823c1 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java +++ b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java @@ -3,6 +3,7 @@ package org.dromara.business.mapper; 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.config.ProjectTablePrefixConfig; import org.dromara.business.domain.BusinessAlert; import org.dromara.business.domain.bo.BusinessAlertBo; import org.dromara.business.domain.vo.BusinessAlertVo; @@ -24,12 +25,12 @@ public interface BusinessAlertMapper extends BaseMapperPlus pageBusinessAlert(@Param("page") Page page,@Param("ew") QueryWrapper ew); + Page pageBusinessAlert(@Param("page") Page page,@Param("ew") QueryWrapper ew, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness @DataPermission( @DataColumn(key = "deptName", value = "t.dept_id") ) - Page pageBusinessAlertHandle(@Param("page") Page page,@Param("ew") QueryWrapper ew); + Page pageBusinessAlertHandle(@Param("page") Page page,@Param("ew") QueryWrapper ew, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness, @Param("tableWorkflow") String tableWorkflow /** * 处理中 @@ -40,34 +41,34 @@ public interface BusinessAlertMapper extends BaseMapperPlus pageAlertTodo(@Param("page") Page page,@Param("ew") QueryWrapper ew); + Page pageAlertTodo(@Param("page") Page page,@Param("ew") QueryWrapper ew, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness, @Param("tableWorkflow") String tableWorkflow @DataPermission( @DataColumn(key = "deptName", value = "t.dept_id") ) - Page pageBusinessAlertCancel(@Param("page") Page page,@Param("ew") QueryWrapper ew); + Page pageBusinessAlertCancel(@Param("page") Page page,@Param("ew") QueryWrapper ew, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness, @Param("tableWorkflow") String tableWorkflow @DataPermission( @DataColumn(key = "deptName", value = "t.dept_id") ) - Page pageBusinessAlertFinish(@Param("page") Page page, @Param("ew") QueryWrapper wrapper); + Page pageBusinessAlertFinish(@Param("page") Page page, @Param("ew") QueryWrapper wrapper, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness @DataPermission( @DataColumn(key = "deptName", value = "t.dept_id") ) - List listTodoAlert(@Param("ew") QueryWrapper ew); + List listTodoAlert(@Param("ew") QueryWrapper ew, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness, @Param("tableWorkflow") String tableWorkflow List> listMonthAlert(@Param("param") BusinessAlertBo businessAlertBo); - List> listDepartAlert(@Param("param") BusinessAlertBo businessAlertBo); + List> listDepartAlert(@Param("param") BusinessAlertBo businessAlertBo, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud List> listMonthAlertStatus(@Param("param")BusinessAlertBo businessAlertBo); - List> listDepartAlertStatus(@Param("param") BusinessAlertBo businessAlertBo); + List> listDepartAlertStatus(@Param("param") BusinessAlertBo businessAlertBo, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud List> countAlertCompare(@Param("param")BusinessAlertBo businessAlertBo); @@ -89,21 +90,22 @@ public interface BusinessAlertMapper extends BaseMapperPlus> handlerRate(@Param("param") BusinessAlertBo businessAlertBo,@Param("months") List months); Map countPastYearAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + Map countTotalAlert(@Param("param") BusinessAlertBo businessAlertBo); - List> countAiLabel(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + List> countAiLabel(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud - List> countStreetAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList); + List> countStreetAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud - List listAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + List listAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness - List heatList(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); - List> countStreetRateAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList); + List heatList(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableBusiness") String tableBusiness + List> countStreetRateAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud - Map streetRateTopAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList); + Map streetRateTopAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud - Map streetTopAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList); + Map streetTopAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("deptIdList") List deptIdList, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud - List> countLabelRateAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + List> countLabelRateAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix);//@Param("tableCloud") String tableCloud void batchUpdateDept(@Param("list") List alertVoList); @@ -112,9 +114,9 @@ public interface BusinessAlertMapper extends BaseMapperPlus listHandleHistory(@Param("lng") String lng, @Param("lat") String lat,@Param("createTime") String createTime); - List> listOneDepartAlert(@Param("param") BusinessAlertBo businessAlertBo); + List> listOneDepartAlert(@Param("param") BusinessAlertBo businessAlertBo, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix); //@Param("tableCloud") String tableCloud - List> listOneDepartAlertStatus(@Param("param") BusinessAlertBo businessAlertBo); + List> listOneDepartAlertStatus(@Param("param") BusinessAlertBo businessAlertBo, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix); //@Param("tableCloud") String tableCloud Integer selectCurrentAlertCount(@Param("currentDate") String currentDate); diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoService.java b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoService.java new file mode 100644 index 0000000..e766935 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoService.java @@ -0,0 +1,69 @@ +package org.dromara.business.service; + +import org.dromara.business.domain.BusinessAlertConstructInfo; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo; +import org.dromara.business.domain.bo.BusinessAlertConstructInfoBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 预警任务-施工信息Service接口 + * + * @author szs + * @date 2025-05-21 + */ +public interface IBusinessAlertConstructInfoService { + + /** + * 查询预警任务-施工信息 + * + * @param id 主键 + * @return 预警任务-施工信息 + */ + BusinessAlertConstructInfoVo queryById(Long id); + + /** + * 分页查询预警任务-施工信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 预警任务-施工信息分页列表 + */ + TableDataInfo queryPageList(BusinessAlertConstructInfoBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的预警任务-施工信息列表 + * + * @param bo 查询条件 + * @return 预警任务-施工信息列表 + */ + List queryList(BusinessAlertConstructInfoBo bo); + + /** + * 新增预警任务-施工信息 + * + * @param bo 预警任务-施工信息 + * @return 是否新增成功 + */ + Boolean insertByBo(BusinessAlertConstructInfoBo bo); + + /** + * 修改预警任务-施工信息 + * + * @param bo 预警任务-施工信息 + * @return 是否修改成功 + */ + Boolean updateByBo(BusinessAlertConstructInfoBo bo); + + /** + * 校验并批量删除预警任务-施工信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java index 6a1bac8..7b0fc80 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java @@ -36,6 +36,8 @@ public interface IBusinessAlertService { * @return 是否新增成功 */ BusinessAlert addBusinessAlert(BusinessAlertVo param); + //用于演示 + BusinessAlert addAlert(BusinessAlert param); void addBusinessAlertList(List alertVoList); @@ -45,7 +47,7 @@ public interface IBusinessAlertService { * @param alertVoList 预警任务 * @return 是否新增成功 */ - Boolean batchAddBusinessAlert(List alertVoList); + Boolean batchAddBusinessAlert(List alertVoList, String activeProfile); /** * 修改预警任务 @@ -94,4 +96,10 @@ public interface IBusinessAlertService { List listHandleHistory(String lng, String lat, String createTime); Boolean transferAlert(BusinessAlertVo vo); + + BusinessAlert getBusinessAlert(Long alertId); + + Boolean updateBusinessAlert(BusinessAlert businessAlert); + + TableDataInfo listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery); } diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java index bac55f8..20ee211 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java @@ -38,4 +38,7 @@ public interface IBusinessAlertStatisticsService { Map listAppAlertCount(BusinessAlertBo businessAlertBo); + List countPostAllAlert(BusinessAlertBo businessAlertBo); + + } diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoServiceImpl.java new file mode 100644 index 0000000..e76ba1b --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoServiceImpl.java @@ -0,0 +1,138 @@ +package org.dromara.business.service.impl; + +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.springframework.stereotype.Service; +import org.dromara.business.domain.bo.BusinessAlertConstructInfoBo; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo; +import org.dromara.business.domain.BusinessAlertConstructInfo; +import org.dromara.business.mapper.BusinessAlertConstructInfoMapper; +import org.dromara.business.service.IBusinessAlertConstructInfoService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 预警任务-施工信息Service业务层处理 + * + * @author szs + * @date 2025-05-21 + */ +@RequiredArgsConstructor +@Service +public class BusinessAlertConstructInfoServiceImpl implements IBusinessAlertConstructInfoService { + + private final BusinessAlertConstructInfoMapper baseMapper; + + /** + * 查询预警任务-施工信息 + * + * @param id 主键 + * @return 预警任务-施工信息 + */ + @Override + public BusinessAlertConstructInfoVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 分页查询预警任务-施工信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 预警任务-施工信息分页列表 + */ + @Override + public TableDataInfo queryPageList(BusinessAlertConstructInfoBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的预警任务-施工信息列表 + * + * @param bo 查询条件 + * @return 预警任务-施工信息列表 + */ + @Override + public List queryList(BusinessAlertConstructInfoBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(BusinessAlertConstructInfoBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getBusinessType() != null, BusinessAlertConstructInfo::getBusinessType, bo.getBusinessType()); + lqw.eq(StringUtils.isNotBlank(bo.getJobId()), BusinessAlertConstructInfo::getJobId, bo.getJobId()); + lqw.like(StringUtils.isNotBlank(bo.getJobName()), BusinessAlertConstructInfo::getJobName, bo.getJobName()); + lqw.eq(bo.getBusinessAlertId() != null, BusinessAlertConstructInfo::getBusinessAlertId, bo.getBusinessAlertId()); + lqw.like(StringUtils.isNotBlank(bo.getConstructName()), BusinessAlertConstructInfo::getConstructName, bo.getConstructName()); + lqw.eq(StringUtils.isNotBlank(bo.getConstructDept()), BusinessAlertConstructInfo::getConstructDept, bo.getConstructDept()); + lqw.eq(StringUtils.isNotBlank(bo.getConstructLeader()), BusinessAlertConstructInfo::getConstructLeader, bo.getConstructLeader()); + lqw.eq(StringUtils.isNotBlank(bo.getPhonenumber()), BusinessAlertConstructInfo::getPhonenumber, bo.getPhonenumber()); + lqw.eq(StringUtils.isNotBlank(bo.getAddress()), BusinessAlertConstructInfo::getAddress, bo.getAddress()); + lqw.eq(StringUtils.isNotBlank(bo.getPipeline()), BusinessAlertConstructInfo::getPipeline, bo.getPipeline()); + return lqw; + } + + /** + * 新增预警任务-施工信息 + * + * @param bo 预警任务-施工信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(BusinessAlertConstructInfoBo bo) { + BusinessAlertConstructInfo add = MapstructUtils.convert(bo, BusinessAlertConstructInfo.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改预警任务-施工信息 + * + * @param bo 预警任务-施工信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(BusinessAlertConstructInfoBo bo) { + BusinessAlertConstructInfo update = MapstructUtils.convert(bo, BusinessAlertConstructInfo.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BusinessAlertConstructInfo entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除预警任务-施工信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java index 90408da..f451e41 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java @@ -3,18 +3,24 @@ package org.dromara.business.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.ListUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; 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.api.domain.bo.RemoteBusinessAlertBo; +import org.dromara.business.api.domain.vo.RemoteBusinessAlertConstructInfo; import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo; +import org.dromara.business.config.ProjectTablePrefixConfig; import org.dromara.business.domain.BusinessAlert; import org.dromara.business.domain.bo.BusinessAlertBo; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo; import org.dromara.business.domain.vo.BusinessAlertVo; +import org.dromara.business.mapper.BusinessAlertConstructInfoMapper; import org.dromara.business.mapper.BusinessAlertMapper; import org.dromara.business.service.IBusinessAlertService; import org.dromara.business.utils.BatchProcessorUtil; @@ -28,6 +34,7 @@ import org.dromara.common.core.utils.MapstructUtils; 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.business.utils.MinioUtil; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.system.api.RemoteLabelPostService; import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; @@ -35,6 +42,7 @@ import org.dromara.system.api.domain.vo.RemoteUserVo; import org.dromara.workflow.api.RemoteWorkflowService; import org.dromara.workflow.api.domain.RemoteStartProcess; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.lang.reflect.Method; @@ -62,12 +70,17 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { private final BusinessAlertMapper baseMapper; + @Autowired + private BusinessAlertConstructInfoMapper businessAlertConstructInfoMapper; + @DubboReference(timeout = 30000) RemoteWorkflowService remoteWorkflowService; @DubboReference RemoteLabelPostService remoteLablePostService; + @Autowired + private ProjectTablePrefixConfig ptPrefix; /** * 新增预警任务 @@ -79,8 +92,37 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { public BusinessAlert addBusinessAlert(BusinessAlertVo param) { BusinessAlert alert = MapstructUtils.convert(param, BusinessAlert.class); alert.setCreateTime(new Date()); - alert.setCaseNumber(param.getCaseNumber()); - alert.setJobName(alert.getDeptName()+alert.getLabelCn()+ DateUtils.getTime()); + alert.setJobName(alert.getLabelCn()+ DateUtils.getTime()); + //创建案件号 + try { + incrementalAlertCount(alert); + } catch (Exception e) { + log.error(e.getMessage(),e); + } + this.baseMapper.insert(alert); + return alert; + } + + @Override + public BusinessAlert addAlert(BusinessAlert alert) { + alert.setCreateTime(new Date()); + if(ObjectUtil.isNull(alert.getJobName())){ + alert.setJobName(alert.getLabelCn()+ DateUtils.getTime()); + alert.setDeptId("106"); + alert.setDeptName("金山街道"); + } + if(ObjectUtil.equals("车辆",alert.getLabelCn())){ + alert.setLat("34.22403"); + alert.setLng("117.13597"); + + }else if(ObjectUtil.equals("烟雾",alert.getLabelCn())){ + alert.setLat("34.22825"); + alert.setLng("117.14087"); + }else if(ObjectUtil.equals("垃圾",alert.getLabelCn())){ + alert.setLat("34.2264"); + alert.setLng("117.13919"); + } + this.baseMapper.insert(alert); return alert; } @@ -117,22 +159,38 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { * @return */ @Override - public Boolean batchAddBusinessAlert(List alertVoList) { + public Boolean batchAddBusinessAlert(List alertVoList, String activeProfile) { List businessAlerts = alertVoList.stream().map(alert -> { BusinessAlert businessAlert = new BusinessAlert(); alert.setCreateTime(new Date()); alert.setHandleType(BusinessStatusEnum.VERIFY.getStatus()); + RemoteBusinessAlertConstructInfo remoteAlertConstructInfo = alert.getRemoteAlertConstructInfo(); + BusinessAlertConstructInfoVo alertConstructInfoVo = new BusinessAlertConstructInfoVo(); + BeanUtils.copyProperties(alert.getRemoteAlertConstructInfo(), alertConstructInfoVo); + businessAlert.setAlertConstructInfoVo(alertConstructInfoVo); BeanUtils.copyProperties(alert, businessAlert); + if(!StrUtil.equals("default", activeProfile)){ + businessAlert.setBusinessType(2); + } //查询历史预警 List businessAlertList = this.listHandleHistory(alert.getLng(), alert.getLat(), DateUtils.parseDateToStr(FormatsType.YYYY_MM_DD_HH_MM_SS, alert.getCreateTime())); - businessAlert.setHandleNum(businessAlertList.size()); return businessAlert; }).toList(); - return this.baseMapper.insertBatch(businessAlerts); + boolean b = this.baseMapper.insertBatch(businessAlerts); + /*List alertConstructInfoList = businessAlerts.stream().map(alert -> { + BusinessAlertConstructInfoVo alertConstructInfoVo = alert.getAlertConstructInfoVo(); + BusinessAlertConstructInfo businessAlertConstructInfo = new BusinessAlertConstructInfo(); + BeanUtils.copyProperties(alertConstructInfoVo, businessAlertConstructInfo); + businessAlertConstructInfo.setBusinessAlertId(alert.getId()); + return businessAlertConstructInfo; + }).collect(Collectors.toList()); + businessAlertConstructInfoMapper.insertBatch(alertConstructInfoList);*/ + + return b; } /** @@ -216,9 +274,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return new TableDataInfo<>(); } - Page page = this.baseMapper.pageBusinessAlert(pageQuery.build(), wrapper); + Page page = this.baseMapper.pageBusinessAlert(pageQuery.build(), wrapper, ptPrefix); - try { + try {//预警管理查询图片 page.getRecords().forEach(businessAlertVo->{ if (businessAlertVo.getBusinessType() == 2){ businessAlertVo.setImages(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlertVo.getImages(), 3600).toString()); @@ -253,7 +311,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.in("t.flowStatus", BusinessStatusEnum.CANCEL.getStatus()); - Page page = this.baseMapper.pageBusinessAlertCancel(pageQuery.build(), wrapper); + Page page = this.baseMapper.pageBusinessAlertCancel(pageQuery.build(), wrapper, ptPrefix); try { page.getRecords().forEach(businessAlertVo->{ @@ -291,7 +349,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.eq("t.handle_type",BusinessStatusEnum.FINISH.getStatus()); - Page page = this.baseMapper.pageBusinessAlertFinish(pageQuery.build(), wrapper); + Page page = this.baseMapper.pageBusinessAlertFinish(pageQuery.build(), wrapper, ptPrefix); try { page.getRecords().forEach(businessAlertVo->{ @@ -311,7 +369,6 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return TableDataInfo.build(page); } - /** * 查询当前用户待办预警 * @param bo @@ -330,7 +387,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.in("t.approver", remoteWorkflowService.getPermissions()); wrapper.in("t.flow_status", BusinessStatusEnum.WAITING.getStatus()); - Page page = this.baseMapper.pageAlertTodo(pageQuery.build(), wrapper); + Page page = this.baseMapper.pageAlertTodo(pageQuery.build(), wrapper, ptPrefix); List records = page.getRecords(); if (CollUtil.isNotEmpty(records)) { @@ -371,11 +428,13 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return new TableDataInfo<>(); } + String tableWorkflow = ptPrefix.getTableWorkflow(); // eg: "dk_workflow" wrapper.notIn("t.flowStatus", BusinessStatusEnum.CANCEL.getStatus()); - wrapper.apply(" EXISTS(select * from dk_workflow.flow_his_task ht where ht.approver ='" + LoginHelper.getUserId() + "' and ht.instance_id = t.instanceId)"); +// wrapper.apply(" EXISTS(select * from w_dk_workflow.flow_his_task ht where ht.approver ='" + LoginHelper.getUserId() + "' and ht.instance_id = t.instanceId)"); + wrapper.apply(" EXISTS(select * from "+tableWorkflow+".flow_his_task ht where ht.approver ='" + LoginHelper.getUserId() + "' and ht.instance_id = t.instanceId)"); - Page page = this.baseMapper.pageBusinessAlertHandle(pageQuery.build(), wrapper); + Page page = this.baseMapper.pageBusinessAlertHandle(pageQuery.build(), wrapper, ptPrefix); try { page.getRecords().forEach(businessAlertVo->{ @@ -490,7 +549,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { //查看的是总览的预警信息 if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { - List businessAlerts = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); + List businessAlerts = this.baseMapper.listAlert(businessAlertBo, startTime, endTime, ptPrefix); businessAlerts.forEach(businessAlertVo->{ if (businessAlertVo.getBusinessType() == 2){ @@ -514,7 +573,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { Map handlerMap = new HashMap<>(); - List alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); + List alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime, ptPrefix); alertList.forEach(businessAlertVo->{ if (businessAlertVo.getBusinessType() == 2){ @@ -554,7 +613,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { //查看的是总览的预警信息 if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { - List businessAlerts = this.baseMapper.heatList(businessAlertBo, businessAlertBo.getStartTime(), businessAlertBo.getEndTime()); + List businessAlerts = this.baseMapper.heatList(businessAlertBo, businessAlertBo.getStartTime(), businessAlertBo.getEndTime(), ptPrefix); Map> listMap = businessAlerts.stream().collect(Collectors.groupingBy(BusinessAlertVo::getLabelCn)); result.putAll(listMap); return result; @@ -567,7 +626,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return result; } businessAlertBo.setAiLabelEnList(postVoList.stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList()); - List alertList = this.baseMapper.heatList(businessAlertBo, businessAlertBo.getStartTime(), businessAlertBo.getEndTime()); + List alertList = this.baseMapper.heatList(businessAlertBo, businessAlertBo.getStartTime(), businessAlertBo.getEndTime(), ptPrefix); Map> listMap = alertList.stream().collect(Collectors.groupingBy(BusinessAlertVo::getLabelCn)); result.putAll(listMap); return result; @@ -604,7 +663,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { businessAlertBo.setAiLabelEnList(aiNameMap.get(businessAlertBo.getAiName()).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList()); - List alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); + List alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime, ptPrefix); alertList.forEach(businessAlertVo->{ if (businessAlertVo.getBusinessType() == 2){ @@ -655,7 +714,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return infoMap; } businessAlertBo.setAiLabelEnList(aiNameMap.get(businessAlertBo.getAiName()).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList()); - List alertList = this.baseMapper.heatList(businessAlertBo, businessAlertBo.getStartTime(), businessAlertBo.getEndTime()); + List alertList = this.baseMapper.heatList(businessAlertBo, businessAlertBo.getStartTime(), businessAlertBo.getEndTime(), ptPrefix); Map> listMap = alertList.stream().collect(Collectors.groupingBy(BusinessAlertVo::getLabelCn)); infoMap.putAll(listMap); return infoMap; @@ -669,6 +728,37 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return this.baseMapper.selectVoList(wrapper); } + /** + * 查询实时流待验证预警 + * @param vo + * @param pageQuery + * @return + */ + @Override + public TableDataInfo listAiVerifyAlert(BusinessAlertVo vo,PageQuery pageQuery) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BusinessAlert::getHandleType, BusinessStatusEnum.VERIFY.getStatus()); + wrapper.eq(BusinessAlert::getBusinessType, vo.getBusinessType()); + if (ObjectUtil.isNotEmpty(vo.getDeptId())){ + wrapper.eq(BusinessAlert::getDeptId, vo.getDeptId()); + } + + if (ObjectUtil.isNotEmpty(vo.getJobName())){ + wrapper.like(BusinessAlert::getJobName, vo.getJobName()); + } + + wrapper.orderByDesc(BusinessAlert::getCreateTime); + + IPage businessAlertVos = this.baseMapper.selectVoPage(pageQuery.build(), wrapper); + businessAlertVos.getRecords().forEach(businessAlertVo->{ + URL url = MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlertVo.getImages(), 3600); + + businessAlertVo.setImages(url.toString()); + }); + + return TableDataInfo.build(businessAlertVos); + } + @Override public Boolean deleteAlert(List alertIdList) { if (ObjectUtil.isEmpty(alertIdList)) { @@ -687,10 +777,14 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { //更新部门 this.baseMapper.batchUpdateDept(alertVoList); - incrementalCount(alertVoList); + try { + incrementalCount(alertVoList); - //更新number - this.baseMapper.batchUpdateCaseNumber(alertVoList); + //更新number + this.baseMapper.batchUpdateCaseNumber(alertVoList); + } catch (Exception e) { + log.error(e.getMessage(),e); + } } @@ -715,6 +809,22 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { }); } + /** + * 创建递归caseNumber + * @param + */ + public void incrementalAlertCount(BusinessAlert businessAlert){ + //查询当天时间有多少条预警 + Integer currentCount = this.baseMapper.selectCurrentAlertCount(DateUtils.getDate()); + //获取当天的时间戳 + String currentDate = DateUtils.getDate().replace("-",""); + + //然后0 + 个数 + 1 当前年月日 例如 202505150 total + 1 + + businessAlert.setCaseNumber(currentDate + "0" + (currentCount + 1)); + + } + public static List getLastSixDays() { List days = new ArrayList<>(7); @@ -745,7 +855,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.in("t.approver", remoteWorkflowService.getPermissions()); wrapper.in("t.flow_status", BusinessStatusEnum.WAITING.getStatus()); - return this.baseMapper.listTodoAlert(wrapper); + return this.baseMapper.listTodoAlert(wrapper, ptPrefix); } /** @@ -761,7 +871,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.in("t.approver", remoteWorkflowService.getPermissions()); wrapper.in("t.flow_status", BusinessStatusEnum.WAITING.getStatus()); - List businessAlerts = this.baseMapper.listTodoAlert(wrapper); + List businessAlerts = this.baseMapper.listTodoAlert(wrapper, ptPrefix); BusinessAlert businessAlert = businessAlerts.stream().filter(p -> p.getId().equals(alertId)).findFirst().get(); try { @@ -785,6 +895,16 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); wrapper.eq(BusinessAlert::getId, alertId); wrapper.set(BusinessAlert::getDelFlag,1); + BusinessAlert businessAlert = this.baseMapper.selectById(alertId); + + //删除minio多余数据 + try { + MinioUtil.deleteFile(businessAlert.getImages(), MinIOConstants.BUCKET_DKCY); + MinioUtil.deleteFile(businessAlert.getImages(), MinIOConstants.BUCKET_ALERT); + } catch (Exception e) { + throw new RuntimeException(e); + } + return this.baseMapper.update(wrapper) > 0; } @@ -831,6 +951,16 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return this.baseMapper.update(wrapper) > 0; } + @Override + public BusinessAlert getBusinessAlert(Long alertId) { + return baseMapper.selectById(alertId); + } + + @Override + public Boolean updateBusinessAlert(BusinessAlert businessAlert) { + return baseMapper.updateById(businessAlert) > 0; + } + public static void main(String[] args) { System.out.println(getLastSixDays()); diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java index 16e7699..5e4be56 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.config.annotation.DubboReference; +import org.dromara.business.config.ProjectTablePrefixConfig; import org.dromara.business.domain.BusinessAlert; import org.dromara.business.domain.bo.BusinessAlertBo; import org.dromara.business.domain.model.StatObj; @@ -72,6 +73,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist private final IBusinessAlertService businessAlertService; + @Autowired + private ProjectTablePrefixConfig ptPrefix; + /** * 按照月份分类预警数量 * @param businessAlertBo @@ -111,12 +115,12 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist .collect(Collectors.toList()); //排除自己如果没有下级则默认使用下边的逻辑查询 if (ObjectUtil.isEmpty(remoteDeptVoList)) { - List> mapList = baseMapper.listOneDepartAlert(businessAlertBo); + List> mapList = baseMapper.listOneDepartAlert(businessAlertBo, ptPrefix); return mapList.stream().map(data -> new StatObj(data.get("deptName") + "", Long.parseLong(data.get("total") + ""),"deptId",data.get("deptId"))).collect(Collectors.toList()); } //如果有则使用这个查询 - List> mapList = baseMapper.listDepartAlert(businessAlertBo); + List> mapList = baseMapper.listDepartAlert(businessAlertBo, ptPrefix); return mapList.stream().map(data -> new StatObj(data.get("deptName") + "", Long.parseLong(data.get("total") + ""),"deptId",data.get("deptId"))).collect(Collectors.toList()); } @@ -159,7 +163,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist //排除自己如果没有下级则默认使用下边的逻辑查询 if (ObjectUtil.isEmpty(remoteDeptVoList)) { - List> mapList = baseMapper.listOneDepartAlertStatus(businessAlertBo); + List> mapList = baseMapper.listOneDepartAlertStatus(businessAlertBo, ptPrefix); return mapList.stream() .map(map -> new StatObj( @@ -176,7 +180,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist } //如果有下级则使用下方方法 - List> mapList = baseMapper.listDepartAlertStatus(businessAlertBo); + List> mapList = baseMapper.listDepartAlertStatus(businessAlertBo, ptPrefix); return mapList.stream() .map(map -> new StatObj( @@ -494,6 +498,41 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist return result; } + @Override + public List countPostAllAlert(BusinessAlertBo businessAlertBo) { + + //构建查询数据权限 + createPermissions(businessAlertBo); + + //查询所有的职能岗位 + List postVoList = remotePostService.listPost(); + postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则 + + List result = new ArrayList<>(); + if (ObjectUtil.isEmpty(postVoList)) { + return ListUtil.empty(); + } + + postVoList.forEach(postVo -> { + List labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); + Map dateMap = new HashMap<>(); + if (ObjectUtil.isEmpty(labelList)) { + dateMap.put("todoCount",0); + dateMap.put("finishCount",0); + }else { + businessAlertBo.setAiLabelEnList(labelList); + dateMap = baseMapper.countTotalAlert(businessAlertBo); + } + result.add(new StatObj( + postVo.getPostName(), + dateMap.get("todoCount"), + dateMap.get("finishCount") + )); + }); + return result; + } + + /** * 出警效率 * @param businessAlertBo @@ -585,7 +624,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist //-------------------------------------------------------识别类型事件情况-------------------------------------------- - List> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); + List> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime, ptPrefix); List labelStatObj = new ArrayList<>(); @@ -603,7 +642,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist List streetList = remoteDeptService.selectListByParentId(String.valueOf(deptId)); List deptIdList = streetList.stream().filter(p-> p.getParentId().equals(deptId)).map(RemoteDeptVo::getDeptId).distinct().toList(); - List> top5Map = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime,deptIdList); + List> top5Map = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime,deptIdList, ptPrefix); List top5StatObj = new ArrayList<>(); @@ -616,7 +655,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist //-------------------------------------------------------街道处理效率Top5-------------------------------------------- - List> streetRateTop5Map = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime,deptIdList); + List> streetRateTop5Map = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime,deptIdList, ptPrefix); List streetRateTop5StatObj = new ArrayList<>(); @@ -630,7 +669,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist //-------------------------------------------------------识别类型事件处理情况-------------------------------------------- //识别类型事件处理情况 - List> labelRateMap = this.baseMapper.countLabelRateAlert(businessAlertBo,startTime,endTime); + List> labelRateMap = this.baseMapper.countLabelRateAlert(businessAlertBo,startTime,endTime, ptPrefix); List labelRateStatObj = new ArrayList<>(); @@ -736,7 +775,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist } - List> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); + List> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime, ptPrefix); List incidentHandlerStatStat = new ArrayList<>(); @@ -750,13 +789,13 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist //-------------------------------------------------------事件高发区-------------------------------------------- //事件高发区top1 - Map topStreet = this.baseMapper.streetTopAlert(businessAlertBo,startTime,endTime,deptIdList); + Map topStreet = this.baseMapper.streetTopAlert(businessAlertBo,startTime,endTime,deptIdList, ptPrefix); keyMap.put("incidentTop1",ObjectUtil.isEmpty(topStreet)?"":topStreet.get("deptName")); //-------------------------------------------------------处理效率-------------------------------------------- //处理效率top1 - Map topStreetRate = this.baseMapper.streetRateTopAlert(businessAlertBo,startTime,endTime,deptIdList); + Map topStreetRate = this.baseMapper.streetRateTopAlert(businessAlertBo,startTime,endTime,deptIdList, ptPrefix); keyMap.put("handlerRateTop1", ObjectUtil.isEmpty(topStreetRate)?"":topStreetRate.get("deptName")); diff --git a/dk-modules/business/src/main/java/org/dromara/business/utils/MinioUtil.java b/dk-modules/business/src/main/java/org/dromara/business/utils/MinioUtil.java new file mode 100644 index 0000000..648b49e --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/utils/MinioUtil.java @@ -0,0 +1,183 @@ +package org.dromara.business.utils; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import io.minio.*; +import io.minio.http.Method; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.io.InputStream; +import java.util.HashMap; + +@Component +public class MinioUtil { + // 指定MinIO服务的访问地址(包括协议、域名或IP以及端口) + private static String endpoint; + // MinIO的访问密钥(Access Key),用于身份验证 + private static String accessKey; + // MinIO的秘密密钥(Secret Key),与访问密钥配对使用,也是认证的一部分。 + private static String secretKey; + // 指定默认的存储桶(Bucket)名称,MinIO中用于组织和存储对象(文件)的基本容器。 + private static String bucket; + + @Value("${minio.endpoint:http://114.235.183.147:9090}") + public void setEndpoint(String endpoint) { + MinioUtil.endpoint = endpoint; + } + + @Value("${minio.accessKey:wuyuan@yf}") + public void setAccessKey(String accessKey) { + MinioUtil.accessKey = accessKey; + } + + @Value("${minio.secretKey:wuyuan@yf}") + public void setSecretKey(String secretKey) { + MinioUtil.secretKey = secretKey; + } + + @Value("${minio.bucket:dkcy}") + public void setBucket(String bucket) { + MinioUtil.bucket = bucket; + } + + /** + * 创建并返回一个配置好的MinioClient实例 + * 用于与MinIO服务器交互,上传文件、下载文件、删除文件 + * + * @return 配置 + */ + public static MinioClient getMinioClient() { + return MinioClient.builder() + .endpoint(endpoint) + .credentials(accessKey, secretKey) + .build(); + } + + /** + * 上传:将一个输入流中的文件上传到MinIO服务器上指定的存储桶(bucket)里 + * + * @param objectName .object(objectName)指定了上传后对象的名称。 + * @param inputStream 转换为 流 + * @param size 文件大小 + * @param contentType 内容类型 + * @throws Exception 异常 + */ + public static void uploadFile(String objectName, InputStream inputStream, long size, String contentType,String newBucket) throws Exception { + String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket; + + MinioClient minioClient = getMinioClient(); + minioClient.putObject( + // .bucket(bucket) 指定了目标存储桶的名称。.object(objectName)指定了上传后对象的名称。 + PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(inputStream, size, -1) + // .contentType(contentType)指定了上传文件的内容类型。 + .contentType(contentType) + .build()); + } + + + /** + * 下载:从MinIO服务器下载指定存储桶(bucket)中的文件 + * + * @param objectName 指定要从MinIO下载的文件对象名称(即文件路径和文件名)。 + * @return 流 对象 + * @throws Exception 异常 + */ + public static InputStream downloadFile(String objectName,String newBucket) throws Exception { + String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket; + + MinioClient minioClient = getMinioClient(); + return minioClient.getObject( + GetObjectArgs.builder() + // .bucket(bucket)指定了文件所在的存储桶名称。 + .bucket(bucketName) + // .object(objectName)指定了要下载的对象名称。 + .object(objectName) + .build()); + } + + + /** + * 预览:生成一个预签名的URL,允许用户通过浏览器或其他HTTP客户端以GET方法访问MinIO存储桶中指定对象(文件)的临时链接 + * + * @param objectName 指定需要获取预览链接的文件对象名称(包括路径)。 + * @return 对象 + * @throws Exception .method(Method.GET)指定了请求的方法为GET,这是预览文件时的标准HTTP方法。 + * .bucket(bucket)指定了存储桶的名称。 + * .object(objectName)指定了对象(文件)的名称。 + */ + public static String getPreviewUrl(String objectName,String newBucket) throws Exception { + String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket; + + MinioClient minioClient = getMinioClient(); + return minioClient.getPresignedObjectUrl( + GetPresignedObjectUrlArgs.builder() + .method(Method.GET) + .bucket(bucketName) + .object(objectName) + .build()); + } + + /** + * 删除:从MinIO服务器上的指定存储桶中删除一个文件 + * + * @param objectName 指定要删除的文件对象名称(包括路径和文件名) + * @throws Exception + */ + public static void deleteFile(String objectName,String newBucket) throws Exception { + String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket; + + MinioClient minioClient = getMinioClient(); + minioClient.removeObject( + RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); + } + + //查询文件信息 + public static HashMap getFileAsMultipart(String objectName, String newBucket) throws Exception { + String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket; + MinioClient client = getMinioClient(); + + // 获取对象 + InputStream is = client.getObject(GetObjectArgs.builder() + .bucket(bucketName) + .object(objectName) + .build()); + + // 获取文件元信息(如 contentType) + StatObjectResponse stat = client.statObject(StatObjectArgs.builder() + .bucket(bucketName) + .object(objectName) + .build()); + + String contentType = stat.contentType(); + + // 将流读为 byte[] 以生成 MockMultipartFile + byte[] bytes = IoUtil.readBytes(is); // Hutool 工具类 + HashMap map = new HashMap<>(); + map.put("objectName",objectName); + map.put("contentType",contentType); + map.put("bytes",bytes); + + return map; + } + + + //文件复制 + public static void copyFile(String sourceObjectName, String targetObjectName, String sourceBucket, String targetBucket) throws Exception { + MinioClient client = getMinioClient(); + + // 使用服务器端复制,无需下载上传 + client.copyObject(CopyObjectArgs.builder() + .bucket(targetBucket) // 目标桶 + .object(targetObjectName) // 目标对象 + .source(CopySource.builder() + .bucket(sourceBucket) + .object(sourceObjectName) + .build()) + .build()); + } + + + + +} diff --git a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoMapper.xml b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoMapper.xml new file mode 100644 index 0000000..5d57f33 --- /dev/null +++ b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml index 4a938ec..dc1ab60 100644 --- a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml +++ b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml @@ -30,20 +30,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + - + + SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -11 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 0 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -11 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -10 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 1 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -10 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -9 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 2 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -9 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -8 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 3 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -8 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -7 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 4 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -7 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -6 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 5 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -6 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -5 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 6 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -5 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -4 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 7 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -4 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -3 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 8 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -3 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -2 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 9 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -2 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 10 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 MONTH), '%Y-%m') union all SELECT DATE_FORMAT(CURDATE(), '%Y-%m') AS dateMonth,count(1) total from business_alert ba - where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 11 MONTH), '%Y-%m') + where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(CURDATE(), '%Y-%m') + + + + + + + + + + - + + + + + + + diff --git a/dk-modules/sample/src/main/resources/mapper/IDeviceProMapper.xml b/dk-modules/sample/src/main/resources/mapper/IDeviceProMapper.xml index d685b89..f7e41db 100644 --- a/dk-modules/sample/src/main/resources/mapper/IDeviceProMapper.xml +++ b/dk-modules/sample/src/main/resources/mapper/IDeviceProMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -10,24 +10,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - - - - - - - - - - diff --git a/dk-modules/system/src/main/java/org/dromara/system/config/ProjectTablePrefixConfig.java b/dk-modules/system/src/main/java/org/dromara/system/config/ProjectTablePrefixConfig.java new file mode 100644 index 0000000..3e3e6c0 --- /dev/null +++ b/dk-modules/system/src/main/java/org/dromara/system/config/ProjectTablePrefixConfig.java @@ -0,0 +1,25 @@ +package org.dromara.system.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * 系统-表名配置 + * 多个profile环境中会查询不同表,需要处理拼接表名 ,比如 dk_business变成 w_dk_business + */ +@Data +@Configuration +@ConfigurationProperties(prefix = "projecttableprefix") +public class ProjectTablePrefixConfig { + + @Value("${projectTablePrefix.tableBusiness:dk_business") + private String tableBusiness; + + @Value("${projectTablePrefix.tableCloud:dk_cloud") + private String tableCloud; + + @Value("${projectTablePrefix.tableWorkflow:dk_workflow") + private String tableWorkflow; +} diff --git a/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteNoticeServiceImpl.java b/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteNoticeServiceImpl.java index 981c85a..12f890d 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteNoticeServiceImpl.java +++ b/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteNoticeServiceImpl.java @@ -1,5 +1,6 @@ package org.dromara.system.dubbo; +import cn.hutool.core.convert.Convert; import lombok.RequiredArgsConstructor; import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboService; @@ -9,9 +10,14 @@ import org.dromara.resource.api.RemoteMessageService; import org.dromara.system.api.RemoteNoticeService; import org.dromara.system.api.domain.bo.RemoteNoticeBo; import org.dromara.system.domain.SysNotice; +import org.dromara.system.domain.vo.SysDictDataVo; import org.dromara.system.mapper.SysNoticeMapper; +import org.dromara.system.service.ISysDictTypeService; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; /** @@ -27,12 +33,21 @@ public class RemoteNoticeServiceImpl implements RemoteNoticeService { private final SysNoticeMapper sysNoticeMapper; @DubboReference private final RemoteMessageService remoteMessageService; + private final ISysDictTypeService dictTypeService; + + private final ScheduledExecutorService scheduledExecutorService; @Override public int saveNotice(RemoteNoticeBo bo) { SysNotice notice = MapstructUtils.convert(bo, SysNotice.class); /*String type = dictService.getDictLabel("sys_notice_type", notice.getNoticeType());*/ - remoteMessageService.publishAll(bo.getParam()); + List data = dictTypeService.selectDictDataByType("ai_push"); + List list = data.stream().map(SysDictDataVo::getDictValue).distinct().toList().stream().map(Long::parseLong).toList(); + //获取字典值 + scheduledExecutorService.schedule(() -> { + remoteMessageService.publishMessage(list, bo.getParam()); + }, 3, TimeUnit.SECONDS); + return sysNoticeMapper.insert(notice); } } diff --git a/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java b/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java index b875fb1..cd3caaf 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java +++ b/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java @@ -8,6 +8,7 @@ import org.dromara.common.mybatis.annotation.DataColumn; import org.dromara.common.mybatis.annotation.DataPermission; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; import org.dromara.common.mybatis.helper.DataBaseHelper; +import org.dromara.system.config.ProjectTablePrefixConfig; import org.dromara.system.domain.SysDept; import org.dromara.system.domain.vo.SysDeptVo; import org.apache.ibatis.annotations.Param; @@ -72,5 +73,5 @@ public interface SysDeptMapper extends BaseMapperPlus { List> getNamePathList(); - List listTreeDept(@Param("deptId") Long deptId); + List listTreeDept(@Param("deptId") Long deptId, @Param("tbPrefix") ProjectTablePrefixConfig tbPrefix); } diff --git a/dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java b/dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java index ba3b6d0..fc6b37e 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java +++ b/dk-modules/system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import io.github.linpeilie.annotations.AutoMapper; import lombok.RequiredArgsConstructor; import org.dromara.common.core.constant.CacheNames; import org.dromara.common.core.constant.SystemConstants; @@ -21,6 +22,7 @@ import org.dromara.common.mybatis.helper.DataBaseHelper; import org.dromara.common.redis.utils.CacheUtils; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.system.api.domain.vo.RemoteDeptVo; +import org.dromara.system.config.ProjectTablePrefixConfig; import org.dromara.system.domain.SysDept; import org.dromara.system.domain.SysRole; import org.dromara.system.domain.SysUser; @@ -30,6 +32,7 @@ import org.dromara.system.mapper.SysDeptMapper; import org.dromara.system.mapper.SysRoleMapper; import org.dromara.system.mapper.SysUserMapper; import org.dromara.system.service.ISysDeptService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @@ -52,6 +55,9 @@ public class SysDeptServiceImpl implements ISysDeptService { private final SysRoleMapper roleMapper; private final SysUserMapper userMapper; + @Autowired + private ProjectTablePrefixConfig ptPrefix; + /** * 查询部门管理数据 * @@ -383,7 +389,7 @@ public class SysDeptServiceImpl implements ISysDeptService { @Override public List listTreeDept(Long deptId) { - return baseMapper.listTreeDept(deptId); + return baseMapper.listTreeDept(deptId, ptPrefix); //.getTableCloud() } } diff --git a/dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml b/dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml index dbd2264..a0af8f3 100644 --- a/dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/dk-modules/system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -84,19 +84,20 @@ deptId +