parent
76722e3aff
commit
8ff583812a
@ -0,0 +1,25 @@ |
|||||||
|
package com.bellmann.common.enums; |
||||||
|
|
||||||
|
import com.bellmann.common.base.IBaseEnum; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
public enum OperateTaskStateEnum implements IBaseEnum<String> { |
||||||
|
|
||||||
|
NOT_EXECUTED("0","未执行"), |
||||||
|
EXECUTION_FAILED("1","执行失败"), |
||||||
|
THE_EXECUTION_WAS_SUCCESSFUL("2","执行成功"), |
||||||
|
THE_DEVICE_IS_NOT_ONLINE("3","设备不在线"), |
||||||
|
ONGOING("4","进行中"), |
||||||
|
; |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String label; |
||||||
|
|
||||||
|
OperateTaskStateEnum(String value, String label){ |
||||||
|
this.label = label; |
||||||
|
this.value = value; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.model.vo.DeviceLogVO; |
||||||
|
import com.bellmann.service.DeviceLogService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-05 |
||||||
|
*/ |
||||||
|
@Tag(name = "24.设备操作日志") |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/api/device-log/v1") |
||||||
|
public class DeviceLogController { |
||||||
|
|
||||||
|
private final DeviceLogService deviceLogService; |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/page/{devId}") |
||||||
|
@Operation(summary = "设备操作日志-page") |
||||||
|
public PageResult<DeviceLogVO> page(@RequestBody BasePageQuery query, @PathVariable Long devId){ |
||||||
|
return deviceLogService.page(query,devId); |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,21 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/operateResult2") |
||||||
|
public class OperateResult2Controller { |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,36 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.model.vo.OperateTask2TableVO; |
||||||
|
import com.bellmann.service.OperateTask2Service; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Tag(name = "23.设备任务列表") |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/api/operate-task2/v1") |
||||||
|
public class OperateTask2Controller { |
||||||
|
|
||||||
|
private final OperateTask2Service operateTask2Service; |
||||||
|
|
||||||
|
@PostMapping("/page/{devId}") |
||||||
|
@Operation(summary = "设备任务列表-page") |
||||||
|
public PageResult<OperateTask2TableVO> page(@PathVariable Long devId, @RequestBody BasePageQuery query){ |
||||||
|
return operateTask2Service.page(devId,query); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.converter; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.bo.OperateTask2TableBO; |
||||||
|
import com.bellmann.model.vo.OperateTask2TableVO; |
||||||
|
import org.mapstruct.Mapper; |
||||||
|
import org.mapstruct.Mapping; |
||||||
|
import org.mapstruct.Mappings; |
||||||
|
|
||||||
|
|
||||||
|
@Mapper(componentModel = "spring") |
||||||
|
public interface OperateTask2Converter { |
||||||
|
@Mappings({ |
||||||
|
@Mapping(target = "resultState", expression = "java(com.bellmann.common.base.IBaseEnum.getLabelByValue(bo.getResultState(), com.bellmann.common.enums.OperateTaskStateEnum.class))"), |
||||||
|
}) |
||||||
|
OperateTask2TableVO pageBo2PageVo(OperateTask2TableBO bo); |
||||||
|
Page<OperateTask2TableVO> pageBo2PageVo(Page<OperateTask2TableBO> boPage); |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.bellmann.model.entity.DeviceLog; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-05 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface DeviceLogMapper extends BaseMapper<DeviceLog> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.bellmann.model.entity.OperateResult2; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface OperateResult2Mapper extends BaseMapper<OperateResult2> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.bo.OperateTask2TableBO; |
||||||
|
import com.bellmann.model.entity.OperateTask2; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface OperateTask2Mapper extends BaseMapper<OperateTask2> { |
||||||
|
|
||||||
|
Page<OperateTask2TableBO> tablePage(Page<OperateTask2TableBO> page, Long devId); |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.bellmann.model.bo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class DevOnlineStatus { |
||||||
|
|
||||||
|
private String devOnline; |
||||||
|
|
||||||
|
private String devOnline1; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.bellmann.model.bo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class OperateTask2TableBO { |
||||||
|
|
||||||
|
|
||||||
|
private Long operTaskId; |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private String userName; |
||||||
|
|
||||||
|
private String operTaskDesc; |
||||||
|
|
||||||
|
private String devAdNo; |
||||||
|
|
||||||
|
private Date operTaskCreateTime; |
||||||
|
|
||||||
|
private String resultState; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
package com.bellmann.model.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class ParamInfo { |
||||||
|
private String parameterName; |
||||||
|
private String actualValue; |
||||||
|
private String remarks; |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-05 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@TableName("itms_device_log") |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
public class DeviceLog implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@TableId(value = "dev_id", type = IdType.AUTO) |
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private Date operTime; |
||||||
|
|
||||||
|
private String operDesc; |
||||||
|
|
||||||
|
private String operName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@TableName("itms_oper_result_2") |
||||||
|
public class OperateResult2 implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@TableId(value = "oper_task_id", type = IdType.AUTO) |
||||||
|
private Long operTaskId; |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private Date operStartTime; |
||||||
|
|
||||||
|
private Date operEndTime; |
||||||
|
|
||||||
|
private String actionName; |
||||||
|
|
||||||
|
private String errorCode; |
||||||
|
|
||||||
|
private String errorDesc; |
||||||
|
|
||||||
|
private String resultState; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@TableName("itms_oper_task_2") |
||||||
|
public class OperateTask2 implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@TableId(value = "oper_task_id", type = IdType.AUTO) |
||||||
|
private Long operTaskId; |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private String userName; |
||||||
|
|
||||||
|
private String operTaskDesc; |
||||||
|
|
||||||
|
private Date operTaskCreateTime; |
||||||
|
|
||||||
|
private String operName; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import com.bellmann.model.dto.ParamInfo; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Schema(description = "设备操作日志视图") |
||||||
|
public class DeviceLogVO { |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") |
||||||
|
private Date operTime; |
||||||
|
|
||||||
|
private String description; |
||||||
|
|
||||||
|
private String operName; |
||||||
|
|
||||||
|
private List<ParamInfo> paramInfoList; |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@Schema(description = "设备任务列表视图") |
||||||
|
public class OperateTask2TableVO { |
||||||
|
|
||||||
|
private Long operTaskId; |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private String userName; |
||||||
|
|
||||||
|
private String operTaskDesc; |
||||||
|
|
||||||
|
private String devAdNo; |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") |
||||||
|
private Date operTaskCreateTime; |
||||||
|
|
||||||
|
private String resultState; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,55 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@Schema(description = "设备任务列表详细信息视图") |
||||||
|
public class OperateTask2VO { |
||||||
|
|
||||||
|
private Long operTaskId; |
||||||
|
|
||||||
|
private Long devId; |
||||||
|
|
||||||
|
private String userName; |
||||||
|
|
||||||
|
private String operTaskDesc; |
||||||
|
|
||||||
|
private String devSno; |
||||||
|
|
||||||
|
private String devPppoe; |
||||||
|
|
||||||
|
@JsonIgnore |
||||||
|
private Long systemDomain; |
||||||
|
|
||||||
|
private String domain; |
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") |
||||||
|
private Date operTaskCreateTime; |
||||||
|
|
||||||
|
private String resultState; |
||||||
|
|
||||||
|
private String errorCode; |
||||||
|
|
||||||
|
private String errorDesc; |
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") |
||||||
|
private Date operStartTime; |
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") |
||||||
|
private Date operEndTime; |
||||||
|
|
||||||
|
private String devTypeName; |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.model.vo.DeviceLogVO; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-05 |
||||||
|
*/ |
||||||
|
public interface DeviceLogService { |
||||||
|
|
||||||
|
PageResult<DeviceLogVO> page(BasePageQuery query, Long devId); |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
public interface OperateResult2Service { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.model.vo.OperateTask2TableVO; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
public interface OperateTask2Service { |
||||||
|
|
||||||
|
PageResult<OperateTask2TableVO> page(Long devId, BasePageQuery query); |
||||||
|
} |
@ -0,0 +1,91 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.common.util.CommonUtils; |
||||||
|
import com.bellmann.mapper.DeviceLogMapper; |
||||||
|
import com.bellmann.model.dto.ParamInfo; |
||||||
|
import com.bellmann.model.entity.DeviceLog; |
||||||
|
import com.bellmann.model.vo.DeviceLogVO; |
||||||
|
import com.bellmann.service.DeviceLogService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.jsoup.Jsoup; |
||||||
|
import org.jsoup.nodes.Document; |
||||||
|
import org.jsoup.nodes.Element; |
||||||
|
import org.jsoup.select.Elements; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-05 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class DeviceLogServiceImpl implements DeviceLogService { |
||||||
|
|
||||||
|
private final DeviceLogMapper deviceLogMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public PageResult<DeviceLogVO> page(BasePageQuery query, Long devId) { |
||||||
|
int pageNum = query.getPageNum(); |
||||||
|
int pageSize = query.getPageSize(); |
||||||
|
Page<DeviceLog> page = new Page<>(pageNum,pageSize); |
||||||
|
Page<DeviceLog> entityPage = deviceLogMapper.selectPage(page, new LambdaQueryWrapper<DeviceLog>() |
||||||
|
.eq(DeviceLog::getDevId, devId) |
||||||
|
.orderByDesc(DeviceLog::getOperTime) |
||||||
|
); |
||||||
|
List<DeviceLog> records = entityPage.getRecords(); |
||||||
|
List<DeviceLogVO> list = new ArrayList<>(); |
||||||
|
if (!records.isEmpty()){ |
||||||
|
list = records.stream().map(obj -> { |
||||||
|
DeviceLogVO deviceLogVO = new DeviceLogVO(); |
||||||
|
String desc = obj.getOperDesc(); |
||||||
|
String targetText = "parameter values :"; |
||||||
|
int startIndex = desc.indexOf(targetText); |
||||||
|
if (startIndex>0){ |
||||||
|
String paramValue = desc.substring(startIndex + targetText.length()).trim(); |
||||||
|
if (!paramValue.isEmpty()&& CommonUtils.containsHtmlTag(paramValue)){ |
||||||
|
desc = desc.substring(0,startIndex); |
||||||
|
deviceLogVO.setParamInfoList(parseHtmlToParamInfo(paramValue)); |
||||||
|
} |
||||||
|
} |
||||||
|
deviceLogVO.setDevId(obj.getDevId()); |
||||||
|
deviceLogVO.setOperTime(obj.getOperTime()); |
||||||
|
deviceLogVO.setDescription(desc); |
||||||
|
deviceLogVO.setOperName(obj.getOperName()); |
||||||
|
return deviceLogVO; |
||||||
|
}).collect(Collectors.toList()); |
||||||
|
} |
||||||
|
Page<DeviceLogVO> voPage = new Page<>(); |
||||||
|
voPage.setTotal(entityPage.getTotal()); |
||||||
|
voPage.setRecords(list); |
||||||
|
return PageResult.success(voPage); |
||||||
|
} |
||||||
|
|
||||||
|
private static List<ParamInfo> parseHtmlToParamInfo(String html){ |
||||||
|
List<ParamInfo> list = new ArrayList<>(); |
||||||
|
Document doc = Jsoup.parse(html); |
||||||
|
Element table = doc.select("table.tableFormTable").first(); |
||||||
|
assert table != null; |
||||||
|
Elements rows = table.select("tr"); |
||||||
|
for (int i = 2; i < rows.size(); i++) { |
||||||
|
ParamInfo paramInfo = new ParamInfo(); |
||||||
|
Elements cols = rows.get(i).select("td"); |
||||||
|
paramInfo.setParameterName(cols.get(0).text().trim()); |
||||||
|
paramInfo.setActualValue(cols.get(1).text().trim()); |
||||||
|
paramInfo.setRemarks(cols.get(2).text().trim()); |
||||||
|
list.add(paramInfo); |
||||||
|
} |
||||||
|
return list; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.bellmann.service.OperateResult2Service; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class OperateResult2ServiceImpl implements OperateResult2Service { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.converter.OperateTask2Converter; |
||||||
|
import com.bellmann.mapper.OperateTask2Mapper; |
||||||
|
import com.bellmann.model.bo.OperateTask2TableBO; |
||||||
|
import com.bellmann.model.vo.OperateTask2TableVO; |
||||||
|
import com.bellmann.service.OperateTask2Service; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-03 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class OperateTask2ServiceImpl implements OperateTask2Service { |
||||||
|
|
||||||
|
private final OperateTask2Mapper operateTask2Mapper; |
||||||
|
|
||||||
|
private final OperateTask2Converter operateTask2Converter; |
||||||
|
@Override |
||||||
|
public PageResult<OperateTask2TableVO> page(Long devId, BasePageQuery query) { |
||||||
|
int pageSize = query.getPageSize(); |
||||||
|
int pageNum = query.getPageNum(); |
||||||
|
Page<OperateTask2TableBO> page = new Page<>(pageNum,pageSize); |
||||||
|
Page<OperateTask2TableBO> boPage = operateTask2Mapper.tablePage(page,devId); |
||||||
|
return PageResult.success(operateTask2Converter.pageBo2PageVo(boPage)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
<?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="com.bellmann.mapper.DeviceLogMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.DeviceLog"> |
||||||
|
<id column="dev_id" property="devId" /> |
||||||
|
<result column="oper_time" property="operTime" /> |
||||||
|
<result column="oper_desc" property="operDesc" /> |
||||||
|
<result column="oper_name" property="operName" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!-- 通用查询结果列 --> |
||||||
|
<sql id="Base_Column_List"> |
||||||
|
dev_id, oper_time, oper_desc, oper_name |
||||||
|
</sql> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,22 @@ |
|||||||
|
<?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="com.bellmann.mapper.OperateResult2Mapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.OperateResult2"> |
||||||
|
<id column="oper_task_id" property="operTaskId" /> |
||||||
|
<result column="dev_id" property="devId" /> |
||||||
|
<result column="oper_start_time" property="operStartTime" /> |
||||||
|
<result column="oper_end_time" property="operEndTime" /> |
||||||
|
<result column="action_name" property="actionName" /> |
||||||
|
<result column="error_code" property="errorCode" /> |
||||||
|
<result column="error_desc" property="errorDesc" /> |
||||||
|
<result column="result_state" property="resultState" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!-- 通用查询结果列 --> |
||||||
|
<sql id="Base_Column_List"> |
||||||
|
oper_task_id, dev_id, oper_start_time, oper_end_time, action_name, error_code, error_desc, result_state |
||||||
|
</sql> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,62 @@ |
|||||||
|
<?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="com.bellmann.mapper.OperateTask2Mapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.OperateTask2"> |
||||||
|
<id column="oper_task_id" property="operTaskId" /> |
||||||
|
<result column="dev_id" property="devId" /> |
||||||
|
<result column="user_name" property="userName" /> |
||||||
|
<result column="oper_task_desc" property="operTaskDesc" /> |
||||||
|
<result column="oper_task_create_time" property="operTaskCreateTime" /> |
||||||
|
<result column="oper_name" property="operName" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!-- 通用查询结果列 --> |
||||||
|
<sql id="Base_Column_List"> |
||||||
|
oper_task_id, dev_id, user_name, oper_task_desc, oper_task_create_time, oper_name |
||||||
|
</sql> |
||||||
|
|
||||||
|
<select id="tablePage" resultType="com.bellmann.model.bo.OperateTask2TableBO"> |
||||||
|
SELECT |
||||||
|
aa.oper_task_id, |
||||||
|
aa.dev_id, |
||||||
|
aa.user_name, |
||||||
|
aa.oper_task_desc, |
||||||
|
aa.oper_task_create_time, |
||||||
|
bb.result_state, |
||||||
|
cc.dev_ad_no |
||||||
|
FROM |
||||||
|
itms_oper_task_2 aa |
||||||
|
INNER JOIN itms_oper_result_2 bb ON aa.oper_task_id = bb.oper_task_id |
||||||
|
INNER JOIN itms_device_static cc ON aa.dev_id = cc.dev_id |
||||||
|
WHERE |
||||||
|
aa.dev_id = #{devId} |
||||||
|
</select> |
||||||
|
<select id="operateTask2ByDevId" resultType="com.bellmann.model.vo.OperateTask2VO"> |
||||||
|
SELECT |
||||||
|
aa.oper_task_id, |
||||||
|
aa.dev_id, |
||||||
|
aa.user_name, |
||||||
|
aa.oper_task_desc, |
||||||
|
aa.oper_task_create_time, |
||||||
|
bb.result_state, |
||||||
|
cc.region_area_id, |
||||||
|
cc.dev_sno, |
||||||
|
cc.dev_pppoe, |
||||||
|
bb.error_code, |
||||||
|
bb.error_desc, |
||||||
|
bb.oper_start_time, |
||||||
|
bb.oper_end_time, |
||||||
|
dd.dev_type_name |
||||||
|
FROM |
||||||
|
itms_oper_task_2 aa |
||||||
|
INNER JOIN itms_oper_result_2 bb ON aa.dev_id = bb.dev_id |
||||||
|
INNER JOIN itms_device_static cc ON aa.dev_id = cc.dev_id |
||||||
|
LEFT JOIN itms_device_type_ver_detail dd ON cc.type_and_ver_id = dd.type_and_ver_id |
||||||
|
WHERE |
||||||
|
aa.oper_task_id = #{id} |
||||||
|
ORDER BY aa.OPER_TASK_CREATE_TIME DESC |
||||||
|
limit 1 |
||||||
|
</select> |
||||||
|
</mapper> |
Loading…
Reference in new issue