Merge remote-tracking branch 'origin/main'

# Conflicts:
#	lidee-admin/src/main/resources/application-dev.yml
This commit is contained in:
chy
2026-05-07 14:38:30 +08:00
28 changed files with 2038 additions and 0 deletions

View File

@@ -38,6 +38,12 @@ spring:
username: root
password: taosdata
dbName: lidee_log
maintenance_repair_data:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/gr_report?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: gryy@8888
# slave:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.cj.jdbc.Driver

View File

@@ -0,0 +1,32 @@
package iot.lidee.iot.data.job;
import iot.lidee.iot.service.IDeviceMaintenanceRepairService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
*
* 同步设备保养维修信息
*
*/
@Slf4j
@Component
public class SyncDeviceMaintenanceRepairJob {
@Resource
private IDeviceMaintenanceRepairService deviceMaintenanceRepairService;
/**
* 同步设备维修保养信息定时任务
* 定期触发设备维修保养数据的同步操作
*/
public void syncDeviceMaintenanceRepairInfo() {
log.info("*********** 开始同步维修保修数据 ************");
deviceMaintenanceRepairService.syncDeviceMaintenanceRepairInfo();
log.info("*********** 开始同步维修保修数据 ************");
}
}

View File

@@ -0,0 +1,51 @@
package iot.lidee.controller.bygz;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import iot.lidee.common.core.domain.AjaxResult;
import iot.lidee.iot.service.IDeviceMaintenanceRepairService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(tags = "物联组态")
@RestController
@RequestMapping("/iot/configuration")
public class DeviceMaintenanceRepairController {
@Resource
private IDeviceMaintenanceRepairService deviceMaintenanceRepairService;
/**
* 组态设备保养列表
*/
@ApiOperation("设备保养")
@GetMapping("/maintenanceList")
public AjaxResult maintenanceList(String devtype) {
return AjaxResult.success(deviceMaintenanceRepairService.maintenanceList(devtype));
}
/**
* 组态设备维修列表
*/
@ApiOperation("设备维修")
@GetMapping("/repairList")
public AjaxResult repairList(String devtype) {
return AjaxResult.success(deviceMaintenanceRepairService.repairList(devtype));
}
/**
* 组态设备列表
*/
@ApiOperation("设备列表")
@GetMapping("/deviceList")
public AjaxResult deviceList(String devtype) {
return AjaxResult.success(deviceMaintenanceRepairService.deviceList(devtype));
}
}

View File

@@ -0,0 +1,21 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.model.bygz.ByManagementGd;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 保养管理-保养工单Mapper接口
*
* @date 2026-03-20
*/
@Mapper
public interface ByManagementGdMapper extends BaseMapperX<ByManagementGd> {
default List<ByManagementGd> selectGdList(){
return this.selectList(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,23 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.model.bygz.ByManagementJl;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 保养管理-保养记录Mapper接口
*
* @date 2026-03-20
*/
@Mapper
public interface ByManagementJlMapper extends BaseMapperX<ByManagementJl> {
default List<ByManagementJl> selectJlList(){
return this.selectList(new QueryWrapper<>());
}
List<ByManagementJl> selectBygdByType(String devtype);
}

View File

@@ -0,0 +1,21 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.model.bygz.ByManagementPlan;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 保养管理-保养计划Mapper接口
*
* @date 2026-04-15
*/
@Mapper
public interface ByManagementPlanMapper extends BaseMapperX<ByManagementPlan> {
default List<ByManagementPlan> selectPlanList(){
return this.selectList(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,21 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.model.bygz.ByManagementYs;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 保养管理-保养验收Mapper接口
*
* @date 2026-03-20
*/
@Mapper
public interface ByManagementYsMapper extends BaseMapperX<ByManagementYs> {
default List<ByManagementYs> selectYsList(){
return this.selectList(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,21 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.model.bygz.DevGzbxDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* demo相关
*/
@Mapper
public interface DevGzbxMapper extends BaseMapperX<DevGzbxDO> {
default List<DevGzbxDO> selectGzbxList(){
return this.selectList(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,26 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.domain.Device;
import iot.lidee.iot.model.bygz.DevGzbxWxgdDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* demo相关
*/
@Mapper
public interface DevGzbxWxgdMapper extends BaseMapperX<DevGzbxWxgdDO> {
default List<DevGzbxWxgdDO> selectGzbxWxgdList(){
return this.selectList(new QueryWrapper<>());
}
List<DevGzbxWxgdDO> selectWxgdByType(String devtype);
List<Device> deviceList(String devtype);
}

View File

@@ -0,0 +1,20 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.model.bygz.DevArchivesEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 设备档案
*/
@Mapper
public interface DeviceArchivesMapper extends BaseMapperX<DevArchivesEntity> {
default List<DevArchivesEntity> selectDeviceList(){
return this.selectList(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,16 @@
package iot.lidee.iot.mapper.bygz;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.model.bygz.SblxDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SblxMapper extends BaseMapperX<SblxDO> {
default List<SblxDO> selectScxList(){
return this.selectList(new QueryWrapper<>());
}
}

View File

@@ -0,0 +1,221 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 保养管理-保养工单
*/
@TableName("by_management_gd")
@Data
@EqualsAndHashCode
public class ByManagementGd{
/**
* ID
*/
private Long id;
/**
* 工单编号
*/
private String orderId;
/**
* 工单名称
*/
private String orderName;
/**
* 设备类型
*/
private String deviceTypeName;
/**
*设备
*/
private String equipmentInfo;
/**
*设备编号
*/
private String equipmentCode;
/**
*保养级别
*/
private String upkeepLevel;
/**
*优先级
*/
private String priority;
/**
*可能更换零件
*/
private String possibleReplacements;
/**
*计划保养时间
*/
private String planUpkeepTime;
/**
*是否申请备件
*/
private String applyForParts;
/**
*是否已停机
*/
private String isStopped;
/**
*执行人
*/
private String executor;
/**
*状态
*/
private String orderState;
/**
* 备注
*/
private String remark;
/**
* 完成时间
*/
private String upkeepTime;
/**
* 保养方案
*/
private String schemeId;
/**
* 计划id
*/
private String planId;
/**
* 保养内容
*/
private String schemeInfo;
/**
* 保养人
*/
private String maintainer;
/**
* 设备所属车间领导
*/
private Long leaderUserId;
/**
* 维保中心领导
*/
private Long wbcjzrUserId;
/**
* 设备所属车间领导意见
*/
private String leaderUserYj;
/**
* 维保中心领导意见
*/
private String wbcjzrUserYj;
/**
* 车间领导确定保养时间
*/
private String leaderUpkeepTime;
/**
* 处理结果
*/
private String bygdCljg;
/**
* 车间领导审批状态
*/
private Integer leaderUserZt;
/**
* 维保领导审批状态
*/
private Integer wbcjzrUserZt;
/**
* 所属年份
*/
private String belongYear;
/**
* 租户id
*/
private Long tenantId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 创建者
*
*/
private Long createUser;
/**
* 创建部门
*
*/
private Long createDept;
/**
* 更新者
*
*/
private Long updateUser;
/**
* 最后更新时间
*/
private LocalDateTime updateTime;
/**
* 是否删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,158 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 保养管理-保养记录
*/
@TableName("by_management_jl")
@Data
@EqualsAndHashCode
public class ByManagementJl {
/**
* ID
*/
private Long id;
/**
* 工单编号
*/
private String orderId;
/**
* 工单名称
*/
private String orderName;
/**
*设备
*/
private String equipmentInfo;
/**
*设备编号
*/
private String equipmentCode;
/**
*优先级
*/
private String priority;
/**
*保养级别
*/
private String upkeepLevel;
/**
*完成时间
*/
private String upkeepTime;
/**
*状态
*/
private String state;
/**
*执行人
*/
private String executor;
/**
*验收时间
*/
private String ysTime;
/**
* 设备所属车间领导
*/
private Long leaderUserId;
/**
* 维保中心领导
*/
private Long wbcjzrUserId;
/**
* 车间领导验收状态
*/
private Integer leaderYsZt;
/**
* 维保领导验收状态
*/
private Integer wbcjzrYsZt;
/**
* 车间领导验收意见
*/
private String leaderYsYj;
/**
* 维保领导验收意见
*/
private String wbcjzrYsYj;
/**
* 保养人
*/
private String maintainer;
/**
* 保养内容
*/
private String schemeInfo;
/**
* 租户id
*/
private Long tenantId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 创建者
*
*/
private Long createUser;
/**
* 创建部门
*
*/
private Long createDept;
/**
* 更新者
*
*/
private Long updateUser;
/**
* 最后更新时间
*/
private LocalDateTime updateTime;
/**
* 是否删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,141 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 保养管理-保养计划
*/
@TableName("by_management_plan")
@Data
@EqualsAndHashCode
public class ByManagementPlan {
/**
* 主键
*/
private Long id;
/**
* 计划编号
*/
private String planId;
/**
* 计划名称
*/
private String planName;
/**
* 生产线
*/
private String deviceTypeName;
/**
* 设备
*/
private String equipmentInfo;
/**
* 设备编号
*/
private String equipmentCode;
/**
* 保养级别
*/
private String upkeepLevel;
/**
* 保养方案
*/
private String schemeId;
/**
* 可能更换零件
*/
private String possibleReplacements;
/**
* 保养周期
*/
private String scheduledInterval;
/**
* 下次保养时间
*/
private String nextUpkeepTime;
/**
* 执行人
*/
private String executor;
/**
* 状态
*/
private String planState;
/**
* 备注
*/
private String remark;
/**
* 起止时间
*/
private String scheduledDate;
/**
* 保养内容
*/
private String schemeInfo;
/**
* 所属年份
*/
private String belongYear;
/**
* 租户id
*/
private Long tenantId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 创建者
*
*/
private Long createUser;
/**
* 创建部门
*
*/
private Long createDept;
/**
* 更新者
*
*/
private Long updateUser;
/**
* 最后更新时间
*/
private LocalDateTime updateTime;
/**
* 是否删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,160 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 保养管理-保养验收
*/
@TableName("by_management_ys")
@Data
@EqualsAndHashCode
public class ByManagementYs {
/**
* ID
*/
private Long id;
/**
* 工单编号
*/
private String orderId;
/**
* 工单名称
*/
private String orderName;
/**
*设备
*/
private String equipmentInfo;
/**
*设备编号
*/
private String equipmentCode;
/**
*优先级
*/
private String priority;
/**
*保养级别
*/
private String upkeepLevel;
/**
*完成时间
*/
private String upkeepTime;
/**
*状态
*/
private String state;
/**
*执行人
*/
private String executor;
/**
*验收时间
*/
private String ysTime;
/**
* 设备所属车间领导
*/
private Long leaderUserId;
/**
* 维保中心领导
*/
private Long wbcjzrUserId;
/**
* 车间领导验收状态
*/
private Integer leaderYsZt;
/**
* 维保领导验收状态
*/
private Integer wbcjzrYsZt;
/**
* 车间领导验收意见
*/
private String leaderYsYj;
/**
* 维保领导验收意见
*/
private String wbcjzrYsYj;
/**
* 保养人
*/
private String maintainer;
/**
* 保养内容
*/
private String schemeInfo;
/**
* 租户id
*/
private Long tenantId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 创建者
*
*/
private Long createUser;
/**
* 创建部门
*
*/
private Long createDept;
/**
* 更新者
*
*/
private Long updateUser;
/**
* 最后更新时间
*/
private LocalDateTime updateTime;
/**
* 是否删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,137 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 设备档案-实体类
*
*
*/
@TableName(value = "sys_device", autoResultMap = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DevArchivesEntity {
/**
* 主键
*/
private Long id;
/**
* 设备编码
*/
private String devCode;
/**
* 出厂编号
*/
private String devCcbh;
/**
* 备注
*/
private String devBz;
/**
* 备注
*/
private String devFj;
/**
* 设备名称
*/
private String devName;
/**
* 设备类型
*/
private String devType;
/**
* 设备型号
*/
private String devXh;
/**
* 设备部门
*/
private String devDept;
/**
* 设备所属单位
*/
private String devZzdw;
/**
* 设备出厂日期
*/
private String devCcrq;
/**
* 设备启用日期
*/
private String devQyrq;
/**
* 设备功率/管理
*/
private String devGl;
/**
* 设备安装位置
*/
private String devAzwz;
/**
* 设备固定资产编码
*/
private String devGdzcbm;
/**
* 设备图片
*/
private String devTp;
/**
* 租户ID
*/
private Long tenantId;
/**
* 创建人
*/
private Long createUser;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建部门
*/
private Long createDept;
/**
* 修改人
*/
private Long updateUser;
/**
* 修改时间
*/
private Date updateTime;
/**
* 逻辑删除标志0-未删除1-已删除)
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,188 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 故障保修 DO
*
*
*/
@TableName(value = "dev_gzbx", autoResultMap = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DevGzbxDO {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 租户ID
*/
@TableField("tenant_id")
private Long tenantId;
/**
* 故障编号
*/
@TableField("fault_number")
private String faultNumber;
/**
* 故障名称
*/
@TableField("name")
private String name;
/**
* 设备类型
*/
@TableField("dev_type")
private Integer devType;
/**
* 设备名称
*/
@TableField("dev_name")
private String devName;
/**
* 设备编号
*/
@TableField("dev_no")
private String devNo;
/**
* 故障类型0-硬件故障 1-软件故障 2-网络故障 3-其他)
*/
@TableField("type")
private Integer type;
/**
* 故障备注/描述
*/
@TableField("remark")
private String remark;
/**
* 故障级别(严重/高/中/低)
*/
@TableField("level")
private Integer level;
/**
* 是否停机0-否 1-是)
*/
@TableField("is_stop")
private Integer isStop;
/**
* 上报人ID
*/
@TableField("reporter")
private Long reporter;
/**
* 部门领导
*/
private Long leaderUserId;
/**
* 部门领导意见
*/
private String leaderUserYj;
/**
* 部门领导审批状态
*/
private Integer leaderUserZt;
/**
* 指定下级部门
*/
private Long assignDeptId;
/**
* 指定下级部门领导
*/
private Long assignDeptLeader;
/**
* 指定下级部门领导意见
*/
private String assignUserYj;
/**
* 指定下级部门领导审批状态
*/
private Integer assignUserZt;
/**
* 手机号码
*/
@TableField("phone_number")
private String phoneNumber;
/**
* 创建人
*/
@TableField("create_user")
private Long createUser;
/**
* 创建时间
*/
@TableField("create_time")
private Date createTime;
/**
* 创建部门ID
*/
@TableField("create_dept")
private Long createDept;
/**
* 更新人
*/
@TableField("update_user")
private Long updateUser;
/**
* 更新时间
*/
@TableField("update_time")
private Date updateTime;
/**
* 删除标志0-未删除 1-已删除)
*/
@TableField("is_deleted")
private Integer isDeleted;
/**
* 处理状态0-待处理 1-处理中 2-已完成
*/
@TableField("processing_status")
private Integer processingStatus;
/**
* 创建人姓名
*/
@TableField("create_user_name")
private String createUserName;
}

View File

@@ -0,0 +1,248 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 维修故障 DO
*
*
*/
@TableName(value = "dev_gzbx_wxgd", autoResultMap = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DevGzbxWxgdDO {
/**
* 主键ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 故障报修ID
*/
@TableField("gzbx_id")
private Long gzbxId;
/**
* 删除标志0-未删除 1-已删除)
*/
@TableField("is_deleted")
private Integer isDeleted;
/**
* 更新时间
*/
@TableField("update_time")
private LocalDateTime updateTime;
/**
* 更新人
*/
@TableField("update_user")
private Long updateUser;
/**
* 创建部门ID
*/
@TableField("create_dept")
private Long createDept;
/**
* 创建时间
*/
@TableField("create_time")
private Date createTime;
/**
* 创建人
*/
@TableField("create_user")
private Long createUser;
/**
* 租户ID
*/
@TableField("tenant_id")
private Long tenantId;
/**
* 处理状态0-待处理 1-处理中 2-已完成)
*/
@TableField("processing_status")
private Integer processingStatus;
/**
* 故障名称
*/
@TableField("name")
private String name;
/**
* 故障类型
*/
@TableField("fault_type")
private Integer faultType;
/**
* 设备编号
*/
@TableField("dev_no")
private String devNo;
/**
* 设备名称
*/
@TableField("dev_name")
private String devName;
/**
* 优先级(
*/
@TableField("priority")
private String priority;
/**
* 工单类型
*/
@TableField("type")
private String type;
/**
* 工单编号
*/
@TableField("number")
private String number;
/**
* 故障备注/描述
*/
@TableField("fault_remark")
private String faultRemark;
/**
* 设备类型(
*/
@TableField("dev_type")
private Integer devType;
/**
* 维修人员ID
*/
@TableField("maintenance_person")
private String maintenancePerson;
/**
* 是否停机0-否 1-是)
*/
@TableField("is_top")
private Integer isTop;
/**
* 是否备案0-否 1-是)
*/
@TableField("is_filing")
private Integer isFiling;
/**
* 上报人ID
*/
@TableField("reporter")
private Long reporter;
/**
* 部门领导
*/
private Long leaderUserId;
/**
* 部门领导意见
*/
private String leaderUserYj;
/**
* 指定下级部门
*/
private Long assignDeptId;
/**
* 指定下级部门领导
*/
private Long assignDeptLeader;
/**
* 指定下级部门领导验收状态 0 1已验收
*/
private Integer assignYsZt;
/**
* 部门领导验收状态0 1已验收
*/
private Integer leaderYsZt;
/**
* 更换配件情况
*/
private String accessories;
/**
* 解决措施
*/
private String solution;
/**
* 手机号码
*/
@TableField("phone_number")
private String phoneNumber;
/**
* 严重级别
*/
private Integer level;
/**
* 完成时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date completionTime;
/**
* 完成时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date acceptanceTime;
/**
* 创建人姓名
*/
@TableField("create_user_name")
private String createUserName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date repairDate;
private String repairTime;
private String leaderYsYj;
private String assignYsYj;
}

View File

@@ -0,0 +1,75 @@
package iot.lidee.iot.model.bygz;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 设备类型表
*
*/
@TableName("dev_sblx")
@Data
public class SblxDO {
public static final Long PARENT_ID_ROOT = 0L;
/**
* 设备类型ID
*/
@TableId
private Long id;
/**
* 设备类型名称
*/
private String industryName;
/**
* 设备类型编码
*/
private String industryCode;
/**
* 父设备类型ID
*
* 关联 {@link #id}
*/
private Long parentId;
/**
* 所属部门
*/
private Long deptId;
/**
* 显示顺序
*/
private Integer sort;
private LocalDateTime createTime;
/**
* 最后更新时间
*/
private LocalDateTime updateTime;
/**
* 创建者,目前使用 SysUser 的 id 编号
*
* 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。
*/
private Long createUser;
/**
* 更新者,目前使用 SysUser 的 id 编号
*
* 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。
*/
private Long updateUser;
/**
* 是否删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,28 @@
package iot.lidee.iot.model.bygz;
import lombok.Data;
import java.util.List;
@Data
public class SyncDataContainer {
private List<DevArchivesEntity> devices;
private List<ByManagementGd> gdList;
private List<ByManagementJl> jlList;
private List<ByManagementPlan> planList;
private List<ByManagementYs> ysList;
private List<DevGzbxDO> gzbxList;
private List<DevGzbxWxgdDO> wxgdList;
private List<SblxDO> sblxList;
}

View File

@@ -0,0 +1,9 @@
package iot.lidee.iot.service;
import iot.lidee.iot.model.bygz.SyncDataContainer;
public interface IDeviceDataLoadService {
SyncDataContainer loadData();
}

View File

@@ -0,0 +1,9 @@
package iot.lidee.iot.service;
import iot.lidee.iot.model.bygz.SyncDataContainer;
public interface IDeviceDataSyncService {
void syncDataToMaster(SyncDataContainer syncData);
}

View File

@@ -0,0 +1,18 @@
package iot.lidee.iot.service;
import iot.lidee.iot.domain.Device;
import iot.lidee.iot.model.bygz.ByManagementJl;
import iot.lidee.iot.model.bygz.DevGzbxWxgdDO;
import java.util.List;
public interface IDeviceMaintenanceRepairService {
void syncDeviceMaintenanceRepairInfo();
List<ByManagementJl> maintenanceList(String devtype);
List<DevGzbxWxgdDO> repairList(String devtype);
List<Device> deviceList(String devtype);
}

View File

@@ -0,0 +1,81 @@
package iot.lidee.iot.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import iot.lidee.iot.mapper.bygz.*;
import iot.lidee.iot.model.bygz.*;
import iot.lidee.iot.service.IDeviceDataLoadService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@DS("maintenance_repair_data")
@Primary
@Service
@Slf4j
public class DeviceDataLoadServiceImpl implements IDeviceDataLoadService {
private static final Logger logger = LoggerFactory.getLogger(DeviceMaintenanceRepairServiceImpl.class);
@Resource
private ByManagementGdMapper byManagementGdMapper;
@Resource
private ByManagementJlMapper byManagementJlMapper;
@Resource
private ByManagementPlanMapper byManagementPlanMapper;
@Resource
private ByManagementYsMapper byManagementYsMapper;
@Resource
private DevGzbxMapper devGzbxMapper;
@Resource
private DevGzbxWxgdMapper devGzbxWxgdMapper;
@Resource
private DeviceArchivesMapper deviceArchivesMapper;
@Resource
private SblxMapper sblxMapper;
/**
* 加载设备维护相关数据
* 从数据库中查询各类设备和保养维修数据,封装到同步数据容器中
*
* @return 同步数据容器,包含设备档案、保养工单、保养记录、保养计划、保养验收、故障报修、维修工单、设备类型等数据
*/
@Override
public SyncDataContainer loadData() {
SyncDataContainer syncData = new SyncDataContainer();
// 获取源数据
List<DevArchivesEntity> devArchivesEntities = deviceArchivesMapper.selectDeviceList();
syncData.setDevices(devArchivesEntities);
List<ByManagementGd> byManagementGds = byManagementGdMapper.selectGdList();
syncData.setGdList(byManagementGds);
List<ByManagementJl> byManagementJls = byManagementJlMapper.selectJlList();
syncData.setJlList(byManagementJls);
List<ByManagementPlan> byManagementPlans = byManagementPlanMapper.selectPlanList();
syncData.setPlanList(byManagementPlans);
List<ByManagementYs> byManagementYs = byManagementYsMapper.selectYsList();
syncData.setYsList(byManagementYs);
List<DevGzbxDO> devGzbxDOS = devGzbxMapper.selectGzbxList();
syncData.setGzbxList(devGzbxDOS);
List<DevGzbxWxgdDO> devGzbxWxgdDOS = devGzbxWxgdMapper.selectGzbxWxgdList();
syncData.setWxgdList(devGzbxWxgdDOS);
List<SblxDO> sblxDOS = sblxMapper.selectScxList();
syncData.setSblxList(sblxDOS);
logger.info("源数据获取完成,开始同步数据");
return syncData;
}
}

View File

@@ -0,0 +1,98 @@
package iot.lidee.iot.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import iot.lidee.framework.mybatis.mapper.BaseMapperX;
import iot.lidee.iot.mapper.bygz.*;
import iot.lidee.iot.model.bygz.SyncDataContainer;
import iot.lidee.iot.service.IDeviceDataSyncService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
@Slf4j
public class DeviceDataSyncServiceImpl implements IDeviceDataSyncService {
private static final Logger logger = LoggerFactory.getLogger(DeviceMaintenanceRepairServiceImpl.class);
private static final int DEFAULT_BATCH_SIZE = 500;
@Resource
private ByManagementGdMapper byManagementGdMapper;
@Resource
private ByManagementJlMapper byManagementJlMapper;
@Resource
private ByManagementPlanMapper byManagementPlanMapper;
@Resource
private ByManagementYsMapper byManagementYsMapper;
@Resource
private DevGzbxMapper devGzbxMapper;
@Resource
private DevGzbxWxgdMapper devGzbxWxgdMapper;
@Resource
private DeviceArchivesMapper deviceArchivesMapper;
@Resource
private SblxMapper sblxMapper;
/**
* 同步数据到主数据库
* 将各类设备和保养维修数据从源数据库同步到主数据库,包括设备档案、保养工单、保养记录、保养计划、
* 保养验收、故障报修、维修工单、生产线等数据
*
* @param data 同步数据容器,包含待同步的各类数据列表
*/
@Override
public void syncDataToMaster(SyncDataContainer data) {
// 同步设备信息
syncData(deviceArchivesMapper, data.getDevices(), "设备信息");
// 同步保养信息
syncData(byManagementGdMapper, data.getGdList(), "保养工单");
syncData(byManagementJlMapper, data.getJlList(), "保养记录");
syncData(byManagementPlanMapper, data.getPlanList(), "保养计划");
syncData(byManagementYsMapper, data.getYsList(), "保养验收");
// 同步维修信息
syncData(devGzbxMapper, data.getGzbxList(), "故障报修");
syncData(devGzbxWxgdMapper, data.getWxgdList(), "维修工单");
// 同步生产线
syncData(sblxMapper, data.getSblxList(), "生产线");
}
/**
* 通用方法
* @param mapper 数据访问接口
* @param dataList 数据列表
* @param dataTypeName 数据类型名称(用于日志)
*/
public <T, M extends BaseMapperX<T>> void syncData(M mapper, List<T> dataList, String dataTypeName) {
if (dataList == null || dataList.isEmpty()) {
logger.warn("{}数据为空,跳过同步", dataTypeName);
return;
}
try {
logger.info("开始同步{},数据量:{}", dataTypeName, dataList.size());
mapper.delete(new QueryWrapper<>());
mapper.insertBatch(dataList, DEFAULT_BATCH_SIZE);
logger.info("{}同步完成", dataTypeName);
} catch (Exception e) {
logger.error("同步{}失败", dataTypeName, e);
throw e;
}
}
}

View File

@@ -0,0 +1,98 @@
package iot.lidee.iot.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import iot.lidee.iot.domain.Device;
import iot.lidee.iot.mapper.bygz.ByManagementJlMapper;
import iot.lidee.iot.mapper.bygz.DevGzbxWxgdMapper;
import iot.lidee.iot.model.bygz.ByManagementJl;
import iot.lidee.iot.model.bygz.DevGzbxWxgdDO;
import iot.lidee.iot.model.bygz.SyncDataContainer;
import iot.lidee.iot.service.IDeviceDataLoadService;
import iot.lidee.iot.service.IDeviceDataSyncService;
import iot.lidee.iot.service.IDeviceMaintenanceRepairService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class DeviceMaintenanceRepairServiceImpl implements IDeviceMaintenanceRepairService {
private static final Logger logger = LoggerFactory.getLogger(DeviceMaintenanceRepairServiceImpl.class);
@Resource
private IDeviceDataLoadService loadService;
@Resource
private IDeviceDataSyncService syncService;
@Resource
private ByManagementJlMapper byManagementJlMapper;
@Resource
private DevGzbxWxgdMapper devGzbxWxgdMapper;
/**
* 同步设备维修保养信息
* 从源数据库加载设备维修保养相关数据并同步到主数据库,使用事务保证数据一致性
* 同步过程包括:加载源数据、同步到主库两个阶段
*/
@Override
@DSTransactional
public void syncDeviceMaintenanceRepairInfo() {
logger.info("开始同步设备维修保养信息");
try {
// 加载源数据
SyncDataContainer syncData = loadService.loadData();
// 同步数据到主数据库
syncService.syncDataToMaster(syncData);
logger.info("设备维修保养信息同步完成");
} catch (Exception e) {
logger.error("同步设备维修保养信息失败", e);
throw new RuntimeException("同步设备维修保养信息失败: " + e.getMessage(), e);
}
}
/**
* 查询保养记录列表
* 根据设备类型查询对应的保养记录信息
*
* @param devtype 设备类型
* @return 保养记录列表
*/
@Override
public List<ByManagementJl> maintenanceList(String devtype) {
return byManagementJlMapper.selectBygdByType(devtype);
}
/**
* 查询维修工单列表
* 根据设备类型查询对应的维修工单信息
*
* @param devtype 设备类型
* @return 维修工单列表
*/
@Override
public List<DevGzbxWxgdDO> repairList(String devtype) {
return devGzbxWxgdMapper.selectWxgdByType(devtype);
}
/**
* 查询设备列表
* 根据设备类型查询对应的设备信息
*
* @param devtype 设备类型
* @return 设备列表
*/
@Override
public List<Device> deviceList(String devtype) {
return devGzbxWxgdMapper.deviceList(devtype);
}
}

View File

@@ -0,0 +1,43 @@
<?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="iot.lidee.iot.mapper.bygz.ByManagementJlMapper">
<select id="selectBygdByType" resultType="iot.lidee.iot.model.bygz.ByManagementJl">
SELECT
w.id,
w.order_id,
s.dev_name AS order_name,
w.equipment_info,
w.priority,
w.upkeep_level,
w.upkeep_time,
w.state,
w.executor,
w.ys_time,
w.tenant_id,
w.create_user,
w.create_time,
w.create_dept,
w.update_user,
w.update_time,
w.is_deleted,
w.equipment_code,
w.leader_user_id,
w.wbcjzr_user_id,
w.leader_ys_zt,
w.wbcjzr_ys_zt,
w.leader_ys_yj,
w.wbcjzr_ys_yj,
w.maintainer,
w.scheme_info
FROM
by_management_jl w
LEFT JOIN sys_device s ON s.id = w.equipment_info
WHERE
s.dev_type = #{devtype}
AND w.is_deleted = 0;
</select>
</mapper>

View File

@@ -0,0 +1,68 @@
<?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="iot.lidee.iot.mapper.bygz.DevGzbxWxgdMapper">
<select id="selectWxgdByType" resultType="iot.lidee.iot.model.bygz.DevGzbxWxgdDO">
SELECT
w.id,
w.gzbx_id,
w.is_deleted,
w.update_time,
w.update_user,
w.create_dept,
w.create_time,
w.create_user,
w.create_user,
w.fault_type,
s.dev_name AS name,
w.dev_no,
w.dev_name,
w.priority,
w.type,
w.number,
w.fault_remark,
w.dev_type,
w.maintenance_person,
w.is_top,
w.is_filing,
w.reporter,
w.phone_number,
w.processing_status,
w.level,
w.completion_time,
w.acceptance_time,
w.create_user_name,
w.solution,
w.repair_date,
w.repair_time,
w.accessories,
w.leader_user_id,
w.assign_dept_id,
w.assign_dept_leader,
w.leader_user_yj,
w.leader_ys_zt,
w.assign_ys_zt,
w.leader_ys_yj,
w.assign_ys_yj
FROM
dev_gzbx_wxgd w
LEFT JOIN
sys_device s ON s.id = w.dev_name
WHERE
w.dev_type = #{devtype} AND w.is_deleted = 0
</select>
<select id="deviceList" resultType="iot.lidee.iot.domain.Device">
SELECT
w.*
FROM
iot_device w
LEFT JOIN
iot_device_group g ON g.device_id = w.device_id
WHERE
w.del_flag = 0 AND g.group_id = #{devtype}
</select>
</mapper>