Browse Source

水电生产运行数据 巡检任务

消息统计 feign调用分页查询序列化修改
zhongwei
段飞宇 2 years ago
parent
commit
06ed0753e8
  1. 38
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java
  2. 27
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java
  3. 134
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/CameraInfoEntity.java
  4. 54
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotEntity.java
  5. 30
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotVO.java
  6. 138
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java
  7. 29
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskVo.java
  8. 8
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java
  9. 24
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/dto/TicketInfoEvaluateDto.java
  10. 61
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java
  11. 57
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java
  12. 60
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskVo.java
  13. 49
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java
  14. 45
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketInfoVO.java
  15. 28
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketMeasureVO.java
  16. 49
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java
  17. 72
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java
  18. 66
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java
  19. 104
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java
  20. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java
  21. 23
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
  22. 12
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
  23. 8
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
  24. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/task/SyslogTimerTask.java
  25. 18
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogStatisticsVo.java
  26. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  27. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  28. 13
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java
  29. 96
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
  30. 118
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  31. 60
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java
  32. 129
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java
  33. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceLibraryController.java
  34. 216
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  35. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java
  36. 558
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  37. 11
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java
  38. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
  39. 54
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  40. 285
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java
  41. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java
  42. 1586
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

38
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java

@ -0,0 +1,38 @@
package com.hnac.hzinfo.inspect.areamonthly.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzinfo.inspect.areamonthly.feign.fallback.TaskFeignClientFallback;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import static com.hnac.hzinfo.inspect.Constants.APP_NAME;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 17:21
*/
@FeignClient(value = APP_NAME, fallback = TaskFeignClientFallback.class)
public interface TaskFeignClient {
@GetMapping("/task/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task")
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query);
@RequestMapping(value = "/task/detail", method = {RequestMethod.GET, RequestMethod.POST})
@ApiOperation(value = "查看,下面列表再调用eventController.list", notes = "传入taskid")
public R<TaskEntity> detail(@RequestParam Long id);
}

27
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java

@ -0,0 +1,27 @@
package com.hnac.hzinfo.inspect.areamonthly.feign.fallback;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzinfo.inspect.areamonthly.feign.TaskFeignClient;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 17:23
*/
@Slf4j
@Service
public class TaskFeignClientFallback implements TaskFeignClient {
@Override
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) {
return R.fail("远程调用失败");
}
}

134
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/CameraInfoEntity.java

@ -0,0 +1,134 @@
package com.hnac.hzinfo.inspect.areamonthly.vo;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzinfo.inspect.utils.QueryField;
import com.hnac.hzinfo.inspect.utils.SqlCondition;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 实体类
*
* @author
*/
@Data
@TableName("hz_st_camera_info")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ImsMonCameraInfo对象", description = "视频巡检、机器人巡检摄像头信息")
public class CameraInfoEntity extends TenantEntity {
private static final long serialVersionUID = 187639487673L;
/**
* 摄像头名称
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "摄像头名称")
private String name;
/**
* 摄像头类型
*/
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "摄像头类型")
private String type;
/**
* 摄像头地址
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "摄像头地址")
private String address;
/**
* 配置拍照间隔时间
*/
@ApiModelProperty(value = "配置拍照间隔时间")
private BigDecimal spanTime;
/**
* 像素值(_x_代表使用原始值640x480代表强制缩放到640x480)
*/
@ApiModelProperty(value = "像素值(_x_代表使用原始值,640x480代表强制缩放到640x480)")
private String resolution;
/**
* 摄像头IP
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "摄像头IP")
private String ip;
/**
* 摄像头端口
*/
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "摄像头端口")
private Integer port;
/**
* 摄像头账号
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "摄像头账号")
private String user;
/**
* 摄像头账号密码
*/
@ApiModelProperty(value = "摄像头账号密码")
private String password;
/**
* 告警检测项目字典表值 通过 ^ 隔开字典类型minitor_item
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "告警检测项目(字典表值, 通过 ^ 隔开),字典类型:minitor_item")
private String monitorItems;
/**
* 视频流地址类型
*/
@ApiModelProperty(value = "视频流地址类型, 字典值:vedio_address_type")
private Long addressType;
/**
* 视频流地址
*/
@ApiModelProperty(value = "视频流地址")
private String livesourceaddress;
/**
* 监测点编号
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "监测点编号")
private String pointCode;
/**
* 最后请求时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "最后请求时间")
private Date lastRequesttime;
/**
* 检测点id
*/
@ApiModelProperty(value = "检测点id")
private Long pointId;
/**
* 是否云台控制
*/
@ApiModelProperty(value = "是否云台控制")
private Integer isControl;
/**
* 是否平台接入
*/
@ApiModelProperty(value = "是否平台接入")
private Integer isHikvideo;
}

54
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotEntity.java

@ -0,0 +1,54 @@
package com.hnac.hzinfo.inspect.areamonthly.vo;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hnac.hzinfo.inspect.utils.QueryField;
import com.hnac.hzinfo.inspect.utils.SqlCondition;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 17:29
*/
@Data
@TableName("hz_st_robot")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Robot对象", description = "机器人巡检机器人实体类")
public class RobotEntity extends TenantEntity {
private static final long serialVersionUID = 4503880134032836625L;
/**
* 机器人用户ID
*/
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "机器人用户ID")
private Long userId;
/**
* 机器人带的摄像头ID
*/
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "机器人带的摄像头ID, 多个摄像头通过 , 隔开")
private String cameraId;
/**
* 机器人名称
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "机器人名称")
private String name;
/**
* 描述信息
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "描述信息")
private Long remark;
}

30
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotVO.java

@ -0,0 +1,30 @@
package com.hnac.hzinfo.inspect.areamonthly.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 17:29
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RobotVO", description = "机器人返回信息")
public class RobotVO extends RobotEntity {
private static final long serialVersionUID = 3439398592744684238L;
/**
* 摄像头信息
*/
@ApiModelProperty(value = "摄像头信息")
private List<CameraInfoEntity> cameraInfo;
}

138
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java

@ -0,0 +1,138 @@
package com.hnac.hzinfo.inspect.areamonthly.vo;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 18:02
*/
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
/**
* @author ninglong
* @create 2020-08-26 8:32
*/
@Getter
@Setter
@ApiModel(value="任务列表查询对象")
public class TaskListQuery implements Serializable {
private static final long serialVersionUID = 6980525036205124047L;
/**
* 计划名称
*/
@ApiModelProperty(value = "计划名称")
private String planName;
/**
* 值班id
*/
@ApiModelProperty(value = "值班id")
private Long dutyId;
/**
* 任务批次号
*/
@ApiModelProperty(value = "任务批次号")
private String batchNumber;
@ApiModelProperty("任务状态 0未开始 1进行中 2暂停 3已完成 4未完成")
private Integer status;
/**
* 计划周期 0: 从不 1:每天 2:每月 3:每季度 4:每年 5:每周
*/
@ApiModelProperty(value = "巡检周期 0: 每次 1:每天 2:每月 3:每季度 4:每年 5:每周")
private String cycle;
/**
* 任务计划开始时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "任务计划开始时间-起")
private LocalDateTime planStartTime;
/**
* 任务计划开始时间-
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "任务计划开始时间-止")
private LocalDateTime planStartTimeEnd;
/**
* 任务计划结束时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "任务计划结束时间")
private LocalDateTime planEndTime;
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "任务实际开始时间")
private LocalDateTime startTime;
@ApiModelProperty(value = "租户id",hidden = true)
private String tenantId;
@ApiModelProperty(value = "当前登录的用户",hidden = true)
private Long curUserId;
@ApiModelProperty(value = "当前对象id,用于扫描对象接口")
private Long objectId;
@ApiModelProperty(value = "任务报备 0 未报备 1已报备")
private String keepOnRecord;
/**
* 巡检类型标识 0普通巡检1视频自动巡检2机器人巡检
*/
@ApiModelProperty(value = "巡检类型标识: 0普通巡检,1视频自动巡检,2机器人巡检")
private String autoVideo;
@ApiModelProperty("巡检任务 按逗号分隔")
private String taskIds;
/**
* 月份
*/
private YearMonth yearmonth;
/**
* 区域Id
*/
private String areaId;
}

29
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskVo.java

@ -0,0 +1,29 @@
package com.hnac.hzinfo.inspect.areamonthly.vo;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 17:28
*/
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @Author: dfy
*/
@Data
@ApiModel(value="任务返回对象")
public class TaskVo extends TaskEntity {
/**
* 是否能撤销领用
*/
private Boolean canCancel = false;
/**
* 机器人信息
*/
private RobotVO robot;
}

8
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java

@ -1,7 +1,10 @@
package com.hnac.hzims.message.vo.msgpushrecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.YearMonth;
/**
* @Author WL
* @Version v1.0
@ -17,9 +20,10 @@ public class MessagePushRecordEntityVo {
private String stationCode;
/**
*
*
*/
private Integer month;
@JsonFormat(pattern = "yyyy-MM")
private YearMonth yearMonth;
/**

24
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/dto/TicketInfoEvaluateDto.java

@ -0,0 +1,24 @@
package com.hnac.hzims.ticket.areamonthly.dto;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 13:44
*/
@Data
@EqualsAndHashCode
public class TicketInfoEvaluateDto extends TicketInfoEvaluateEntity implements Serializable {
private static final long serialVersionUID = -4416736590841388580L;
@ApiModelProperty("工作票种类")
private Integer ticketType;
}

61
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java

@ -2,14 +2,22 @@ package com.hnac.hzims.ticket.areamonthly.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
import com.hnac.hzims.ticket.areamonthly.feign.fallback.StandardTicketInfoFeignClient;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.*;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @Author WL
* @Version v1.0
@ -21,12 +29,53 @@ import org.springframework.web.bind.annotation.*;
public interface TicketFeignClient {
/**
* 根据月份区域 获取操作详情数据
* 根据月份区域 获取操作列表数据
*
* @return
*/
@GetMapping("/standard/ticket/areaMonthlyWithOperation/{page}/{size}")
R<IPage<StandardTicketVo>> areaMonthlyWithOperation(@PathVariable("page") Long page,
@PathVariable("size") Long size,
@SpringQueryMap AreaMonthlyVo areaMonthlyV);
R<BladePage<StandardTicketVo>> areaMonthlyWithOperation(@PathVariable("page") Long page,
@PathVariable("size") Long size,
@SpringQueryMap StandardTicketWithAreaVo ticketWithAreaVo);
/**
* 获取操作票详情数据
*/
@GetMapping("/standard/ticket/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情")
R<StandardTicketInfoVO> detail(@RequestParam Long id);
/**
* 查询工作票评论
*
* @param req
* @return
*/
@PostMapping("/allTicket/ticketEvaluate/list")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "查询工作票评论")
R<List<TicketInfoEvaluateVO>> list(@RequestBody TicketInfoEvaluateEntity req);
/**
* 新增
*
* @param req
* @return
*/
@PostMapping("/allTicket/ticketEvaluate/save")
@ApiOperationSupport(order = 20)
@ApiOperation(value = "新增")
public R save(@RequestBody TicketInfoEvaluateDto req);
/**
* 根据月份和区域查询工作票列表详情
*/
@GetMapping("/workTicketInfo/workTicketListByMonthAndArea/{page}/{size}")
R<BladePage<StandardWorkVo>> workTicketListByMonthAndArea(@PathVariable Long page,
@PathVariable Long size,
@SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo);
}

57
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java

@ -1,18 +1,25 @@
package com.hnac.hzims.ticket.areamonthly.feign.fallback;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 17:24
*/
@Slf4j
@Service
public class StandardTicketInfoFeignClient implements TicketFeignClient {
/**
@ -23,8 +30,52 @@ public class StandardTicketInfoFeignClient implements TicketFeignClient {
* @return
*/
@Override
public R<IPage<StandardTicketVo>> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthlyV) {
public R<BladePage<StandardTicketVo>> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthlyV) {
return R.fail("远程调用失败");
}
/**
* 根据月份区域 获取操作票详情数据
*
* @param id
*/
@Override
public R<StandardTicketInfoVO> detail(Long id) {
return R.fail("远程调用失败");
}
/**
* 查询工作票评论
*
* @param req
* @return
*/
@Override
public R<List<TicketInfoEvaluateVO>> list(TicketInfoEvaluateEntity req) {
return R.fail("远程调用失败");
}
/**
* 新增
*
* @param req
* @return
*/
@Override
public R save(TicketInfoEvaluateDto req) {
return R.fail("远程调用失败");
}
/**
* 根据月份和区域查询工作票列表详情
*
* @param page
* @param size
* @param areaMonthlyVo
*/
@Override
public R<BladePage<StandardWorkVo>> workTicketListByMonthAndArea(Long page, Long size, StandardTicketWithAreaVo areaMonthlyVo) {
return R.fail("远程调用失败");
}
}

60
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskVo.java

@ -0,0 +1,60 @@
package com.hnac.hzims.ticket.areamonthly.vo;
import lombok.Data;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 11:06
*/
@Data
public class MaintenanceTaskVo {
/**
* 编号
*/
private Long id;
/**
* 项目名称
*/
private String title;
/**
* 维护内容
*/
private String content;
/**
* 执行人
*/
private String disposerName;
/**
* 类型
*/
private String typeCode;
/**
* 类型名称
*/
private String typeCodeValue;
/**
* 执行状态
*/
private Integer status;
/**
* 执行状态名称
*/
private String statusValue;
/**
* 任务类型
*/
private String taskType;
}

49
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java

@ -0,0 +1,49 @@
package com.hnac.hzims.ticket.areamonthly.vo;
import lombok.Data;
import java.time.YearMonth;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 12:00
*/
@Data
public class MaintenanceTaskWithAreaVo {
/**
* 区域编号
*/
private String areaId;
/**
* 月份
*/
private java.time.YearMonth YearMonth;
/**
* 项目名称
*/
private String title;
/**
* 维护内容
*/
private String content;
/**
* 执行状态
*/
private Integer status;
/**
* 任务类型
*/
private String taskType;
}

45
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketInfoVO.java

@ -0,0 +1,45 @@
package com.hnac.hzims.ticket.areamonthly.vo;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 13:31
*/
@EqualsAndHashCode
@Data
public class StandardTicketInfoVO extends StandardTicketInfoEntity implements Serializable {
private static final long serialVersionUID = -8870464581684939369L;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("更新人名称")
private String updateUserName;
@ApiModelProperty("来源类型名称")
private String taskTypeName;
@ApiModelProperty("发令人名称")
private String issueOrderPersonName;
@ApiModelProperty("受令人名称")
private String accessOrderPersonName;
@ApiModelProperty("负责人名称")
private String principalName;
@ApiModelProperty("许可人名称")
private String guardianName;
@ApiModelProperty("安全措施完成明细")
private List<StandardTicketMeasureVO> standardTicketMeasureVOList;
}

28
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketMeasureVO.java

@ -0,0 +1,28 @@
package com.hnac.hzims.ticket.areamonthly.vo;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketMeasureEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 13:31
*/
@Data
@EqualsAndHashCode
public class StandardTicketMeasureVO extends StandardTicketMeasureEntity implements Serializable {
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("更新人名称")
private String updateUserName;
@ApiModelProperty("执行人名称")
private String executorName;
}

49
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java

@ -1,4 +1,4 @@
package com.hnac.hzims.ticket.areamonthly;
package com.hnac.hzims.ticket.areamonthly.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -24,6 +24,12 @@ public class StandardTicketVo implements Serializable {
/**
* 编号
*/
private Long id;
/**
* 开票种类
*/
private String ticketType;
@ -40,6 +46,12 @@ public class StandardTicketVo implements Serializable {
* 开票来源
*/
private String taskType;
/**
* 开票来源名称
*/
private String taskTypeName;
/**
* 开票任务来源
*/
@ -51,21 +63,54 @@ public class StandardTicketVo implements Serializable {
private Long issueOrderPerson;
/**
* 发令人名称
*/
private String issueOrderPersonName;
/**
* 受令人
*/
private Long accessOrderPerson;
/**
* 受令人名称
*/
private String accessOrderPersonName;
/**
* 监护人
*/
private String guardian;
private Long guardian;
/**
* 监护人名称
*/
private String guardianName;
/**
* 值班负责人
*/
private Long principal;
/**
* 值班负责人
*/
private String principalName;
/**
* 开票时间
*/
private Date createTime;
/**
* 状态
*/
private Integer status;
/**
* 是否评价
*/
private Integer isEvaluate;
}

72
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java

@ -0,0 +1,72 @@
package com.hnac.hzims.ticket.areamonthly.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.time.YearMonth;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/11 12:55
*/
@Data
public class StandardTicketWithAreaVo {
/**
* 区域编号
*/
private String areaId;
/**
* 月份
*/
private YearMonth YearMonth;
/**
* 开票种类
*/
private String ticketType;
/**
* 编号
*/
private String code;
/**
* 开票来源
*/
private String taskType;
/**
* 状态
*/
private Integer status;
/**
* 开始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("开始时间")
private LocalDateTime startTime;
/**
* 结束时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("结束时间")
private LocalDateTime endTime;
}

66
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java

@ -0,0 +1,66 @@
package com.hnac.hzims.ticket.areamonthly.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 17:06
*/
@EqualsAndHashCode
@Data
public class StandardWorkVo implements Serializable {
private static final long serialVersionUID = -8870464581684939369L;
/**
* 编号
*/
private Long id;
/**
* 开票种类
*/
private String type;
/**
* 单位
*/
private String company;
/**
* 编号
*/
private String code;
/**
* 开票来源
*/
private String taskType;
/**
* 开票任务来源
*/
private String taskName;
/**
* 开票时间
*/
private Date createTime;
/**
* 状态
*/
private Integer status;
/**
* 是否评价
*/
private Integer isEvaluate;
}

104
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java

@ -1,104 +0,0 @@
// package com.hnac.hzims.middle.mybatisplus;
//
// import com.baomidou.mybatisplus.generator.AutoGenerator;
// import com.baomidou.mybatisplus.generator.InjectionConfig;
// import com.baomidou.mybatisplus.generator.config.*;
// import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
//
// import java.util.ArrayList;
// import java.util.List;
//
// /**
// * @Author WL
// * @Version v1.0
// * @Serial 1.0
// * @Date 2023/4/4 9:07
// */
// public class CodeGenerator {
//
//
// public static void main(String[] args) {
// // 代码生成器
// AutoGenerator mpg = new AutoGenerator();
//
// // 全局配置
// GlobalConfig gc = new GlobalConfig();
// String projectPath = System.getProperty("user.dir") + "/hzims-service/hzims-middle";
// gc.setOutputDir(projectPath + "/src/main/java");
// gc.setAuthor("dfy");
// gc.setOpen(false);
// // gc.setSwagger2(true); 实体属性 Swagger2 注解
// mpg.setGlobalConfig(gc);
//
// // 数据源配置
// DataSourceConfig dsc = new DataSourceConfig();
// dsc.setUrl("jdbc:mysql://192.168.1.20:3576/dev_hzims_middle?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true");
// // dsc.setSchemaName("public");
// dsc.setDriverName("com.mysql.cj.jdbc.Driver");
// dsc.setUsername("root");
// dsc.setPassword("123");
// mpg.setDataSource(dsc);
//
// // 包配置
// PackageConfig pc = new PackageConfig();
// pc.setModuleName("systemlog");
// pc.setParent("com.hnac.hzims.middle");
// mpg.setPackageInfo(pc);
//
// // 自定义配置
// InjectionConfig cfg = new InjectionConfig() {
// @Override
// public void initMap() {
// // to do nothing
// }
// };
//
// // 如果模板引擎是 freemarker
// String templatePath = "/templates/mapper.xml.ftl";
// // 如果模板引擎是 velocity
// // String templatePath = "/templates/mapper.xml.vm";
//
// // 自定义输出配置
// List<FileOutConfig> focList = new ArrayList<>();
// cfg.setFileOutConfigList(focList);
// mpg.setCfg(cfg);
//
// // 配置模板
// TemplateConfig templateConfig = new TemplateConfig();
//
// // 配置自定义输出模板
// //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// // templateConfig.setEntity("templates/entity2.java");
// // templateConfig.setService();
// // templateConfig.setController();
//
// // templateConfig.setXml(null);
// mpg.setTemplate(templateConfig);
//
// // 策略配置
// StrategyConfig strategy = new StrategyConfig();
// strategy.setNaming(NamingStrategy.underline_to_camel);
// strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// // strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
// strategy.setEntityLombokModel(true);
// strategy.setRestControllerStyle(true);
// strategy.setEntityBooleanColumnRemoveIsPrefix(true);
// strategy.setEntityLombokModel(true);
// strategy.setEntitySerialVersionUID(true);
// strategy.setChainModel(true);
// strategy.setEntityTableFieldAnnotationEnable(true);
// // strategy.setFieldPrefix("hzims_");
// // 公共父类
// // strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// // 写于父类中的公共字段
// // strategy.setSuperEntityColumns("id");
// strategy.setInclude("hzims_statistics");
// strategy.setControllerMappingHyphenStyle(true);
// strategy.setTablePrefix("hzims_");
// mpg.setStrategy(strategy);
// // mpg.setTemplateEngine(new FreemarkerTemplateEngine());
// mpg.execute();
// }
//
// }
//

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java

@ -27,8 +27,8 @@ public class SysLogConfig {
//2.创建一个SyslogTimerTask实例
SyslogTimerTask myTimeTask = new SyslogTimerTask(statisticsService);
//3.通过timer定时定频率调用SyslogTimerTask的业务逻辑
// 即 第一次执行是在当前时间的两秒之后,之后每隔3秒钟执行一次
timer.schedule(myTimeTask,2000L,10000L);
// 即 第一次执行是在当前时间的两秒之后,之后每隔60分钟执行一次
timer.schedule(myTimeTask,2000L,60000L);
}
}

23
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java

@ -38,18 +38,41 @@ public class Statistics implements Serializable {
@TableField("date_calculated")
private String dateCalculated;
/**
* 操作模块
*/
@TableField("title")
private String title;
/**
* 操作模块统计
*/
@TableField("title_num")
private Integer titleNum;
/**
* 功能模块统计
*/
@TableField("module_name")
private String moduleName;
/**
* 功能模块统计
*/
@TableField("module_name_num")
private Integer moduleNameNum;
/**
* 请求路径统计
*/
@TableField("path")
private String path;
/**
* 请求路径统计
*/

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

@ -4,10 +4,14 @@
<select id="countStatistics" resultType="com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo">
select date_format(operation_time, '%Y-%m-%d') operationTime,
count(title) titleCount,
count(module_name) moduleNameCount,
count(path) pathCount
title,
count(title) titleCount,
module_name,
count(module_name) moduleNameCount,
path,
count(path) pathCount
from hzims_sys_log
group by operationTime;
where to_days(operation_time) = to_days(now())
group by operationTime,title,module_name,path;
</select>
</mapper>

8
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java

@ -7,6 +7,7 @@ import com.hnac.hzims.middle.systemlog.service.StatisticsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.middle.systemlog.service.SysLogService;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,6 +22,7 @@ import java.util.List;
* @author dfy
* @since 2023-04-08
*/
@Slf4j
@Service
public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statistics> implements StatisticsService {
@ -34,16 +36,16 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
/**
* 保存统计的数据
*/
@Override
public void saveCountStatistics() {
//1. 查询统计的数据
List<SysLogStatisticsVo> sysLogStatisticsVoList = sysLogService.countStatistics();
System.out.println(sysLogStatisticsVoList);
log.info("查询统计的数据: {}", sysLogStatisticsVoList);
//2. 保存数据
if (sysLogStatisticsVoList == null) {
return;
}
for (SysLogStatisticsVo sysLogStatisticsVo : sysLogStatisticsVoList) {
//查询数据
Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo.getOperationTime());
@ -55,7 +57,7 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
statistics.setPathNum(sysLogStatisticsVo.getPathCount());
statisticsService.save(statistics);
}else {
} else {
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
statistics.setPathNum(sysLogStatisticsVo.getPathCount());

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/task/SyslogTimerTask.java

@ -3,6 +3,7 @@ package com.hnac.hzims.middle.systemlog.task;
import com.hnac.hzims.middle.systemlog.service.StatisticsService;
import com.hnac.hzims.middle.systemlog.service.SysLogService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -14,6 +15,7 @@ import java.util.TimerTask;
* @Serial 1.0
* @Date 2023/4/8 14:13
*/
@Slf4j
@AllArgsConstructor
public class SyslogTimerTask extends TimerTask {
@ -26,7 +28,7 @@ public class SyslogTimerTask extends TimerTask {
@Override
public void run() {
//保存统计的数据
System.out.println("保存统计的数据");
log.info("保存统计的数据");
statisticsService.saveCountStatistics();
}
}

18
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogStatisticsVo.java

@ -18,17 +18,33 @@ public class SysLogStatisticsVo {
*/
private String operationTime;
/**
* 操作模块统计
*/
private Integer titleCount;
private String title;
/**
* 操作模块统计
*/
private Integer titleCount;
/**
* 操作类型统计
*/
private String moduleName;
/**
* 操作类型统计
*/
private Integer moduleNameCount;
/**
* 根据路径统计
*/
private Integer path;
/**
* 根据路径统计
*/

10
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java

@ -102,8 +102,8 @@ public class TaskController extends BladeController {
*/
@GetMapping("/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task")
public R<IPage<TaskVo>> list(TaskListQuery task, Query query) {
CacheUtil.put("test#2","inspect","test","12");
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) {
//CacheUtil.put("test#2","inspect","test","12");
// LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task);
// queryWrapper.orderByDesc(TaskEntity::getUpdateTime);
// IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper);
@ -112,9 +112,13 @@ public class TaskController extends BladeController {
task.setCurUserId(AuthUtil.getUserId());
task.setTenantId(AuthUtil.getTenantId());
}
if (task.getCurUserId().longValue() == -1) {
task.setCurUserId(null);
}
List<TaskVo> list = taskService.getListPage(pages,task);
pages.setRecords(list);
return R.data(pages);
BladePage<TaskVo> bladePage = BladePage.of(pages);
return R.data(bladePage);
}
@GetMapping("/mainQueryPage")

6
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -162,6 +162,12 @@
<if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID,#{task.taskIds})
</if>
<if test="task.areaId != null and task.areaId != ''">
and t.CREATE_DEPT = #{task.areaId})
</if>
<if test="task.yearmonth != null and task.yearmonth != ''">
and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearmonth})
</if>
order by t.UPDATE_TIME desc
</select>

13
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java

@ -10,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
/**
* @author ninglong
@ -114,4 +115,16 @@ public class TaskListQuery implements Serializable {
@ApiModelProperty("巡检任务 按逗号分隔")
private String taskIds;
/**
* 月份
*/
private YearMonth yearmonth;
/**
* 区域Id
*/
private String areaId;
}

96
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml

@ -22,12 +22,13 @@
date_format(PLAN_TIME, '%Y-%m') strMonth,
type
from hzims_message_push_record
where IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<where>
IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
</where>
group by strMonth, TYPE
</select>
@ -36,19 +37,21 @@
select BUSINESS_CLASSIFY businessClassify,
count(1) power
from hzims_message_push_record
where IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.month != null and vo.month != ''">
and
date_format(PLAN_TIME, '%m') = #{vo.month}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
<where>
IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.yearMonth != null">
and
date_format(PLAN_TIME, '%Y-%m') = #{vo.yearMonth}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
</where>
group by businessClassify
</select>
@ -58,19 +61,21 @@
BUSINESS_CLASSIFY businessClassify,
count(1) count
from hzims_message_push_record
where IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.month != null and vo.month != ''">
and
date_format(PLAN_TIME, '%m') = #{vo.month}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
<where>
IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.yearMonth != null">
and
date_format(PLAN_TIME, '%Y-%m') = #{vo.yearMonth}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
</where>
group by businessClassify, pusherName
</select>
@ -90,18 +95,21 @@
<select id="pushStat" resultMap="PushStatResultMap">
select BUSINESS_CLASSIFY businessClassify,STATUS status,count(1) count
from hzims_message_push_record
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.month != null and vo.month != ''">
and
date_format(PLAN_TIME, '%m') = #{vo.month}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
<where>
IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
</if>
<if test="vo.yearMonth != null">
and
date_format(PLAN_TIME, '%Y-%m') = #{vo.yearMonth}
</if>
<if test="vo.type != null and vo.type != ''">
and
type = #{vo.type}
</if>
</where>
group by businessClassify,status
</select>
</mapper>

118
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java

@ -1,16 +1,28 @@
package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
import com.hnac.hzims.ticket.areamonthly.vo.*;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 水电生成报告详情数据
@ -29,24 +41,106 @@ public class AreaMonthlyDetailsController {
private final AreaMonthlyDetailsService areaMonthlyDetailsService;
private final IOperMaintenanceTaskService taskService;
/**
* 操作票 根据月份区域 获取操作详情数据
* 操作票 根据月份区域 获取操作详情数据
*
* @return
*/
@GetMapping("/areaMonthlyWithOperation/{page}/{size}")
public R areaMonthlyWithOperation(@PathVariable("page") Long page,
@PathVariable("size") Long size,
AreaMonthlyVo areaMonthly) {
IPage<StandardTicketVo> standardTicketInfoVoIPage =
areaMonthlyDetailsService.areaMonthlyWithOperation(page,size, areaMonthly);
public R areaMonthlyWithOperation(@PathVariable("page") Long page, @PathVariable("size") Long size, StandardTicketWithAreaVo areaMonthly) {
BladePage<StandardTicketVo> standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperation(page, size, areaMonthly);
return R.data(standardTicketInfoVoIPage);
}
/**
* 操作票 根据月份区域 获取操作详情数据
*
* @return
*/
@GetMapping("/areaMonthlyWithOperation/detail/{id}")
public R areaMonthlyWithOperationDetail(@PathVariable("id") Long id) {
StandardTicketInfoVO standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperationDetail(id);
return R.data(standardTicketInfoVoIPage);
}
/**
* 查询工作票评论
*/
@GetMapping("/areaMonthlyWithOperation/workTicketCommentList")
public R<List<TicketInfoEvaluateVO>> workTicketCommentList(TicketInfoEvaluateEntity req) {
List<TicketInfoEvaluateVO> ticketInfoEvaluateVOS = areaMonthlyDetailsService.workTicketCommentList(req);
return R.data(ticketInfoEvaluateVOS);
}
/**
* 保存评论信息
*/
@PostMapping("/saveComment")
public R saveComment(@RequestBody TicketInfoEvaluateDto req) {
return R.data(areaMonthlyDetailsService.saveComment(req));
}
/**
* 根据月份和区域查询工作票列表详情
*/
@GetMapping("/workTicketListByMonthAndArea/{page}/{size}")
R<BladePage<StandardWorkVo>> workTicketListByMonthAndArea(@PathVariable Long page, @PathVariable Long size, @SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) {
BladePage<StandardWorkVo> standardWorkVoIPage = areaMonthlyDetailsService.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
return R.data(standardWorkVoIPage);
}
/**
* 根据区域和月份分页查询日志维护列表
*/
@ApiOperationSupport(order = 100)
@ApiOperation(value = "日志维护列表分页查询")
@GetMapping("/queryLogMaintenancePageList/{page}/{size}")
public R<IPage<MaintenanceTaskVo>> queryLogMaintenancePageList(@PathVariable Long page, @PathVariable Long size, MaintenanceTaskWithAreaVo maintenanceTaskVo) {
Page<OperMaintenanceTaskEntity> pageParam = new Page<>(page, size);
IPage<MaintenanceTaskVo> taskList = taskService.queryLogMaintenancePageList(pageParam, maintenanceTaskVo);
return R.data(taskList);
}
/**
* 根据区域和月份分页查询日志维护 根据id获取详情
*/
@GetMapping("/queryLogMaintenancePageList/detail/{id}")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情")
public R<OperMaintenanceTaskEntity> detail(@PathVariable Long id) {
return taskService.detail(id);
}
/**
* 根据区域和月份分页查询巡检任务
*/
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页查询")
@GetMapping("/queryCheckTaskPageList")
public R<BladePage<TaskVo>> queryCheckTaskPageList(TaskListQuery task, Query query) {
BladePage<TaskVo> taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, query);
return R.data(taskVoIPage);
}
/**
* 根据id查询巡检任务
*/
@GetMapping("/queryCheckTaskById/{id}")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "详情")
public R<TaskEntity> queryCheckTaskById(@PathVariable Long id) {
TaskEntity task = areaMonthlyDetailsService.queryCheckTaskById(id);
return R.data(task);
}
}

60
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java

@ -1,8 +1,17 @@
package com.hnac.hzims.operational.main.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
import com.hnac.hzims.ticket.areamonthly.vo.*;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import java.util.List;
/**
*
@ -20,5 +29,50 @@ public interface AreaMonthlyDetailsService {
* @param areaMonthly
* @return
*/
IPage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthly);
BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly);
/**
* 根据月份和区域查询工作票列表详情
* @param page
* @param size
* @param areaMonthlyVo
* @return
*/
BladePage<StandardWorkVo> workTicketListByMonthAndArea(Long page, Long size, StandardTicketWithAreaVo areaMonthlyVo);
/**
* 操作票 根据月份区域 获取操作详情数据
* @param id
* @return
*/
StandardTicketInfoVO areaMonthlyWithOperationDetail(Long id);
/**
* 查询工作票评论
* @param req
*/
List<TicketInfoEvaluateVO> workTicketCommentList(TicketInfoEvaluateEntity req);
/**
* 保存评论信息
* @param req
* @return
*/
Boolean saveComment(TicketInfoEvaluateDto req);
/**
* 根据区域和月份分页查询巡检任务
* @param task
* @param query
* @return
*/
BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Query query);
/**
* 根据id查询巡检任务
* @param id
* @return
*/
TaskEntity queryCheckTaskById(Long id);
}

129
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java

@ -1,15 +1,25 @@
package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.*;
import com.hnac.hzinfo.inspect.areamonthly.feign.TaskFeignClient;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 水电生产运行数据
*
@ -26,6 +36,9 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
private final TicketFeignClient ticketFeignClient;
private final TaskFeignClient taskFeignClient;
/**
* 根据月份区域 获取操作详情数据
*
@ -35,14 +48,118 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
* @return
*/
@Override
public IPage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthly) {
R<IPage<StandardTicketVo>> pageR =
ticketFeignClient.areaMonthlyWithOperation(page, size,areaMonthly);
public BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) {
R<BladePage<StandardTicketVo>> pageR =
ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly);
if (pageR.isSuccess()) {
log.info("获取操作详情数据成功");
return pageR.getData();
}
log.error(pageR.getMsg());
return null;
}
/**
* 根据月份和区域查询工作票列表详情
*
* @param page
* @param size
* @param areaMonthlyVo
* @return
*/
@Override
public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Long page, Long size,StandardTicketWithAreaVo areaMonthlyVo) {
R<BladePage<StandardWorkVo>> pageR =
ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
if (pageR.isSuccess()) {
log.info("获取操作详情数据成功");
return pageR.getData();
}
System.out.println(pageR.getMsg());
log.error("获取操作详情数据失败", pageR.getMsg());
return null;
}
/**
* 操作票 根据月份区域 获取操作详情数据
*
* @param id
* @return
*/
@Override
public StandardTicketInfoVO areaMonthlyWithOperationDetail(Long id) {
R<StandardTicketInfoVO> detail = ticketFeignClient.detail(id);
if (detail.isSuccess()) {
log.info("获取操作详情数据成功");
return detail.getData();
}
log.error("获取操作详情数据失败", detail.getMsg());
return null;
}
/**
* 查询工作票评论
*
* @param req
*/
@Override
public List<TicketInfoEvaluateVO> workTicketCommentList(TicketInfoEvaluateEntity req) {
R<List<TicketInfoEvaluateVO>> list = ticketFeignClient.list(req);
if (list.isSuccess()) {
log.info("获取查询工作票评论");
return list.getData();
}
log.error("获取查询工作票评论失败", list.getMsg());
return null;
}
/**
* 保存评论信息
*
* @param req
* @return
*/
@Override
public Boolean saveComment(TicketInfoEvaluateDto req) {
R save = ticketFeignClient.save(req);
if (save.isSuccess()) {
log.info("保存评论信息");
return true;
}
log.error("保存评论信息失败", save.getMsg());
return false;
}
/**
* 根据区域和月份分页查询巡检任务
*
* @param task
* @param query
* @return
*/
@Override
public BladePage<TaskVo> queryCheckTaskPageList(TaskListQuery task, Query query) {
R<BladePage<TaskVo>> list = taskFeignClient.list(task, query);
if (list.isSuccess()) {
log.info("获取巡检检查任务列表成功");
return list.getData();
}
log.error("获取检查巡检任务列表失败", list.getMsg());
return null;
}
/**
* 根据id查询巡检任务
* @param id
* @return
*/
@Override
public TaskEntity queryCheckTaskById(Long id) {
R<TaskEntity> detail = taskFeignClient.detail(id);
if (detail.isSuccess()) {
log.info("获取巡检检查任务详情成功");
return detail.getData();
}
log.error("获取检查巡检任务详情失败", detail.getMsg());
return null;
}
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceLibraryController.java

@ -87,7 +87,8 @@ public class OperMaintenanceLibraryController extends BladeController {
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 50)
@OperationAnnotation(title = "设备维护库",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
@OperationAnnotation(moduleName = "设备管理",title = "设备维护库",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE,
action = "分页 查询参数:libraryCode,emCode,typeCode,procDefId,disposers(仅支持一人)")
@ApiOperation(value = "分页 查询参数:libraryCode,emCode,typeCode,procDefId,disposers(仅支持一人)")
public R<IPage<OperMaintenanceLibraryVO>> list(OperMaintenanceLibraryDTO req, Query query) {

216
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.maintenance.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.invalid.DictInvalid;
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid;
@ -16,6 +17,8 @@ import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTas
import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskPushMsg;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -27,8 +30,11 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.SortDefault;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.Arrays;
@ -50,107 +56,111 @@ import java.util.stream.Collectors;
@Validated
public class OperMaintenanceTaskController extends BladeController {
private final IOperMaintenanceTaskService taskService;
private final MaintenanceTaskCreateTask maintenanceTaskCreateTask;
private final MaintenanceTaskPushMsg maintenanceTaskPushMsg;
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "逻辑删除")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(taskService.deleteLogic(Func.toLongList(ids)));
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 20)
@ApiOperation(value = "新增")
public R save(@Valid @RequestBody OperMaintenanceTaskDTO req) {
return taskService.doSave(req);
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 30)
@ApiOperation(value = "修改")
public R update(@Valid @RequestBody OperMaintenanceTaskDTO req) {
return R.status(taskService.updateById(req));
}
/**
* 详情
*/
@ApiLog
@GetMapping("/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情")
public R<OperMaintenanceTaskEntity> detail(@RequestParam Long id) {
return taskService.detail(id);
}
/**
* 分页
*/
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status")
@ApiImplicitParams({
})
@OperationAnnotation(moduleName ="日常维护" ,title = "日常维护记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status")
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
return taskService.list(req, query);
}
@GetMapping("/testCreateTask")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "测试定时生成日常维护任务")
public R testCreateTask(@RequestParam("date") String date) throws Exception {
maintenanceTaskCreateTask.execute(date);
return R.success("推送成功!");
}
@GetMapping("/testPushMsg")
@ApiOperationSupport(order = 70)
@ApiOperation(value = "测试消息推送")
public R testPushMsg(@RequestParam("date") String date) throws Exception {
//maintenanceTaskPushMsg.execute(date);
maintenanceTaskPushMsg.maintenancePushMsg("1380746947515691009","200000",200000000000101L,1380746947515691009L);
return R.success("推送成功!");
}
@PostMapping("/completeTask")
@ApiOperationSupport(order = 80)
@ApiOperation(value = "完成日常维护工作流任务")
public R completeTask(@RequestBody
@ObjectRequiredInvalid(attributes = {"req.id","req.status","completeTask.taskId","completeTask.processInstanceId","completeTask.flag","completeTask.comment"})
@DictInvalid(attribute = "req.status",dictKey = "MaintenanceTaskStatus") Map<String,Object> requestMap){
if(CollectionUtil.isEmpty(requestMap) || ObjectUtil.isEmpty(requestMap.get("req")) || ObjectUtil.isEmpty(requestMap.get("completeTask"))){
return R.fail("传入参数有误");
}
OperMaintenanceTaskDTO req = JSON.parseObject(JSON.toJSONString(requestMap.get("req")), OperMaintenanceTaskDTO.class);
ComleteTask completeTask = JSON.parseObject(JSON.toJSONString(requestMap.get("completeTask")), ComleteTask.class);
return taskService.completeTask(req,completeTask);
}
@ApiLog
@PostMapping("/deleteTaskBatch")
@ApiOperationSupport(order = 90)
@ApiOperation(value = "删除日常维护工作流任务")
public R deleteTaskBatch(@RequestBody String body){
String ids = JSONObject.parseObject(body).getString("ids");
List<Long> taskIdList = Arrays.asList(ids.split(",")).stream().map(taskId->{
log.info(taskId);
return Long.parseLong(taskId);
}).collect(Collectors.toList());
return taskService.deleteTaskBatch(taskIdList);
}
private final IOperMaintenanceTaskService taskService;
private final MaintenanceTaskCreateTask maintenanceTaskCreateTask;
private final MaintenanceTaskPushMsg maintenanceTaskPushMsg;
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "逻辑删除")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(taskService.deleteLogic(Func.toLongList(ids)));
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 20)
@ApiOperation(value = "新增")
public R save(@Valid @RequestBody OperMaintenanceTaskDTO req) {
return taskService.doSave(req);
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 30)
@ApiOperation(value = "修改")
public R update(@Valid @RequestBody OperMaintenanceTaskDTO req) {
return R.status(taskService.updateById(req));
}
/**
* 详情
*/
@ApiLog
@GetMapping("/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情")
public R<OperMaintenanceTaskEntity> detail(@RequestParam Long id) {
return taskService.detail(id);
}
/**
* 分页
*/
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status")
@ApiImplicitParams({
})
@OperationAnnotation(moduleName = "日常维护", title = "日常维护记录", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status")
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
return taskService.list(req, query);
}
@GetMapping("/testCreateTask")
@ApiOperationSupport(order = 60)
@ApiOperation(value = "测试定时生成日常维护任务")
public R testCreateTask(@RequestParam("date") String date) throws Exception {
maintenanceTaskCreateTask.execute(date);
return R.success("推送成功!");
}
@GetMapping("/testPushMsg")
@ApiOperationSupport(order = 70)
@ApiOperation(value = "测试消息推送")
public R testPushMsg(@RequestParam("date") String date) throws Exception {
//maintenanceTaskPushMsg.execute(date);
maintenanceTaskPushMsg.maintenancePushMsg("1380746947515691009", "200000", 200000000000101L, 1380746947515691009L);
return R.success("推送成功!");
}
@PostMapping("/completeTask")
@ApiOperationSupport(order = 80)
@ApiOperation(value = "完成日常维护工作流任务")
public R completeTask(@RequestBody
@ObjectRequiredInvalid(attributes = {"req.id", "req.status", "completeTask.taskId", "completeTask.processInstanceId", "completeTask.flag", "completeTask.comment"})
@DictInvalid(attribute = "req.status", dictKey = "MaintenanceTaskStatus") Map<String, Object> requestMap) {
if (CollectionUtil.isEmpty(requestMap) || ObjectUtil.isEmpty(requestMap.get("req")) || ObjectUtil.isEmpty(requestMap.get("completeTask"))) {
return R.fail("传入参数有误");
}
OperMaintenanceTaskDTO req = JSON.parseObject(JSON.toJSONString(requestMap.get("req")), OperMaintenanceTaskDTO.class);
ComleteTask completeTask = JSON.parseObject(JSON.toJSONString(requestMap.get("completeTask")), ComleteTask.class);
return taskService.completeTask(req, completeTask);
}
@ApiLog
@PostMapping("/deleteTaskBatch")
@ApiOperationSupport(order = 90)
@ApiOperation(value = "删除日常维护工作流任务")
public R deleteTaskBatch(@RequestBody String body) {
String ids = JSONObject.parseObject(body).getString("ids");
List<Long> taskIdList = Arrays.asList(ids.split(",")).stream().map(taskId -> {
log.info(taskId);
return Long.parseLong(taskId);
}).collect(Collectors.toList());
return taskService.deleteTaskBatch(taskIdList);
}
}

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java

@ -1,12 +1,18 @@
package com.hnac.hzims.operational.maintenance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -83,4 +89,15 @@ public interface IOperMaintenanceTaskService extends BaseService<OperMaintenance
*/
SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate,String endDate,Long dept);
/**
* 根据区域和月份分页查询日志维护列表
* @param pageParam
* @param areaMonthlyVo
* @return
*/
IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo);
}

558
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -2,8 +2,10 @@ package com.hnac.hzims.operational.maintenance.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
@ -22,6 +24,9 @@ import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.operational.maintenance.wrapper.OperMaintenanceTaskWrapper;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.feign.IDangerSourceClient;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -41,6 +46,7 @@ import org.springblade.system.cache.DictCache;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -62,267 +68,323 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
@Slf4j
public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintenanceTaskMapper, OperMaintenanceTaskEntity> implements IOperMaintenanceTaskService {
private final IDangerSourceClient dangerSourceClient;
private final OperMaintenanceTaskMapper operMaintenanceTaskMapper;
private final OperPhenomenonMapper operPhenomenonMapper;
private final IFlowClient flowClient;
private final IUserClient userClient;
private final IDangerSourceClient dangerSourceClient;
private final OperMaintenanceTaskMapper operMaintenanceTaskMapper;
private final OperPhenomenonMapper operPhenomenonMapper;
private final IFlowClient flowClient;
private final IUserClient userClient;
@Override
public R doSave(OperMaintenanceTaskDTO req) {
req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999)));
//保存时推送消息
return R.status(super.save(req));
}
@Override
public R doSave(OperMaintenanceTaskDTO req) {
req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999)));
//保存时推送消息
return R.status(super.save(req));
}
@Override
public R<OperMaintenanceTaskEntity> detail(Long id) {
OperMaintenanceTaskVO detail = OperMaintenanceTaskWrapper.build().entityVO(super.getById(id));
detail.setDangerSources(dangerSourceClient.details(detail.getSafo().split(",")));
return R.data(detail);
}
@Override
public R<OperMaintenanceTaskEntity> detail(Long id) {
OperMaintenanceTaskVO detail = OperMaintenanceTaskWrapper.build().entityVO(super.getById(id));
detail.setDangerSources(dangerSourceClient.details(detail.getSafo().split(",")));
return R.data(detail);
}
@Override
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
orderByDesc(OperMaintenanceTaskEntity::getDisposeTime);
if(StringUtil.isNotBlank(req.getTaskIds())){
in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(",")));
}
if (req.getRefLibraryId() != null) {
eq(OperMaintenanceTaskEntity::getRefLibraryId, req.getRefLibraryId());
}
if (StringUtils.isNotBlank(req.getProcessInstanceId())) {
eq(OperMaintenanceTaskEntity::getProcessInstanceId, req.getProcessInstanceId());
}
if (req.getDisposer() != null) {
like(OperMaintenanceTaskEntity::getDisposer, req.getDisposer());
}
if (StringUtils.isNotBlank(req.getContent())) {
like(OperMaintenanceTaskEntity::getContent, req.getContent());
}
if (req.getStatus() != null) {
eq(OperMaintenanceTaskEntity::getStatus, req.getStatus());
}
if (req.getTitle() != null) {
like(OperMaintenanceTaskEntity::getTitle, req.getTitle());
}
if (req.getTaskType() != null) {
eq(OperMaintenanceTaskEntity::getTaskType, req.getTaskType());
}
if (req.getExcludeNullTicket() != null && req.getExcludeNullTicket() == 1) {
isNull(OperMaintenanceTaskEntity::getTicketId);
}
if (!StringUtil.isEmpty(req.getStartTime())) {
gt(OperMaintenanceTaskEntity::getDisposeTime,req.getStartTime());
}
if (!StringUtil.isEmpty(req.getEndTime())) {
lt(OperMaintenanceTaskEntity::getDisposeTime,req.getEndTime());
}
if(!CollectionUtils.isEmpty(req.getDeptIds())){
in(OperMaintenanceTaskEntity::getCreateDept,req.getDeptIds());
}
}};
@Override
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
orderByDesc(OperMaintenanceTaskEntity::getDisposeTime);
if (StringUtil.isNotBlank(req.getTaskIds())) {
in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(",")));
}
if (req.getRefLibraryId() != null) {
eq(OperMaintenanceTaskEntity::getRefLibraryId, req.getRefLibraryId());
}
if (StringUtils.isNotBlank(req.getProcessInstanceId())) {
eq(OperMaintenanceTaskEntity::getProcessInstanceId, req.getProcessInstanceId());
}
if (req.getDisposer() != null) {
like(OperMaintenanceTaskEntity::getDisposer, req.getDisposer());
}
if (StringUtils.isNotBlank(req.getContent())) {
like(OperMaintenanceTaskEntity::getContent, req.getContent());
}
if (req.getStatus() != null) {
eq(OperMaintenanceTaskEntity::getStatus, req.getStatus());
}
if (req.getTitle() != null) {
like(OperMaintenanceTaskEntity::getTitle, req.getTitle());
}
if (req.getTaskType() != null) {
eq(OperMaintenanceTaskEntity::getTaskType, req.getTaskType());
}
if (req.getExcludeNullTicket() != null && req.getExcludeNullTicket() == 1) {
isNull(OperMaintenanceTaskEntity::getTicketId);
}
if (!StringUtil.isEmpty(req.getStartTime())) {
gt(OperMaintenanceTaskEntity::getDisposeTime, req.getStartTime());
}
if (!StringUtil.isEmpty(req.getEndTime())) {
lt(OperMaintenanceTaskEntity::getDisposeTime, req.getEndTime());
}
if (!CollectionUtils.isEmpty(req.getDeptIds())) {
in(OperMaintenanceTaskEntity::getCreateDept, req.getDeptIds());
}
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords()));
return R.data(pages);
}
IPage pages = super.page(Condition.getPage(query), queryWrapper);
pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords()));
return R.data(pages);
}
@Override
public String genTaskCode(Integer num) {
return DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("000").format(num);
}
@Override
public String genTaskCode(Integer num) {
return DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("000").format(num);
}
@Override
public List<OperMaintenanceTaskEntity> getByEmCode(String emCode, List<String> list) {
return this.baseMapper.selectByEmCode(emCode,list);
}
@Override
public List<OperMaintenanceTaskEntity> getByEmCode(String emCode, List<String> list) {
return this.baseMapper.selectByEmCode(emCode, list);
}
@Override
public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) {
List<MaintenanceReportVO> maintenanceReportVOList = new ArrayList<>();
//查询当月日常维护任务
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList = this.baseMapper.selectList(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{
ge(OperMaintenanceTaskEntity::getDisposeTime,startDate);
le(OperMaintenanceTaskEntity::getDisposeTime,endDate);
in(OperMaintenanceTaskEntity::getCreateDept,deptIdList);
}});
//按执行人组合
if(CollectionUtil.isNotEmpty(operMaintenanceTaskEntityList)){
Map<String,List<OperMaintenanceTaskEntity>> map = operMaintenanceTaskEntityList.stream().filter(o->StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer));
map.forEach((k,v)->{
MaintenanceReportVO maintenanceReportVO = new MaintenanceReportVO();
//获取执行人名字
List<Long> userIdList = Arrays.asList(k.split(",")).stream().map(o->Long.parseLong(o)).collect(Collectors.toList());
String userName = userIdList.stream().map(userId -> {
User user = UserCache.getUser(userId);
return Optional.ofNullable(user).map(User::getName).orElse("");
}).collect(Collectors.joining(","));
maintenanceReportVO.setOperMaintenanceTaskEntityList(v);
maintenanceReportVO.setUserName(userName);
//已完成任务
List<OperMaintenanceTaskEntity> finishTask = v.stream().filter(o-> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());
Map<String,List<OperMaintenanceTaskEntity>> finishTaskGroupByType = finishTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
AtomicReference<String> finishSituation = new AtomicReference<>("");
finishTaskGroupByType.forEach((TypeCode,TypeList)->{
try{
finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
}
catch(NullPointerException e){
e.printStackTrace();
}
});
maintenanceReportVO.setCompleteNum(finishTask.size());
maintenanceReportVO.setCompleteSituation(finishSituation.get());
//未完成任务
List<OperMaintenanceTaskEntity> immatureTask = v.stream().filter(o-> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList());
Map<String,List<OperMaintenanceTaskEntity>> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
AtomicReference<String> immatureTaskSituation = new AtomicReference<>("");
immatureTaskTaskGroupByType.forEach((TypeCode,TypeList)->{
immatureTaskSituation.set(immatureTaskSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
});
maintenanceReportVO.setIncompleteNum(immatureTask.size());
maintenanceReportVO.setIncompleteSituation(immatureTaskSituation.get());
@Override
public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) {
List<MaintenanceReportVO> maintenanceReportVOList = new ArrayList<>();
//查询当月日常维护任务
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList = this.baseMapper.selectList(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
ge(OperMaintenanceTaskEntity::getDisposeTime, startDate);
le(OperMaintenanceTaskEntity::getDisposeTime, endDate);
in(OperMaintenanceTaskEntity::getCreateDept, deptIdList);
}});
//按执行人组合
if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntityList)) {
Map<String, List<OperMaintenanceTaskEntity>> map = operMaintenanceTaskEntityList.stream().filter(o -> StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer));
map.forEach((k, v) -> {
MaintenanceReportVO maintenanceReportVO = new MaintenanceReportVO();
//获取执行人名字
List<Long> userIdList = Arrays.asList(k.split(",")).stream().map(o -> Long.parseLong(o)).collect(Collectors.toList());
String userName = userIdList.stream().map(userId -> {
User user = UserCache.getUser(userId);
return Optional.ofNullable(user).map(User::getName).orElse("");
}).collect(Collectors.joining(","));
maintenanceReportVO.setOperMaintenanceTaskEntityList(v);
maintenanceReportVO.setUserName(userName);
//已完成任务
List<OperMaintenanceTaskEntity> finishTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());
Map<String, List<OperMaintenanceTaskEntity>> finishTaskGroupByType = finishTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
AtomicReference<String> finishSituation = new AtomicReference<>("");
finishTaskGroupByType.forEach((TypeCode, TypeList) -> {
try {
finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
} catch (NullPointerException e) {
e.printStackTrace();
}
});
maintenanceReportVO.setCompleteNum(finishTask.size());
maintenanceReportVO.setCompleteSituation(finishSituation.get());
//未完成任务
List<OperMaintenanceTaskEntity> immatureTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList());
Map<String, List<OperMaintenanceTaskEntity>> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
AtomicReference<String> immatureTaskSituation = new AtomicReference<>("");
immatureTaskTaskGroupByType.forEach((TypeCode, TypeList) -> {
immatureTaskSituation.set(immatureTaskSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
});
maintenanceReportVO.setIncompleteNum(immatureTask.size());
maintenanceReportVO.setIncompleteSituation(immatureTaskSituation.get());
//获取问题数量
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>(){{
in(OperPhenomenonEntity::getFinder,userIdList);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.RCWH.getStatus());
ge(OperPhenomenonEntity::getFindTime,startDate);
le(OperPhenomenonEntity::getFindTime,endDate);
in(OperPhenomenonEntity::getCreateDept,deptIdList);
}});
maintenanceReportVO.setFindProblemNum(operPhenomenonEntityList.size());
//获取工时
int actHoursSum = v.stream().collect(Collectors.summingInt(OperMaintenanceTaskEntity::getHours));
maintenanceReportVO.setHours(actHoursSum);
//合计
maintenanceReportVO.setCount(v.size());
maintenanceReportVOList.add(maintenanceReportVO);
});
}
return maintenanceReportVOList;
}
//获取问题数量
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
in(OperPhenomenonEntity::getFinder, userIdList);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.RCWH.getStatus());
ge(OperPhenomenonEntity::getFindTime, startDate);
le(OperPhenomenonEntity::getFindTime, endDate);
in(OperPhenomenonEntity::getCreateDept, deptIdList);
}});
maintenanceReportVO.setFindProblemNum(operPhenomenonEntityList.size());
//获取工时
int actHoursSum = v.stream().collect(Collectors.summingInt(OperMaintenanceTaskEntity::getHours));
maintenanceReportVO.setHours(actHoursSum);
//合计
maintenanceReportVO.setCount(v.size());
maintenanceReportVOList.add(maintenanceReportVO);
});
}
return maintenanceReportVOList;
}
@Override
public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(Map<String,Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId");
return getMaintenanceStatisticsByDisposer(startDate,endDate,deptIdList);
}
@Override
public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId");
return getMaintenanceStatisticsByDisposer(startDate, endDate, deptIdList);
}
@Override
public List<Map<String, Object>> getMaintenanceConclusion(Map<String, Object> params) {
return operMaintenanceTaskMapper.getMaintenanceConclusion(params);
}
@Override
public List<Map<String, Object>> getMaintenanceConclusion(Map<String, Object> params) {
return operMaintenanceTaskMapper.getMaintenanceConclusion(params);
}
@Override
public List<OperMaintenanceTaskEntity> getMaintenanceTask(String startTime, String endTime, List<Long> list) {
return this.baseMapper.selectMaintenanceTask(startTime,endTime,list);
}
@Override
public List<OperMaintenanceTaskEntity> getMaintenanceTask(String startTime, String endTime, List<Long> list) {
return this.baseMapper.selectMaintenanceTask(startTime, endTime, list);
}
@Override
@Transactional
public R completeTask(OperMaintenanceTaskDTO req, ComleteTask completeTask) {
/**如果当前流程为待确认、归档,则从相应角色内获取人员列表完成工作流任务**/
if(req.getStatus() == MaintenanceConstant.TASK_STATUS_3 || req.getStatus() == MaintenanceConstant.TASK_STATUS_4){
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),req.getCreateDept(),MaintenanceConstant.GROUP_LEADER);
if(!userListR.isSuccess() || CollectionUtil.isEmpty(userListR.getData())){
throw new ServiceException("获取"+MaintenanceConstant.GROUP_LEADER+"角色下的用户为空或失败");
}
String leaders = userListR.getData().stream().map(user->"taskUser_".concat(user.getId().toString())).collect(Collectors.joining(","));
log.info("获取角色下的人员为:{}",leaders);
if(CollectionUtil.isEmpty(completeTask.getVariables())){
completeTask.setVariables(new HashMap<>());
}
completeTask.getVariables().put(MaintenanceConstant.GROUP_LEADER,leaders);
}
R completeR = flowClient.completeTask(completeTask);
if(!completeR.isSuccess()){
throw new ServiceException(completeR.getMsg());
}
return R.status(this.updateById(req));
}
@Override
@Transactional
public R completeTask(OperMaintenanceTaskDTO req, ComleteTask completeTask) {
/**如果当前流程为待确认、归档,则从相应角色内获取人员列表完成工作流任务**/
if (req.getStatus() == MaintenanceConstant.TASK_STATUS_3 || req.getStatus() == MaintenanceConstant.TASK_STATUS_4) {
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), req.getCreateDept(), MaintenanceConstant.GROUP_LEADER);
if (!userListR.isSuccess() || CollectionUtil.isEmpty(userListR.getData())) {
throw new ServiceException("获取" + MaintenanceConstant.GROUP_LEADER + "角色下的用户为空或失败");
}
String leaders = userListR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(","));
log.info("获取角色下的人员为:{}", leaders);
if (CollectionUtil.isEmpty(completeTask.getVariables())) {
completeTask.setVariables(new HashMap<>());
}
completeTask.getVariables().put(MaintenanceConstant.GROUP_LEADER, leaders);
}
R completeR = flowClient.completeTask(completeTask);
if (!completeR.isSuccess()) {
throw new ServiceException(completeR.getMsg());
}
return R.status(this.updateById(req));
}
@Override
@Transactional
public R deleteTaskBatch(List<Long> taskIdList) {
taskIdList.forEach(taskId->{
/**删除工作流任务**/
EndVo endVo = new EndVo();
if(Func.isEmpty(taskId)){
return;
}
OperMaintenanceTaskEntity taskEntity = this.getById(taskId);
if(ObjectUtil.isEmpty(taskEntity) || ObjectUtil.isEmpty(taskEntity.getProcessInstanceId())){
return;
}
R r = flowClient.delProcessInstanceById(taskEntity.getProcessInstanceId(),"删除日常维护任务");
if(!r.isSuccess()){
throw new ServiceException(r.getMsg());
}
/**删除任务**/
this.removeById(taskId);
});
return R.success("删除成功!");
}
@Override
@Transactional
public R deleteTaskBatch(List<Long> taskIdList) {
taskIdList.forEach(taskId -> {
/**删除工作流任务**/
EndVo endVo = new EndVo();
if (Func.isEmpty(taskId)) {
return;
}
OperMaintenanceTaskEntity taskEntity = this.getById(taskId);
if (ObjectUtil.isEmpty(taskEntity) || ObjectUtil.isEmpty(taskEntity.getProcessInstanceId())) {
return;
}
R r = flowClient.delProcessInstanceById(taskEntity.getProcessInstanceId(), "删除日常维护任务");
if (!r.isSuccess()) {
throw new ServiceException(r.getMsg());
}
/**删除任务**/
this.removeById(taskId);
});
return R.success("删除成功!");
}
/**
* 获取当班定期工作
* @param start
* @param end
* @param list
* @return
*/
@Override
public RegularWorkVO getDutyRegularWork(String start, String end, List<Long> list) {
RegularWorkVO regularWorkVO = new RegularWorkVO();
// 查询定期工作任务
List<OperMaintenanceTaskEntity> regularWorkList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{
ge(OperMaintenanceTaskEntity::getDisposeTime,start)
.le(OperMaintenanceTaskEntity::getDisposeTime,end)
.eq(OperMaintenanceTaskEntity::getTypeCode,"05")
.in(OperMaintenanceTaskEntity::getCreateDept,list);
}});
if(CollectionUtil.isEmpty(regularWorkList)){
regularWorkVO.setRegularWorkSum(0);
regularWorkVO.setRegularWork(0);
return regularWorkVO;
}
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id->id.toString()).collect(Collectors.joining(",")));
regularWorkVO.setRegularWorkSum(regularWorkList.size());
// 定期工作任务完成数量
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());
if(CollectionUtil.isEmpty(regularWorkFinishList)){
regularWorkVO.setRegularWork(0);
return regularWorkVO;
}
regularWorkVO.setRegularWork(regularWorkFinishList.size());
return regularWorkVO;
}
/**
* 获取当班定期工作
*
* @param start
* @param end
* @param list
* @return
*/
@Override
public RegularWorkVO getDutyRegularWork(String start, String end, List<Long> list) {
RegularWorkVO regularWorkVO = new RegularWorkVO();
// 查询定期工作任务
List<OperMaintenanceTaskEntity> regularWorkList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
ge(OperMaintenanceTaskEntity::getDisposeTime, start)
.le(OperMaintenanceTaskEntity::getDisposeTime, end)
.eq(OperMaintenanceTaskEntity::getTypeCode, "05")
.in(OperMaintenanceTaskEntity::getCreateDept, list);
}});
if (CollectionUtil.isEmpty(regularWorkList)) {
regularWorkVO.setRegularWorkSum(0);
regularWorkVO.setRegularWork(0);
return regularWorkVO;
}
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id -> id.toString()).collect(Collectors.joining(",")));
regularWorkVO.setRegularWorkSum(regularWorkList.size());
// 定期工作任务完成数量
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());
if (CollectionUtil.isEmpty(regularWorkFinishList)) {
regularWorkVO.setRegularWork(0);
return regularWorkVO;
}
regularWorkVO.setRegularWork(regularWorkFinishList.size());
return regularWorkVO;
}
/**
* 获取安全检查日常维护任务
* @param startDate 开始时间
* @param endDate 结束时间
* @param dept 机构ID
* @return SafeCheckStatisticVO对象
*/
@Override
public SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate, String endDate, Long dept) {
//获取已完成任务
List<OperMaintenanceTaskEntity> taskEntityList = this.list(Wrappers.<OperMaintenanceTaskEntity>lambdaQuery()
.eq(OperMaintenanceTaskEntity::getStatus,MaintenanceConstant.TASK_STATUS_5)
.eq(OperMaintenanceTaskEntity::getCreateDept,dept)
.ge(OperMaintenanceTaskEntity::getDisposeTime,startDate)
.le(OperMaintenanceTaskEntity::getDisposeTime,endDate)
);
SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
vo.setProjectType(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getName());
vo.setTotal(taskEntityList.size());
return vo;
}
/**
* 获取安全检查日常维护任务
*
* @param startDate 开始时间
* @param endDate 结束时间
* @param dept 机构ID
* @return SafeCheckStatisticVO对象
*/
@Override
public SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate, String endDate, Long dept) {
//获取已完成任务
List<OperMaintenanceTaskEntity> taskEntityList = this.list(Wrappers.<OperMaintenanceTaskEntity>lambdaQuery()
.eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_5)
.eq(OperMaintenanceTaskEntity::getCreateDept, dept)
.ge(OperMaintenanceTaskEntity::getDisposeTime, startDate)
.le(OperMaintenanceTaskEntity::getDisposeTime, endDate)
);
SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
vo.setProjectType(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getName());
vo.setTotal(taskEntityList.size());
return vo;
}
/**
* 根据区域和月份分页查询日志维护列表
*
* @param pageParam
* @param areaMonthlyVo
* @return
*/
@Override
public IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) {
//1.根据区域查询
QueryWrapper<OperMaintenanceTaskEntity> queryWrapper = new QueryWrapper<>();
//维护内容
queryWrapper.lambda().like(StringUtils.isNotBlank(areaMonthlyVo.getContent()),
OperMaintenanceTaskEntity::getContent, areaMonthlyVo.getContent());
//执行状态
queryWrapper.lambda().eq(areaMonthlyVo.getStatus() != null, OperMaintenanceTaskEntity::getStatus,
areaMonthlyVo.getStatus());
//项目名称
queryWrapper.lambda().like(areaMonthlyVo.getTitle() != null, OperMaintenanceTaskEntity::getTitle,
areaMonthlyVo.getTitle());
//任务类型
queryWrapper.lambda().eq(areaMonthlyVo.getTaskType() != null, OperMaintenanceTaskEntity::getTaskType,
areaMonthlyVo.getTaskType());
//区域编号必传
queryWrapper.eq("CREATE_DEPT", areaMonthlyVo.getAreaId());
queryWrapper.eq(areaMonthlyVo.getYearMonth() != null, "date_format(create_time,'%Y-%m')", areaMonthlyVo.getYearMonth());
Page<OperMaintenanceTaskEntity> operMaintenanceTaskEntityPage = baseMapper.selectPage(pageParam, queryWrapper);
//数据转换
if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntityPage.getRecords())) {
List<MaintenanceTaskVo> maintenanceTaskVos = operMaintenanceTaskEntityPage.getRecords().stream().map(operMaintenanceTaskEntity -> {
MaintenanceTaskVo vo = new MaintenanceTaskVo();
BeanUtils.copyProperties(operMaintenanceTaskEntity, vo);
vo.setTypeCodeValue(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, vo.getTypeCode()));
vo.setStatusValue(DictCache.getValue(DictConstant.MAINTENANCE_TASK_STATUS, vo.getStatus()));
String disposerName = Optional.ofNullable(operMaintenanceTaskEntity.getDisposer()).map(s -> {
List<String> disposerList = Arrays.stream(s.split(",")).collect(Collectors.toList());
return disposerList.stream().map(d -> {
User user = UserCache.getUser(Long.parseLong(d));
return Optional.ofNullable(user).map(User::getName).orElse("");
}).collect(Collectors.joining(","));
}).orElse("");
vo.setDisposerName(disposerName);
return vo;
}).collect(Collectors.toList());
IPage<MaintenanceTaskVo> taskVos = new Page<>();
taskVos.setRecords(maintenanceTaskVos);
taskVos.setTotal(operMaintenanceTaskEntityPage.getTotal());
taskVos.setPages(operMaintenanceTaskEntityPage.getPages());
taskVos.setSize(operMaintenanceTaskEntityPage.getSize());
return taskVos;
}
return null;
}
}

11
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java

@ -7,8 +7,9 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
@ -19,6 +20,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
@ -115,12 +117,13 @@ public class StandardTicketInfoController extends BladeController {
* @return
*/
@GetMapping("/areaMonthlyWithOperation/{page}/{size}")
public R<IPage<StandardTicketVo>> areaMonthlyWithOperation(
public R<BladePage<StandardTicketVo>> areaMonthlyWithOperation(
@PathVariable("page") Long page,
@PathVariable("size") Long size,
@SpringQueryMap AreaMonthlyVo areaMonthlyVo) {
@SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) {
Page<StandardTicketInfoEntity> searchPage = new Page<>(page, size);
IPage<StandardTicketVo> standardTicketInfoEntity =
BladePage<StandardTicketVo> standardTicketInfoEntity =
standardTicketInfoService.areaMonthlyWithOperation(areaMonthlyVo, searchPage);
return R.data(standardTicketInfoEntity);
}

6
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java

@ -4,13 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.flow.core.vo.ComleteTask;
@ -105,6 +107,6 @@ public interface IStandardTicketInfoService extends BaseService<StandardTicketIn
* @param searchPage
* @return
*/
Page<StandardTicketVo> areaMonthlyWithOperation(AreaMonthlyVo areaMonthly, Page<StandardTicketInfoEntity> searchPage);
BladePage<StandardTicketVo> areaMonthlyWithOperation(StandardTicketWithAreaVo areaMonthly, Page<StandardTicketInfoEntity> searchPage);
}

54
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -11,8 +11,10 @@ import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.constants.DictConstants;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketMeasureDto;
@ -34,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -43,6 +46,9 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.system.cache.DictCache;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -55,10 +61,7 @@ import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -319,16 +322,31 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/**
* 根据区域Id 分页查询
*
* @param areaMonthly
* @param areaVo
* @param searchPage
* @return
*/
@Override
public Page<StandardTicketVo> areaMonthlyWithOperation(AreaMonthlyVo areaMonthly, Page<StandardTicketInfoEntity> searchPage) {
public BladePage<StandardTicketVo> areaMonthlyWithOperation(StandardTicketWithAreaVo areaVo, Page<StandardTicketInfoEntity> searchPage) {
//1.查询
QueryWrapper<StandardTicketInfoEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CREATE_DEPT", areaMonthly.getAreaId());
queryWrapper.eq(areaMonthly.getYearMonth() != null,
"date_format(create_time,'%Y-%m')", areaMonthly.getYearMonth());
//开票来源
queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), StandardTicketInfoEntity::getTaskType,
areaVo.getTaskType());
//编号
queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), StandardTicketInfoEntity::getCode, areaVo.getCode());
//状态
queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), StandardTicketInfoEntity::getStatus,
areaVo.getStatus());
//开始时间
queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), StandardTicketInfoEntity::getCreateTime,
areaVo.getStartTime());
//结束时间
queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), StandardTicketInfoEntity::getCreateTime,
areaVo.getEndTime());
queryWrapper.eq("CREATE_DEPT", areaVo.getAreaId());
queryWrapper.eq(areaVo.getYearMonth() != null,
"date_format(create_time,'%Y-%m')", areaVo.getYearMonth());
Page<StandardTicketInfoEntity> standardTicketInfoEntityPage = baseMapper.selectPage(searchPage, queryWrapper);
//数据转换StandardTicketInfoEntity ==> StandardTicketVo
List<StandardTicketVo> standardTicketInfoVOList = new ArrayList<>();
@ -336,6 +354,17 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
standardTicketInfoVOList = standardTicketInfoEntityPage.getRecords().stream().map(item -> {
StandardTicketVo standardTicketVo = new StandardTicketVo();
BeanUtils.copyProperties(item, standardTicketVo);
/*发令人、受令人、负责人、监护人*/
User issueOrderPerson = UserCache.getUser(standardTicketVo.getIssueOrderPerson());
User accessOrderPerson = UserCache.getUser(standardTicketVo.getAccessOrderPerson());
User principal = UserCache.getUser(standardTicketVo.getPrincipal());
User guardian = UserCache.getUser(standardTicketVo.getGuardian());
standardTicketVo.setIssueOrderPersonName(Optional.ofNullable(issueOrderPerson).map(User::getName).orElse(null));
standardTicketVo.setAccessOrderPersonName(Optional.ofNullable(accessOrderPerson).map(User::getName).orElse(null));
standardTicketVo.setPrincipalName(Optional.ofNullable(principal).map(User::getName).orElse(null));
standardTicketVo.setGuardianName(Optional.ofNullable(guardian).map(User::getName).orElse(null));
/**来源类型名称**/
standardTicketVo.setTaskTypeName(Optional.ofNullable(item.getTaskType()).map(t-> DictCache.getValue(DictConstants.TICKET_SOURCE_TYPE,t)).orElse(null));
return standardTicketVo;
}).collect(Collectors.toList());
}
@ -344,7 +373,10 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
page.setCurrent(standardTicketInfoEntityPage.getCurrent());
page.setTotal(standardTicketInfoEntityPage.getTotal());
page.setRecords(standardTicketInfoVOList);
return page;
BladePage<StandardTicketVo> bladePage = BladePage.of(page);
return bladePage;
}
/**

285
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java

@ -2,21 +2,27 @@ package com.hnac.hzims.ticket.workTicket.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.invalid.DictInvalid;
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo;
import com.hnac.hzims.ticket.constants.DictConstants;
import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkInfoFlowDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -27,6 +33,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
@ -39,139 +46,155 @@ import java.util.Map;
*/
@RestController
@RequestMapping("/workTicketInfo")
@Api(value = "工作票管理",tags = "工作票管理")
@Api(value = "工作票管理", tags = "工作票管理")
@AllArgsConstructor
@Validated
public class WorkTicketInfoController {
private final IWorkTicketInfoService workTicketInfoService;
/**
* 删除
*/
@GetMapping("/remove")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "逻辑删除")
public R remove(@RequestParam Long id,@RequestParam String comment) {
return workTicketInfoService.remove(id,comment);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 20)
@ApiOperation(value = "新增")
public R save(@Valid @RequestBody WorkTicketInfoDto req) {
return workTicketInfoService.doSave(req);
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 30)
@ApiOperation(value = "修改")
public R update(@Valid @RequestBody WorkTicketInfoDto req) {
return R.status(workTicketInfoService.updateById(req));
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情")
public R<WorkTicketInfoVO> detail(@RequestParam Long id) {
return workTicketInfoService.detail(id);
}
/**
* 分页
*/
@ApiLog
@PostMapping("/queryList")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页")
@OperationAnnotation(moduleName = "两票管理",title = "工作票"
,operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE,
action = "分页")
public R<IPage<WorkTicketInfoVO>> queryList(WorkTicketInfoDto req, Query query) {
return workTicketInfoService.queryList(req, query);
}
@GetMapping(value = "/exportWorkTicketInfoPdf")
@ApiOperationSupport(order = 60)
@ApiImplicitParam(name = "req",value = "工作票dto对象,导出传参id进入即可")
@ApiOperation(value = "导出工作票pdf文档")
public void exportWorkTicketInfoPdf(@RequestParam Long id, HttpServletResponse response){
workTicketInfoService.exportWorkTicketInfoPdf(id,response);
}
@GetMapping(value = "/exportWorkTicketTemplate")
@ApiOperationSupport(order = 80)
@ApiImplicitParam(name = "req",value = "工作票dto对象,导出传参id进入即可")
@ApiOperation(value = "导出工作票pdf模板")
public void exportWorkTicketTemplate(@RequestParam Long id, HttpServletResponse response){
workTicketInfoService.exportWorkTicketTemplate(id,response);
}
@PostMapping("/completeTask")
@ApiOperationSupport(order = 70)
@ApiOperation(value = "执行工作流任务")
public R completeTask(@RequestBody @ObjectRequiredInvalid(attributes = {"req.id","req.status","flow.processInstanceId","flow.taskId","flow.flag"})
@DictInvalid(dictKey = DictConstants.FIRST_TICKET_FLOW,attribute = "req.status") WorkInfoFlowDto workInfoFlowDto){
return workTicketInfoService.completeTask(workInfoFlowDto.getReq(),workInfoFlowDto.getFlow());
}
@PostMapping("/finishOfflineTicket")
@ApiOperationSupport(order = 80)
@ApiImplicitParams({
@ApiImplicitParam(name = "accessTaskDTO", value = "检修任务对象,需传id、actHours,accessMaterials", paramType = "body", dataType = "AccessTaskDTO对象", required = true),
@ApiImplicitParam(name = "workTicketInfoDto", value = "工作票对象,需传id", paramType = "body", dataType = "WorkTicketInfoDto对象", required = true)
})
@ApiOperation(value = "终结离线工作票")
public R finishOfflineTicket(@RequestBody TicketAccessTaskDto ticketAccessTaskDto) {
return workTicketInfoService.finishOfflineTicket(ticketAccessTaskDto);
}
@PostMapping("/licenseOfflineTicket")
@ApiOperationSupport(order = 90)
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "工作票主键ID", paramType = "body", dataType = "Long", required = true)
})
@ApiOperation(value = "许可离线工作票")
public R licenseOfflineTicket(@RequestBody WorkTicketInfoDto req) {
return workTicketInfoService.licenseOfflineTicket(req);
}
@ApiLog
@GetMapping("/userListByRoleAlias")
@ApiOperationSupport(order = 100)
@OperationAnnotation(moduleName = "两票管理",
title = "两票管理(工作票)",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "获取某机构下角色的人员列表")
@ApiOperation(value = "获取某机构下角色的人员列表")
public R userListByRoleAlias(@RequestParam("roleAlias") @ApiParam("角色别称") String roleAlias) {
IUserClient userClient = SpringUtil.getBean(IUserClient.class);
final String ADMIN = "admin";
//当账号为管理员时 查询出租户200000下所有角色成员
if(StringUtil.isNotBlank(AuthUtil.getDeptId()) && ADMIN.equalsIgnoreCase(AuthUtil.getUserAccount())){
return userClient.userListByRoleAlias(AuthUtil.getTenantId(),roleAlias);
}
//获取当前用户权限下的用户列表
return userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),Long.parseLong(AuthUtil.getDeptId()),roleAlias);
}
@GetMapping("/verificationRole")
@ApiOperationSupport(order = 110)
@ApiImplicitParams({
@ApiImplicitParam(name = "deptId",value = "机构ID",dataType = "Long",paramType = "path"),
@ApiImplicitParam(name = "roleAliasArray",value = "角色别称 按,分隔",dataType = "String",paramType = "path")
})
@ApiOperation(value = "验证某机构下的角色是否能查询到相关人员")
public R<Map<String,Object>> verificationRole(@RequestParam("deptId") Long deptId,@RequestParam("roleAliasArray") String roleAliasArray ) {
return workTicketInfoService.verificationRole(deptId,roleAliasArray);
}
private final IWorkTicketInfoService workTicketInfoService;
/**
* 删除
*/
@GetMapping("/remove")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "逻辑删除")
public R remove(@RequestParam Long id, @RequestParam String comment) {
return workTicketInfoService.remove(id, comment);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 20)
@ApiOperation(value = "新增")
public R save(@Valid @RequestBody WorkTicketInfoDto req) {
return workTicketInfoService.doSave(req);
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 30)
@ApiOperation(value = "修改")
public R update(@Valid @RequestBody WorkTicketInfoDto req) {
return R.status(workTicketInfoService.updateById(req));
}
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情")
public R<WorkTicketInfoVO> detail(@RequestParam Long id) {
return workTicketInfoService.detail(id);
}
/**
* 分页
*/
@ApiLog
@PostMapping("/queryList")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页")
@OperationAnnotation(moduleName = "两票管理", title = "工作票"
, operatorType = OperatorType.MOBILE, businessType =
BusinessType.GENCODE,
action = "分页")
public R<IPage<WorkTicketInfoVO>> queryList(WorkTicketInfoDto req, Query query) {
return workTicketInfoService.queryList(req, query);
}
@GetMapping(value = "/exportWorkTicketInfoPdf")
@ApiOperationSupport(order = 60)
@ApiImplicitParam(name = "req", value = "工作票dto对象,导出传参id进入即可")
@ApiOperation(value = "导出工作票pdf文档")
public void exportWorkTicketInfoPdf(@RequestParam Long id, HttpServletResponse response) {
workTicketInfoService.exportWorkTicketInfoPdf(id, response);
}
@GetMapping(value = "/exportWorkTicketTemplate")
@ApiOperationSupport(order = 80)
@ApiImplicitParam(name = "req", value = "工作票dto对象,导出传参id进入即可")
@ApiOperation(value = "导出工作票pdf模板")
public void exportWorkTicketTemplate(@RequestParam Long id, HttpServletResponse response) {
workTicketInfoService.exportWorkTicketTemplate(id, response);
}
@PostMapping("/completeTask")
@ApiOperationSupport(order = 70)
@ApiOperation(value = "执行工作流任务")
public R completeTask(@RequestBody @ObjectRequiredInvalid(attributes = {"req.id", "req.status", "flow.processInstanceId", "flow.taskId", "flow.flag"})
@DictInvalid(dictKey = DictConstants.FIRST_TICKET_FLOW, attribute = "req.status") WorkInfoFlowDto workInfoFlowDto) {
return workTicketInfoService.completeTask(workInfoFlowDto.getReq(), workInfoFlowDto.getFlow());
}
@PostMapping("/finishOfflineTicket")
@ApiOperationSupport(order = 80)
@ApiImplicitParams({
@ApiImplicitParam(name = "accessTaskDTO", value = "检修任务对象,需传id、actHours,accessMaterials", paramType = "body", dataType = "AccessTaskDTO对象", required = true),
@ApiImplicitParam(name = "workTicketInfoDto", value = "工作票对象,需传id", paramType = "body", dataType = "WorkTicketInfoDto对象", required = true)
})
@ApiOperation(value = "终结离线工作票")
public R finishOfflineTicket(@RequestBody TicketAccessTaskDto ticketAccessTaskDto) {
return workTicketInfoService.finishOfflineTicket(ticketAccessTaskDto);
}
@PostMapping("/licenseOfflineTicket")
@ApiOperationSupport(order = 90)
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "工作票主键ID", paramType = "body", dataType = "Long", required = true)
})
@ApiOperation(value = "许可离线工作票")
public R licenseOfflineTicket(@RequestBody WorkTicketInfoDto req) {
return workTicketInfoService.licenseOfflineTicket(req);
}
@ApiLog
@GetMapping("/userListByRoleAlias")
@ApiOperationSupport(order = 100)
@OperationAnnotation(moduleName = "两票管理",
title = "两票管理(工作票)", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "获取某机构下角色的人员列表")
@ApiOperation(value = "获取某机构下角色的人员列表")
public R userListByRoleAlias(@RequestParam("roleAlias") @ApiParam("角色别称") String roleAlias) {
IUserClient userClient = SpringUtil.getBean(IUserClient.class);
final String ADMIN = "admin";
//当账号为管理员时 查询出租户200000下所有角色成员
if (StringUtil.isNotBlank(AuthUtil.getDeptId()) && ADMIN.equalsIgnoreCase(AuthUtil.getUserAccount())) {
return userClient.userListByRoleAlias(AuthUtil.getTenantId(), roleAlias);
}
//获取当前用户权限下的用户列表
return userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), Long.parseLong(AuthUtil.getDeptId()), roleAlias);
}
@GetMapping("/verificationRole")
@ApiOperationSupport(order = 110)
@ApiImplicitParams({
@ApiImplicitParam(name = "deptId", value = "机构ID", dataType = "Long", paramType = "path"),
@ApiImplicitParam(name = "roleAliasArray", value = "角色别称 按,分隔", dataType = "String", paramType = "path")
})
@ApiOperation(value = "验证某机构下的角色是否能查询到相关人员")
public R<Map<String, Object>> verificationRole(@RequestParam("deptId") Long deptId, @RequestParam("roleAliasArray") String roleAliasArray) {
return workTicketInfoService.verificationRole(deptId, roleAliasArray);
}
/**
* 根据月份和区域查询工作票列表详情
*/
@GetMapping("/workTicketListByMonthAndArea/{page}/{size}")
public R<BladePage<StandardWorkVo>> workTicketListByMonthAndArea(@PathVariable Long page,
@PathVariable Long size,
StandardTicketWithAreaVo standardTicketWithAreaVo) {
Page<WorkTicketInfoEntity> pageEntity = new Page<>(page, size);
BladePage<StandardWorkVo> standardWorkVoList = workTicketInfoService
.workTicketListByMonthAndArea(pageEntity,
standardTicketWithAreaVo);
return R.data(standardWorkVoList);
}
}

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java

@ -1,12 +1,17 @@
package com.hnac.hzims.ticket.workTicket.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo;
import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.flow.core.entity.BladeFlow;
@ -123,4 +128,11 @@ public interface IWorkTicketInfoService extends BaseService<WorkTicketInfoEntity
*/
R<Map<String,Object>> verificationRole(Long deptId, String roleAliasArray);
/**
* 根据月份和区域查询工作票列表详情
* @param pageEntity
* @param standardTicketWithAreaVo
* @return
*/
BladePage<StandardWorkVo> workTicketListByMonthAndArea(Page<WorkTicketInfoEntity> pageEntity, StandardTicketWithAreaVo standardTicketWithAreaVo);
}

1586
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save