bug修改
This commit is contained in:
@@ -1,28 +0,0 @@
|
|||||||
package com.njcn.device.pq.api;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.device.pq.api.fallback.TerminalBaseClientFallbackFactory;
|
|
||||||
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
|
||||||
import com.njcn.device.pq.pojo.po.Line;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hongawen
|
|
||||||
* @version 1.0.0
|
|
||||||
* @date 2022年02月14日 14:02
|
|
||||||
*/
|
|
||||||
@FeignClient(value = ServerInfo.DEVICE, path = "/pqsTransformer", fallbackFactory = TerminalBaseClientFallbackFactory.class, contextId = "pqsTransformer")
|
|
||||||
public interface TransformerClient {
|
|
||||||
|
|
||||||
|
|
||||||
HttpResult<List<EntityLogicDTO>> getLogic();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.njcn.device.pq.api.fallback;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
|
||||||
import com.njcn.device.pq.api.TerminalBaseClient;
|
|
||||||
import com.njcn.device.pq.api.TransformerClient;
|
|
||||||
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
|
||||||
import com.njcn.device.pq.pojo.po.Line;
|
|
||||||
import feign.hystrix.FallbackFactory;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hongawen
|
|
||||||
* @version 1.0.0
|
|
||||||
* @date 2022年02月14日 14:03
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class TransformerClientFallbackFactory implements FallbackFactory<TransformerClient> {
|
|
||||||
@Override
|
|
||||||
public TransformerClient create(Throwable throwable) {
|
|
||||||
//判断抛出异常是否为解码器抛出的业务异常
|
|
||||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
|
||||||
if (throwable.getCause() instanceof BusinessException) {
|
|
||||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
|
||||||
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
|
||||||
}
|
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
|
||||||
return new TransformerClient()
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpResult<List<EntityLogicDTO>> getLogic() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -65,6 +65,9 @@ public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, E
|
|||||||
//初始化分页数据
|
//初始化分页数据
|
||||||
Page<EventTemplateVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
Page<EventTemplateVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||||
List<String> list = page.getRecords().stream().map(EventTemplateVO::getId).collect(Collectors.toList());
|
List<String> list = page.getRecords().stream().map(EventTemplateVO::getId).collect(Collectors.toList());
|
||||||
|
if(CollectionUtil.isEmpty(list)){
|
||||||
|
throw new BusinessException("查询模板为空");
|
||||||
|
}
|
||||||
List<TemplateRel> templateRels = templateRelMapper.selectRelevance(list);
|
List<TemplateRel> templateRels = templateRelMapper.selectRelevance(list);
|
||||||
if (CollectionUtil.isNotEmpty(templateRels)) {
|
if (CollectionUtil.isNotEmpty(templateRels)) {
|
||||||
// Map<String, String> map = templateRels.stream().collect(Collectors.toMap(TemplateRel::getRdId, TemplateRel::getRtId));
|
// Map<String, String> map = templateRels.stream().collect(Collectors.toMap(TemplateRel::getRdId, TemplateRel::getRtId));
|
||||||
|
|||||||
Reference in New Issue
Block a user