parent
47ff18e96e
commit
4d9910bbc8
@ -0,0 +1,39 @@ |
||||
package com.bellmann.controller; |
||||
|
||||
import com.bellmann.common.result.Result; |
||||
import com.bellmann.model.query.FaultQuery; |
||||
import com.bellmann.model.vo.FaultBasicInfoVO; |
||||
import com.bellmann.model.vo.FaultQueryVO; |
||||
import com.bellmann.service.FaultService; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Tag(name = "33.故障管理") |
||||
@RestController |
||||
@RequestMapping("/api/fault/v1") |
||||
@RequiredArgsConstructor |
||||
public class FaultController { |
||||
|
||||
private final FaultService faultService; |
||||
|
||||
@Operation(summary = "故障管理查询") |
||||
@PostMapping("/query") |
||||
public Result<List<FaultQueryVO>> queryList(@RequestBody FaultQuery query){ |
||||
List<FaultQueryVO> list = faultService.queryList(query); |
||||
return Result.success(list); |
||||
} |
||||
|
||||
@Operation(summary = "基本信息查询") |
||||
@PostMapping("/basic_info") |
||||
public Result<FaultBasicInfoVO> basicInfoQuery(@RequestBody FaultQuery query){ |
||||
FaultBasicInfoVO faultBasicInfoVO = faultService.basicInfoQuery(query); |
||||
return Result.success(faultBasicInfoVO); |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.bellmann.model.query; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class FaultQuery { |
||||
private String value; |
||||
|
||||
private String label; |
||||
|
||||
private String[] ping; |
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.bellmann.model.vo; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class FaultBasicInfoVO { |
||||
|
||||
private Long devId; |
||||
@JsonIgnore |
||||
private Long typeAndVerId; |
||||
|
||||
@JsonIgnore |
||||
private Long custId; |
||||
|
||||
private String devPppoe; |
||||
|
||||
private String devVendorName; |
||||
|
||||
private String devTypeName; |
||||
|
||||
private String devHardVer; |
||||
|
||||
private String userSnNo; |
||||
|
||||
private String customType; |
||||
|
||||
private String devIp; |
||||
|
||||
private String devStatus; |
||||
|
||||
private String devAccessType; |
||||
|
||||
private String devSno; |
||||
|
||||
private String softVer; |
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.bellmann.model.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class FaultQueryVO { |
||||
|
||||
private Long devId; |
||||
|
||||
private String devSno; |
||||
|
||||
private String devPppoe; |
||||
|
||||
private String devVendorOui; |
||||
|
||||
private String devAdNo; |
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.bellmann.service; |
||||
|
||||
import com.bellmann.model.query.FaultQuery; |
||||
import com.bellmann.model.vo.FaultBasicInfoVO; |
||||
import com.bellmann.model.vo.FaultQueryVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface FaultService { |
||||
List<FaultQueryVO> queryList(FaultQuery query); |
||||
|
||||
FaultBasicInfoVO basicInfoQuery(FaultQuery query); |
||||
} |
@ -0,0 +1,62 @@ |
||||
package com.bellmann.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.bellmann.common.base.IBaseEnum; |
||||
import com.bellmann.common.enums.CustomTypeEnum; |
||||
import com.bellmann.common.enums.DevAccessTypeEnum; |
||||
import com.bellmann.common.enums.DevStatusEnum; |
||||
import com.bellmann.manger.CustomerManager; |
||||
import com.bellmann.mapper.DeviceStaticMapper; |
||||
import com.bellmann.mapper.DeviceTypeVerDetailMapper; |
||||
import com.bellmann.model.entity.Customer; |
||||
import com.bellmann.model.entity.DeviceTypeVerDetail; |
||||
import com.bellmann.model.query.FaultQuery; |
||||
import com.bellmann.model.vo.FaultBasicInfoVO; |
||||
import com.bellmann.model.vo.FaultQueryVO; |
||||
import com.bellmann.service.FaultService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Service |
||||
@RequiredArgsConstructor |
||||
public class FaultServiceImpl implements FaultService { |
||||
|
||||
private final DeviceStaticMapper deviceStaticMapper; |
||||
|
||||
private final CustomerManager customerManager; |
||||
|
||||
private final DeviceTypeVerDetailMapper deviceTypeVerDetailMapper; |
||||
|
||||
@Override |
||||
public List<FaultQueryVO> queryList(FaultQuery query) { |
||||
return deviceStaticMapper.faultQueryList(query.getLabel(), query.getValue()); |
||||
} |
||||
|
||||
@Override |
||||
public FaultBasicInfoVO basicInfoQuery(FaultQuery query) { |
||||
FaultBasicInfoVO faultBasicInfoQuery = deviceStaticMapper.faultBasicInfoQuery(query.getLabel(), query.getValue()); |
||||
Long customId = faultBasicInfoQuery.getCustId(); |
||||
if (customId != null) { |
||||
Customer customer = customerManager.findByCustomId(customId); |
||||
if (customer != null) { |
||||
faultBasicInfoQuery.setCustomType(IBaseEnum.getLabelByValue(customer.getCustomType(), CustomTypeEnum.class)); |
||||
} |
||||
} |
||||
Long typeAndVerId = faultBasicInfoQuery.getTypeAndVerId(); |
||||
if (typeAndVerId != null) { |
||||
DeviceTypeVerDetail deviceTypeVerDetail = deviceTypeVerDetailMapper.selectOne(new LambdaQueryWrapper<DeviceTypeVerDetail>() |
||||
.eq(DeviceTypeVerDetail::getTypeAndVerId, typeAndVerId) |
||||
); |
||||
if (deviceTypeVerDetail != null) { |
||||
faultBasicInfoQuery.setDevAccessType(IBaseEnum.getLabelByValue(deviceTypeVerDetail.getDevAccessType(), DevAccessTypeEnum.class)); |
||||
} |
||||
} |
||||
String devStatus = faultBasicInfoQuery.getDevStatus(); |
||||
if (devStatus!=null){ |
||||
faultBasicInfoQuery.setDevStatus(IBaseEnum.getLabelByValue(devStatus, DevStatusEnum.class)); |
||||
} |
||||
return faultBasicInfoQuery; |
||||
} |
||||
} |
Loading…
Reference in new issue