Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
3099c284b5
  1. 16
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java
  2. 9
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindKpiAppVo.java
  3. 12
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindScoreVo.java
  4. 6
      hzims-service-api/inspect-api/pom.xml
  5. 1
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java
  6. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/CameraInfoEntity.java
  7. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/ClockEntity.java
  8. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/ClockTypeEntity.java
  9. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java
  10. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotTaskEntity.java
  11. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotTaskIdentifyEntity.java
  12. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/UserFaceDataEntity.java
  13. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/AIData.java
  14. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockDTO.java
  15. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockTypeDTO.java
  16. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/FaceResponse.java
  17. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RobotDTO.java
  18. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RobotTaskDTO.java
  19. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RobotTaskIdentifyDTO.java
  20. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/UserFaceDataDTO.java
  21. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/VideoReturnDTO.java
  22. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/InspectPdf.java
  23. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectDangerEntity.java
  24. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java
  25. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectTemplateEntity.java
  26. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectUserEntity.java
  27. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/OtherObjectEntity.java
  28. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java
  29. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateEntity.java
  30. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateProjectEntity.java
  31. 4
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/TaskContants.java
  32. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectEntity.java
  33. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectContentEntity.java
  34. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectEntity.java
  35. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskRecordEntity.java
  36. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskResultEntity.java
  37. 0
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskUserEntity.java
  38. 3
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java
  39. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  40. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
  41. 23
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java
  42. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ContentMapper.java
  43. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectMapper.java
  44. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectUserMapper.java
  45. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java
  46. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanObjectTemplateMapper.java
  47. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanOrgMapper.java
  48. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanPositionMapper.java
  49. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanUserMapper.java
  50. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectContentMapper.java
  51. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectMapper.java
  52. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectMapper.java
  53. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectContentMapper.java
  54. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectMapper.java
  55. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskResultMapper.java
  56. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskUserMapper.java
  57. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateMapper.java
  58. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateProjectMapper.java
  59. 17
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DutyMainMapper.java
  60. 40
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BusinessScheduledTask.java
  61. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  62. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  63. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java
  64. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java
  65. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ContentService.java
  66. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectService.java
  67. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectUserService.java
  68. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanObjectTemplateService.java
  69. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanOrgService.java
  70. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanPositionService.java
  71. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java
  72. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanUserService.java
  73. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectContentService.java
  74. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectService.java
  75. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectContentService.java
  76. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectService.java
  77. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectService.java
  78. 295
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskRemindManager.java
  79. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskResultService.java
  80. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java
  81. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskUserService.java
  82. 98
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskVideoManager.java
  83. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateProjectService.java
  84. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateService.java
  85. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ContentServiceImpl.java
  86. 19
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java
  87. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectUserServiceImpl.java
  88. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanObjectTemplateServiceImpl.java
  89. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanOrgServiceImpl.java
  90. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanPositionServiceImpl.java
  91. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java
  92. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanUserServiceImpl.java
  93. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectContentServiceImpl.java
  94. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectServiceImpl.java
  95. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectContentServiceImpl.java
  96. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectServiceImpl.java
  97. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectServiceImpl.java
  98. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskResultServiceImpl.java
  99. 714
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java
  100. 23
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskUserServiceImpl.java
  101. Some files were not shown because too many files have changed in this diff Show More

16
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindAreaDutyVo.java

@ -16,6 +16,10 @@ public class WindAreaDutyVo {
@ApiModelProperty(value = "机构Id") @ApiModelProperty(value = "机构Id")
private Long deptId; private Long deptId;
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
private String start; private String start;
@ -109,38 +113,50 @@ public class WindAreaDutyVo {
/**=============================================风电指标数据=============================================**/ /**=============================================风电指标数据=============================================**/
@ApiModelProperty("计划发电量") @ApiModelProperty("计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double plan; private Double plan;
@ApiModelProperty(value = "年实际发电量") @ApiModelProperty(value = "年实际发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generate; private Double generate;
@ApiModelProperty(value = "年发电量完成率") @ApiModelProperty(value = "年发电量完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateComplete; private Double generateComplete;
@ApiModelProperty("平均风速: m/s") @ApiModelProperty("平均风速: m/s")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double speed; private Double speed;
@ApiModelProperty("上网电量") @ApiModelProperty("上网电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double surfPower; private Double surfPower;
@ApiModelProperty("下网电量") @ApiModelProperty("下网电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double belowPower; private Double belowPower;
@ApiModelProperty("可用时长") @ApiModelProperty("可用时长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double available; private Double available;
@ApiModelProperty("综合用电量") @ApiModelProperty("综合用电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double comprehensivePower; private Double comprehensivePower;
@ApiModelProperty("峰值功率") @ApiModelProperty("峰值功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double peakPower; private Double peakPower;
@ApiModelProperty("故障时长: 单位-小时") @ApiModelProperty("故障时长: 单位-小时")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double faultHours; private Double faultHours;
@ApiModelProperty("短期预测准确率") @ApiModelProperty("短期预测准确率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double accuracy; private Double accuracy;
@ApiModelProperty("超短准确率") @ApiModelProperty("超短准确率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double ultraShortAccuracy; private Double ultraShortAccuracy;
} }

9
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindKpiAppVo.java

@ -13,6 +13,15 @@ import lombok.Data;
@ApiModel(value = "风电站点app指标数据") @ApiModel(value = "风电站点app指标数据")
public class WindKpiAppVo { public class WindKpiAppVo {
@ApiModelProperty(value = "机构Id")
private Long deptId;
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "机构类型")
private Integer type;
@ApiModelProperty(value = "风电站数量") @ApiModelProperty(value = "风电站数量")
private Integer count; private Integer count;

12
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindScoreVo.java

@ -30,6 +30,10 @@ public class WindScoreVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateMon; private Double generateMon;
@ApiModelProperty(value = "月计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double planMon;
@ApiModelProperty(value = "年计划发电量") @ApiModelProperty(value = "年计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double planYear; private Double planYear;
@ -46,13 +50,13 @@ public class WindScoreVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double speedRate; private Double speedRate;
@ApiModelProperty(value = "短期准确率") @ApiModelProperty(value = "月利用小时")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double accuracy; private Double availableMon;
@ApiModelProperty(value = "超短期准确率") @ApiModelProperty(value = "月发电量完成率")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double ultraShortAccuracyRate; private Double completeMonRate;
@ApiModelProperty(value = "近年发电量集合") @ApiModelProperty(value = "近年发电量集合")
private List<PowerYearVo> powerYearVoList; private List<PowerYearVo> powerYearVoList;

6
hzims-service-api/inspect-api/pom.xml

@ -64,6 +64,12 @@
<artifactId>common-api</artifactId> <artifactId>common-api</artifactId>
<version>4.0.0-SNAPSHOT</version> <version>4.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>safeproduct-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>

1
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/Constants.java

@ -6,6 +6,7 @@ import lombok.Getter;
* @Author: py * @Author: py
*/ */
public class Constants { public class Constants {
public final static String APP_NAME = "hzinfo-inspect"; public final static String APP_NAME = "hzinfo-inspect";
/** /**

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/entity/CameraInfoEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/CameraInfoEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/entity/ClockEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/ClockEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/entity/ClockTypeEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/ClockTypeEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotTaskEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotTaskEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotTaskIdentifyEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/RobotTaskIdentifyEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/entity/UserFaceDataEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/UserFaceDataEntity.java

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/AIData.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/AIData.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/ClockDTO.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/ClockTypeDTO.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/ClockTypeDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/FaceResponse.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/FaceResponse.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/RobotDTO.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RobotDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/RobotTaskDTO.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RobotTaskDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import com.hnac.hzinfo.inspect.ai.entity.RobotTaskIdentifyEntity; import com.hnac.hzinfo.inspect.ai.entity.RobotTaskIdentifyEntity;
import com.hnac.hzinfo.inspect.utils.QueryField; import com.hnac.hzinfo.inspect.utils.QueryField;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/RobotTaskIdentifyDTO.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RobotTaskIdentifyDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/UserFaceDataDTO.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/UserFaceDataDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import com.hnac.hzinfo.inspect.ai.entity.UserFaceDataEntity; import com.hnac.hzinfo.inspect.ai.entity.UserFaceDataEntity;
import lombok.Data; import lombok.Data;

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/dto/VideoReturnDTO.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/VideoReturnDTO.java

@ -1,4 +1,4 @@
package com.hnac.hzinfo.inspect.ai.dto; package com.hnac.hzinfo.inspect.ai.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/InspectPdf.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/InspectPdf.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectDangerEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectDangerEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectTemplateEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectTemplateEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectUserEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ObjectUserEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/OtherObjectEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/OtherObjectEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateProjectEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/TemplateProjectEntity.java

4
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 { public interface TaskContants {
// 巡检任务派发 定时任务
String INSPECT_TASK_DISTRIBUTE = "taskJobDistribute";
/** /**
* 处理同时开启几个任务的 * 处理同时开启几个任务的
*/ */

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectContentEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectContentEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskObjectProjectEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskRecordEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskRecordEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskResultEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskResultEntity.java

0
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskUserEntity.java → hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskUserEntity.java

3
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzims.spare.mapper; package com.hnac.hzims.spare.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity; import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity;
import com.hnac.hzims.spare.entity.WtSpBasicEntity; import com.hnac.hzims.spare.entity.WtSpBasicEntity;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
@ -14,7 +15,7 @@ import java.util.Map;
* *
* @author Chill * @author Chill
*/ */
public interface WtSpBasicMapper extends UserDataScopeBaseMapper<WtSpBasicEntity> { public interface WtSpBasicMapper extends BaseMapper<WtSpBasicEntity> {
/** /**
* 备品备件基础信息列表 * 备品备件基础信息列表
* @param params * @param params

1
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -836,6 +836,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
dto.setModelSignage(emTreeInspect.getModelSignage()); dto.setModelSignage(emTreeInspect.getModelSignage());
dto.setAttrSignage(emTreeInspect.getModelAttrSignage()); dto.setAttrSignage(emTreeInspect.getModelAttrSignage());
dto.setAttrName(emTreeInspect.getModelAttrName()); dto.setAttrName(emTreeInspect.getModelAttrName());
dto.setCreateDept(emInfo.getDepartment());
dto.setId(null); dto.setId(null);
contentDTOList.add(dto); contentDTOList.add(dto);
} }

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml

@ -17,6 +17,7 @@
from hzims_sys_log from hzims_sys_log
where is_deleted = 0 where is_deleted = 0
and to_days(operation_time) = to_days(now()) and to_days(operation_time) = to_days(now())
and tenant_id = '200000'
group by module_name; group by module_name;
</select> </select>
<select id="statisticsTitleByModuleName" <select id="statisticsTitleByModuleName"
@ -25,6 +26,7 @@
from hzims_sys_log from hzims_sys_log
<where> <where>
module_name = #{statisticsVo.moduleName} module_name = #{statisticsVo.moduleName}
and tenant_id = '200000'
<if test="statisticsVo.createTime != null"> <if test="statisticsVo.createTime != null">
and operation_time &gt;= #{statisticsVo.createTime} and operation_time &gt;= #{statisticsVo.createTime}
</if> </if>

23
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java

@ -67,10 +67,9 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
} }
/** /**
* 日志查询接口 * 日志查询接口
*
* @param sysLog * @param sysLog
* @return * @return
*/ */
@ -96,13 +95,13 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
} }
//功能模块 //功能模块
if (StringUtils.isNotEmpty(moduleName)){ if (StringUtils.isNotEmpty(moduleName)) {
queryWrapper.lambda().eq(SysLog::getModuleName,moduleName); queryWrapper.lambda().eq(SysLog::getModuleName, moduleName);
} }
//操作方法 //操作方法
if (StringUtils.isNotEmpty(title)){ if (StringUtils.isNotEmpty(title)) {
queryWrapper.lambda().eq(SysLog::getTitle,title); queryWrapper.lambda().eq(SysLog::getTitle, title);
} }
@ -112,17 +111,17 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
} }
//结束时间 //结束时间
if (ObjectUtils.isNotEmpty(endTime)){ if (ObjectUtils.isNotEmpty(endTime)) {
queryWrapper.lambda().le(SysLog::getOperationTime,endTime); queryWrapper.lambda().le(SysLog::getOperationTime, endTime);
} }
//根据操作时间和功能模块查询 //根据操作时间和功能模块查询
if (StringUtils.isNotEmpty(dateCalculated) && StringUtils.isNotEmpty(moduleName)){ if (StringUtils.isNotEmpty(dateCalculated) && StringUtils.isNotEmpty(moduleName)) {
queryWrapper.lambda().eq(SysLog::getModuleName,moduleName); queryWrapper.lambda().eq(SysLog::getModuleName, moduleName);
queryWrapper.eq("date_format(operation_time,'%Y-%m')",dateCalculated); queryWrapper.eq("date_format(operation_time,'%Y-%m')", dateCalculated);
} }
queryWrapper.lambda().eq(SysLog::getTenantId, "200000");
queryWrapper.lambda().orderByDesc(SysLog::getOperationTime); queryWrapper.lambda().orderByDesc(SysLog::getOperationTime);
return queryWrapper; return queryWrapper;

12
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<ContentEntity>{
}

13
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<ObjectEntity> {
}

13
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<ObjectUserEntity>{
}

12
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<PlanEntity> {
}

13
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<PlanObjectTemplateEntity> {
}

13
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<PlanOrgEntity> {
}

14
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<PlanPositionEntity> {
}

13
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<PlanUserEntity> {
}

15
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<ProjectContentEntity>{
}

13
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<ProjectEntity>{
}

13
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<TaskObjectEntity> {
}

16
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<TaskObjectProjectContentEntity> {
}

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectMapper.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.TaskObjectProjectEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @author ysj
*/
@Mapper
public interface TaskObjectProjectMapper extends BaseMapper<TaskObjectProjectEntity> {
}

13
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<TaskResultEntity> {
}

13
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<TaskUserEntity> {
}

15
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<TemplateEntity> {
}

13
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<TemplateProjectEntity>{
}

17
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<ImsDutyMainEntity> {
}

40
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<String> inspectTaskDistribute(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.inspectTaskDistribute(param);
return new ReturnT<>("SUCCESS");
}
}

2
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.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
@ -16,6 +15,7 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.*;
/** /**
* 监测点定时任务
* @author ysj * @author ysj
*/ */
@Slf4j @Slf4j

1
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 * @author ysj
*/ */
@Slf4j @Slf4j

1
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 * @author ysj
*/ */
@Slf4j @Slf4j

1
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 * @author ysj
*/ */
@Slf4j @Slf4j

11
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<ContentEntity> {
}

11
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<ObjectEntity> {
}

11
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<ObjectUserEntity> {
}

11
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<PlanObjectTemplateEntity> {
}

11
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<PlanOrgEntity> {
}

11
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<PlanPositionEntity> {
}

12
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<PlanEntity> {
}

13
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<PlanUserEntity> {
}

12
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<ProjectContentEntity>{
}

12
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<ProjectEntity>{
}

11
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<TaskObjectProjectContentEntity> {
}

11
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<TaskObjectProjectEntity> {
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.service.inspect;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface TaskObjectService extends BaseService<TaskObjectEntity> {
}

295
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskRemindManager.java

@ -0,0 +1,295 @@
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.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<TaskEntity> taskBegin){
//先删除
redisTemplate.opsForZSet().removeRange(REMIND_TASK_BEGIN_LIST,0, -1);
setTaskBeginList(taskBegin);
}
/**
* 结束
* 重置redis结束提醒缓存列表
* 按照时间排序 正序
*/
public void replaceEndTaskCacheList(List<TaskEntity> taskEnd){
//先删除
redisTemplate.opsForZSet().removeRange(REMIND_TASK_END_LIST,0, -1);
setTaskEndList(taskEnd);
}
/**
* 开始
* 任务批量加入redis提醒缓存列表中
*
*/
public void setTaskBeginList(List<TaskEntity> tasks){
HashSet set = new HashSet();
for (TaskEntity task : tasks) {
DefaultTypedTuple<TaskEntity> 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<TaskEntity> tasks){
HashSet set = new HashSet();
for (TaskEntity task : tasks) {
DefaultTypedTuple<TaskEntity> 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<TaskEntity> 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<TaskEntity> tasks = redisTemplate.opsForZSet().rangeByScore(key,0, currentTime);
if(Func.isNotEmpty(tasks)){
//若该任务已完成 则无需再进行短信推送
List<Long> taskIds = tasks.stream().map(TaskEntity::getId).collect(Collectors.toList());
List<TaskEntity> undoneTaskList = taskService.list(Wrappers.<TaskEntity>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<Long> 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<PushAudienceType, List<String>> 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<String, String> 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<SmsResponse> 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));
}
}
}
}

11
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<TaskResultEntity> {
}

2
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<TaskEntity> { public interface TaskService extends BaseService<TaskEntity> {
void inspectTaskDistribute(String param);
DutyInspectTaskVO task(String start, String end, List<Long> areas); DutyInspectTaskVO task(String start, String end, List<Long> areas);
} }

13
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<TaskUserEntity> {
}

98
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.vo.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<TaskEntity> getTasksFromCacheList(){
List<TaskEntity> tasks = new ArrayList<>();
HashMap<String, TaskEntity> map = (HashMap<String, TaskEntity>) 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;
}
}

12
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<TemplateProjectEntity>{
}

11
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<TemplateEntity> {
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ContentServiceImpl.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.ContentMapper;
import com.hnac.hzims.scheduled.service.inspect.ContentService;
import com.hnac.hzinfo.inspect.obj.entity.ContentEntity;
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 ContentServiceImpl extends BaseServiceImpl<ContentMapper, ContentEntity> implements ContentService {
}

19
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<ObjectMapper, ObjectEntity> implements ObjectService {
}

21
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.mapper.inspect.ObjectUserMapper;
import com.hnac.hzims.scheduled.service.inspect.ObjectUserService;
import com.hnac.hzinfo.inspect.obj.entity.ObjectUserEntity;
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<ObjectUserMapper, ObjectUserEntity> implements ObjectUserService {
}

21
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.mapper.inspect.PlanObjectTemplateMapper;
import com.hnac.hzims.scheduled.service.inspect.PlanObjectTemplateService;
import com.hnac.hzinfo.inspect.plan.entity.PlanObjectTemplateEntity;
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<PlanObjectTemplateMapper, PlanObjectTemplateEntity> implements PlanObjectTemplateService {
}

15
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.mapper.inspect.PlanOrgMapper;
import com.hnac.hzims.scheduled.service.inspect.PlanOrgService;
import com.hnac.hzinfo.inspect.plan.entity.PlanOrgEntity;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Service
public class PlanOrgServiceImpl extends BaseServiceImpl<PlanOrgMapper, PlanOrgEntity> implements PlanOrgService {
}

22
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.hzims.scheduled.mapper.inspect.PlanPositionMapper;
import com.hnac.hzims.scheduled.service.inspect.PlanPositionService;
import com.hnac.hzinfo.inspect.plan.entity.PlanPositionEntity;
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<PlanPositionMapper, PlanPositionEntity> implements PlanPositionService {
}

21
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<PlanMapper, PlanEntity> implements PlanService {
}

21
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.mapper.inspect.PlanUserMapper;
import com.hnac.hzims.scheduled.service.inspect.PlanUserService;
import com.hnac.hzinfo.inspect.plan.entity.PlanUserEntity;
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<PlanUserMapper, PlanUserEntity> implements PlanUserService {
}

22
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectContentServiceImpl.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.mapper.inspect.ProjectContentMapper;
import com.hnac.hzims.scheduled.service.inspect.ProjectContentService;
import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity;
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<ProjectContentMapper, ProjectContentEntity> implements ProjectContentService {
}

22
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.mapper.inspect.ProjectMapper;
import com.hnac.hzims.scheduled.service.inspect.ProjectService;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
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<ProjectMapper, ProjectEntity> implements ProjectService {
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectContentServiceImpl.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.TaskObjectProjectContentMapper;
import com.hnac.hzims.scheduled.service.inspect.TaskObjectProjectContentService;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectContentEntity;
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 TaskObjectProjectContentServiceImpl extends BaseServiceImpl<TaskObjectProjectContentMapper, TaskObjectProjectContentEntity> implements TaskObjectProjectContentService {
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectServiceImpl.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.TaskObjectProjectMapper;
import com.hnac.hzims.scheduled.service.inspect.TaskObjectProjectService;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity;
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 TaskObjectProjectServiceImpl extends BaseServiceImpl<TaskObjectProjectMapper, TaskObjectProjectEntity> implements TaskObjectProjectService {
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectServiceImpl.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.TaskObjectMapper;
import com.hnac.hzims.scheduled.service.inspect.TaskObjectService;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity;
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 TaskObjectServiceImpl extends BaseServiceImpl<TaskObjectMapper, TaskObjectEntity> implements TaskObjectService {
}

21
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.mapper.inspect.TaskResultMapper;
import com.hnac.hzims.scheduled.service.inspect.TaskResultService;
import com.hnac.hzinfo.inspect.task.entity.TaskResultEntity;
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<TaskResultMapper, TaskResultEntity> implements TaskResultService {
}

714
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java

@ -1,18 +1,45 @@
package com.hnac.hzims.scheduled.service.inspect.impl; 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.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.mapper.inspect.TaskMapper;
import com.hnac.hzims.scheduled.service.inspect.TaskService; import com.hnac.hzims.scheduled.service.inspect.*;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity; 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.vo.DutyInspectTaskVO; import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; 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 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.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -25,6 +52,687 @@ import java.util.stream.Collectors;
@DS("inspect") @DS("inspect")
public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> implements TaskService { public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> 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<PlanEntity> 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<TaskEntity> 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<PlanEntity> 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<PlanEntity> plans = planService.list(Wrappers.<PlanEntity>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<TaskUserEntity> 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<PlanUserEntity> users = this.getUsersByPlan(plan);
List<TaskUserEntity> 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<TaskUserEntity> 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<Long> 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<PlanUserEntity> users = this.getUsersByPlan(plan);
List<TaskUserEntity> 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<PlanUserEntity> getUsersByPlan(PlanEntity plan) {
List<PlanUserEntity> res = new LinkedList<>();
if(PlanContants.PlanTypeEnum.USER_TYPE.getType().equals(plan.getType()) || PlanContants.PlanTypeEnum.FREE_TYPE.getType().equals(plan.getType())){
QueryWrapper<PlanUserEntity> 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<PlanPositionEntity> planPositionEntityQueryWrapper = new QueryWrapper<>();
planPositionEntityQueryWrapper.lambda().eq(PlanPositionEntity::getPlanId, plan.getId());
planPostionService.list(planPositionEntityQueryWrapper).forEach(entity->{
//获取该机构下所有用户列表
List<User> users = new ArrayList<>();
List<User> 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<PlanOrgEntity> planOrgEntityQueryWrapper = new QueryWrapper<>();
planOrgEntityQueryWrapper.lambda().eq(PlanOrgEntity::getPlanId, plan.getId());
planOrgService.list(planOrgEntityQueryWrapper).forEach(entity->{
List<User> 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<plan.getTaskTimesADay();i++){
JSONObject time = timeJsonArray.getJSONObject(i);
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")) {
DateTimeFormatter dfShort = DateTimeFormatter.ofPattern("yyyy-MM-dd");
ImsDutyMainFeignVO mainPerson = dutyMainService.mainPerson(time.getLong("classId"), dfShort.format(LocalDate.now()));
List<Long> 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.<TaskEntity>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<TaskObjectEntity> taskObjectList = Lists.newArrayList();
// 自由模式
if(PlanContants.PlanTypeEnum.FREE_TYPE.getType().equals(plan.getType())){
// 查询计划用户
List<PlanUserEntity> planUsers = planUserService.list(Wrappers.<PlanUserEntity>query().lambda().eq(PlanUserEntity::getPlanId,plan.getId()));
if(CollectionUtil.isEmpty(planUsers)){
return result;
}
for(PlanUserEntity planUser : planUsers){
// 查询巡检对象用户
List<ObjectUserEntity> objectUsers= objectUserService.list(Wrappers.<ObjectUserEntity>query().lambda().eq(ObjectUserEntity::getUserId,planUser.getUserId()));
if(CollectionUtil.isEmpty(objectUsers)){
break;
}
for (ObjectUserEntity objectUser : objectUsers){
List<TaskObjectEntity> 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<PlanObjectTemplateEntity> templates = planObjectTemplateService.list(Wrappers.<PlanObjectTemplateEntity>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<TaskObjectEntity> 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<TemplateProjectEntity> projects = templateProjectService.list(Wrappers.<TemplateProjectEntity>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<ProjectContentEntity> contents = projectContentService.list(Wrappers.<ProjectContentEntity>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 * @param start

23
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.mapper.inspect.TaskUserMapper;
import com.hnac.hzims.scheduled.service.inspect.TaskUserService;
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity;
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<TaskUserMapper, TaskUserEntity> implements TaskUserService {
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save