parent
8ff583812a
commit
d8fe0bb7aa
Binary file not shown.
Binary file not shown.
@ -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; |
||||||
|
} |
||||||
|
} |
@ -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…
Reference in new issue