diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/api/DeptLineFeignClient.java b/pqs-device/device-api/src/main/java/com/njcn/device/api/DeptLineFeignClient.java index a97cb4e63..977de4ce3 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/api/DeptLineFeignClient.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/api/DeptLineFeignClient.java @@ -25,5 +25,5 @@ public interface DeptLineFeignClient { HttpResult selectDeptBindLines(@RequestParam("ids") List ids); @PostMapping("removeBind") - Integer removeBind(@RequestParam("id") String id); + HttpResult removeBind(@RequestParam("id") String id); } diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/api/LineFeignClient.java b/pqs-device/device-api/src/main/java/com/njcn/device/api/LineFeignClient.java index 622e5b6ee..2fd3da825 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/api/LineFeignClient.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/api/LineFeignClient.java @@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.response.HttpResult; import com.njcn.device.api.fallback.LineFeignClientFallbackFactory; import com.njcn.device.pojo.dto.*; +import com.njcn.device.pojo.param.LineBaseQueryParam; import com.njcn.device.pojo.po.Line; import com.njcn.device.pojo.po.LineDetail; import com.njcn.device.pojo.po.Overlimit; @@ -178,15 +179,23 @@ public interface LineFeignClient { /** * 区域监测点以及上级一些信息 * @param list 监测点id集合 - * @return + * @return AreaLineInfoVO */ @PostMapping("getBaseLineAreaInfo") HttpResult> getBaseLineAreaInfo(@RequestBody List list); + /** + * 获取丰富的监测点信息(扩展模糊查询) + * @param lineBaseQueryParam 监测点参数 + * @return AreaLineInfoVO + */ + @PostMapping("getRichLineInfo") + HttpResult> getRichLineInfo(@RequestBody LineBaseQueryParam lineBaseQueryParam); + /** * 获取监测点基本信息 * @param list 监测点id集合 - * @return + * @return Line */ @PostMapping("getBaseLineList") HttpResult> getBaseLineList(@RequestBody List list); @@ -220,4 +229,14 @@ public interface LineFeignClient { @PostMapping("getOnLineCount") HttpResult getOnLineCount(@RequestBody List lineIds); + /** + * 获取当前状态在线和离线的监测点 + * @param lineBaseQueryParam 监测点查询参数 + * @return 在线的监测点id集 + * @author cdf + * @date 2022/8/1 + */ + @PostMapping("getOnOrUnLine") + HttpResult> getOnOrUnLine(@RequestBody LineBaseQueryParam lineBaseQueryParam); + } diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/DeptLineFeignClientFallbackFactory.java b/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/DeptLineFeignClientFallbackFactory.java index d9c9dd7aa..805655f7f 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/DeptLineFeignClientFallbackFactory.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/DeptLineFeignClientFallbackFactory.java @@ -45,7 +45,7 @@ public class DeptLineFeignClientFallbackFactory implements FallbackFactory removeBind(String id) { log.error("{}异常,降级处理,异常为:{}", "部门解除绑定", throwable.toString()); throw new BusinessException(finalExceptionEnum); } diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/LineFeignClientFallbackFactory.java b/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/LineFeignClientFallbackFactory.java index 9d046b6c2..d95b25540 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/LineFeignClientFallbackFactory.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/api/fallback/LineFeignClientFallbackFactory.java @@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.response.HttpResult; import com.njcn.device.api.LineFeignClient; import com.njcn.device.pojo.dto.*; +import com.njcn.device.pojo.param.LineBaseQueryParam; import com.njcn.device.pojo.po.Line; import com.njcn.device.pojo.po.LineDetail; import com.njcn.device.pojo.po.Overlimit; @@ -139,7 +140,13 @@ public class LineFeignClientFallbackFactory implements FallbackFactory> getBaseLineAreaInfo(List list) { - log.error("{}异常,降级处理,异常为:{}", "获取监测点详情 ", throwable.toString()); + log.error("{}异常,降级处理,异常为:{}", "获取监测点详情异常 ", throwable.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult> getRichLineInfo(LineBaseQueryParam lineBaseQueryParam) { + log.error("{}异常,降级处理,异常为:{}", "获取监测点详情异常 ", throwable.toString()); throw new BusinessException(finalExceptionEnum); } @@ -163,7 +170,13 @@ public class LineFeignClientFallbackFactory implements FallbackFactory getOnLineCount(List lineIds) { - log.error("{}异常,降级处理,异常为:{}", "或取在线监测点数量异常: ", throwable.toString()); + log.error("{}异常,降级处理,异常为:{}", "获取在线监测点数量异常: ", throwable.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult> getOnOrUnLine( LineBaseQueryParam lineBaseQueryParam) { + log.error("{}异常,降级处理,异常为:{}", "获取当前状态在线和离线的监测点异常: ", throwable.toString()); throw new BusinessException(finalExceptionEnum); } diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java b/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java index 2409dbc1d..d70100c0c 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/enums/DeviceResponseEnum.java @@ -74,8 +74,8 @@ public enum DeviceResponseEnum { FLOW_FLAG("A0351","默认类型已存在"), FLOW_ERROR("A0352","占比参数异常"), - IMPORT_ORACLE_EXCEPTION("A0353","导入旧库台账异常") - + IMPORT_ORACLE_EXCEPTION("A0353","导入旧库台账异常"), + PARAM_VAL_ERR("A0354","参数校验异常") diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/DeviceInfoParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/DeviceInfoParam.java index 247558885..57e541af4 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/DeviceInfoParam.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/DeviceInfoParam.java @@ -30,11 +30,11 @@ public class DeviceInfoParam implements Serializable { /** * 统计类型 */ - @ApiModelProperty(name = "statisticalType", value = "统计类型") + @ApiModelProperty(name = "statisticalType", value = "统计类型",required = true) @NotNull(message = "统计类型不可为空") private SimpleDTO statisticalType; - @ApiModelProperty(name = "deptIndex", value = "部门索引") + @ApiModelProperty(name = "deptIndex", value = "部门索引",required = true) @NotBlank(message = "部门索引不可为空") private String deptIndex; @@ -69,7 +69,7 @@ public class DeviceInfoParam implements Serializable { */ @ApiModelProperty("网公司标识") @Range(min = 0, max = 2, message = "网公司标识" + ValidMessage.PARAM_FORMAT_ERROR) - private int monitorFlag; + private Integer monitorFlag; /** * 0-电网侧 @@ -77,7 +77,7 @@ public class DeviceInfoParam implements Serializable { */ @ApiModelProperty("电网侧标识") @Range(min = 0, max = 2, message = "电网侧标识" + ValidMessage.PARAM_FORMAT_ERROR) - private int powerFlag; + private Integer powerFlag; diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/LineBaseQueryParam.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/LineBaseQueryParam.java new file mode 100644 index 000000000..05043d6f0 --- /dev/null +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/param/LineBaseQueryParam.java @@ -0,0 +1,29 @@ +package com.njcn.device.pojo.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * pqs + * + * @author cdf + * @date 2022/8/9 + */ +@Data +public class LineBaseQueryParam { + + @NotEmpty(message = "监测点索引集合不可为空") + @ApiModelProperty(name = "lineIds",value = "监测点索引集合") + private List lineIds; + + + @ApiModelProperty(name = "comFlag",value = "通讯状态 0.离线 1.在线") + private Integer comFlag; + + @ApiModelProperty(name = "searchValue",value = "关键字搜索值") + private String searchValue; +} diff --git a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/AreaLineInfoVO.java b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/AreaLineInfoVO.java index e06097893..5b84fca3f 100644 --- a/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/AreaLineInfoVO.java +++ b/pqs-device/device-api/src/main/java/com/njcn/device/pojo/vo/AreaLineInfoVO.java @@ -56,6 +56,9 @@ public class AreaLineInfoVO implements Serializable { @ApiModelProperty(name = "pt2",value = "pt2") private Integer pt2; + @ApiModelProperty(name = "objName",value = "对象名称") + private String objName; + @ApiModelProperty(name = "runFlag",value = "运行状态") private Integer runFlag; @@ -73,4 +76,7 @@ public class AreaLineInfoVO implements Serializable { @ApiModelProperty(name = "manufacturer",value = "供应商名称") private String manufacturer; + + @ApiModelProperty(name = "loadType",value = "干扰源类型") + private String loadType; } diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/controller/DeptLineController.java b/pqs-device/device-boot/src/main/java/com/njcn/device/controller/DeptLineController.java index af2915570..e74993840 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/controller/DeptLineController.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/controller/DeptLineController.java @@ -91,9 +91,9 @@ public class DeptLineController extends BaseController { @PostMapping("/removeBind") @ApiOperation("部门解除绑定监测点") @ApiImplicitParam(name = "id", value = "部门id", required = true) - public Integer removeBind(@RequestParam("id") String id) { + public HttpResult removeBind(@RequestParam("id") String id) { String methodDescribe = getMethodDescribe("removeBind"); - return deptLineService.removeBind(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptLineService.removeBind(id), methodDescribe); } diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/controller/LineController.java b/pqs-device/device-boot/src/main/java/com/njcn/device/controller/LineController.java index 9a5e0fbb4..3068114fa 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/controller/LineController.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/controller/LineController.java @@ -3,13 +3,16 @@ package com.njcn.device.controller; import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.enums.common.LogEnum; 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.common.utils.HttpResultUtil; import com.njcn.common.utils.LogUtil; +import com.njcn.device.enums.DeviceResponseEnum; import com.njcn.device.mapper.DeviceMapper; import com.njcn.device.mapper.LineDetailMapper; import com.njcn.device.mapper.LineMapper; import com.njcn.device.pojo.dto.*; +import com.njcn.device.pojo.param.LineBaseQueryParam; import com.njcn.device.pojo.po.Device; import com.njcn.device.pojo.po.Line; import com.njcn.device.pojo.po.LineDetail; @@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import java.util.List; +import java.util.Objects; /** * @author denghuajun @@ -245,9 +249,23 @@ public class LineController extends BaseController { }) public HttpResult> getBaseLineAreaInfo(@RequestBody List lineIndex) { String methodDescribe = getMethodDescribe("getBaseLineAreaInfo"); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineService.getBaseLineAreaInfo(lineIndex), methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineService.getBaseLineAreaInfo(lineIndex,null,null), methodDescribe); } + /** + * 获取丰富的监测点信息(扩展模糊查询) + */ + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getRichLineInfo") + @ApiOperation("获取丰富的监测点信息(扩展模糊查询)") + @ApiImplicitParam(name = "lineBaseQueryParam", value = "监测点参数", required = true) + public HttpResult> getRichLineInfo(@RequestBody @Validated LineBaseQueryParam lineBaseQueryParam) { + String methodDescribe = getMethodDescribe("getRichLineInfo"); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineService.getBaseLineAreaInfo(lineBaseQueryParam.getLineIds(),lineBaseQueryParam.getSearchValue(),lineBaseQueryParam.getComFlag()), methodDescribe); + } + + + /** * 根据监测点ids获取监测点基本信息 * @author cdf @@ -255,7 +273,7 @@ public class LineController extends BaseController { */ @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getBaseLineList") - @ApiOperation("根据监测点ids获取监测点基本信息") + @ApiOperation("获取最基础的监测点信息") @ApiImplicitParam(name = "lineIndex", value = "监测点集合", required = true) public HttpResult> getBaseLineList(@RequestBody List lineIndex) { String methodDescribe = getMethodDescribe("getBaseLineList"); @@ -305,4 +323,26 @@ public class LineController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineMapper.getOnLineCount(lineIds), methodDescribe); } + /** + * 获取当前状态在线和离线的监测点 + * @param lineBaseQueryParam 监测点查询参数 + * @return 在线的监测点id集 + * @author cdf + * @date 2022/8/1 + */ + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getOnOrUnLine") + @ApiOperation("获取当前状态在线和离线的监测点") + @ApiImplicitParam(name = "lineBaseQueryParam", value = "监测点查询参数", required = true) + public HttpResult> getOnOrUnLine(@RequestBody @Validated LineBaseQueryParam lineBaseQueryParam) { + String methodDescribe = getMethodDescribe("getOnOrUnLine"); + if(Objects.isNull(lineBaseQueryParam.getComFlag())){ + throw new BusinessException(DeviceResponseEnum.PARAM_VAL_ERR); + } + List idsRes = lineMapper.getOnOrUnLine(lineBaseQueryParam.getLineIds(),lineBaseQueryParam.getComFlag()); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,idsRes, methodDescribe); + } + + + } diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java index 08a9be7c1..bb6a9b00a 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/LineMapper.java @@ -193,7 +193,7 @@ public interface LineMapper extends BaseMapper { * @param lineIndex 监测点结合 * @date 2022/6/29 */ - List getBaseLineAreaInfo(@Param("list")List lineIndex); + List getBaseLineAreaInfo(@Param("list")List lineIndex,@Param("searchValue")String searchValue,@Param("comFlag")Integer comFlag); /** * 返回监测点信息及通讯状态 @@ -321,7 +321,13 @@ public interface LineMapper extends BaseMapper { /** * 获取当前状态在线的监测点数量 - * @return 装置Id + * @return Integer 在线监测点数量 */ Integer getOnLineCount(@Param("lineIds")List lineIds); + + /** + * 获取当前状态在线和离线的监测点 + * @return 在线或离线监测点ids + */ + List getOnOrUnLine(@Param("list")List lineIds,@Param("comFlag")Integer comFlag); } diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml index a09e66579..4cd89c727 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/mapper/mapping/LineMapper.xml @@ -493,7 +493,9 @@ detail.ct1, detail.ct2, detail.pt1, - detail.pt2 + detail.pt2, + detail.obj_name, + loadtype.name loadType FROM pq_line line, pq_line_detail detail, @@ -520,11 +522,29 @@ AND substation.id = pqsubstation.id AND pqsubstation.Scale = subscale.id AND substation.pid = gd.id + AND detail.load_type = loadtype.id AND line.Id IN #{item} - GROUP BY line.id + + and (line.name like CONCAT('%', #{searchValue},'%') + or voltage.name like CONCAT('%', #{searchValue},'%') + or device.name like CONCAT('%', #{searchValue},'%') + or substation.name like CONCAT('%', #{searchValue},'%') + or gd.name like CONCAT('%', #{searchValue},'%')) + + + and (line.name like CONCAT('%', #{searchValue},'%') + or voltage.name like CONCAT('%', #{searchValue},'%') + or device.name like CONCAT('%', #{searchValue},'%') + or substation.name like CONCAT('%', #{searchValue},'%') + or gd.name like CONCAT('%', #{searchValue},'%')) + + + and pqdevice.com_flag = #{comFlag} + + + + diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/service/LineService.java b/pqs-device/device-boot/src/main/java/com/njcn/device/service/LineService.java index 6aff647e6..a5db41aa3 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/service/LineService.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/service/LineService.java @@ -132,7 +132,7 @@ public interface LineService { * @param lineIndex 监测点结合 * @date 2022/6/29 */ - List getBaseLineAreaInfo(List lineIndex); + List getBaseLineAreaInfo(List lineIndex,String searchValue,Integer comFlag); /** * 获取监测点基本信息 diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/LineServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/LineServiceImpl.java index 6a94b6505..73223d9b9 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/LineServiceImpl.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/LineServiceImpl.java @@ -661,8 +661,8 @@ public class LineServiceImpl extends ServiceImpl implements Li @Override - public List getBaseLineAreaInfo(List lineIndex) { - return this.baseMapper.getBaseLineAreaInfo(lineIndex); + public List getBaseLineAreaInfo(List lineIndex,String searchValue,Integer comFlag) { + return this.baseMapper.getBaseLineAreaInfo(lineIndex,searchValue,comFlag); } @Override diff --git a/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalTreeServiceImpl.java b/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalTreeServiceImpl.java index 98a5cafda..612dc8087 100644 --- a/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalTreeServiceImpl.java +++ b/pqs-device/device-boot/src/main/java/com/njcn/device/service/impl/TerminalTreeServiceImpl.java @@ -105,7 +105,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService { */ @Override public List getTerminalTreeForFive(DeviceInfoParam deviceInfoParam) { - deviceInfoParam.setDeptIndex(RequestUtil.getDeptIndex()); + //deviceInfoParam.setDeptIndex(RequestUtil.getDeptIndex()); List generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) { List taiZhang = new ArrayList<>(); diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java index 7ae3739a9..bec3163af 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/DeptServiceImpl.java @@ -89,7 +89,7 @@ public class DeptServiceImpl extends ServiceImpl implements ID Dept dept = new Dept(); BeanUtil.copyProperties(deptParam, dept); //进行先解绑,再新增 - Integer httpResult=deptLineFeignClient.removeBind(deptParam.getPid()); + Integer httpResult=deptLineFeignClient.removeBind(deptParam.getPid()).getData(); System.out.println(httpResult); if (deptParam.getPid().equals("-1")) { //上层节点