master
李小林 8 months ago
parent 8ff583812a
commit d8fe0bb7aa
  1. BIN
      lib/oamapi.jar
  2. BIN
      lib/oamserver.jar
  3. 65
      pom.xml
  4. 22
      src/main/java/com/bellmann/common/enums/SoapDirectEnum.java
  5. 6
      src/main/java/com/bellmann/common/result/ResultCode.java
  6. 69
      src/main/java/com/bellmann/controller/DeviceSoapLogController.java
  7. 30
      src/main/java/com/bellmann/converter/DeviceSoapLogConverter.java
  8. 18
      src/main/java/com/bellmann/mapper/DeviceSoapLogMapper.java
  9. 34
      src/main/java/com/bellmann/model/entity/DeviceSoapLog.java
  10. 29
      src/main/java/com/bellmann/model/vo/DeviceSoapLogExportVO.java
  11. 29
      src/main/java/com/bellmann/model/vo/DeviceSoapLogVO.java
  12. 30
      src/main/java/com/bellmann/service/DeviceSoapLogService.java
  13. 90
      src/main/java/com/bellmann/service/impl/DeviceSoapLogServiceImpl.java
  14. 18
      src/main/resources/mapper/DeviceSoapLogMapper.xml

Binary file not shown.

Binary file not shown.

@ -187,7 +187,7 @@
<groupId>com.zznode.cap</groupId>
<artifactId>capapi</artifactId>
<scope>system</scope>
<version>1.0</version>
<version>2.0</version>
<systemPath>${project.basedir}/lib/capapi.jar</systemPath>
</dependency>
<dependency>
@ -204,6 +204,69 @@
<version>1.0</version>
<systemPath>${project.basedir}/lib/resourceapi.jar</systemPath>
</dependency>
<dependency>
<groupId>com.zznode.itms</groupId>
<artifactId>acsapi</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/acsapi.jar</systemPath>
</dependency>
<dependency>
<groupId>com.corba</groupId>
<artifactId>OB</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/OB.jar</systemPath>
</dependency>
<dependency>
<groupId>com.corba</groupId>
<artifactId>OBEvent</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/OBEvent.jar</systemPath>
</dependency>
<dependency>
<groupId>com.corba</groupId>
<artifactId>OBNaming</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/OBNaming.jar</systemPath>
</dependency>
<dependency>
<groupId>com.corba</groupId>
<artifactId>OBNotify</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/OBNotify.jar</systemPath>
</dependency>
<dependency>
<groupId>com.corba</groupId>
<artifactId>OBTime</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/OBTime.jar</systemPath>
</dependency>
<dependency>
<groupId>com.bellmann</groupId>
<artifactId>server</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/server.jar</systemPath>
</dependency>
<dependency>
<groupId>com.bellmann</groupId>
<artifactId>CloudApi</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/CloudApi.jar</systemPath>
</dependency>
<dependency>
<groupId>com.zznode.itms</groupId>
<artifactId>oamapi</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${project.basedir}/lib/oamapi.jar</systemPath>
</dependency>
</dependencies>
<build>

@ -0,0 +1,22 @@
package com.bellmann.common.enums;
import com.bellmann.common.base.IBaseEnum;
import lombok.Getter;
public enum SoapDirectEnum implements IBaseEnum<String> {
NORMAL("0","CPE-->ACS"),
SIGN_OUT("1","ACS-->CPE"),
;
@Getter
private String value;
@Getter
private String label;
SoapDirectEnum(String value, String label){
this.label = label;
this.value = value;
}
}

@ -113,7 +113,11 @@ public enum ResultCode implements IResultCode, Serializable {
LOGICID_ALREADY_UNBINDING_ORDER_ALREADY_EXIST("F0022","逻辑ID已解绑,工单已存在!" ),
UPDATE_DEVICE_FAILED("F0023", "更新设备信息失败"),
DEVICE_BINDING_FAILED("F0024","设备更换失败");
DEVICE_BINDING_FAILED("F0024","设备更换失败"),
THE_PARAMETER_CANNOT_BE_EMPTY("F0025","参数不能为空" ),
OAM_INTERFACE_ERROR("F0026", "调用OAM接口报错"),
ACS_INTERFACE_ERROR("F0028", "调用ACS接口报错");
@Override
public String getCode() {
return code;

@ -0,0 +1,69 @@
package com.bellmann.controller;
import com.alibaba.excel.EasyExcel;
import com.bellmann.common.base.BasePageQuery;
import com.bellmann.common.result.PageResult;
import com.bellmann.common.result.Result;
import com.bellmann.model.vo.DeviceSoapLogExportVO;
import com.bellmann.model.vo.DeviceSoapLogVO;
import com.bellmann.service.DeviceSoapLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author 李小林
* @since 2024-07-06
*/
@Tag(name = "24.SOAP包日志")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/device-soap-log/v1")
public class DeviceSoapLogController {
private final DeviceSoapLogService deviceSoapLogService;
@PostMapping("/page/{devId}")
@Operation(summary = "SOAP列表-page")
public PageResult<DeviceSoapLogVO> soapPage(@RequestBody BasePageQuery query, @PathVariable Long devId){
return PageResult.success(deviceSoapLogService.soapPage(query,devId));
}
@PutMapping("/start/{devId}")
@Operation(summary = "soap-开始")
public Result<String> soapStart(@PathVariable Long devId){
return deviceSoapLogService.soapStart(devId);
}
@PutMapping("/stop/{devId}")
@Operation(summary = "soap-结束")
public Result<String> soapEnd(@PathVariable Long devId){
return deviceSoapLogService.soapEnd(devId);
}
@PutMapping("/delete/{devId}")
@Operation(summary = "soap-结束")
public Result<String> soapDelete(@PathVariable Long devId){
return deviceSoapLogService.soapDelete(devId);
}
@Operation(summary = "导出SOAP")
@GetMapping("/_export/{devId}")
public void exportUsers(BasePageQuery query, HttpServletResponse response, @PathVariable Long devId) throws IOException {
String fileName = "SOAP.xlsx";
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
List<DeviceSoapLogExportVO> exportUserList = deviceSoapLogService.listExportSoaps(query,devId);
EasyExcel.write(response.getOutputStream(), DeviceSoapLogExportVO.class).sheet("SOAP")
.doWrite(exportUserList);
}
}

@ -0,0 +1,30 @@
package com.bellmann.converter;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bellmann.model.entity.DeviceSoapLog;
import com.bellmann.model.vo.DeviceSoapLogExportVO;
import com.bellmann.model.vo.DeviceSoapLogVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import java.util.List;
/**
* 用户对象转换器
*
*
* @since 2022/6/8
*/
@Mapper(componentModel = "spring")
public interface DeviceSoapLogConverter {
@Mappings({
@Mapping(target = "soapDirect", expression = "java(com.bellmann.common.base.IBaseEnum.getLabelByValue(entity.getSoapDirect(), com.bellmann.common.enums.SoapDirectEnum.class))"),
})
DeviceSoapLogVO entityPage2VoPage(DeviceSoapLog entity);
Page<DeviceSoapLogVO> entityPage2VoPage(Page<DeviceSoapLog> entityPage);
List<DeviceSoapLogExportVO> VO2Export(List<DeviceSoapLogVO> records);
}

@ -0,0 +1,18 @@
package com.bellmann.mapper;
import com.bellmann.model.entity.DeviceSoapLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author 李小林
* @since 2024-07-06
*/
@Mapper
public interface DeviceSoapLogMapper extends BaseMapper<DeviceSoapLog> {
}

@ -0,0 +1,34 @@
package com.bellmann.model.entity;
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-06
*/
@Data
@TableName("itms_device_soap_log")
@EqualsAndHashCode(callSuper = false)
public class DeviceSoapLog implements Serializable {
private static final long serialVersionUID = 1L;
private Date operTime;
private String soapDirect;
private String soapDesc;
private Long devId;
}

@ -0,0 +1,29 @@
package com.bellmann.model.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author 李小林
* @since 2024-07-06
*/
@Data
@ColumnWidth(20)
public class DeviceSoapLogExportVO {
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@ExcelProperty(value = "操作时间")
private Date operTime;
@ExcelProperty(value = "操作方向")
private String soapDirect;
@ExcelProperty(value = "描述")
private String soapDesc;
}

@ -0,0 +1,29 @@
package com.bellmann.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author 李小林
* @since 2024-07-06
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(description = "SOAP包列表视图")
public class DeviceSoapLogVO{
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
private Date operTime;
private String soapDirect;
private String soapDesc;
}

@ -0,0 +1,30 @@
package com.bellmann.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bellmann.common.base.BasePageQuery;
import com.bellmann.common.result.Result;
import com.bellmann.model.vo.DeviceSoapLogExportVO;
import com.bellmann.model.vo.DeviceSoapLogVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author 李小林
* @since 2024-07-06
*/
public interface DeviceSoapLogService {
Page<DeviceSoapLogVO> soapPage(BasePageQuery query, Long devId);
Result<String> soapStart(Long devId);
Result<String> soapEnd(Long devId);
Result<String> soapDelete(Long devId);
List<DeviceSoapLogExportVO> listExportSoaps(BasePageQuery query, Long devId);
}

@ -0,0 +1,90 @@
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.exception.BusinessException;
import com.bellmann.common.result.Result;
import com.bellmann.common.result.ResultCode;
import com.bellmann.converter.DeviceSoapLogConverter;
import com.bellmann.mapper.DeviceSoapLogMapper;
import com.bellmann.model.entity.DeviceSoapLog;
import com.bellmann.model.vo.DeviceSoapLogExportVO;
import com.bellmann.model.vo.DeviceSoapLogVO;
import com.bellmann.service.DeviceSoapLogService;
import com.zznode.itms.api.OAMManager;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author 李小林
* @since 2024-07-06
*/
@Service
@RequiredArgsConstructor
public class DeviceSoapLogServiceImpl implements DeviceSoapLogService {
private final DeviceSoapLogMapper deviceSoapLogMapper;
private final DeviceSoapLogConverter deviceSoapLogConverter;
@Override
public Page<DeviceSoapLogVO> soapPage(BasePageQuery query, Long devId) {
int pageNum = query.getPageNum();
int pageSize = query.getPageSize();
Page<DeviceSoapLog> page = new Page<>(pageNum,pageSize);
Page<DeviceSoapLog> entityPage = deviceSoapLogMapper.selectPage(page, new LambdaQueryWrapper<DeviceSoapLog>()
.eq(DeviceSoapLog::getDevId, devId)
);
return deviceSoapLogConverter.entityPage2VoPage(entityPage);
}
@Override
public Result<String> soapStart(Long devId) {
if (devId==null){
throw new BusinessException(ResultCode.THE_PARAMETER_CANNOT_BE_EMPTY);
}
try {
OAMManager.startSoapMonitor(devId);
return Result.success();
}catch (Exception e){
throw new BusinessException(ResultCode.OAM_INTERFACE_ERROR);
}
}
@Override
public Result<String> soapEnd(Long devId) {
if (devId==null){
throw new BusinessException(ResultCode.THE_PARAMETER_CANNOT_BE_EMPTY);
}
try {
OAMManager.stopSoapMonitor(devId);
return Result.success();
}catch (Exception e){
throw new BusinessException(ResultCode.OAM_INTERFACE_ERROR);
}
}
@Override
public Result<String> soapDelete(Long devId) {
if (devId==null){
throw new BusinessException(ResultCode.THE_PARAMETER_CANNOT_BE_EMPTY);
}
deviceSoapLogMapper.delete(new LambdaQueryWrapper<DeviceSoapLog>()
.eq(DeviceSoapLog::getDevId,devId)
);
return Result.success();
}
@Override
public List<DeviceSoapLogExportVO> listExportSoaps(BasePageQuery query, Long devId) {
List<DeviceSoapLogVO> records = soapPage(query, devId).getRecords();
return deviceSoapLogConverter.VO2Export(records);
}
}

@ -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.DeviceSoapLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.DeviceSoapLog">
<id column="oper_time" property="operTime" />
<result column="soap_direct" property="soapDirect" />
<result column="soap_desc" property="soapDesc" />
<result column="dev_id" property="devId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
oper_time, soap_direct, soap_desc, dev_id
</sql>
</mapper>
Loading…
Cancel
Save