From 57dfe884e6e68b45e74e264c3990569fbd27819a Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 25 Jul 2023 15:44:15 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=B7=A1=E6=A3=80=E4=BB=BB=E5=8A=A1=E6=B4=BE?= =?UTF-8?q?=E5=8F=91=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/vo/WindAreaDutyVo.java | 12 + .../java/com/hnac/hzinfo/inspect/Constants.java | 1 + .../com/hnac/hzinfo/inspect/task/TaskContants.java | 4 + .../scheduled/mapper/inspect/ContentMapper.java | 12 + .../scheduled/mapper/inspect/ObjectMapper.java | 13 + .../scheduled/mapper/inspect/ObjectUserMapper.java | 13 + .../hzims/scheduled/mapper/inspect/PlanMapper.java | 12 + .../mapper/inspect/PlanObjectTemplateMapper.java | 13 + .../scheduled/mapper/inspect/PlanOrgMapper.java | 13 + .../mapper/inspect/PlanPositionMapper.java | 14 + .../scheduled/mapper/inspect/PlanUserMapper.java | 13 + .../mapper/inspect/ProjectContentMapper.java | 15 + .../scheduled/mapper/inspect/ProjectMapper.java | 13 + .../scheduled/mapper/inspect/TaskObjectMapper.java | 13 + .../inspect/TaskObjectProjectContentMapper.java | 16 + .../mapper/inspect/TaskObjectProjectMapper.java | 17 + .../scheduled/mapper/inspect/TaskResultMapper.java | 13 + .../scheduled/mapper/inspect/TaskUserMapper.java | 13 + .../scheduled/mapper/inspect/TemplateMapper.java | 15 + .../mapper/inspect/TemplateProjectMapper.java | 13 + .../scheduled/mapper/operation/DutyMainMapper.java | 17 + .../scheduled/scheduled/BusinessScheduledTask.java | 40 ++ .../scheduled/scheduled/MonitorScheduledTask.java | 2 +- .../scheduled/RealTargetScheduledTask.java | 1 + .../scheduled/scheduled/ReportScheduledTask.java | 1 + .../scheduled/scheduled/ShowScheduledTask.java | 1 + .../scheduled/service/inspect/ContentService.java | 11 + .../scheduled/service/inspect/ObjectService.java | 11 + .../service/inspect/ObjectUserService.java | 11 + .../service/inspect/PlanObjectTemplateService.java | 11 + .../scheduled/service/inspect/PlanOrgService.java | 11 + .../service/inspect/PlanPositionService.java | 11 + .../scheduled/service/inspect/PlanService.java | 12 + .../scheduled/service/inspect/PlanUserService.java | 13 + .../service/inspect/ProjectContentService.java | 12 + .../scheduled/service/inspect/ProjectService.java | 12 + .../inspect/TaskObjectProjectContentService.java | 11 + .../service/inspect/TaskObjectProjectService.java | 11 + .../service/inspect/TaskObjectService.java | 15 + .../service/inspect/TaskRemindManager.java | 296 +++++++++ .../service/inspect/TaskResultService.java | 11 + .../scheduled/service/inspect/TaskService.java | 2 + .../scheduled/service/inspect/TaskUserService.java | 13 + .../service/inspect/TaskVideoManager.java | 98 +++ .../service/inspect/TemplateProjectService.java | 12 + .../scheduled/service/inspect/TemplateService.java | 11 + .../service/inspect/impl/ContentServiceImpl.java | 31 + .../service/inspect/impl/ObjectServiceImpl.java | 19 + .../inspect/impl/ObjectUserServiceImpl.java | 21 + .../impl/PlanObjectTemplateServiceImpl.java | 21 + .../service/inspect/impl/PlanOrgServiceImpl.java | 15 + .../inspect/impl/PlanPositionServiceImpl.java | 22 + .../service/inspect/impl/PlanServiceImpl.java | 21 + .../service/inspect/impl/PlanUserServiceImpl.java | 21 + .../inspect/impl/ProjectContentServiceImpl.java | 23 + .../service/inspect/impl/ProjectServiceImpl.java | 22 + .../impl/TaskObjectProjectContentServiceImpl.java | 23 + .../inspect/impl/TaskObjectProjectServiceImpl.java | 24 + .../inspect/impl/TaskObjectServiceImpl.java | 25 + .../inspect/impl/TaskResultServiceImpl.java | 21 + .../service/inspect/impl/TaskServiceImpl.java | 716 ++++++++++++++++++++- .../service/inspect/impl/TaskUserServiceImpl.java | 23 + .../inspect/impl/TemplateProjectServiceImpl.java | 34 + .../service/inspect/impl/TemplateServiceImpl.java | 20 + .../service/operation/DutyMainService.java | 13 + .../operation/impl/DutyMainServiceImpl.java | 44 ++ .../resources/mapper/inspect/ContentMapper.xml | 5 + .../resources/mapper/inspect/DutyMainMapper.xml | 21 + .../main/resources/mapper/inspect/ObjectMapper.xml | 5 + .../resources/mapper/inspect/ObjectUserMapper.xml | 5 + .../main/resources/mapper/inspect/PlanMapper.xml | 5 + .../mapper/inspect/PlanObjectTemplateMapper.xml | 5 + .../resources/mapper/inspect/PlanOrgMapper.xml | 5 + .../mapper/inspect/PlanPositionMapper.xml | 5 + .../resources/mapper/inspect/PlanUserMapper.xml | 5 + .../mapper/inspect/ProjectContentMapper.xml | 5 + .../resources/mapper/inspect/ProjectMapper.xml | 5 + .../main/resources/mapper/inspect/TaskMapper.xml | 3 +- .../resources/mapper/inspect/TaskObjectMapper.xml | 5 + .../inspect/TaskObjectProjectContentMapper.xml | 5 + .../mapper/inspect/TaskObjectProjectMapper.xml | 6 + .../resources/mapper/inspect/TaskResultMapper.xml | 5 + .../resources/mapper/inspect/TaskUserMapper.xml | 5 + .../resources/mapper/inspect/TemplateMapper.xml | 5 + .../mapper/inspect/TemplateProjectMapper.xml | 5 + .../station/controller/ImsDeptController.java | 2 +- 86 files changed, 2170 insertions(+), 6 deletions(-) create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ContentMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectUserMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanObjectTemplateMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanOrgMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanPositionMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanUserMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectContentMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectContentMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskResultMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskUserMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateProjectMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DutyMainMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BusinessScheduledTask.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ContentService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectUserService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanObjectTemplateService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanOrgService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanPositionService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanUserService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectContentService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectContentService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskRemindManager.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskResultService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskUserService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskVideoManager.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateProjectService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ContentServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectUserServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanObjectTemplateServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanOrgServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanPositionServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanUserServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectContentServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectContentServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskResultServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskUserServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateProjectServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DutyMainService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DutyMainServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ContentMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/DutyMainMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectUserMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanObjectTemplateMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanOrgMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanPositionMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanUserMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectContentMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectContentMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskResultMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskUserMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateProjectMapper.xml diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java index 89f5c9d..104dde6 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java @@ -109,38 +109,50 @@ public class WindAreaDutyVo { /**=============================================风电指标数据=============================================**/ @ApiModelProperty("计划发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double plan; @ApiModelProperty(value = "年实际发电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generate; @ApiModelProperty(value = "年发电量完成率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double generateComplete; @ApiModelProperty("平均风速: m/s") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double speed; @ApiModelProperty("上网电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double surfPower; @ApiModelProperty("下网电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double belowPower; @ApiModelProperty("可用时长") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double available; @ApiModelProperty("综合用电量") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double comprehensivePower; @ApiModelProperty("峰值功率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double peakPower; @ApiModelProperty("故障时长: 单位-小时") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double faultHours; @ApiModelProperty("短期预测准确率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double accuracy; @ApiModelProperty("超短准确率") + @JsonSerialize(nullsUsing = NullSerializer.class) private Double ultraShortAccuracy; } diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java index fc2195b..9887f7c 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java @@ -6,6 +6,7 @@ import lombok.Getter; * @Author: py */ public class Constants { + public final static String APP_NAME = "hzinfo-inspect"; /** diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/TaskContants.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/TaskContants.java index 287cd05..3d1e0b2 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/TaskContants.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/TaskContants.java @@ -13,6 +13,10 @@ import java.util.Set; * */ public interface TaskContants { + + // 巡检任务派发 定时任务 + String INSPECT_TASK_DISTRIBUTE = "taskJobDistribute"; + /** * 处理同时开启几个任务的 */ diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ContentMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ContentMapper.java new file mode 100644 index 0000000..159ec5c --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ContentMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface ContentMapper extends BaseMapper{ +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectMapper.java new file mode 100644 index 0000000..b130b94 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.ObjectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface ObjectMapper extends BaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectUserMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectUserMapper.java new file mode 100644 index 0000000..bf7bd6b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectUserMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface ObjectUserMapper extends BaseMapper{ + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java new file mode 100644 index 0000000..e4a1c2d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +@Mapper +public interface PlanMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanObjectTemplateMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanObjectTemplateMapper.java new file mode 100644 index 0000000..cffeb83 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanObjectTemplateMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.plan.entity.PlanObjectTemplateEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface PlanObjectTemplateMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanOrgMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanOrgMapper.java new file mode 100644 index 0000000..7a9b54f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanOrgMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.plan.entity.PlanOrgEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface PlanOrgMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanPositionMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanPositionMapper.java new file mode 100644 index 0000000..31ee860 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanPositionMapper.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.plan.entity.PlanPositionEntity; +import org.apache.ibatis.annotations.Mapper; + + +/** + * @author ysj + */ +@Mapper +public interface PlanPositionMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanUserMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanUserMapper.java new file mode 100644 index 0000000..6d4d19e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanUserMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.plan.entity.PlanUserEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface PlanUserMapper extends BaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectContentMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectContentMapper.java new file mode 100644 index 0000000..8e9ae3e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectContentMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author ysj + */ +@Mapper +public interface ProjectContentMapper extends BaseMapper{ + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectMapper.java new file mode 100644 index 0000000..c237f71 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface ProjectMapper extends BaseMapper{ + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectMapper.java new file mode 100644 index 0000000..0c0869c --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface TaskObjectMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectContentMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectContentMapper.java new file mode 100644 index 0000000..4bdca02 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectContentMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author ysj + */ +@Mapper +public interface TaskObjectProjectContentMapper extends BaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectMapper.java new file mode 100644 index 0000000..6279cdf --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectMapper.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; +import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author ysj + */ +@Mapper +public interface TaskObjectProjectMapper extends BaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskResultMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskResultMapper.java new file mode 100644 index 0000000..ee0f34b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskResultMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.task.entity.TaskResultEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface TaskResultMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskUserMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskUserMapper.java new file mode 100644 index 0000000..83c6db3 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskUserMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface TaskUserMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateMapper.java new file mode 100644 index 0000000..0b82110 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author ysj + */ +@Mapper +public interface TemplateMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateProjectMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateProjectMapper.java new file mode 100644 index 0000000..6d42089 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateProjectMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ysj + */ +@Mapper +public interface TemplateProjectMapper extends BaseMapper{ + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DutyMainMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DutyMainMapper.java new file mode 100644 index 0000000..08159cf --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DutyMainMapper.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; +import com.hnac.hzims.operational.duty.vo.*; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.annotation.UserDataAuth; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.List; +import java.util.Map; + +/** + * @author ysj + */ +public interface DutyMainMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BusinessScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BusinessScheduledTask.java new file mode 100644 index 0000000..1c353d9 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BusinessScheduledTask.java @@ -0,0 +1,40 @@ +package com.hnac.hzims.scheduled.scheduled; + +import com.hnac.hzims.scheduled.service.inspect.TaskService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.util.Date; + +import static com.hnac.hzinfo.inspect.task.TaskContants.INSPECT_TASK_DISTRIBUTE; + + +/** + * 业务模块定时任务 + * @author ysj + */ +@Slf4j +@Component +public class BusinessScheduledTask { + + @Autowired + private TaskService service; + + /** + * 首页-指标数据加载 + */ + @XxlJob(INSPECT_TASK_DISTRIBUTE) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT inspectTaskDistribute(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.inspectTaskDistribute(param); + return new ReturnT<>("SUCCESS"); + } + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java index ee4a1a1..78cb8d8 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java @@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Date; @@ -16,6 +15,7 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.*; /** + * 监测点定时任务 * @author ysj */ @Slf4j diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java index 3834f1a..6a55529 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java @@ -19,6 +19,7 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.*; /** + * 各厂站实时/指标数据 定时任务 * @author ysj */ @Slf4j diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java index 7f59697..5146c24 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java @@ -15,6 +15,7 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.AREA_MONTH_ /** + * 报表定时任务 * @author ysj */ @Slf4j diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java index e8d43b6..e10c021 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java @@ -16,6 +16,7 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.*; /** + * 智能生产定时任务 * @author ysj */ @Slf4j diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ContentService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ContentService.java new file mode 100644 index 0000000..f1f04cf --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ContentService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface ContentService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectService.java new file mode 100644 index 0000000..7512337 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.obj.entity.ObjectEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface ObjectService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectUserService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectUserService.java new file mode 100644 index 0000000..2963621 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectUserService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface ObjectUserService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanObjectTemplateService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanObjectTemplateService.java new file mode 100644 index 0000000..9c7314f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanObjectTemplateService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.plan.entity.PlanObjectTemplateEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface PlanObjectTemplateService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanOrgService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanOrgService.java new file mode 100644 index 0000000..3372f82 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanOrgService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.plan.entity.PlanOrgEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface PlanOrgService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanPositionService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanPositionService.java new file mode 100644 index 0000000..334cfc6 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanPositionService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.plan.entity.PlanPositionEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface PlanPositionService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java new file mode 100644 index 0000000..ac2b6aa --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface PlanService extends BaseService { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanUserService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanUserService.java new file mode 100644 index 0000000..7634f14 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanUserService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.plan.entity.PlanUserEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * 巡检计划用户模板服务类 + * + * @author Chill + */ +public interface PlanUserService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectContentService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectContentService.java new file mode 100644 index 0000000..82cd962 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectContentService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.inspect; + + +import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface ProjectContentService extends BaseService{ + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectService.java new file mode 100644 index 0000000..ef2a474 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.inspect; + + +import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface ProjectService extends BaseService{ + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectContentService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectContentService.java new file mode 100644 index 0000000..0db0ebb --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectContentService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface TaskObjectProjectContentService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectService.java new file mode 100644 index 0000000..400d84b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface TaskObjectProjectService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectService.java new file mode 100644 index 0000000..2b6c0d6 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; +import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; +import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface TaskObjectService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskRemindManager.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskRemindManager.java new file mode 100644 index 0000000..94d7f06 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskRemindManager.java @@ -0,0 +1,296 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzinfo.core.push.enums.PushAudienceType; +import com.hnac.hzinfo.core.push.model.PushAudience; +import com.hnac.hzinfo.core.push.model.PushInfo; +import com.hnac.hzinfo.core.push.model.PushPlatform; +import com.hnac.hzinfo.inspect.task.TaskContants; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import com.hnac.hzinfo.inspect.task.job.HzThreadPool; +import com.xxl.job.core.log.XxlJobLogger; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.sms.model.SmsResponse; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.resource.feign.IPushClient; +import org.springblade.resource.feign.ISmsClient; +import org.springblade.resource.vo.PushInfoVO; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.DefaultTypedTuple; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +/** + * 巡检任务通知、短信提醒管理器 + * 提醒列表使用redis缓存 + * + * @author py + */ +@Slf4j +@Component +public class TaskRemindManager { + + /** + * 巡检任务开始前发送短信信息阿里云模板 + **/ + @Value("${hzims.inspect.task.templateCode.taskBegin}") + private String taskBeginTemplateCode; + + /** + * 巡检任务结束前发送短信信息阿里云模板 + **/ + @Value("${hzims.inspect.task.templateCode.taskEnd}") + private String taskEndTemplateCode; + + /** + * 巡检消息推送模板 - 极光 + **/ + @Value("${hzims.inspect.task.jgPushCode}") + private String jgPushCode; + + @Autowired + private TaskService taskService; + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private ISmsClient smsClient; + @Autowired + private IPushClient pushClient; + + + /** + * 开始前提醒任务列表 + */ + final static String REMIND_TASK_BEGIN_LIST = "hzinfo:remind:begin:tasks"; + /** + * 结束前提醒任务列表 + */ + final static String REMIND_TASK_END_LIST = "hzinfo:remind:end:tasks"; + + /** + * 开始 + * 重置redis开始提醒缓存列表 + * 按照时间排序 : 正序 + */ + public void replaceBeginTaskCacheList(List taskBegin){ + //先删除 + redisTemplate.opsForZSet().removeRange(REMIND_TASK_BEGIN_LIST,0, -1); + setTaskBeginList(taskBegin); + } + + /** + * 结束 + * 重置redis结束提醒缓存列表 + * 按照时间排序 : 正序 + */ + public void replaceEndTaskCacheList(List taskEnd){ + //先删除 + redisTemplate.opsForZSet().removeRange(REMIND_TASK_END_LIST,0, -1); + setTaskEndList(taskEnd); + } + + /** + * 开始 + * 任务批量加入redis提醒缓存列表中 + * + */ + public void setTaskBeginList(List tasks){ + HashSet set = new HashSet(); + + for (TaskEntity task : tasks) { + DefaultTypedTuple tuple = new DefaultTypedTuple<>(task, (double) task.getStartRemindTime().toEpochSecond(ZoneOffset.of("+8"))); + set.add(tuple); + } + if(Func.isNotEmpty(set)){ + redisTemplate.opsForZSet().add(REMIND_TASK_BEGIN_LIST, set); + } + } + + /** + * 结束 + * 任务批量加入redis提醒缓存列表中 + */ + public void setTaskEndList(List tasks){ + HashSet set = new HashSet(); + for (TaskEntity task : tasks) { + DefaultTypedTuple tuple = new DefaultTypedTuple<>(task, (double) task.getEndRemindTime().toEpochSecond(ZoneOffset.of("+8"))); + set.add(tuple); + } + if(Func.isNotEmpty(set)){ + redisTemplate.opsForZSet().add(REMIND_TASK_END_LIST, set); + } + } + + + /** + * 把任务加入redis提醒缓存列表中 + * 加入的时候 按照时间排序 : 正序 + */ + public void addTaskToCacheList(TaskEntity task){ + DateTimeFormatter dfShort = DateTimeFormatter.ofPattern("yyyy-MM-dd "); + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + redisTemplate.expire(REMIND_TASK_BEGIN_LIST,365,TimeUnit.DAYS); + if(task.getStartRemindTime().isAfter(LocalDateTime.parse(dfShort.format(LocalDate.now()) + "00:00:00", df))){ + redisTemplate.opsForZSet().add(REMIND_TASK_BEGIN_LIST, task, task.getStartRemindTime().toEpochSecond(ZoneOffset.of("+8"))); + log.info("--------------- key = hzinfo:remind:begin:tasks ---- size = " + redisTemplate.opsForZSet().size(REMIND_TASK_BEGIN_LIST)); + } + + if(task.getEndRemindTime().isAfter(LocalDateTime.parse(dfShort.format(LocalDate.now()) + "00:00:00", df))){ + redisTemplate.opsForZSet().add(REMIND_TASK_END_LIST, task, task.getEndRemindTime().toEpochSecond(ZoneOffset.of("+8"))); + log.info("--------------- key = hzinfo:remind:end:tasks ---- size = " + redisTemplate.opsForZSet().size(REMIND_TASK_END_LIST)); + } + } + + /** + * 任务开始前 + */ + static final int BEGIN_SEND_FLAG = 1; + /** + * 任务结束前 + */ + static final int END_SEND_FLAG = 2; + + /** + * 任务开始、结束前提醒 + */ + public void taskRemind(){ + sendMsg(BEGIN_SEND_FLAG); + sendMsg(END_SEND_FLAG); + } + + /** + * 任务开始、结束前提醒 + */ + public void cleanCache(){ + long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")); + String key = REMIND_TASK_BEGIN_LIST; + for (int i = 0; i < 2; i++) { + if(i == 1 ){ + key = REMIND_TASK_END_LIST; + } + Set tasks = redisTemplate.opsForZSet().rangeByScore(key,0, currentTime); + if(Func.isNotEmpty(tasks)){ + for (TaskEntity task : tasks) { + //用户id为空,删除数据 + redisTemplate.opsForZSet().remove(key, task); + } + } + log.info(key + " 清空cache后 ---- size = " + redisTemplate.opsForZSet().size(key)); + } + + } + + /** + * 任务开始/结束前 + * 推送消息、发送短信 + * @param sendFlag 发送标识:任务开始前提醒 1;任务结束前提醒 2; + */ + private void sendMsg(int sendFlag){ + //redis key; 消息推送标题; 短信模板code + String key = "", title = "", templateCode = ""; + + switch (sendFlag){ + case BEGIN_SEND_FLAG: + key = REMIND_TASK_BEGIN_LIST; + title = "任务开始前提醒"; + templateCode = taskBeginTemplateCode; + break; + case END_SEND_FLAG: + key = REMIND_TASK_END_LIST; + title = "任务结束前提醒"; + templateCode = taskEndTemplateCode; + break; + default: + break; + } + + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")); + Set tasks = redisTemplate.opsForZSet().rangeByScore(key,0, currentTime); + if(Func.isNotEmpty(tasks)){ + //若该任务已完成 则无需再进行短信推送 + List taskIds = tasks.stream().map(TaskEntity::getId).collect(Collectors.toList()); + List undoneTaskList = taskService.list(Wrappers.lambdaQuery() + .ne(TaskEntity::getStatus, TaskContants.TaskStatusEnum.FINISH_STATUS.getStatus()) + .in(TaskEntity::getId, taskIds) + ); + if(CollectionUtil.isEmpty(undoneTaskList)) { + XxlJobLogger.log("巡检短信通知列表为空;redis内取出数据为:" + JSON.toJSONString(taskIds)); + return; + } + List undoneTaskIds = undoneTaskList.stream().map(TaskEntity::getId).collect(Collectors.toList()); + for (TaskEntity task : tasks) { + if(!undoneTaskIds.contains(task.getId())) { + XxlJobLogger.log(task.getId()+"巡检任务已完成,无需推送短信"); + return; + } + XxlJobLogger.log(task.getId()+"开始推送消息!"); + // 移动端消息推送 : 使用 用户id做TAG,前端注册用户id为TAG + PushInfoVO pushInfoVO = new PushInfoVO(); + pushInfoVO.setTenantId(task.getTenantId()); + PushPlatform platform = PushPlatform.all(); + Map> audienceMap = new HashMap<>(); + audienceMap.put(PushAudienceType.TAG, Collections.singletonList(task.getUserId().toString())); + PushAudience audience = new PushAudience(false, audienceMap); + PushInfo pushInfo = new PushInfo(jgPushCode + , title + , "任务“"+ task.getPlanName() + "”的计划执行时间是:" + df.format(task.getPlanStartTime())+ " —— " + df.format(task.getPlanEndTime()) + , "" + , null + , platform + , audience); + pushInfoVO.setPushInfo(pushInfo); + + Map smsMap = new HashMap<>(3); + smsMap.put("one", task.getPlanName()); + if(sendFlag == BEGIN_SEND_FLAG){ + smsMap.put("two", df.format(task.getPlanStartTime())); + } else if(sendFlag == END_SEND_FLAG){ + smsMap.put("two", df.format(task.getPlanEndTime())); + } //smsMap.put("three", df.format(task.getPlanEndTime())); + + + String jsonParam = JSON.toJSONString(smsMap); + + User user = UserCache.getUser(task.getUserId()); + String userPhone = Func.isNotEmpty(user) ? user.getPhone() : null; + log.info("------------ 发送短信 用户手机号 = " + userPhone); + + String finalTemplateCode = templateCode; + XxlJobLogger.log(task.getId()+"开始推送短信!"); + ThreadFactory threadFactory = Executors.defaultThreadFactory(); + ThreadPoolExecutor pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingDeque(), threadFactory); + pool.execute(() -> { + if(Func.isNotEmpty(userPhone)){ + // 发送短信 + R success = smsClient.sendMessage(task.getTenantId(), finalTemplateCode, jsonParam, userPhone); + log.info("msg -- 用户手机号:" + userPhone + " ; 短信内容:" + jsonParam + " ; TenantId:" + task.getTenantId() + " ; finalTemplateCode:" + finalTemplateCode + ";返回信息 = " + (Func.isNotEmpty(success)?success.toString(): "返回为空")); + } + //推送消息给移动端 + pushClient.tenantPush(pushInfoVO); + log.info("msg -- 推送信息完成" ); + }); + + //把已发送的数据移除 + // redisTemplate.opsForZSet().remove(key, task); + log.info("已推送、发送短信后 --------------- key = " + key + " ---- size = " + redisTemplate.opsForZSet().size(key)); + } + } + } + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskResultService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskResultService.java new file mode 100644 index 0000000..960f773 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskResultService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.task.entity.TaskResultEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface TaskResultService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java index 6d25531..4e3aa2b 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java @@ -11,5 +11,7 @@ import java.util.List; */ public interface TaskService extends BaseService { + void inspectTaskDistribute(String param); + DutyInspectTaskVO task(String start, String end, List areas); } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskUserService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskUserService.java new file mode 100644 index 0000000..558a4c6 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskUserService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface TaskUserService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskVideoManager.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskVideoManager.java new file mode 100644 index 0000000..23c4340 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskVideoManager.java @@ -0,0 +1,98 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.ai.dto.VideoReturnDTO; +import com.hnac.hzinfo.inspect.plan.PlanContants; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + + +/** + * 视频巡检任务 + * 提醒列表使用redis缓存 + * @Author: py + */ +@Component +public class TaskVideoManager { + + /** + * 视频巡检任务列表 + */ + final static String VIDEO_TASK_LIST = "hzinfo:video:tasks"; + + /** + * 视频巡检 AI识别结果列表 + */ + final static String VIDEO_TASK_AI_RESULT= "hzinfo:video:ai:results"; + + @Autowired + private RedisTemplate redisTemplate; + + /** + * 把AI识别结果加入redis缓存中 + */ + public void addAiResultToMap(VideoReturnDTO returnDTO){ + redisTemplate.opsForHash().put(VIDEO_TASK_AI_RESULT, returnDTO.getVideo(), returnDTO); + } + + /** + * 从redis缓存中取出AI识别结果 + */ + public VideoReturnDTO getAiResultFromMap(String video){ + if(redisTemplate.opsForHash().hasKey(VIDEO_TASK_AI_RESULT, video)){ + return (VideoReturnDTO)redisTemplate.opsForHash().get(VIDEO_TASK_AI_RESULT, video); + } + return null; + } + + + + /** + * 把任务加入redis提醒缓存列表中 + */ + public void addTaskToVideoCacheList(TaskEntity task){ + if(task.getAutoVideo().equals(PlanContants.InspectTypeEnum.VIDEO.getVal())){ + redisTemplate.opsForHash().put(VIDEO_TASK_LIST, task.getId(), task); + } + } + + + /** + * 把任务加入redis提醒缓存列表中 + */ + public void deleteTaskFromCacheList(TaskEntity task){ + redisTemplate.opsForHash().delete(VIDEO_TASK_LIST, task.getId()); + } + + + /** + * + */ + public void deleteTaskFromCacheList(String taskId){ + redisTemplate.opsForHash().delete(VIDEO_TASK_LIST, taskId); + } + + /** + * 从缓存中取出当前时间加一分钟之前的所有数据 + */ + public List getTasksFromCacheList(){ + List tasks = new ArrayList<>(); + HashMap map = (HashMap) redisTemplate.opsForHash().entries(VIDEO_TASK_LIST); + map.forEach((id, task) ->{ + if(task.getPlanStartTime().isBefore(LocalDateTime.now().plusMinutes(1L))){ + tasks.add(task); + deleteTaskFromCacheList(id); + } + }); + return tasks; + } + + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateProjectService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateProjectService.java new file mode 100644 index 0000000..d67b8df --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateProjectService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.inspect; + + +import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface TemplateProjectService extends BaseService{ + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateService.java new file mode 100644 index 0000000..f0e8005 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface TemplateService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ContentServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ContentServiceImpl.java new file mode 100644 index 0000000..21020c5 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ContentServiceImpl.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.ContentService; +import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; +import com.hnac.hzinfo.inspect.obj.mapper.ContentMapper; +import com.hnac.hzinfo.inspect.obj.services.DatabaseCopyHandler; +import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class ContentServiceImpl extends BaseServiceImpl implements ContentService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java new file mode 100644 index 0000000..4aa787a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.mapper.inspect.ObjectMapper; +import com.hnac.hzims.scheduled.service.inspect.ObjectService; +import com.hnac.hzinfo.inspect.obj.entity.ObjectEntity; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class ObjectServiceImpl extends BaseServiceImpl implements ObjectService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectUserServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectUserServiceImpl.java new file mode 100644 index 0000000..4da90a4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectUserServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.ObjectUserService; +import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity; +import com.hnac.hzinfo.inspect.obj.mapper.ObjectUserMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class ObjectUserServiceImpl extends BaseServiceImpl implements ObjectUserService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanObjectTemplateServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanObjectTemplateServiceImpl.java new file mode 100644 index 0000000..3dda58f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanObjectTemplateServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.PlanObjectTemplateService; +import com.hnac.hzinfo.inspect.plan.entity.PlanObjectTemplateEntity; +import com.hnac.hzinfo.inspect.plan.mapper.PlanObjectTemplateMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class PlanObjectTemplateServiceImpl extends BaseServiceImpl implements PlanObjectTemplateService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanOrgServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanOrgServiceImpl.java new file mode 100644 index 0000000..3b97ec7 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanOrgServiceImpl.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.hnac.hzims.scheduled.service.inspect.PlanOrgService; +import com.hnac.hzinfo.inspect.plan.entity.PlanOrgEntity; +import com.hnac.hzinfo.inspect.plan.mapper.PlanOrgMapper; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +public class PlanOrgServiceImpl extends BaseServiceImpl implements PlanOrgService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanPositionServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanPositionServiceImpl.java new file mode 100644 index 0000000..c61a5f5 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanPositionServiceImpl.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzinfo.inspect.plan.entity.PlanPositionEntity; +import com.hnac.hzinfo.inspect.plan.mapper.PlanPositionMapper; +import com.hnac.hzinfo.inspect.plan.service.IPlanPositionService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class PlanPositionServiceImpl extends BaseServiceImpl implements IPlanPositionService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java new file mode 100644 index 0000000..4ac6701 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.mapper.inspect.PlanMapper; +import com.hnac.hzims.scheduled.service.inspect.PlanService; +import com.hnac.hzinfo.inspect.plan.entity.PlanEntity; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class PlanServiceImpl extends BaseServiceImpl implements PlanService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanUserServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanUserServiceImpl.java new file mode 100644 index 0000000..a73e57a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanUserServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.PlanUserService; +import com.hnac.hzinfo.inspect.plan.entity.PlanUserEntity; +import com.hnac.hzinfo.inspect.plan.mapper.PlanUserMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class PlanUserServiceImpl extends BaseServiceImpl implements PlanUserService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectContentServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectContentServiceImpl.java new file mode 100644 index 0000000..69aab3d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectContentServiceImpl.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.ProjectContentService; +import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; +import com.hnac.hzinfo.inspect.obj.mapper.ProjectContentMapper; +import com.hnac.hzinfo.inspect.obj.services.DatabaseCopyHandler; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class ProjectContentServiceImpl extends BaseServiceImpl implements ProjectContentService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectServiceImpl.java new file mode 100644 index 0000000..a41d5b9 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectServiceImpl.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.ProjectService; +import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import com.hnac.hzinfo.inspect.obj.mapper.ProjectMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class ProjectServiceImpl extends BaseServiceImpl implements ProjectService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectContentServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectContentServiceImpl.java new file mode 100644 index 0000000..cdfc58e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectContentServiceImpl.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.TaskObjectProjectContentService; +import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity; +import com.hnac.hzinfo.inspect.task.mapper.TaskObjectProjectContentMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TaskObjectProjectContentServiceImpl extends BaseServiceImpl implements TaskObjectProjectContentService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectServiceImpl.java new file mode 100644 index 0000000..9c0b12f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectServiceImpl.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.TaskObjectProjectService; +import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity; +import com.hnac.hzinfo.inspect.task.mapper.TaskObjectProjectMapper; +import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TaskObjectProjectServiceImpl extends BaseServiceImpl implements TaskObjectProjectService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectServiceImpl.java new file mode 100644 index 0000000..2b7856d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectServiceImpl.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.TaskObjectService; +import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; +import com.hnac.hzinfo.inspect.task.mapper.TaskObjectMapper; +import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; +import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TaskObjectServiceImpl extends BaseServiceImpl implements TaskObjectService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskResultServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskResultServiceImpl.java new file mode 100644 index 0000000..438d74d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskResultServiceImpl.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.TaskResultService; +import com.hnac.hzinfo.inspect.task.entity.TaskResultEntity; +import com.hnac.hzinfo.inspect.task.mapper.TaskResultMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TaskResultServiceImpl extends BaseServiceImpl implements TaskResultService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java index e323d5b..925e765 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java @@ -1,18 +1,47 @@ package com.hnac.hzims.scheduled.service.inspect.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.hnac.hzims.operational.duty.vo.ImsDutyMainFeignVO; import com.hnac.hzims.scheduled.mapper.inspect.TaskMapper; -import com.hnac.hzims.scheduled.service.inspect.TaskService; -import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import com.hnac.hzims.scheduled.service.inspect.*; +import com.hnac.hzims.scheduled.service.operation.DutyMainService; +import com.hnac.hzinfo.inspect.obj.entity.*; +import com.hnac.hzinfo.inspect.plan.PlanContants; +import com.hnac.hzinfo.inspect.plan.entity.*; +import com.hnac.hzinfo.inspect.task.TaskContants; +import com.hnac.hzinfo.inspect.task.entity.*; +import com.hnac.hzinfo.inspect.task.job.service.TaskRemindManager; +import com.hnac.hzinfo.inspect.task.job.service.TaskVideoManager; import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; +import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.WeekFields; +import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; @@ -25,6 +54,687 @@ import java.util.stream.Collectors; @DS("inspect") public class TaskServiceImpl extends BaseServiceImpl implements TaskService { + private final PlanService planService; + + private final ObjectService objectService; + + private final PlanOrgService planOrgService; + + private final ContentService contentService; + + private final ProjectService projectService; + + private final TemplateService templateService; + + private final DutyMainService dutyMainService; + + private final PlanUserService planUserService; + + private final TaskUserService taskUserService; + + private final ObjectUserService objectUserService; + + private final TaskResultService taskResultService; + + private final TaskObjectService taskObjectService; + + private final PlanPositionService planPostionService; + + private final ProjectContentService projectContentService; + + private final TemplateProjectService templateProjectService; + + private final TaskObjectProjectService taskObjectProjectService; + + private final PlanObjectTemplateService planObjectTemplateService; + + private final TaskObjectProjectContentService taskObjectProjectContentService; + + private final TaskVideoManager taskVideoManager; + + private final TaskRemindManager remindCacheManager; + + private final IUserClient userClient; + + /** + * 巡检任务派发 + * @param param + */ + @Override + public void inspectTaskDistribute(String param) { + // 清理无效任务 + this.close(); + + // 派发任务状态前置修改 + this.status(); + + // 遍历派发任务 + this.distribute(); + } + + + /** + * 清理无效任务 + */ + private void close() { + // 关闭超过计划结束时间 、已审核 、派发中的巡检计划 + UpdateWrapper plan = new UpdateWrapper<>(); + plan.lambda().set(PlanEntity::getStatus, Integer.valueOf(PlanContants.PlanStatusEnum.FINISH_STATUS.getStatus())) + .in(PlanEntity::getStatus, Integer.valueOf(PlanContants.PlanStatusEnum.PAUSE_STATUS.getStatus()), Integer.valueOf(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus()), Integer.valueOf(PlanContants.PlanStatusEnum.UNDERWAY_STATUS.getStatus())) + .lt(PlanEntity::getEndTime, LocalDate.now()); + this.planService.update(plan); + //关闭超过计划结束时间的巡检任务 + UpdateWrapper task = new UpdateWrapper<>(); + task.lambda().set(TaskEntity::getStatus, Integer.valueOf(TaskContants.TaskStatusEnum.UNFINISH_STATUS.getStatus())) + .ne(TaskEntity::getStatus, Integer.valueOf(TaskContants.TaskStatusEnum.FINISH_STATUS.getStatus())) + .lt(TaskEntity::getPlanEndTime, LocalDate.now()); + this.update(task); + } + + /** + * 派发状态前置 : 已审核计划 且 已过计划开始时间 + */ + private void status() { + UpdateWrapper plan = new UpdateWrapper<>(); + plan.lambda().set(PlanEntity::getStatus, Integer.valueOf(PlanContants.PlanStatusEnum.UNDERWAY_STATUS.getStatus())) + .eq(PlanEntity::getStatus, Integer.valueOf(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus())) + .le(PlanEntity::getStartTime, LocalDate.now()); + this.planService.update(plan); + } + + /** + * 派发任务 + */ + private void distribute() { + // 查询需要派发任务列表 + List plans = planService.list(Wrappers.lambdaQuery() + .eq(PlanEntity::getStatus,Integer.valueOf(PlanContants.PlanStatusEnum.UNDERWAY_STATUS.getStatus()))); + if(CollectionUtil.isEmpty(plans)){ + return; + } + plans.forEach(plan->{ + if(PlanContants.PlanCycleEnum.NEVER_CYCLE.getCycle().equals(plan.getCycle())){//计划周期每次,只需要派发一次任务 + plan.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.FINISH_STATUS.getStatus())); + this.planService.updateById(plan); + } + if(PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(plan.getMethod())){ + // 抢占模式 + this.seize(plan); + }else if(PlanContants.PlanMethodEnum.CONCURRENT.getMethod().equals(plan.getMethod())){ + // 并发模式 + this.concurrent(plan); + } + }); + } + + + /** + * 抢占模式 + * @param plan + */ + private void seize(PlanEntity plan) { + // 计划班次模式 + if("4".equals(plan.getType())){ + this.seizeClass(plan); + } + // 其他模式 + this.seizeOther(plan); + } + + /** + * 并发模式 + * @param plan + */ + private void concurrent(PlanEntity plan) { + // 计划班次模式 + if("4".equals(plan.getType())){ + this.concurrentClass(plan); + } + // 其他模式 + this.concurrentOther(plan); + } + + /** + * 抢占-班次模式 + * @param plan + */ + private void seizeClass(PlanEntity plan) { + List taskUserList = Lists.newArrayList(); + + if(Func.isEmpty(plan.getExecTimeJson())){ + XxlJobLogger.log("seizeClass_巡检计划未设置值班班次: plan = " + plan); + return; + } + JSONArray array = JSONArray.parseArray(plan.getExecTimeJson()); + for (int index = 0; index < plan.getTaskTimesADay(); index++) { + // 取巡检任务执行开始、结束时间、是否下一天 + JSONObject time = array.getJSONObject(index); + plan.setExecStartTime(time.get("execStartTime").toString()); + plan.setExecEndTime(time.get("execEndTime").toString()); + if(time.containsKey("isNextDay")){ + plan.setIsNextDay(time.getBoolean("isNextDay")); + } + // 保存巡检任务 + TaskEntity task = this.saveTask(plan,1); + if(ObjectUtil.isEmpty(task) || !time.containsKey("classId")){ + XxlJobLogger.log("seizeClass_任务执行时间json数据不包含classId"); + continue; + } + // 查询值班数据 + ImsDutyMainFeignVO main = dutyMainService.mainPerson(time.getLong("classId"), DateUtil.format(LocalDate.now(),DateUtil.PATTERN_DATE)); + if(ObjectUtil.isNotEmpty(main) && CollectionUtil.isNotEmpty(main.getPersons())){ + plan.setDutyId(main.getMainId()); + main.getPersons().forEach(persons->{ + // 任务用户关联记录 + TaskUserEntity taskUser = TaskUserEntity.builder().taskId(task.getId()).userId(persons).claimStatus(TaskContants.ClaimStatusEnum.UN_COLLECT.getStatus()).build(); + taskUser.setTenantId(plan.getTenantId()); + taskUserList.add(taskUser); + //添加到提醒cache + task.setUserId(persons); + remindCacheManager.addTaskToCacheList(task); + taskVideoManager.addTaskToVideoCacheList(task); + }); + } + String reason = this.saveTaskObject(plan,task); + if(reason.equals(StringUtils.EMPTY)){ + LocalDateTime now = LocalDateTime.now(); + reason = plan.getName() + now.getYear() + "年" + now.getMonthValue() + "月" + now.getDayOfMonth() + "日的任务派发成功"; + } + XxlJobLogger.log(reason); + TaskResultEntity taskResultEntity = TaskResultEntity.builder().planId(task.getPlanId()).batchNumber(task.getBatchNumber()).reason(reason).build(); + taskResultEntity.setTenantId(plan.getTenantId()); + taskResultService.save(taskResultEntity); + } + if(taskUserList.size()>0){ + taskUserService.saveBatch(taskUserList); + } + } + + + /** + * 抢占-其他模式 + * @param plan + */ + private void seizeOther(PlanEntity plan) { + List users = this.getUsersByPlan(plan); + List taskUserList = Lists.newArrayList(); + + JSONArray timeJsonArray = null; + if(Func.isNotEmpty(plan.getExecTimeJson())){ + timeJsonArray = JSON.parseArray(plan.getExecTimeJson()); + } + for (int j = 0; j < plan.getTaskTimesADay(); j++) { + if(Func.isNotEmpty(timeJsonArray)){ + JSONObject time = timeJsonArray.getJSONObject(j); + plan.setExecStartTime(time.get("execStartTime").toString()); + plan.setExecEndTime(time.get("execEndTime").toString()); + if(time.containsKey("isNextDay")){ + plan.setIsNextDay(time.getBoolean("isNextDay")); + } + } else { + plan.setExecStartTime("00:00:00"); + plan.setExecEndTime("23:59:59"); + } + TaskEntity task = this.saveTask(plan,1); + if(task==null){continue;} + for(PlanUserEntity user:users){ + TaskUserEntity taskUser = TaskUserEntity.builder().taskId(task.getId()).userId(user.getUserId()).claimStatus(TaskContants.ClaimStatusEnum.UN_COLLECT.getStatus()).build(); + taskUser.setTenantId(plan.getTenantId()); + taskUserList.add(taskUser); + //添加到提醒cache + task.setUserId(user.getUserId()); + remindCacheManager.addTaskToCacheList(task); + taskVideoManager.addTaskToVideoCacheList(task); + } + String reason = this.saveTaskObject(plan,task); + if(reason.equals(StringUtils.EMPTY)){ + LocalDateTime now = LocalDateTime.now(); + reason = plan.getName() + now.getYear() + "年" + now.getMonthValue() + "月" + now.getDayOfMonth() + "日的任务派发成功"; + } + XxlJobLogger.log(reason); + TaskResultEntity taskResultEntity = TaskResultEntity.builder().planId(task.getPlanId()).batchNumber(task.getBatchNumber()).reason(reason).build(); + taskResultEntity.setTenantId(plan.getTenantId()); + taskResultService.save(taskResultEntity); + } + + if(taskUserList.size()>0){ + taskUserService.saveBatch(taskUserList); + } else { + XxlJobLogger.log("没有用户: plan = " + plan); + XxlJobLogger.log("SeizeTaskService...没有任务用户: plan = " + plan); + } + } + + + /** + * 并发-班次模式 + * @param plan + */ + private void concurrentClass(PlanEntity plan) { + List taskUserList = Lists.newArrayList(); + + LocalDateTime now = LocalDateTime.now(); + String defaultReason = plan.getName() + now.getYear() + "年" + now.getMonthValue() + "月" + now.getDayOfMonth() + "日的任务派发成功"; + JSONArray timeJsonArray; + if (Func.isNotEmpty(plan.getExecTimeJson())) { + timeJsonArray = JSON.parseArray(plan.getExecTimeJson()); + } else { + XxlJobLogger.log("巡检计划未设置值班班次: plan = " + plan); + return; + } + for (int j = 0; j < plan.getTaskTimesADay(); j++) { + JSONObject time = timeJsonArray.getJSONObject(j); + plan.setExecStartTime(time.get("execStartTime").toString()); + plan.setExecEndTime(time.get("execEndTime").toString()); + if (time.containsKey("isNextDay")) { + plan.setIsNextDay(time.getBoolean("isNextDay")); + } + + //获取值班用户 + if (time.containsKey("classId")) { + Long classId = time.getLong("classId"); + DateTimeFormatter dfShort = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + ImsDutyMainFeignVO mainPerson = dutyMainService.mainPerson(classId, dfShort.format(LocalDate.now())); + List ids = mainPerson.getPersons(); + plan.setDutyId(mainPerson.getMainId()); + if (Func.isNotEmpty(ids)) { + for (Long id : ids) { + TaskEntity task = saveTask(plan, ids.size()); + if (task == null) { + continue; + } + TaskUserEntity taskUser = TaskUserEntity.builder().taskId(task.getId()).userId(id).claimStatus(TaskContants.ClaimStatusEnum.UN_COLLECT.getStatus()).build(); + taskUser.setTenantId(plan.getTenantId()); + taskUserList.add(taskUser); + String reason = saveTaskObject(plan, task); + if (reason.equals(StringUtils.EMPTY)) { + reason = defaultReason; + } + + XxlJobLogger.log(reason); + TaskResultEntity taskResultEntity = TaskResultEntity.builder().planId(task.getPlanId()).batchNumber(task.getBatchNumber()).reason(reason).build(); + taskResultEntity.setTenantId(plan.getTenantId()); + taskResultService.save(taskResultEntity); + + //添加到提醒cache + task.setUserId(id); + remindCacheManager.addTaskToCacheList(task); + taskVideoManager.addTaskToVideoCacheList(task); + } + } else { + XxlJobLogger.log("获取该班次值班人员为空, plan = " + plan); + return; + } + } else { + XxlJobLogger.log("巡检计划未设置值班班次, plan = " + plan); + return; + } + } + if (taskUserList.size() > 0) { + taskUserService.saveBatch(taskUserList); + } + } + + /** + * 并发其他模式 + * @param plan + */ + private void concurrentOther(PlanEntity plan) { + LocalDateTime now = LocalDateTime.now(); + String defaultReason = plan.getName() + now.getYear() + "年" + now.getMonthValue() + "月" + now.getDayOfMonth() + "日的任务派发成功"; + List users = this.getUsersByPlan(plan); + List taskUserList = Lists.newArrayList(); + + JSONArray timeJsonArray = null; + if (Func.isNotEmpty(plan.getExecTimeJson())) { + timeJsonArray = JSON.parseArray(plan.getExecTimeJson()); + } + for (PlanUserEntity user : users) { + for (int j = 0; j < plan.getTaskTimesADay(); j++) { + if (Func.isNotEmpty(timeJsonArray)) { + JSONObject time = timeJsonArray.getJSONObject(j); + plan.setExecStartTime(time.get("execStartTime").toString()); + plan.setExecEndTime(time.get("execEndTime").toString()); + if (time.containsKey("isNextDay")) { + plan.setIsNextDay(time.getBoolean("isNextDay")); + } + } else { + plan.setExecStartTime("00:00:00"); + plan.setExecEndTime("23:59:59"); + } + TaskEntity task = saveTask(plan, users.size()); + if (task == null) { + continue; + } + TaskUserEntity taskUser = TaskUserEntity.builder().taskId(task.getId()).userId(user.getId()).claimStatus(TaskContants.ClaimStatusEnum.UN_COLLECT.getStatus()).build(); + taskUser.setTenantId(plan.getTenantId()); + taskUserList.add(taskUser); + String reason = saveTaskObject(plan, task); + if (reason.equals(StringUtils.EMPTY)) { + reason = defaultReason; + } + XxlJobLogger.log(reason); + + TaskResultEntity taskResultEntity = TaskResultEntity.builder().planId(task.getPlanId()).batchNumber(task.getBatchNumber()).reason(reason).build(); + taskResultEntity.setTenantId(plan.getTenantId()); + taskResultService.save(taskResultEntity); + + //添加到提醒cache + task.setUserId(user.getUserId()); + remindCacheManager.addTaskToCacheList(task); + taskVideoManager.addTaskToVideoCacheList(task); + } + } + if (taskUserList.size() > 0) { + taskUserService.saveBatch(taskUserList); + } else { + log.error("ConcurrentTaskServcie...没有任务用户: plan = " + plan); + XxlJobLogger.log("ConcurrentTaskServcie...没有任务用户: plan = " + plan); + } + } + + /** + * 根据巡检计划返回与计划有关的所有用户 + * @param plan 巡检计划实例 + * @return 计划相关用户集合 + */ + public List getUsersByPlan(PlanEntity plan) { + List res = new LinkedList<>(); + if(PlanContants.PlanTypeEnum.USER_TYPE.getType().equals(plan.getType()) || PlanContants.PlanTypeEnum.FREE_TYPE.getType().equals(plan.getType())){ + QueryWrapper planUserQw = new QueryWrapper<>(); + planUserQw.lambda().eq(PlanUserEntity::getPlanId, plan.getId()); + res.addAll(planUserService.list(planUserQw)); + }else if(PlanContants.PlanTypeEnum.POSITION_TYPE.getType().equals(plan.getType())){ + QueryWrapper planPositionEntityQueryWrapper = new QueryWrapper<>(); + planPositionEntityQueryWrapper.lambda().eq(PlanPositionEntity::getPlanId, plan.getId()); + planPostionService.list(planPositionEntityQueryWrapper).forEach(entity->{ + //获取该机构下所有用户列表 + List users = new ArrayList<>(); + List positionUsers = userClient.userListByPosition(entity.getPositionId()).getData(); + if(CollectionUtil.isNotEmpty(positionUsers)){ + users = positionUsers.stream().filter(user->user.getCreateDept().toString().contains(entity.getCreateDept().toString())).collect(Collectors.toList()); + } + XxlJobLogger.log("岗位信息:" + entity + "; 获取到的user:{}",users.stream().map(User::getName).collect(Collectors.joining(","))); + for(User u:users){ + res.add(PlanUserEntity.builder().planId(plan.getId()).userId(u.getId()).build()); + } + }); + }else if(PlanContants.PlanTypeEnum.ORG_TYPE.getType().equals(plan.getType())){ + QueryWrapper planOrgEntityQueryWrapper = new QueryWrapper<>(); + planOrgEntityQueryWrapper.lambda().eq(PlanOrgEntity::getPlanId, plan.getId()); + planOrgService.list(planOrgEntityQueryWrapper).forEach(entity->{ + List users = userClient.userListByDeptId(entity.getOrgId()).getData(); + for(User u:users){ + res.add(PlanUserEntity.builder().planId(plan.getId()).userId(u.getId()).build()); + } + }); + }else if(PlanContants.PlanTypeEnum.CLASS_TYPE.getType().equals(plan.getType())){ + XxlJobLogger.log("巡检计划为班次时,有单独的处理流程,不应该跑到该分支下面来, plan = " + plan); + JSONArray timeJsonArray; + if(Func.isNotEmpty(plan.getExecTimeJson())){ + timeJsonArray = JSON.parseArray(plan.getExecTimeJson()); + } + else{ + throw new ServiceException("巡检计划未设置值班班次: plan = " + plan); + } + for(int i=0;i ids = mainPerson.getPersons(); + log.info("--计划为:{};人员ID为:{}--",plan.getName(),ids.stream().map(String::valueOf).collect(Collectors.joining(","))); + plan.setDutyId(mainPerson.getMainId()); + if(Func.isNotEmpty(ids)){ + for (Long id : ids) { + res.add(PlanUserEntity.builder().planId(plan.getId()).userId(id).build()); + } + } else { + XxlJobLogger.log("获取该班次值班人员为空, plan = " + plan); + } + } + } + } + //设置租户 + return res.stream().distinct().peek(entity-> entity.setTenantId(plan.getTenantId())).collect(Collectors.toList()); + } + + /** + * 保存巡检任务 + * @param plan 巡检计划 + * @param totalTaskNum 任务数 : 抢占任务只生成一个 + * @return 巡检任务实例 + */ + public TaskEntity saveTask(PlanEntity plan,int totalTaskNum) { + totalTaskNum = plan.getTaskTimesADay() * totalTaskNum; + TaskEntity task = new TaskEntity(); + LocalDate now = LocalDate.now(); + DateTimeFormatter dfShort = DateTimeFormatter.ofPattern("yyyy-MM-dd "); + DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + if(PlanContants.PlanCycleEnum.NEVER_CYCLE.getCycle().equals(plan.getCycle())) { + task.setBatchNumber(now.getYear()+ "_" +now.getMonthValue()+ "_" +now.getDayOfMonth() + "N"); + task.setPlanEndTime(LocalDateTime.parse(dfShort.format(plan.getEndTime())+plan.getExecEndTime(), df)); + }else if(PlanContants.PlanCycleEnum.EVERYDAY_CYCLE.getCycle().equals(plan.getCycle())) { + task.setBatchNumber(now.getYear()+ "_" +now.getMonthValue()+ "_" +now.getDayOfMonth()); + if(Func.isNotEmpty(plan.getIsNextDay()) && plan.getIsNextDay()){ + task.setPlanEndTime(LocalDateTime.parse(dfShort.format(now.plusDays(1L)) + plan.getExecEndTime(), df)); + } else { + task.setPlanEndTime(LocalDateTime.parse(dfShort.format(now) + plan.getExecEndTime(), df)); + } + }else if(PlanContants.PlanCycleEnum.EVERYWEEK_CYCLE.getCycle().equals(plan.getCycle())) { + WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY,1); + int weeks = now.get(weekFields.weekOfYear()); + task.setBatchNumber(now.getYear()+ "_" +now.getMonthValue() + "_" +weeks + "W"); + task.setPlanEndTime(LocalDateTime.parse(dfShort.format(now.plusWeeks(1)) + plan.getExecEndTime(), df)); + }else if(PlanContants.PlanCycleEnum.EVERYMONTH_CYCLE.getCycle().equals(plan.getCycle())) { + task.setBatchNumber(now.getYear()+ "_" +now.getMonthValue()); + task.setPlanEndTime(LocalDateTime.parse(dfShort.format(now.plusMonths(1))+plan.getExecEndTime(), df)); + }else if(PlanContants.PlanCycleEnum.EVERYQUARTER_CYCLE.getCycle().equals(plan.getCycle())) { + task.setBatchNumber(now.getYear()+ "_" +now.getMonthValue() + "Q"); + task.setPlanEndTime(LocalDateTime.parse(dfShort.format(now.plusMonths(3)) + plan.getExecEndTime(), df)); + }else if(PlanContants.PlanCycleEnum.EVERYYEAR_CYCLE.getCycle().equals(plan.getCycle())){ + task.setBatchNumber(String.valueOf(now.getYear())); + task.setPlanEndTime(LocalDateTime.parse(dfShort.format(now.plusYears(1))+plan.getExecEndTime(), df)); + } + if(PlanContants.PlanCycleEnum.NEVER_CYCLE.getCycle().equals(plan.getCycle())) { + task.setPlanStartTime(LocalDateTime.parse(dfShort.format(plan.getStartTime()) + plan.getExecStartTime(), df)); + } else { + task.setPlanStartTime(LocalDateTime.parse(dfShort.format(now) + plan.getExecStartTime(), df)); + } + task.setDutyId(plan.getDutyId()); + task.setPlanId(plan.getId()); + task.setPlanName(plan.getName()); + task.setType(plan.getType()); + task.setCycle(plan.getCycle()); + task.setStatus(Integer.valueOf(TaskContants.TaskStatusEnum.INIT_STATUS.getStatus())); + task.setTenantId(plan.getTenantId()); + task.setCreateUser(plan.getCreateUser()); + task.setCreateDept(plan.getCreateDept()); + task.setAutoVideo(plan.getAutoVideo()); + task.setMessageTemplateId(plan.getMessageTemplateId()); + task.setMethod(plan.getMethod()); + task.setEndRemindFlag(true); + task.setStartRemindFlag(true); + task.setStartRemindTime(task.getPlanStartTime().minusMinutes(plan.getStartRemind())); + task.setEndRemindTime(task.getPlanEndTime().minusMinutes(plan.getEndRemind())); + int taskCount = this.count(Wrappers.query().lambda().eq(TaskEntity::getPlanId,task.getPlanId()).eq(TaskEntity::getBatchNumber, task.getBatchNumber())); + XxlJobLogger.log("该计划已生成计划批次:{},数量:{}",task.getBatchNumber(),taskCount); + if(taskCount >= totalTaskNum){ + log.info("计划id={}本周期batchNumber={}的任务已生成",plan.getId(),task.getBatchNumber()); + return null; + } + this.save(task); + return task; + } + + /** + * 保存巡检对象数据 + * @param plan 巡检计划实例 + * @param task 巡检任务实例 + * @return + */ + public String saveTaskObject(PlanEntity plan, TaskEntity task) { + String result = StringUtils.EMPTY; + List taskObjectList = Lists.newArrayList(); + // 自由模式 + if(PlanContants.PlanTypeEnum.FREE_TYPE.getType().equals(plan.getType())){ + // 查询计划用户 + List planUsers = planUserService.list(Wrappers.query().lambda().eq(PlanUserEntity::getPlanId,plan.getId())); + if(CollectionUtil.isEmpty(planUsers)){ + return result; + } + for(PlanUserEntity planUser : planUsers){ + // 查询巡检对象用户 + List objectUsers= objectUserService.list(Wrappers.query().lambda().eq(ObjectUserEntity::getUserId,planUser.getUserId())); + if(CollectionUtil.isEmpty(objectUsers)){ + break; + } + for (ObjectUserEntity objectUser : objectUsers){ + List existEntity = taskObjectList.stream().filter(taskObjectEntity -> objectUser.getObjectId().equals(taskObjectEntity.getObjectId())).collect(Collectors.toList()); + if(ObjectUtil.isNotEmpty(existEntity)){ + break; + } + // 保存巡检对象 + result = saveTaskObject(taskObjectList,task,objectUser.getObjectId(),objectUser.getTemplateId()); + if(!result.equals(StringUtils.EMPTY)){ + break; + } + } + } + }else{ + List templates = planObjectTemplateService.list(Wrappers.query().lambda().eq(PlanObjectTemplateEntity::getPlanId,plan.getId())); + for (PlanObjectTemplateEntity template : templates) { + result = saveTaskObject(taskObjectList,task,template.getObjectId(),template.getTemplateId()); + if(!result.equals(StringUtils.EMPTY)){ + break; + } + } + } + if(taskObjectList.size()>0 && result.equals(StringUtils.EMPTY)){ + taskObjectService.saveBatch(taskObjectList); + } + return result; + } + + /** + * 保存巡检对象 + * @param taskObjectList + * @param task + * @param objectId + * @param templateId + * @return + */ + private String saveTaskObject(List taskObjectList,TaskEntity task,Long objectId,Long templateId){ + String result = StringUtils.EMPTY; + ObjectEntity io = objectService.getById(objectId); + if(io == null) { + return "巡检对象id="+objectId+"找不到记录"; + } + TemplateEntity templateInfo = templateService.getById(templateId); + if(templateInfo == null) { + return "巡检模板id="+templateId+"找不到记录"; + } + TaskObjectEntity ito = new TaskObjectEntity(); + ito.setTaskId(task.getId()); + ito.setObjectId(objectId); + ito.setCode(io.getCode()); + ito.setName(io.getName()); + ito.setAddress(io.getAddress()); + ito.setLttd(io.getLttd()); + ito.setLgtd(io.getLgtd()); + ito.setCreateUser(task.getCreateUser()); + ito.setCreateDept(task.getCreateDept()); + ito.setCreateTime(task.getCreateTime()); + ito.setDuplicateRecord(templateInfo.getDuplicateRecord()); + ito.setTenantId(task.getTenantId()); + ito.setStatus(TaskContants.StatusEnum.INIT_STATUS.getStatus()); + taskObjectList.add(ito); + List projects = templateProjectService.list(Wrappers.query().lambda().eq(TemplateProjectEntity::getTemplateId,templateId)); + for (TemplateProjectEntity project : projects) { + result = saveTaskObjectProject(task, objectId, project); + if(!result.equals(StringUtils.EMPTY)){ + break; + } + } + return result; + } + + /** + * 从巡检任务、巡检计划对象模板、巡检模板项目获取信息插入巡检任务项目表以及对应的历史数据表 + * @param objectId 巡检计划对象模板实例 + * @param project 巡检模板项目实例 + * @return + */ + private String saveTaskObjectProject(TaskEntity task, Long objectId, TemplateProjectEntity project) { + String result = StringUtils.EMPTY; + ProjectEntity ip = projectService.getById(project.getProjectId()); + if(ip == null) { + return "巡检项目id="+project.getProjectId()+"找不到记录"; + } + TaskObjectProjectEntity itop = new TaskObjectProjectEntity(); + itop.setObjectId(objectId); + itop.setProjectId(ip.getId()); + itop.setTaskId(task.getId()); + itop.setName(ip.getName()); + itop.setCode(ip.getCode()); + itop.setDescription(ip.getDescription()); + itop.setCreateTime(project.getCreateTime()); + itop.setTenantId(task.getTenantId()); + itop.setCreateUser(task.getCreateUser()); + itop.setCreateDept(task.getCreateDept()); + itop.setStatus(TaskContants.StatusEnum.INIT_STATUS.getStatus()); + taskObjectProjectService.save(itop); + List contents = projectContentService.list(Wrappers.query().lambda().eq(ProjectContentEntity::getProjectId,project.getProjectId())); + for (ProjectContentEntity content : contents) { + result = saveTaskObjectProjectContent(task, objectId, content); + if(!result.equals(StringUtils.EMPTY)){ + break; + } + } + return result; + } + + /** + * 从巡检任务、巡检计划对象模板、巡检项目内容获取信息插入巡检任务内容表以及对应的历史数据表 + * @param objectId 巡检计划对象模板实例 + * @param content 巡检项目内容实例 + * @return + */ + private String saveTaskObjectProjectContent(TaskEntity task, Long objectId, ProjectContentEntity content) { + ContentEntity ioc = contentService.getById(content.getContentId()); + if(ioc == null) {return "巡检内容id="+content.getContentId()+"找不到记录";} + TaskObjectProjectContentEntity itopc = new TaskObjectProjectContentEntity(); + itopc.setTaskId(task.getId()); + itopc.setObjectId(objectId); + itopc.setProjectId(content.getProjectId()); + itopc.setContentId(content.getContentId()); + itopc.setCode(ioc.getCode()); + itopc.setName(ioc.getName()); + itopc.setDescription(ioc.getDescription()); + itopc.setCheckType(ioc.getCheckType()); + itopc.setRecordType(ioc.getRecordType()); + itopc.setCreateTime(content.getCreateTime()); + itopc.setTenantId(task.getTenantId()); + itopc.setCreateUser(task.getCreateUser()); + itopc.setCreateDept(task.getCreateDept()); + itopc.setCheckTypeSon(ioc.getCheckTypeSon()); + itopc.setCameraAddr(ioc.getCameraAddr()); + itopc.setCameraId(ioc.getCameraId()); + itopc.setClockId(ioc.getClockId()); + itopc.setOtherParam(ioc.getOtherParam()); + itopc.setStatus(TaskContants.StatusEnum.INIT_STATUS.getStatus()); + itopc.setDictType(ioc.getDictType()); + taskObjectProjectContentService.save(itopc); + return StringUtils.EMPTY; + } + /** * 时间区间机构的巡检任务数据查询 * @param start diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskUserServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskUserServiceImpl.java new file mode 100644 index 0000000..34f8911 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskUserServiceImpl.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.TaskUserService; +import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity; +import com.hnac.hzinfo.inspect.task.mapper.TaskUserMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TaskUserServiceImpl extends BaseServiceImpl implements TaskUserService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateProjectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateProjectServiceImpl.java new file mode 100644 index 0000000..bd3aa45 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateProjectServiceImpl.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.scheduled.service.inspect.TemplateProjectService; +import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; +import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity; +import com.hnac.hzinfo.inspect.obj.mapper.TemplateProjectMapper; +import com.hnac.hzinfo.inspect.obj.services.DatabaseCopyHandler; +import com.hnac.hzinfo.inspect.obj.services.TemplateService; +import com.hnac.hzinfo.inspect.obj.services.impl.ProjectContentServiceImpl; +import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; +import com.hnac.hzinfo.inspect.obj.vo.ProjectContentDto; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.Func; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TemplateProjectServiceImpl extends BaseServiceImpl implements TemplateProjectService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateServiceImpl.java new file mode 100644 index 0000000..1f009da --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateServiceImpl.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hnac.hzims.scheduled.service.inspect.TemplateService; +import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity; +import com.hnac.hzinfo.inspect.obj.mapper.TemplateMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("inspect") +public class TemplateServiceImpl extends BaseServiceImpl implements TemplateService { +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DutyMainService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DutyMainService.java new file mode 100644 index 0000000..1fe0e7e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DutyMainService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; +import com.hnac.hzims.operational.duty.vo.ImsDutyMainFeignVO; +import org.springblade.core.mp.base.BaseService; + + +/** + * @author ysj + */ +public interface DutyMainService extends BaseService { + ImsDutyMainFeignVO mainPerson(Long classId, String date); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DutyMainServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DutyMainServiceImpl.java new file mode 100644 index 0000000..a49a30d --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DutyMainServiceImpl.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; +import com.hnac.hzims.operational.duty.vo.ImsDutyMainFeignVO; +import com.hnac.hzims.scheduled.mapper.operation.DutyMainMapper; +import com.hnac.hzims.scheduled.service.operation.DutyMainService; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 服务实现类 + * + * @author Chill + */ +@Service +@Slf4j +public class DutyMainServiceImpl extends BaseServiceImpl implements DutyMainService { + + + @Override + public ImsDutyMainFeignVO mainPerson(Long classId, String date) { + ImsDutyMainEntity entity = this.getOne(new LambdaQueryWrapper() {{ + eq(ImsDutyMainEntity::getDutyDate, date); + eq(ImsDutyMainEntity::getClassId, classId); + }}); + if(ObjectUtil.isEmpty(entity)){ + return new ImsDutyMainFeignVO(); + } + ImsDutyMainFeignVO main = new ImsDutyMainFeignVO(); + main.setMainId(entity.getId()); + String[] persons = entity.getDutyPersonIds().split("\\^"); + //string 转为 long + List personList = Arrays.stream(persons).map(person -> Long.parseLong(person.trim())).collect(Collectors.toList()); + main.setPersons(personList); + return main; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ContentMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ContentMapper.xml new file mode 100644 index 0000000..e68eb88 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ContentMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/DutyMainMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/DutyMainMapper.xml new file mode 100644 index 0000000..3ce9fcd --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/DutyMainMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectMapper.xml new file mode 100644 index 0000000..d50799a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectUserMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectUserMapper.xml new file mode 100644 index 0000000..66a295e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectUserMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml new file mode 100644 index 0000000..09f72d8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanObjectTemplateMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanObjectTemplateMapper.xml new file mode 100644 index 0000000..1d0d4b3 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanObjectTemplateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanOrgMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanOrgMapper.xml new file mode 100644 index 0000000..667ee81 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanOrgMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanPositionMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanPositionMapper.xml new file mode 100644 index 0000000..7d8f0e9 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanPositionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanUserMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanUserMapper.xml new file mode 100644 index 0000000..3e8602b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanUserMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectContentMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectContentMapper.xml new file mode 100644 index 0000000..56170b0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectContentMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectMapper.xml new file mode 100644 index 0000000..88668db --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml index 9acf610..e2899b8 100644 --- a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml @@ -1,4 +1,5 @@ - + + \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectMapper.xml new file mode 100644 index 0000000..6d89084 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectContentMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectContentMapper.xml new file mode 100644 index 0000000..ad59b3e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectContentMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectMapper.xml new file mode 100644 index 0000000..eb355f8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskResultMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskResultMapper.xml new file mode 100644 index 0000000..e2986ad --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskResultMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskUserMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskUserMapper.xml new file mode 100644 index 0000000..ca9da30 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskUserMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateMapper.xml new file mode 100644 index 0000000..7096dd1 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateProjectMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateProjectMapper.xml new file mode 100644 index 0000000..b4ab0b8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TemplateProjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/ImsDeptController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/ImsDeptController.java index 87f3bd1..8d6ba21 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/ImsDeptController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/ImsDeptController.java @@ -96,7 +96,7 @@ public class ImsDeptController { @GetMapping(value = "/getHydropowerTree") public R> getHydropowerTree(@ApiParam(value="站点类型: 水电、光伏、风电...") Integer stationType,@RequestParam(required = false) Integer serveType) { if(ObjectUtil.isEmpty(serveType)){ - R.data(imsDeptService.getHydropowerTree(stationType,null)); + return R.data(imsDeptService.getHydropowerTree(stationType,null)); } return R.data(imsDeptService.getHydropowerTree(stationType,serveType)); }