diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/api/EpdFeignClient.java b/pqs-system/system-api/src/main/java/com/njcn/system/api/EpdFeignClient.java index f840ca946..9d2dfb88e 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/api/EpdFeignClient.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/api/EpdFeignClient.java @@ -1,10 +1,18 @@ package com.njcn.system.api; +import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.enums.common.LogEnum; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.common.utils.LogUtil; import com.njcn.system.api.fallback.EpdFeignClientFallbackFactory; import com.njcn.system.pojo.param.EleEpdPqdParam; import com.njcn.system.pojo.po.EleEpdPqd; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; @@ -42,4 +50,7 @@ public interface EpdFeignClient { @PostMapping("/judgeExist") HttpResult> judgeExist(@RequestParam("name") String name,@RequestParam("dataType") String dataType); + + @PostMapping("/findByParam") + HttpResult findByParam(@RequestParam("name") String name, @RequestParam("dataType") String dataType, @RequestParam("phase") String phase); } diff --git a/pqs-system/system-api/src/main/java/com/njcn/system/api/fallback/EpdFeignClientFallbackFactory.java b/pqs-system/system-api/src/main/java/com/njcn/system/api/fallback/EpdFeignClientFallbackFactory.java index 0ae9320d0..44e211e4f 100644 --- a/pqs-system/system-api/src/main/java/com/njcn/system/api/fallback/EpdFeignClientFallbackFactory.java +++ b/pqs-system/system-api/src/main/java/com/njcn/system/api/fallback/EpdFeignClientFallbackFactory.java @@ -75,6 +75,12 @@ public class EpdFeignClientFallbackFactory implements FallbackFactory findByParam(String name, String dataType, String phase) { + log.error("{}异常,降级处理,异常为:{}","根据条件查询字典数据",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } }; } } diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/controller/EleEpdPqdController.java b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/EleEpdPqdController.java index 7abe5541f..b5d8f3ec4 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/controller/EleEpdPqdController.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/controller/EleEpdPqdController.java @@ -177,5 +177,20 @@ public class EleEpdPqdController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } + @PostMapping("/findByParam") + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @ApiOperation("根据条件查询字典数据") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "指标名称", required = true), + @ApiImplicitParam(name = "dataType", value = "数据模型", required = true), + @ApiImplicitParam(name = "phase", value = "相别", required = true) + }) + public HttpResult findByParam(@RequestParam("name") @Validated String name, @RequestParam("dataType") @Validated String dataType, @RequestParam("phase") @Validated String phase){ + String methodDescribe = getMethodDescribe("judgeExist"); + LogUtil.njcnDebug(log, "{},根据条件查询字典数据:", methodDescribe); + EleEpdPqd eleEpdPqd = eleEpdPqdService.findByParam(name,dataType,phase); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eleEpdPqd, methodDescribe); + } + } diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/IEleEpdPqdService.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/IEleEpdPqdService.java index e463a9b96..94bcdd4a9 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/service/IEleEpdPqdService.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/IEleEpdPqdService.java @@ -94,4 +94,13 @@ public interface IEleEpdPqdService extends IService { */ List judgeExist(String name, String dataType); + /** + * 根据条件查询字典数据 + * @param name + * @param dataType + * @param phase + * @return + */ + EleEpdPqd findByParam(String name, String dataType, String phase); + } diff --git a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/EleEpdPqdServiceImpl.java b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/EleEpdPqdServiceImpl.java index f330bada7..bb9731cee 100644 --- a/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/EleEpdPqdServiceImpl.java +++ b/pqs-system/system-boot/src/main/java/com/njcn/system/service/impl/EleEpdPqdServiceImpl.java @@ -199,6 +199,13 @@ public class EleEpdPqdServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(EleEpdPqd::getDataType,dataType).eq(EleEpdPqd::getName,name).eq(EleEpdPqd::getPhase,phase).eq(EleEpdPqd::getStatus,1); + return this.baseMapper.selectOne(lambdaQueryWrapper); + } + /** * 校验参数, * 1.检查是否存在相同名称的菜单