Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java
zhongwei
yang_shj 1 year ago
parent
commit
459aa778c0
  1. 4
      hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java
  2. 7
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java
  3. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java
  4. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentDefinitionEntity.java
  5. 2
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java
  6. 54
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/entity/WorkArea.java
  7. 32
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/vo/WorkAreaQueryVo.java
  8. 35
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/dto/TicketStatisticDTO.java
  9. 71
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/entity/TicketInfoEntity.java
  10. 7
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/ITicketInfoAllClient.java
  11. 7
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClientFallback.java
  12. 12
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java
  13. 2
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml
  14. 3
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java
  15. 11
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java
  16. 6
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  17. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  18. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
  19. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ContentMapper.java
  20. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectMapper.java
  21. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ObjectUserMapper.java
  22. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanMapper.java
  23. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanObjectTemplateMapper.java
  24. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanOrgMapper.java
  25. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanPositionMapper.java
  26. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/PlanUserMapper.java
  27. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectContentMapper.java
  28. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ProjectMapper.java
  29. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java
  30. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectMapper.java
  31. 16
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectContentMapper.java
  32. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectProjectMapper.java
  33. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskResultMapper.java
  34. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskUserMapper.java
  35. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateMapper.java
  36. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TemplateProjectMapper.java
  37. 55
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BusinessScheduledTask.java
  38. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ContentService.java
  39. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectService.java
  40. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ObjectUserService.java
  41. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanObjectTemplateService.java
  42. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanOrgService.java
  43. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanPositionService.java
  44. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanService.java
  45. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/PlanUserService.java
  46. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectContentService.java
  47. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/ProjectService.java
  48. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectContentService.java
  49. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectProjectService.java
  50. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskObjectService.java
  51. 295
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskRemindManager.java
  52. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskResultService.java
  53. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java
  54. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskUserService.java
  55. 98
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskVideoManager.java
  56. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateProjectService.java
  57. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TemplateService.java
  58. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ContentServiceImpl.java
  59. 19
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectServiceImpl.java
  60. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ObjectUserServiceImpl.java
  61. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanObjectTemplateServiceImpl.java
  62. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanOrgServiceImpl.java
  63. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanPositionServiceImpl.java
  64. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanServiceImpl.java
  65. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/PlanUserServiceImpl.java
  66. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectContentServiceImpl.java
  67. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/ProjectServiceImpl.java
  68. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectContentServiceImpl.java
  69. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectProjectServiceImpl.java
  70. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskObjectServiceImpl.java
  71. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskResultServiceImpl.java
  72. 717
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java
  73. 23
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskUserServiceImpl.java
  74. 21
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateProjectServiceImpl.java
  75. 20
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateServiceImpl.java
  76. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java
  77. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/MaintenanceService.java
  78. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java
  79. 24
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java
  80. 188
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/MaintenanceServiceImpl.java
  81. 35
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java
  82. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java
  83. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java
  84. 55
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/WorkTicketServiceImpl.java
  85. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ContentMapper.xml
  86. 21
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/DutyMainMapper.xml
  87. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectMapper.xml
  88. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectUserMapper.xml
  89. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml
  90. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanObjectTemplateMapper.xml
  91. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanOrgMapper.xml
  92. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanPositionMapper.xml
  93. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanUserMapper.xml
  94. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectContentMapper.xml
  95. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectMapper.xml
  96. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectMapper.xml
  97. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectContentMapper.xml
  98. 6
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectMapper.xml
  99. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskResultMapper.xml
  100. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskUserMapper.xml
  101. Some files were not shown because too many files have changed in this diff Show More

4
hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java

@ -37,8 +37,8 @@ import java.util.Map;
* @date 2023/3/29 * @date 2023/3/29
* @description: 操作日志切面处理类 * @description: 操作日志切面处理类
*/ */
@Aspect //@Aspect
@Component //@Component
@Slf4j @Slf4j
public class SysLogAspect { public class SysLogAspect {

7
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java

@ -16,11 +16,8 @@ public class AreaAssetDeviceVo {
@ApiModelProperty(value = "机构Id") @ApiModelProperty(value = "机构Id")
private Long deptId; private Long deptId;
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "机构名称")
private String deviceCode; private String deptName;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private Integer status; private Integer status;

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java

@ -24,8 +24,8 @@ public class AreaTimelyVo {
private String time; private String time;
@ApiModelProperty(value = "提醒数量") @ApiModelProperty(value = "提醒数量")
private Integer sum; private String type;
@ApiModelProperty(value = "字体颜色:1-红色 0-黄色") @ApiModelProperty(value = "字体颜色:0-红色 1-黄色 2-绿色")
private Integer colour; private Integer colour;
} }

2
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ContentDefinitionEntity.java

@ -39,9 +39,11 @@ public class ContentDefinitionEntity extends TenantEntity implements Serializabl
private String description; private String description;
@ApiModelProperty(value = "记录类型 0不记录 1仅选择 2仅记值 3选择并记值") @ApiModelProperty(value = "记录类型 0不记录 1仅选择 2仅记值 3选择并记值")
@QueryField(condition = SqlCondition.EQUAL)
private String recordType; private String recordType;
@ApiModelProperty(value = "检测类型") @ApiModelProperty(value = "检测类型")
@QueryField(condition = SqlCondition.EQUAL)
private String checkType; private String checkType;
@ApiModelProperty(value = "检测类型子类") @ApiModelProperty(value = "检测类型子类")

2
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/WxMessageDTO.java

@ -45,7 +45,7 @@ public class WxMessageDTO implements Serializable {
@NotNull @NotNull
@ApiModelProperty(value = "推送消息键值对") @ApiModelProperty(value = "推送消息键值对")
private Map<String,String> map; private Map<String,Object> map;
@NotNull @NotNull
@ApiModelProperty(value = "内容") @ApiModelProperty(value = "内容")

54
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/entity/WorkArea.java

@ -0,0 +1,54 @@
package com.hnac.hzims.safeproduct.workarea.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("work_area")
public class WorkArea {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 区域名称
*/
@TableField("area_name")
private String areaName;
/**
* 安全责任人
*/
@TableField("direct_op_id")
private Long directOpId;
/**
* 监管部门
*/
@TableField("depart_id")
private Long departId;
/**
* 分管领导
*/
@TableField("lead_op_id")
private Long leadOpId;
/**
* 区域范围
*/
@TableField("area_range")
private String areaRange;
private String directOpName;
private String departName;
private String leadOpName;
}

32
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/workarea/vo/WorkAreaQueryVo.java

@ -0,0 +1,32 @@
package com.hnac.hzims.safeproduct.workarea.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
@Data
public class WorkAreaQueryVo {
/**
* 区域名称
*/
@TableField("area_name")
private String areaName;
/**
* 安全责任人
*/
@TableField("direct_op_id")
private Long directOpId;
/**
* 监管部门
*/
@TableField("depart_id")
private Long departId;
/**
* 分管领导
*/
@TableField("lead_op_id")
private Long leadOpId;
}

35
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/dto/TicketStatisticDTO.java

@ -0,0 +1,35 @@
package com.hnac.hzims.ticket.allTicket.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @ClassName TicketStatisticDTO
* @description: 两票统计请求
* @author: hx
* @create: 2023-08-17 11:26
* @Version 4.0
**/
@Data
@Builder
@EqualsAndHashCode
public class TicketStatisticDTO implements Serializable {
private String deptIds;
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime startTime;
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime endTime;
}

71
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/entity/TicketInfoEntity.java

@ -0,0 +1,71 @@
package com.hnac.hzims.ticket.allTicket.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* @ClassName TicketInfoEntity
* @description:
* @author: hx
* @create: 2023-08-30 08:30
* @Version 4.0
**/
@TableName("v_hzims_ticket_info")
@ApiModel("两票合计对象")
@Data
public class TicketInfoEntity extends TenantEntity {
@ApiModelProperty("审批流程ID")
@QueryField(condition = SqlCondition.EQUAL)
private String processInstanceId;
@ApiModelProperty(value = "关联业务类型")
@QueryField(condition = SqlCondition.EQUAL)
private String type;
@ApiModelProperty(value = "单位")
@QueryField(condition = SqlCondition.LIKE)
private String company;
@ApiModelProperty(value = "编号")
@QueryField(condition = SqlCondition.LIKE)
private String code;
@ApiModelProperty(value = "关联业务类型")
@QueryField(condition = SqlCondition.EQUAL)
private String taskType;
@ApiModelProperty(value = "关联业务ID")
@QueryField(condition = SqlCondition.EQUAL)
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long taskId;
@ApiModelProperty("关联业务名称")
@QueryField(condition = SqlCondition.LIKE)
private String taskName;
@ApiModelProperty(value = "计划开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime planStartTime;
@ApiModelProperty(value = "计划结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime planEndTime;
@ApiModelProperty("流程描述")
private String flowDescription;
}

7
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/ITicketInfoAllClient.java

@ -1,11 +1,14 @@
package com.hnac.hzims.ticket.allTicket.fegin; package com.hnac.hzims.ticket.allTicket.fegin;
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.TicketConstants;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -25,6 +28,7 @@ public interface ITicketInfoAllClient {
String DOUBLE_PASS_RATE = "/getDoublePassRate"; String DOUBLE_PASS_RATE = "/getDoublePassRate";
String DOUBLE_PASS_QUANTITY = "/getDoublePassQuantity"; String DOUBLE_PASS_QUANTITY = "/getDoublePassQuantity";
String GET_TICKET_REPORT_STATISTIC = API_PREFIX+"/getTicketReportStatistic"; String GET_TICKET_REPORT_STATISTIC = API_PREFIX+"/getTicketReportStatistic";
String GET_TICKET_PASS_RATE = API_PREFIX + "/getTicketPassRate";
/** /**
* 统计站点统计月报-两票 * 统计站点统计月报-两票
@ -61,4 +65,7 @@ public interface ITicketInfoAllClient {
List<DoublePassVO> getDoublePassQuantity(@RequestParam(value = "stationMap") Map<String,String> stationMap, List<DoublePassVO> getDoublePassQuantity(@RequestParam(value = "stationMap") Map<String,String> stationMap,
@RequestParam(value = "firstDateTime") LocalDateTime firstDateTime, @RequestParam(value = "firstDateTime") LocalDateTime firstDateTime,
@RequestParam(value = "now") LocalDateTime now); @RequestParam(value = "now") LocalDateTime now);
@GetMapping(GET_TICKET_PASS_RATE)
R<DoublePassRateVO> getTicketPassRate(TicketStatisticDTO ticketStatisticDTO);
} }

7
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClientFallback.java

@ -1,8 +1,10 @@
package com.hnac.hzims.ticket.allTicket.fegin; package com.hnac.hzims.ticket.allTicket.fegin;
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -34,4 +36,9 @@ public class TicketInfoAllClientFallback implements ITicketInfoAllClient {
public List<DoublePassVO> getDoublePassQuantity(Map<String, String> stationMap, LocalDateTime firstDateTime, LocalDateTime now) { public List<DoublePassVO> getDoublePassQuantity(Map<String, String> stationMap, LocalDateTime firstDateTime, LocalDateTime now) {
return null; return null;
} }
@Override
public R<DoublePassRateVO> getTicketPassRate(TicketStatisticDTO ticketStatisticDTO) {
return null;
}
} }

12
hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java

@ -110,26 +110,18 @@ public class SpareClient implements ISpareClient{
WtSpWarehouseEntity warehouse = warehouses.stream().filter(o->o.getId().equals(total.getWarehouseId())).min(Comparator.comparing(WtSpWarehouseEntity::getId)).get(); WtSpWarehouseEntity warehouse = warehouses.stream().filter(o->o.getId().equals(total.getWarehouseId())).min(Comparator.comparing(WtSpWarehouseEntity::getId)).get();
timely.setDeptName(warehouse.getName()); timely.setDeptName(warehouse.getName());
timely.setEventId(String.valueOf(total.getId())); timely.setEventId(String.valueOf(total.getId()));
timely.setType("固定资产");
timely.setColour(1);
if(total.getStock() > basic.getUpperLimit()){ if(total.getStock() > basic.getUpperLimit()){
timely.setContent(String.format("(%s)已达到上限,目前仓库内的库存为:%s,上限值为:%s。", timely.setContent(String.format("(%s)已达到上限,目前仓库内的库存为:%s,上限值为:%s。",
basic.getName(), basic.getName(),
total.getStock(), total.getStock(),
basic.getUpperLimit())); basic.getUpperLimit()));
timely.setSum((int) (total.getStock() - basic.getUpperLimit()));
timely.setColour(0);
if((double) (total.getStock() - basic.getUpperLimit()) / basic.getUpperLimit() > 0.3){
timely.setColour(1);
}
}else{ }else{
timely.setContent(String.format("(%s)已达到下限,目前仓库内的库存为:%s,下限值为:%s。", timely.setContent(String.format("(%s)已达到下限,目前仓库内的库存为:%s,下限值为:%s。",
basic.getName(), basic.getName(),
total.getStock(), total.getStock(),
basic.getUpperLimit())); basic.getUpperLimit()));
timely.setSum((int) (total.getStock() - basic.getLowerLimit()));
timely.setColour(0);
if((double)(basic.getLowerLimit() - total.getStock()) / basic.getLowerLimit() > 0.3){
timely.setColour(1);
}
} }
timely.setTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); timely.setTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
exceeds.add(timely); exceeds.add(timely);

2
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceivesMapper.xml

@ -45,7 +45,7 @@
wt_sp_receives wr wt_sp_receives wr
JOIN wt_sp_warehouse sw ON wr.STORAGE_ROOM = sw.id JOIN wt_sp_warehouse sw ON wr.STORAGE_ROOM = sw.id
<if test="params.code!=null and params.code!=''"> <if test="params.code!=null and params.code!=''">
and wr.code = #{params.code} and wr.code like concat('%',#{params.code},'%')
</if> </if>
<if test="params.createUser!=null"> <if test="params.createUser!=null">
and wr.CREATE_USER = #{params.createUser} and wr.CREATE_USER = #{params.createUser}

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

@ -1,6 +1,5 @@
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;
@ -15,7 +14,7 @@ import java.util.Map;
* *
* @author Chill * @author Chill
*/ */
public interface WtSpBasicMapper extends BaseMapper<WtSpBasicEntity> { public interface WtSpBasicMapper extends UserDataScopeBaseMapper<WtSpBasicEntity> {
/** /**
* 备品备件基础信息列表 * 备品备件基础信息列表
* @param params * @param params

11
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java

@ -14,14 +14,13 @@ import com.hnac.hzims.spare.vo.WtSpBasicVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springblade.core.launch.constant.FlowConstant;
import org.springblade.core.log.exception.ServiceException; 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.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.IDictBizClient; import org.springblade.system.feign.IDictBizClient;
@ -31,7 +30,6 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -39,7 +37,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
@ -246,7 +243,11 @@ public class SpAllocationServiceImpl extends BaseServiceImpl<SpAllocationMapper,
} }
} }
WtSpWarehouseEntity inWarehouseEntity = warehouseMapper.selectById(entity.getInWarehouseId()); WtSpWarehouseEntity inWarehouseEntity = warehouseMapper.selectById(entity.getInWarehouseId());
entity.setInWarehouseName(inWarehouseEntity.getName()); if(ObjectUtil.isNotEmpty(inWarehouseEntity)&&StringUtil.isNotBlank(inWarehouseEntity.getName())){
entity.setInWarehouseName(inWarehouseEntity.getName());
}else {
entity.setInWarehouseName("");
}
result.add(entity); result.add(entity);
} }
return page.setRecords(result); return page.setRecords(result);

6
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java

@ -552,9 +552,9 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
List<WtSpBasicEntity> data = new ArrayList<>(); List<WtSpBasicEntity> data = new ArrayList<>();
List<WtSpBasicEntity> error = new ArrayList<>(); List<WtSpBasicEntity> error = new ArrayList<>();
error = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream() error = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream()
.filter(entity -> Func.isEmpty(entity.getName())).collect(Collectors.toList()); .filter(entity -> Func.isEmpty(entity.getCode())).collect(Collectors.toList());
data = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream() data = JSONArray.parseArray(JSON.toJSONString(entityList), WtSpBasicEntity.class).stream()
.filter(entity -> Func.isNotEmpty(entity.getName())).collect(Collectors.toList()); .filter(entity -> Func.isNotEmpty(entity.getCode())).collect(Collectors.toList());
Assert.isTrue(CollectionUtil.isEmpty(error), () -> { Assert.isTrue(CollectionUtil.isEmpty(error), () -> {
throw new ServiceException("填入工器具编码不能为空"); throw new ServiceException("填入工器具编码不能为空");
}); });
@ -567,7 +567,7 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
Integer counter = 2; Integer counter = 2;
//数据校验 //数据校验
R<String> r = this.validExcel(libraryExcel, codeList, counter); R<String> r = this.validExcel(libraryExcel, codeList, counter);
if (r.getMsg()!=null|| !r.isSuccess()) { if ( !r.isSuccess()) {
return r; return r;
} }
} }

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

@ -638,7 +638,7 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
} }
paramMap.put("stationIds", list.toArray(new String[0])); paramMap.put("stationIds", list.toArray(new String[0]));
}else{ }else{
paramMap.put("stationIds", stations); paramMap.put("stationIds", stations);
} }
String result = HttpRequestUtil.postCall(paramMap, autoFaultPath, "POST"); String result = HttpRequestUtil.postCall(paramMap, autoFaultPath, "POST");
if (StringUtil.isBlank(result)) { if (StringUtil.isBlank(result)) {

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java

@ -45,7 +45,7 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService {
@Override @Override
public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { public Boolean isWorkflowProcess(WorkflowQueue flowQueue) {
log.info("是否执行水力机械工作票流程环节操作~~~~,流程ticket: {}", flowQueue); log.info("是否执行水力机械工作票流程环节操作~~~~,流程ticket: {}", flowQueue);
String dictValue = processDictService.selectDictValueByKey(flowQueue.getProcessDefinitionKey()); String dictValue = processDictService.selectDictValueByKey(MACHINERY_TICKET_KEY);
if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { if (dictValue.equals(flowQueue.getProcessDefinitionKey())) {
log.info("已执行水力机械工作票流程环节操作~~~~"); log.info("已执行水力机械工作票流程环节操作~~~~");
return true; return true;

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/ContentMapper.java

@ -1,12 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,14 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,15 +0,0 @@
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

@ -1,13 +0,0 @@
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>{
}

4
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java

@ -1,13 +1,13 @@
package com.hnac.hzims.scheduled.mapper.inspect; package com.hnac.hzims.scheduled.mapper.inspect;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/** /**
* @author ysj * @author ysj
*/ */
@Mapper @Mapper
public interface TaskMapper extends UserDataScopeBaseMapper<TaskEntity> { public interface TaskMapper extends BaseMapper<TaskEntity> {
} }

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskObjectMapper.java

@ -1,13 +0,0 @@
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

@ -1,16 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,15 +0,0 @@
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

@ -1,13 +0,0 @@
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>{
}

55
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/BusinessScheduledTask.java

@ -1,55 +0,0 @@
package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.inspect.TaskService;
import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService;
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.*;
/**
* 业务模块定时任务
* @author ysj
*/
@Slf4j
@Component
public class BusinessScheduledTask {
@Autowired
private TaskService service;
private MaintenanceService maintenanceService;
/**
* 巡检任务派发 : 一分钟执行一次
*/
@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");
}
/**
* 巡检任务派发 : 一天执行一次 凌晨0时执行
*/
@XxlJob(MAINTENANCE_TASK_DISTRIBUTE)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> maintenanceTaskDistribute(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
maintenanceService.maintenanceTaskDistribute(param);
return new ReturnT<>("SUCCESS");
}
}

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

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -1,13 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,295 +0,0 @@
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

@ -1,11 +0,0 @@
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,7 +11,5 @@ 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

@ -1,13 +0,0 @@
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

@ -1,98 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -1,11 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,19 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,15 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,21 +0,0 @@
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

@ -1,21 +0,0 @@
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 {
}

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

@ -1,45 +1,17 @@
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.*; import com.hnac.hzims.scheduled.service.inspect.TaskService;
import com.hnac.hzims.scheduled.service.operation.business.DutyMainService; import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
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.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;
@ -52,687 +24,6 @@ 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
@ -758,13 +49,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
task.setInspectTaskIds(tasks.stream().map(TaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); task.setInspectTaskIds(tasks.stream().map(TaskEntity::getId).map(Object::toString).collect(Collectors.joining(",")));
task.setInspectTaskSum(tasks.size()); task.setInspectTaskSum(tasks.size());
// 所有处理完成巡检任务 // 所有处理完成巡检任务
List<TaskEntity> finshList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(3)).collect(Collectors.toList()); List<TaskEntity> finshList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(4)).collect(Collectors.toList());
if(CollectionUtil.isEmpty(finshList)){ if(CollectionUtil.isEmpty(finshList)){
return task; return task;
} }
task.setInspectTaskFinish(finshList.size()); task.setInspectTaskFinish(finshList.size());
// 未执行任务数 // 未执行任务数
List<TaskEntity> notExecuteList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(0)).collect(Collectors.toList()); List<TaskEntity> notExecuteList = tasks.stream().filter(o-> !finshList.stream().map(TaskEntity::getId).collect(Collectors.toList()).contains(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(notExecuteList)){ if(CollectionUtil.isEmpty(notExecuteList)){
return task; return task;
} }

23
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskUserServiceImpl.java

@ -1,23 +0,0 @@
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 {
}

21
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateProjectServiceImpl.java

@ -1,21 +0,0 @@
package com.hnac.hzims.scheduled.service.inspect.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.scheduled.mapper.inspect.TemplateProjectMapper;
import com.hnac.hzims.scheduled.service.inspect.TemplateProjectService;
import com.hnac.hzinfo.inspect.obj.entity.TemplateProjectEntity;
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 TemplateProjectServiceImpl extends BaseServiceImpl<TemplateProjectMapper, TemplateProjectEntity> implements TemplateProjectService {
}

20
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TemplateServiceImpl.java

@ -1,20 +0,0 @@
package com.hnac.hzims.scheduled.service.inspect.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.scheduled.mapper.inspect.TemplateMapper;
import com.hnac.hzims.scheduled.service.inspect.TemplateService;
import com.hnac.hzinfo.inspect.obj.entity.TemplateEntity;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Service
@Slf4j
@AllArgsConstructor
@DS("inspect")
public class TemplateServiceImpl extends BaseServiceImpl<TemplateMapper, TemplateEntity> implements TemplateService {
}

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java

@ -11,5 +11,4 @@ import java.util.List;
*/ */
public interface DefectService extends BaseService<OperDefectEntity> { public interface DefectService extends BaseService<OperDefectEntity> {
SolveHomeVO solve_count(List<Long> deptIds, String start, String end);
} }

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/MaintenanceService.java

@ -13,8 +13,6 @@ import java.util.List;
*/ */
public interface MaintenanceService extends BaseService<OperMaintenanceTaskEntity> { public interface MaintenanceService extends BaseService<OperMaintenanceTaskEntity> {
void maintenanceTaskDistribute(String param);
Integer maintenanceCount(List<Long> areas); Integer maintenanceCount(List<Long> areas);
MaintainVo maintain(String start, String end, List<Long> areas); MaintainVo maintain(String start, String end, List<Long> areas);

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.scheduled.service.operation.business; package com.hnac.hzims.scheduled.service.operation.business;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.SolveHomeVO;
import com.hnac.hzims.operational.main.vo.ShortagesVo; import com.hnac.hzims.operational.main.vo.ShortagesVo;
import com.hnac.hzims.operational.report.vo.DutyDefectVO; import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
@ -12,6 +13,8 @@ import java.util.List;
*/ */
public interface PhenomenonService extends BaseService<OperPhenomenonEntity> { public interface PhenomenonService extends BaseService<OperPhenomenonEntity> {
SolveHomeVO solve_count(List<Long> deptIds, String start, String end);
DutyDefectVO defect(String start, String end, List<Long> areas); DutyDefectVO defect(String start, String end, List<Long> areas);
ShortagesVo defectMonth(String start, String end, List<Long> list); ShortagesVo defectMonth(String start, String end, List<Long> list);

24
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java

@ -26,28 +26,4 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public class DefectServiceImpl extends BaseServiceImpl<DefectMapper, OperDefectEntity> implements DefectService { public class DefectServiceImpl extends BaseServiceImpl<DefectMapper, OperDefectEntity> implements DefectService {
/**
* 消缺数量统计
* @param deptIds
* @param start
* @param end
* @return
*/
@Override
public SolveHomeVO solve_count(List<Long> deptIds, String start, String end) {
SolveHomeVO solve = new SolveHomeVO();
List<OperDefectEntity> defects = this.list(Wrappers.<OperDefectEntity>lambdaQuery()
.in(OperDefectEntity::getCreateDept,deptIds)
.gt(OperDefectEntity::getCreateTime,start)
.lt(OperDefectEntity::getCreateTime,end)
);
if(cn.hutool.core.collection.CollectionUtil.isEmpty(defects)){
solve.setDefectCount(0);
solve.setSolveCount(0);
}else{
solve.setDefectCount(defects.size());
solve.setSolveCount((int) defects.stream().filter(defect-> ObjectUtil.isNotEmpty(defect.getHandleTaskId())).count());
}
return solve;
}
} }

188
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/MaintenanceServiceImpl.java

@ -1,44 +1,23 @@
package com.hnac.hzims.scheduled.service.operation.business.impl; package com.hnac.hzims.scheduled.service.operation.business.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.message.dto.PlanMsgRecordDto;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.main.vo.MaintainVo; import com.hnac.hzims.operational.main.vo.MaintainVo;
import com.hnac.hzims.operational.main.vo.RegularWorkVO; import com.hnac.hzims.operational.main.vo.RegularWorkVO;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskEntityVo;
import com.hnac.hzims.scheduled.mapper.operation.MaintenanceMapper; import com.hnac.hzims.scheduled.mapper.operation.MaintenanceMapper;
import com.hnac.hzims.scheduled.service.operation.business.MaintenancePlanService;
import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService; import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
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.*;
import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.beans.Transient; import java.time.LocalDate;
import java.time.*; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.LocalTime;
import java.util.*; import java.util.Date;
import java.util.concurrent.CompletableFuture; import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATE;
/** /**
* @author ysj * @author ysj
@ -48,157 +27,6 @@ import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATE;
@Slf4j @Slf4j
public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, OperMaintenanceTaskEntity> implements MaintenanceService { public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, OperMaintenanceTaskEntity> implements MaintenanceService {
private final MaintenancePlanService planService;
private final DutyMainServiceImpl dutyMainService;
private final IFlowClient flowClient;
private final IMessageClient messageClient;
private final DataSourceTransactionManager manager;
private final ThreadPoolExecutor executor;
/**
* 日常维护任务派发
* @param param
*/
@Override
@Transient
public void maintenanceTaskDistribute(String param) {
// 开始时间
Date start = DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE);
// 结束时间
Date end = DateUtil.parse(DateUtil.formatDate(DateUtil.plusDays(start, 1)), DateUtil.PATTERN_DATE);
// 查询日常维护计划
List<OperMaintenancePlanEntity> plans = planService.list(Wrappers.<OperMaintenancePlanEntity>lambdaQuery()
.ge(OperMaintenancePlanEntity::getDisposeTime,start)
.lt(OperMaintenancePlanEntity::getDisposeTime,end)
.isNotNull(OperMaintenancePlanEntity::getCreateTaskTime)
);
// 遍历计划列表生成相应任务
if(CollectionUtil.isEmpty(plans)){
return;
}
plans.forEach(plan -> {
// 生成日常任务对象
OperMaintenanceTaskEntity task = BeanUtil.copy(plan,OperMaintenanceTaskEntity.class);
if(StringUtil.isEmpty(task.getEmCode())){
this.taskDistribute(task,plan);
}else{
for (String code : plan.getEmCode().split(",")) {
task.setEmCode(code);
this.taskDistribute(task,plan);
}
}
});
}
/**
* 日常维护任务派发
* @param task
* @param plan
*/
private void taskDistribute(OperMaintenanceTaskEntity task, OperMaintenancePlanEntity plan) {
DefaultTransactionDefinition defaultTransactionDefinition = new DefaultTransactionDefinition();
defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus transaction = manager.getTransaction(defaultTransactionDefinition);
task.setId(null);
task.setCreateTime(new Date());
task.setUpdateTime(new Date());
task.setPlanId(plan.getId());
task.setTaskCode(UUID.randomUUID().toString());
if (task.getRefLibraryId() != 0) {
task.setCreateTime(DateUtil.now());
}
if(ObjectUtil.isNotEmpty(plan.getDisposer())){
task.setDisposer(plan.getDisposer().toString());
}
//补充计划结束时间
Instant instant = task.getDisposeTime().toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime disposeTime = instant.atZone(zoneId).toLocalDateTime();
task.setPlanEndTime(disposeTime.plusHours(task.getHours()));
//获取值班人员
if (ObjectUtil.isNotEmpty(plan.getMaintenanceModel()) && plan.getMaintenanceModel() == 2) {
//查询值班信息
LambdaQueryWrapper<ImsDutyMainEntity> dutyWrapper = new LambdaQueryWrapper<>();
dutyWrapper.eq(ImsDutyMainEntity::getDutyDate, DateTimeFormatter.ofPattern(PATTERN_DATE).format(disposeTime));
dutyWrapper.eq(ImsDutyMainEntity::getClassId, plan.getImsDutyClassId());
ImsDutyMainEntity entity = dutyMainService.getOne(dutyWrapper);
if (ObjectUtil.isEmpty(entity) || StringUtils.isEmpty(entity.getDutyPersonIds())) {
log.error("计划ID为:{}未查询到排班记录", plan.getId());
return;
}
String userId = entity.getDutyPersonIds();
task.setDisposer(userId.replaceAll("\\^", ","));
}
this.save(task);
// 事务提交
manager.commit(transaction);
//启动流程
String processInstanceId = this.startProcess(plan.getProcDefId(), task);
//推送消息
CompletableFuture<Void> operMaintenanceTaskEntityCompletableFuture =
CompletableFuture.runAsync(() -> {
task.setProcessInstanceId(processInstanceId);
this.updateById(task);
plan.setCreateTaskTime(new Date());
planService.updateById(plan);
//推送消息
this.pushTaskMessage(task.getId());
}, executor);
//启动队列
try {
CompletableFuture.allOf(operMaintenanceTaskEntityCompletableFuture).get();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 开启一个流程实例
**/
private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity) {
OperMaintenanceTaskEntityVo operMaintenanceTaskEntityVo = new OperMaintenanceTaskEntityVo();
BeanUtils.copyProperties(taskEntity, operMaintenanceTaskEntityVo);
Map<String, Object> params = new HashMap<>();
params.put("taskId", taskEntity.getId());
List<String> userIdList = Stream.of(taskEntity.getDisposer().split(",")).collect(Collectors.toList());
String taskUsers = userIdList.stream().filter(StringUtils::isNotBlank).map("taskUser_"::concat).collect(Collectors.joining(","));
params.put("initUserIds", taskUsers);
params.put("operMaintenanceTaskEntityVo", operMaintenanceTaskEntityVo);
return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params).getData().getProcessInstanceId();
}
/**
* 推送消息
*/
private void pushTaskMessage(Long taskId) {
OperMaintenanceTaskEntity task = this.getById(taskId);
if(ObjectUtil.isEmpty(task)){
return;
}
// 根据消息模板Id查询模板
R<MessageTemplateEntity> result = messageClient.getMsgTemplateById(task.getMessageTemplateId());
if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) {
Func.toLongList(",", task.getDisposer()).forEach(userId -> {
//推送消息
ZoneId zoneId = ZoneId.systemDefault();
PlanMsgRecordDto msg = new PlanMsgRecordDto();
msg.setTemplateId(task.getMessageTemplateId());
msg.setCreateUser(task.getCreateUser());
msg.setPlanTime(LocalDateTime.ofInstant(task.getDisposeTime().toInstant(), zoneId));
msg.setTaskId(task.getId());
msg.setDeptId(task.getCreateDept());
msg.setReceiver(userId);
msg.setContent("距离任务执行时间已不满一小时,请及时处理");
messageClient.planSendMessage(msg);
});
}
}
/** /**
* 获取日常维护数量 * 获取日常维护数量
* @param departList * @param departList
@ -247,7 +75,7 @@ public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, O
} }
// 日常维护完成数 // 日常维护完成数
maintainVo.setMaintain(maintainList.size()); maintainVo.setMaintain(maintainList.size());
List<Long> maintainFinish = maintainList.stream().filter(o-> Func.isNotEmpty(o.getStatus()) && MaintenanceConstant.TASK_STATUS_5 == o.getStatus()) List<Long> maintainFinish = maintainList.stream().filter(o-> "结束".equals(o.getFlowTaskName()))
.map(OperMaintenanceTaskEntity::getId).collect(Collectors.toList()); .map(OperMaintenanceTaskEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(maintainFinish)){ if(CollectionUtil.isEmpty(maintainFinish)){
maintainVo.setMaintainFinish(0); maintainVo.setMaintainFinish(0);
@ -281,7 +109,7 @@ public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, O
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(",")));
regularWorkVO.setRegularWorkSum(regularWorkList.size()); regularWorkVO.setRegularWorkSum(regularWorkList.size());
// 定期工作任务完成数量 // 定期工作任务完成数量
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> "结束".equals(o.getFlowTaskName())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(regularWorkFinishList)) { if (CollectionUtil.isEmpty(regularWorkFinishList)) {
regularWorkVO.setRegularWork(0); regularWorkVO.setRegularWork(0);
return regularWorkVO; return regularWorkVO;

35
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java

@ -1,7 +1,10 @@
package com.hnac.hzims.scheduled.service.operation.business.impl; package com.hnac.hzims.scheduled.service.operation.business.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.SolveHomeVO;
import com.hnac.hzims.operational.main.vo.ShortagesVo; import com.hnac.hzims.operational.main.vo.ShortagesVo;
import com.hnac.hzims.operational.report.vo.DutyDefectVO; import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import com.hnac.hzims.scheduled.mapper.operation.PhenomenonMapper; import com.hnac.hzims.scheduled.mapper.operation.PhenomenonMapper;
@ -11,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
@ -28,6 +32,32 @@ import java.util.stream.Collectors;
public class PhenomenonServiceImpl extends BaseServiceImpl<PhenomenonMapper, OperPhenomenonEntity> implements PhenomenonService { public class PhenomenonServiceImpl extends BaseServiceImpl<PhenomenonMapper, OperPhenomenonEntity> implements PhenomenonService {
/** /**
* 消缺数量统计
* @param deptIds
* @param start
* @param end
* @return
*/
@Override
public SolveHomeVO solve_count(List<Long> deptIds, String start, String end) {
SolveHomeVO solve = new SolveHomeVO();
List<OperPhenomenonEntity> defects = this.list(Wrappers.<OperPhenomenonEntity>lambdaQuery()
.in(OperPhenomenonEntity::getCreateDept,deptIds)
.gt(OperPhenomenonEntity::getCreateTime,start)
.lt(OperPhenomenonEntity::getCreateTime,end)
);
if(cn.hutool.core.collection.CollectionUtil.isEmpty(defects)){
solve.setDefectCount(0);
solve.setSolveCount(0);
}else{
solve.setDefectCount(defects.size());
solve.setSolveCount((int) defects.stream().filter(defect-> !ObjectUtil.isEmpty(defect.getHandleTaskId())).count());
}
return solve;
}
/**
* 时间范围内机构缺陷数据查询 * 时间范围内机构缺陷数据查询
* @param start * @param start
* @param end * @param end
@ -51,7 +81,7 @@ public class PhenomenonServiceImpl extends BaseServiceImpl<PhenomenonMapper, Ope
defectVO.setTotalIds(operPhenomenonList.stream().map(o->String.valueOf(o.getId())).collect(Collectors.joining(","))); defectVO.setTotalIds(operPhenomenonList.stream().map(o->String.valueOf(o.getId())).collect(Collectors.joining(",")));
defectVO.setDefectSum(operPhenomenonList.size()); defectVO.setDefectSum(operPhenomenonList.size());
// 消缺数 // 消缺数
List<Long> defectList = operPhenomenonList.stream().filter(o -> (Func.isNotEmpty(o.getIsDefect()) && o.getIsDefect() == 0) || "1".equals(o.getConclusionStatus())). List<Long> defectList = operPhenomenonList.stream().filter(defect-> !ObjectUtil.isEmpty(defect.getHandleTaskId())).
map(OperPhenomenonEntity::getId).collect(Collectors.toList()); map(OperPhenomenonEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(defectList)){ if(CollectionUtil.isEmpty(defectList)){
defectVO.setDefect(0); defectVO.setDefect(0);
@ -88,8 +118,7 @@ public class PhenomenonServiceImpl extends BaseServiceImpl<PhenomenonMapper, Ope
} }
// 消缺数 // 消缺数
shortagesVo.setShortagesSum(defects.size()); shortagesVo.setShortagesSum(defects.size());
List<Long> shortagesList = defects.stream().filter(o -> (Func.isNotEmpty(o.getIsDefect()) && o.getIsDefect() == 0) || "1".equals(o.getConclusionStatus())). List<Long> shortagesList = defects.stream().filter(defect-> !ObjectUtil.isEmpty(defect.getHandleTaskId())).map(OperPhenomenonEntity::getId).collect(Collectors.toList());
map(OperPhenomenonEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(shortagesList)){ if(CollectionUtil.isEmpty(shortagesList)){
shortagesVo.setShortages(0); shortagesVo.setShortages(0);
} }

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -80,7 +80,6 @@ public class ShowServiceImpl implements ShowService {
private final OtherService otherService; private final OtherService otherService;
private final AccessService accessService; private final AccessService accessService;
private final TicketService ticketService; private final TicketService ticketService;
private final DefectService defectService;
private final DutyService dutyService; private final DutyService dutyService;
private final StationService stationService; private final StationService stationService;
private final OverDetailsService detailsService; private final OverDetailsService detailsService;
@ -397,7 +396,7 @@ public class ShowServiceImpl implements ShowService {
}); });
// 消缺率 // 消缺率
exe.execute(() -> { exe.execute(() -> {
SolveHomeVO solve = defectService.solve_count(areas,DateUtil.format(DateUtil.toDate(firstDateTime.toLocalDate()),DateUtil.PATTERN_DATETIME),DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); SolveHomeVO solve = phenomenonService.solve_count(areas,DateUtil.format(DateUtil.toDate(firstDateTime.toLocalDate()),DateUtil.PATTERN_DATETIME),DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
if(Math.abs(solve.getSolveCount()) > 0 && Math.abs(solve.getDefectCount()) > 0){ if(Math.abs(solve.getSolveCount()) > 0 && Math.abs(solve.getDefectCount()) > 0){
target.setTaget_three(BigDecimal.valueOf((double)solve.getSolveCount() / solve.getDefectCount() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); target.setTaget_three(BigDecimal.valueOf((double)solve.getSolveCount() / solve.getDefectCount() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}else{ }else{

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java

@ -15,7 +15,6 @@ import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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.springframework.stereotype.Service; import org.springframework.stereotype.Service;

55
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/WorkTicketServiceImpl.java

@ -2,26 +2,19 @@ package com.hnac.hzims.scheduled.service.ticket.impl;
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.toolkit.Wrappers;
import com.hnac.hzims.scheduled.mapper.ticket.WorkTicketMapper; import com.hnac.hzims.scheduled.mapper.ticket.WorkTicketMapper;
import com.hnac.hzims.scheduled.service.ticket.WorkDelayService; import com.hnac.hzims.scheduled.service.ticket.WorkDelayService;
import com.hnac.hzims.scheduled.service.ticket.WorkPrincipalService; import com.hnac.hzims.scheduled.service.ticket.WorkPrincipalService;
import com.hnac.hzims.scheduled.service.ticket.WorkTicketService; import com.hnac.hzims.scheduled.service.ticket.WorkTicketService;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketDelayEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketPrincipalChangeEntity;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -46,32 +39,40 @@ public class WorkTicketServiceImpl extends BaseServiceImpl<WorkTicketMapper, Wor
in(WorkTicketInfoEntity::getCreateDept, areas); in(WorkTicketInfoEntity::getCreateDept, areas);
}}); }});
if (CollectionUtil.isNotEmpty(infoList)) { if (CollectionUtil.isNotEmpty(infoList)) {
List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()); // List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList());
work.setTotal(infoList.size()); work.setTotal(infoList.size());
//工作票作废 //工作票作废
List<WorkTicketInfoEntity> invalidList = infoList.stream().filter(w -> TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(w.getStatus())) List<WorkTicketInfoEntity> invalidList = infoList.stream().filter(item -> "废票".equals(item.getFlowTaskName()))
.collect(Collectors.toList()); .collect(Collectors.toList());
work.setInvalid(CollectionUtil.isNotEmpty(invalidList) ? invalidList.size() : 0); work.setInvalid(CollectionUtil.isNotEmpty(invalidList) ? invalidList.size() : 0);
// 工作票完成 // 工作票结束
List<WorkTicketInfoEntity> completeList = infoList.stream().filter(w -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().equals(w.getStatus())) List<WorkTicketInfoEntity> completeList = infoList.stream().filter(item -> "结束".equals(item.getFlowTaskName()))
.collect(Collectors.toList()); .collect(Collectors.toList());
work.setComplete(CollectionUtil.isNotEmpty(completeList) ? completeList.size() : 0); work.setComplete(CollectionUtil.isNotEmpty(completeList) ? completeList.size() : 0);
int transferTask = 0; // 工作票延期总数数
int delayTask = 0; List<WorkTicketInfoEntity> delayList = infoList.stream().filter(item -> "延期".equals(item.getInput()))
List<WorkTicketPrincipalChangeEntity> moveList = workPrincipalService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>() {{ .collect(Collectors.toList());
in(WorkTicketPrincipalChangeEntity::getTicketId, infoIdList); work.setDelay(CollectionUtil.isNotEmpty(delayList) ? delayList.size() : 0);
}}); // 工作票移交数
if(CollectionUtil.isNotEmpty(moveList)){ List<WorkTicketInfoEntity> changeList = infoList.stream().filter(item -> "转移".equals(item.getInput()))
transferTask = moveList.size(); .collect(Collectors.toList());
} work.setTransfer(CollectionUtil.isNotEmpty(changeList) ? changeList.size() : 0);
List<WorkTicketDelayEntity> delayEntityList = workDelayService.list(Wrappers.<WorkTicketDelayEntity>lambdaQuery() // int transferTask = 0;
.in(WorkTicketDelayEntity::getTicketId, infoIdList) // int delayTask = 0;
); // List<WorkTicketPrincipalChangeEntity> moveList = workPrincipalService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>() {{
if(CollectionUtil.isNotEmpty(delayEntityList)){ // in(WorkTicketPrincipalChangeEntity::getTicketId, infoIdList);
delayTask = delayEntityList.size(); // }});
} // if(CollectionUtil.isNotEmpty(moveList)){
work.setDelay(delayTask); // transferTask = moveList.size();
work.setTransfer(transferTask); // }
// List<WorkTicketDelayEntity> delayEntityList = workDelayService.list(Wrappers.<WorkTicketDelayEntity>lambdaQuery()
// .in(WorkTicketDelayEntity::getTicketId, infoIdList)
// );
// if(CollectionUtil.isNotEmpty(delayEntityList)){
// delayTask = delayEntityList.size();
// }
// work.setDelay(delayTask);
// work.setTransfer(transferTask);
} }
return work; return work;
} }

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ContentMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ContentMapper">
</mapper>

21
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/DutyMainMapper.xml

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.DutyMainMapper">
<resultMap id="BaseResultMap" type="com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="TENANT_ID" property="tenantId" jdbcType="VARCHAR"/>
<result column="DUTY_PERSON_IDS" property="dutyPersonIds" jdbcType="LONGVARCHAR"/>
<result column="DUTY_DATE" property="dutyDate" jdbcType="DATE"/>
<result column="CLASS_ID" property="classId" jdbcType="BIGINT"/>
<result column="DUTY_GROUP_ID" property="dutyGroupId" jdbcType="BIGINT"/>
<result column="CLASS_NAME" property="className" jdbcType="VARCHAR"/>
<result column="STATUS" property="status" jdbcType="TINYINT"/>
<result column="REMARK" property="remark" jdbcType="LONGVARCHAR"/>
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP"/>
<result column="UPDATE_TIME" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="CREATE_USER" property="createUser" jdbcType="BIGINT"/>
<result column="UPDATE_USER" property="updateUser" jdbcType="BIGINT"/>
<result column="IS_DELETED" property="isDeleted" jdbcType="TINYINT"/>
<result column="CREATE_DEPT" property="createDept" jdbcType="BIGINT"/>
</resultMap>
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ObjectMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ObjectUserMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ObjectUserMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanObjectTemplateMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanObjectTemplateMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanOrgMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanOrgMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanPositionMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanPositionMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/PlanUserMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.PlanUserMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectContentMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ProjectContentMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/ProjectMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.ProjectMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskObjectMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectContentMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskObjectProjectContentMapper">
</mapper>

6
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskObjectProjectMapper.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskObjectProjectMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskResultMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskResultMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskUserMapper.xml

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.scheduled.mapper.inspect.TaskUserMapper">
</mapper>

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

Loading…
Cancel
Save