chore: 【ops】迁移cleaner相关实体到environment模块
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
package com.viewsh.module.ops.dal.dataobject.cleaner;
|
||||
|
||||
import com.viewsh.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 保洁员绩效月度汇总 DO
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@TableName("ops_cleaner_performance_monthly")
|
||||
@KeySequence("ops_cleaner_performance_monthly_seq")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OpsCleanerPerformanceMonthlyDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 汇总ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 保洁员用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 年月(2025-01)
|
||||
*/
|
||||
private String yearMonth;
|
||||
/**
|
||||
* 总工单数
|
||||
*/
|
||||
private Integer totalOrders;
|
||||
/**
|
||||
* P0紧急工单数
|
||||
*/
|
||||
private Integer p0Orders;
|
||||
/**
|
||||
* P1重要工单数
|
||||
*/
|
||||
private Integer p1Orders;
|
||||
/**
|
||||
* P2普通工单数
|
||||
*/
|
||||
private Integer p2Orders;
|
||||
/**
|
||||
* 平均响应时长(秒)
|
||||
*/
|
||||
private Integer avgResponseSeconds;
|
||||
/**
|
||||
* 平均完成时长(秒)
|
||||
*/
|
||||
private Integer avgCompletionSeconds;
|
||||
/**
|
||||
* 平均质量评分(1-5)
|
||||
*/
|
||||
private BigDecimal avgQualityScore;
|
||||
/**
|
||||
* 总作业时长(秒)
|
||||
*/
|
||||
private Long totalWorkSeconds;
|
||||
/**
|
||||
* 总暂停时长(秒)
|
||||
*/
|
||||
private Long totalPauseSeconds;
|
||||
/**
|
||||
* 出勤率(百分比)
|
||||
*/
|
||||
private BigDecimal attendanceRate;
|
||||
/**
|
||||
* 绩效总分
|
||||
*/
|
||||
private BigDecimal performanceScore;
|
||||
/**
|
||||
* 团队排名
|
||||
*/
|
||||
private Integer rankInTeam;
|
||||
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package com.viewsh.module.ops.dal.dataobject.cleaner;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.viewsh.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.viewsh.module.ops.enums.CleanerStatusEnum;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 保洁员实时状态 DO
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@TableName("ops_cleaner_status")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OpsCleanerStatusDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 保洁员用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 保洁员姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 工牌设备ID(关联iot_device表)
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 工牌设备编码
|
||||
*/
|
||||
private String deviceCode;
|
||||
|
||||
/**
|
||||
* 当前状态(IDLE=空闲/BUSY=忙碌/OFFLINE=离线/PAUSED=暂停)
|
||||
*
|
||||
* 枚举 {@link com.viewsh.module.ops.enums.CleanerStatusEnum}
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 当前位置区域ID
|
||||
*
|
||||
* 关联 {@link com.viewsh.module.ops.dal.dataobject.area.OpsBusAreaDO#getId()}
|
||||
*/
|
||||
private Long currentAreaId;
|
||||
|
||||
/**
|
||||
* 当前位置区域名称
|
||||
*/
|
||||
private String currentAreaName;
|
||||
|
||||
/**
|
||||
* 当前正在执行的工单ID
|
||||
*
|
||||
* 关联 {@link com.viewsh.module.ops.dal.dataobject.workorder.OpsOrderDO#getId()}
|
||||
*/
|
||||
private Long currentOpsOrderId;
|
||||
|
||||
/**
|
||||
* 当前正在执行的工单编号
|
||||
*/
|
||||
private String currentOpsOrderCode;
|
||||
|
||||
/**
|
||||
* 工牌电量(0-100)
|
||||
*/
|
||||
private Integer batteryLevel;
|
||||
|
||||
/**
|
||||
* 最后心跳时间
|
||||
*/
|
||||
private LocalDateTime lastHeartbeatTime;
|
||||
|
||||
/**
|
||||
* 最后一次同步设备状态时间
|
||||
*/
|
||||
private LocalDateTime lastDeviceSyncTime;
|
||||
|
||||
/**
|
||||
* 状态变更时间
|
||||
*/
|
||||
private LocalDateTime statusChangeTime;
|
||||
|
||||
/**
|
||||
* 离线原因
|
||||
*/
|
||||
private String offlineReason;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 获取状态枚举
|
||||
*/
|
||||
public CleanerStatusEnum getStatusEnum() {
|
||||
return CleanerStatusEnum.fromCode(this.status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置状态枚举
|
||||
*/
|
||||
public void setStatusEnum(CleanerStatusEnum statusEnum) {
|
||||
this.status = statusEnum.getCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否可以接新单
|
||||
*/
|
||||
public boolean canAcceptNewOrder() {
|
||||
CleanerStatusEnum statusEnum = getStatusEnum();
|
||||
return statusEnum != null && statusEnum.isCanAcceptNewOrder();
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.viewsh.module.ops.dal.dataobject.log;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.viewsh.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 保洁业务日志 DO
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@TableName(value = "ops_order_clean_log", autoResultMap = true)
|
||||
@KeySequence("ops_order_clean_log_seq")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OpsOrderCleanLogDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 日志ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 事件发生时间
|
||||
*/
|
||||
private LocalDateTime eventTime;
|
||||
/**
|
||||
* 日志级别(INFO=信息/WARN=警告/ERROR=错误)
|
||||
*/
|
||||
private String eventLevel;
|
||||
/**
|
||||
* 领域(RULE=规则引擎/DISPATCH=调度/BADGE=工牌/BEACON=信标/SYSTEM=系统)
|
||||
*
|
||||
* 枚举 {@link com.viewsh.module.ops.enums.EventDomainEnum}
|
||||
*/
|
||||
private String eventDomain;
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
private String eventType;
|
||||
/**
|
||||
* 关联工单ID
|
||||
*
|
||||
* 关联 {@link com.viewsh.module.ops.dal.dataobject.workorder.OpsOrderDO#getId()}
|
||||
*/
|
||||
private Long opsOrderId;
|
||||
/**
|
||||
* 区域ID
|
||||
*
|
||||
* 关联 {@link com.viewsh.module.ops.dal.dataobject.area.OpsBusAreaDO#getId()}
|
||||
*/
|
||||
private Long areaId;
|
||||
/**
|
||||
* 保洁员ID
|
||||
*/
|
||||
private Long cleanerId;
|
||||
/**
|
||||
* 设备ID(工牌/信标)
|
||||
*/
|
||||
private Long deviceId;
|
||||
/**
|
||||
* 可读日志内容
|
||||
*/
|
||||
private String eventMessage;
|
||||
/**
|
||||
* 结构化上下文
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, Object> eventPayload;
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.viewsh.module.ops.dal.dataobject.workorder;
|
||||
|
||||
import com.viewsh.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 保洁工单扩展 DO
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@TableName("ops_order_clean_ext")
|
||||
@KeySequence("ops_order_clean_ext_seq")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OpsOrderCleanExtDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 工单ID
|
||||
*
|
||||
* 关联 {@link OpsOrderDO#getId()}
|
||||
*/
|
||||
private Long opsOrderId;
|
||||
/**
|
||||
* 是否自动工单(1=自动 0=手动)
|
||||
*/
|
||||
private Integer isAuto;
|
||||
/**
|
||||
* 预计作业时长(分钟)
|
||||
*/
|
||||
private Integer expectedDuration;
|
||||
/**
|
||||
* 实际到岗时间
|
||||
*/
|
||||
private LocalDateTime arrivedTime;
|
||||
/**
|
||||
* 实际完成时间
|
||||
*/
|
||||
private LocalDateTime completedTime;
|
||||
/**
|
||||
* 暂停开始时间
|
||||
*/
|
||||
private LocalDateTime pauseStartTime;
|
||||
/**
|
||||
* 暂停结束时间
|
||||
*/
|
||||
private LocalDateTime pauseEndTime;
|
||||
/**
|
||||
* 累计暂停时长(秒)
|
||||
*/
|
||||
private Integer totalPauseSeconds;
|
||||
/**
|
||||
* 保洁类型(ROUTINE=日常/DEEP=深度/SPOT=点状/EMERGENCY=应急)
|
||||
*/
|
||||
private String cleaningType;
|
||||
/**
|
||||
* 难度等级(1-5级)
|
||||
*/
|
||||
private Integer difficultyLevel;
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.viewsh.module.ops.dal.mysql.cleaner;
|
||||
|
||||
import com.viewsh.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.viewsh.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.viewsh.module.ops.dal.dataobject.cleaner.OpsCleanerPerformanceMonthlyDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保洁员绩效月度汇总 Mapper
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@Mapper
|
||||
public interface OpsCleanerPerformanceMonthlyMapper extends BaseMapperX<OpsCleanerPerformanceMonthlyDO> {
|
||||
|
||||
/**
|
||||
* 根据用户ID和年月查询绩效
|
||||
*/
|
||||
default OpsCleanerPerformanceMonthlyDO selectByUserIdAndYearMonth(Long userId, String yearMonth) {
|
||||
return selectOne(new LambdaQueryWrapperX<OpsCleanerPerformanceMonthlyDO>()
|
||||
.eq(OpsCleanerPerformanceMonthlyDO::getUserId, userId)
|
||||
.eq(OpsCleanerPerformanceMonthlyDO::getYearMonth, yearMonth));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据年月查询所有人的绩效
|
||||
*/
|
||||
default List<OpsCleanerPerformanceMonthlyDO> selectListByYearMonth(String yearMonth) {
|
||||
return selectList(new LambdaQueryWrapperX<OpsCleanerPerformanceMonthlyDO>()
|
||||
.eq(OpsCleanerPerformanceMonthlyDO::getYearMonth, yearMonth)
|
||||
.orderByDesc(OpsCleanerPerformanceMonthlyDO::getPerformanceScore));
|
||||
}
|
||||
|
||||
// 注意:分页查询方法需要在Service层实现,这里只提供基础查询方法
|
||||
// 具体分页查询请参考Service实现
|
||||
|
||||
/**
|
||||
* 查询用户的历史绩效列表
|
||||
*/
|
||||
default List<OpsCleanerPerformanceMonthlyDO> selectListByUserId(Long userId) {
|
||||
return selectList(new LambdaQueryWrapperX<OpsCleanerPerformanceMonthlyDO>()
|
||||
.eq(OpsCleanerPerformanceMonthlyDO::getUserId, userId)
|
||||
.orderByDesc(OpsCleanerPerformanceMonthlyDO::getYearMonth));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.viewsh.module.ops.dal.mysql.cleaner;
|
||||
|
||||
import com.viewsh.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.viewsh.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.viewsh.module.ops.dal.dataobject.cleaner.OpsCleanerStatusDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保洁员实时状态 Mapper
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@Mapper
|
||||
public interface OpsCleanerStatusMapper extends BaseMapperX<OpsCleanerStatusDO> {
|
||||
|
||||
/**
|
||||
* 根据用户ID查询状态
|
||||
*/
|
||||
default OpsCleanerStatusDO selectByUserId(Long userId) {
|
||||
return selectOne(OpsCleanerStatusDO::getUserId, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态查询保洁员列表
|
||||
*/
|
||||
default List<OpsCleanerStatusDO> selectListByStatus(String status) {
|
||||
return selectList(new LambdaQueryWrapperX<OpsCleanerStatusDO>()
|
||||
.eq(OpsCleanerStatusDO::getStatus, status)
|
||||
.orderByDesc(OpsCleanerStatusDO::getStatusChangeTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区域查询附近保洁员
|
||||
*/
|
||||
default List<OpsCleanerStatusDO> selectListByAreaId(Long areaId) {
|
||||
return selectList(new LambdaQueryWrapperX<OpsCleanerStatusDO>()
|
||||
.eq(OpsCleanerStatusDO::getCurrentAreaId, areaId)
|
||||
.ne(OpsCleanerStatusDO::getStatus, "OFFLINE")
|
||||
.orderByDesc(OpsCleanerStatusDO::getLastHeartbeatTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询离线保洁员(心跳超时)
|
||||
*/
|
||||
default List<OpsCleanerStatusDO> selectListByHeartbeatTimeout(LocalDateTime timeout) {
|
||||
return selectList(new LambdaQueryWrapperX<OpsCleanerStatusDO>()
|
||||
.lt(OpsCleanerStatusDO::getLastHeartbeatTime, timeout)
|
||||
.ne(OpsCleanerStatusDO::getStatus, "OFFLINE"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备ID查询保洁员状态
|
||||
*/
|
||||
default OpsCleanerStatusDO selectByDeviceId(Long deviceId) {
|
||||
return selectOne(OpsCleanerStatusDO::getDeviceId, deviceId);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user