diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/SupvPlanParam.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/SupvPlanParam.java index 3727af210..4589b3d2a 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/SupvPlanParam.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/SupvPlanParam.java @@ -108,14 +108,14 @@ public class SupvPlanParam extends BaseParam { * 计划执行开始时间 */ @ApiModelProperty(value = "计划执行开始时间",required = true) - @DateTimeStrValid(message = "计划执行开始时间格式有误") + @DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss",message = "计划执行开始时间格式有误") private String effectStartTime; /** * 计划执行结束时间 */ @ApiModelProperty(value = "计划执行结束时间",required = true) - @DateTimeStrValid(message = "计划执行结束时间格式有误") + @DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss",message = "计划执行结束时间格式有误") private String effectEndTime; /** diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java index b108cc4cf..d8009a8b0 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvPlan.java @@ -104,16 +104,16 @@ public class SupvPlan extends BaseEntity { /** * 计划执行开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(updateStrategy = FieldStrategy.IGNORED) - private LocalDate effectStartTime; + private LocalDateTime effectStartTime; /** * 计划执行结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @TableField(updateStrategy = FieldStrategy.IGNORED) - private LocalDate effectEndTime; + private LocalDateTime effectEndTime; /** diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvPlanVO.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvPlanVO.java index 404dd9a35..b56997e13 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvPlanVO.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvPlanVO.java @@ -112,13 +112,15 @@ public class SupvPlanVO { * 计划执行开始时间 */ @ApiModelProperty(value = "计划执行开始时间",required = true) - private String effectStartTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime effectStartTime; /** * 计划执行结束时间 */ @ApiModelProperty(value = "计划执行结束时间",required = true) - private String effectEndTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime effectEndTime; /** * 报告出具时间 diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPlanServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPlanServiceImpl.java index 1de11c8c0..0f7581316 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPlanServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPlanServiceImpl.java @@ -82,10 +82,10 @@ public class SupvPlanServiceImpl extends ServiceImpl i supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); if(StrUtil.isNotBlank(supvPlanParam.getEffectEndTime())) { - supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime())); + supvPlan.setEffectEndTime(PubUtils.localDateTimeFormat(supvPlanParam.getEffectEndTime())); } if(StrUtil.isNotBlank(supvPlanParam.getEffectStartTime())) { - supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime())); + supvPlan.setEffectStartTime(PubUtils.localDateTimeFormat(supvPlanParam.getEffectStartTime())); } if(StrUtil.isNotBlank(supvPlanParam.getProblemOcTime())) { supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime())); @@ -113,10 +113,10 @@ public class SupvPlanServiceImpl extends ServiceImpl i BeanUtil.copyProperties(supvPlanParam, supvPlan); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); if(StrUtil.isNotBlank(supvPlanParam.getEffectEndTime())) { - supvPlan.setEffectEndTime(PubUtils.localDateFormat(supvPlanParam.getEffectEndTime())); + supvPlan.setEffectEndTime(PubUtils.localDateTimeFormat(supvPlanParam.getEffectEndTime())); } if(StrUtil.isNotBlank(supvPlanParam.getEffectStartTime())) { - supvPlan.setEffectStartTime(PubUtils.localDateFormat(supvPlanParam.getEffectStartTime())); + supvPlan.setEffectStartTime(PubUtils.localDateTimeFormat(supvPlanParam.getEffectStartTime())); } if(StrUtil.isNotBlank(supvPlanParam.getProblemOcTime())) { supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime())); diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java index 043368df9..4866e0580 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvPushGwServiceImpl.java @@ -167,7 +167,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { //监督对象类型 if (mapSubvObjType.containsKey(supvPlan.getSupvObjType())) { - supvPlan.setSupvType(String.format("%02d", mapSubvObjType.get(supvPlan.getSupvObjType()).getAlgoDescribe())); + supvPlan.setSupvObjType(String.format("%02d", mapSubvObjType.get(supvPlan.getSupvObjType()).getAlgoDescribe())); } //电站等级 @@ -461,8 +461,8 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { if (ObjectUtil.isNull(param)) { cb = new ContentBody(""); } else { - String s = JSON.toJSONString(param); - log.info(Thread.currentThread().getName() + "1.信息:" + JSON.toJSONString(param)); + String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT); + log.info(Thread.currentThread().getName() + "1.信息:" + s); cb = new ContentBody(s); } //ContentBody传递,要求使用post方式进行调用 @@ -511,6 +511,8 @@ public class SupvPushGwServiceImpl implements SupvPushGwService { //获取返回体 Map body = userEntity.getBody(); token = body.get("access_token").toString(); + }else{ + throw new BusinessException("获取数据token出现未知异常!请检查ip端口是否正确!"); } return token; } 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.检查是否存在相同名称的菜单