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. 59
      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. 6
      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. 28
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
  30. 116
      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. 26
      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. 178
      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. 67
      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. 566
      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; package com.hnac.hzims.message.vo.msgpushrecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.time.YearMonth;
/** /**
* @Author WL * @Author WL
* @Version v1.0 * @Version v1.0
@ -17,9 +20,10 @@ public class MessagePushRecordEntityVo {
private String stationCode; 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;
}

59
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.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.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.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap; import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/** /**
* @Author WL * @Author WL
* @Version v1.0 * @Version v1.0
@ -21,12 +29,53 @@ import org.springframework.web.bind.annotation.*;
public interface TicketFeignClient { public interface TicketFeignClient {
/** /**
* 根据月份区域 获取操作详情数据 * 根据月份区域 获取操作列表数据
* *
* @return * @return
*/ */
@GetMapping("/standard/ticket/areaMonthlyWithOperation/{page}/{size}") @GetMapping("/standard/ticket/areaMonthlyWithOperation/{page}/{size}")
R<IPage<StandardTicketVo>> areaMonthlyWithOperation(@PathVariable("page") Long page, R<BladePage<StandardTicketVo>> areaMonthlyWithOperation(@PathVariable("page") Long page,
@PathVariable("size") Long size, @PathVariable("size") Long size,
@SpringQueryMap AreaMonthlyVo areaMonthlyV); @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; package com.hnac.hzims.ticket.areamonthly.feign.fallback;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.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.springblade.core.tool.api.R;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @Author WL * @Author WL
* @Version v1.0 * @Version v1.0
* @Serial 1.0 * @Serial 1.0
* @Date 2023/4/10 17:24 * @Date 2023/4/10 17:24
*/ */
@Slf4j
@Service @Service
public class StandardTicketInfoFeignClient implements TicketFeignClient { public class StandardTicketInfoFeignClient implements TicketFeignClient {
/** /**
@ -23,8 +30,52 @@ public class StandardTicketInfoFeignClient implements TicketFeignClient {
* @return * @return
*/ */
@Override @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("远程调用失败"); 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 io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -24,6 +24,12 @@ public class StandardTicketVo implements Serializable {
/** /**
* 编号
*/
private Long id;
/**
* 开票种类 * 开票种类
*/ */
private String ticketType; private String ticketType;
@ -40,6 +46,12 @@ public class StandardTicketVo implements Serializable {
* 开票来源 * 开票来源
*/ */
private String taskType; private String taskType;
/**
* 开票来源名称
*/
private String taskTypeName;
/** /**
* 开票任务来源 * 开票任务来源
*/ */
@ -51,21 +63,54 @@ public class StandardTicketVo implements Serializable {
private Long issueOrderPerson; private Long issueOrderPerson;
/** /**
* 发令人名称
*/
private String issueOrderPersonName;
/**
* 受令人 * 受令人
*/ */
private Long accessOrderPerson; private Long accessOrderPerson;
/**
* 受令人名称
*/
private String accessOrderPersonName;
/** /**
* 监护人 * 监护人
*/ */
private String guardian; private Long guardian;
/**
* 监护人名称
*/
private String guardianName;
/** /**
* 值班负责人 * 值班负责人
*/ */
private Long principal; private Long principal;
/**
* 值班负责人
*/
private String principalName;
/** /**
* 开票时间 * 开票时间
*/ */
private Date createTime; 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实例 //2.创建一个SyslogTimerTask实例
SyslogTimerTask myTimeTask = new SyslogTimerTask(statisticsService); SyslogTimerTask myTimeTask = new SyslogTimerTask(statisticsService);
//3.通过timer定时定频率调用SyslogTimerTask的业务逻辑 //3.通过timer定时定频率调用SyslogTimerTask的业务逻辑
// 即 第一次执行是在当前时间的两秒之后,之后每隔3秒钟执行一次 // 即 第一次执行是在当前时间的两秒之后,之后每隔60分钟执行一次
timer.schedule(myTimeTask,2000L,10000L); 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") @TableField("date_calculated")
private String dateCalculated; private String dateCalculated;
/**
* 操作模块
*/
@TableField("title")
private String title;
/** /**
* 操作模块统计 * 操作模块统计
*/ */
@TableField("title_num") @TableField("title_num")
private Integer titleNum; private Integer titleNum;
/**
* 功能模块统计
*/
@TableField("module_name")
private String moduleName;
/** /**
* 功能模块统计 * 功能模块统计
*/ */
@TableField("module_name_num") @TableField("module_name_num")
private Integer moduleNameNum; private Integer moduleNameNum;
/**
* 请求路径统计
*/
@TableField("path")
private String path;
/** /**
* 请求路径统计 * 请求路径统计
*/ */

6
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 id="countStatistics" resultType="com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo">
select date_format(operation_time, '%Y-%m-%d') operationTime, select date_format(operation_time, '%Y-%m-%d') operationTime,
title,
count(title) titleCount, count(title) titleCount,
module_name,
count(module_name) moduleNameCount, count(module_name) moduleNameCount,
path,
count(path) pathCount count(path) pathCount
from hzims_sys_log from hzims_sys_log
group by operationTime; where to_days(operation_time) = to_days(now())
group by operationTime,title,module_name,path;
</select> </select>
</mapper> </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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.middle.systemlog.service.SysLogService; import com.hnac.hzims.middle.systemlog.service.SysLogService;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo; import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,6 +22,7 @@ import java.util.List;
* @author dfy * @author dfy
* @since 2023-04-08 * @since 2023-04-08
*/ */
@Slf4j
@Service @Service
public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statistics> implements StatisticsService { public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statistics> implements StatisticsService {
@ -34,16 +36,16 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
/** /**
* 保存统计的数据 * 保存统计的数据
*/ */
@Override @Override
public void saveCountStatistics() { public void saveCountStatistics() {
//1. 查询统计的数据 //1. 查询统计的数据
List<SysLogStatisticsVo> sysLogStatisticsVoList = sysLogService.countStatistics(); List<SysLogStatisticsVo> sysLogStatisticsVoList = sysLogService.countStatistics();
System.out.println(sysLogStatisticsVoList); log.info("查询统计的数据: {}", sysLogStatisticsVoList);
//2. 保存数据 //2. 保存数据
if (sysLogStatisticsVoList == null) { if (sysLogStatisticsVoList == null) {
return; return;
} }
for (SysLogStatisticsVo sysLogStatisticsVo : sysLogStatisticsVoList) { for (SysLogStatisticsVo sysLogStatisticsVo : sysLogStatisticsVoList) {
//查询数据 //查询数据
Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo.getOperationTime()); Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo.getOperationTime());
@ -55,7 +57,7 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount()); statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
statistics.setPathNum(sysLogStatisticsVo.getPathCount()); statistics.setPathNum(sysLogStatisticsVo.getPathCount());
statisticsService.save(statistics); statisticsService.save(statistics);
}else { } else {
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount()); statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount()); statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
statistics.setPathNum(sysLogStatisticsVo.getPathCount()); 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.StatisticsService;
import com.hnac.hzims.middle.systemlog.service.SysLogService; import com.hnac.hzims.middle.systemlog.service.SysLogService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -14,6 +15,7 @@ import java.util.TimerTask;
* @Serial 1.0 * @Serial 1.0
* @Date 2023/4/8 14:13 * @Date 2023/4/8 14:13
*/ */
@Slf4j
@AllArgsConstructor @AllArgsConstructor
public class SyslogTimerTask extends TimerTask { public class SyslogTimerTask extends TimerTask {
@ -26,7 +28,7 @@ public class SyslogTimerTask extends TimerTask {
@Override @Override
public void run() { public void run() {
//保存统计的数据 //保存统计的数据
System.out.println("保存统计的数据"); log.info("保存统计的数据");
statisticsService.saveCountStatistics(); 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 String operationTime;
/** /**
* 操作模块统计 * 操作模块统计
*/ */
private Integer titleCount; private String title;
/** /**
* 操作模块统计
*/
private Integer titleCount;
/**
* 操作类型统计
*/
private String moduleName;
/**
* 操作类型统计 * 操作类型统计
*/ */
private Integer moduleNameCount; 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") @GetMapping("/list")
@ApiOperation(value = "分页显示任务列表", notes = "传入task") @ApiOperation(value = "分页显示任务列表", notes = "传入task")
public R<IPage<TaskVo>> list(TaskListQuery task, Query query) { public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) {
CacheUtil.put("test#2","inspect","test","12"); //CacheUtil.put("test#2","inspect","test","12");
// LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task); // LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task);
// queryWrapper.orderByDesc(TaskEntity::getUpdateTime); // queryWrapper.orderByDesc(TaskEntity::getUpdateTime);
// IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper); // IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper);
@ -112,9 +112,13 @@ public class TaskController extends BladeController {
task.setCurUserId(AuthUtil.getUserId()); task.setCurUserId(AuthUtil.getUserId());
task.setTenantId(AuthUtil.getTenantId()); task.setTenantId(AuthUtil.getTenantId());
} }
if (task.getCurUserId().longValue() == -1) {
task.setCurUserId(null);
}
List<TaskVo> list = taskService.getListPage(pages,task); List<TaskVo> list = taskService.getListPage(pages,task);
pages.setRecords(list); pages.setRecords(list);
return R.data(pages); BladePage<TaskVo> bladePage = BladePage.of(pages);
return R.data(bladePage);
} }
@GetMapping("/mainQueryPage") @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 != ''"> <if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID,#{task.taskIds}) and FIND_IN_SET(t.ID,#{task.taskIds})
</if> </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 order by t.UPDATE_TIME desc
</select> </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.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.YearMonth;
/** /**
* @author ninglong * @author ninglong
@ -114,4 +115,16 @@ public class TaskListQuery implements Serializable {
@ApiModelProperty("巡检任务 按逗号分隔") @ApiModelProperty("巡检任务 按逗号分隔")
private String taskIds; private String taskIds;
/**
* 月份
*/
private YearMonth yearmonth;
/**
* 区域Id
*/
private String areaId;
} }

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

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

116
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; package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; 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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import java.util.List;
/** /**
* 水电生成报告详情数据 * 水电生成报告详情数据
@ -29,6 +41,8 @@ public class AreaMonthlyDetailsController {
private final AreaMonthlyDetailsService areaMonthlyDetailsService; private final AreaMonthlyDetailsService areaMonthlyDetailsService;
private final IOperMaintenanceTaskService taskService;
/** /**
* 操作票 根据月份区域 获取操作详情数据 * 操作票 根据月份区域 获取操作详情数据
@ -36,17 +50,97 @@ public class AreaMonthlyDetailsController {
* @return * @return
*/ */
@GetMapping("/areaMonthlyWithOperation/{page}/{size}") @GetMapping("/areaMonthlyWithOperation/{page}/{size}")
public R areaMonthlyWithOperation(@PathVariable("page") Long page, public R areaMonthlyWithOperation(@PathVariable("page") Long page, @PathVariable("size") Long size, StandardTicketWithAreaVo areaMonthly) {
@PathVariable("size") Long size, BladePage<StandardTicketVo> standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperation(page, size, areaMonthly);
AreaMonthlyVo areaMonthly) { return R.data(standardTicketInfoVoIPage);
IPage<StandardTicketVo> standardTicketInfoVoIPage = }
areaMonthlyDetailsService.areaMonthlyWithOperation(page,size, areaMonthly);
/**
* 操作票 根据月份区域 获取操作详情数据
*
* @return
*/
@GetMapping("/areaMonthlyWithOperation/detail/{id}")
public R areaMonthlyWithOperationDetail(@PathVariable("id") Long id) {
StandardTicketInfoVO standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperationDetail(id);
return R.data(standardTicketInfoVoIPage); 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; package com.hnac.hzims.operational.main.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.areamonthly.vo.AreaMonthlyVo; 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 * @param areaMonthly
* @return * @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; package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.feign.TicketFeignClient;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService; 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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.springblade.core.tool.api.R;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 水电生产运行数据 * 水电生产运行数据
* *
@ -26,6 +36,9 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
private final TicketFeignClient ticketFeignClient; private final TicketFeignClient ticketFeignClient;
private final TaskFeignClient taskFeignClient;
/** /**
* 根据月份区域 获取操作详情数据 * 根据月份区域 获取操作详情数据
* *
@ -35,14 +48,118 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
* @return * @return
*/ */
@Override @Override
public IPage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthly) { public BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) {
R<IPage<StandardTicketVo>> pageR = R<BladePage<StandardTicketVo>> pageR =
ticketFeignClient.areaMonthlyWithOperation(page, size,areaMonthly); 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()) { if (pageR.isSuccess()) {
log.info("获取操作详情数据成功"); log.info("获取操作详情数据成功");
return pageR.getData(); 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; 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 @ApiLog
@GetMapping("/list") @GetMapping("/list")
@ApiOperationSupport(order = 50) @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(仅支持一人)") action = "分页 查询参数:libraryCode,emCode,typeCode,procDefId,disposers(仅支持一人)")
@ApiOperation(value = "分页 查询参数:libraryCode,emCode,typeCode,procDefId,disposers(仅支持一人)") @ApiOperation(value = "分页 查询参数:libraryCode,emCode,typeCode,procDefId,disposers(仅支持一人)")
public R<IPage<OperMaintenanceLibraryVO>> list(OperMaintenanceLibraryDTO req, Query query) { public R<IPage<OperMaintenanceLibraryVO>> list(OperMaintenanceLibraryDTO req, Query query) {

26
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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.invalid.DictInvalid; import com.hnac.hzims.common.invalid.DictInvalid;
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; 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.scheduled.MaintenanceTaskPushMsg;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; 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 io.swagger.annotations.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.vo.ComleteTask; 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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Arrays; import java.util.Arrays;
@ -104,7 +110,7 @@ public class OperMaintenanceTaskController extends BladeController {
@ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") @ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status")
@ApiImplicitParams({ @ApiImplicitParams({
}) })
@OperationAnnotation(moduleName ="日常维护" ,title = "日常维护记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, @OperationAnnotation(moduleName = "日常维护", title = "日常维护记录", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") action = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status")
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) { public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
return taskService.list(req, query); return taskService.list(req, query);
@ -124,7 +130,7 @@ public class OperMaintenanceTaskController extends BladeController {
@ApiOperation(value = "测试消息推送") @ApiOperation(value = "测试消息推送")
public R testPushMsg(@RequestParam("date") String date) throws Exception { public R testPushMsg(@RequestParam("date") String date) throws Exception {
//maintenanceTaskPushMsg.execute(date); //maintenanceTaskPushMsg.execute(date);
maintenanceTaskPushMsg.maintenancePushMsg("1380746947515691009","200000",200000000000101L,1380746947515691009L); maintenanceTaskPushMsg.maintenancePushMsg("1380746947515691009", "200000", 200000000000101L, 1380746947515691009L);
return R.success("推送成功!"); return R.success("推送成功!");
} }
@ -132,25 +138,29 @@ public class OperMaintenanceTaskController extends BladeController {
@ApiOperationSupport(order = 80) @ApiOperationSupport(order = 80)
@ApiOperation(value = "完成日常维护工作流任务") @ApiOperation(value = "完成日常维护工作流任务")
public R completeTask(@RequestBody public R completeTask(@RequestBody
@ObjectRequiredInvalid(attributes = {"req.id","req.status","completeTask.taskId","completeTask.processInstanceId","completeTask.flag","completeTask.comment"}) @ObjectRequiredInvalid(attributes = {"req.id", "req.status", "completeTask.taskId", "completeTask.processInstanceId", "completeTask.flag", "completeTask.comment"})
@DictInvalid(attribute = "req.status",dictKey = "MaintenanceTaskStatus") Map<String,Object> requestMap){ @DictInvalid(attribute = "req.status", dictKey = "MaintenanceTaskStatus") Map<String, Object> requestMap) {
if(CollectionUtil.isEmpty(requestMap) || ObjectUtil.isEmpty(requestMap.get("req")) || ObjectUtil.isEmpty(requestMap.get("completeTask"))){ if (CollectionUtil.isEmpty(requestMap) || ObjectUtil.isEmpty(requestMap.get("req")) || ObjectUtil.isEmpty(requestMap.get("completeTask"))) {
return R.fail("传入参数有误"); return R.fail("传入参数有误");
} }
OperMaintenanceTaskDTO req = JSON.parseObject(JSON.toJSONString(requestMap.get("req")), OperMaintenanceTaskDTO.class); OperMaintenanceTaskDTO req = JSON.parseObject(JSON.toJSONString(requestMap.get("req")), OperMaintenanceTaskDTO.class);
ComleteTask completeTask = JSON.parseObject(JSON.toJSONString(requestMap.get("completeTask")), ComleteTask.class); ComleteTask completeTask = JSON.parseObject(JSON.toJSONString(requestMap.get("completeTask")), ComleteTask.class);
return taskService.completeTask(req,completeTask); return taskService.completeTask(req, completeTask);
} }
@ApiLog @ApiLog
@PostMapping("/deleteTaskBatch") @PostMapping("/deleteTaskBatch")
@ApiOperationSupport(order = 90) @ApiOperationSupport(order = 90)
@ApiOperation(value = "删除日常维护工作流任务") @ApiOperation(value = "删除日常维护工作流任务")
public R deleteTaskBatch(@RequestBody String body){ public R deleteTaskBatch(@RequestBody String body) {
String ids = JSONObject.parseObject(body).getString("ids"); String ids = JSONObject.parseObject(body).getString("ids");
List<Long> taskIdList = Arrays.asList(ids.split(",")).stream().map(taskId->{ List<Long> taskIdList = Arrays.asList(ids.split(",")).stream().map(taskId -> {
log.info(taskId); log.info(taskId);
return Long.parseLong(taskId); return Long.parseLong(taskId);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return taskService.deleteTaskBatch(taskIdList); 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; package com.hnac.hzims.operational.maintenance.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO; import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO; import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; 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.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.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; 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); SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate,String endDate,Long dept);
/**
* 根据区域和月份分页查询日志维护列表
* @param pageParam
* @param areaMonthlyVo
* @return
*/
IPage<MaintenanceTaskVo> queryLogMaintenancePageList(Page<OperMaintenanceTaskEntity> pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo);
} }

178
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.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.operational.defect.constants.DefectConstant; import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; 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.operational.maintenance.wrapper.OperMaintenanceTaskWrapper;
import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; 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 com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -86,7 +92,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) { public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req, Query query) {
Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ Wrapper<OperMaintenanceTaskEntity> queryWrapper = new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
orderByDesc(OperMaintenanceTaskEntity::getDisposeTime); orderByDesc(OperMaintenanceTaskEntity::getDisposeTime);
if(StringUtil.isNotBlank(req.getTaskIds())){ if (StringUtil.isNotBlank(req.getTaskIds())) {
in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(","))); in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(",")));
} }
if (req.getRefLibraryId() != null) { if (req.getRefLibraryId() != null) {
@ -114,13 +120,13 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
isNull(OperMaintenanceTaskEntity::getTicketId); isNull(OperMaintenanceTaskEntity::getTicketId);
} }
if (!StringUtil.isEmpty(req.getStartTime())) { if (!StringUtil.isEmpty(req.getStartTime())) {
gt(OperMaintenanceTaskEntity::getDisposeTime,req.getStartTime()); gt(OperMaintenanceTaskEntity::getDisposeTime, req.getStartTime());
} }
if (!StringUtil.isEmpty(req.getEndTime())) { if (!StringUtil.isEmpty(req.getEndTime())) {
lt(OperMaintenanceTaskEntity::getDisposeTime,req.getEndTime()); lt(OperMaintenanceTaskEntity::getDisposeTime, req.getEndTime());
} }
if(!CollectionUtils.isEmpty(req.getDeptIds())){ if (!CollectionUtils.isEmpty(req.getDeptIds())) {
in(OperMaintenanceTaskEntity::getCreateDept,req.getDeptIds()); in(OperMaintenanceTaskEntity::getCreateDept, req.getDeptIds());
} }
}}; }};
@ -136,25 +142,25 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
@Override @Override
public List<OperMaintenanceTaskEntity> getByEmCode(String emCode, List<String> list) { public List<OperMaintenanceTaskEntity> getByEmCode(String emCode, List<String> list) {
return this.baseMapper.selectByEmCode(emCode,list); return this.baseMapper.selectByEmCode(emCode, list);
} }
@Override @Override
public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) { public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList) {
List<MaintenanceReportVO> maintenanceReportVOList = new ArrayList<>(); List<MaintenanceReportVO> maintenanceReportVOList = new ArrayList<>();
//查询当月日常维护任务 //查询当月日常维护任务
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList = this.baseMapper.selectList(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{ List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList = this.baseMapper.selectList(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
ge(OperMaintenanceTaskEntity::getDisposeTime,startDate); ge(OperMaintenanceTaskEntity::getDisposeTime, startDate);
le(OperMaintenanceTaskEntity::getDisposeTime,endDate); le(OperMaintenanceTaskEntity::getDisposeTime, endDate);
in(OperMaintenanceTaskEntity::getCreateDept,deptIdList); in(OperMaintenanceTaskEntity::getCreateDept, deptIdList);
}}); }});
//按执行人组合 //按执行人组合
if(CollectionUtil.isNotEmpty(operMaintenanceTaskEntityList)){ if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntityList)) {
Map<String,List<OperMaintenanceTaskEntity>> map = operMaintenanceTaskEntityList.stream().filter(o->StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer)); Map<String, List<OperMaintenanceTaskEntity>> map = operMaintenanceTaskEntityList.stream().filter(o -> StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer));
map.forEach((k,v)->{ map.forEach((k, v) -> {
MaintenanceReportVO maintenanceReportVO = new MaintenanceReportVO(); MaintenanceReportVO maintenanceReportVO = new MaintenanceReportVO();
//获取执行人名字 //获取执行人名字
List<Long> userIdList = Arrays.asList(k.split(",")).stream().map(o->Long.parseLong(o)).collect(Collectors.toList()); List<Long> userIdList = Arrays.asList(k.split(",")).stream().map(o -> Long.parseLong(o)).collect(Collectors.toList());
String userName = userIdList.stream().map(userId -> { String userName = userIdList.stream().map(userId -> {
User user = UserCache.getUser(userId); User user = UserCache.getUser(userId);
return Optional.ofNullable(user).map(User::getName).orElse(""); return Optional.ofNullable(user).map(User::getName).orElse("");
@ -162,36 +168,35 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
maintenanceReportVO.setOperMaintenanceTaskEntityList(v); maintenanceReportVO.setOperMaintenanceTaskEntityList(v);
maintenanceReportVO.setUserName(userName); maintenanceReportVO.setUserName(userName);
//已完成任务 //已完成任务
List<OperMaintenanceTaskEntity> finishTask = v.stream().filter(o-> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); 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)); Map<String, List<OperMaintenanceTaskEntity>> finishTaskGroupByType = finishTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
AtomicReference<String> finishSituation = new AtomicReference<>(""); AtomicReference<String> finishSituation = new AtomicReference<>("");
finishTaskGroupByType.forEach((TypeCode,TypeList)->{ finishTaskGroupByType.forEach((TypeCode, TypeList) -> {
try{ try {
finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n")); finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
} } catch (NullPointerException e) {
catch(NullPointerException e){
e.printStackTrace(); e.printStackTrace();
} }
}); });
maintenanceReportVO.setCompleteNum(finishTask.size()); maintenanceReportVO.setCompleteNum(finishTask.size());
maintenanceReportVO.setCompleteSituation(finishSituation.get()); maintenanceReportVO.setCompleteSituation(finishSituation.get());
//未完成任务 //未完成任务
List<OperMaintenanceTaskEntity> immatureTask = v.stream().filter(o-> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList()); 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)); Map<String, List<OperMaintenanceTaskEntity>> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
AtomicReference<String> immatureTaskSituation = new AtomicReference<>(""); AtomicReference<String> immatureTaskSituation = new AtomicReference<>("");
immatureTaskTaskGroupByType.forEach((TypeCode,TypeList)->{ immatureTaskTaskGroupByType.forEach((TypeCode, TypeList) -> {
immatureTaskSituation.set(immatureTaskSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n")); immatureTaskSituation.set(immatureTaskSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
}); });
maintenanceReportVO.setIncompleteNum(immatureTask.size()); maintenanceReportVO.setIncompleteNum(immatureTask.size());
maintenanceReportVO.setIncompleteSituation(immatureTaskSituation.get()); maintenanceReportVO.setIncompleteSituation(immatureTaskSituation.get());
//获取问题数量 //获取问题数量
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>(){{ List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
in(OperPhenomenonEntity::getFinder,userIdList); in(OperPhenomenonEntity::getFinder, userIdList);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.RCWH.getStatus()); eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.RCWH.getStatus());
ge(OperPhenomenonEntity::getFindTime,startDate); ge(OperPhenomenonEntity::getFindTime, startDate);
le(OperPhenomenonEntity::getFindTime,endDate); le(OperPhenomenonEntity::getFindTime, endDate);
in(OperPhenomenonEntity::getCreateDept,deptIdList); in(OperPhenomenonEntity::getCreateDept, deptIdList);
}}); }});
maintenanceReportVO.setFindProblemNum(operPhenomenonEntityList.size()); maintenanceReportVO.setFindProblemNum(operPhenomenonEntityList.size());
//获取工时 //获取工时
@ -206,11 +211,11 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
} }
@Override @Override
public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(Map<String,Object> params) { public List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); 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)); LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId"); List<Long> deptIdList = (List<Long>) params.get("deptId");
return getMaintenanceStatisticsByDisposer(startDate,endDate,deptIdList); return getMaintenanceStatisticsByDisposer(startDate, endDate, deptIdList);
} }
@Override @Override
@ -220,27 +225,27 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
@Override @Override
public List<OperMaintenanceTaskEntity> getMaintenanceTask(String startTime, String endTime, List<Long> list) { public List<OperMaintenanceTaskEntity> getMaintenanceTask(String startTime, String endTime, List<Long> list) {
return this.baseMapper.selectMaintenanceTask(startTime,endTime,list); return this.baseMapper.selectMaintenanceTask(startTime, endTime, list);
} }
@Override @Override
@Transactional @Transactional
public R completeTask(OperMaintenanceTaskDTO req, ComleteTask completeTask) { public R completeTask(OperMaintenanceTaskDTO req, ComleteTask completeTask) {
/**如果当前流程为待确认、归档,则从相应角色内获取人员列表完成工作流任务**/ /**如果当前流程为待确认、归档,则从相应角色内获取人员列表完成工作流任务**/
if(req.getStatus() == MaintenanceConstant.TASK_STATUS_3 || req.getStatus() == MaintenanceConstant.TASK_STATUS_4){ 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); R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), req.getCreateDept(), MaintenanceConstant.GROUP_LEADER);
if(!userListR.isSuccess() || CollectionUtil.isEmpty(userListR.getData())){ if (!userListR.isSuccess() || CollectionUtil.isEmpty(userListR.getData())) {
throw new ServiceException("获取"+MaintenanceConstant.GROUP_LEADER+"角色下的用户为空或失败"); throw new ServiceException("获取" + MaintenanceConstant.GROUP_LEADER + "角色下的用户为空或失败");
} }
String leaders = userListR.getData().stream().map(user->"taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); String leaders = userListR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(","));
log.info("获取角色下的人员为:{}",leaders); log.info("获取角色下的人员为:{}", leaders);
if(CollectionUtil.isEmpty(completeTask.getVariables())){ if (CollectionUtil.isEmpty(completeTask.getVariables())) {
completeTask.setVariables(new HashMap<>()); completeTask.setVariables(new HashMap<>());
} }
completeTask.getVariables().put(MaintenanceConstant.GROUP_LEADER,leaders); completeTask.getVariables().put(MaintenanceConstant.GROUP_LEADER, leaders);
} }
R completeR = flowClient.completeTask(completeTask); R completeR = flowClient.completeTask(completeTask);
if(!completeR.isSuccess()){ if (!completeR.isSuccess()) {
throw new ServiceException(completeR.getMsg()); throw new ServiceException(completeR.getMsg());
} }
return R.status(this.updateById(req)); return R.status(this.updateById(req));
@ -249,18 +254,18 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
@Override @Override
@Transactional @Transactional
public R deleteTaskBatch(List<Long> taskIdList) { public R deleteTaskBatch(List<Long> taskIdList) {
taskIdList.forEach(taskId->{ taskIdList.forEach(taskId -> {
/**删除工作流任务**/ /**删除工作流任务**/
EndVo endVo = new EndVo(); EndVo endVo = new EndVo();
if(Func.isEmpty(taskId)){ if (Func.isEmpty(taskId)) {
return; return;
} }
OperMaintenanceTaskEntity taskEntity = this.getById(taskId); OperMaintenanceTaskEntity taskEntity = this.getById(taskId);
if(ObjectUtil.isEmpty(taskEntity) || ObjectUtil.isEmpty(taskEntity.getProcessInstanceId())){ if (ObjectUtil.isEmpty(taskEntity) || ObjectUtil.isEmpty(taskEntity.getProcessInstanceId())) {
return; return;
} }
R r = flowClient.delProcessInstanceById(taskEntity.getProcessInstanceId(),"删除日常维护任务"); R r = flowClient.delProcessInstanceById(taskEntity.getProcessInstanceId(), "删除日常维护任务");
if(!r.isSuccess()){ if (!r.isSuccess()) {
throw new ServiceException(r.getMsg()); throw new ServiceException(r.getMsg());
} }
/**删除任务**/ /**删除任务**/
@ -271,6 +276,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
/** /**
* 获取当班定期工作 * 获取当班定期工作
*
* @param start * @param start
* @param end * @param end
* @param list * @param list
@ -280,22 +286,22 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
public RegularWorkVO getDutyRegularWork(String start, String end, List<Long> list) { public RegularWorkVO getDutyRegularWork(String start, String end, List<Long> list) {
RegularWorkVO regularWorkVO = new RegularWorkVO(); RegularWorkVO regularWorkVO = new RegularWorkVO();
// 查询定期工作任务 // 查询定期工作任务
List<OperMaintenanceTaskEntity> regularWorkList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{ List<OperMaintenanceTaskEntity> regularWorkList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
ge(OperMaintenanceTaskEntity::getDisposeTime,start) ge(OperMaintenanceTaskEntity::getDisposeTime, start)
.le(OperMaintenanceTaskEntity::getDisposeTime,end) .le(OperMaintenanceTaskEntity::getDisposeTime, end)
.eq(OperMaintenanceTaskEntity::getTypeCode,"05") .eq(OperMaintenanceTaskEntity::getTypeCode, "05")
.in(OperMaintenanceTaskEntity::getCreateDept,list); .in(OperMaintenanceTaskEntity::getCreateDept, list);
}}); }});
if(CollectionUtil.isEmpty(regularWorkList)){ if (CollectionUtil.isEmpty(regularWorkList)) {
regularWorkVO.setRegularWorkSum(0); regularWorkVO.setRegularWorkSum(0);
regularWorkVO.setRegularWork(0); regularWorkVO.setRegularWork(0);
return regularWorkVO; return regularWorkVO;
} }
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id->id.toString()).collect(Collectors.joining(","))); regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id -> id.toString()).collect(Collectors.joining(",")));
regularWorkVO.setRegularWorkSum(regularWorkList.size()); regularWorkVO.setRegularWorkSum(regularWorkList.size());
// 定期工作任务完成数量 // 定期工作任务完成数量
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());
if(CollectionUtil.isEmpty(regularWorkFinishList)){ if (CollectionUtil.isEmpty(regularWorkFinishList)) {
regularWorkVO.setRegularWork(0); regularWorkVO.setRegularWork(0);
return regularWorkVO; return regularWorkVO;
} }
@ -305,6 +311,7 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
/** /**
* 获取安全检查日常维护任务 * 获取安全检查日常维护任务
*
* @param startDate 开始时间 * @param startDate 开始时间
* @param endDate 结束时间 * @param endDate 结束时间
* @param dept 机构ID * @param dept 机构ID
@ -314,10 +321,10 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
public SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate, String endDate, Long dept) { public SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate, String endDate, Long dept) {
//获取已完成任务 //获取已完成任务
List<OperMaintenanceTaskEntity> taskEntityList = this.list(Wrappers.<OperMaintenanceTaskEntity>lambdaQuery() List<OperMaintenanceTaskEntity> taskEntityList = this.list(Wrappers.<OperMaintenanceTaskEntity>lambdaQuery()
.eq(OperMaintenanceTaskEntity::getStatus,MaintenanceConstant.TASK_STATUS_5) .eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_5)
.eq(OperMaintenanceTaskEntity::getCreateDept,dept) .eq(OperMaintenanceTaskEntity::getCreateDept, dept)
.ge(OperMaintenanceTaskEntity::getDisposeTime,startDate) .ge(OperMaintenanceTaskEntity::getDisposeTime, startDate)
.le(OperMaintenanceTaskEntity::getDisposeTime,endDate) .le(OperMaintenanceTaskEntity::getDisposeTime, endDate)
); );
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
vo.setProjectType(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getType()); vo.setProjectType(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getType());
@ -325,4 +332,59 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
vo.setTotal(taskEntityList.size()); vo.setTotal(taskEntityList.size());
return vo; 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.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; 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.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.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService; import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
@ -19,6 +20,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
@ -115,12 +117,13 @@ public class StandardTicketInfoController extends BladeController {
* @return * @return
*/ */
@GetMapping("/areaMonthlyWithOperation/{page}/{size}") @GetMapping("/areaMonthlyWithOperation/{page}/{size}")
public R<IPage<StandardTicketVo>> areaMonthlyWithOperation( public R<BladePage<StandardTicketVo>> areaMonthlyWithOperation(
@PathVariable("page") Long page, @PathVariable("page") Long page,
@PathVariable("size") Long size, @PathVariable("size") Long size,
@SpringQueryMap AreaMonthlyVo areaMonthlyVo) { @SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) {
Page<StandardTicketInfoEntity> searchPage = new Page<>(page, size); Page<StandardTicketInfoEntity> searchPage = new Page<>(page, size);
IPage<StandardTicketVo> standardTicketInfoEntity =
BladePage<StandardTicketVo> standardTicketInfoEntity =
standardTicketInfoService.areaMonthlyWithOperation(areaMonthlyVo, searchPage); standardTicketInfoService.areaMonthlyWithOperation(areaMonthlyVo, searchPage);
return R.data(standardTicketInfoEntity); 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; 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.AreaMonthlyVo;
import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO; import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import org.springblade.core.mp.base.BaseService; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
@ -105,6 +107,6 @@ public interface IStandardTicketInfoService extends BaseService<StandardTicketIn
* @param searchPage * @param searchPage
* @return * @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.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzims.ticket.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.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.constants.TicketConstants;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketMeasureDto; 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.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; 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.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.vo.ComleteTask; 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.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -55,10 +61,7 @@ import java.time.LocalDateTime;
import java.time.YearMonth; import java.time.YearMonth;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -319,16 +322,31 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/** /**
* 根据区域Id 分页查询 * 根据区域Id 分页查询
* *
* @param areaMonthly * @param areaVo
* @param searchPage * @param searchPage
* @return * @return
*/ */
@Override @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<StandardTicketInfoEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CREATE_DEPT", areaMonthly.getAreaId()); //开票来源
queryWrapper.eq(areaMonthly.getYearMonth() != null, queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), StandardTicketInfoEntity::getTaskType,
"date_format(create_time,'%Y-%m')", areaMonthly.getYearMonth()); 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); Page<StandardTicketInfoEntity> standardTicketInfoEntityPage = baseMapper.selectPage(searchPage, queryWrapper);
//数据转换StandardTicketInfoEntity ==> StandardTicketVo //数据转换StandardTicketInfoEntity ==> StandardTicketVo
List<StandardTicketVo> standardTicketInfoVOList = new ArrayList<>(); List<StandardTicketVo> standardTicketInfoVOList = new ArrayList<>();
@ -336,6 +354,17 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
standardTicketInfoVOList = standardTicketInfoEntityPage.getRecords().stream().map(item -> { standardTicketInfoVOList = standardTicketInfoEntityPage.getRecords().stream().map(item -> {
StandardTicketVo standardTicketVo = new StandardTicketVo(); StandardTicketVo standardTicketVo = new StandardTicketVo();
BeanUtils.copyProperties(item, 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; return standardTicketVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@ -344,7 +373,10 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
page.setCurrent(standardTicketInfoEntityPage.getCurrent()); page.setCurrent(standardTicketInfoEntityPage.getCurrent());
page.setTotal(standardTicketInfoEntityPage.getTotal()); page.setTotal(standardTicketInfoEntityPage.getTotal());
page.setRecords(standardTicketInfoVOList); page.setRecords(standardTicketInfoVOList);
return page;
BladePage<StandardTicketVo> bladePage = BladePage.of(page);
return bladePage;
} }
/** /**

67
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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.invalid.DictInvalid; import com.hnac.hzims.common.invalid.DictInvalid;
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; import com.hnac.hzims.common.invalid.ObjectRequiredInvalid;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; 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.constants.DictConstants;
import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto; import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkInfoFlowDto; import com.hnac.hzims.ticket.workTicket.dto.WorkInfoFlowDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; 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.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.log.annotation.ApiLog; 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.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -27,6 +33,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -39,7 +46,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("/workTicketInfo") @RequestMapping("/workTicketInfo")
@Api(value = "工作票管理",tags = "工作票管理") @Api(value = "工作票管理", tags = "工作票管理")
@AllArgsConstructor @AllArgsConstructor
@Validated @Validated
public class WorkTicketInfoController { public class WorkTicketInfoController {
@ -51,8 +58,8 @@ public class WorkTicketInfoController {
@GetMapping("/remove") @GetMapping("/remove")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
@ApiOperation(value = "逻辑删除") @ApiOperation(value = "逻辑删除")
public R remove(@RequestParam Long id,@RequestParam String comment) { public R remove(@RequestParam Long id, @RequestParam String comment) {
return workTicketInfoService.remove(id,comment); return workTicketInfoService.remove(id, comment);
} }
/** /**
@ -92,8 +99,8 @@ public class WorkTicketInfoController {
@PostMapping("/queryList") @PostMapping("/queryList")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页") @ApiOperation(value = "分页")
@OperationAnnotation(moduleName = "两票管理",title = "工作票" @OperationAnnotation(moduleName = "两票管理", title = "工作票"
,operatorType = OperatorType.MOBILE,businessType = , operatorType = OperatorType.MOBILE, businessType =
BusinessType.GENCODE, BusinessType.GENCODE,
action = "分页") action = "分页")
public R<IPage<WorkTicketInfoVO>> queryList(WorkTicketInfoDto req, Query query) { public R<IPage<WorkTicketInfoVO>> queryList(WorkTicketInfoDto req, Query query) {
@ -102,26 +109,26 @@ public class WorkTicketInfoController {
@GetMapping(value = "/exportWorkTicketInfoPdf") @GetMapping(value = "/exportWorkTicketInfoPdf")
@ApiOperationSupport(order = 60) @ApiOperationSupport(order = 60)
@ApiImplicitParam(name = "req",value = "工作票dto对象,导出传参id进入即可") @ApiImplicitParam(name = "req", value = "工作票dto对象,导出传参id进入即可")
@ApiOperation(value = "导出工作票pdf文档") @ApiOperation(value = "导出工作票pdf文档")
public void exportWorkTicketInfoPdf(@RequestParam Long id, HttpServletResponse response){ public void exportWorkTicketInfoPdf(@RequestParam Long id, HttpServletResponse response) {
workTicketInfoService.exportWorkTicketInfoPdf(id,response); workTicketInfoService.exportWorkTicketInfoPdf(id, response);
} }
@GetMapping(value = "/exportWorkTicketTemplate") @GetMapping(value = "/exportWorkTicketTemplate")
@ApiOperationSupport(order = 80) @ApiOperationSupport(order = 80)
@ApiImplicitParam(name = "req",value = "工作票dto对象,导出传参id进入即可") @ApiImplicitParam(name = "req", value = "工作票dto对象,导出传参id进入即可")
@ApiOperation(value = "导出工作票pdf模板") @ApiOperation(value = "导出工作票pdf模板")
public void exportWorkTicketTemplate(@RequestParam Long id, HttpServletResponse response){ public void exportWorkTicketTemplate(@RequestParam Long id, HttpServletResponse response) {
workTicketInfoService.exportWorkTicketTemplate(id,response); workTicketInfoService.exportWorkTicketTemplate(id, response);
} }
@PostMapping("/completeTask") @PostMapping("/completeTask")
@ApiOperationSupport(order = 70) @ApiOperationSupport(order = 70)
@ApiOperation(value = "执行工作流任务") @ApiOperation(value = "执行工作流任务")
public R completeTask(@RequestBody @ObjectRequiredInvalid(attributes = {"req.id","req.status","flow.processInstanceId","flow.taskId","flow.flag"}) 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){ @DictInvalid(dictKey = DictConstants.FIRST_TICKET_FLOW, attribute = "req.status") WorkInfoFlowDto workInfoFlowDto) {
return workTicketInfoService.completeTask(workInfoFlowDto.getReq(),workInfoFlowDto.getFlow()); return workTicketInfoService.completeTask(workInfoFlowDto.getReq(), workInfoFlowDto.getFlow());
} }
@PostMapping("/finishOfflineTicket") @PostMapping("/finishOfflineTicket")
@ -149,29 +156,45 @@ public class WorkTicketInfoController {
@GetMapping("/userListByRoleAlias") @GetMapping("/userListByRoleAlias")
@ApiOperationSupport(order = 100) @ApiOperationSupport(order = 100)
@OperationAnnotation(moduleName = "两票管理", @OperationAnnotation(moduleName = "两票管理",
title = "两票管理(工作票)",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, title = "两票管理(工作票)", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "获取某机构下角色的人员列表") action = "获取某机构下角色的人员列表")
@ApiOperation(value = "获取某机构下角色的人员列表") @ApiOperation(value = "获取某机构下角色的人员列表")
public R userListByRoleAlias(@RequestParam("roleAlias") @ApiParam("角色别称") String roleAlias) { public R userListByRoleAlias(@RequestParam("roleAlias") @ApiParam("角色别称") String roleAlias) {
IUserClient userClient = SpringUtil.getBean(IUserClient.class); IUserClient userClient = SpringUtil.getBean(IUserClient.class);
final String ADMIN = "admin"; final String ADMIN = "admin";
//当账号为管理员时 查询出租户200000下所有角色成员 //当账号为管理员时 查询出租户200000下所有角色成员
if(StringUtil.isNotBlank(AuthUtil.getDeptId()) && ADMIN.equalsIgnoreCase(AuthUtil.getUserAccount())){ if (StringUtil.isNotBlank(AuthUtil.getDeptId()) && ADMIN.equalsIgnoreCase(AuthUtil.getUserAccount())) {
return userClient.userListByRoleAlias(AuthUtil.getTenantId(),roleAlias); return userClient.userListByRoleAlias(AuthUtil.getTenantId(), roleAlias);
} }
//获取当前用户权限下的用户列表 //获取当前用户权限下的用户列表
return userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),Long.parseLong(AuthUtil.getDeptId()),roleAlias); return userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), Long.parseLong(AuthUtil.getDeptId()), roleAlias);
} }
@GetMapping("/verificationRole") @GetMapping("/verificationRole")
@ApiOperationSupport(order = 110) @ApiOperationSupport(order = 110)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "deptId",value = "机构ID",dataType = "Long",paramType = "path"), @ApiImplicitParam(name = "deptId", value = "机构ID", dataType = "Long", paramType = "path"),
@ApiImplicitParam(name = "roleAliasArray",value = "角色别称 按,分隔",dataType = "String",paramType = "path") @ApiImplicitParam(name = "roleAliasArray", value = "角色别称 按,分隔", dataType = "String", paramType = "path")
}) })
@ApiOperation(value = "验证某机构下的角色是否能查询到相关人员") @ApiOperation(value = "验证某机构下的角色是否能查询到相关人员")
public R<Map<String,Object>> verificationRole(@RequestParam("deptId") Long deptId,@RequestParam("roleAliasArray") String roleAliasArray ) { public R<Map<String, Object>> verificationRole(@RequestParam("deptId") Long deptId, @RequestParam("roleAliasArray") String roleAliasArray) {
return workTicketInfoService.verificationRole(deptId,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; package com.hnac.hzims.ticket.workTicket.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.TicketAccessTaskDto;
import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import org.springblade.core.mp.base.BaseService; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.flow.core.entity.BladeFlow; 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); R<Map<String,Object>> verificationRole(Long deptId, String roleAliasArray);
/**
* 根据月份和区域查询工作票列表详情
* @param pageEntity
* @param standardTicketWithAreaVo
* @return
*/
BladePage<StandardWorkVo> workTicketListByMonthAndArea(Page<WorkTicketInfoEntity> pageEntity, StandardTicketWithAreaVo standardTicketWithAreaVo);
} }

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

@ -4,14 +4,19 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.feign.ITaskClient; import com.hnac.hzims.operational.maintenance.feign.ITaskClient;
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.aspect.AroundFlow; import com.hnac.hzims.ticket.aspect.AroundFlow;
import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.utils.ExcelUtil; import com.hnac.hzims.ticket.utils.ExcelUtil;
@ -29,10 +34,12 @@ import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketInfoWrapper;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import lombok.var;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
@ -43,6 +50,7 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@ -86,10 +94,10 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
private final IOperAccessTaskClient operAccessTaskClient; private final IOperAccessTaskClient operAccessTaskClient;
private final ITaskClient taskClient; private final ITaskClient taskClient;
/**生成两票编号锁**/ /** 生成两票编号锁 **/
private Lock lock = new ReentrantLock(); private Lock lock = new ReentrantLock();
/**word模板预览导出保存路径**/ /** word模板预览导出保存路径 **/
@Value("${hzims.ticket.path.xlsx.savePath}") @Value("${hzims.ticket.path.xlsx.savePath}")
private String xlsSavePath; private String xlsSavePath;
@ -110,22 +118,22 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
req.setStatus(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers()) ? TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus() : TicketConstants.FirstWorkTicketFlowStatusEnum.SIGN.getStatus()); req.setStatus(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers()) ? TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus() : TicketConstants.FirstWorkTicketFlowStatusEnum.SIGN.getStatus());
boolean flag = this.save(req); boolean flag = this.save(req);
/**保存安全措施**/ /**保存安全措施**/
if(flag && CollectionUtil.isNotEmpty(req.getWorkTicketSafetyMeasureDtoList())){ if (flag && CollectionUtil.isNotEmpty(req.getWorkTicketSafetyMeasureDtoList())) {
req.getWorkTicketSafetyMeasureDtoList().forEach(workTicketSafetyMeasureDto -> { req.getWorkTicketSafetyMeasureDtoList().forEach(workTicketSafetyMeasureDto -> {
workTicketSafetyMeasureDto.setTicketId(req.getId()); workTicketSafetyMeasureDto.setTicketId(req.getId());
workTicketSafetyMeasureService.save(workTicketSafetyMeasureDto); workTicketSafetyMeasureService.save(workTicketSafetyMeasureDto);
}); });
} }
if(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers())){ if (Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers())) {
//将票据ID会传至计划/任务内 //将票据ID会传至计划/任务内
returnTicket(req); returnTicket(req);
return R.success("开票成功!该票走线下未开启流程"); return R.success("开票成功!该票走线下未开启流程");
} }
/**开启工作流**/ /**开启工作流**/
BladeFlow bladeFlow = this.startProcessInstance(firstWorkTicketFlowKey,req); BladeFlow bladeFlow = this.startProcessInstance(firstWorkTicketFlowKey, req);
this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getProcessInstanceId,bladeFlow.getProcessInstanceId()) .set(WorkTicketInfoEntity::getProcessInstanceId, bladeFlow.getProcessInstanceId())
.eq(WorkTicketInfoEntity::getId,req.getId())); .eq(WorkTicketInfoEntity::getId, req.getId()));
//将票据ID会传至计划/任务内 //将票据ID会传至计划/任务内
returnTicket(req); returnTicket(req);
return R.success("保存成功"); return R.success("保存成功");
@ -133,32 +141,33 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/** /**
* 工作票延期 进入许可人确认工作票延期 * 工作票延期 进入许可人确认工作票延期
*
* @param ticketId 工作票ID * @param ticketId 工作票ID
* @param status 状态 * @param status 状态
* @param completeTask 工作流进行 * @param completeTask 工作流进行
*/ */
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void delay(Long ticketId, Integer status,ComleteTask completeTask) { public void delay(Long ticketId, Integer status, ComleteTask completeTask) {
//新增延期信息 //新增延期信息
Assert.notNull(completeTask.getVariables().get("delay"),"延期信息不能为空"); Assert.notNull(completeTask.getVariables().get("delay"), "延期信息不能为空");
WorkTicketDelayEntity delayEntity = (WorkTicketDelayEntity) completeTask.getVariables().get("delay"); WorkTicketDelayEntity delayEntity = (WorkTicketDelayEntity) completeTask.getVariables().get("delay");
delayService.save(delayEntity); delayService.save(delayEntity);
//更新负责人确认执行情况流程 填充信息 //更新负责人确认执行情况流程 填充信息
WorkTicketFlowEntity workTicketFlowEntity = workTicketFlowService.getOne(Wrappers.<WorkTicketFlowEntity>lambdaQuery() WorkTicketFlowEntity workTicketFlowEntity = workTicketFlowService.getOne(Wrappers.<WorkTicketFlowEntity>lambdaQuery()
.eq(WorkTicketFlowEntity::getTicketId,ticketId) .eq(WorkTicketFlowEntity::getTicketId, ticketId)
.eq(WorkTicketFlowEntity::getFlowCode,TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()) .eq(WorkTicketFlowEntity::getFlowCode, TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus())
.orderByDesc(WorkTicketFlowEntity::getCreateTime) .orderByDesc(WorkTicketFlowEntity::getCreateTime)
.last("limit 1;") .last("limit 1;")
); );
workTicketFlowService.update(Wrappers.<WorkTicketFlowEntity>lambdaUpdate() workTicketFlowService.update(Wrappers.<WorkTicketFlowEntity>lambdaUpdate()
.set(WorkTicketFlowEntity::getExecutor,AuthUtil.getUserId().toString()) .set(WorkTicketFlowEntity::getExecutor, AuthUtil.getUserId().toString())
.set(WorkTicketFlowEntity::getExecuteTime,LocalDateTime.now()) .set(WorkTicketFlowEntity::getExecuteTime, LocalDateTime.now())
.eq(WorkTicketFlowEntity::getId,workTicketFlowEntity.getId()) .eq(WorkTicketFlowEntity::getId, workTicketFlowEntity.getId())
); );
//更新工作票状态 //更新工作票状态
this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getStatus,status) .set(WorkTicketInfoEntity::getStatus, status)
.eq(WorkTicketInfoEntity::getId,ticketId) .eq(WorkTicketInfoEntity::getId, ticketId)
); );
//创建延期流程 //创建延期流程
WorkTicketInfoEntity infoEntity = this.getById(ticketId); WorkTicketInfoEntity infoEntity = this.getById(ticketId);
@ -170,7 +179,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
workTicketFlowService.save(workTicketFlowEntity); workTicketFlowService.save(workTicketFlowEntity);
//进入工作流下一步 //进入工作流下一步
R result = flowClient.completeTask(completeTask); R result = flowClient.completeTask(completeTask);
if(!result.isSuccess()){ if (!result.isSuccess()) {
throw new ServiceException("执行工作流失败"); throw new ServiceException("执行工作流失败");
} }
} }
@ -178,10 +187,9 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
@Override @Override
public R<WorkTicketInfoVO> detail(Long id) { public R<WorkTicketInfoVO> detail(Long id) {
WorkTicketInfoEntity workTicketInfoEntity = this.getById(id); WorkTicketInfoEntity workTicketInfoEntity = this.getById(id);
if(ObjectUtil.isEmpty(workTicketInfoEntity)){ if (ObjectUtil.isEmpty(workTicketInfoEntity)) {
return R.fail("未查询到该ID对应的记录"); return R.fail("未查询到该ID对应的记录");
} } else {
else{
WorkTicketInfoVO workTicketInfoVO = WorkTicketInfoWrapper.build().entityVO(workTicketInfoEntity); WorkTicketInfoVO workTicketInfoVO = WorkTicketInfoWrapper.build().entityVO(workTicketInfoEntity);
/**获取工作票安全措施列表**/ /**获取工作票安全措施列表**/
@ -217,11 +225,11 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/**获取工作票延期列表**/ /**获取工作票延期列表**/
WorkTicketDelayDto workTicketDelayDto = new WorkTicketDelayDto(); WorkTicketDelayDto workTicketDelayDto = new WorkTicketDelayDto();
workTicketDelayDto.setTicketId(id); workTicketDelayDto.setTicketId(id);
List<WorkTicketDelayEntity> workTicketDelayList = workDelayNoScopeMapper.selectList(new LambdaQueryWrapper<WorkTicketDelayEntity>(){{ List<WorkTicketDelayEntity> workTicketDelayList = workDelayNoScopeMapper.selectList(new LambdaQueryWrapper<WorkTicketDelayEntity>() {{
eq(WorkTicketDelayEntity::getTicketId,id); eq(WorkTicketDelayEntity::getTicketId, id);
eq(WorkTicketDelayEntity::getIsDeleted,0L); eq(WorkTicketDelayEntity::getIsDeleted, 0L);
}}); }});
if(CollectionUtil.isNotEmpty(workTicketDelayList)){ if (CollectionUtil.isNotEmpty(workTicketDelayList)) {
workTicketInfoVO.setWorkTicketDelayVOList(WorkTicketDelayWrapper.build().listVO(workTicketDelayList)); workTicketInfoVO.setWorkTicketDelayVOList(WorkTicketDelayWrapper.build().listVO(workTicketDelayList));
} }
@ -233,7 +241,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
public R<IPage<WorkTicketInfoVO>> queryList(WorkTicketInfoDto req, Query query) { public R<IPage<WorkTicketInfoVO>> queryList(WorkTicketInfoDto req, Query query) {
LambdaQueryWrapper<WorkTicketInfoEntity> lqw = this.getQueryWrapper(req); LambdaQueryWrapper<WorkTicketInfoEntity> lqw = this.getQueryWrapper(req);
lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime); lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime);
IPage pages = super.page(Condition.getPage(query),lqw); IPage pages = super.page(Condition.getPage(query), lqw);
pages.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords())); pages.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords()));
return R.data(pages); return R.data(pages);
} }
@ -247,89 +255,85 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
@Override @Override
@Transactional @Transactional
public R remove(Long id,String comment) { public R remove(Long id, String comment) {
WorkTicketInfoEntity entity = this.getById(id); WorkTicketInfoEntity entity = this.getById(id);
if(ObjectUtil.isEmpty(entity)){ if (ObjectUtil.isEmpty(entity)) {
return R.fail(400,"删除失败!未查询到相关记录"); return R.fail(400, "删除失败!未查询到相关记录");
} }
boolean flag = this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() boolean flag = this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()) .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus())
.eq(WorkTicketInfoEntity::getId,id)); .eq(WorkTicketInfoEntity::getId, id));
/**线下单独删除**/ /**线下单独删除**/
if(TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())){ if (TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())) {
return R.status(flag); return R.status(flag);
} }
/**终止工作流**/ /**终止工作流**/
R<Boolean> r = flowClient.delProcessInstanceById(entity.getProcessInstanceId(),comment); R<Boolean> r = flowClient.delProcessInstanceById(entity.getProcessInstanceId(), comment);
if(!r.isSuccess()){ if (!r.isSuccess()) {
throw new ServiceException("终止工作流失败!"); throw new ServiceException("终止工作流失败!");
} }
return R.success("删除成功!"); return R.success("删除成功!");
} }
@Override @Override
public void exportWorkTicketTemplate(Long id, HttpServletResponse response){ public void exportWorkTicketTemplate(Long id, HttpServletResponse response) {
exportWorkTicketInfoPdf(id,response); exportWorkTicketInfoPdf(id, response);
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void exportWorkTicketInfoPdf(Long id, HttpServletResponse response) { public void exportWorkTicketInfoPdf(Long id, HttpServletResponse response) {
R<WorkTicketInfoVO> workTicketInfoVOR = this.detail(id); R<WorkTicketInfoVO> workTicketInfoVOR = this.detail(id);
if(!workTicketInfoVOR.isSuccess()){ if (!workTicketInfoVOR.isSuccess()) {
log.error("未查询到相关工作票记录!"); log.error("未查询到相关工作票记录!");
return; return;
} }
WorkTicketInfoVO workTicketInfoVO = workTicketInfoVOR.getData(); WorkTicketInfoVO workTicketInfoVO = workTicketInfoVOR.getData();
//将workTicketInfoVO封装进Map,以便pdf导出 //将workTicketInfoVO封装进Map,以便pdf导出
Map<String,Object> workTicketInfoMap = new HashMap<>(); Map<String, Object> workTicketInfoMap = new HashMap<>();
try { try {
workTicketInfoMap = PdfUtils.objectToMap(workTicketInfoVO); workTicketInfoMap = PdfUtils.objectToMap(workTicketInfoVO);
} } catch (Exception e) {
catch (Exception e) {
log.info("转换对象失败!"); log.info("转换对象失败!");
} }
//安全措施 //安全措施
if(CollectionUtil.isNotEmpty(workTicketInfoVO.getWorkTicketSafetyMeasureVOList())){ if (CollectionUtil.isNotEmpty(workTicketInfoVO.getWorkTicketSafetyMeasureVOList())) {
Map<String,List<WorkTicketSafetyMeasureVO>> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream() Map<String, List<WorkTicketSafetyMeasureVO>> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream()
.collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType)); .collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType));
if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))){ if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))) {
workTicketInfoMap.put("matterLibraryListOne",measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure-> { workTicketInfoMap.put("matterLibraryListOne", measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure -> {
Map<String,Object> map = PdfUtils.objectToMap(measure); Map<String, Object> map = PdfUtils.objectToMap(measure);
map.put("safetyMeasure",ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null);
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " ";
map.put("status",status); map.put("status", status);
return map; return map;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} else {
workTicketInfoMap.put("matterLibraryListOne", new ArrayList<Map<String, String>>(1));
} }
else { if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_TWO))) {
workTicketInfoMap.put("matterLibraryListOne", new ArrayList<Map<String,String>>(1)); workTicketInfoMap.put("matterLibraryListTwo", measureMap.get(TicketConstants.MEASURE_TYPE_TWO).stream().map(measure -> {
} Map<String, Object> map = PdfUtils.objectToMap(measure);
if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_TWO))){ map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null);
workTicketInfoMap.put("matterLibraryListTwo",measureMap.get(TicketConstants.MEASURE_TYPE_TWO).stream().map(measure-> {
Map<String,Object> map = PdfUtils.objectToMap(measure);
map.put("safetyMeasure",ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null);
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " ";
map.put("status",status); map.put("status", status);
return map; return map;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} else {
workTicketInfoMap.put("matterLibraryListTwo", new ArrayList<Map<String, String>>(1));
} }
else { if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_THREE))) {
workTicketInfoMap.put("matterLibraryListTwo", new ArrayList<Map<String,String>>(1)); workTicketInfoMap.put("matterLibraryListThree", measureMap.get(TicketConstants.MEASURE_TYPE_THREE).stream().map(measure -> {
} Map<String, Object> map = PdfUtils.objectToMap(measure);
if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_THREE))){ map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null);
workTicketInfoMap.put("matterLibraryListThree",measureMap.get(TicketConstants.MEASURE_TYPE_THREE).stream().map(measure-> {
Map<String,Object> map = PdfUtils.objectToMap(measure);
map.put("safetyMeasure",ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null);
String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " ";
map.put("status",status); map.put("status", status);
return map; return map;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} } else {
else { workTicketInfoMap.put("matterLibraryListThree", new ArrayList<Map<String, String>>(1));
workTicketInfoMap.put("matterLibraryListThree", new ArrayList<Map<String,String>>(1));
} }
} }
//线下开票确认人为空 //线下开票确认人为空
@ -338,73 +342,67 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
List<WorkTicketFlowVO> workTicketFlowVOList = workTicketInfoVO.getWorkTicketFlowVOList(); List<WorkTicketFlowVO> workTicketFlowVOList = workTicketInfoVO.getWorkTicketFlowVOList();
//签发 //签发
List<WorkTicketFlowVO> signFlow = workTicketFlowVOList.stream() List<WorkTicketFlowVO> signFlow = workTicketFlowVOList.stream()
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(signFlow)){ if (CollectionUtil.isNotEmpty(signFlow)) {
workTicketInfoMap.put("signer",signFlow.get(0).getCreateUserName()); workTicketInfoMap.put("signer", signFlow.get(0).getCreateUserName());
workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN));
} } else {
else {
workTicketInfoMap.put("signer", ""); workTicketInfoMap.put("signer", "");
workTicketInfoMap.put("signTime", ""); workTicketInfoMap.put("signTime", "");
} }
//许可人许可 //许可人许可
if(Func.isNotEmpty(workTicketInfoVO.getLicenseTime())){ if (Func.isNotEmpty(workTicketInfoVO.getLicenseTime())) {
workTicketInfoMap.put("licensorConfirm",workTicketInfoVO.getLicensorName()); workTicketInfoMap.put("licensorConfirm", workTicketInfoVO.getLicensorName());
workTicketInfoMap.put("licenseTime", DateUtil.format(workTicketInfoVO.getLicenseTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("licenseTime", DateUtil.format(workTicketInfoVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN));
} } else {
else {
workTicketInfoMap.put("licensorConfirm", ""); workTicketInfoMap.put("licensorConfirm", "");
workTicketInfoMap.put("licenseTime", ""); workTicketInfoMap.put("licenseTime", "");
} }
/**负责人收到工作票**/ /**负责人收到工作票**/
List<WorkTicketFlowVO> receiveFlow = workTicketFlowVOList.stream() List<WorkTicketFlowVO> receiveFlow = workTicketFlowVOList.stream()
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(receiveFlow)){ if (CollectionUtil.isNotEmpty(receiveFlow)) {
workTicketInfoMap.put("receivePrincipal",receiveFlow.get(0).getCreateUserName()); workTicketInfoMap.put("receivePrincipal", receiveFlow.get(0).getCreateUserName());
workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN));
workTicketInfoMap.put("principalConfirm",workTicketInfoVO.getPrincipalName()); workTicketInfoMap.put("principalConfirm", workTicketInfoVO.getPrincipalName());
} } else {
else{ workTicketInfoMap.put("receivePrincipal", "");
workTicketInfoMap.put("receivePrincipal","");
workTicketInfoMap.put("receiveTime", ""); workTicketInfoMap.put("receiveTime", "");
workTicketInfoMap.put("principalConfirm",""); workTicketInfoMap.put("principalConfirm", "");
} }
/**负责人确认安全事项**/ /**负责人确认安全事项**/
List<WorkTicketFlowVO> confirmFlow = workTicketFlowVOList.stream() List<WorkTicketFlowVO> confirmFlow = workTicketFlowVOList.stream()
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(confirmFlow)){ if (CollectionUtil.isNotEmpty(confirmFlow)) {
workTicketInfoMap.put("confirmPrincipal",confirmFlow.get(0).getCreateUserName()); workTicketInfoMap.put("confirmPrincipal", confirmFlow.get(0).getCreateUserName());
workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN));
} } else {
else{ workTicketInfoMap.put("confirmPrincipal", "");
workTicketInfoMap.put("confirmPrincipal","");
workTicketInfoMap.put("confirmTime", ""); workTicketInfoMap.put("confirmTime", "");
} }
/**工作结束**/ /**工作结束**/
List<WorkTicketFlowVO> finishFlow = workTicketFlowVOList.stream() List<WorkTicketFlowVO> finishFlow = workTicketFlowVOList.stream()
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(finishFlow)){ if (CollectionUtil.isNotEmpty(finishFlow)) {
workTicketInfoMap.put("finisher",finishFlow.get(0).getCreateUserName()); workTicketInfoMap.put("finisher", finishFlow.get(0).getCreateUserName());
workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN));
workTicketInfoMap.put("principalFinish",workTicketInfoVO.getPrincipalName()); workTicketInfoMap.put("principalFinish", workTicketInfoVO.getPrincipalName());
} } else {
else { workTicketInfoMap.put("finisher", "");
workTicketInfoMap.put("finisher","");
workTicketInfoMap.put("finishTime", ""); workTicketInfoMap.put("finishTime", "");
workTicketInfoMap.put("principalFinish",""); workTicketInfoMap.put("principalFinish", "");
} }
/**工作终结**/ /**工作终结**/
List<WorkTicketFlowVO> endFlow = workTicketFlowVOList.stream() List<WorkTicketFlowVO> endFlow = workTicketFlowVOList.stream()
.filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(endFlow)){ if (CollectionUtil.isNotEmpty(endFlow)) {
workTicketInfoMap.put("endLicensor",endFlow.get(0).getCreateUserName()); workTicketInfoMap.put("endLicensor", endFlow.get(0).getCreateUserName());
workTicketInfoMap.put("endTime", DateUtil.format(endFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("endTime", DateUtil.format(endFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN));
workTicketInfoMap.put("groundSwitchCount",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundSwitchCount()) ? endFlow.get(0).getGroundSwitchCount() : ""); workTicketInfoMap.put("groundSwitchCount", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundSwitchCount()) ? endFlow.get(0).getGroundSwitchCount() : "");
workTicketInfoMap.put("groundWireCode",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCode()) ? endFlow.get(0).getGroundWireCode() : ""); workTicketInfoMap.put("groundWireCode", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCode()) ? endFlow.get(0).getGroundWireCode() : "");
workTicketInfoMap.put("groundWireCount",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCount()) ? endFlow.get(0).getGroundWireCount() : ""); workTicketInfoMap.put("groundWireCount", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCount()) ? endFlow.get(0).getGroundWireCount() : "");
} } else {
else {
workTicketInfoMap.put("endLicensor", ""); workTicketInfoMap.put("endLicensor", "");
workTicketInfoMap.put("endTime", ""); workTicketInfoMap.put("endTime", "");
workTicketInfoMap.put("groundSwitchCount", ""); workTicketInfoMap.put("groundSwitchCount", "");
@ -413,13 +411,12 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
} }
/**负责人变更**/ /**负责人变更**/
List<WorkTicketPrincipalChangeVO> workTicketPrincipalChangeVOList = workTicketInfoVO.getWorkTicketPrincipalChangeVOList(); List<WorkTicketPrincipalChangeVO> workTicketPrincipalChangeVOList = workTicketInfoVO.getWorkTicketPrincipalChangeVOList();
if(CollectionUtil.isNotEmpty(workTicketPrincipalChangeVOList)){ if (CollectionUtil.isNotEmpty(workTicketPrincipalChangeVOList)) {
workTicketInfoMap.put("initPrincipal",workTicketPrincipalChangeVOList.get(0).getInitialPrincipalName()); workTicketInfoMap.put("initPrincipal", workTicketPrincipalChangeVOList.get(0).getInitialPrincipalName());
workTicketInfoMap.put("changePrincipal",workTicketPrincipalChangeVOList.get(0).getChangePrincipalName()); workTicketInfoMap.put("changePrincipal", workTicketPrincipalChangeVOList.get(0).getChangePrincipalName());
workTicketInfoMap.put("principalChangeSigner",workTicketPrincipalChangeVOList.get(0).getCreateUserName()); workTicketInfoMap.put("principalChangeSigner", workTicketPrincipalChangeVOList.get(0).getCreateUserName());
workTicketInfoMap.put("principalChangeTime", DateUtil.format(workTicketPrincipalChangeVOList.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("principalChangeTime", DateUtil.format(workTicketPrincipalChangeVOList.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN));
} } else {
else {
workTicketInfoMap.put("initPrincipal", ""); workTicketInfoMap.put("initPrincipal", "");
workTicketInfoMap.put("changePrincipal", ""); workTicketInfoMap.put("changePrincipal", "");
workTicketInfoMap.put("principalChangeSigner", ""); workTicketInfoMap.put("principalChangeSigner", "");
@ -427,28 +424,26 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
} }
/**工作成员变更**/ /**工作成员变更**/
List<WorkTicketMembersChangeVO> membersChangeList = workTicketInfoVO.getWorkTicketMembersChangeVOList(); List<WorkTicketMembersChangeVO> membersChangeList = workTicketInfoVO.getWorkTicketMembersChangeVOList();
if(CollectionUtil.isNotEmpty(membersChangeList)){ if (CollectionUtil.isNotEmpty(membersChangeList)) {
/**工作成员变更详情**/ /**工作成员变更详情**/
String membersChangeSituation = membersChangeList.stream().map(mc -> String membersChangeSituation = membersChangeList.stream().map(mc ->
DateUtil.format(mc.getCreateTime(),TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); DateUtil.format(mc.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";"));
workTicketInfoMap.put("membersChangeSituation",membersChangeSituation); workTicketInfoMap.put("membersChangeSituation", membersChangeSituation);
workTicketInfoMap.put("memberChangePrincipal",membersChangeList.get(0).getCreateUserName()); workTicketInfoMap.put("memberChangePrincipal", membersChangeList.get(0).getCreateUserName());
} } else {
else {
workTicketInfoMap.put("membersChangeSituation", ""); workTicketInfoMap.put("membersChangeSituation", "");
workTicketInfoMap.put("memberChangePrincipal", ""); workTicketInfoMap.put("memberChangePrincipal", "");
} }
/**工作票延期**/ /**工作票延期**/
List<WorkTicketDelayVO> workTicketDelayVOList = workTicketInfoVO.getWorkTicketDelayVOList(); List<WorkTicketDelayVO> workTicketDelayVOList = workTicketInfoVO.getWorkTicketDelayVOList();
if(CollectionUtil.isNotEmpty(workTicketDelayVOList)){ if (CollectionUtil.isNotEmpty(workTicketDelayVOList)) {
WorkTicketDelayVO workTicketDelayVO = workTicketDelayVOList.get(0); WorkTicketDelayVO workTicketDelayVO = workTicketDelayVOList.get(0);
workTicketInfoMap.put("delayTime",DateUtil.format(workTicketDelayVO.getChangeTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("delayTime", DateUtil.format(workTicketDelayVO.getChangeTime(), TicketConstants.TICKET_DATE_PATTERN));
workTicketInfoMap.put("delayPrincipal",workTicketDelayVO.getCreateUserName()); workTicketInfoMap.put("delayPrincipal", workTicketDelayVO.getCreateUserName());
workTicketInfoMap.put("delayPrincipalTime",DateUtil.format(workTicketDelayVO.getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("delayPrincipalTime", DateUtil.format(workTicketDelayVO.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN));
workTicketInfoMap.put("delayLicensor",workTicketDelayVO.getLicensorName()); workTicketInfoMap.put("delayLicensor", workTicketDelayVO.getLicensorName());
workTicketInfoMap.put("delayLicenseTime",DateUtil.format(workTicketDelayVO.getLicenseTime(),TicketConstants.TICKET_DATE_PATTERN)); workTicketInfoMap.put("delayLicenseTime", DateUtil.format(workTicketDelayVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN));
} } else {
else {
workTicketInfoMap.put("delayTime", ""); workTicketInfoMap.put("delayTime", "");
workTicketInfoMap.put("delayPrincipal", ""); workTicketInfoMap.put("delayPrincipal", "");
workTicketInfoMap.put("delayPrincipalTime", ""); workTicketInfoMap.put("delayPrincipalTime", "");
@ -458,53 +453,52 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/**跨日工作时间**/ /**跨日工作时间**/
List<WorkTicketOperateTimeVO> operateList = workTicketInfoVO.getWorkTicketOperateTimeVOList(); List<WorkTicketOperateTimeVO> operateList = workTicketInfoVO.getWorkTicketOperateTimeVOList();
if(CollectionUtil.isNotEmpty(operateList)){ if (CollectionUtil.isNotEmpty(operateList)) {
List<Map<String,String>> operateMapList = operateList.stream().map(operate->{ List<Map<String, String>> operateMapList = operateList.stream().map(operate -> {
Map<String,String> map = new HashMap<>(4); Map<String, String> map = new HashMap<>(4);
map.put("startTime",DateUtil.format(operate.getStartTime(),TicketConstants.TICKET_DATE_PATTERN)); map.put("startTime", DateUtil.format(operate.getStartTime(), TicketConstants.TICKET_DATE_PATTERN));
map.put("endTime",DateUtil.format(operate.getEndTime(),TicketConstants.TICKET_DATE_PATTERN)); map.put("endTime", DateUtil.format(operate.getEndTime(), TicketConstants.TICKET_DATE_PATTERN));
map.put("principal",operate.getPrincipalName()); map.put("principal", operate.getPrincipalName());
map.put("licensor",operate.getLicensorName()); map.put("licensor", operate.getLicensorName());
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
workTicketInfoMap.put("operateMapList",operateMapList); workTicketInfoMap.put("operateMapList", operateMapList);
} } else {
else { List<Map<String, String>> operateMapList = new ArrayList<>();
List<Map<String,String>> operateMapList = new ArrayList<>(); Map<String, String> map = new HashMap<>(4);
Map<String,String> map = new HashMap<>(4); map.put("startTime", "");
map.put("startTime",""); map.put("endTime", "");
map.put("endTime",""); map.put("principal", "");
map.put("principal",""); map.put("licensor", "");
map.put("licensor","");
operateMapList.add(map); operateMapList.add(map);
workTicketInfoMap.put("operateMapList", operateMapList); workTicketInfoMap.put("operateMapList", operateMapList);
} }
/**运行值班人员暂为空**/ /**运行值班人员暂为空**/
workTicketInfoMap.put("dutyPersonName","/"); workTicketInfoMap.put("dutyPersonName", "/");
String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(workTicketInfoVO.getType()) + PdfUtils.XLSX_SUFFIX; String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(workTicketInfoVO.getType()) + PdfUtils.XLSX_SUFFIX;
log.info("工作票模板为:{}",fileName); log.info("工作票模板为:{}", fileName);
TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true);
Workbook workbook = null; Workbook workbook = null;
try { try {
workbook = ExcelUtil.getWorkbook(templateExportParams,workTicketInfoMap); workbook = ExcelUtil.getWorkbook(templateExportParams, workTicketInfoMap);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
//上传xlsx至服务器 //上传xlsx至服务器
try { try {
ExcelUtil.upload(workbook,xlsSavePath,workTicketInfoVO.getWorkContent()+PdfUtils.XLSX_SUFFIX); ExcelUtil.upload(workbook, xlsSavePath, workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
//将xlsx文件转换为pdf并保存 //将xlsx文件转换为pdf并保存
String pdfFileName = workTicketInfoVO.getWorkContent() + PdfUtils.PDF_SUFFIX; String pdfFileName = workTicketInfoVO.getWorkContent() + PdfUtils.PDF_SUFFIX;
String xlsFileName = workTicketInfoVO.getWorkContent()+PdfUtils.XLSX_SUFFIX; String xlsFileName = workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX;
PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName);
String savePath = pdfSavePath + pdfFileName; String savePath = pdfSavePath + pdfFileName;
// 设置response参数,可以打开下载页面 // 设置response参数,可以打开下载页面
PdfUtils.readPdf(response,savePath); PdfUtils.readPdf(response, savePath);
} }
@Override @Override
@ -519,36 +513,34 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
task.setVariables(flow.getVariables()); task.setVariables(flow.getVariables());
//待许可时获取许可人角色下用户开启工作流 //待许可时获取许可人角色下用户开启工作流
if(TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())){ if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) {
R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),req.getCreateDept(),TicketConstants.LICENSOR_ROLE); R<List<User>> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), req.getCreateDept(), TicketConstants.LICENSOR_ROLE);
if(!userListR.isSuccess()){ if (!userListR.isSuccess()) {
throw new ServiceException(userListR.getMsg()); throw new ServiceException(userListR.getMsg());
} }
Map<String, Object> variables = CollectionUtil.isEmpty(flow.getVariables()) ? new HashMap<>() : flow.getVariables(); Map<String, Object> variables = CollectionUtil.isEmpty(flow.getVariables()) ? new HashMap<>() : flow.getVariables();
String taskUser = userListR.getData().stream().map(u->"taskUser_".concat(u.getId().toString())).collect(Collectors.joining(",")); String taskUser = userListR.getData().stream().map(u -> "taskUser_".concat(u.getId().toString())).collect(Collectors.joining(","));
variables.put("licenseUserIds",taskUser); variables.put("licenseUserIds", taskUser);
task.setVariables(variables); task.setVariables(variables);
} }
log.info("工作流对象为:{}",JSONObject.toJSONString(flow)); log.info("工作流对象为:{}", JSONObject.toJSONString(flow));
if(TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())){ if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) {
req.setSigner(AuthUtil.getUserId()); req.setSigner(AuthUtil.getUserId());
} } else if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) {
else if(TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())){
req.setLicensor(AuthUtil.getUserId()); req.setLicensor(AuthUtil.getUserId());
} } else if (TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(req.getStatus())) {
else if(TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(req.getStatus())){
this.invalidTicket(req); this.invalidTicket(req);
} }
//更新状态 //更新状态
boolean flag = this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() boolean flag = this.update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getStatus,req.getStatus()) .set(WorkTicketInfoEntity::getStatus, req.getStatus())
.set(WorkTicketInfoEntity::getPrincipal,req.getPrincipal()) .set(WorkTicketInfoEntity::getPrincipal, req.getPrincipal())
.set(WorkTicketInfoEntity::getLicensor,req.getLicensor()) .set(WorkTicketInfoEntity::getLicensor, req.getLicensor())
.set(WorkTicketInfoEntity::getLicenseTime,req.getLicenseTime()) .set(WorkTicketInfoEntity::getLicenseTime, req.getLicenseTime())
.set(WorkTicketInfoEntity::getLicenseEndTime,req.getLicenseEndTime()) .set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime())
.eq(WorkTicketInfoEntity::getId,req.getId())); .eq(WorkTicketInfoEntity::getId, req.getId()));
//新增流程信息 //新增流程信息
WorkTicketFlowEntity workTicketFlowEntity = new WorkTicketFlowEntity(); WorkTicketFlowEntity workTicketFlowEntity = new WorkTicketFlowEntity();
@ -556,10 +548,10 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
workTicketFlowEntity.setFlowCode(req.getStatus().toString()); workTicketFlowEntity.setFlowCode(req.getStatus().toString());
workTicketFlowEntity.setExecutor(AuthUtil.getUserId().toString()); workTicketFlowEntity.setExecutor(AuthUtil.getUserId().toString());
workTicketFlowEntity.setExecuteTime(LocalDateTime.now()); workTicketFlowEntity.setExecuteTime(LocalDateTime.now());
workTicketFlowEntity.setRemark(Optional.ofNullable(flow.getVariables()).map(v->v.get("remark")).map(s->s.toString()).orElse("")); workTicketFlowEntity.setRemark(Optional.ofNullable(flow.getVariables()).map(v -> v.get("remark")).map(s -> s.toString()).orElse(""));
workTicketFlowEntity.setSignImgPath(Optional.ofNullable(flow.getVariables()).map(v->v.get("signImgPath")).map(s->s.toString()).orElse("")); workTicketFlowEntity.setSignImgPath(Optional.ofNullable(flow.getVariables()).map(v -> v.get("signImgPath")).map(s -> s.toString()).orElse(""));
workTicketFlowEntity.setGroundWireCount(Optional.ofNullable(flow.getVariables()).map(v->v.get("groundWireCount")).map(s->Integer.parseInt(s.toString())).orElse(null)); workTicketFlowEntity.setGroundWireCount(Optional.ofNullable(flow.getVariables()).map(v -> v.get("groundWireCount")).map(s -> Integer.parseInt(s.toString())).orElse(null));
workTicketFlowEntity.setGroundSwitchCount(Optional.ofNullable(flow.getVariables()).map(v->v.get("groundSwitchCount")).map(s->Integer.parseInt(s.toString())).orElse(null)); workTicketFlowEntity.setGroundSwitchCount(Optional.ofNullable(flow.getVariables()).map(v -> v.get("groundSwitchCount")).map(s -> Integer.parseInt(s.toString())).orElse(null));
workTicketFlowEntity.setStatus(req.getStatus()); workTicketFlowEntity.setStatus(req.getStatus());
workTicketFlowService.save(workTicketFlowEntity); workTicketFlowService.save(workTicketFlowEntity);
//执行流程 //执行流程
@ -567,7 +559,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
//更新任务状态 //更新任务状态
updateAccessStatus(req); updateAccessStatus(req);
if(!flowResult.isSuccess()){ if (!flowResult.isSuccess()) {
throw new ServiceException("执行工作流失败!"); throw new ServiceException("执行工作流失败!");
} }
@ -575,11 +567,11 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateAccessStatus(WorkTicketInfoDto req){ public void updateAccessStatus(WorkTicketInfoDto req) {
if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())){ if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) {
log.info("许可通过:{}",JSONObject.toJSONString(req)); log.info("许可通过:{}", JSONObject.toJSONString(req));
//许可人通过将检修任务状态设为执行中 //许可人通过将检修任务状态设为执行中
if(TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())){ if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) {
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); OperAccessTaskEntity taskEntity = new OperAccessTaskEntity();
taskEntity.setId(req.getTaskId()); taskEntity.setId(req.getTaskId());
taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_1); taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_1);
@ -594,15 +586,15 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
* 票据作废时 对应任务ID应该置空 * 票据作废时 对应任务ID应该置空
* @param req * @param req
*/ */
public void invalidTicket(WorkTicketInfoDto req){ public void invalidTicket(WorkTicketInfoDto req) {
if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())){ if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) {
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); OperAccessTaskEntity taskEntity = new OperAccessTaskEntity();
taskEntity.setId(req.getTaskId()); taskEntity.setId(req.getTaskId());
taskEntity.setInvalid(true); taskEntity.setInvalid(true);
taskEntity.setTicketId(null); taskEntity.setTicketId(null);
operAccessTaskClient.updateById(taskEntity); operAccessTaskClient.updateById(taskEntity);
} }
if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())){ if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) {
OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO();
dto.setId(req.getTaskId()); dto.setId(req.getTaskId());
dto.setInvalid(true); dto.setInvalid(true);
@ -616,14 +608,14 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
* @param req * @param req
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void returnTicket(WorkTicketInfoDto req){ public void returnTicket(WorkTicketInfoDto req) {
if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType())){ if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType())) {
OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); OperAccessTaskEntity taskEntity = new OperAccessTaskEntity();
taskEntity.setId(req.getTaskId()); taskEntity.setId(req.getTaskId());
taskEntity.setTicketId(req.getId()); taskEntity.setTicketId(req.getId());
operAccessTaskClient.updateById(taskEntity); operAccessTaskClient.updateById(taskEntity);
} }
if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())){ if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) {
OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO();
dto.setId(req.getTaskId()); dto.setId(req.getTaskId());
dto.setTicketId(req.getId()); dto.setTicketId(req.getId());
@ -633,58 +625,59 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/** /**
* 获取queryWrapper * 获取queryWrapper
*
* @param req * @param req
* @return * @return
*/ */
private LambdaQueryWrapper<WorkTicketInfoEntity> getQueryWrapper(WorkTicketInfoDto req){ private LambdaQueryWrapper<WorkTicketInfoEntity> getQueryWrapper(WorkTicketInfoDto req) {
LambdaQueryWrapper<WorkTicketInfoEntity> lqw = new LambdaQueryWrapper(); LambdaQueryWrapper<WorkTicketInfoEntity> lqw = new LambdaQueryWrapper();
if(Func.isNotBlank(req.getProcessInstanceId())){ if (Func.isNotBlank(req.getProcessInstanceId())) {
lqw.eq(WorkTicketInfoEntity::getProcessInstanceId,req.getProcessInstanceId()); lqw.eq(WorkTicketInfoEntity::getProcessInstanceId, req.getProcessInstanceId());
} }
if(Func.isNotEmpty(req.getType())){ if (Func.isNotEmpty(req.getType())) {
lqw.eq(WorkTicketInfoEntity::getType,req.getType()); lqw.eq(WorkTicketInfoEntity::getType, req.getType());
} }
if(Func.isNotEmpty(req.getTaskType())){ if (Func.isNotEmpty(req.getTaskType())) {
lqw.eq(WorkTicketInfoEntity::getTaskType,req.getTaskType()); lqw.eq(WorkTicketInfoEntity::getTaskType, req.getTaskType());
} }
if(Func.isNotEmpty(req.getCode())){ if (Func.isNotEmpty(req.getCode())) {
lqw.like(WorkTicketInfoEntity::getCode,req.getCode()); lqw.like(WorkTicketInfoEntity::getCode, req.getCode());
} }
if(Func.isNotEmpty(req.getStatus())){ if (Func.isNotEmpty(req.getStatus())) {
lqw.eq(WorkTicketInfoEntity::getStatus,req.getStatus()); lqw.eq(WorkTicketInfoEntity::getStatus, req.getStatus());
} }
if(Func.isNotEmpty(req.getCompany())){ if (Func.isNotEmpty(req.getCompany())) {
lqw.like(WorkTicketInfoEntity::getType,"%".concat(req.getCompany()).concat("%")); lqw.like(WorkTicketInfoEntity::getType, "%".concat(req.getCompany()).concat("%"));
} }
if(Func.isNotEmpty(req.getClassGroup())){ if (Func.isNotEmpty(req.getClassGroup())) {
lqw.eq(WorkTicketInfoEntity::getClassGroup,req.getClassGroup()); lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup());
} }
if(Func.isNotEmpty(req.getTaskId())){ if (Func.isNotEmpty(req.getTaskId())) {
lqw.eq(WorkTicketInfoEntity::getTaskId,req.getTaskId()); lqw.eq(WorkTicketInfoEntity::getTaskId, req.getTaskId());
} }
if(Func.isNotEmpty(req.getClassGroup())){ if (Func.isNotEmpty(req.getClassGroup())) {
lqw.eq(WorkTicketInfoEntity::getClassGroup,req.getClassGroup()); lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup());
} }
if(Func.isNotEmpty(req.getClassGroupMembers())){ if (Func.isNotEmpty(req.getClassGroupMembers())) {
lqw.like(WorkTicketInfoEntity::getClassGroupMembers,"%".concat(req.getClassGroupMembers()).concat("%")); lqw.like(WorkTicketInfoEntity::getClassGroupMembers, "%".concat(req.getClassGroupMembers()).concat("%"));
} }
if(Func.isNotEmpty(req.getWorkContent())){ if (Func.isNotEmpty(req.getWorkContent())) {
lqw.like(WorkTicketInfoEntity::getWorkContent,"%".concat(req.getWorkContent()).concat("%")); lqw.like(WorkTicketInfoEntity::getWorkContent, "%".concat(req.getWorkContent()).concat("%"));
} }
if(Func.isNotEmpty(req.getSigner())){ if (Func.isNotEmpty(req.getSigner())) {
lqw.eq(WorkTicketInfoEntity::getSigner,req.getSigner()); lqw.eq(WorkTicketInfoEntity::getSigner, req.getSigner());
} }
if(Func.isNotEmpty(req.getLicensor())){ if (Func.isNotEmpty(req.getLicensor())) {
lqw.eq(WorkTicketInfoEntity::getLicensor,req.getLicensor()); lqw.eq(WorkTicketInfoEntity::getLicensor, req.getLicensor());
} }
if(Func.isNotEmpty(req.getStartTime())){ if (Func.isNotEmpty(req.getStartTime())) {
lqw.ge(WorkTicketInfoEntity::getCreateTime,req.getStartTime()); lqw.ge(WorkTicketInfoEntity::getCreateTime, req.getStartTime());
} }
if(Func.isNotEmpty(req.getEndTime())){ if (Func.isNotEmpty(req.getEndTime())) {
lqw.le(WorkTicketInfoEntity::getCreateTime,req.getEndTime()); lqw.le(WorkTicketInfoEntity::getCreateTime, req.getEndTime());
} }
if(!CollectionUtil.isEmpty(req.getDeptIds())){ if (!CollectionUtil.isEmpty(req.getDeptIds())) {
lqw.in(WorkTicketInfoEntity::getCreateDept,req.getDeptIds()); lqw.in(WorkTicketInfoEntity::getCreateDept, req.getDeptIds());
} }
return lqw; return lqw;
} }
@ -697,19 +690,19 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
@Override @Override
public BladeFlow startProcessInstance(String processDefinitionKey, WorkTicketInfoEntity workTicketInfoEntity) { public BladeFlow startProcessInstance(String processDefinitionKey, WorkTicketInfoEntity workTicketInfoEntity) {
/**获取签发人角色下的人员**/ /**获取签发人角色下的人员**/
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId,Long.parseLong(AuthUtil.getUser().getDeptId()),TicketConstants.SIGNER_ROLE); R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId, Long.parseLong(AuthUtil.getUser().getDeptId()), TicketConstants.SIGNER_ROLE);
if(!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())){ if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) {
throw new ServiceException("工作票签发人角色下未查询到相关人员"); throw new ServiceException("工作票签发人角色下未查询到相关人员");
} }
String signUserIds = listR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); String signUserIds = listR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(","));
Map<String,Object> params = new HashMap<String, Object>(2) {{ Map<String, Object> params = new HashMap<String, Object>(2) {{
put("taskId", workTicketInfoEntity.getId()); put("taskId", workTicketInfoEntity.getId());
put("signUserIds", signUserIds); put("signUserIds", signUserIds);
}}; }};
R<BladeFlow> r = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey,"workTicket:task:" + workTicketInfoEntity.getId(),workTicketInfoEntity.getWorkContent(), params); R<BladeFlow> r = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, "workTicket:task:" + workTicketInfoEntity.getId(), workTicketInfoEntity.getWorkContent(), params);
if(!r.isSuccess()){ if (!r.isSuccess()) {
throw new ServiceException(r.getMsg()); throw new ServiceException(r.getMsg());
} }
return r.getData(); return r.getData();
@ -717,6 +710,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/** /**
* 许可人通过线下工作票 * 许可人通过线下工作票
*
* @param req * @param req
* @return * @return
*/ */
@ -725,26 +719,27 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
Long ticketId = req.getId(); Long ticketId = req.getId();
WorkTicketInfoEntity infoEntity = getById(ticketId); WorkTicketInfoEntity infoEntity = getById(ticketId);
//获取许可人角色下的人员 //获取许可人角色下的人员
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId,infoEntity.getCreateDept(),TicketConstants.LICENSOR_ROLE); R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId, infoEntity.getCreateDept(), TicketConstants.LICENSOR_ROLE);
if(!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())){ if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) {
throw new ServiceException("工作票许可人角色下未查询到相关人员"); throw new ServiceException("工作票许可人角色下未查询到相关人员");
} }
List<Long> userId = listR.getData().stream().map(User::getId).distinct().collect(Collectors.toList()); List<Long> userId = listR.getData().stream().map(User::getId).distinct().collect(Collectors.toList());
if(!userId.contains(AuthUtil.getUserId())){ if (!userId.contains(AuthUtil.getUserId())) {
throw new ServiceException("当前操作人没有许可人角色,无法执行该操作"); throw new ServiceException("当前操作人没有许可人角色,无法执行该操作");
} }
update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()) .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus())
.set(WorkTicketInfoEntity::getLicensor,AuthUtil.getUserId()) .set(WorkTicketInfoEntity::getLicensor, AuthUtil.getUserId())
.set(WorkTicketInfoEntity::getLicenseTime,LocalDateTime.now()) .set(WorkTicketInfoEntity::getLicenseTime, LocalDateTime.now())
.set(WorkTicketInfoEntity::getLicenseEndTime,req.getLicenseEndTime()) .set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime())
.eq(WorkTicketInfoEntity::getId,ticketId) .eq(WorkTicketInfoEntity::getId, ticketId)
); );
return R.success("操作成功"); return R.success("操作成功");
} }
/** /**
* 完成线下工作票 * 完成线下工作票
*
* @param ticketAccessTaskDto * @param ticketAccessTaskDto
* @return * @return
*/ */
@ -753,13 +748,13 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
//更新工作票 //更新工作票
WorkTicketInfoDto infoDto = ticketAccessTaskDto.getWorkTicketInfoDto(); WorkTicketInfoDto infoDto = ticketAccessTaskDto.getWorkTicketInfoDto();
update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate() update(Wrappers.<WorkTicketInfoEntity>lambdaUpdate()
.set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()) .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus())
.eq(WorkTicketInfoEntity::getId,infoDto.getId()) .eq(WorkTicketInfoEntity::getId, infoDto.getId())
); );
//获取工作票实体类 //获取工作票实体类
WorkTicketInfoEntity infoEntity = getById(infoDto.getId()); WorkTicketInfoEntity infoEntity = getById(infoDto.getId());
//根据任务类型执行任务 //根据任务类型执行任务
if(ObjectUtil.isEmpty(infoEntity.getTaskType())){ if (ObjectUtil.isEmpty(infoEntity.getTaskType())) {
return R.success("操作成功"); return R.success("操作成功");
} }
//FIXME 日常维护、检修任务暂时不形成闭环(因许可人无需填入任务结束完成所需参数,故选择由执行人手动闭环) ~2022--05-06 //FIXME 日常维护、检修任务暂时不形成闭环(因许可人无需填入任务结束完成所需参数,故选择由执行人手动闭环) ~2022--05-06
@ -797,10 +792,10 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
* @return * @return
*/ */
@Override @Override
public String getWorkTicketCode(){ public String getWorkTicketCode() {
String code = ""; String code = "";
lock.lock(); lock.lock();
try{ try {
/**获取当前时间**/ /**获取当前时间**/
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM");
YearMonth yearMonth = YearMonth.now(); YearMonth yearMonth = YearMonth.now();
@ -808,23 +803,20 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
LocalDateTime date = LocalDateTime.now(); LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59); LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59);
log.info("当月第一天:{};当月最后一天{}",firstDay,lastDay); log.info("当月第一天:{};当月最后一天{}", firstDay, lastDay);
/**获取当月工作票总条数**/ /**获取当月工作票总条数**/
List<WorkTicketInfoEntity> infoEntityList = this.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ List<WorkTicketInfoEntity> infoEntityList = this.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getCreateTime,firstDay); ge(WorkTicketInfoEntity::getCreateTime, firstDay);
le(WorkTicketInfoEntity::getCreateTime,lastDay); le(WorkTicketInfoEntity::getCreateTime, lastDay);
}}); }});
if(CollectionUtil.isEmpty(infoEntityList)){ if (CollectionUtil.isEmpty(infoEntityList)) {
code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-001"); code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-001");
} else {
code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-").concat(String.format("%03d", infoEntityList.size() + 1));
} }
else { } catch (Exception e) {
code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-").concat(String.format("%03d", infoEntityList.size()+1));
}
}
catch(Exception e){
e.printStackTrace(); e.printStackTrace();
} } finally {
finally{
lock.unlock(); lock.unlock();
} }
return code; return code;
@ -832,6 +824,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
/** /**
* 获取安全检查工作票项统计 * 获取安全检查工作票项统计
*
* @param startDate 开始时间 * @param startDate 开始时间
* @param endDate 结束时间 * @param endDate 结束时间
* @param dept 机构ID * @param dept 机构ID
@ -839,33 +832,90 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
*/ */
@Override @Override
public SafeCheckStatisticVO getWorkTicketStatistic(String startDate, String endDate, Long dept) { public SafeCheckStatisticVO getWorkTicketStatistic(String startDate, String endDate, Long dept) {
return this.baseMapper.getWorkTicketStatistic(startDate,endDate,dept); return this.baseMapper.getWorkTicketStatistic(startDate, endDate, dept);
} }
/** /**
* 验证角色是否能查询到相关人员 * 验证角色是否能查询到相关人员
*
* @param deptId 机构ID * @param deptId 机构ID
* @param roleAliasArray 角色 按逗号分隔 * @param roleAliasArray 角色 按逗号分隔
* @return * @return
*/ */
@Override @Override
public R<Map<String,Object>> verificationRole(Long deptId, String roleAliasArray){ public R<Map<String, Object>> verificationRole(Long deptId, String roleAliasArray) {
Map<String,Object> result = new HashedMap(2); Map<String, Object> result = new HashedMap(2);
List<String> failRoleAliasList = Lists.newArrayList(); List<String> failRoleAliasList = Lists.newArrayList();
AtomicBoolean flag = new AtomicBoolean(true); AtomicBoolean flag = new AtomicBoolean(true);
Arrays.stream(roleAliasArray.split(",")).forEach(roleAlias->{ Arrays.stream(roleAliasArray.split(",")).forEach(roleAlias -> {
//查询机构下角色是否有对应人员列表 //查询机构下角色是否有对应人员列表
R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId,deptId,roleAlias); R<List<User>> listR = userClient.relationUserListByRoleAlias(tenantId, deptId, roleAlias);
if(!listR.isSuccess() || ObjectUtil.isEmpty(listR.getData())) { if (!listR.isSuccess() || ObjectUtil.isEmpty(listR.getData())) {
failRoleAliasList.add(roleAlias); failRoleAliasList.add(roleAlias);
flag.set(false); flag.set(false);
} }
}); });
result.put("flag",flag.get()); result.put("flag", flag.get());
if(CollectionUtil.isNotEmpty(failRoleAliasList)){ if (CollectionUtil.isNotEmpty(failRoleAliasList)) {
result.put("message","验证失败,获取"+JSON.toJSONString(failRoleAliasList)+"角色下的人员失败"); result.put("message", "验证失败,获取" + JSON.toJSONString(failRoleAliasList) + "角色下的人员失败");
} }
return R.data(result); return R.data(result);
} }
/**
* 根据月份和区域查询工作票列表详情
*
* @param pageEntity
* @param areaVo
* @return
*/
@Override
public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Page<WorkTicketInfoEntity> pageEntity,
StandardTicketWithAreaVo areaVo) {
//1.查询
QueryWrapper<WorkTicketInfoEntity> queryWrapper = new QueryWrapper<>();
//开票来源
queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), WorkTicketInfoEntity::getTaskType,
areaVo.getTaskType());
//编号
queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), WorkTicketInfoEntity::getCode, areaVo.getCode());
//状态
queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), WorkTicketInfoEntity::getStatus,
areaVo.getStatus());
//开始时间
queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), WorkTicketInfoEntity::getCreateTime,
areaVo.getStartTime());
//结束时间
queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), WorkTicketInfoEntity::getCreateTime,
areaVo.getEndTime());
queryWrapper.eq("create_dept", areaVo.getAreaId());
queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(create_time,'%Y-%m')",
areaVo.getYearMonth());
Page<WorkTicketInfoEntity> workTicketInfoEntityPage = baseMapper.selectPage(pageEntity, queryWrapper);
//数据转换
List<StandardWorkVo> standardWorkList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(workTicketInfoEntityPage.getRecords())) {
standardWorkList = workTicketInfoEntityPage.getRecords()
.stream().map(workTicketInfoEntity -> {
StandardWorkVo standardWorkVo = new StandardWorkVo();
BeanUtils.copyProperties(workTicketInfoEntity, standardWorkVo);
return standardWorkVo;
}).collect(Collectors.toList());
}
IPage<StandardWorkVo> page = new Page<>();
page.setRecords(standardWorkList);
page.setTotal(workTicketInfoEntityPage.getTotal());
page.setCurrent(workTicketInfoEntityPage.getCurrent());
page.setSize(workTicketInfoEntityPage.getSize());
BladePage<StandardWorkVo> bladePage = BladePage.of(page);
return bladePage;
}
} }

Loading…
Cancel
Save