diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java new file mode 100644 index 0000000..9f7f51f --- /dev/null +++ b/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> list(TaskListQuery task, Query query); + + + @RequestMapping(value = "/task/detail", method = {RequestMethod.GET, RequestMethod.POST}) + @ApiOperation(value = "查看,下面列表再调用eventController.list", notes = "传入taskid") + public R detail(@RequestParam Long id); +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java new file mode 100644 index 0000000..038046b --- /dev/null +++ b/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> list(TaskListQuery task, Query query) { + + return R.fail("远程调用失败"); + } +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/CameraInfoEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/CameraInfoEntity.java new file mode 100644 index 0000000..26e7efe --- /dev/null +++ b/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; + +} + diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotEntity.java new file mode 100644 index 0000000..7f10ad8 --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotVO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/RobotVO.java new file mode 100644 index 0000000..b711735 --- /dev/null +++ b/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 cameraInfo; + +} + diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskListQuery.java new file mode 100644 index 0000000..12321b7 --- /dev/null +++ b/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; + + +} + diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskVo.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/vo/TaskVo.java new file mode 100644 index 0000000..8717036 --- /dev/null +++ b/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; +} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java index 2b2e11d..bb0ba83 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordEntityVo.java @@ -1,7 +1,10 @@ package com.hnac.hzims.message.vo.msgpushrecord; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import java.time.YearMonth; + /** * @Author WL * @Version v1.0 @@ -17,9 +20,10 @@ public class MessagePushRecordEntityVo { private String stationCode; /** - * 月份 + * 年月 */ - private Integer month; + @JsonFormat(pattern = "yyyy-MM") + private YearMonth yearMonth; /** diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/dto/TicketInfoEvaluateDto.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/dto/TicketInfoEvaluateDto.java new file mode 100644 index 0000000..90c6fba --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java index fa7bc87..1995d69 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java @@ -2,14 +2,22 @@ package com.hnac.hzims.ticket.areamonthly.feign; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; +import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.feign.fallback.StandardTicketInfoFeignClient; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.*; +import io.swagger.annotations.ApiOperation; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.SpringQueryMap; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; +import java.util.List; + /** * @Author WL * @Version v1.0 @@ -21,12 +29,53 @@ import org.springframework.web.bind.annotation.*; public interface TicketFeignClient { /** - * 根据月份,区域 获取操作详情数据 + * 根据月份,区域 获取操作列表数据 * * @return */ @GetMapping("/standard/ticket/areaMonthlyWithOperation/{page}/{size}") - R> areaMonthlyWithOperation(@PathVariable("page") Long page, - @PathVariable("size") Long size, - @SpringQueryMap AreaMonthlyVo areaMonthlyV); + R> areaMonthlyWithOperation(@PathVariable("page") Long page, + @PathVariable("size") Long size, + @SpringQueryMap StandardTicketWithAreaVo ticketWithAreaVo); + + /** + * 获取操作票详情数据 + */ + @GetMapping("/standard/ticket/detail") + @ApiOperationSupport(order = 40) + @ApiOperation(value = "详情") + R detail(@RequestParam Long id); + + + /** + * 查询工作票评论 + * + * @param req + * @return + */ + @PostMapping("/allTicket/ticketEvaluate/list") + @ApiOperationSupport(order = 10) + @ApiOperation(value = "查询工作票评论") + R> 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> workTicketListByMonthAndArea(@PathVariable Long page, + @PathVariable Long size, + @SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo); } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java index 4c42a82..5a303a9 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java @@ -1,18 +1,25 @@ package com.hnac.hzims.ticket.areamonthly.feign.fallback; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; +import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.*; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.tool.api.R; import org.springframework.stereotype.Service; +import java.util.List; + /** * @Author WL * @Version v1.0 * @Serial 1.0 * @Date 2023/4/10 17:24 */ +@Slf4j @Service public class StandardTicketInfoFeignClient implements TicketFeignClient { /** @@ -23,8 +30,52 @@ public class StandardTicketInfoFeignClient implements TicketFeignClient { * @return */ @Override - public R> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthlyV) { + public R> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthlyV) { return R.fail("远程调用失败"); } + + /** + * 根据月份,区域 获取操作票详情数据 + * + * @param id + */ + @Override + public R detail(Long id) { + return R.fail("远程调用失败"); + } + + /** + * 查询工作票评论 + * + * @param req + * @return + */ + @Override + public R> 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> workTicketListByMonthAndArea(Long page, Long size, StandardTicketWithAreaVo areaMonthlyVo) { + return R.fail("远程调用失败"); + } } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskVo.java new file mode 100644 index 0000000..3ac0b6a --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/MaintenanceTaskWithAreaVo.java new file mode 100644 index 0000000..e3c7288 --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketInfoVO.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketInfoVO.java new file mode 100644 index 0000000..4fd267a --- /dev/null +++ b/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 standardTicketMeasureVOList; +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketMeasureVO.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketMeasureVO.java new file mode 100644 index 0000000..a6bb31e --- /dev/null +++ b/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; +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java index 888e12b..8a2abe6 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java @@ -1,4 +1,4 @@ -package com.hnac.hzims.ticket.areamonthly; +package com.hnac.hzims.ticket.areamonthly.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -24,6 +24,12 @@ public class StandardTicketVo implements Serializable { /** + * 编号 + */ + private Long id; + + + /** * 开票种类 */ private String ticketType; @@ -40,6 +46,12 @@ public class StandardTicketVo implements Serializable { * 开票来源 */ private String taskType; + + + /** + * 开票来源名称 + */ + private String taskTypeName; /** * 开票任务来源 */ @@ -51,21 +63,54 @@ public class StandardTicketVo implements Serializable { private Long issueOrderPerson; /** + * 发令人名称 + */ + private String issueOrderPersonName; + + + /** * 受令人 */ private Long accessOrderPerson; + + /** + * 受令人名称 + */ + private String accessOrderPersonName; + /** * 监护人 */ - private String guardian; + private Long guardian; + + + /** + * 监护人名称 + */ + private String guardianName; /** * 值班负责人 */ private Long principal; + + /** + * 值班负责人 + */ + private String principalName; /** * 开票时间 */ private Date createTime; + + /** + * 状态 + */ + private Integer status; + + /** + * 是否评价 + */ + private Integer isEvaluate; } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java new file mode 100644 index 0000000..3ebd967 --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardWorkVo.java new file mode 100644 index 0000000..14cff7c --- /dev/null +++ b/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; +} + diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java deleted file mode 100644 index 8d8bfd6..0000000 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java +++ /dev/null @@ -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 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(); -// } -// -// } -// diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java index 6a409ff..5c99a58 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java @@ -27,8 +27,8 @@ public class SysLogConfig { //2.创建一个SyslogTimerTask实例 SyslogTimerTask myTimeTask = new SyslogTimerTask(statisticsService); //3.通过timer定时定频率调用SyslogTimerTask的业务逻辑 - // 即 第一次执行是在当前时间的两秒之后,之后每隔3秒钟执行一次 - timer.schedule(myTimeTask,2000L,10000L); + // 即 第一次执行是在当前时间的两秒之后,之后每隔60分钟执行一次 + timer.schedule(myTimeTask,2000L,60000L); } } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java index 5348ce9..9d8f338 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java @@ -38,18 +38,41 @@ public class Statistics implements Serializable { @TableField("date_calculated") private String dateCalculated; + + /** + * 操作模块 + */ + @TableField("title") + private String title; + + /** * 操作模块统计 */ @TableField("title_num") private Integer titleNum; + + /** + * 功能模块统计 + */ + @TableField("module_name") + private String moduleName; + + /** * 功能模块统计 */ @TableField("module_name_num") private Integer moduleNameNum; + + /** + * 请求路径统计 + */ + @TableField("path") + private String path; + /** * 请求路径统计 */ diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml index c2f6ff0..fae7e99 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml @@ -4,10 +4,14 @@ diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java index b4209ec..a551ab5 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java @@ -7,6 +7,7 @@ import com.hnac.hzims.middle.systemlog.service.StatisticsService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.middle.systemlog.service.SysLogService; import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,6 +22,7 @@ import java.util.List; * @author dfy * @since 2023-04-08 */ +@Slf4j @Service public class StatisticsServiceImpl extends ServiceImpl implements StatisticsService { @@ -34,16 +36,16 @@ public class StatisticsServiceImpl extends ServiceImpl sysLogStatisticsVoList = sysLogService.countStatistics(); - System.out.println(sysLogStatisticsVoList); + log.info("查询统计的数据: {}", sysLogStatisticsVoList); //2. 保存数据 if (sysLogStatisticsVoList == null) { return; } - for (SysLogStatisticsVo sysLogStatisticsVo : sysLogStatisticsVoList) { //查询数据 Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo.getOperationTime()); @@ -55,7 +57,7 @@ public class StatisticsServiceImpl extends ServiceImpl> list(TaskListQuery task, Query query) { - CacheUtil.put("test#2","inspect","test","12"); + public R> list(TaskListQuery task, Query query) { + //CacheUtil.put("test#2","inspect","test","12"); // LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task); // queryWrapper.orderByDesc(TaskEntity::getUpdateTime); // IPage pages = taskService.page(Condition.getPage(query), queryWrapper); @@ -112,9 +112,13 @@ public class TaskController extends BladeController { task.setCurUserId(AuthUtil.getUserId()); task.setTenantId(AuthUtil.getTenantId()); } + if (task.getCurUserId().longValue() == -1) { + task.setCurUserId(null); + } List list = taskService.getListPage(pages,task); pages.setRecords(list); - return R.data(pages); + BladePage bladePage = BladePage.of(pages); + return R.data(bladePage); } @GetMapping("/mainQueryPage") diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml index 7589fea..7862d45 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml @@ -162,6 +162,12 @@ and FIND_IN_SET(t.ID,#{task.taskIds}) + + and t.CREATE_DEPT = #{task.areaId}) + + + and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearmonth}) + order by t.UPDATE_TIME desc diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java index cd30baa..4cd012b 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskListQuery.java @@ -10,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.YearMonth; /** * @author ninglong @@ -114,4 +115,16 @@ public class TaskListQuery implements Serializable { @ApiModelProperty("巡检任务 按逗号分隔") private String taskIds; + + /** + * 月份 + */ + private YearMonth yearmonth; + + /** + * 区域Id + */ + private String areaId; + + } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml index 9ae9935..a9fe853 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml @@ -22,12 +22,13 @@ date_format(PLAN_TIME, '%Y-%m') strMonth, type from hzims_message_push_record - where IS_DELETED = 0 - - - and - STATION_CODE = #{vo.stationCode} - + + IS_DELETED = 0 + + and + STATION_CODE = #{vo.stationCode} + + group by strMonth, TYPE @@ -36,19 +37,21 @@ select BUSINESS_CLASSIFY businessClassify, count(1) power from hzims_message_push_record - where IS_DELETED = 0 - - and - STATION_CODE = #{vo.stationCode} - - - and - date_format(PLAN_TIME, '%m') = #{vo.month} - - - and - type = #{vo.type} - + + IS_DELETED = 0 + + and + STATION_CODE = #{vo.stationCode} + + + and + date_format(PLAN_TIME, '%Y-%m') = #{vo.yearMonth} + + + and + type = #{vo.type} + + group by businessClassify @@ -58,19 +61,21 @@ BUSINESS_CLASSIFY businessClassify, count(1) count from hzims_message_push_record - where IS_DELETED = 0 - - and - STATION_CODE = #{vo.stationCode} - - - and - date_format(PLAN_TIME, '%m') = #{vo.month} - - - and - type = #{vo.type} - + + IS_DELETED = 0 + + and + STATION_CODE = #{vo.stationCode} + + + and + date_format(PLAN_TIME, '%Y-%m') = #{vo.yearMonth} + + + and + type = #{vo.type} + + group by businessClassify, pusherName @@ -90,18 +95,21 @@ \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java index c7b8f89..0e63ad2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java @@ -1,16 +1,28 @@ package com.hnac.hzims.operational.main.controller.web; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; +import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; +import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; +import com.hnac.hzims.ticket.areamonthly.vo.*; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.support.BladePage; +import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.cloud.openfeign.SpringQueryMap; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 水电生成报告详情数据 @@ -29,24 +41,106 @@ public class AreaMonthlyDetailsController { private final AreaMonthlyDetailsService areaMonthlyDetailsService; + private final IOperMaintenanceTaskService taskService; + /** - * 操作票 根据月份,区域 获取操作详情数据 + * 操作票 根据月份,区域 获取操作详情数据 * * @return */ @GetMapping("/areaMonthlyWithOperation/{page}/{size}") - public R areaMonthlyWithOperation(@PathVariable("page") Long page, - @PathVariable("size") Long size, - AreaMonthlyVo areaMonthly) { - IPage standardTicketInfoVoIPage = - areaMonthlyDetailsService.areaMonthlyWithOperation(page,size, areaMonthly); + public R areaMonthlyWithOperation(@PathVariable("page") Long page, @PathVariable("size") Long size, StandardTicketWithAreaVo areaMonthly) { + BladePage standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperation(page, size, areaMonthly); + return R.data(standardTicketInfoVoIPage); + } + + + /** + * 操作票 根据月份,区域 获取操作详情数据 + * + * @return + */ + @GetMapping("/areaMonthlyWithOperation/detail/{id}") + public R areaMonthlyWithOperationDetail(@PathVariable("id") Long id) { + StandardTicketInfoVO standardTicketInfoVoIPage = areaMonthlyDetailsService.areaMonthlyWithOperationDetail(id); return R.data(standardTicketInfoVoIPage); } + /** + * 查询工作票评论 + */ + @GetMapping("/areaMonthlyWithOperation/workTicketCommentList") + public R> workTicketCommentList(TicketInfoEvaluateEntity req) { + List 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> workTicketListByMonthAndArea(@PathVariable Long page, @PathVariable Long size, @SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) { + BladePage standardWorkVoIPage = areaMonthlyDetailsService.workTicketListByMonthAndArea(page, size, areaMonthlyVo); + return R.data(standardWorkVoIPage); + } + /** + * 根据区域和月份分页查询日志维护列表 + */ + @ApiOperationSupport(order = 100) + @ApiOperation(value = "日志维护列表分页查询") + @GetMapping("/queryLogMaintenancePageList/{page}/{size}") + public R> queryLogMaintenancePageList(@PathVariable Long page, @PathVariable Long size, MaintenanceTaskWithAreaVo maintenanceTaskVo) { + Page pageParam = new Page<>(page, size); + IPage taskList = taskService.queryLogMaintenancePageList(pageParam, maintenanceTaskVo); + return R.data(taskList); + } + + + /** + * 根据区域和月份分页查询日志维护 根据id获取详情 + */ + @GetMapping("/queryLogMaintenancePageList/detail/{id}") + @ApiOperationSupport(order = 40) + @ApiOperation(value = "详情") + public R detail(@PathVariable Long id) { + return taskService.detail(id); + } + + + /** + * 根据区域和月份分页查询巡检任务 + */ + @ApiOperationSupport(order = 50) + @ApiOperation(value = "分页查询") + @GetMapping("/queryCheckTaskPageList") + public R> queryCheckTaskPageList(TaskListQuery task, Query query) { + BladePage taskVoIPage = areaMonthlyDetailsService.queryCheckTaskPageList(task, query); + return R.data(taskVoIPage); + } + + + /** + * 根据id查询巡检任务 + */ + @GetMapping("/queryCheckTaskById/{id}") + @ApiOperationSupport(order = 60) + @ApiOperation(value = "详情") + public R queryCheckTaskById(@PathVariable Long id) { + TaskEntity task = areaMonthlyDetailsService.queryCheckTaskById(id); + return R.data(task); + } + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java index 6ce6fa6..1322f12 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java @@ -1,8 +1,17 @@ package com.hnac.hzims.operational.main.service; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; +import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; +import com.hnac.hzims.ticket.areamonthly.vo.*; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import org.springblade.core.mp.support.BladePage; +import org.springblade.core.mp.support.Query; + +import java.util.List; /** * @@ -20,5 +29,50 @@ public interface AreaMonthlyDetailsService { * @param areaMonthly * @return */ - IPage areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthly); + BladePage areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly); + + + /** + * 根据月份和区域查询工作票列表详情 + * @param page + * @param size + * @param areaMonthlyVo + * @return + */ + BladePage workTicketListByMonthAndArea(Long page, Long size, StandardTicketWithAreaVo areaMonthlyVo); + + /** + * 操作票 根据月份,区域 获取操作详情数据 + * @param id + * @return + */ + StandardTicketInfoVO areaMonthlyWithOperationDetail(Long id); + + /** + * 查询工作票评论 + * @param req + */ + List workTicketCommentList(TicketInfoEvaluateEntity req); + + /** + * 保存评论信息 + * @param req + * @return + */ + Boolean saveComment(TicketInfoEvaluateDto req); + + /** + * 根据区域和月份分页查询巡检任务 + * @param task + * @param query + * @return + */ + BladePage queryCheckTaskPageList(TaskListQuery task, Query query); + + /** + * 根据id查询巡检任务 + * @param id + * @return + */ + TaskEntity queryCheckTaskById(Long id); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java index 2ae6bcb..6dfda4f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java @@ -1,15 +1,25 @@ package com.hnac.hzims.operational.main.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; +import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient; import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.*; +import com.hnac.hzinfo.inspect.areamonthly.feign.TaskFeignClient; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.support.BladePage; +import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springframework.stereotype.Service; +import java.util.List; + /** * 水电生产运行数据 * @@ -26,6 +36,9 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService private final TicketFeignClient ticketFeignClient; + private final TaskFeignClient taskFeignClient; + + /** * 根据月份,区域 获取操作详情数据 * @@ -35,14 +48,118 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService * @return */ @Override - public IPage areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthly) { - R> pageR = - ticketFeignClient.areaMonthlyWithOperation(page, size,areaMonthly); + public BladePage areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) { + R> pageR = + ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly); + if (pageR.isSuccess()) { + log.info("获取操作详情数据成功"); + return pageR.getData(); + } + log.error(pageR.getMsg()); + return null; + } + + /** + * 根据月份和区域查询工作票列表详情 + * + * @param page + * @param size + * @param areaMonthlyVo + * @return + */ + @Override + public BladePage workTicketListByMonthAndArea(Long page, Long size,StandardTicketWithAreaVo areaMonthlyVo) { + R> pageR = + ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo); if (pageR.isSuccess()) { log.info("获取操作详情数据成功"); return pageR.getData(); } - System.out.println(pageR.getMsg()); + log.error("获取操作详情数据失败", pageR.getMsg()); + return null; + } + + /** + * 操作票 根据月份,区域 获取操作详情数据 + * + * @param id + * @return + */ + @Override + public StandardTicketInfoVO areaMonthlyWithOperationDetail(Long id) { + R detail = ticketFeignClient.detail(id); + if (detail.isSuccess()) { + log.info("获取操作详情数据成功"); + return detail.getData(); + } + log.error("获取操作详情数据失败", detail.getMsg()); + return null; + } + + /** + * 查询工作票评论 + * + * @param req + */ + @Override + public List workTicketCommentList(TicketInfoEvaluateEntity req) { + R> 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 queryCheckTaskPageList(TaskListQuery task, Query query) { + R> 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 detail = taskFeignClient.detail(id); + if (detail.isSuccess()) { + log.info("获取巡检检查任务详情成功"); + return detail.getData(); + } + log.error("获取检查巡检任务详情失败", detail.getMsg()); return null; } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceLibraryController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceLibraryController.java index 690d6ee..1bf6b50 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceLibraryController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceLibraryController.java @@ -87,7 +87,8 @@ public class OperMaintenanceLibraryController extends BladeController { @ApiLog @GetMapping("/list") @ApiOperationSupport(order = 50) - @OperationAnnotation(title = "设备维护库",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, + @OperationAnnotation(moduleName = "设备管理",title = "设备维护库",operatorType = OperatorType.MOBILE,businessType = + BusinessType.GENCODE, action = "分页 查询参数:libraryCode,emCode,typeCode,procDefId,disposers(仅支持一人)") @ApiOperation(value = "分页 查询参数:libraryCode,emCode,typeCode,procDefId,disposers(仅支持一人)") public R> list(OperMaintenanceLibraryDTO req, Query query) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java index 28ee3d2..0226a72 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java @@ -3,6 +3,7 @@ package com.hnac.hzims.operational.maintenance.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.invalid.DictInvalid; import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; @@ -16,6 +17,8 @@ import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskCreateTas import com.hnac.hzims.operational.maintenance.scheduled.MaintenanceTaskPushMsg; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; +import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; import io.swagger.annotations.*; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -27,8 +30,11 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.vo.ComleteTask; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.SortDefault; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; import javax.validation.Valid; import java.util.Arrays; @@ -50,107 +56,111 @@ import java.util.stream.Collectors; @Validated public class OperMaintenanceTaskController extends BladeController { - private final IOperMaintenanceTaskService taskService; - private final MaintenanceTaskCreateTask maintenanceTaskCreateTask; - private final MaintenanceTaskPushMsg maintenanceTaskPushMsg; - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "逻辑删除") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(taskService.deleteLogic(Func.toLongList(ids))); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 20) - @ApiOperation(value = "新增") - public R save(@Valid @RequestBody OperMaintenanceTaskDTO req) { - return taskService.doSave(req); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 30) - @ApiOperation(value = "修改") - public R update(@Valid @RequestBody OperMaintenanceTaskDTO req) { - return R.status(taskService.updateById(req)); - } - - /** - * 详情 - */ - @ApiLog - @GetMapping("/detail") - @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情") - public R detail(@RequestParam Long id) { - return taskService.detail(id); - } - - /** - * 分页 - */ - @ApiLog - @GetMapping("/list") - @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") - @ApiImplicitParams({ - }) - @OperationAnnotation(moduleName ="日常维护" ,title = "日常维护记录",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, - action = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") - public R> list(OperMaintenanceTaskDTO req, Query query) { - return taskService.list(req, query); - } - - - @GetMapping("/testCreateTask") - @ApiOperationSupport(order = 60) - @ApiOperation(value = "测试定时生成日常维护任务") - public R testCreateTask(@RequestParam("date") String date) throws Exception { - maintenanceTaskCreateTask.execute(date); - return R.success("推送成功!"); - } - - @GetMapping("/testPushMsg") - @ApiOperationSupport(order = 70) - @ApiOperation(value = "测试消息推送") - public R testPushMsg(@RequestParam("date") String date) throws Exception { - //maintenanceTaskPushMsg.execute(date); - maintenanceTaskPushMsg.maintenancePushMsg("1380746947515691009","200000",200000000000101L,1380746947515691009L); - return R.success("推送成功!"); - } - - @PostMapping("/completeTask") - @ApiOperationSupport(order = 80) - @ApiOperation(value = "完成日常维护工作流任务") - public R completeTask(@RequestBody - @ObjectRequiredInvalid(attributes = {"req.id","req.status","completeTask.taskId","completeTask.processInstanceId","completeTask.flag","completeTask.comment"}) - @DictInvalid(attribute = "req.status",dictKey = "MaintenanceTaskStatus") Map requestMap){ - if(CollectionUtil.isEmpty(requestMap) || ObjectUtil.isEmpty(requestMap.get("req")) || ObjectUtil.isEmpty(requestMap.get("completeTask"))){ - return R.fail("传入参数有误"); - } - OperMaintenanceTaskDTO req = JSON.parseObject(JSON.toJSONString(requestMap.get("req")), OperMaintenanceTaskDTO.class); - ComleteTask completeTask = JSON.parseObject(JSON.toJSONString(requestMap.get("completeTask")), ComleteTask.class); - return taskService.completeTask(req,completeTask); - } - @ApiLog - @PostMapping("/deleteTaskBatch") - @ApiOperationSupport(order = 90) - @ApiOperation(value = "删除日常维护工作流任务") - public R deleteTaskBatch(@RequestBody String body){ - String ids = JSONObject.parseObject(body).getString("ids"); - List taskIdList = Arrays.asList(ids.split(",")).stream().map(taskId->{ - log.info(taskId); - return Long.parseLong(taskId); - }).collect(Collectors.toList()); - return taskService.deleteTaskBatch(taskIdList); - } + private final IOperMaintenanceTaskService taskService; + private final MaintenanceTaskCreateTask maintenanceTaskCreateTask; + private final MaintenanceTaskPushMsg maintenanceTaskPushMsg; + + /** + * 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 10) + @ApiOperation(value = "逻辑删除") + public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { + return R.status(taskService.deleteLogic(Func.toLongList(ids))); + } + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 20) + @ApiOperation(value = "新增") + public R save(@Valid @RequestBody OperMaintenanceTaskDTO req) { + return taskService.doSave(req); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 30) + @ApiOperation(value = "修改") + public R update(@Valid @RequestBody OperMaintenanceTaskDTO req) { + return R.status(taskService.updateById(req)); + } + + /** + * 详情 + */ + @ApiLog + @GetMapping("/detail") + @ApiOperationSupport(order = 40) + @ApiOperation(value = "详情") + public R detail(@RequestParam Long id) { + return taskService.detail(id); + } + + /** + * 分页 + */ + @ApiLog + @GetMapping("/list") + @ApiOperationSupport(order = 50) + @ApiOperation(value = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") + @ApiImplicitParams({ + }) + @OperationAnnotation(moduleName = "日常维护", title = "日常维护记录", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, + action = "分页 查询参数:refLibraryId,processInstanceId,disposer,content,status") + public R> list(OperMaintenanceTaskDTO req, Query query) { + return taskService.list(req, query); + } + + + @GetMapping("/testCreateTask") + @ApiOperationSupport(order = 60) + @ApiOperation(value = "测试定时生成日常维护任务") + public R testCreateTask(@RequestParam("date") String date) throws Exception { + maintenanceTaskCreateTask.execute(date); + return R.success("推送成功!"); + } + + @GetMapping("/testPushMsg") + @ApiOperationSupport(order = 70) + @ApiOperation(value = "测试消息推送") + public R testPushMsg(@RequestParam("date") String date) throws Exception { + //maintenanceTaskPushMsg.execute(date); + maintenanceTaskPushMsg.maintenancePushMsg("1380746947515691009", "200000", 200000000000101L, 1380746947515691009L); + return R.success("推送成功!"); + } + + @PostMapping("/completeTask") + @ApiOperationSupport(order = 80) + @ApiOperation(value = "完成日常维护工作流任务") + public R completeTask(@RequestBody + @ObjectRequiredInvalid(attributes = {"req.id", "req.status", "completeTask.taskId", "completeTask.processInstanceId", "completeTask.flag", "completeTask.comment"}) + @DictInvalid(attribute = "req.status", dictKey = "MaintenanceTaskStatus") Map requestMap) { + if (CollectionUtil.isEmpty(requestMap) || ObjectUtil.isEmpty(requestMap.get("req")) || ObjectUtil.isEmpty(requestMap.get("completeTask"))) { + return R.fail("传入参数有误"); + } + OperMaintenanceTaskDTO req = JSON.parseObject(JSON.toJSONString(requestMap.get("req")), OperMaintenanceTaskDTO.class); + ComleteTask completeTask = JSON.parseObject(JSON.toJSONString(requestMap.get("completeTask")), ComleteTask.class); + return taskService.completeTask(req, completeTask); + } + + @ApiLog + @PostMapping("/deleteTaskBatch") + @ApiOperationSupport(order = 90) + @ApiOperation(value = "删除日常维护工作流任务") + public R deleteTaskBatch(@RequestBody String body) { + String ids = JSONObject.parseObject(body).getString("ids"); + List taskIdList = Arrays.asList(ids.split(",")).stream().map(taskId -> { + log.info(taskId); + return Long.parseLong(taskId); + }).collect(Collectors.toList()); + return taskService.deleteTaskBatch(taskIdList); + } + + + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java index d6431a9..3a23096 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java @@ -1,12 +1,18 @@ package com.hnac.hzims.operational.maintenance.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO; import com.hnac.hzims.operational.report.vo.MaintenanceReportVO; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; +import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; +import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo; import com.hnac.hzims.vo.SafeCheckStatisticVO; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery; +import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -83,4 +89,15 @@ public interface IOperMaintenanceTaskService extends BaseService queryLogMaintenancePageList(Page pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo); + + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java index 21f09c8..996732e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java @@ -2,8 +2,10 @@ package com.hnac.hzims.operational.maintenance.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.hnac.hzims.operational.defect.constants.DefectConstant; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; @@ -22,6 +24,9 @@ import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; import com.hnac.hzims.operational.maintenance.wrapper.OperMaintenanceTaskWrapper; import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; +import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo; +import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo; import com.hnac.hzims.vo.SafeCheckStatisticVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -41,6 +46,7 @@ import org.springblade.system.cache.DictCache; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -62,267 +68,323 @@ import java.util.stream.Collectors; @RequiredArgsConstructor @Slf4j public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl implements IOperMaintenanceTaskService { - private final IDangerSourceClient dangerSourceClient; - private final OperMaintenanceTaskMapper operMaintenanceTaskMapper; - private final OperPhenomenonMapper operPhenomenonMapper; - private final IFlowClient flowClient; - private final IUserClient userClient; + private final IDangerSourceClient dangerSourceClient; + private final OperMaintenanceTaskMapper operMaintenanceTaskMapper; + private final OperPhenomenonMapper operPhenomenonMapper; + private final IFlowClient flowClient; + private final IUserClient userClient; - @Override - public R doSave(OperMaintenanceTaskDTO req) { - req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999))); - //保存时推送消息 - return R.status(super.save(req)); - } + @Override + public R doSave(OperMaintenanceTaskDTO req) { + req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999))); + //保存时推送消息 + return R.status(super.save(req)); + } - @Override - public R detail(Long id) { - OperMaintenanceTaskVO detail = OperMaintenanceTaskWrapper.build().entityVO(super.getById(id)); - detail.setDangerSources(dangerSourceClient.details(detail.getSafo().split(","))); - return R.data(detail); - } + @Override + public R detail(Long id) { + OperMaintenanceTaskVO detail = OperMaintenanceTaskWrapper.build().entityVO(super.getById(id)); + detail.setDangerSources(dangerSourceClient.details(detail.getSafo().split(","))); + return R.data(detail); + } - @Override - public R> list(OperMaintenanceTaskDTO req, Query query) { - Wrapper queryWrapper = new LambdaQueryWrapper() {{ - orderByDesc(OperMaintenanceTaskEntity::getDisposeTime); - if(StringUtil.isNotBlank(req.getTaskIds())){ - in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(","))); - } - if (req.getRefLibraryId() != null) { - eq(OperMaintenanceTaskEntity::getRefLibraryId, req.getRefLibraryId()); - } - if (StringUtils.isNotBlank(req.getProcessInstanceId())) { - eq(OperMaintenanceTaskEntity::getProcessInstanceId, req.getProcessInstanceId()); - } - if (req.getDisposer() != null) { - like(OperMaintenanceTaskEntity::getDisposer, req.getDisposer()); - } - if (StringUtils.isNotBlank(req.getContent())) { - like(OperMaintenanceTaskEntity::getContent, req.getContent()); - } - if (req.getStatus() != null) { - eq(OperMaintenanceTaskEntity::getStatus, req.getStatus()); - } - if (req.getTitle() != null) { - like(OperMaintenanceTaskEntity::getTitle, req.getTitle()); - } - if (req.getTaskType() != null) { - eq(OperMaintenanceTaskEntity::getTaskType, req.getTaskType()); - } - if (req.getExcludeNullTicket() != null && req.getExcludeNullTicket() == 1) { - isNull(OperMaintenanceTaskEntity::getTicketId); - } - if (!StringUtil.isEmpty(req.getStartTime())) { - gt(OperMaintenanceTaskEntity::getDisposeTime,req.getStartTime()); - } - if (!StringUtil.isEmpty(req.getEndTime())) { - lt(OperMaintenanceTaskEntity::getDisposeTime,req.getEndTime()); - } - if(!CollectionUtils.isEmpty(req.getDeptIds())){ - in(OperMaintenanceTaskEntity::getCreateDept,req.getDeptIds()); - } - }}; + @Override + public R> list(OperMaintenanceTaskDTO req, Query query) { + Wrapper queryWrapper = new LambdaQueryWrapper() {{ + orderByDesc(OperMaintenanceTaskEntity::getDisposeTime); + if (StringUtil.isNotBlank(req.getTaskIds())) { + in(OperMaintenanceTaskEntity::getId, Lists.newArrayList(req.getTaskIds().split(","))); + } + if (req.getRefLibraryId() != null) { + eq(OperMaintenanceTaskEntity::getRefLibraryId, req.getRefLibraryId()); + } + if (StringUtils.isNotBlank(req.getProcessInstanceId())) { + eq(OperMaintenanceTaskEntity::getProcessInstanceId, req.getProcessInstanceId()); + } + if (req.getDisposer() != null) { + like(OperMaintenanceTaskEntity::getDisposer, req.getDisposer()); + } + if (StringUtils.isNotBlank(req.getContent())) { + like(OperMaintenanceTaskEntity::getContent, req.getContent()); + } + if (req.getStatus() != null) { + eq(OperMaintenanceTaskEntity::getStatus, req.getStatus()); + } + if (req.getTitle() != null) { + like(OperMaintenanceTaskEntity::getTitle, req.getTitle()); + } + if (req.getTaskType() != null) { + eq(OperMaintenanceTaskEntity::getTaskType, req.getTaskType()); + } + if (req.getExcludeNullTicket() != null && req.getExcludeNullTicket() == 1) { + isNull(OperMaintenanceTaskEntity::getTicketId); + } + if (!StringUtil.isEmpty(req.getStartTime())) { + gt(OperMaintenanceTaskEntity::getDisposeTime, req.getStartTime()); + } + if (!StringUtil.isEmpty(req.getEndTime())) { + lt(OperMaintenanceTaskEntity::getDisposeTime, req.getEndTime()); + } + if (!CollectionUtils.isEmpty(req.getDeptIds())) { + in(OperMaintenanceTaskEntity::getCreateDept, req.getDeptIds()); + } + }}; - IPage pages = super.page(Condition.getPage(query), queryWrapper); - pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords())); - return R.data(pages); - } + IPage pages = super.page(Condition.getPage(query), queryWrapper); + pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords())); + return R.data(pages); + } - @Override - public String genTaskCode(Integer num) { - return DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("000").format(num); - } + @Override + public String genTaskCode(Integer num) { + return DateUtil.format(DateUtil.now(), DateUtil.PATTERN_DATETIME_MINI) + new DecimalFormat("000").format(num); + } - @Override - public List getByEmCode(String emCode, List list) { - return this.baseMapper.selectByEmCode(emCode,list); - } + @Override + public List getByEmCode(String emCode, List list) { + return this.baseMapper.selectByEmCode(emCode, list); + } - @Override - public List getMaintenanceStatisticsByDisposer(LocalDate startDate, LocalDate endDate, List deptIdList) { - List maintenanceReportVOList = new ArrayList<>(); - //查询当月日常维护任务 - List operMaintenanceTaskEntityList = this.baseMapper.selectList(new LambdaQueryWrapper(){{ - ge(OperMaintenanceTaskEntity::getDisposeTime,startDate); - le(OperMaintenanceTaskEntity::getDisposeTime,endDate); - in(OperMaintenanceTaskEntity::getCreateDept,deptIdList); - }}); - //按执行人组合 - if(CollectionUtil.isNotEmpty(operMaintenanceTaskEntityList)){ - Map> map = operMaintenanceTaskEntityList.stream().filter(o->StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer)); - map.forEach((k,v)->{ - MaintenanceReportVO maintenanceReportVO = new MaintenanceReportVO(); - //获取执行人名字 - List userIdList = Arrays.asList(k.split(",")).stream().map(o->Long.parseLong(o)).collect(Collectors.toList()); - String userName = userIdList.stream().map(userId -> { - User user = UserCache.getUser(userId); - return Optional.ofNullable(user).map(User::getName).orElse(""); - }).collect(Collectors.joining(",")); - maintenanceReportVO.setOperMaintenanceTaskEntityList(v); - maintenanceReportVO.setUserName(userName); - //已完成任务 - List finishTask = v.stream().filter(o-> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); - Map> finishTaskGroupByType = finishTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode)); - AtomicReference finishSituation = new AtomicReference<>(""); - finishTaskGroupByType.forEach((TypeCode,TypeList)->{ - try{ - finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n")); - } - catch(NullPointerException e){ - e.printStackTrace(); - } - }); - maintenanceReportVO.setCompleteNum(finishTask.size()); - maintenanceReportVO.setCompleteSituation(finishSituation.get()); - //未完成任务 - List immatureTask = v.stream().filter(o-> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList()); - Map> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode)); - AtomicReference immatureTaskSituation = new AtomicReference<>(""); - immatureTaskTaskGroupByType.forEach((TypeCode,TypeList)->{ - immatureTaskSituation.set(immatureTaskSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n")); - }); - maintenanceReportVO.setIncompleteNum(immatureTask.size()); - maintenanceReportVO.setIncompleteSituation(immatureTaskSituation.get()); + @Override + public List getMaintenanceStatisticsByDisposer(LocalDate startDate, LocalDate endDate, List deptIdList) { + List maintenanceReportVOList = new ArrayList<>(); + //查询当月日常维护任务 + List operMaintenanceTaskEntityList = this.baseMapper.selectList(new LambdaQueryWrapper() {{ + ge(OperMaintenanceTaskEntity::getDisposeTime, startDate); + le(OperMaintenanceTaskEntity::getDisposeTime, endDate); + in(OperMaintenanceTaskEntity::getCreateDept, deptIdList); + }}); + //按执行人组合 + if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntityList)) { + Map> map = operMaintenanceTaskEntityList.stream().filter(o -> StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer)); + map.forEach((k, v) -> { + MaintenanceReportVO maintenanceReportVO = new MaintenanceReportVO(); + //获取执行人名字 + List userIdList = Arrays.asList(k.split(",")).stream().map(o -> Long.parseLong(o)).collect(Collectors.toList()); + String userName = userIdList.stream().map(userId -> { + User user = UserCache.getUser(userId); + return Optional.ofNullable(user).map(User::getName).orElse(""); + }).collect(Collectors.joining(",")); + maintenanceReportVO.setOperMaintenanceTaskEntityList(v); + maintenanceReportVO.setUserName(userName); + //已完成任务 + List finishTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); + Map> finishTaskGroupByType = finishTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode)); + AtomicReference finishSituation = new AtomicReference<>(""); + finishTaskGroupByType.forEach((TypeCode, TypeList) -> { + try { + finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n")); + } catch (NullPointerException e) { + e.printStackTrace(); + } + }); + maintenanceReportVO.setCompleteNum(finishTask.size()); + maintenanceReportVO.setCompleteSituation(finishSituation.get()); + //未完成任务 + List immatureTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList()); + Map> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode)); + AtomicReference immatureTaskSituation = new AtomicReference<>(""); + immatureTaskTaskGroupByType.forEach((TypeCode, TypeList) -> { + immatureTaskSituation.set(immatureTaskSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n")); + }); + maintenanceReportVO.setIncompleteNum(immatureTask.size()); + maintenanceReportVO.setIncompleteSituation(immatureTaskSituation.get()); - //获取问题数量 - List operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper(){{ - in(OperPhenomenonEntity::getFinder,userIdList); - eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.RCWH.getStatus()); - ge(OperPhenomenonEntity::getFindTime,startDate); - le(OperPhenomenonEntity::getFindTime,endDate); - in(OperPhenomenonEntity::getCreateDept,deptIdList); - }}); - maintenanceReportVO.setFindProblemNum(operPhenomenonEntityList.size()); - //获取工时 - int actHoursSum = v.stream().collect(Collectors.summingInt(OperMaintenanceTaskEntity::getHours)); - maintenanceReportVO.setHours(actHoursSum); - //合计 - maintenanceReportVO.setCount(v.size()); - maintenanceReportVOList.add(maintenanceReportVO); - }); - } - return maintenanceReportVOList; - } + //获取问题数量 + List operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper() {{ + in(OperPhenomenonEntity::getFinder, userIdList); + eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.RCWH.getStatus()); + ge(OperPhenomenonEntity::getFindTime, startDate); + le(OperPhenomenonEntity::getFindTime, endDate); + in(OperPhenomenonEntity::getCreateDept, deptIdList); + }}); + maintenanceReportVO.setFindProblemNum(operPhenomenonEntityList.size()); + //获取工时 + int actHoursSum = v.stream().collect(Collectors.summingInt(OperMaintenanceTaskEntity::getHours)); + maintenanceReportVO.setHours(actHoursSum); + //合计 + maintenanceReportVO.setCount(v.size()); + maintenanceReportVOList.add(maintenanceReportVO); + }); + } + return maintenanceReportVOList; + } - @Override - public List getMaintenanceStatisticsByDisposer(Map params) { - LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); - LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); - List deptIdList = (List) params.get("deptId"); - return getMaintenanceStatisticsByDisposer(startDate,endDate,deptIdList); - } + @Override + public List getMaintenanceStatisticsByDisposer(Map params) { + LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); + LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); + List deptIdList = (List) params.get("deptId"); + return getMaintenanceStatisticsByDisposer(startDate, endDate, deptIdList); + } - @Override - public List> getMaintenanceConclusion(Map params) { - return operMaintenanceTaskMapper.getMaintenanceConclusion(params); - } + @Override + public List> getMaintenanceConclusion(Map params) { + return operMaintenanceTaskMapper.getMaintenanceConclusion(params); + } - @Override - public List getMaintenanceTask(String startTime, String endTime, List list) { - return this.baseMapper.selectMaintenanceTask(startTime,endTime,list); - } + @Override + public List getMaintenanceTask(String startTime, String endTime, List list) { + return this.baseMapper.selectMaintenanceTask(startTime, endTime, list); + } - @Override - @Transactional - public R completeTask(OperMaintenanceTaskDTO req, ComleteTask completeTask) { - /**如果当前流程为待确认、归档,则从相应角色内获取人员列表完成工作流任务**/ - if(req.getStatus() == MaintenanceConstant.TASK_STATUS_3 || req.getStatus() == MaintenanceConstant.TASK_STATUS_4){ - R> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),req.getCreateDept(),MaintenanceConstant.GROUP_LEADER); - if(!userListR.isSuccess() || CollectionUtil.isEmpty(userListR.getData())){ - throw new ServiceException("获取"+MaintenanceConstant.GROUP_LEADER+"角色下的用户为空或失败"); - } - String leaders = userListR.getData().stream().map(user->"taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); - log.info("获取角色下的人员为:{}",leaders); - if(CollectionUtil.isEmpty(completeTask.getVariables())){ - completeTask.setVariables(new HashMap<>()); - } - completeTask.getVariables().put(MaintenanceConstant.GROUP_LEADER,leaders); - } - R completeR = flowClient.completeTask(completeTask); - if(!completeR.isSuccess()){ - throw new ServiceException(completeR.getMsg()); - } - return R.status(this.updateById(req)); - } + @Override + @Transactional + public R completeTask(OperMaintenanceTaskDTO req, ComleteTask completeTask) { + /**如果当前流程为待确认、归档,则从相应角色内获取人员列表完成工作流任务**/ + if (req.getStatus() == MaintenanceConstant.TASK_STATUS_3 || req.getStatus() == MaintenanceConstant.TASK_STATUS_4) { + R> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), req.getCreateDept(), MaintenanceConstant.GROUP_LEADER); + if (!userListR.isSuccess() || CollectionUtil.isEmpty(userListR.getData())) { + throw new ServiceException("获取" + MaintenanceConstant.GROUP_LEADER + "角色下的用户为空或失败"); + } + String leaders = userListR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); + log.info("获取角色下的人员为:{}", leaders); + if (CollectionUtil.isEmpty(completeTask.getVariables())) { + completeTask.setVariables(new HashMap<>()); + } + completeTask.getVariables().put(MaintenanceConstant.GROUP_LEADER, leaders); + } + R completeR = flowClient.completeTask(completeTask); + if (!completeR.isSuccess()) { + throw new ServiceException(completeR.getMsg()); + } + return R.status(this.updateById(req)); + } - @Override - @Transactional - public R deleteTaskBatch(List taskIdList) { - taskIdList.forEach(taskId->{ - /**删除工作流任务**/ - EndVo endVo = new EndVo(); - if(Func.isEmpty(taskId)){ - return; - } - OperMaintenanceTaskEntity taskEntity = this.getById(taskId); - if(ObjectUtil.isEmpty(taskEntity) || ObjectUtil.isEmpty(taskEntity.getProcessInstanceId())){ - return; - } - R r = flowClient.delProcessInstanceById(taskEntity.getProcessInstanceId(),"删除日常维护任务"); - if(!r.isSuccess()){ - throw new ServiceException(r.getMsg()); - } - /**删除任务**/ - this.removeById(taskId); - }); - return R.success("删除成功!"); - } + @Override + @Transactional + public R deleteTaskBatch(List taskIdList) { + taskIdList.forEach(taskId -> { + /**删除工作流任务**/ + EndVo endVo = new EndVo(); + if (Func.isEmpty(taskId)) { + return; + } + OperMaintenanceTaskEntity taskEntity = this.getById(taskId); + if (ObjectUtil.isEmpty(taskEntity) || ObjectUtil.isEmpty(taskEntity.getProcessInstanceId())) { + return; + } + R r = flowClient.delProcessInstanceById(taskEntity.getProcessInstanceId(), "删除日常维护任务"); + if (!r.isSuccess()) { + throw new ServiceException(r.getMsg()); + } + /**删除任务**/ + this.removeById(taskId); + }); + return R.success("删除成功!"); + } - /** - * 获取当班定期工作 - * @param start - * @param end - * @param list - * @return - */ - @Override - public RegularWorkVO getDutyRegularWork(String start, String end, List list) { - RegularWorkVO regularWorkVO = new RegularWorkVO(); - // 查询定期工作任务 - List regularWorkList = this.list(new LambdaQueryWrapper(){{ - ge(OperMaintenanceTaskEntity::getDisposeTime,start) - .le(OperMaintenanceTaskEntity::getDisposeTime,end) - .eq(OperMaintenanceTaskEntity::getTypeCode,"05") - .in(OperMaintenanceTaskEntity::getCreateDept,list); - }}); - if(CollectionUtil.isEmpty(regularWorkList)){ - regularWorkVO.setRegularWorkSum(0); - regularWorkVO.setRegularWork(0); - return regularWorkVO; - } - regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id->id.toString()).collect(Collectors.joining(","))); - regularWorkVO.setRegularWorkSum(regularWorkList.size()); - // 定期工作任务完成数量 - List regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(regularWorkFinishList)){ - regularWorkVO.setRegularWork(0); - return regularWorkVO; - } - regularWorkVO.setRegularWork(regularWorkFinishList.size()); - return regularWorkVO; - } + /** + * 获取当班定期工作 + * + * @param start + * @param end + * @param list + * @return + */ + @Override + public RegularWorkVO getDutyRegularWork(String start, String end, List list) { + RegularWorkVO regularWorkVO = new RegularWorkVO(); + // 查询定期工作任务 + List regularWorkList = this.list(new LambdaQueryWrapper() {{ + ge(OperMaintenanceTaskEntity::getDisposeTime, start) + .le(OperMaintenanceTaskEntity::getDisposeTime, end) + .eq(OperMaintenanceTaskEntity::getTypeCode, "05") + .in(OperMaintenanceTaskEntity::getCreateDept, list); + }}); + if (CollectionUtil.isEmpty(regularWorkList)) { + regularWorkVO.setRegularWorkSum(0); + regularWorkVO.setRegularWork(0); + return regularWorkVO; + } + regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id -> id.toString()).collect(Collectors.joining(","))); + regularWorkVO.setRegularWorkSum(regularWorkList.size()); + // 定期工作任务完成数量 + List regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(regularWorkFinishList)) { + regularWorkVO.setRegularWork(0); + return regularWorkVO; + } + regularWorkVO.setRegularWork(regularWorkFinishList.size()); + return regularWorkVO; + } - /** - * 获取安全检查日常维护任务 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param dept 机构ID - * @return SafeCheckStatisticVO对象 - */ - @Override - public SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate, String endDate, Long dept) { - //获取已完成任务 - List taskEntityList = this.list(Wrappers.lambdaQuery() - .eq(OperMaintenanceTaskEntity::getStatus,MaintenanceConstant.TASK_STATUS_5) - .eq(OperMaintenanceTaskEntity::getCreateDept,dept) - .ge(OperMaintenanceTaskEntity::getDisposeTime,startDate) - .le(OperMaintenanceTaskEntity::getDisposeTime,endDate) - ); - SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); - vo.setProjectType(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getType()); - vo.setProjectTypeName(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getName()); - vo.setTotal(taskEntityList.size()); - return vo; - } + /** + * 获取安全检查日常维护任务 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param dept 机构ID + * @return SafeCheckStatisticVO对象 + */ + @Override + public SafeCheckStatisticVO getMaintenanceTaskCheck(String startDate, String endDate, Long dept) { + //获取已完成任务 + List taskEntityList = this.list(Wrappers.lambdaQuery() + .eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_5) + .eq(OperMaintenanceTaskEntity::getCreateDept, dept) + .ge(OperMaintenanceTaskEntity::getDisposeTime, startDate) + .le(OperMaintenanceTaskEntity::getDisposeTime, endDate) + ); + SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); + vo.setProjectType(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getType()); + vo.setProjectTypeName(Constants.SafeCheckProjectEnum.MAINTENANCE_TASK.getName()); + vo.setTotal(taskEntityList.size()); + return vo; + } + + /** + * 根据区域和月份分页查询日志维护列表 + * + * @param pageParam + * @param areaMonthlyVo + * @return + */ + @Override + public IPage queryLogMaintenancePageList(Page pageParam, MaintenanceTaskWithAreaVo areaMonthlyVo) { + //1.根据区域查询 + QueryWrapper 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 operMaintenanceTaskEntityPage = baseMapper.selectPage(pageParam, queryWrapper); + //数据转换 + if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntityPage.getRecords())) { + List 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 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 taskVos = new Page<>(); + taskVos.setRecords(maintenanceTaskVos); + taskVos.setTotal(operMaintenanceTaskEntityPage.getTotal()); + taskVos.setPages(operMaintenanceTaskEntityPage.getPages()); + taskVos.setSize(operMaintenanceTaskEntityPage.getSize()); + return taskVos; + } + return null; + } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java index b28d1a1..7e44bfa 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java @@ -7,8 +7,9 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.OperatorType; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService; @@ -19,6 +20,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.annotation.ApiLog; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; @@ -115,12 +117,13 @@ public class StandardTicketInfoController extends BladeController { * @return */ @GetMapping("/areaMonthlyWithOperation/{page}/{size}") - public R> areaMonthlyWithOperation( + public R> areaMonthlyWithOperation( @PathVariable("page") Long page, @PathVariable("size") Long size, - @SpringQueryMap AreaMonthlyVo areaMonthlyVo) { + @SpringQueryMap StandardTicketWithAreaVo areaMonthlyVo) { Page searchPage = new Page<>(page, size); - IPage standardTicketInfoEntity = + + BladePage standardTicketInfoEntity = standardTicketInfoService.areaMonthlyWithOperation(areaMonthlyVo, searchPage); return R.data(standardTicketInfoEntity); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java index abae5de..be22563 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java @@ -4,13 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo; import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO; import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.flow.core.vo.ComleteTask; @@ -105,6 +107,6 @@ public interface IStandardTicketInfoService extends BaseService areaMonthlyWithOperation(AreaMonthlyVo areaMonthly, Page searchPage); + BladePage areaMonthlyWithOperation(StandardTicketWithAreaVo areaMonthly, Page searchPage); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index a4d8a3d..fb7f139 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -11,8 +11,10 @@ import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; -import com.hnac.hzims.ticket.areamonthly.StandardTicketVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo; import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; +import com.hnac.hzims.ticket.constants.DictConstants; import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketMeasureDto; @@ -34,6 +36,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Workbook; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -43,6 +46,9 @@ import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.vo.ComleteTask; +import org.springblade.system.cache.DictCache; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -55,10 +61,7 @@ import java.time.LocalDateTime; import java.time.YearMonth; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -319,16 +322,31 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl areaMonthlyWithOperation(AreaMonthlyVo areaMonthly, Page searchPage) { + public BladePage areaMonthlyWithOperation(StandardTicketWithAreaVo areaVo, Page searchPage) { + //1.查询 QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("CREATE_DEPT", areaMonthly.getAreaId()); - queryWrapper.eq(areaMonthly.getYearMonth() != null, - "date_format(create_time,'%Y-%m')", areaMonthly.getYearMonth()); + //开票来源 + queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), StandardTicketInfoEntity::getTaskType, + areaVo.getTaskType()); + //编号 + queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), StandardTicketInfoEntity::getCode, areaVo.getCode()); + //状态 + queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), StandardTicketInfoEntity::getStatus, + areaVo.getStatus()); + //开始时间 + queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), StandardTicketInfoEntity::getCreateTime, + areaVo.getStartTime()); + //结束时间 + queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), StandardTicketInfoEntity::getCreateTime, + areaVo.getEndTime()); + queryWrapper.eq("CREATE_DEPT", areaVo.getAreaId()); + queryWrapper.eq(areaVo.getYearMonth() != null, + "date_format(create_time,'%Y-%m')", areaVo.getYearMonth()); Page standardTicketInfoEntityPage = baseMapper.selectPage(searchPage, queryWrapper); //数据转换StandardTicketInfoEntity ==> StandardTicketVo List standardTicketInfoVOList = new ArrayList<>(); @@ -336,6 +354,17 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl { StandardTicketVo standardTicketVo = new StandardTicketVo(); BeanUtils.copyProperties(item, standardTicketVo); + /*发令人、受令人、负责人、监护人*/ + User issueOrderPerson = UserCache.getUser(standardTicketVo.getIssueOrderPerson()); + User accessOrderPerson = UserCache.getUser(standardTicketVo.getAccessOrderPerson()); + User principal = UserCache.getUser(standardTicketVo.getPrincipal()); + User guardian = UserCache.getUser(standardTicketVo.getGuardian()); + standardTicketVo.setIssueOrderPersonName(Optional.ofNullable(issueOrderPerson).map(User::getName).orElse(null)); + standardTicketVo.setAccessOrderPersonName(Optional.ofNullable(accessOrderPerson).map(User::getName).orElse(null)); + standardTicketVo.setPrincipalName(Optional.ofNullable(principal).map(User::getName).orElse(null)); + standardTicketVo.setGuardianName(Optional.ofNullable(guardian).map(User::getName).orElse(null)); + /**来源类型名称**/ + standardTicketVo.setTaskTypeName(Optional.ofNullable(item.getTaskType()).map(t-> DictCache.getValue(DictConstants.TICKET_SOURCE_TYPE,t)).orElse(null)); return standardTicketVo; }).collect(Collectors.toList()); } @@ -344,7 +373,10 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl bladePage = BladePage.of(page); + return bladePage; } /** diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java index 8232e81..f92e35e 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/controller/WorkTicketInfoController.java @@ -2,21 +2,27 @@ package com.hnac.hzims.ticket.workTicket.controller; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.invalid.DictInvalid; import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; import com.hnac.hzims.ticket.constants.DictConstants; import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto; import com.hnac.hzims.ticket.workTicket.dto.WorkInfoFlowDto; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO; import io.swagger.annotations.*; import lombok.AllArgsConstructor; import org.springblade.core.log.annotation.ApiLog; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; @@ -27,6 +33,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.util.List; import java.util.Map; /** @@ -39,139 +46,155 @@ import java.util.Map; */ @RestController @RequestMapping("/workTicketInfo") -@Api(value = "工作票管理",tags = "工作票管理") +@Api(value = "工作票管理", tags = "工作票管理") @AllArgsConstructor @Validated public class WorkTicketInfoController { - private final IWorkTicketInfoService workTicketInfoService; - - /** - * 删除 - */ - @GetMapping("/remove") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "逻辑删除") - public R remove(@RequestParam Long id,@RequestParam String comment) { - return workTicketInfoService.remove(id,comment); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 20) - @ApiOperation(value = "新增") - public R save(@Valid @RequestBody WorkTicketInfoDto req) { - return workTicketInfoService.doSave(req); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 30) - @ApiOperation(value = "修改") - public R update(@Valid @RequestBody WorkTicketInfoDto req) { - return R.status(workTicketInfoService.updateById(req)); - } - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 40) - @ApiOperation(value = "详情") - public R detail(@RequestParam Long id) { - return workTicketInfoService.detail(id); - } - - /** - * 分页 - */ - @ApiLog - @PostMapping("/queryList") - @ApiOperationSupport(order = 50) - @ApiOperation(value = "分页") - @OperationAnnotation(moduleName = "两票管理",title = "工作票" - ,operatorType = OperatorType.MOBILE,businessType = - BusinessType.GENCODE, - action = "分页") - public R> queryList(WorkTicketInfoDto req, Query query) { - return workTicketInfoService.queryList(req, query); - } - - @GetMapping(value = "/exportWorkTicketInfoPdf") - @ApiOperationSupport(order = 60) - @ApiImplicitParam(name = "req",value = "工作票dto对象,导出传参id进入即可") - @ApiOperation(value = "导出工作票pdf文档") - public void exportWorkTicketInfoPdf(@RequestParam Long id, HttpServletResponse response){ - workTicketInfoService.exportWorkTicketInfoPdf(id,response); - } - - @GetMapping(value = "/exportWorkTicketTemplate") - @ApiOperationSupport(order = 80) - @ApiImplicitParam(name = "req",value = "工作票dto对象,导出传参id进入即可") - @ApiOperation(value = "导出工作票pdf模板") - public void exportWorkTicketTemplate(@RequestParam Long id, HttpServletResponse response){ - workTicketInfoService.exportWorkTicketTemplate(id,response); - } - - @PostMapping("/completeTask") - @ApiOperationSupport(order = 70) - @ApiOperation(value = "执行工作流任务") - public R completeTask(@RequestBody @ObjectRequiredInvalid(attributes = {"req.id","req.status","flow.processInstanceId","flow.taskId","flow.flag"}) - @DictInvalid(dictKey = DictConstants.FIRST_TICKET_FLOW,attribute = "req.status") WorkInfoFlowDto workInfoFlowDto){ - return workTicketInfoService.completeTask(workInfoFlowDto.getReq(),workInfoFlowDto.getFlow()); - } - - @PostMapping("/finishOfflineTicket") - @ApiOperationSupport(order = 80) - @ApiImplicitParams({ - @ApiImplicitParam(name = "accessTaskDTO", value = "检修任务对象,需传id、actHours,accessMaterials", paramType = "body", dataType = "AccessTaskDTO对象", required = true), - @ApiImplicitParam(name = "workTicketInfoDto", value = "工作票对象,需传id", paramType = "body", dataType = "WorkTicketInfoDto对象", required = true) - }) - @ApiOperation(value = "终结离线工作票") - public R finishOfflineTicket(@RequestBody TicketAccessTaskDto ticketAccessTaskDto) { - return workTicketInfoService.finishOfflineTicket(ticketAccessTaskDto); - } - - @PostMapping("/licenseOfflineTicket") - @ApiOperationSupport(order = 90) - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "工作票主键ID", paramType = "body", dataType = "Long", required = true) - }) - @ApiOperation(value = "许可离线工作票") - public R licenseOfflineTicket(@RequestBody WorkTicketInfoDto req) { - return workTicketInfoService.licenseOfflineTicket(req); - } - - @ApiLog - @GetMapping("/userListByRoleAlias") - @ApiOperationSupport(order = 100) - @OperationAnnotation(moduleName = "两票管理", - title = "两票管理(工作票)",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, - action = "获取某机构下角色的人员列表") - @ApiOperation(value = "获取某机构下角色的人员列表") - public R userListByRoleAlias(@RequestParam("roleAlias") @ApiParam("角色别称") String roleAlias) { - IUserClient userClient = SpringUtil.getBean(IUserClient.class); - final String ADMIN = "admin"; - //当账号为管理员时 查询出租户200000下所有角色成员 - if(StringUtil.isNotBlank(AuthUtil.getDeptId()) && ADMIN.equalsIgnoreCase(AuthUtil.getUserAccount())){ - return userClient.userListByRoleAlias(AuthUtil.getTenantId(),roleAlias); - } - //获取当前用户权限下的用户列表 - return userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),Long.parseLong(AuthUtil.getDeptId()),roleAlias); - } - - @GetMapping("/verificationRole") - @ApiOperationSupport(order = 110) - @ApiImplicitParams({ - @ApiImplicitParam(name = "deptId",value = "机构ID",dataType = "Long",paramType = "path"), - @ApiImplicitParam(name = "roleAliasArray",value = "角色别称 按,分隔",dataType = "String",paramType = "path") - }) - @ApiOperation(value = "验证某机构下的角色是否能查询到相关人员") - public R> verificationRole(@RequestParam("deptId") Long deptId,@RequestParam("roleAliasArray") String roleAliasArray ) { - return workTicketInfoService.verificationRole(deptId,roleAliasArray); - } + private final IWorkTicketInfoService workTicketInfoService; + + /** + * 删除 + */ + @GetMapping("/remove") + @ApiOperationSupport(order = 10) + @ApiOperation(value = "逻辑删除") + public R remove(@RequestParam Long id, @RequestParam String comment) { + return workTicketInfoService.remove(id, comment); + } + + /** + * 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 20) + @ApiOperation(value = "新增") + public R save(@Valid @RequestBody WorkTicketInfoDto req) { + return workTicketInfoService.doSave(req); + } + + /** + * 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 30) + @ApiOperation(value = "修改") + public R update(@Valid @RequestBody WorkTicketInfoDto req) { + return R.status(workTicketInfoService.updateById(req)); + } + + /** + * 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 40) + @ApiOperation(value = "详情") + public R detail(@RequestParam Long id) { + return workTicketInfoService.detail(id); + } + + /** + * 分页 + */ + @ApiLog + @PostMapping("/queryList") + @ApiOperationSupport(order = 50) + @ApiOperation(value = "分页") + @OperationAnnotation(moduleName = "两票管理", title = "工作票" + , operatorType = OperatorType.MOBILE, businessType = + BusinessType.GENCODE, + action = "分页") + public R> queryList(WorkTicketInfoDto req, Query query) { + return workTicketInfoService.queryList(req, query); + } + + @GetMapping(value = "/exportWorkTicketInfoPdf") + @ApiOperationSupport(order = 60) + @ApiImplicitParam(name = "req", value = "工作票dto对象,导出传参id进入即可") + @ApiOperation(value = "导出工作票pdf文档") + public void exportWorkTicketInfoPdf(@RequestParam Long id, HttpServletResponse response) { + workTicketInfoService.exportWorkTicketInfoPdf(id, response); + } + + @GetMapping(value = "/exportWorkTicketTemplate") + @ApiOperationSupport(order = 80) + @ApiImplicitParam(name = "req", value = "工作票dto对象,导出传参id进入即可") + @ApiOperation(value = "导出工作票pdf模板") + public void exportWorkTicketTemplate(@RequestParam Long id, HttpServletResponse response) { + workTicketInfoService.exportWorkTicketTemplate(id, response); + } + + @PostMapping("/completeTask") + @ApiOperationSupport(order = 70) + @ApiOperation(value = "执行工作流任务") + public R completeTask(@RequestBody @ObjectRequiredInvalid(attributes = {"req.id", "req.status", "flow.processInstanceId", "flow.taskId", "flow.flag"}) + @DictInvalid(dictKey = DictConstants.FIRST_TICKET_FLOW, attribute = "req.status") WorkInfoFlowDto workInfoFlowDto) { + return workTicketInfoService.completeTask(workInfoFlowDto.getReq(), workInfoFlowDto.getFlow()); + } + + @PostMapping("/finishOfflineTicket") + @ApiOperationSupport(order = 80) + @ApiImplicitParams({ + @ApiImplicitParam(name = "accessTaskDTO", value = "检修任务对象,需传id、actHours,accessMaterials", paramType = "body", dataType = "AccessTaskDTO对象", required = true), + @ApiImplicitParam(name = "workTicketInfoDto", value = "工作票对象,需传id", paramType = "body", dataType = "WorkTicketInfoDto对象", required = true) + }) + @ApiOperation(value = "终结离线工作票") + public R finishOfflineTicket(@RequestBody TicketAccessTaskDto ticketAccessTaskDto) { + return workTicketInfoService.finishOfflineTicket(ticketAccessTaskDto); + } + + @PostMapping("/licenseOfflineTicket") + @ApiOperationSupport(order = 90) + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "工作票主键ID", paramType = "body", dataType = "Long", required = true) + }) + @ApiOperation(value = "许可离线工作票") + public R licenseOfflineTicket(@RequestBody WorkTicketInfoDto req) { + return workTicketInfoService.licenseOfflineTicket(req); + } + + @ApiLog + @GetMapping("/userListByRoleAlias") + @ApiOperationSupport(order = 100) + @OperationAnnotation(moduleName = "两票管理", + title = "两票管理(工作票)", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, + action = "获取某机构下角色的人员列表") + @ApiOperation(value = "获取某机构下角色的人员列表") + public R userListByRoleAlias(@RequestParam("roleAlias") @ApiParam("角色别称") String roleAlias) { + IUserClient userClient = SpringUtil.getBean(IUserClient.class); + final String ADMIN = "admin"; + //当账号为管理员时 查询出租户200000下所有角色成员 + if (StringUtil.isNotBlank(AuthUtil.getDeptId()) && ADMIN.equalsIgnoreCase(AuthUtil.getUserAccount())) { + return userClient.userListByRoleAlias(AuthUtil.getTenantId(), roleAlias); + } + //获取当前用户权限下的用户列表 + return userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), Long.parseLong(AuthUtil.getDeptId()), roleAlias); + } + + @GetMapping("/verificationRole") + @ApiOperationSupport(order = 110) + @ApiImplicitParams({ + @ApiImplicitParam(name = "deptId", value = "机构ID", dataType = "Long", paramType = "path"), + @ApiImplicitParam(name = "roleAliasArray", value = "角色别称 按,分隔", dataType = "String", paramType = "path") + }) + @ApiOperation(value = "验证某机构下的角色是否能查询到相关人员") + public R> verificationRole(@RequestParam("deptId") Long deptId, @RequestParam("roleAliasArray") String roleAliasArray) { + return workTicketInfoService.verificationRole(deptId, roleAliasArray); + } + + + /** + * 根据月份和区域查询工作票列表详情 + */ + @GetMapping("/workTicketListByMonthAndArea/{page}/{size}") + public R> workTicketListByMonthAndArea(@PathVariable Long page, + @PathVariable Long size, + StandardTicketWithAreaVo standardTicketWithAreaVo) { + Page pageEntity = new Page<>(page, size); + BladePage standardWorkVoList = workTicketInfoService + .workTicketListByMonthAndArea(pageEntity, + standardTicketWithAreaVo); + return R.data(standardWorkVoList); + } + } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java index 388e63b..37f0e5f 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java @@ -1,12 +1,17 @@ package com.hnac.hzims.ticket.workTicket.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; +import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; import com.hnac.hzims.ticket.workTicket.dto.TicketAccessTaskDto; import com.hnac.hzims.ticket.workTicket.dto.WorkTicketInfoDto; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO; import com.hnac.hzims.vo.SafeCheckStatisticVO; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.flow.core.entity.BladeFlow; @@ -123,4 +128,11 @@ public interface IWorkTicketInfoService extends BaseService> verificationRole(Long deptId, String roleAliasArray); + /** + * 根据月份和区域查询工作票列表详情 + * @param pageEntity + * @param standardTicketWithAreaVo + * @return + */ + BladePage workTicketListByMonthAndArea(Page pageEntity, StandardTicketWithAreaVo standardTicketWithAreaVo); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java index 5af6e85..60b5d45 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java +++ b/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.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; 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.constants.TicketConstants; 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 lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import lombok.var; import org.apache.commons.collections.map.HashedMap; import org.apache.poi.ss.usermodel.Workbook; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; @@ -43,6 +50,7 @@ import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.vo.ComleteTask; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -74,695 +82,682 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class WorkTicketInfoServiceImpl extends BaseServiceImpl implements IWorkTicketInfoService { - private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService; - private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService; - private final IWorkTicketDelayService delayService; - private final IWorkTicketMembersChangeService workTicketMembersChangeService; - private final IWorkTicketOperateTimeService workTicketOperateTimeService; - private final IWorkTicketFlowService workTicketFlowService; - private final IFlowClient flowClient; - private final IUserClient userClient; - private final WorkDelayNoScopeMapper workDelayNoScopeMapper; - private final IOperAccessTaskClient operAccessTaskClient; - private final ITaskClient taskClient; - - /**生成两票编号锁**/ - private Lock lock = new ReentrantLock(); - - /**word模板预览导出保存路径**/ - @Value("${hzims.ticket.path.xlsx.savePath}") - private String xlsSavePath; - - @Value("${hzims.ticket.first-work-flow-key}") - private String firstWorkTicketFlowKey; - - @Value("${hzims.tenantId}") - private String tenantId; - - @Value("${hzims.ticket.path.pdf.savePath}") - private String pdfSavePath; - - @Override - @Transactional - @AroundFlow - public R doSave(WorkTicketInfoDto req) { - req.setCode(this.getWorkTicketCode()); - req.setStatus(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers()) ? TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus() : TicketConstants.FirstWorkTicketFlowStatusEnum.SIGN.getStatus()); - boolean flag = this.save(req); - /**保存安全措施**/ - if(flag && CollectionUtil.isNotEmpty(req.getWorkTicketSafetyMeasureDtoList())){ - req.getWorkTicketSafetyMeasureDtoList().forEach(workTicketSafetyMeasureDto -> { - workTicketSafetyMeasureDto.setTicketId(req.getId()); - workTicketSafetyMeasureService.save(workTicketSafetyMeasureDto); - }); - } - if(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers())){ - //将票据ID会传至计划/任务内 - returnTicket(req); - return R.success("开票成功!该票走线下未开启流程"); - } - /**开启工作流**/ - BladeFlow bladeFlow = this.startProcessInstance(firstWorkTicketFlowKey,req); - this.update(Wrappers.lambdaUpdate() - .set(WorkTicketInfoEntity::getProcessInstanceId,bladeFlow.getProcessInstanceId()) - .eq(WorkTicketInfoEntity::getId,req.getId())); - //将票据ID会传至计划/任务内 - returnTicket(req); - return R.success("保存成功"); - } - - /** - * 工作票延期 进入许可人确认工作票延期 - * @param ticketId 工作票ID - * @param status 状态 - * @param completeTask 工作流进行 - */ - @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED) - public void delay(Long ticketId, Integer status,ComleteTask completeTask) { - //新增延期信息 - Assert.notNull(completeTask.getVariables().get("delay"),"延期信息不能为空"); - WorkTicketDelayEntity delayEntity = (WorkTicketDelayEntity) completeTask.getVariables().get("delay"); - delayService.save(delayEntity); - //更新负责人确认执行情况流程 填充信息 - WorkTicketFlowEntity workTicketFlowEntity = workTicketFlowService.getOne(Wrappers.lambdaQuery() - .eq(WorkTicketFlowEntity::getTicketId,ticketId) - .eq(WorkTicketFlowEntity::getFlowCode,TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()) - .orderByDesc(WorkTicketFlowEntity::getCreateTime) - .last("limit 1;") - ); - workTicketFlowService.update(Wrappers.lambdaUpdate() - .set(WorkTicketFlowEntity::getExecutor,AuthUtil.getUserId().toString()) - .set(WorkTicketFlowEntity::getExecuteTime,LocalDateTime.now()) - .eq(WorkTicketFlowEntity::getId,workTicketFlowEntity.getId()) - ); - //更新工作票状态 - this.update(Wrappers.lambdaUpdate() - .set(WorkTicketInfoEntity::getStatus,status) - .eq(WorkTicketInfoEntity::getId,ticketId) - ); - //创建延期流程 - WorkTicketInfoEntity infoEntity = this.getById(ticketId); - WorkTicketFlowEntity currentFlowEntity = new WorkTicketFlowEntity(); - currentFlowEntity.setTicketId(ticketId); - currentFlowEntity.setFlowCode(status.toString()); - currentFlowEntity.setExecutor(infoEntity.getLicensor().toString()); - currentFlowEntity.setProcTaskId((String) completeTask.getVariables().get("procTaskId")); - workTicketFlowService.save(workTicketFlowEntity); - //进入工作流下一步 - R result = flowClient.completeTask(completeTask); - if(!result.isSuccess()){ - throw new ServiceException("执行工作流失败"); - } - } - - @Override - public R detail(Long id) { - WorkTicketInfoEntity workTicketInfoEntity = this.getById(id); - if(ObjectUtil.isEmpty(workTicketInfoEntity)){ - return R.fail("未查询到该ID对应的记录"); - } - else{ - WorkTicketInfoVO workTicketInfoVO = WorkTicketInfoWrapper.build().entityVO(workTicketInfoEntity); - - /**获取工作票安全措施列表**/ - WorkTicketSafetyMeasureDto workTicketSafetyMeasureDto = new WorkTicketSafetyMeasureDto(); - workTicketSafetyMeasureDto.setTicketId(id); - List workTicketSafetyMeasureVOList = workTicketSafetyMeasureService.list(workTicketSafetyMeasureDto); - workTicketInfoVO.setWorkTicketSafetyMeasureVOList(workTicketSafetyMeasureVOList); - - /**获取工作票负责人变更**/ - WorkTicketPrincipalChangeDto workTicketPrincipalChangeDto = new WorkTicketPrincipalChangeDto(); - workTicketPrincipalChangeDto.setTicketId(id); - List workTicketPrincipalChangeVOList = workTicketPrincipalChangeService.list(workTicketPrincipalChangeDto); - workTicketInfoVO.setWorkTicketPrincipalChangeVOList(workTicketPrincipalChangeVOList); - - /**获取工作票工作组员变更**/ - WorkTicketMembersChangeDto workTicketMembersChangeDto = new WorkTicketMembersChangeDto(); - workTicketMembersChangeDto.setTicketId(id); - List workTicketMembersChangeVOList = workTicketMembersChangeService.list(workTicketMembersChangeDto); - workTicketInfoVO.setWorkTicketMembersChangeVOList(workTicketMembersChangeVOList); - - /**获取工作票跨日运行时间列表**/ - WorkTicketOperateTimeDto workTicketOperateTimeDto = new WorkTicketOperateTimeDto(); - workTicketOperateTimeDto.setTicketId(id); - List workTicketOperateTimeVOList = workTicketOperateTimeService.list(workTicketOperateTimeDto); - workTicketInfoVO.setWorkTicketOperateTimeVOList(workTicketOperateTimeVOList); - - /**获取工作票处理流程列表**/ - WorkTicketFlowDto workTicketFlowDto = new WorkTicketFlowDto(); - workTicketFlowDto.setTicketId(id); - List workTicketFlowVOList = workTicketFlowService.list(workTicketFlowDto); - workTicketInfoVO.setWorkTicketFlowVOList(workTicketFlowVOList); - - /**获取工作票延期列表**/ - WorkTicketDelayDto workTicketDelayDto = new WorkTicketDelayDto(); - workTicketDelayDto.setTicketId(id); - List workTicketDelayList = workDelayNoScopeMapper.selectList(new LambdaQueryWrapper(){{ - eq(WorkTicketDelayEntity::getTicketId,id); - eq(WorkTicketDelayEntity::getIsDeleted,0L); - }}); - if(CollectionUtil.isNotEmpty(workTicketDelayList)){ - workTicketInfoVO.setWorkTicketDelayVOList(WorkTicketDelayWrapper.build().listVO(workTicketDelayList)); - } - - return R.data(workTicketInfoVO); - } - } - - @Override - public R> queryList(WorkTicketInfoDto req, Query query) { - LambdaQueryWrapper lqw = this.getQueryWrapper(req); - lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime); - IPage pages = super.page(Condition.getPage(query),lqw); - pages.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords())); - return R.data(pages); - } - - @Override - public List list(WorkTicketInfoDto req) { - LambdaQueryWrapper lqw = this.getQueryWrapper(req); - List workTicketInfoEntityList = this.list(lqw); - return CollectionUtil.isNotEmpty(workTicketInfoEntityList) ? WorkTicketInfoWrapper.build().listVO(workTicketInfoEntityList) : null; - } - - @Override - @Transactional - public R remove(Long id,String comment) { - WorkTicketInfoEntity entity = this.getById(id); - if(ObjectUtil.isEmpty(entity)){ - return R.fail(400,"删除失败!未查询到相关记录"); - } - - boolean flag = this.update(Wrappers.lambdaUpdate() - .set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()) - .eq(WorkTicketInfoEntity::getId,id)); - - /**线下单独删除**/ - if(TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())){ - return R.status(flag); - } - /**终止工作流**/ - R r = flowClient.delProcessInstanceById(entity.getProcessInstanceId(),comment); - if(!r.isSuccess()){ - throw new ServiceException("终止工作流失败!"); - } - return R.success("删除成功!"); - } - - @Override - public void exportWorkTicketTemplate(Long id, HttpServletResponse response){ - exportWorkTicketInfoPdf(id,response); - } - - @Override - @SuppressWarnings("unchecked") - public void exportWorkTicketInfoPdf(Long id, HttpServletResponse response) { - R workTicketInfoVOR = this.detail(id); - if(!workTicketInfoVOR.isSuccess()){ - log.error("未查询到相关工作票记录!"); - return; - } - WorkTicketInfoVO workTicketInfoVO = workTicketInfoVOR.getData(); - //将workTicketInfoVO封装进Map,以便pdf导出 - Map workTicketInfoMap = new HashMap<>(); - try { - workTicketInfoMap = PdfUtils.objectToMap(workTicketInfoVO); - } - catch (Exception e) { - log.info("转换对象失败!"); - } - //安全措施 - if(CollectionUtil.isNotEmpty(workTicketInfoVO.getWorkTicketSafetyMeasureVOList())){ - Map> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream() - .collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType)); - if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))){ - workTicketInfoMap.put("matterLibraryListOne",measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure-> { - Map 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() : " "; - map.put("status",status); - return map; - }).collect(Collectors.toList())); - } - else { - workTicketInfoMap.put("matterLibraryListOne", new ArrayList>(1)); - } - if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_TWO))){ - workTicketInfoMap.put("matterLibraryListTwo",measureMap.get(TicketConstants.MEASURE_TYPE_TWO).stream().map(measure-> { - Map 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() : " "; - map.put("status",status); - return map; - }).collect(Collectors.toList())); - } - else { - workTicketInfoMap.put("matterLibraryListTwo", new ArrayList>(1)); - } - if(ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_THREE))){ - workTicketInfoMap.put("matterLibraryListThree",measureMap.get(TicketConstants.MEASURE_TYPE_THREE).stream().map(measure-> { - Map 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() : " "; - map.put("status",status); - return map; - }).collect(Collectors.toList())); - } - else { - workTicketInfoMap.put("matterLibraryListThree", new ArrayList>(1)); - } - } - //线下开票确认人为空 - workTicketInfoMap.put("membersConfirm", TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(workTicketInfoVO.getStatus()) ? "" : workTicketInfoVO.getMembersName()); - //获取工作票工作流处理信息 - List workTicketFlowVOList = workTicketInfoVO.getWorkTicketFlowVOList(); - //签发 - List signFlow = workTicketFlowVOList.stream() - .filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); - if(CollectionUtil.isNotEmpty(signFlow)){ - workTicketInfoMap.put("signer",signFlow.get(0).getCreateUserName()); - workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); - } - else { - workTicketInfoMap.put("signer", ""); - workTicketInfoMap.put("signTime", ""); - } - //许可人许可 - if(Func.isNotEmpty(workTicketInfoVO.getLicenseTime())){ - workTicketInfoMap.put("licensorConfirm",workTicketInfoVO.getLicensorName()); - workTicketInfoMap.put("licenseTime", DateUtil.format(workTicketInfoVO.getLicenseTime(),TicketConstants.TICKET_DATE_PATTERN)); - } - else { - workTicketInfoMap.put("licensorConfirm", ""); - workTicketInfoMap.put("licenseTime", ""); - } - - /**负责人收到工作票**/ - List receiveFlow = workTicketFlowVOList.stream() - .filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); - if(CollectionUtil.isNotEmpty(receiveFlow)){ - workTicketInfoMap.put("receivePrincipal",receiveFlow.get(0).getCreateUserName()); - workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); - workTicketInfoMap.put("principalConfirm",workTicketInfoVO.getPrincipalName()); - } - else{ - workTicketInfoMap.put("receivePrincipal",""); - workTicketInfoMap.put("receiveTime", ""); - workTicketInfoMap.put("principalConfirm",""); - } - /**负责人确认安全事项**/ - List confirmFlow = workTicketFlowVOList.stream() - .filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); - if(CollectionUtil.isNotEmpty(confirmFlow)){ - workTicketInfoMap.put("confirmPrincipal",confirmFlow.get(0).getCreateUserName()); - workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); - } - else{ - workTicketInfoMap.put("confirmPrincipal",""); - workTicketInfoMap.put("confirmTime", ""); - } - /**工作结束**/ - List finishFlow = workTicketFlowVOList.stream() - .filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); - if(CollectionUtil.isNotEmpty(finishFlow)){ - workTicketInfoMap.put("finisher",finishFlow.get(0).getCreateUserName()); - workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); - workTicketInfoMap.put("principalFinish",workTicketInfoVO.getPrincipalName()); - } - else { - workTicketInfoMap.put("finisher",""); - workTicketInfoMap.put("finishTime", ""); - workTicketInfoMap.put("principalFinish",""); - } - /**工作终结**/ - List endFlow = workTicketFlowVOList.stream() - .filter(f->TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); - if(CollectionUtil.isNotEmpty(endFlow)){ - workTicketInfoMap.put("endLicensor",endFlow.get(0).getCreateUserName()); - 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("groundWireCode",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCode()) ? endFlow.get(0).getGroundWireCode() : ""); - workTicketInfoMap.put("groundWireCount",ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCount()) ? endFlow.get(0).getGroundWireCount() : ""); - } - else { - workTicketInfoMap.put("endLicensor", ""); - workTicketInfoMap.put("endTime", ""); - workTicketInfoMap.put("groundSwitchCount", ""); - workTicketInfoMap.put("groundWireCode", ""); - workTicketInfoMap.put("groundWireCount", ""); - } - /**负责人变更**/ - List workTicketPrincipalChangeVOList = workTicketInfoVO.getWorkTicketPrincipalChangeVOList(); - if(CollectionUtil.isNotEmpty(workTicketPrincipalChangeVOList)){ - workTicketInfoMap.put("initPrincipal",workTicketPrincipalChangeVOList.get(0).getInitialPrincipalName()); - workTicketInfoMap.put("changePrincipal",workTicketPrincipalChangeVOList.get(0).getChangePrincipalName()); - workTicketInfoMap.put("principalChangeSigner",workTicketPrincipalChangeVOList.get(0).getCreateUserName()); - workTicketInfoMap.put("principalChangeTime", DateUtil.format(workTicketPrincipalChangeVOList.get(0).getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); - } - else { - workTicketInfoMap.put("initPrincipal", ""); - workTicketInfoMap.put("changePrincipal", ""); - workTicketInfoMap.put("principalChangeSigner", ""); - workTicketInfoMap.put("principalChangeTime", ""); - } - /**工作成员变更**/ - List membersChangeList = workTicketInfoVO.getWorkTicketMembersChangeVOList(); - if(CollectionUtil.isNotEmpty(membersChangeList)){ - /**工作成员变更详情**/ - String membersChangeSituation = membersChangeList.stream().map(mc -> - DateUtil.format(mc.getCreateTime(),TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); - workTicketInfoMap.put("membersChangeSituation",membersChangeSituation); - workTicketInfoMap.put("memberChangePrincipal",membersChangeList.get(0).getCreateUserName()); - } - else { - workTicketInfoMap.put("membersChangeSituation", ""); - workTicketInfoMap.put("memberChangePrincipal", ""); - } - /**工作票延期**/ - List workTicketDelayVOList = workTicketInfoVO.getWorkTicketDelayVOList(); - if(CollectionUtil.isNotEmpty(workTicketDelayVOList)){ - WorkTicketDelayVO workTicketDelayVO = workTicketDelayVOList.get(0); - workTicketInfoMap.put("delayTime",DateUtil.format(workTicketDelayVO.getChangeTime(),TicketConstants.TICKET_DATE_PATTERN)); - workTicketInfoMap.put("delayPrincipal",workTicketDelayVO.getCreateUserName()); - workTicketInfoMap.put("delayPrincipalTime",DateUtil.format(workTicketDelayVO.getCreateTime(),TicketConstants.TICKET_DATE_PATTERN)); - workTicketInfoMap.put("delayLicensor",workTicketDelayVO.getLicensorName()); - workTicketInfoMap.put("delayLicenseTime",DateUtil.format(workTicketDelayVO.getLicenseTime(),TicketConstants.TICKET_DATE_PATTERN)); - } - else { - workTicketInfoMap.put("delayTime", ""); - workTicketInfoMap.put("delayPrincipal", ""); - workTicketInfoMap.put("delayPrincipalTime", ""); - workTicketInfoMap.put("delayLicensor", ""); - workTicketInfoMap.put("delayLicenseTime", ""); - } - - /**跨日工作时间**/ - List operateList = workTicketInfoVO.getWorkTicketOperateTimeVOList(); - if(CollectionUtil.isNotEmpty(operateList)){ - List> operateMapList = operateList.stream().map(operate->{ - Map map = new HashMap<>(4); - map.put("startTime",DateUtil.format(operate.getStartTime(),TicketConstants.TICKET_DATE_PATTERN)); - map.put("endTime",DateUtil.format(operate.getEndTime(),TicketConstants.TICKET_DATE_PATTERN)); - map.put("principal",operate.getPrincipalName()); - map.put("licensor",operate.getLicensorName()); - return map; - }).collect(Collectors.toList()); - workTicketInfoMap.put("operateMapList",operateMapList); - } - else { - List> operateMapList = new ArrayList<>(); - Map map = new HashMap<>(4); - map.put("startTime",""); - map.put("endTime",""); - map.put("principal",""); - map.put("licensor",""); - operateMapList.add(map); - workTicketInfoMap.put("operateMapList", operateMapList); - } - - /**运行值班人员暂为空**/ - workTicketInfoMap.put("dutyPersonName","/"); - - String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(workTicketInfoVO.getType()) + PdfUtils.XLSX_SUFFIX; - log.info("工作票模板为:{}",fileName); - TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); - Workbook workbook = null; - try { - workbook = ExcelUtil.getWorkbook(templateExportParams,workTicketInfoMap); - } catch (Exception e) { - e.printStackTrace(); - } - //上传xlsx至服务器 - try { - ExcelUtil.upload(workbook,xlsSavePath,workTicketInfoVO.getWorkContent()+PdfUtils.XLSX_SUFFIX); - } catch (Exception e) { - e.printStackTrace(); - } - //将xlsx文件转换为pdf并保存 - String pdfFileName = workTicketInfoVO.getWorkContent() + PdfUtils.PDF_SUFFIX; - String xlsFileName = workTicketInfoVO.getWorkContent()+PdfUtils.XLSX_SUFFIX; - PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); - String savePath = pdfSavePath + pdfFileName; - // 设置response参数,可以打开下载页面 - PdfUtils.readPdf(response,savePath); - } - - @Override - @Transactional - public R completeTask(WorkTicketInfoDto req, BladeFlow flow) { - ComleteTask task = new ComleteTask(); - task.setTaskId(flow.getTaskId()); - task.setComment(flow.getComment()); - task.setAttachments(flow.getAttachments()); - task.setFlag(flow.getFlag()); - task.setProcessInstanceId(flow.getProcessInstanceId()); - task.setVariables(flow.getVariables()); - - //待许可时获取许可人角色下用户开启工作流 - if(TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())){ - R> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(),req.getCreateDept(),TicketConstants.LICENSOR_ROLE); - if(!userListR.isSuccess()){ - throw new ServiceException(userListR.getMsg()); - } - Map variables = CollectionUtil.isEmpty(flow.getVariables()) ? new HashMap<>() : flow.getVariables(); - String taskUser = userListR.getData().stream().map(u->"taskUser_".concat(u.getId().toString())).collect(Collectors.joining(",")); - variables.put("licenseUserIds",taskUser); - task.setVariables(variables); - } - log.info("工作流对象为:{}",JSONObject.toJSONString(flow)); - - if(TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())){ - req.setSigner(AuthUtil.getUserId()); - } - else if(TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())){ - req.setLicensor(AuthUtil.getUserId()); - } - else if(TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(req.getStatus())){ - this.invalidTicket(req); - } - - //更新状态 - boolean flag = this.update(Wrappers.lambdaUpdate() - .set(WorkTicketInfoEntity::getStatus,req.getStatus()) - .set(WorkTicketInfoEntity::getPrincipal,req.getPrincipal()) - .set(WorkTicketInfoEntity::getLicensor,req.getLicensor()) - .set(WorkTicketInfoEntity::getLicenseTime,req.getLicenseTime()) - .set(WorkTicketInfoEntity::getLicenseEndTime,req.getLicenseEndTime()) - .eq(WorkTicketInfoEntity::getId,req.getId())); - - //新增流程信息 - WorkTicketFlowEntity workTicketFlowEntity = new WorkTicketFlowEntity(); - workTicketFlowEntity.setTicketId(req.getId()); - workTicketFlowEntity.setFlowCode(req.getStatus().toString()); - workTicketFlowEntity.setExecutor(AuthUtil.getUserId().toString()); - workTicketFlowEntity.setExecuteTime(LocalDateTime.now()); - 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.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.setStatus(req.getStatus()); - workTicketFlowService.save(workTicketFlowEntity); - //执行流程 - R flowResult = flowClient.completeTask(task); - //更新任务状态 - updateAccessStatus(req); - - if(!flowResult.isSuccess()){ - throw new ServiceException("执行工作流失败!"); - } - - return R.success("操作成功!"); - } - - @Transactional(rollbackFor = Exception.class) - public void updateAccessStatus(WorkTicketInfoDto req){ - if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())){ - log.info("许可通过:{}",JSONObject.toJSONString(req)); - //许可人通过将检修任务状态设为执行中 - if(TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())){ - OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); - taskEntity.setId(req.getTaskId()); - taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_1); - //设置开始时间 - taskEntity.setActStartTime(DateUtil.now()); - operAccessTaskClient.updateById(taskEntity); - } - } - } - - /*** - * 票据作废时 对应任务ID应该置空 - * @param req - */ - public void invalidTicket(WorkTicketInfoDto req){ - if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())){ - OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); - taskEntity.setId(req.getTaskId()); - taskEntity.setInvalid(true); - taskEntity.setTicketId(null); - operAccessTaskClient.updateById(taskEntity); - } - if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())){ - OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); - dto.setId(req.getTaskId()); - dto.setInvalid(true); - //dto.setTicketId(null); - taskClient.doUpdateTaskById(dto); - } - } - - /*** - * 回传票据ID - * @param req - */ - @Transactional(rollbackFor = Exception.class) - public void returnTicket(WorkTicketInfoDto req){ - if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType())){ - OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); - taskEntity.setId(req.getTaskId()); - taskEntity.setTicketId(req.getId()); - operAccessTaskClient.updateById(taskEntity); - } - if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())){ - OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); - dto.setId(req.getTaskId()); - dto.setTicketId(req.getId()); - taskClient.doUpdateTaskById(dto); - } - } - - /** - * 获取queryWrapper - * @param req - * @return - */ - private LambdaQueryWrapper getQueryWrapper(WorkTicketInfoDto req){ - LambdaQueryWrapper lqw = new LambdaQueryWrapper(); - if(Func.isNotBlank(req.getProcessInstanceId())){ - lqw.eq(WorkTicketInfoEntity::getProcessInstanceId,req.getProcessInstanceId()); - } - if(Func.isNotEmpty(req.getType())){ - lqw.eq(WorkTicketInfoEntity::getType,req.getType()); - } - if(Func.isNotEmpty(req.getTaskType())){ - lqw.eq(WorkTicketInfoEntity::getTaskType,req.getTaskType()); - } - if(Func.isNotEmpty(req.getCode())){ - lqw.like(WorkTicketInfoEntity::getCode,req.getCode()); - } - if(Func.isNotEmpty(req.getStatus())){ - lqw.eq(WorkTicketInfoEntity::getStatus,req.getStatus()); - } - if(Func.isNotEmpty(req.getCompany())){ - lqw.like(WorkTicketInfoEntity::getType,"%".concat(req.getCompany()).concat("%")); - } - if(Func.isNotEmpty(req.getClassGroup())){ - lqw.eq(WorkTicketInfoEntity::getClassGroup,req.getClassGroup()); - } - if(Func.isNotEmpty(req.getTaskId())){ - lqw.eq(WorkTicketInfoEntity::getTaskId,req.getTaskId()); - } - if(Func.isNotEmpty(req.getClassGroup())){ - lqw.eq(WorkTicketInfoEntity::getClassGroup,req.getClassGroup()); - } - if(Func.isNotEmpty(req.getClassGroupMembers())){ - lqw.like(WorkTicketInfoEntity::getClassGroupMembers,"%".concat(req.getClassGroupMembers()).concat("%")); - } - if(Func.isNotEmpty(req.getWorkContent())){ - lqw.like(WorkTicketInfoEntity::getWorkContent,"%".concat(req.getWorkContent()).concat("%")); - } - if(Func.isNotEmpty(req.getSigner())){ - lqw.eq(WorkTicketInfoEntity::getSigner,req.getSigner()); - } - if(Func.isNotEmpty(req.getLicensor())){ - lqw.eq(WorkTicketInfoEntity::getLicensor,req.getLicensor()); - } - if(Func.isNotEmpty(req.getStartTime())){ - lqw.ge(WorkTicketInfoEntity::getCreateTime,req.getStartTime()); - } - if(Func.isNotEmpty(req.getEndTime())){ - lqw.le(WorkTicketInfoEntity::getCreateTime,req.getEndTime()); - } - if(!CollectionUtil.isEmpty(req.getDeptIds())){ - lqw.in(WorkTicketInfoEntity::getCreateDept,req.getDeptIds()); - } - return lqw; - } - - /** - * 开启一个流程实例 - * - * @author hx - **/ - @Override - public BladeFlow startProcessInstance(String processDefinitionKey, WorkTicketInfoEntity workTicketInfoEntity) { - /**获取签发人角色下的人员**/ - R> listR = userClient.relationUserListByRoleAlias(tenantId,Long.parseLong(AuthUtil.getUser().getDeptId()),TicketConstants.SIGNER_ROLE); - if(!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())){ - throw new ServiceException("工作票签发人角色下未查询到相关人员"); - } - String signUserIds = listR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); - - Map params = new HashMap(2) {{ - put("taskId", workTicketInfoEntity.getId()); - put("signUserIds", signUserIds); - }}; - - R r = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey,"workTicket:task:" + workTicketInfoEntity.getId(),workTicketInfoEntity.getWorkContent(), params); - if(!r.isSuccess()){ - throw new ServiceException(r.getMsg()); - } - return r.getData(); - } - - /** - * 许可人通过线下工作票 - * @param req - * @return - */ - @Override - public R licenseOfflineTicket(WorkTicketInfoDto req) { - Long ticketId = req.getId(); - WorkTicketInfoEntity infoEntity = getById(ticketId); - //获取许可人角色下的人员 - R> listR = userClient.relationUserListByRoleAlias(tenantId,infoEntity.getCreateDept(),TicketConstants.LICENSOR_ROLE); - if(!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())){ - throw new ServiceException("工作票许可人角色下未查询到相关人员"); - } - List userId = listR.getData().stream().map(User::getId).distinct().collect(Collectors.toList()); - if(!userId.contains(AuthUtil.getUserId())){ - throw new ServiceException("当前操作人没有许可人角色,无法执行该操作"); - } - update(Wrappers.lambdaUpdate() - .set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()) - .set(WorkTicketInfoEntity::getLicensor,AuthUtil.getUserId()) - .set(WorkTicketInfoEntity::getLicenseTime,LocalDateTime.now()) - .set(WorkTicketInfoEntity::getLicenseEndTime,req.getLicenseEndTime()) - .eq(WorkTicketInfoEntity::getId,ticketId) - ); - return R.success("操作成功"); - } - - /** - * 完成线下工作票 - * @param ticketAccessTaskDto - * @return - */ - @Override - public R finishOfflineTicket(TicketAccessTaskDto ticketAccessTaskDto) { - //更新工作票 - WorkTicketInfoDto infoDto = ticketAccessTaskDto.getWorkTicketInfoDto(); - update(Wrappers.lambdaUpdate() - .set(WorkTicketInfoEntity::getStatus,TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()) - .eq(WorkTicketInfoEntity::getId,infoDto.getId()) - ); - //获取工作票实体类 - WorkTicketInfoEntity infoEntity = getById(infoDto.getId()); - //根据任务类型执行任务 - if(ObjectUtil.isEmpty(infoEntity.getTaskType())){ - return R.success("操作成功"); - } - //FIXME 日常维护、检修任务暂时不形成闭环(因许可人无需填入任务结束完成所需参数,故选择由执行人手动闭环) ~2022--05-06 + private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService; + private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService; + private final IWorkTicketDelayService delayService; + private final IWorkTicketMembersChangeService workTicketMembersChangeService; + private final IWorkTicketOperateTimeService workTicketOperateTimeService; + private final IWorkTicketFlowService workTicketFlowService; + private final IFlowClient flowClient; + private final IUserClient userClient; + private final WorkDelayNoScopeMapper workDelayNoScopeMapper; + private final IOperAccessTaskClient operAccessTaskClient; + private final ITaskClient taskClient; + + /** 生成两票编号锁 **/ + private Lock lock = new ReentrantLock(); + + /** word模板预览导出保存路径 **/ + @Value("${hzims.ticket.path.xlsx.savePath}") + private String xlsSavePath; + + @Value("${hzims.ticket.first-work-flow-key}") + private String firstWorkTicketFlowKey; + + @Value("${hzims.tenantId}") + private String tenantId; + + @Value("${hzims.ticket.path.pdf.savePath}") + private String pdfSavePath; + + @Override + @Transactional + @AroundFlow + public R doSave(WorkTicketInfoDto req) { + req.setCode(this.getWorkTicketCode()); + req.setStatus(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers()) ? TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus() : TicketConstants.FirstWorkTicketFlowStatusEnum.SIGN.getStatus()); + boolean flag = this.save(req); + /**保存安全措施**/ + if (flag && CollectionUtil.isNotEmpty(req.getWorkTicketSafetyMeasureDtoList())) { + req.getWorkTicketSafetyMeasureDtoList().forEach(workTicketSafetyMeasureDto -> { + workTicketSafetyMeasureDto.setTicketId(req.getId()); + workTicketSafetyMeasureService.save(workTicketSafetyMeasureDto); + }); + } + if (Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers())) { + //将票据ID会传至计划/任务内 + returnTicket(req); + return R.success("开票成功!该票走线下未开启流程"); + } + /**开启工作流**/ + BladeFlow bladeFlow = this.startProcessInstance(firstWorkTicketFlowKey, req); + this.update(Wrappers.lambdaUpdate() + .set(WorkTicketInfoEntity::getProcessInstanceId, bladeFlow.getProcessInstanceId()) + .eq(WorkTicketInfoEntity::getId, req.getId())); + //将票据ID会传至计划/任务内 + returnTicket(req); + return R.success("保存成功"); + } + + /** + * 工作票延期 进入许可人确认工作票延期 + * + * @param ticketId 工作票ID + * @param status 状态 + * @param completeTask 工作流进行 + */ + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) + public void delay(Long ticketId, Integer status, ComleteTask completeTask) { + //新增延期信息 + Assert.notNull(completeTask.getVariables().get("delay"), "延期信息不能为空"); + WorkTicketDelayEntity delayEntity = (WorkTicketDelayEntity) completeTask.getVariables().get("delay"); + delayService.save(delayEntity); + //更新负责人确认执行情况流程 填充信息 + WorkTicketFlowEntity workTicketFlowEntity = workTicketFlowService.getOne(Wrappers.lambdaQuery() + .eq(WorkTicketFlowEntity::getTicketId, ticketId) + .eq(WorkTicketFlowEntity::getFlowCode, TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()) + .orderByDesc(WorkTicketFlowEntity::getCreateTime) + .last("limit 1;") + ); + workTicketFlowService.update(Wrappers.lambdaUpdate() + .set(WorkTicketFlowEntity::getExecutor, AuthUtil.getUserId().toString()) + .set(WorkTicketFlowEntity::getExecuteTime, LocalDateTime.now()) + .eq(WorkTicketFlowEntity::getId, workTicketFlowEntity.getId()) + ); + //更新工作票状态 + this.update(Wrappers.lambdaUpdate() + .set(WorkTicketInfoEntity::getStatus, status) + .eq(WorkTicketInfoEntity::getId, ticketId) + ); + //创建延期流程 + WorkTicketInfoEntity infoEntity = this.getById(ticketId); + WorkTicketFlowEntity currentFlowEntity = new WorkTicketFlowEntity(); + currentFlowEntity.setTicketId(ticketId); + currentFlowEntity.setFlowCode(status.toString()); + currentFlowEntity.setExecutor(infoEntity.getLicensor().toString()); + currentFlowEntity.setProcTaskId((String) completeTask.getVariables().get("procTaskId")); + workTicketFlowService.save(workTicketFlowEntity); + //进入工作流下一步 + R result = flowClient.completeTask(completeTask); + if (!result.isSuccess()) { + throw new ServiceException("执行工作流失败"); + } + } + + @Override + public R detail(Long id) { + WorkTicketInfoEntity workTicketInfoEntity = this.getById(id); + if (ObjectUtil.isEmpty(workTicketInfoEntity)) { + return R.fail("未查询到该ID对应的记录"); + } else { + WorkTicketInfoVO workTicketInfoVO = WorkTicketInfoWrapper.build().entityVO(workTicketInfoEntity); + + /**获取工作票安全措施列表**/ + WorkTicketSafetyMeasureDto workTicketSafetyMeasureDto = new WorkTicketSafetyMeasureDto(); + workTicketSafetyMeasureDto.setTicketId(id); + List workTicketSafetyMeasureVOList = workTicketSafetyMeasureService.list(workTicketSafetyMeasureDto); + workTicketInfoVO.setWorkTicketSafetyMeasureVOList(workTicketSafetyMeasureVOList); + + /**获取工作票负责人变更**/ + WorkTicketPrincipalChangeDto workTicketPrincipalChangeDto = new WorkTicketPrincipalChangeDto(); + workTicketPrincipalChangeDto.setTicketId(id); + List workTicketPrincipalChangeVOList = workTicketPrincipalChangeService.list(workTicketPrincipalChangeDto); + workTicketInfoVO.setWorkTicketPrincipalChangeVOList(workTicketPrincipalChangeVOList); + + /**获取工作票工作组员变更**/ + WorkTicketMembersChangeDto workTicketMembersChangeDto = new WorkTicketMembersChangeDto(); + workTicketMembersChangeDto.setTicketId(id); + List workTicketMembersChangeVOList = workTicketMembersChangeService.list(workTicketMembersChangeDto); + workTicketInfoVO.setWorkTicketMembersChangeVOList(workTicketMembersChangeVOList); + + /**获取工作票跨日运行时间列表**/ + WorkTicketOperateTimeDto workTicketOperateTimeDto = new WorkTicketOperateTimeDto(); + workTicketOperateTimeDto.setTicketId(id); + List workTicketOperateTimeVOList = workTicketOperateTimeService.list(workTicketOperateTimeDto); + workTicketInfoVO.setWorkTicketOperateTimeVOList(workTicketOperateTimeVOList); + + /**获取工作票处理流程列表**/ + WorkTicketFlowDto workTicketFlowDto = new WorkTicketFlowDto(); + workTicketFlowDto.setTicketId(id); + List workTicketFlowVOList = workTicketFlowService.list(workTicketFlowDto); + workTicketInfoVO.setWorkTicketFlowVOList(workTicketFlowVOList); + + /**获取工作票延期列表**/ + WorkTicketDelayDto workTicketDelayDto = new WorkTicketDelayDto(); + workTicketDelayDto.setTicketId(id); + List workTicketDelayList = workDelayNoScopeMapper.selectList(new LambdaQueryWrapper() {{ + eq(WorkTicketDelayEntity::getTicketId, id); + eq(WorkTicketDelayEntity::getIsDeleted, 0L); + }}); + if (CollectionUtil.isNotEmpty(workTicketDelayList)) { + workTicketInfoVO.setWorkTicketDelayVOList(WorkTicketDelayWrapper.build().listVO(workTicketDelayList)); + } + + return R.data(workTicketInfoVO); + } + } + + @Override + public R> queryList(WorkTicketInfoDto req, Query query) { + LambdaQueryWrapper lqw = this.getQueryWrapper(req); + lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime); + IPage pages = super.page(Condition.getPage(query), lqw); + pages.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords())); + return R.data(pages); + } + + @Override + public List list(WorkTicketInfoDto req) { + LambdaQueryWrapper lqw = this.getQueryWrapper(req); + List workTicketInfoEntityList = this.list(lqw); + return CollectionUtil.isNotEmpty(workTicketInfoEntityList) ? WorkTicketInfoWrapper.build().listVO(workTicketInfoEntityList) : null; + } + + @Override + @Transactional + public R remove(Long id, String comment) { + WorkTicketInfoEntity entity = this.getById(id); + if (ObjectUtil.isEmpty(entity)) { + return R.fail(400, "删除失败!未查询到相关记录"); + } + + boolean flag = this.update(Wrappers.lambdaUpdate() + .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()) + .eq(WorkTicketInfoEntity::getId, id)); + + /**线下单独删除**/ + if (TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())) { + return R.status(flag); + } + /**终止工作流**/ + R r = flowClient.delProcessInstanceById(entity.getProcessInstanceId(), comment); + if (!r.isSuccess()) { + throw new ServiceException("终止工作流失败!"); + } + return R.success("删除成功!"); + } + + @Override + public void exportWorkTicketTemplate(Long id, HttpServletResponse response) { + exportWorkTicketInfoPdf(id, response); + } + + @Override + @SuppressWarnings("unchecked") + public void exportWorkTicketInfoPdf(Long id, HttpServletResponse response) { + R workTicketInfoVOR = this.detail(id); + if (!workTicketInfoVOR.isSuccess()) { + log.error("未查询到相关工作票记录!"); + return; + } + WorkTicketInfoVO workTicketInfoVO = workTicketInfoVOR.getData(); + //将workTicketInfoVO封装进Map,以便pdf导出 + Map workTicketInfoMap = new HashMap<>(); + try { + workTicketInfoMap = PdfUtils.objectToMap(workTicketInfoVO); + } catch (Exception e) { + log.info("转换对象失败!"); + } + //安全措施 + if (CollectionUtil.isNotEmpty(workTicketInfoVO.getWorkTicketSafetyMeasureVOList())) { + Map> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream() + .collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType)); + if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))) { + workTicketInfoMap.put("matterLibraryListOne", measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure -> { + Map 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() : " "; + map.put("status", status); + return map; + }).collect(Collectors.toList())); + } else { + workTicketInfoMap.put("matterLibraryListOne", new ArrayList>(1)); + } + if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_TWO))) { + workTicketInfoMap.put("matterLibraryListTwo", measureMap.get(TicketConstants.MEASURE_TYPE_TWO).stream().map(measure -> { + Map 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() : " "; + map.put("status", status); + return map; + }).collect(Collectors.toList())); + } else { + workTicketInfoMap.put("matterLibraryListTwo", new ArrayList>(1)); + } + if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_THREE))) { + workTicketInfoMap.put("matterLibraryListThree", measureMap.get(TicketConstants.MEASURE_TYPE_THREE).stream().map(measure -> { + Map 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() : " "; + map.put("status", status); + return map; + }).collect(Collectors.toList())); + } else { + workTicketInfoMap.put("matterLibraryListThree", new ArrayList>(1)); + } + } + //线下开票确认人为空 + workTicketInfoMap.put("membersConfirm", TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(workTicketInfoVO.getStatus()) ? "" : workTicketInfoVO.getMembersName()); + //获取工作票工作流处理信息 + List workTicketFlowVOList = workTicketInfoVO.getWorkTicketFlowVOList(); + //签发 + List signFlow = workTicketFlowVOList.stream() + .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(signFlow)) { + workTicketInfoMap.put("signer", signFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("signer", ""); + workTicketInfoMap.put("signTime", ""); + } + //许可人许可 + if (Func.isNotEmpty(workTicketInfoVO.getLicenseTime())) { + workTicketInfoMap.put("licensorConfirm", workTicketInfoVO.getLicensorName()); + workTicketInfoMap.put("licenseTime", DateUtil.format(workTicketInfoVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("licensorConfirm", ""); + workTicketInfoMap.put("licenseTime", ""); + } + + /**负责人收到工作票**/ + List receiveFlow = workTicketFlowVOList.stream() + .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(receiveFlow)) { + workTicketInfoMap.put("receivePrincipal", receiveFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("principalConfirm", workTicketInfoVO.getPrincipalName()); + } else { + workTicketInfoMap.put("receivePrincipal", ""); + workTicketInfoMap.put("receiveTime", ""); + workTicketInfoMap.put("principalConfirm", ""); + } + /**负责人确认安全事项**/ + List confirmFlow = workTicketFlowVOList.stream() + .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(confirmFlow)) { + workTicketInfoMap.put("confirmPrincipal", confirmFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("confirmPrincipal", ""); + workTicketInfoMap.put("confirmTime", ""); + } + /**工作结束**/ + List finishFlow = workTicketFlowVOList.stream() + .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(finishFlow)) { + workTicketInfoMap.put("finisher", finishFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("principalFinish", workTicketInfoVO.getPrincipalName()); + } else { + workTicketInfoMap.put("finisher", ""); + workTicketInfoMap.put("finishTime", ""); + workTicketInfoMap.put("principalFinish", ""); + } + /**工作终结**/ + List endFlow = workTicketFlowVOList.stream() + .filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(endFlow)) { + workTicketInfoMap.put("endLicensor", endFlow.get(0).getCreateUserName()); + 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("groundWireCode", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCode()) ? endFlow.get(0).getGroundWireCode() : ""); + workTicketInfoMap.put("groundWireCount", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCount()) ? endFlow.get(0).getGroundWireCount() : ""); + } else { + workTicketInfoMap.put("endLicensor", ""); + workTicketInfoMap.put("endTime", ""); + workTicketInfoMap.put("groundSwitchCount", ""); + workTicketInfoMap.put("groundWireCode", ""); + workTicketInfoMap.put("groundWireCount", ""); + } + /**负责人变更**/ + List workTicketPrincipalChangeVOList = workTicketInfoVO.getWorkTicketPrincipalChangeVOList(); + if (CollectionUtil.isNotEmpty(workTicketPrincipalChangeVOList)) { + workTicketInfoMap.put("initPrincipal", workTicketPrincipalChangeVOList.get(0).getInitialPrincipalName()); + workTicketInfoMap.put("changePrincipal", workTicketPrincipalChangeVOList.get(0).getChangePrincipalName()); + workTicketInfoMap.put("principalChangeSigner", workTicketPrincipalChangeVOList.get(0).getCreateUserName()); + workTicketInfoMap.put("principalChangeTime", DateUtil.format(workTicketPrincipalChangeVOList.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("initPrincipal", ""); + workTicketInfoMap.put("changePrincipal", ""); + workTicketInfoMap.put("principalChangeSigner", ""); + workTicketInfoMap.put("principalChangeTime", ""); + } + /**工作成员变更**/ + List membersChangeList = workTicketInfoVO.getWorkTicketMembersChangeVOList(); + if (CollectionUtil.isNotEmpty(membersChangeList)) { + /**工作成员变更详情**/ + String membersChangeSituation = membersChangeList.stream().map(mc -> + DateUtil.format(mc.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); + workTicketInfoMap.put("membersChangeSituation", membersChangeSituation); + workTicketInfoMap.put("memberChangePrincipal", membersChangeList.get(0).getCreateUserName()); + } else { + workTicketInfoMap.put("membersChangeSituation", ""); + workTicketInfoMap.put("memberChangePrincipal", ""); + } + /**工作票延期**/ + List workTicketDelayVOList = workTicketInfoVO.getWorkTicketDelayVOList(); + if (CollectionUtil.isNotEmpty(workTicketDelayVOList)) { + WorkTicketDelayVO workTicketDelayVO = workTicketDelayVOList.get(0); + workTicketInfoMap.put("delayTime", DateUtil.format(workTicketDelayVO.getChangeTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("delayPrincipal", workTicketDelayVO.getCreateUserName()); + workTicketInfoMap.put("delayPrincipalTime", DateUtil.format(workTicketDelayVO.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("delayLicensor", workTicketDelayVO.getLicensorName()); + workTicketInfoMap.put("delayLicenseTime", DateUtil.format(workTicketDelayVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("delayTime", ""); + workTicketInfoMap.put("delayPrincipal", ""); + workTicketInfoMap.put("delayPrincipalTime", ""); + workTicketInfoMap.put("delayLicensor", ""); + workTicketInfoMap.put("delayLicenseTime", ""); + } + + /**跨日工作时间**/ + List operateList = workTicketInfoVO.getWorkTicketOperateTimeVOList(); + if (CollectionUtil.isNotEmpty(operateList)) { + List> operateMapList = operateList.stream().map(operate -> { + Map map = new HashMap<>(4); + map.put("startTime", DateUtil.format(operate.getStartTime(), TicketConstants.TICKET_DATE_PATTERN)); + map.put("endTime", DateUtil.format(operate.getEndTime(), TicketConstants.TICKET_DATE_PATTERN)); + map.put("principal", operate.getPrincipalName()); + map.put("licensor", operate.getLicensorName()); + return map; + }).collect(Collectors.toList()); + workTicketInfoMap.put("operateMapList", operateMapList); + } else { + List> operateMapList = new ArrayList<>(); + Map map = new HashMap<>(4); + map.put("startTime", ""); + map.put("endTime", ""); + map.put("principal", ""); + map.put("licensor", ""); + operateMapList.add(map); + workTicketInfoMap.put("operateMapList", operateMapList); + } + + /**运行值班人员暂为空**/ + workTicketInfoMap.put("dutyPersonName", "/"); + + String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(workTicketInfoVO.getType()) + PdfUtils.XLSX_SUFFIX; + log.info("工作票模板为:{}", fileName); + TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); + Workbook workbook = null; + try { + workbook = ExcelUtil.getWorkbook(templateExportParams, workTicketInfoMap); + } catch (Exception e) { + e.printStackTrace(); + } + //上传xlsx至服务器 + try { + ExcelUtil.upload(workbook, xlsSavePath, workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX); + } catch (Exception e) { + e.printStackTrace(); + } + //将xlsx文件转换为pdf并保存 + String pdfFileName = workTicketInfoVO.getWorkContent() + PdfUtils.PDF_SUFFIX; + String xlsFileName = workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX; + PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); + String savePath = pdfSavePath + pdfFileName; + // 设置response参数,可以打开下载页面 + PdfUtils.readPdf(response, savePath); + } + + @Override + @Transactional + public R completeTask(WorkTicketInfoDto req, BladeFlow flow) { + ComleteTask task = new ComleteTask(); + task.setTaskId(flow.getTaskId()); + task.setComment(flow.getComment()); + task.setAttachments(flow.getAttachments()); + task.setFlag(flow.getFlag()); + task.setProcessInstanceId(flow.getProcessInstanceId()); + task.setVariables(flow.getVariables()); + + //待许可时获取许可人角色下用户开启工作流 + if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) { + R> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), req.getCreateDept(), TicketConstants.LICENSOR_ROLE); + if (!userListR.isSuccess()) { + throw new ServiceException(userListR.getMsg()); + } + Map variables = CollectionUtil.isEmpty(flow.getVariables()) ? new HashMap<>() : flow.getVariables(); + String taskUser = userListR.getData().stream().map(u -> "taskUser_".concat(u.getId().toString())).collect(Collectors.joining(",")); + variables.put("licenseUserIds", taskUser); + task.setVariables(variables); + } + log.info("工作流对象为:{}", JSONObject.toJSONString(flow)); + + if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) { + req.setSigner(AuthUtil.getUserId()); + } else if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) { + req.setLicensor(AuthUtil.getUserId()); + } else if (TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(req.getStatus())) { + this.invalidTicket(req); + } + + //更新状态 + boolean flag = this.update(Wrappers.lambdaUpdate() + .set(WorkTicketInfoEntity::getStatus, req.getStatus()) + .set(WorkTicketInfoEntity::getPrincipal, req.getPrincipal()) + .set(WorkTicketInfoEntity::getLicensor, req.getLicensor()) + .set(WorkTicketInfoEntity::getLicenseTime, req.getLicenseTime()) + .set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()) + .eq(WorkTicketInfoEntity::getId, req.getId())); + + //新增流程信息 + WorkTicketFlowEntity workTicketFlowEntity = new WorkTicketFlowEntity(); + workTicketFlowEntity.setTicketId(req.getId()); + workTicketFlowEntity.setFlowCode(req.getStatus().toString()); + workTicketFlowEntity.setExecutor(AuthUtil.getUserId().toString()); + workTicketFlowEntity.setExecuteTime(LocalDateTime.now()); + 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.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.setStatus(req.getStatus()); + workTicketFlowService.save(workTicketFlowEntity); + //执行流程 + R flowResult = flowClient.completeTask(task); + //更新任务状态 + updateAccessStatus(req); + + if (!flowResult.isSuccess()) { + throw new ServiceException("执行工作流失败!"); + } + + return R.success("操作成功!"); + } + + @Transactional(rollbackFor = Exception.class) + public void updateAccessStatus(WorkTicketInfoDto req) { + if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) { + log.info("许可通过:{}", JSONObject.toJSONString(req)); + //许可人通过将检修任务状态设为执行中 + if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) { + OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); + taskEntity.setId(req.getTaskId()); + taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_1); + //设置开始时间 + taskEntity.setActStartTime(DateUtil.now()); + operAccessTaskClient.updateById(taskEntity); + } + } + } + + /*** + * 票据作废时 对应任务ID应该置空 + * @param req + */ + public void invalidTicket(WorkTicketInfoDto req) { + if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) { + OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); + taskEntity.setId(req.getTaskId()); + taskEntity.setInvalid(true); + taskEntity.setTicketId(null); + operAccessTaskClient.updateById(taskEntity); + } + if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) { + OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); + dto.setId(req.getTaskId()); + dto.setInvalid(true); + //dto.setTicketId(null); + taskClient.doUpdateTaskById(dto); + } + } + + /*** + * 回传票据ID + * @param req + */ + @Transactional(rollbackFor = Exception.class) + public void returnTicket(WorkTicketInfoDto req) { + if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType())) { + OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); + taskEntity.setId(req.getTaskId()); + taskEntity.setTicketId(req.getId()); + operAccessTaskClient.updateById(taskEntity); + } + if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) { + OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); + dto.setId(req.getTaskId()); + dto.setTicketId(req.getId()); + taskClient.doUpdateTaskById(dto); + } + } + + /** + * 获取queryWrapper + * + * @param req + * @return + */ + private LambdaQueryWrapper getQueryWrapper(WorkTicketInfoDto req) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper(); + if (Func.isNotBlank(req.getProcessInstanceId())) { + lqw.eq(WorkTicketInfoEntity::getProcessInstanceId, req.getProcessInstanceId()); + } + if (Func.isNotEmpty(req.getType())) { + lqw.eq(WorkTicketInfoEntity::getType, req.getType()); + } + if (Func.isNotEmpty(req.getTaskType())) { + lqw.eq(WorkTicketInfoEntity::getTaskType, req.getTaskType()); + } + if (Func.isNotEmpty(req.getCode())) { + lqw.like(WorkTicketInfoEntity::getCode, req.getCode()); + } + if (Func.isNotEmpty(req.getStatus())) { + lqw.eq(WorkTicketInfoEntity::getStatus, req.getStatus()); + } + if (Func.isNotEmpty(req.getCompany())) { + lqw.like(WorkTicketInfoEntity::getType, "%".concat(req.getCompany()).concat("%")); + } + if (Func.isNotEmpty(req.getClassGroup())) { + lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup()); + } + if (Func.isNotEmpty(req.getTaskId())) { + lqw.eq(WorkTicketInfoEntity::getTaskId, req.getTaskId()); + } + if (Func.isNotEmpty(req.getClassGroup())) { + lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup()); + } + if (Func.isNotEmpty(req.getClassGroupMembers())) { + lqw.like(WorkTicketInfoEntity::getClassGroupMembers, "%".concat(req.getClassGroupMembers()).concat("%")); + } + if (Func.isNotEmpty(req.getWorkContent())) { + lqw.like(WorkTicketInfoEntity::getWorkContent, "%".concat(req.getWorkContent()).concat("%")); + } + if (Func.isNotEmpty(req.getSigner())) { + lqw.eq(WorkTicketInfoEntity::getSigner, req.getSigner()); + } + if (Func.isNotEmpty(req.getLicensor())) { + lqw.eq(WorkTicketInfoEntity::getLicensor, req.getLicensor()); + } + if (Func.isNotEmpty(req.getStartTime())) { + lqw.ge(WorkTicketInfoEntity::getCreateTime, req.getStartTime()); + } + if (Func.isNotEmpty(req.getEndTime())) { + lqw.le(WorkTicketInfoEntity::getCreateTime, req.getEndTime()); + } + if (!CollectionUtil.isEmpty(req.getDeptIds())) { + lqw.in(WorkTicketInfoEntity::getCreateDept, req.getDeptIds()); + } + return lqw; + } + + /** + * 开启一个流程实例 + * + * @author hx + **/ + @Override + public BladeFlow startProcessInstance(String processDefinitionKey, WorkTicketInfoEntity workTicketInfoEntity) { + /**获取签发人角色下的人员**/ + R> listR = userClient.relationUserListByRoleAlias(tenantId, Long.parseLong(AuthUtil.getUser().getDeptId()), TicketConstants.SIGNER_ROLE); + if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) { + throw new ServiceException("工作票签发人角色下未查询到相关人员"); + } + String signUserIds = listR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); + + Map params = new HashMap(2) {{ + put("taskId", workTicketInfoEntity.getId()); + put("signUserIds", signUserIds); + }}; + + R r = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, "workTicket:task:" + workTicketInfoEntity.getId(), workTicketInfoEntity.getWorkContent(), params); + if (!r.isSuccess()) { + throw new ServiceException(r.getMsg()); + } + return r.getData(); + } + + /** + * 许可人通过线下工作票 + * + * @param req + * @return + */ + @Override + public R licenseOfflineTicket(WorkTicketInfoDto req) { + Long ticketId = req.getId(); + WorkTicketInfoEntity infoEntity = getById(ticketId); + //获取许可人角色下的人员 + R> listR = userClient.relationUserListByRoleAlias(tenantId, infoEntity.getCreateDept(), TicketConstants.LICENSOR_ROLE); + if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) { + throw new ServiceException("工作票许可人角色下未查询到相关人员"); + } + List userId = listR.getData().stream().map(User::getId).distinct().collect(Collectors.toList()); + if (!userId.contains(AuthUtil.getUserId())) { + throw new ServiceException("当前操作人没有许可人角色,无法执行该操作"); + } + update(Wrappers.lambdaUpdate() + .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()) + .set(WorkTicketInfoEntity::getLicensor, AuthUtil.getUserId()) + .set(WorkTicketInfoEntity::getLicenseTime, LocalDateTime.now()) + .set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()) + .eq(WorkTicketInfoEntity::getId, ticketId) + ); + return R.success("操作成功"); + } + + /** + * 完成线下工作票 + * + * @param ticketAccessTaskDto + * @return + */ + @Override + public R finishOfflineTicket(TicketAccessTaskDto ticketAccessTaskDto) { + //更新工作票 + WorkTicketInfoDto infoDto = ticketAccessTaskDto.getWorkTicketInfoDto(); + update(Wrappers.lambdaUpdate() + .set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()) + .eq(WorkTicketInfoEntity::getId, infoDto.getId()) + ); + //获取工作票实体类 + WorkTicketInfoEntity infoEntity = getById(infoDto.getId()); + //根据任务类型执行任务 + if (ObjectUtil.isEmpty(infoEntity.getTaskType())) { + return R.success("操作成功"); + } + //FIXME 日常维护、检修任务暂时不形成闭环(因许可人无需填入任务结束完成所需参数,故选择由执行人手动闭环) ~2022--05-06 // if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(infoEntity.getTaskType()) // || TicketConstants.TaskTypeEnum.JXJH.getType().equals(infoEntity.getTaskType())) { // //执行检修任务 @@ -789,83 +784,138 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl infoEntityList = this.list(new LambdaQueryWrapper(){{ - ge(WorkTicketInfoEntity::getCreateTime,firstDay); - le(WorkTicketInfoEntity::getCreateTime,lastDay); - }}); - if(CollectionUtil.isEmpty(infoEntityList)){ - 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)); - } - } - catch(Exception e){ - e.printStackTrace(); - } - finally{ - lock.unlock(); - } - return code; - } - - /** - * 获取安全检查工作票项统计 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param dept 机构ID - * @return WorkTicketStatisticVO统计对象 - */ - @Override - public SafeCheckStatisticVO getWorkTicketStatistic(String startDate, String endDate, Long dept) { - return this.baseMapper.getWorkTicketStatistic(startDate,endDate,dept); - } - - /** - * 验证角色是否能查询到相关人员 - * @param deptId 机构ID - * @param roleAliasArray 角色 按逗号分隔 - * @return - */ - @Override - public R> verificationRole(Long deptId, String roleAliasArray){ - Map result = new HashedMap(2); - List failRoleAliasList = Lists.newArrayList(); - AtomicBoolean flag = new AtomicBoolean(true); - Arrays.stream(roleAliasArray.split(",")).forEach(roleAlias->{ - //查询机构下角色是否有对应人员列表 - R> listR = userClient.relationUserListByRoleAlias(tenantId,deptId,roleAlias); - if(!listR.isSuccess() || ObjectUtil.isEmpty(listR.getData())) { - failRoleAliasList.add(roleAlias); - flag.set(false); - } - }); - result.put("flag",flag.get()); - if(CollectionUtil.isNotEmpty(failRoleAliasList)){ - result.put("message","验证失败,获取"+JSON.toJSONString(failRoleAliasList)+"角色下的人员失败"); - } - - return R.data(result); - } + return R.success("操作成功"); + } + + /*** + * 获取工作票编号 + * @return + */ + @Override + public String getWorkTicketCode() { + String code = ""; + lock.lock(); + try { + /**获取当前时间**/ + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM"); + YearMonth yearMonth = YearMonth.now(); + String tym = yearMonth.format(formatter); + LocalDateTime date = LocalDateTime.now(); + LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); + LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59); + log.info("当月第一天:{};当月最后一天{}", firstDay, lastDay); + /**获取当月工作票总条数**/ + List infoEntityList = this.list(new LambdaQueryWrapper() {{ + ge(WorkTicketInfoEntity::getCreateTime, firstDay); + le(WorkTicketInfoEntity::getCreateTime, lastDay); + }}); + if (CollectionUtil.isEmpty(infoEntityList)) { + 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)); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + lock.unlock(); + } + return code; + } + + /** + * 获取安全检查工作票项统计 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param dept 机构ID + * @return WorkTicketStatisticVO统计对象 + */ + @Override + public SafeCheckStatisticVO getWorkTicketStatistic(String startDate, String endDate, Long dept) { + return this.baseMapper.getWorkTicketStatistic(startDate, endDate, dept); + } + + /** + * 验证角色是否能查询到相关人员 + * + * @param deptId 机构ID + * @param roleAliasArray 角色 按逗号分隔 + * @return + */ + @Override + public R> verificationRole(Long deptId, String roleAliasArray) { + Map result = new HashedMap(2); + List failRoleAliasList = Lists.newArrayList(); + AtomicBoolean flag = new AtomicBoolean(true); + Arrays.stream(roleAliasArray.split(",")).forEach(roleAlias -> { + //查询机构下角色是否有对应人员列表 + R> listR = userClient.relationUserListByRoleAlias(tenantId, deptId, roleAlias); + if (!listR.isSuccess() || ObjectUtil.isEmpty(listR.getData())) { + failRoleAliasList.add(roleAlias); + flag.set(false); + } + }); + result.put("flag", flag.get()); + if (CollectionUtil.isNotEmpty(failRoleAliasList)) { + result.put("message", "验证失败,获取" + JSON.toJSONString(failRoleAliasList) + "角色下的人员失败"); + } + + return R.data(result); + } + + /** + * 根据月份和区域查询工作票列表详情 + * + * @param pageEntity + * @param areaVo + * @return + */ + @Override + public BladePage workTicketListByMonthAndArea(Page pageEntity, + StandardTicketWithAreaVo areaVo) { + //1.查询 + QueryWrapper 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 workTicketInfoEntityPage = baseMapper.selectPage(pageEntity, queryWrapper); + //数据转换 + List 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 page = new Page<>(); + page.setRecords(standardWorkList); + page.setTotal(workTicketInfoEntityPage.getTotal()); + page.setCurrent(workTicketInfoEntityPage.getCurrent()); + page.setSize(workTicketInfoEntityPage.getSize()); + BladePage bladePage = BladePage.of(page); + return bladePage; + } }