Merge branch 'master' of http://192.168.1.13:3000/root/pqs
# Conflicts: # pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsSimpleDTO.java # pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/controller/ledgerManger/SubstationExpendController.java # pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/MonitorMapper.xml # pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java # pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/CommunicateParam.java # pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/DeviceInfoParam.java # pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/CommunicateVO.java # pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml # pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationExpendService.java # pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java # pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/WaveTypeParam.java
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.njcn.algorithm.api;
|
||||
|
||||
import com.njcn.algorithm.api.fallback.CsEdDataFeignClientFallbackFactory;
|
||||
import com.njcn.algorithm.pojo.po.CsEdDataPO;
|
||||
import com.njcn.algorithm.pojo.vo.CsEdDataVO;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.ALGORITHM_BOOT, path = "/edData", fallbackFactory = CsEdDataFeignClientFallbackFactory.class,contextId = "edData")
|
||||
public interface CsEdDataFeignClient {
|
||||
|
||||
@PostMapping("/findByDevTypeId")
|
||||
HttpResult<CsEdDataVO> findByDevTypeId(@RequestParam("devType") String devType);
|
||||
|
||||
@PostMapping("/getAll")
|
||||
HttpResult<List<CsEdDataPO>> getAll(@RequestParam("devType") String devType);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.algorithm.api.fallback;
|
||||
|
||||
import com.njcn.algorithm.api.CsEdDataFeignClient;
|
||||
import com.njcn.algorithm.pojo.po.CsEdDataPO;
|
||||
import com.njcn.algorithm.pojo.vo.CsEdDataVO;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsEdDataFeignClientFallbackFactory implements FallbackFactory<CsEdDataFeignClient> {
|
||||
@Override
|
||||
public CsEdDataFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsEdDataFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEdDataVO> findByDevTypeId(String devType) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置型号获取装置类型",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsEdDataPO>> getAll(String devType) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置型号获取装置类型",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -24,6 +26,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "cs_ed_data")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CsEdDataPO extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
@@ -83,4 +86,10 @@ public class CsEdDataPO extends BaseEntity {
|
||||
@TableField(value = "file_path")
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 装置类型
|
||||
*/
|
||||
@TableField(value = "type")
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -77,4 +77,7 @@ public class CsEdDataVO extends BaseEntity {
|
||||
@ApiModelProperty(value = ".bin文件")
|
||||
private String filePath;
|
||||
|
||||
@ApiModelProperty(value = "type")
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -74,8 +74,8 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryEquipmentByndid")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryEquipmentByndid")
|
||||
@ApiOperation("通过ndid查询出厂设备")
|
||||
@ApiImplicitParam(name = "ndid", value = "网关识别码", required = true)
|
||||
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid")String ndid){
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.algorithm.pojo.param.CsEdDataAddParm;
|
||||
import com.njcn.algorithm.pojo.param.CsEdDataAuditParm;
|
||||
import com.njcn.algorithm.pojo.param.CsEdDataQueryParm;
|
||||
import com.njcn.algorithm.pojo.po.CsDictPO;
|
||||
import com.njcn.algorithm.pojo.po.CsEdDataPO;
|
||||
import com.njcn.algorithm.pojo.vo.CsEdDataVO;
|
||||
import com.njcn.algorithm.service.CsEdDataService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -18,10 +20,10 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -72,4 +74,14 @@ public class CsEdDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/findByDevTypeId")
|
||||
@ApiOperation("根据装置型号获取装置类型")
|
||||
@ApiImplicitParam(name = "devType", value = "装置型号", required = true)
|
||||
public HttpResult<CsEdDataVO> findByDevTypeId(@Validated @RequestParam("devType") String devType){
|
||||
String methodDescribe = getMethodDescribe("findByDevTypeId");
|
||||
CsEdDataVO vo = csEdDataService.findByDevTypeId(devType);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.njcn.algorithm.pojo.po.CsEdDataPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.algorithm.pojo.vo.CsEdDataVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
@@ -42,5 +44,11 @@ public interface CsEdDataService extends IService<CsEdDataPO> {
|
||||
* @Date: 2023/4/7
|
||||
*/
|
||||
IPage<CsEdDataVO> queryEdDataPage(CsEdDataQueryParm csEdDataQueryParm);
|
||||
|
||||
/**
|
||||
* @Description: 根据装置型号获取装置类型
|
||||
* @author: xuyang
|
||||
*/
|
||||
CsEdDataVO findByDevTypeId(String devType);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.algorithm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -16,7 +17,10 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -66,5 +70,20 @@ public class CsEdDataServiceImpl extends ServiceImpl<CsEdDataMapper, CsEdDataPO>
|
||||
returnpage = this.getBaseMapper ().getPage(returnpage,csEdDataQueryParm);
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsEdDataVO findByDevTypeId(String devType) {
|
||||
CsEdDataPO csEdDataPo = new CsEdDataPO();
|
||||
LambdaQueryWrapper<CsEdDataPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getDevType,devType);
|
||||
lambdaQueryWrapper.eq(CsEdDataPO::getStatus,1);
|
||||
List<CsEdDataPO> list = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
csEdDataPo = list.get(0);
|
||||
}
|
||||
CsEdDataVO csEdDataVo = new CsEdDataVO();
|
||||
BeanUtils.copyProperties(csEdDataPo,csEdDataVo);
|
||||
return csEdDataVo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
public CsEquipmentDeliveryPO queryEquipmentPOByndid(String ndid) {
|
||||
QueryWrapper<CsEquipmentDeliveryPO> wrapper = new QueryWrapper();
|
||||
wrapper.eq ("ndid", ndid);
|
||||
wrapper.eq("status",2);
|
||||
wrapper.eq("status",1);
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = this.baseMapper.selectOne (wrapper);
|
||||
return csEquipmentDeliveryPO;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user