终端模块新增对外接口

This commit is contained in:
2022-08-12 16:00:41 +08:00
parent a178d230e9
commit 7e631b088d
16 changed files with 171 additions and 25 deletions

View File

@@ -25,5 +25,5 @@ public interface DeptLineFeignClient {
HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids);
@PostMapping("removeBind")
Integer removeBind(@RequestParam("id") String id);
HttpResult<Integer> removeBind(@RequestParam("id") String id);
}

View File

@@ -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<List<AreaLineInfoVO>> getBaseLineAreaInfo(@RequestBody List<String> list);
/**
* 获取丰富的监测点信息(扩展模糊查询)
* @param lineBaseQueryParam 监测点参数
* @return AreaLineInfoVO
*/
@PostMapping("getRichLineInfo")
HttpResult<List<AreaLineInfoVO>> getRichLineInfo(@RequestBody LineBaseQueryParam lineBaseQueryParam);
/**
* 获取监测点基本信息
* @param list 监测点id集合
* @return
* @return Line
*/
@PostMapping("getBaseLineList")
HttpResult<List<Line>> getBaseLineList(@RequestBody List<String> list);
@@ -220,4 +229,14 @@ public interface LineFeignClient {
@PostMapping("getOnLineCount")
HttpResult<Integer> getOnLineCount(@RequestBody List<String> lineIds);
/**
* 获取当前状态在线和离线的监测点
* @param lineBaseQueryParam 监测点查询参数
* @return 在线的监测点id集
* @author cdf
* @date 2022/8/1
*/
@PostMapping("getOnOrUnLine")
HttpResult<List<String>> getOnOrUnLine(@RequestBody LineBaseQueryParam lineBaseQueryParam);
}

View File

@@ -45,7 +45,7 @@ public class DeptLineFeignClientFallbackFactory implements FallbackFactory<DeptL
}
@Override
public Integer removeBind(String id) {
public HttpResult<Integer> removeBind(String id) {
log.error("{}异常,降级处理,异常为:{}", "部门解除绑定", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -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<LineFeign
@Override
public HttpResult<List<AreaLineInfoVO>> getBaseLineAreaInfo(List<String> list) {
log.error("{}异常,降级处理,异常为:{}", "获取监测点详情 ", throwable.toString());
log.error("{}异常,降级处理,异常为:{}", "获取监测点详情异常 ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<AreaLineInfoVO>> getRichLineInfo(LineBaseQueryParam lineBaseQueryParam) {
log.error("{}异常,降级处理,异常为:{}", "获取监测点详情异常 ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@@ -163,7 +170,13 @@ public class LineFeignClientFallbackFactory implements FallbackFactory<LineFeign
@Override
public HttpResult<Integer> getOnLineCount(List<String> lineIds) {
log.error("{}异常,降级处理,异常为:{}", "取在线监测点数量异常: ", throwable.toString());
log.error("{}异常,降级处理,异常为:{}", "取在线监测点数量异常: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<String>> getOnOrUnLine( LineBaseQueryParam lineBaseQueryParam) {
log.error("{}异常,降级处理,异常为:{}", "获取当前状态在线和离线的监测点异常: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}

View File

@@ -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","参数校验异常")

View File

@@ -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;

View File

@@ -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<String> lineIds;
@ApiModelProperty(name = "comFlag",value = "通讯状态 0.离线 1.在线")
private Integer comFlag;
@ApiModelProperty(name = "searchValue",value = "关键字搜索值")
private String searchValue;
}

View File

@@ -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;
}

View File

@@ -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<Integer> removeBind(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("removeBind");
return deptLineService.removeBind(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptLineService.removeBind(id), methodDescribe);
}

View File

@@ -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<List<AreaLineInfoVO>> getBaseLineAreaInfo(@RequestBody List<String> 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<List<AreaLineInfoVO>> 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<List<Line>> getBaseLineList(@RequestBody List<String> 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<List<String>> getOnOrUnLine(@RequestBody @Validated LineBaseQueryParam lineBaseQueryParam) {
String methodDescribe = getMethodDescribe("getOnOrUnLine");
if(Objects.isNull(lineBaseQueryParam.getComFlag())){
throw new BusinessException(DeviceResponseEnum.PARAM_VAL_ERR);
}
List<String> idsRes = lineMapper.getOnOrUnLine(lineBaseQueryParam.getLineIds(),lineBaseQueryParam.getComFlag());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,idsRes, methodDescribe);
}
}

View File

@@ -193,7 +193,7 @@ public interface LineMapper extends BaseMapper<Line> {
* @param lineIndex 监测点结合
* @date 2022/6/29
*/
List<AreaLineInfoVO> getBaseLineAreaInfo(@Param("list")List<String> lineIndex);
List<AreaLineInfoVO> getBaseLineAreaInfo(@Param("list")List<String> lineIndex,@Param("searchValue")String searchValue,@Param("comFlag")Integer comFlag);
/**
* 返回监测点信息及通讯状态
@@ -321,7 +321,13 @@ public interface LineMapper extends BaseMapper<Line> {
/**
* 获取当前状态在线的监测点数量
* @return 装置Id
* @return Integer 在线监测点数量
*/
Integer getOnLineCount(@Param("lineIds")List<String> lineIds);
/**
* 获取当前状态在线和离线的监测点
* @return 在线或离线监测点ids
*/
List<String> getOnOrUnLine(@Param("list")List<String> lineIds,@Param("comFlag")Integer comFlag);
}

View File

@@ -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
<foreach item="item" collection="list" separator="," open="(" close=")">
#{item}
</foreach>
GROUP BY line.id
<if test="searchValue!=null and 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},'%'))
</if>
<if test="searchValue!=null and 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},'%'))
</if>
<if test="comFlag!=null">
and pqdevice.com_flag = #{comFlag}
</if>
</select>
<select id="getLineDeviceStateVO" resultType="com.njcn.device.pojo.vo.LineDeviceStateVO">
@@ -906,4 +926,17 @@ FROM
#{item}
</foreach>
</select>
<select id="getOnOrUnLine" resultType="String">
select a.id from pq_line a
inner join pq_line b on a.pid = b.id
inner join pq_line c on b.pid =c.id
inner join pq_device d on c.id = d.id
where a.id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and d.com_flag = #{comFlag}
and a.state = 1
</select>
</mapper>

View File

@@ -132,7 +132,7 @@ public interface LineService {
* @param lineIndex 监测点结合
* @date 2022/6/29
*/
List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex);
List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex,String searchValue,Integer comFlag);
/**
* 获取监测点基本信息

View File

@@ -661,8 +661,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
@Override
public List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex) {
return this.baseMapper.getBaseLineAreaInfo(lineIndex);
public List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex,String searchValue,Integer comFlag) {
return this.baseMapper.getBaseLineAreaInfo(lineIndex,searchValue,comFlag);
}
@Override

View File

@@ -105,7 +105,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
*/
@Override
public List<TerminalTree> getTerminalTreeForFive(DeviceInfoParam deviceInfoParam) {
deviceInfoParam.setDeptIndex(RequestUtil.getDeptIndex());
//deviceInfoParam.setDeptIndex(RequestUtil.getDeptIndex());
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
List<TerminalTree> taiZhang = new ArrayList<>();

View File

@@ -89,7 +89,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> 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")) {
//上层节点