parent
b93f8e2c4d
commit
61fffc9134
61 changed files with 3501 additions and 24 deletions
@ -0,0 +1,61 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_check_item") |
||||
public class CheckItem extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 归属 |
||||
*/ |
||||
private String owner; |
||||
|
||||
/** |
||||
* 编码 |
||||
*/ |
||||
private String code; |
||||
|
||||
|
||||
/** |
||||
* 名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 描述 |
||||
*/ |
||||
private String checkDesc; |
||||
|
||||
/** |
||||
* 默认内容 |
||||
*/ |
||||
private String defValue; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
} |
||||
@ -0,0 +1,140 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_plan") |
||||
public class InspectionPlan extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 点位名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 计划单据 |
||||
*/ |
||||
private String planCode; |
||||
|
||||
/** |
||||
* 计划状态 |
||||
*/ |
||||
private String planStatus; |
||||
|
||||
/** |
||||
* 计划类型 |
||||
*/ |
||||
private String planType; |
||||
|
||||
/** |
||||
* 负责人 |
||||
*/ |
||||
private String leaderId; |
||||
|
||||
/** |
||||
* 巡检班组 |
||||
*/ |
||||
private String groupId; |
||||
|
||||
/** |
||||
* 位置范围 |
||||
*/ |
||||
private String posDetail; |
||||
|
||||
|
||||
/** |
||||
* 开始日期 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date startDate; |
||||
|
||||
/** |
||||
* 截止日期 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date endDate; |
||||
|
||||
/** |
||||
* 计划周期 |
||||
*/ |
||||
private String actionCycleTime; |
||||
|
||||
/** |
||||
* 计划周期间隔 |
||||
*/ |
||||
private String actionCycleType; |
||||
|
||||
/** |
||||
* 巡检顺序 |
||||
*/ |
||||
private String inspectionMethod; |
||||
|
||||
/** |
||||
* 时间要求 |
||||
*/ |
||||
private Double completionTime; |
||||
|
||||
/** |
||||
* 上次执行 |
||||
*/ |
||||
|
||||
private String lastTime; |
||||
|
||||
/** |
||||
* 下次执行 |
||||
*/ |
||||
private String nextTime; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
/** |
||||
* 巡检点位列表 |
||||
*/ |
||||
@TableField(exist = false) |
||||
List<InspectionPoint> pointList; |
||||
|
||||
/** |
||||
* 巡检点数 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private Integer pointCount; |
||||
} |
||||
@ -0,0 +1,52 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_plan_point") |
||||
public class InspectionPlanPoint extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 巡检计划 |
||||
*/ |
||||
private String planId; |
||||
|
||||
/** |
||||
* 巡检点 |
||||
*/ |
||||
private String pointId; |
||||
|
||||
/** |
||||
* 排序 |
||||
*/ |
||||
private String sort; |
||||
|
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,124 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_point") |
||||
public class InspectionPoint extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 点位名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 点位编码 |
||||
*/ |
||||
private String code; |
||||
|
||||
/** |
||||
* 巡检内容 |
||||
*/ |
||||
private String content; |
||||
|
||||
/** |
||||
* 巡检路线 |
||||
*/ |
||||
private String routeId; |
||||
|
||||
/** |
||||
* 点位位置 |
||||
*/ |
||||
private String posId; |
||||
|
||||
/** |
||||
* 位置详情 |
||||
*/ |
||||
private String pos; |
||||
|
||||
/** |
||||
* 位置经度 |
||||
*/ |
||||
private Double posLongitude; |
||||
|
||||
|
||||
/** |
||||
* 位置纬度 |
||||
*/ |
||||
private Double posLatitude; |
||||
|
||||
/** |
||||
* 图片 |
||||
*/ |
||||
private String picture; |
||||
|
||||
/** |
||||
* 关联设备 |
||||
*/ |
||||
private String assetId; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
/** |
||||
* 巡检点项对应列表 |
||||
*/ |
||||
@TableField(exist = false) |
||||
List<InspectionPointItem> pointItemList; |
||||
|
||||
/** |
||||
* 巡检项列表 |
||||
*/ |
||||
@TableField(exist = false) |
||||
List<CheckItem> checkItemList; |
||||
|
||||
/** |
||||
* 关联设备名称 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String assetName; |
||||
|
||||
/** |
||||
* 巡检路径名称 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String routeName; |
||||
|
||||
/** |
||||
* 点位路径 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String posHierarchy; |
||||
|
||||
/** |
||||
* 检查项数 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private Integer itemSize; |
||||
|
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_point_item") |
||||
public class InspectionPointItem extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 巡检点 |
||||
*/ |
||||
private String pointId; |
||||
|
||||
/** |
||||
* 巡检项 |
||||
*/ |
||||
private String itemId; |
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
} |
||||
@ -0,0 +1,72 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_point_pos") |
||||
public class InspectionPointPos extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 编码 |
||||
*/ |
||||
private String code; |
||||
|
||||
/** |
||||
* 名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 父节点 |
||||
*/ |
||||
private Long parentId; |
||||
|
||||
/** |
||||
* 祖级 |
||||
*/ |
||||
private String ancestors; |
||||
|
||||
/** |
||||
* 节点路径 |
||||
*/ |
||||
private String hierarchy; |
||||
|
||||
/** |
||||
* 路径名称 |
||||
*/ |
||||
private String hierarchyName; |
||||
|
||||
|
||||
|
||||
/** |
||||
* 排序 |
||||
*/ |
||||
private Integer sort; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
} |
||||
@ -0,0 +1,47 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.tool.node.INode; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class InspectionPointPosVO extends InspectionPointPos implements INode<InspectionPointPosVO> { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@JsonSerialize(using = ToStringSerializer.class) |
||||
private Long id; |
||||
|
||||
/** |
||||
* 父节点 |
||||
*/ |
||||
@JsonSerialize(using = ToStringSerializer.class) |
||||
private Long parentId; |
||||
|
||||
|
||||
private List<InspectionPointPosVO> children; |
||||
|
||||
/** |
||||
* 是否有子孙节点 |
||||
*/ |
||||
private Boolean hasChildren; |
||||
|
||||
public List<InspectionPointPosVO> getChildren() { |
||||
if (this.children == null) { |
||||
this.children = new ArrayList<>(); |
||||
} |
||||
return this.children; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,75 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_record") |
||||
public class InspectionRecord extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 单据 |
||||
*/ |
||||
private String businessCode; |
||||
|
||||
/** |
||||
* 设备 |
||||
*/ |
||||
private String assetId; |
||||
|
||||
/** |
||||
* 结果 |
||||
*/ |
||||
private String resultCode; |
||||
|
||||
/** |
||||
* 内容 |
||||
*/ |
||||
private String content; |
||||
|
||||
/** |
||||
* 操作日期 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date recordTime; |
||||
|
||||
/** |
||||
* 操作人员 |
||||
*/ |
||||
private String operUserId; |
||||
|
||||
/** |
||||
* 操作人员 |
||||
*/ |
||||
private String operUserName; |
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
} |
||||
@ -0,0 +1,46 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_route") |
||||
public class InspectionRoute extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
|
||||
/** |
||||
* 排序 |
||||
*/ |
||||
private Integer sort; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
} |
||||
@ -0,0 +1,170 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_task") |
||||
public class InspectionTask extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 方案 |
||||
*/ |
||||
private String planId; |
||||
|
||||
/** |
||||
* 任务状态 |
||||
*/ |
||||
private String taskStatus; |
||||
|
||||
/** |
||||
* 任务单据 |
||||
*/ |
||||
private String taskCode; |
||||
|
||||
/** |
||||
* 计划单据 |
||||
*/ |
||||
private String planCode; |
||||
|
||||
/** |
||||
* 巡检名称 |
||||
*/ |
||||
private String planName; |
||||
|
||||
/** |
||||
* 巡检顺序 |
||||
*/ |
||||
private String planInspectionMethod; |
||||
|
||||
/** |
||||
* 时间要求 |
||||
*/ |
||||
private Double planCompletionTime; |
||||
|
||||
/** |
||||
* 巡检备注 |
||||
*/ |
||||
private String planNotes; |
||||
|
||||
/** |
||||
* 巡检班组 |
||||
*/ |
||||
private String groupId; |
||||
|
||||
/** |
||||
* 执行人 |
||||
*/ |
||||
private String executorId; |
||||
|
||||
/** |
||||
* 应开始时间 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date planStartTime; |
||||
|
||||
/** |
||||
* 实际开始 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date actStartTime; |
||||
|
||||
/** |
||||
* 实际完成 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date actFinishTime; |
||||
|
||||
|
||||
/** |
||||
* 实际用时 |
||||
*/ |
||||
private Double actTotalCost; |
||||
|
||||
/** |
||||
* 提醒时间 |
||||
*/ |
||||
private Double remindTime; |
||||
|
||||
/** |
||||
* 超时处理 |
||||
*/ |
||||
private String overtimeMethod; |
||||
|
||||
/** |
||||
* 任务反馈 |
||||
*/ |
||||
private String content; |
||||
|
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
/** |
||||
* 制单人 |
||||
*/ |
||||
private String originatorId; |
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
@TableField(exist = false) |
||||
private String actStartTimeBegin; |
||||
|
||||
@TableField(exist = false) |
||||
private String actStartTimeEnd; |
||||
|
||||
@TableField(exist = false) |
||||
private Integer pointCount; |
||||
|
||||
@TableField(exist = false) |
||||
private Integer unPointCount; |
||||
|
||||
@TableField(exist = false) |
||||
private Integer pointNormalCount; |
||||
|
||||
@TableField(exist = false) |
||||
private Integer pointAbnormalCount; |
||||
|
||||
@TableField(exist = false) |
||||
private List<InspectionTaskPoint> taskPointList; |
||||
|
||||
} |
||||
@ -0,0 +1,87 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_task_abnormal") |
||||
public class InspectionTaskAbnormal extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 任务名称 |
||||
*/ |
||||
private String taskId; |
||||
|
||||
/** |
||||
* 异常信息 |
||||
*/ |
||||
private String taskAbnormalInfo; |
||||
|
||||
/** |
||||
* 处理人员 |
||||
*/ |
||||
private String operId; |
||||
|
||||
/** |
||||
* 处理方式 |
||||
*/ |
||||
private String content; |
||||
|
||||
/** |
||||
* 处理时间 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date operTime; |
||||
|
||||
/** |
||||
* 图片 |
||||
*/ |
||||
private String fileIds; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
/** |
||||
* 任务名称 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String taskName; |
||||
|
||||
/** |
||||
* 任务单据 |
||||
*/ |
||||
@TableField(exist = false) |
||||
private String taskCode; |
||||
|
||||
} |
||||
@ -0,0 +1,151 @@ |
||||
package org.springblade.lims.entry; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springframework.data.annotation.Id; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@Data |
||||
@TableName("t_inspection_task_point") |
||||
public class InspectionTaskPoint extends BaseEntity implements Serializable { |
||||
|
||||
/** |
||||
* 业务主键 |
||||
*/ |
||||
@Id |
||||
private Long id; |
||||
|
||||
/** |
||||
* 任务 |
||||
*/ |
||||
private String taskId; |
||||
|
||||
/** |
||||
* 巡检状态 |
||||
*/ |
||||
private String pointStatus; |
||||
|
||||
/** |
||||
* 操作时间 |
||||
*/ |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd" |
||||
) |
||||
private Date operTime; |
||||
|
||||
/** |
||||
* 巡检结果 |
||||
*/ |
||||
private String content; |
||||
|
||||
/** |
||||
* 图片 |
||||
*/ |
||||
private String imageId; |
||||
|
||||
/** |
||||
* 巡检点 |
||||
*/ |
||||
private String pointId; |
||||
|
||||
/** |
||||
* 编码 |
||||
*/ |
||||
private String pointCode; |
||||
|
||||
/** |
||||
* 巡检点 |
||||
*/ |
||||
private String pointName; |
||||
|
||||
/** |
||||
* 巡检内容 |
||||
*/ |
||||
private String pointContent; |
||||
|
||||
/** |
||||
* 巡检路线 |
||||
*/ |
||||
private String pointRouteId; |
||||
|
||||
|
||||
/** |
||||
* 位置详情 |
||||
*/ |
||||
private String pointPos; |
||||
|
||||
/** |
||||
* 位置 |
||||
*/ |
||||
private String pointPosId; |
||||
|
||||
/** |
||||
* 位置经度 |
||||
*/ |
||||
private Double pointPosLongitude; |
||||
|
||||
/** |
||||
* 位置纬度 |
||||
*/ |
||||
private Double pointPosLatitude; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String pointNotes; |
||||
|
||||
/** |
||||
* 排序 |
||||
*/ |
||||
private Integer sort; |
||||
|
||||
/** |
||||
* 操作人 |
||||
*/ |
||||
private String operId; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String notes; |
||||
|
||||
/** |
||||
* 租户 |
||||
*/ |
||||
private String tenantId; |
||||
|
||||
@TableField(exist = false) |
||||
private String taskName; |
||||
|
||||
@TableField(exist = false) |
||||
private String taskCode; |
||||
|
||||
@TableField(exist = false) |
||||
@DateTimeFormat( |
||||
pattern = "yyyy-MM-dd hh:mm:ss" |
||||
) |
||||
@JsonFormat( |
||||
pattern = "yyyy-MM-dd hh:mm:ss" |
||||
) |
||||
private Date taskCreateTime; |
||||
|
||||
@TableField(exist = false) |
||||
private String hierarchyName; |
||||
|
||||
@TableField(exist = false) |
||||
private String routeName; |
||||
|
||||
} |
||||
@ -0,0 +1,62 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.lims.entry.CheckItem; |
||||
import org.springblade.lims.service.ICheckItemService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/checkItem") |
||||
@Api(value = "", tags = "") |
||||
public class CheckItemController extends BladeController { |
||||
|
||||
private final ICheckItemService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(CheckItem entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存巡检项 |
||||
*/ |
||||
@PostMapping("/saveItem") |
||||
@ApiOperation(value = "保存巡检项", notes = "保存巡检项") |
||||
public R saveItem(@RequestBody CheckItem entry) { |
||||
return R.data(service.saveItem(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@GetMapping("/deleteById") |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id") |
||||
public R deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
||||
return R.status(service.deleteLogic(Func.toLongList(id))); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,79 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.SneakyThrows; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.lims.entry.InspectionPlan; |
||||
import org.springblade.lims.service.IInspectionPlanService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionPlan") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionPlanController extends BladeController { |
||||
|
||||
private final IInspectionPlanService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(InspectionPlan entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存巡检计划 |
||||
*/ |
||||
@SneakyThrows |
||||
@PostMapping("/savePlan") |
||||
@ApiOperation(value = "保存巡检计划", notes = "保存巡检计划") |
||||
public R savePlan(@RequestBody InspectionPlan entry) { |
||||
return R.data(service.savePlan(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@SneakyThrows |
||||
@GetMapping("/deleteById") |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id") |
||||
public R deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
||||
return R.status(service.deleteById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 启动、停用 |
||||
*/ |
||||
@PostMapping("/update") |
||||
@ApiOperation(value = "更新", notes = "更新") |
||||
public R update(@RequestBody InspectionPlan entry) { |
||||
entry.setUpdateTime(new Date()); |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
return R.status(service.updateById(entry)); |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,82 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.SneakyThrows; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.lims.entry.InspectionPoint; |
||||
import org.springblade.lims.service.IInspectionPointService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionPoint") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionPointController extends BladeController { |
||||
|
||||
private final IInspectionPointService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(InspectionPoint entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存巡检点位 |
||||
*/ |
||||
@SneakyThrows |
||||
@PostMapping("/savePoint") |
||||
@ApiOperation(value = "保存巡检点位", notes = "保存巡检点位") |
||||
public R savePoint(@RequestBody InspectionPoint entry) { |
||||
return R.data(service.savePoint(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@SneakyThrows |
||||
@GetMapping("/deleteById") |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id") |
||||
public R deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
||||
return R.status(service.deleteById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 上传文件 |
||||
*/ |
||||
@PostMapping("/uploadFile") |
||||
public R<String> uploadFile(@RequestParam MultipartFile file) { |
||||
return R.data(service.uploadFile(file)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询检查项 |
||||
*/ |
||||
@GetMapping("/getItemById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getItemById(String id) { |
||||
return R.data(service.getItemById(id)); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,78 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.SneakyThrows; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.lims.entry.InspectionPointPos; |
||||
import org.springblade.lims.entry.InspectionPointPosVO; |
||||
import org.springblade.lims.service.IInspectionPointPosService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionPointPos") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionPointPosController extends BladeController { |
||||
|
||||
private final IInspectionPointPosService service; |
||||
|
||||
@GetMapping("/findList") |
||||
public R<Object> findList(InspectionPointPos entry, Query query) { |
||||
return R.data(service.findList(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存巡检位置 |
||||
*/ |
||||
@PostMapping("/savePos") |
||||
@ApiOperation(value = "保存巡检位置", notes = "保存巡检位置") |
||||
public R savePos(@RequestBody InspectionPointPos entry) { |
||||
return R.data(service.savePos(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@SneakyThrows |
||||
@GetMapping("/deleteById") |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id") |
||||
public R deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
||||
return R.status(service.deleteById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 获取资产树形结构 |
||||
*/ |
||||
@GetMapping("/tree") |
||||
@ApiOperationSupport(order = 9) |
||||
@ApiOperation(value = "树形结构(物品类型下拉接口)", notes = "树形结构") |
||||
public R<List<InspectionPointPosVO>> tree() { |
||||
List<InspectionPointPosVO> tree = service.tree(); |
||||
return R.data(tree); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.lims.entry.InspectionRecord; |
||||
import org.springblade.lims.service.IInspectionRecordService; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionRecord") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionRecordController extends BladeController { |
||||
|
||||
private final IInspectionRecordService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(InspectionRecord entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,62 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.lims.entry.InspectionRoute; |
||||
import org.springblade.lims.service.IInspectionRouteService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionRoute") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionRouteController extends BladeController { |
||||
|
||||
private final IInspectionRouteService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(InspectionRoute entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存巡检路径 |
||||
*/ |
||||
@PostMapping("/saveRoute") |
||||
@ApiOperation(value = "保存巡检路径", notes = "保存巡检路径") |
||||
public R saveRoute(@RequestBody InspectionRoute entry) { |
||||
return R.data(service.saveRoute(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@GetMapping("/deleteById") |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id") |
||||
public R deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
||||
return R.status(service.deleteLogic(Func.toLongList(id))); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,63 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.lims.entry.InspectionTaskAbnormal; |
||||
import org.springblade.lims.service.IInspectionTaskAbnormalService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionTaskAbnormal") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionTaskAbnormalController extends BladeController { |
||||
|
||||
private final IInspectionTaskAbnormalService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(InspectionTaskAbnormal entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存巡检异常任务单 |
||||
*/ |
||||
@PostMapping("/saveAbnormal") |
||||
@ApiOperation(value = "保存巡检异常任务单", notes = "保存巡检异常任务单") |
||||
public R saveAbnormal(@RequestBody InspectionTaskAbnormal entry) { |
||||
return R.data(service.saveAbnormal(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@GetMapping("/deleteById") |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id") |
||||
public R deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
||||
return R.status(service.deleteLogic(Func.toLongList(id))); |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,93 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.lims.entry.InspectionTask; |
||||
import org.springblade.lims.service.IInspectionTaskService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionTask") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionTaskController extends BladeController { |
||||
|
||||
private final IInspectionTaskService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(InspectionTask entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存申请单 |
||||
*/ |
||||
@PostMapping("/saveTask") |
||||
@ApiOperation(value = "保存申请单", notes = "保存申请单") |
||||
public R saveTask(@RequestBody InspectionTask entry) { |
||||
return R.data(service.saveTask(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@GetMapping("/deleteById") |
||||
@ApiOperation(value = "逻辑删除", notes = "传入id") |
||||
public R deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
||||
return R.status(service.deleteById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 完成巡检任务 |
||||
*/ |
||||
@GetMapping("/finish") |
||||
@ApiOperation(value = "完成保养任务", notes = "完成保养任务") |
||||
public R finish(String id) { |
||||
return service.finish(id); |
||||
} |
||||
|
||||
/** |
||||
* 取消保养任务 |
||||
*/ |
||||
@GetMapping("/cancel") |
||||
@ApiOperation(value = "取消保养任务", notes = "取消保养任务 ") |
||||
public R cancel(String id) { |
||||
InspectionTask task = service.getById(id); |
||||
task.setTaskStatus("3"); |
||||
return R.data(service.updateById(task)); |
||||
} |
||||
|
||||
/** |
||||
* 巡检日历 |
||||
*/ |
||||
@GetMapping("/queryDataByCal") |
||||
@ApiOperation(value = "巡检日历", notes = "巡检日历 ") |
||||
public R queryDataByCal(String startDate,String endDate) { |
||||
return R.data(service.queryDataByCal(startDate,endDate)); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,59 @@ |
||||
|
||||
package org.springblade.lims.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.lims.entry.InspectionTaskPoint; |
||||
import org.springblade.lims.service.IInspectionTaskPointService; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspectionTaskPoint") |
||||
@Api(value = "", tags = "") |
||||
public class InspectionTaskPointController extends BladeController { |
||||
|
||||
private final IInspectionTaskPointService service; |
||||
|
||||
@GetMapping("/page") |
||||
public R<Object> page(InspectionTaskPoint entry, Query query) { |
||||
return R.data(service.findPage(entry, query)); |
||||
} |
||||
|
||||
/** |
||||
* 保存巡检任务巡检点 |
||||
*/ |
||||
@PostMapping("/saveTaskPoint") |
||||
@ApiOperation(value = "保存巡检任务巡检点", notes = "保存巡检任务巡检点") |
||||
public R saveTask(@RequestBody InspectionTaskPoint entry) { |
||||
return R.data(service.saveTaskPoint(entry)); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询信息 |
||||
*/ |
||||
@GetMapping("/getById") |
||||
@ApiOperation(value = "根据id查询信息", notes = "根据id查询信息") |
||||
public R getById(String id) { |
||||
return R.data(service.findById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 上传文件 |
||||
*/ |
||||
@PostMapping("/uploadFile") |
||||
public R<String> uploadFile(@RequestParam MultipartFile file) { |
||||
return R.data(service.uploadFile(file)); |
||||
} |
||||
|
||||
} |
||||
@ -1,18 +1,20 @@ |
||||
package org.springblade.lims.job; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.lims.service.IInspectionPlanService; |
||||
import org.springblade.lims.service.IMaintainPlanService; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
@AllArgsConstructor |
||||
public class CreateMaintainTaskJob { |
||||
private final IMaintainPlanService maintainPlanService; |
||||
private final IInspectionPlanService inspectionPlanService; |
||||
|
||||
//@Scheduled(cron ="0 0 0 1/1 * ? ")
|
||||
//@Scheduled(cron ="0 0/2 * * * ? ")
|
||||
@Scheduled(cron ="0 0 0 1/1 * ? ") |
||||
public void createTask(){ |
||||
maintainPlanService.checkAndCreateTask(); |
||||
inspectionPlanService.checkAndCreateTask(); |
||||
//maintainPlanService.checkAndCreateTask();
|
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.CheckItem; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface CheckItemMapper extends BaseMapper<CheckItem> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionPlan; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionPlanMapper extends BaseMapper<InspectionPlan> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionPlanPoint; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionPlanPointMapper extends BaseMapper<InspectionPlanPoint> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionPointItem; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionPointItemMapper extends BaseMapper<InspectionPointItem> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionPoint; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionPointMapper extends BaseMapper<InspectionPoint> { |
||||
|
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionPointPos; |
||||
import org.springblade.lims.entry.InspectionPointPosVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionPointPosMapper extends BaseMapper<InspectionPointPos> { |
||||
|
||||
/** |
||||
* 获取产品类型树 |
||||
* @return |
||||
*/ |
||||
List<InspectionPointPosVO> tree(); |
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.springblade.lims.mapper.InspectionPointPosMapper"> |
||||
|
||||
|
||||
<resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode"> |
||||
<id column="id" property="id"/> |
||||
<result column="parent_id" property="parentId"/> |
||||
<result column="title" property="title"/> |
||||
<result column="value" property="value"/> |
||||
<result column="key" property="key"/> |
||||
<result column="has_children" property="hasChildren"/> |
||||
</resultMap> |
||||
|
||||
<select id="tree" resultMap="treeNodeResultMap"> |
||||
select id, parent_id, name as title, id as "value", id as "key" from t_inspection_point_pos where is_deleted = 0 |
||||
ORDER BY sort |
||||
</select> |
||||
|
||||
</mapper> |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionRecord; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionRecordMapper extends BaseMapper<InspectionRecord> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionRoute; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionRouteMapper extends BaseMapper<InspectionRoute> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionTaskAbnormal; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionTaskAbnormalMapper extends BaseMapper<InspectionTaskAbnormal> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionTask; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionTaskMapper extends BaseMapper<InspectionTask> { |
||||
|
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
|
||||
package org.springblade.lims.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.lims.entry.InspectionTaskPoint; |
||||
|
||||
/** |
||||
* |
||||
* |
||||
* @author sjx |
||||
* @since 2023年11月27日15:47:39 |
||||
*/ |
||||
public interface InspectionTaskPointMapper extends BaseMapper<InspectionTaskPoint> { |
||||
|
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.CheckItem; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface ICheckItemService extends BaseService<CheckItem> { |
||||
IPage<CheckItem> findPage(CheckItem entry, Query query); |
||||
|
||||
boolean saveItem(CheckItem entry); |
||||
|
||||
CheckItem findById(String id); |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionPlanPoint; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionPlanPointService extends BaseService<InspectionPlanPoint> { |
||||
|
||||
IPage<InspectionPlanPoint> findPage(InspectionPlanPoint entry, Query query); |
||||
|
||||
boolean savePlanPoint(InspectionPlanPoint entry); |
||||
|
||||
InspectionPlanPoint findById(String id); |
||||
} |
||||
@ -0,0 +1,25 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionPlan; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionPlanService extends BaseService<InspectionPlan> { |
||||
|
||||
IPage<InspectionPlan> findPage(InspectionPlan entry, Query query); |
||||
|
||||
boolean savePlan(InspectionPlan entry); |
||||
|
||||
InspectionPlan findById(String id); |
||||
|
||||
boolean deleteById(String id); |
||||
|
||||
void checkAndCreateTask(); |
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.lims.entry.InspectionPointItem; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionPointItemService extends BaseService<InspectionPointItem> { |
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionPointPos; |
||||
import org.springblade.lims.entry.InspectionPointPosVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionPointPosService extends BaseService<InspectionPointPos> { |
||||
List<InspectionPointPosVO> findList(InspectionPointPos entry, Query query); |
||||
|
||||
boolean savePos(InspectionPointPos entry); |
||||
|
||||
InspectionPointPos findById(String id); |
||||
|
||||
boolean deleteById(String id); |
||||
|
||||
/** |
||||
* 树形结构 |
||||
* @return |
||||
*/ |
||||
List<InspectionPointPosVO> tree(); |
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.CheckItem; |
||||
import org.springblade.lims.entry.InspectionPoint; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionPointService extends BaseService<InspectionPoint> { |
||||
IPage<InspectionPoint> findPage(InspectionPoint entry, Query query); |
||||
|
||||
boolean savePoint(InspectionPoint entry); |
||||
|
||||
InspectionPoint findById(String id); |
||||
|
||||
String uploadFile(MultipartFile file); |
||||
|
||||
boolean deleteById(String id); |
||||
|
||||
List<CheckItem> getItemById(String id); |
||||
} |
||||
@ -0,0 +1,17 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionRecord; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionRecordService extends BaseService<InspectionRecord> { |
||||
IPage<InspectionRecord> findPage(InspectionRecord entry, Query query); |
||||
|
||||
} |
||||
@ -0,0 +1,20 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionRoute; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionRouteService extends BaseService<InspectionRoute> { |
||||
IPage<InspectionRoute> findPage(InspectionRoute entry, Query query); |
||||
|
||||
boolean saveRoute(InspectionRoute entry); |
||||
|
||||
InspectionRoute findById(String id); |
||||
} |
||||
@ -0,0 +1,22 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionTaskAbnormal; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionTaskAbnormalService extends BaseService<InspectionTaskAbnormal> { |
||||
|
||||
IPage<InspectionTaskAbnormal> findPage(InspectionTaskAbnormal entry, Query query); |
||||
|
||||
boolean saveAbnormal(InspectionTaskAbnormal entry); |
||||
|
||||
InspectionTaskAbnormal findById(String id); |
||||
|
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionTaskPoint; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionTaskPointService extends BaseService<InspectionTaskPoint> { |
||||
IPage<InspectionTaskPoint> findPage(InspectionTaskPoint entry, Query query); |
||||
|
||||
boolean saveTaskPoint(InspectionTaskPoint entry); |
||||
|
||||
InspectionTaskPoint findById(String id); |
||||
|
||||
String uploadFile(MultipartFile file); |
||||
|
||||
} |
||||
@ -0,0 +1,28 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.lims.entry.InspectionTask; |
||||
|
||||
/** |
||||
* @author sjx |
||||
* @date 2023年11月27日15:34:17 |
||||
*/ |
||||
public interface IInspectionTaskService extends BaseService<InspectionTask> { |
||||
IPage<InspectionTask> findPage(InspectionTask entry, Query query); |
||||
|
||||
boolean saveTask(InspectionTask entry); |
||||
|
||||
InspectionTask findById(String id); |
||||
|
||||
boolean deleteById(String id); |
||||
|
||||
R finish(String id); |
||||
|
||||
JSONArray queryDataByCal(String startDate,String endDate); |
||||
} |
||||
@ -0,0 +1,65 @@ |
||||
|
||||
package org.springblade.lims.service; |
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.lims.entry.InspectionRoute; |
||||
import org.springblade.lims.mapper.InspectionRouteMapper; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionRouteServiceImpl extends BaseServiceImpl<InspectionRouteMapper, InspectionRoute> implements IInspectionRouteService { |
||||
|
||||
@Override |
||||
public IPage<InspectionRoute> findPage(InspectionRoute entry, Query query) { |
||||
LambdaQueryWrapper<InspectionRoute> wrapper = new LambdaQueryWrapper<>(); |
||||
if (StringUtils.isNotBlank(entry.getName())) { |
||||
wrapper.like(InspectionRoute::getName, entry.getName()); |
||||
} |
||||
wrapper.eq(BaseEntity::getIsDeleted, 0); |
||||
wrapper.orderByDesc(InspectionRoute::getCreateTime); |
||||
IPage<InspectionRoute> page = this.page(Condition.getPage(query), wrapper); |
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean saveRoute(InspectionRoute entry) { |
||||
Date date = new Date(); |
||||
if (entry.getId() == null) { |
||||
entry.setCreateUser(AuthUtil.getUserId()); |
||||
entry.setCreateTime(date); |
||||
baseMapper.insert(entry); |
||||
} else { |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
entry.setUpdateTime(date); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionRoute findById(String id) { |
||||
InspectionRoute entry = this.getById(id); |
||||
return entry; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,79 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.apache.commons.lang3.time.DateFormatUtils; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springblade.lims.entry.CheckItem; |
||||
import org.springblade.lims.mapper.CheckItemMapper; |
||||
import org.springblade.lims.service.ICheckItemService; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* @author sjx |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class CheckItemServiceImpl extends BaseServiceImpl<CheckItemMapper, CheckItem> implements ICheckItemService { |
||||
|
||||
@Override |
||||
public IPage<CheckItem> findPage(CheckItem entry, Query query) { |
||||
LambdaQueryWrapper<CheckItem> wrapper = new LambdaQueryWrapper<>(); |
||||
if (entry.getStatus() != null) { |
||||
wrapper.eq(CheckItem::getStatus, entry.getStatus()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getOwner())) { |
||||
wrapper.eq(CheckItem::getOwner, entry.getOwner()); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(entry.getCode())) { |
||||
wrapper.eq(CheckItem::getCode, entry.getCode()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getName())) { |
||||
wrapper.eq(CheckItem::getName, entry.getName()); |
||||
} |
||||
wrapper.eq(BaseEntity::getIsDeleted, 0); |
||||
wrapper.orderByDesc(CheckItem::getCreateTime); |
||||
IPage<CheckItem> page = this.page(Condition.getPage(query), wrapper); |
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean saveItem(CheckItem entry) { |
||||
Date date = new Date(); |
||||
if (entry.getId() == null) { |
||||
entry.setCreateUser(AuthUtil.getUserId()); |
||||
entry.setCreateTime(date); |
||||
entry.setCode("XJX" + DateFormatUtils.format(date, "yyyyMMddhhmmss") + StringUtil.randomUUID().substring(0, 5)); |
||||
baseMapper.insert(entry); |
||||
} else { |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
entry.setUpdateTime(date); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public CheckItem findById(String id) { |
||||
CheckItem entry = this.getById(id); |
||||
return entry; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,49 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionPlanPoint; |
||||
import org.springblade.lims.mapper.InspectionPlanPointMapper; |
||||
import org.springblade.lims.service.IInspectionPlanPointService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
/** |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionPlanPointServiceImpl extends BaseServiceImpl<InspectionPlanPointMapper, InspectionPlanPoint> implements IInspectionPlanPointService { |
||||
|
||||
|
||||
@Override |
||||
public IPage<InspectionPlanPoint> findPage(InspectionPlanPoint entry, Query query) { |
||||
LambdaQueryWrapper<InspectionPlanPoint> wrapper = new LambdaQueryWrapper<>(); |
||||
if (entry.getStatus() != null) { |
||||
wrapper.eq(InspectionPlanPoint::getStatus, entry.getStatus()); |
||||
} |
||||
|
||||
wrapper.eq(BaseEntity::getIsDeleted, 0); |
||||
wrapper.orderByDesc(InspectionPlanPoint::getCreateTime); |
||||
IPage<InspectionPlanPoint> page = this.page(Condition.getPage(query), wrapper); |
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
public boolean savePlanPoint(InspectionPlanPoint entry) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionPlanPoint findById(String id) { |
||||
return null; |
||||
} |
||||
} |
||||
@ -0,0 +1,292 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils; |
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.apache.commons.lang3.time.DateFormatUtils; |
||||
import org.apache.commons.lang3.time.DateUtils; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springblade.lims.entry.*; |
||||
import org.springblade.lims.mapper.InspectionPlanMapper; |
||||
import org.springblade.lims.service.*; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.text.ParseException; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
/** |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionPlanServiceImpl extends BaseServiceImpl<InspectionPlanMapper, InspectionPlan> implements IInspectionPlanService { |
||||
|
||||
private final IInspectionPlanPointService inspectionPlanPointService; |
||||
private final IInspectionPointService inspectionPointService; |
||||
private final IInspectionTaskService inspectionTaskService; |
||||
private final IInspectionTaskPointService inspectionTaskPointService; |
||||
private final IInspectionPointItemService inspectionPointItemService; |
||||
private final IInstrumentService instrumentService; |
||||
private final IInspectionRouteService routeService; |
||||
private final IInspectionPointPosService pointPosService; |
||||
|
||||
@Override |
||||
public IPage<InspectionPlan> findPage(InspectionPlan entry, Query query) { |
||||
LambdaQueryWrapper<InspectionPlan> wrapper = new LambdaQueryWrapper<>(); |
||||
if (entry.getStatus() != null) { |
||||
wrapper.eq(InspectionPlan::getStatus, entry.getStatus()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getPlanStatus())) { |
||||
wrapper.eq(InspectionPlan::getPlanStatus, entry.getPlanStatus()); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(entry.getPlanCode())) { |
||||
wrapper.eq(InspectionPlan::getPlanCode, entry.getPlanCode()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getName())) { |
||||
wrapper.like(InspectionPlan::getName, entry.getName()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getGroupId())) { |
||||
wrapper.eq(InspectionPlan::getGroupId, entry.getGroupId()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getInspectionMethod())) { |
||||
wrapper.eq(InspectionPlan::getInspectionMethod, entry.getInspectionMethod()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getPlanType())) { |
||||
wrapper.eq(InspectionPlan::getPlanType, entry.getPlanType()); |
||||
} |
||||
wrapper.eq(BaseEntity::getIsDeleted, 0); |
||||
wrapper.orderByDesc(InspectionPlan::getCreateTime); |
||||
IPage<InspectionPlan> page = this.page(Condition.getPage(query), wrapper); |
||||
page.getRecords().forEach(plan ->{ |
||||
int pointCount = 0; |
||||
LambdaQueryWrapper<InspectionPlanPoint> wrapper1 = new LambdaQueryWrapper<>(); |
||||
wrapper1.eq(InspectionPlanPoint::getPlanId,plan.getId()); |
||||
List<InspectionPlanPoint> planPointList = inspectionPlanPointService.list(wrapper1); |
||||
if(CollectionUtils.isNotEmpty(planPointList)){ |
||||
pointCount = planPointList.size(); |
||||
} |
||||
plan.setPointCount(pointCount); |
||||
}); |
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
public boolean savePlan(InspectionPlan entry) { |
||||
Date date = new Date(); |
||||
//计算下次开始时间
|
||||
int startYear = Integer.parseInt(DateFormatUtils.format(new Date(), "yyyy-MM-dd").substring(0, 4)); |
||||
int startMonth = Integer.parseInt(DateFormatUtils.format(new Date(), "yyyy-MM-dd").substring(5, 7)); |
||||
int startDate = Integer.parseInt(DateFormatUtils.format(new Date(), "yyyy-MM-dd").substring(8)); |
||||
//1-年 2-月 3-间隔
|
||||
if (entry.getActionCycleType().equals("1")) { |
||||
try { |
||||
Date date1 = DateUtils.parseDate(startYear+"-"+entry.getActionCycleTime(),"yyyy-MM-dd"); |
||||
if(date1.compareTo(entry.getStartDate())<0){ |
||||
//如果是年,则为每年固定日期;
|
||||
entry.setNextTime((startYear+1)+"-"+entry.getActionCycleTime()); |
||||
}else{ |
||||
entry.setNextTime(startYear + "-" + entry.getActionCycleTime()); |
||||
} |
||||
} catch (ParseException e) { |
||||
throw new RuntimeException(e); |
||||
} |
||||
|
||||
|
||||
} else if (entry.getActionCycleType().equals("2")) { |
||||
//如果是月或间隔,则通过开始日期计算;
|
||||
|
||||
|
||||
//如果开始时间小于配置的间隔时间,那么下次执行时间是开始时间当月,否则为开始时间下月
|
||||
if (startDate < Integer.parseInt(entry.getActionCycleTime())) { |
||||
entry.setNextTime(startYear + "-" + startMonth + "-" + entry.getActionCycleTime()); |
||||
} else { |
||||
if (startMonth < 9) { |
||||
entry.setNextTime(startYear + "-0" + (startMonth + 1) + (Integer.parseInt(entry.getActionCycleTime()) < 10 ? "0" +entry.getActionCycleTime() : entry.getActionCycleTime()) ); |
||||
} else if (startMonth >= 9 && startMonth <= 11) { |
||||
entry.setNextTime(startYear + "-" + (startMonth + 1) + (Integer.parseInt(entry.getActionCycleTime()) < 10 ? "0" +entry.getActionCycleTime() : entry.getActionCycleTime())); |
||||
} else { |
||||
entry.setNextTime((startYear + 1) + "-01-" + (Integer.parseInt(entry.getActionCycleTime()) < 10 ? "0" +entry.getActionCycleTime() : entry.getActionCycleTime())); |
||||
} |
||||
} |
||||
} else { |
||||
//如果是固定间隔,则第一次为开始日期
|
||||
entry.setNextTime(DateFormatUtils.format(entry.getStartDate(),"yyyy-MM-dd")); |
||||
} |
||||
if (entry.getId() == null) { |
||||
entry.setCreateUser(AuthUtil.getUserId()); |
||||
entry.setCreateTime(date); |
||||
entry.setPlanCode("XJJH" + DateFormatUtils.format(date, "yyyyMMddhhmmss") + StringUtil.randomUUID().substring(0, 5)); |
||||
baseMapper.insert(entry); |
||||
} else { |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
entry.setUpdateTime(date); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
//保存巡检点位
|
||||
if(CollectionUtils.isNotEmpty(entry.getPointList())){ |
||||
//巡检点位全删全增
|
||||
LambdaUpdateWrapper<InspectionPlanPoint> wrapper = new LambdaUpdateWrapper<>(); |
||||
wrapper.eq(InspectionPlanPoint::getPlanId, entry.getId()); |
||||
inspectionPlanPointService.remove(wrapper); |
||||
for(InspectionPoint point : entry.getPointList()){ |
||||
InspectionPlanPoint planPoint = new InspectionPlanPoint(); |
||||
planPoint.setPlanId(entry.getId().toString()); |
||||
planPoint.setPointId(point.getId().toString()); |
||||
planPoint.setCreateTime(date); |
||||
planPoint.setCreateUser(AuthUtil.getUserId()); |
||||
inspectionPlanPointService.save(planPoint); |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionPlan findById(String id) { |
||||
InspectionPlan plan = this.getById(id); |
||||
//查询巡检点
|
||||
LambdaQueryWrapper<InspectionPlanPoint> pointWrapper = new LambdaQueryWrapper<>(); |
||||
pointWrapper.eq(InspectionPlanPoint::getPlanId,id); |
||||
List<InspectionPlanPoint> planPointList = inspectionPlanPointService.list(pointWrapper); |
||||
if(CollectionUtils.isNotEmpty(planPointList)){ |
||||
List<String> ids = planPointList.stream().map(InspectionPlanPoint::getPointId).collect(Collectors.toList()); |
||||
List<InspectionPoint> pointList = inspectionPointService.listByIds(ids); |
||||
if(CollectionUtils.isNotEmpty(pointList)){ |
||||
pointList.forEach(point -> { |
||||
InspectionPointPos pointPos = pointPosService.getById(point.getPosId()); |
||||
InspectionRoute route = routeService.getById(point.getRouteId()); |
||||
Instrument instrument = instrumentService.getById(point.getAssetId()); |
||||
point.setPosHierarchy(pointPos.getHierarchyName()); |
||||
point.setRouteName(route.getName()); |
||||
point.setAssetName(instrument.getName()); |
||||
List<InspectionPointItem> itemList = inspectionPointItemService.list(new LambdaQueryWrapper<InspectionPointItem>().eq(InspectionPointItem::getPointId,point.getId())); |
||||
if(CollectionUtils.isNotEmpty(itemList)){ |
||||
point.setItemSize(itemList.size()); |
||||
} |
||||
}); |
||||
plan.setPointList(pointList); |
||||
} |
||||
|
||||
} |
||||
|
||||
return plan; |
||||
} |
||||
|
||||
@Override |
||||
public boolean deleteById(String id) { |
||||
//删除保养项目
|
||||
List<InspectionPlanPoint> planPointList = inspectionPlanPointService.list(new LambdaQueryWrapper<InspectionPlanPoint>().eq(InspectionPlanPoint::getPlanId,id)); |
||||
if(CollectionUtils.isNotEmpty(planPointList)){ |
||||
List<Long> ids = planPointList.stream().map(InspectionPlanPoint::getId).collect(Collectors.toList()); |
||||
inspectionPlanPointService.deleteLogic(ids); |
||||
} |
||||
return this.deleteLogic(Func.toLongList(id)); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public void checkAndCreateTask() { |
||||
String date = DateFormatUtils.format(new Date(),"yyyy-MM-dd"); |
||||
String enddate = DateFormatUtils.format(DateUtils.addDays(new Date(),-1),"yyyy-MM-dd"); |
||||
//已结束的计划更新状态
|
||||
LambdaQueryWrapper<InspectionPlan> wrapper1 = new LambdaQueryWrapper<>(); |
||||
wrapper1.like(InspectionPlan::getEndDate,enddate); |
||||
List<InspectionPlan> planList1 = this.list(wrapper1); |
||||
if(CollectionUtils.isNotEmpty(planList1)){ |
||||
for(InspectionPlan plan : planList1){ |
||||
plan.setStatus(2); |
||||
this.updateById(plan); |
||||
} |
||||
} |
||||
//查询需要创建任务的计划
|
||||
LambdaQueryWrapper<InspectionPlan> wrapper = new LambdaQueryWrapper<>(); |
||||
wrapper.eq(InspectionPlan::getNextTime,date); |
||||
wrapper.eq(BaseEntity::getStatus,"1"); |
||||
List<InspectionPlan> planList = this.list(wrapper); |
||||
if(CollectionUtils.isNotEmpty(planList)){ |
||||
for(InspectionPlan inspectionPlan : planList){ |
||||
//创建任务
|
||||
createTask(inspectionPlan.getId().toString()); |
||||
//计算下次执行时间
|
||||
if (inspectionPlan.getActionCycleType().equals("1")) { |
||||
//年:当前日期再加一年
|
||||
inspectionPlan.setNextTime(DateFormatUtils.format(DateUtils.addYears(new Date(),1),"yyyy-MM-dd")); |
||||
}else if (inspectionPlan.getActionCycleType().equals("2")){ |
||||
//月:当前月再加一月
|
||||
inspectionPlan.setNextTime(DateFormatUtils.format(DateUtils.addMonths(new Date(),1),"yyyy-MM-dd")); |
||||
}else { |
||||
//间隔:当前日期再加间隔天数
|
||||
inspectionPlan.setNextTime(DateFormatUtils.format(DateUtils.addDays(new Date(),Integer.parseInt(inspectionPlan.getActionCycleTime())),"yyyy-MM-dd")); |
||||
} |
||||
this.updateById(inspectionPlan); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Transactional(rollbackFor = Exception.class) |
||||
public R createTask(String id) { |
||||
Date date = new Date(); |
||||
InspectionPlan plan = this.getById(id); |
||||
//查询巡检点
|
||||
List<InspectionPlanPoint> planPointList = inspectionPlanPointService.list(new LambdaQueryWrapper<InspectionPlanPoint>().eq(InspectionPlanPoint::getPlanId,id)); |
||||
if(CollectionUtils.isEmpty(planPointList)){ |
||||
return R.fail("未查询到保养项目!"); |
||||
} |
||||
List<String> pointIds = planPointList.stream().map(InspectionPlanPoint::getPointId).collect(Collectors.toList()); |
||||
List<InspectionPoint> pointList = inspectionPointService.listByIds(pointIds); |
||||
//生成任务
|
||||
InspectionTask task = new InspectionTask(); |
||||
task.setPlanId(id); |
||||
task.setTaskStatus("0"); |
||||
task.setPlanName(plan.getName().concat("-").concat(DateFormatUtils.format(date,"yyyy-MM-dd"))); |
||||
task.setPlanCode(plan.getPlanCode()); |
||||
task.setPlanInspectionMethod(plan.getInspectionMethod()); |
||||
task.setPlanCompletionTime(plan.getCompletionTime()); |
||||
task.setPlanNotes(plan.getNotes()); |
||||
task.setGroupId(plan.getGroupId()); |
||||
task.setPlanStartTime(plan.getStartDate()); |
||||
task.setActStartTime(date); |
||||
task.setTenantId(plan.getTenantId()); |
||||
inspectionTaskService.saveTask(task); |
||||
//巡检点
|
||||
for(int j=0;j<pointList.size();j++){ |
||||
InspectionPoint point = pointList.get(j); |
||||
InspectionTaskPoint taskPoint = new InspectionTaskPoint(); |
||||
taskPoint.setTaskId(task.getId().toString()); |
||||
taskPoint.setPointId(point.getId().toString()); |
||||
taskPoint.setPointCode(point.getCode()); |
||||
taskPoint.setPointName(point.getName()); |
||||
taskPoint.setPointContent(point.getContent()); |
||||
taskPoint.setPointRouteId(point.getRouteId()); |
||||
taskPoint.setPointPos(point.getPos()); |
||||
taskPoint.setPointPosId(point.getPosId()); |
||||
taskPoint.setPointPosLongitude(point.getPosLongitude()); |
||||
taskPoint.setPointPosLatitude(point.getPosLatitude()); |
||||
taskPoint.setPointNotes(point.getNotes()); |
||||
taskPoint.setCreateTime(date); |
||||
taskPoint.setCreateUser(AuthUtil.getUserId()); |
||||
taskPoint.setStatus(0); |
||||
taskPoint.setTenantId(plan.getTenantId()); |
||||
taskPoint.setPointStatus("0"); |
||||
inspectionTaskPointService.save(taskPoint); |
||||
} |
||||
return R.success("创建任务成功!"); |
||||
} |
||||
} |
||||
@ -0,0 +1,22 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.lims.entry.InspectionPointItem; |
||||
import org.springblade.lims.mapper.InspectionPointItemMapper; |
||||
import org.springblade.lims.service.IInspectionPointItemService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
/** |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionPointItemServiceImpl extends BaseServiceImpl<InspectionPointItemMapper, InspectionPointItem> implements IInspectionPointItemService { |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,124 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils; |
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.node.ForestNodeMerger; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
||||
import org.springblade.lims.entry.InspectionPointPos; |
||||
import org.springblade.lims.entry.InspectionPointPosVO; |
||||
import org.springblade.lims.mapper.InspectionPointPosMapper; |
||||
import org.springblade.lims.service.IInspectionPointPosService; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
/** |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionPointPosServiceImpl extends BaseServiceImpl<InspectionPointPosMapper, InspectionPointPos> implements IInspectionPointPosService { |
||||
|
||||
@Override |
||||
public List<InspectionPointPosVO> findList(InspectionPointPos entry, Query query) { |
||||
LambdaQueryWrapper<InspectionPointPos> wrapper = new LambdaQueryWrapper<>(); |
||||
if (StringUtils.isNotBlank(entry.getName())) { |
||||
wrapper.like(InspectionPointPos::getName, entry.getName()); |
||||
} |
||||
wrapper.eq(BaseEntity::getIsDeleted, 0); |
||||
wrapper.orderByDesc(InspectionPointPos::getCreateTime); |
||||
List<InspectionPointPos> list = this.list(wrapper); |
||||
List<InspectionPointPosVO> collect = list.stream().map(InspectionPointPos -> { |
||||
InspectionPointPosVO InspectionPointPosVO = BeanUtil.copy(InspectionPointPos, InspectionPointPosVO.class); |
||||
return InspectionPointPosVO; |
||||
}).collect(Collectors.toList()); |
||||
return ForestNodeMerger.merge(collect); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean savePos(InspectionPointPos entry) { |
||||
// 判断是否子项
|
||||
if (entry.getParentId() == null) { |
||||
entry.setParentId(0L); |
||||
entry.setAncestors("0"); |
||||
entry.setIsDeleted(0); |
||||
entry.setAncestors("0"); |
||||
entry.setHierarchyName(entry.getName()); |
||||
entry.setHierarchy("0"); |
||||
} else { |
||||
LambdaQueryWrapper<InspectionPointPos> wrapper = new LambdaQueryWrapper<>(); |
||||
wrapper.eq(InspectionPointPos::getId,entry.getParentId()); |
||||
InspectionPointPos one = this.getOne(wrapper); |
||||
entry.setAncestors(one.getAncestors() + "," + one.getId().toString()); |
||||
entry.setHierarchy(one.getHierarchy()+"/"); |
||||
entry.setHierarchyName(one.getHierarchyName()+"/"+entry.getName()); |
||||
// 排序:用已有的最的 +1
|
||||
if (entry.getSort() == null) { |
||||
LambdaQueryWrapper<InspectionPointPos> wrapper1 = new LambdaQueryWrapper<>(); |
||||
wrapper1.eq(InspectionPointPos::getParentId, entry.getParentId()); |
||||
List<InspectionPointPos> list = this.list(wrapper1); |
||||
// 可以用流换一下
|
||||
Integer max = 0; |
||||
for (InspectionPointPos pos : list) { |
||||
Integer sort = pos.getSort(); |
||||
if (sort == null) { continue; } |
||||
if (sort > max) { |
||||
max = sort; |
||||
} |
||||
} |
||||
entry.setSort(max + 1); |
||||
} |
||||
} |
||||
if(entry.getId() == null){ |
||||
baseMapper.insert(entry); |
||||
}else{ |
||||
baseMapper.updateById(entry); |
||||
} |
||||
|
||||
//更新节点路径
|
||||
if(entry.getParentId() != 0){ |
||||
entry.setHierarchy(entry.getHierarchy()+entry.getId()); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionPointPos findById(String id) { |
||||
InspectionPointPos entry = this.getById(id); |
||||
return entry; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean deleteById(String id) { |
||||
//删除子级
|
||||
LambdaQueryWrapper<InspectionPointPos> childrenWrapper = new LambdaQueryWrapper<>(); |
||||
childrenWrapper.eq(InspectionPointPos::getParentId,id); |
||||
List<InspectionPointPos> childrenList = this.list(childrenWrapper); |
||||
if(CollectionUtils.isNotEmpty(childrenList)){ |
||||
List<Long> ids = childrenList.stream().map(InspectionPointPos::getId).collect(Collectors.toList()); |
||||
this.removeByIds(ids); |
||||
} |
||||
this.removeById(id); |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public List<InspectionPointPosVO> tree() { |
||||
return ForestNodeMerger.merge(baseMapper.tree()); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,192 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils; |
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.apache.commons.lang3.time.DateFormatUtils; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springblade.lims.entry.*; |
||||
import org.springblade.lims.mapper.InspectionPointMapper; |
||||
import org.springblade.lims.service.*; |
||||
import org.springblade.system.feign.ISysClient; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.FileOutputStream; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.UUID; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
/** |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionPointServiceImpl extends BaseServiceImpl<InspectionPointMapper, InspectionPoint> implements IInspectionPointService { |
||||
|
||||
private final ISysClient sysClient; |
||||
private final IInspectionPointItemService inspectionPointItemService; |
||||
private final ICheckItemService checkItemService; |
||||
private final IInstrumentService instrumentService; |
||||
private final IInspectionRouteService routeService; |
||||
private final IInspectionPointPosService pointPosService; |
||||
|
||||
@Override |
||||
public IPage<InspectionPoint> findPage(InspectionPoint entry, Query query) { |
||||
LambdaQueryWrapper<InspectionPoint> wrapper = new LambdaQueryWrapper<>(); |
||||
if (entry.getStatus() != null) { |
||||
wrapper.eq(InspectionPoint::getStatus, entry.getStatus()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getPosId())) { |
||||
wrapper.eq(InspectionPoint::getPosId, entry.getPosId()); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(entry.getCode())) { |
||||
wrapper.eq(InspectionPoint::getCode, entry.getCode()); |
||||
} |
||||
if (StringUtils.isNotBlank(entry.getName())) { |
||||
wrapper.like(InspectionPoint::getName, entry.getName()); |
||||
} |
||||
wrapper.eq(BaseEntity::getIsDeleted, 0); |
||||
wrapper.orderByDesc(InspectionPoint::getCreateTime); |
||||
IPage<InspectionPoint> page = this.page(Condition.getPage(query), wrapper); |
||||
page.getRecords().forEach(point -> { |
||||
InspectionPointPos pointPos = pointPosService.getById(point.getPosId()); |
||||
InspectionRoute route = routeService.getById(point.getRouteId()); |
||||
Instrument instrument = instrumentService.getById(point.getAssetId()); |
||||
point.setPosHierarchy(pointPos.getHierarchyName()); |
||||
point.setRouteName(route.getName()); |
||||
point.setAssetName(instrument.getName()); |
||||
List<InspectionPointItem> itemList = inspectionPointItemService.list(new LambdaQueryWrapper<InspectionPointItem>().eq(InspectionPointItem::getPointId,point.getId())); |
||||
if(CollectionUtils.isNotEmpty(itemList)){ |
||||
point.setItemSize(itemList.size()); |
||||
} |
||||
}); |
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean savePoint(InspectionPoint entry) { |
||||
Date date = new Date(); |
||||
if (entry.getId() == null) { |
||||
entry.setCreateUser(AuthUtil.getUserId()); |
||||
entry.setCreateTime(date); |
||||
entry.setCode("XJDW" + DateFormatUtils.format(date, "yyyyMMddhhmmss") + StringUtil.randomUUID().substring(0, 5)); |
||||
baseMapper.insert(entry); |
||||
} else { |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
entry.setUpdateTime(date); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
//巡检项全删全增
|
||||
if(CollectionUtils.isNotEmpty(entry.getCheckItemList())){ |
||||
LambdaUpdateWrapper<InspectionPointItem> itemWrapper = new LambdaUpdateWrapper<>(); |
||||
itemWrapper.eq(InspectionPointItem::getPointId,entry.getId()); |
||||
inspectionPointItemService.remove(itemWrapper); |
||||
for(CheckItem item : entry.getCheckItemList()){ |
||||
InspectionPointItem pointItem = new InspectionPointItem(); |
||||
pointItem.setPointId(entry.getId().toString()); |
||||
pointItem.setItemId(item.getId().toString()); |
||||
pointItem.setCreateTime(new Date()); |
||||
pointItem.setCreateUser(AuthUtil.getUserId()); |
||||
inspectionPointItemService.save(pointItem); |
||||
} |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionPoint findById(String id) { |
||||
InspectionPoint entry = this.getById(id); |
||||
//查询点位位置
|
||||
if(StringUtils.isNotEmpty(entry.getPosId())){ |
||||
InspectionPointPos pointPos = pointPosService.getById(entry.getPosId()); |
||||
entry.setPosHierarchy(pointPos.getName()); |
||||
} |
||||
//查询路径
|
||||
if(StringUtils.isNotEmpty(entry.getRouteId())){ |
||||
InspectionRoute route = routeService.getById(entry.getRouteId()); |
||||
entry.setRouteName(route.getName()); |
||||
} |
||||
|
||||
//查询关联设备
|
||||
if(StringUtils.isNotEmpty(entry.getAssetId())){ |
||||
Instrument instrument = instrumentService.getById(entry.getAssetId()); |
||||
entry.setAssetName(instrument.getName()); |
||||
} |
||||
|
||||
//查询巡检项
|
||||
LambdaQueryWrapper<InspectionPointItem> itemWrapper = new LambdaQueryWrapper<>(); |
||||
itemWrapper.eq(InspectionPointItem::getPointId,id); |
||||
List<InspectionPointItem> pointItemList = inspectionPointItemService.list(itemWrapper); |
||||
if(CollectionUtils.isNotEmpty(pointItemList)){ |
||||
List<String> itemIds = pointItemList.stream().map(InspectionPointItem::getItemId).collect(Collectors.toList()); |
||||
List<CheckItem> itemList = checkItemService.listByIds(itemIds); |
||||
entry.setCheckItemList(itemList); |
||||
} |
||||
return entry; |
||||
} |
||||
|
||||
@Override |
||||
public String uploadFile(MultipartFile file) { |
||||
String fileName = ""; |
||||
String path = ""; |
||||
if (file != null) { |
||||
String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); |
||||
fileName = UUID.randomUUID().toString() + fileSuffix; |
||||
path = sysClient.getParamValue("jiahe").getData() + fileName; |
||||
|
||||
FileOutputStream fout; |
||||
try { |
||||
fout = new FileOutputStream(path); |
||||
fout.write(file.getBytes()); |
||||
fout.close(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
return path; |
||||
} |
||||
|
||||
@Override |
||||
public boolean deleteById(String id) { |
||||
//删除巡检项
|
||||
LambdaUpdateWrapper<InspectionPointItem> pointItemWrapper = new LambdaUpdateWrapper<>(); |
||||
pointItemWrapper.eq(InspectionPointItem::getPointId,id); |
||||
List<InspectionPointItem> pointItemList = inspectionPointItemService.list(pointItemWrapper); |
||||
if(CollectionUtils.isNotEmpty(pointItemList)){ |
||||
List<Long> ids = pointItemList.stream().map(InspectionPointItem::getId).collect(Collectors.toList()); |
||||
inspectionPointItemService.deleteLogic(ids); |
||||
} |
||||
return this.deleteLogic(Func.toLongList(id)); |
||||
} |
||||
|
||||
@Override |
||||
public List<CheckItem> getItemById(String id) { |
||||
//查询巡检项
|
||||
LambdaQueryWrapper<InspectionPointItem> itemWrapper = new LambdaQueryWrapper<>(); |
||||
itemWrapper.eq(InspectionPointItem::getPointId,id); |
||||
List<InspectionPointItem> pointItemList = inspectionPointItemService.list(itemWrapper); |
||||
List<String> itemIds = pointItemList.stream().map(InspectionPointItem::getItemId).collect(Collectors.toList()); |
||||
List<CheckItem> itemList = checkItemService.listByIds(itemIds); |
||||
return itemList; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,36 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.lims.entry.InspectionRecord; |
||||
import org.springblade.lims.mapper.InspectionRecordMapper; |
||||
import org.springblade.lims.service.IInspectionRecordService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
|
||||
/** |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionRecordServiceImpl extends BaseServiceImpl<InspectionRecordMapper, InspectionRecord> implements IInspectionRecordService { |
||||
|
||||
@Override |
||||
public IPage<InspectionRecord> findPage(InspectionRecord entry, Query query) { |
||||
LambdaQueryWrapper<InspectionRecord> wrapper = new LambdaQueryWrapper<>(); |
||||
|
||||
wrapper.eq(BaseEntity::getIsDeleted, 0); |
||||
wrapper.orderByDesc(InspectionRecord::getCreateTime); |
||||
IPage<InspectionRecord> page = this.page(Condition.getPage(query), wrapper); |
||||
return page; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,90 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.lims.entry.InspectionTask; |
||||
import org.springblade.lims.entry.InspectionTaskAbnormal; |
||||
import org.springblade.lims.mapper.InspectionTaskAbnormalMapper; |
||||
import org.springblade.lims.mapper.InspectionTaskMapper; |
||||
import org.springblade.lims.service.IInspectionTaskAbnormalService; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionTaskAbnormalServiceImpl extends BaseServiceImpl<InspectionTaskAbnormalMapper, InspectionTaskAbnormal> implements IInspectionTaskAbnormalService { |
||||
|
||||
private final InspectionTaskMapper inspectionTaskMapper; |
||||
|
||||
@Override |
||||
public IPage<InspectionTaskAbnormal> findPage(InspectionTaskAbnormal entry, Query query) { |
||||
LambdaQueryWrapper<InspectionTaskAbnormal> wrapper = new LambdaQueryWrapper<>(); |
||||
|
||||
if(entry.getStatus() != null){ |
||||
wrapper.eq(InspectionTaskAbnormal::getStatus,entry.getStatus()); |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(entry.getTaskAbnormalInfo())){ |
||||
wrapper.eq(InspectionTaskAbnormal::getTaskAbnormalInfo,entry.getTaskAbnormalInfo()); |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(entry.getContent())){ |
||||
wrapper.like(InspectionTaskAbnormal::getContent,entry.getContent()); |
||||
} |
||||
|
||||
wrapper.eq(BaseEntity::getIsDeleted,0); |
||||
wrapper.orderByDesc(InspectionTaskAbnormal::getCreateTime); |
||||
IPage<InspectionTaskAbnormal> page = this.page(Condition.getPage(query), wrapper); |
||||
page.getRecords().forEach(taskAbnormal ->{ |
||||
InspectionTask task = inspectionTaskMapper.selectById(taskAbnormal.getTaskId()); |
||||
taskAbnormal.setTaskName(task.getPlanName()); |
||||
taskAbnormal.setTaskCode(task.getTaskCode()); |
||||
}); |
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean saveAbnormal(InspectionTaskAbnormal entry) { |
||||
Date date = new Date(); |
||||
entry.setOperId(AuthUtil.getUserName()); |
||||
entry.setOperTime(date); |
||||
if(entry.getId() == null){ |
||||
entry.setCreateUser(AuthUtil.getUserId()); |
||||
entry.setCreateTime(date); |
||||
baseMapper.insert(entry); |
||||
}else{ |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
entry.setUpdateTime(date); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionTaskAbnormal findById(String id) { |
||||
InspectionTaskAbnormal entry = this.getById(id); |
||||
InspectionTask task = inspectionTaskMapper.selectById(entry.getTaskId()); |
||||
entry.setTaskName(task.getPlanName()); |
||||
entry.setTaskCode(task.getTaskCode()); |
||||
return entry; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,145 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.lims.entry.InspectionPointPos; |
||||
import org.springblade.lims.entry.InspectionRoute; |
||||
import org.springblade.lims.entry.InspectionTask; |
||||
import org.springblade.lims.entry.InspectionTaskPoint; |
||||
import org.springblade.lims.mapper.InspectionPointPosMapper; |
||||
import org.springblade.lims.mapper.InspectionRouteMapper; |
||||
import org.springblade.lims.mapper.InspectionTaskMapper; |
||||
import org.springblade.lims.mapper.InspectionTaskPointMapper; |
||||
import org.springblade.lims.service.IInspectionTaskPointService; |
||||
import org.springblade.system.feign.ISysClient; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.FileOutputStream; |
||||
import java.util.Date; |
||||
import java.util.UUID; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionTaskPointServiceImpl extends BaseServiceImpl<InspectionTaskPointMapper, InspectionTaskPoint> implements IInspectionTaskPointService { |
||||
|
||||
private final ISysClient sysClient; |
||||
private final InspectionTaskMapper inspectionTaskMapper; |
||||
private final InspectionRouteMapper inspectionRouteMapper; |
||||
private final InspectionPointPosMapper inspectionPointPosMapper; |
||||
@Override |
||||
public IPage<InspectionTaskPoint> findPage(InspectionTaskPoint entry, Query query) { |
||||
LambdaQueryWrapper<InspectionTaskPoint> wrapper = new LambdaQueryWrapper<>(); |
||||
if(StringUtils.isNotEmpty(entry.getPointStatus())){ |
||||
wrapper.eq(InspectionTaskPoint::getPointStatus,entry.getPointStatus()); |
||||
} |
||||
|
||||
if(StringUtils.isNotEmpty(entry.getPointPosId())){ |
||||
wrapper.eq(InspectionTaskPoint::getPointPosId,entry.getPointPosId()); |
||||
} |
||||
|
||||
if(StringUtils.isNotEmpty(entry.getPointCode())){ |
||||
wrapper.eq(InspectionTaskPoint::getPointCode,entry.getPointCode()); |
||||
} |
||||
|
||||
if(StringUtils.isNotEmpty(entry.getPointName())){ |
||||
wrapper.like(InspectionTaskPoint::getPointName,entry.getPointName()); |
||||
} |
||||
|
||||
if(StringUtils.isNotEmpty(entry.getPointPos())){ |
||||
wrapper.like(InspectionTaskPoint::getPointPos,entry.getPointPos()); |
||||
} |
||||
wrapper.eq(BaseEntity::getIsDeleted,0); |
||||
wrapper.orderByDesc(InspectionTaskPoint::getCreateTime); |
||||
IPage<InspectionTaskPoint> page = this.page(Condition.getPage(query), wrapper); |
||||
page.getRecords().forEach(taskPoint -> { |
||||
InspectionTask task = inspectionTaskMapper.selectById(taskPoint.getTaskId()); |
||||
InspectionRoute route = inspectionRouteMapper.selectById(taskPoint.getPointRouteId()); |
||||
InspectionPointPos pointPos = inspectionPointPosMapper.selectById(taskPoint.getPointPosId()); |
||||
taskPoint.setTaskName(task.getPlanName()); |
||||
taskPoint.setTaskCode(task.getTaskCode()); |
||||
taskPoint.setTaskCreateTime(task.getCreateTime()); |
||||
taskPoint.setRouteName(route.getName()); |
||||
taskPoint.setHierarchyName(pointPos.getHierarchyName()); |
||||
}); |
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean saveTaskPoint(InspectionTaskPoint entry) { |
||||
Date date = new Date(); |
||||
//巡检点执行后更新巡检任务状态为检中
|
||||
if(!"0".equals(entry.getPointStatus())){ |
||||
InspectionTask task = inspectionTaskMapper.selectById(entry.getTaskId()); |
||||
task.setTaskStatus("1"); |
||||
inspectionTaskMapper.updateById(task); |
||||
} |
||||
if(entry.getId() == null){ |
||||
entry.setCreateUser(AuthUtil.getUserId()); |
||||
entry.setCreateTime(date); |
||||
baseMapper.insert(entry); |
||||
}else{ |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
entry.setUpdateTime(date); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionTaskPoint findById(String id) { |
||||
InspectionTaskPoint entry = this.getById(id); |
||||
//巡检任务
|
||||
InspectionTask task = inspectionTaskMapper.selectById(entry.getTaskId()); |
||||
//巡检路线
|
||||
InspectionRoute route = inspectionRouteMapper.selectById(entry.getPointRouteId()); |
||||
//巡检点位
|
||||
InspectionPointPos pointPos = inspectionPointPosMapper.selectById(entry.getPointPosId()); |
||||
entry.setTaskName(task.getPlanName()); |
||||
entry.setTaskCode(task.getTaskCode()); |
||||
entry.setTaskCreateTime(task.getCreateTime()); |
||||
entry.setRouteName(route.getName()); |
||||
entry.setHierarchyName(pointPos.getHierarchyName()); |
||||
return entry; |
||||
} |
||||
|
||||
@Override |
||||
public String uploadFile(MultipartFile file) { |
||||
String fileName = ""; |
||||
String path = ""; |
||||
if (file != null) { |
||||
String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); |
||||
fileName = UUID.randomUUID().toString() + fileSuffix; |
||||
path = sysClient.getParamValue("jiahe").getData() + fileName; |
||||
|
||||
FileOutputStream fout; |
||||
try { |
||||
fout = new FileOutputStream(path); |
||||
fout.write(file.getBytes()); |
||||
fout.close(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
return path; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,238 @@ |
||||
|
||||
package org.springblade.lims.service.impl; |
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.alibaba.nacos.common.utils.CollectionUtils; |
||||
import com.alibaba.nacos.common.utils.StringUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.AllArgsConstructor; |
||||
import org.apache.commons.lang3.time.DateFormatUtils; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springblade.lims.entry.*; |
||||
import org.springblade.lims.mapper.InspectionTaskMapper; |
||||
import org.springblade.lims.service.*; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* @author swj |
||||
* @since 2022年6月2日15:53:01 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMapper, InspectionTask> implements IInspectionTaskService { |
||||
|
||||
private final IInspectionTaskPointService inspectionTaskPointService; |
||||
private final IInstrumentService instrumentService; |
||||
private final IInspectionPointService inspectionPointService; |
||||
private final IInspectionRecordService inspectionRecordService; |
||||
private final IInspectionTaskAbnormalService inspectionTaskAbnormalService; |
||||
|
||||
@Override |
||||
public IPage<InspectionTask> findPage(InspectionTask entry, Query query) { |
||||
LambdaQueryWrapper<InspectionTask> wrapper = new LambdaQueryWrapper<>(); |
||||
|
||||
if(StringUtils.isNotBlank(entry.getTaskStatus())){ |
||||
wrapper.eq(InspectionTask::getTaskStatus,entry.getTaskStatus()); |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(entry.getGroupId())){ |
||||
wrapper.eq(InspectionTask::getGroupId,entry.getGroupId()); |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(entry.getTaskCode())){ |
||||
wrapper.like(InspectionTask::getTaskCode,entry.getTaskCode()); |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(entry.getPlanName())){ |
||||
wrapper.like(InspectionTask::getPlanName,entry.getPlanName()); |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(entry.getActStartTimeBegin())){ |
||||
wrapper.ge(InspectionTask::getActStartTime,entry.getActStartTimeBegin()); |
||||
} |
||||
|
||||
if(StringUtils.isNotBlank(entry.getActStartTimeEnd())){ |
||||
wrapper.le(InspectionTask::getActStartTime,entry.getActStartTimeEnd()); |
||||
} |
||||
|
||||
wrapper.eq(BaseEntity::getIsDeleted,0); |
||||
wrapper.orderByDesc(InspectionTask::getCreateTime); |
||||
IPage<InspectionTask> page = this.page(Condition.getPage(query), wrapper); |
||||
page.getRecords().forEach(task ->{ |
||||
int pointCount = 0; //巡检点总数
|
||||
int unPointCount =0; //待检点数
|
||||
int pointNormalCount = 0; //正常
|
||||
int pointAbnormalCount = 0; //异常
|
||||
LambdaQueryWrapper<InspectionTaskPoint> wrapper1 = new LambdaQueryWrapper<>(); |
||||
wrapper1.eq(InspectionTaskPoint::getTaskId,task.getId()); |
||||
List<InspectionTaskPoint> taskPointList = inspectionTaskPointService.list(wrapper1); |
||||
if(CollectionUtils.isNotEmpty(taskPointList)){ |
||||
pointCount = taskPointList.size(); |
||||
for(InspectionTaskPoint taskpoint : taskPointList){ |
||||
if("0".equals(taskpoint.getPointStatus())){ |
||||
unPointCount++; |
||||
} |
||||
if("1".equals(taskpoint.getPointStatus())){ |
||||
pointNormalCount++; |
||||
} |
||||
if("2".equals(taskpoint.getPointStatus())){ |
||||
pointAbnormalCount++; |
||||
} |
||||
} |
||||
} |
||||
task.setPointCount(pointCount); |
||||
task.setUnPointCount(unPointCount); |
||||
task.setPointNormalCount(pointNormalCount); |
||||
task.setPointAbnormalCount(pointAbnormalCount); |
||||
}); |
||||
|
||||
return page; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean saveTask(InspectionTask entry) { |
||||
Date date = new Date(); |
||||
if(entry.getId() == null){ |
||||
entry.setTaskCode("XJRW" + DateFormatUtils.format(date, "yyyyMMddhhmmss") + StringUtil.randomUUID().substring(0, 5)); |
||||
entry.setCreateUser(AuthUtil.getUserId()); |
||||
entry.setCreateTime(date); |
||||
entry.setOriginatorId(AuthUtil.getUserId().toString()); |
||||
baseMapper.insert(entry); |
||||
}else{ |
||||
entry.setUpdateUser(AuthUtil.getUserId()); |
||||
entry.setUpdateTime(date); |
||||
baseMapper.updateById(entry); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public InspectionTask findById(String id) { |
||||
InspectionTask entry = this.getById(id); |
||||
//查询巡检点位
|
||||
List<InspectionTaskPoint> taskPointList = inspectionTaskPointService.list(new LambdaQueryWrapper<InspectionTaskPoint>().eq(InspectionTaskPoint::getTaskId,id)); |
||||
entry.setTaskPointList(taskPointList); |
||||
return entry; |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public boolean deleteById(String id) { |
||||
//删除对应保养项目
|
||||
LambdaQueryWrapper<InspectionTaskPoint> wrapper = new LambdaQueryWrapper<>(); |
||||
wrapper.eq(InspectionTaskPoint::getTaskId,id); |
||||
List<InspectionTaskPoint> taskPointList = inspectionTaskPointService.list(wrapper); |
||||
if(CollectionUtils.isNotEmpty(taskPointList)){ |
||||
List<Long> ids = taskPointList.stream().map(InspectionTaskPoint::getId).collect(Collectors.toList()); |
||||
inspectionTaskPointService.deleteLogic(ids); |
||||
} |
||||
//删除对应巡检异常点
|
||||
InspectionTaskAbnormal inspectionTaskAbnormal = inspectionTaskAbnormalService.getOne(new LambdaQueryWrapper<InspectionTaskAbnormal>().eq(InspectionTaskAbnormal::getTaskId,id)); |
||||
inspectionTaskAbnormalService.deleteLogic(Func.toLongList(inspectionTaskAbnormal.getId().toString())); |
||||
return this.deleteLogic(Func.toLongList(id)); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public R finish(String id) { |
||||
InspectionTask task = this.getById(id); |
||||
boolean insertAbnormal=false; |
||||
//校验巡检点是否都巡检完成
|
||||
LambdaQueryWrapper<InspectionTaskPoint> taskProjectWrapper = new LambdaQueryWrapper<>(); |
||||
taskProjectWrapper.eq(InspectionTaskPoint::getTaskId,id); |
||||
List<InspectionTaskPoint> taskPointList = inspectionTaskPointService.list(taskProjectWrapper); |
||||
if(CollectionUtils.isNotEmpty(taskPointList)){ |
||||
for(InspectionTaskPoint taskPoint : taskPointList){ |
||||
if("0".equals(taskPoint.getPointStatus())){ |
||||
return R.fail("巡检点:"+taskPoint.getPointName()+"未巡检!"); |
||||
} |
||||
if("2".equals(taskPoint.getPointStatus())){ |
||||
insertAbnormal=true; |
||||
} |
||||
//巡检记录
|
||||
InspectionPoint point = inspectionPointService.getById(taskPoint.getPointId()); |
||||
Instrument instrument = instrumentService.getById(point.getAssetId()); |
||||
InspectionRecord record=new InspectionRecord(); |
||||
record.setAssetId(instrument.getId().toString()); |
||||
record.setBusinessCode(task.getTaskCode()); |
||||
record.setContent("巡检完成"); |
||||
record.setRecordTime(new Date()); |
||||
inspectionRecordService.save(record); |
||||
} |
||||
}else{ |
||||
return R.fail("没有需要巡检的项目!"); |
||||
} |
||||
//更新巡检状态
|
||||
task.setTaskStatus("2"); |
||||
task.setUpdateTime(new Date()); |
||||
task.setUpdateUser(AuthUtil.getUserId()); |
||||
task.setExecutorId(AuthUtil.getUserName()); |
||||
this.updateById(task); |
||||
//异常巡检点
|
||||
if(insertAbnormal){ |
||||
InspectionTaskAbnormal inspectionTaskAbnormal=new InspectionTaskAbnormal(); |
||||
inspectionTaskAbnormal.setTaskId(task.getId().toString()); |
||||
inspectionTaskAbnormal.setTaskAbnormalInfo("存在巡检点异常,请确认"); |
||||
inspectionTaskAbnormal.setStatus(0); |
||||
inspectionTaskAbnormalService.save(inspectionTaskAbnormal); |
||||
} |
||||
return R.success("巡检完成!"); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public JSONArray queryDataByCal(String startDate,String endDate) { |
||||
JSONArray data=new JSONArray(); |
||||
LambdaQueryWrapper<InspectionTask> wrapper = new LambdaQueryWrapper<>(); |
||||
|
||||
if(StringUtils.isNotBlank(startDate)){ |
||||
wrapper.ge(InspectionTask::getPlanStartTime,startDate); |
||||
} |
||||
if(StringUtils.isNotBlank(endDate)){ |
||||
wrapper.le(InspectionTask::getPlanStartTime,endDate); |
||||
} |
||||
List<InspectionTask> list = this.list(wrapper); |
||||
if(CollectionUtils.isNotEmpty(list)){ |
||||
for(InspectionTask task : list){ |
||||
JSONObject obj=new JSONObject(); |
||||
String name = task.getPlanName(); |
||||
String statusName = "未知"; |
||||
if("0".equals(task.getTaskStatus())){ |
||||
statusName = "待检"; |
||||
}else if("1".equals(task.getTaskStatus())){ |
||||
statusName = "检中"; |
||||
}else if("2".equals(task.getTaskStatus())){ |
||||
statusName = "结束"; |
||||
}else if("3".equals(task.getTaskStatus())){ |
||||
statusName = "取消"; |
||||
} |
||||
obj.put("title","【"+statusName+"】"+name); |
||||
obj.put("start", DateFormatUtils.format(task.getPlanStartTime(),"yyyy-MM-dd")); |
||||
if(task.getActFinishTime()!=null){ |
||||
obj.put("end", DateFormatUtils.format(task.getActFinishTime(),"yyyy-MM-dd")); |
||||
} |
||||
data.add(obj); |
||||
} |
||||
} |
||||
|
||||
return data; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue