sql字段修改前端联调

This commit is contained in:
zhuxinyu
2023-04-07 10:11:53 +08:00
parent a4363bf37b
commit b06916b5ea
10 changed files with 87 additions and 16 deletions

View File

@@ -24,7 +24,11 @@ import java.util.List;
* @version 1.0.0
* @date 2022年02月14日 14:02
*/
@FeignClient(value = ServerInfo.DEVICE, path = "/deviceInfo", fallbackFactory = GeneralDeviceInfoClientFallbackFactory.class, contextId = "deviceInfo")
@FeignClient(
value = ServerInfo.DEVICE,
path = "/deviceInfo",
fallbackFactory = GeneralDeviceInfoClientFallbackFactory.class,
contextId = "deviceInfo")
public interface GeneralDeviceInfoClient {

View File

@@ -22,7 +22,11 @@ import java.util.Map;
* @author denghuajun
* @date 2022/2/28
*/
@FeignClient(value = ServerInfo.DEVICE, path = "/line", fallbackFactory = LineFeignClientFallbackFactory.class, contextId = "line")
@FeignClient(
value = ServerInfo.DEVICE,
path = "/line",
fallbackFactory = LineFeignClientFallbackFactory.class,
contextId = "line")
public interface LineFeignClient {
/**
@@ -304,4 +308,7 @@ public interface LineFeignClient {
*/
@PostMapping("/getOnIntegrityByIds")
HttpResult<List<RStatIntegrityVO>> getOnIntegrityByIds(@RequestBody OnlineRateParam param);
@PostMapping("getOnIntegrityByIdsAndTime")
HttpResult<List<RStatIntegrityVO>> getOnIntegrityByIdsAndTime(@RequestBody LineBaseQueryParam param);
}

View File

@@ -224,10 +224,13 @@ public class LineFeignClientFallbackFactory implements FallbackFactory<LineFeign
public HttpResult<List<RStatIntegrityVO>> getOnIntegrityByIds(OnlineRateParam param) {
log.error("{}异常,降级处理,异常为:{}", "获取监测点数据完整率(谐波专用): ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<RStatIntegrityVO>> getOnIntegrityByIdsAndTime(LineBaseQueryParam param) {
log.error("{}异常,降级处理,异常为:{}", "获取监测点数据完整率: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -25,4 +25,10 @@ public class LineBaseQueryParam {
@ApiModelProperty(name = "searchValue",value = "关键字搜索值")
private String searchValue;
@ApiModelProperty(name = "startTime", value = "开始时间")
private String startTime;
@ApiModelProperty(name = "endTime", value = "结束时间")
private String endTime;
}

View File

@@ -6,12 +6,15 @@ 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.device.pq.mapper.RStatOnlinerateDMapper;
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.vo.DeptDeviceDetailVO;
import com.njcn.device.pq.pojo.vo.DeptSubstationDetailVO;
import com.njcn.device.pq.pojo.vo.ExceptionDeviceInfoVO;
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.device.pq.service.TerminalBaseService;
import com.njcn.device.pq.service.impl.GeneralDeviceService;
import com.njcn.web.controller.BaseController;
@@ -48,6 +51,7 @@ public class GeneralDeviceInfoController extends BaseController {
private final TerminalBaseService terminalBaseService;
private final RStatOnlinerateDMapper onlineRateMapper;
/**
* 获取按部门分类的实际运行终端综合信息
*/
@@ -266,4 +270,14 @@ public class GeneralDeviceInfoController extends BaseController {
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getOnlineRateByDevIds")
@ApiOperation("终端在线率(谐波专用)")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param) {
String methodDescribe = getMethodDescribe("getOnlineRateByDevIds");
List<RStatOnlinerateVO> onlineRateByDevIds = onlineRateMapper.getOnlineRateByDevIds(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,onlineRateByDevIds,methodDescribe);
}
}

View File

@@ -45,18 +45,15 @@ public class LineController extends BaseController {
private final LineService lineService;
private final GeneralDeviceService generalDeviceService;
private final DeviceMapper deviceMapper;
private final LineMapper lineMapper;
private final LineDetailMapper lineDetailMapper;
private final DeptFeignClient deptFeignClient;
private final RStatIntegrityDMapper integrityDMapper;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getLineDetailData")
@ApiOperation("根据监测点id获取监测点详情")
@@ -421,4 +418,14 @@ public class LineController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,onIntegrityByIds,methodDescribe);
}
@PostMapping("/getOnIntegrityByIdsAndTime")
@ApiOperation("监测点数据完整率")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<List<RStatIntegrityVO>> getOnIntegrityByIdsAndTime(@RequestBody LineBaseQueryParam param) {
String methodDescribe = getMethodDescribe("getOnIntegrityByIdsAndTime");
List<RStatIntegrityVO> onIntegrityByIds = integrityDMapper.getOnIntegrityByIdsAndTime (param.getLineIds(),param.getStartTime(),param.getEndTime());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,onIntegrityByIds,methodDescribe);
}
}

View File

@@ -2,6 +2,7 @@ package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.LineDataIntegrity;
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
@@ -36,4 +37,6 @@ public interface RStatIntegrityDMapper extends BaseMapper<RStatIntegrityD> {
* @return List<OnlineRate>
*/
List<RStatIntegrityVO> getOnIntegrityByIds(@Param("param") OnlineRateParam param);
List<RStatIntegrityVO> getOnIntegrityByIdsAndTime (@Param("list")List<String> lineIds,@Param("startTime")String startTime,@Param("endTime")String endTime);
}

View File

@@ -24,7 +24,7 @@
r_stat_integrity_d
<where>
<if test="param!=null and param.ids != null and param.ids.size > 0">
AND Dev_Id IN
AND line_index IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
@@ -38,4 +38,29 @@
</where>
group by line_index ;
</select>
<select id="getOnIntegrityByIdsAndTime" resultType="com.njcn.device.pq.pojo.vo.RStatIntegrityVO">
SELECT
line_index AS lineIndex,
sum( real_time )/ sum( due_time )* 100 AS integrityRate
FROM
r_stat_integrity_d
<where>
<if test="list.size > 0">
AND line_index IN
<foreach collection='list' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="startTime != null and startTime !=''">
AND time_id >= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND time_id &lt;= #{endTime}
</if>
</where>
group by line_index ;
</select>
</mapper>

View File

@@ -8,7 +8,7 @@
from r_stat_onlinerate_d
<where>
<if test="param!=null and param.ids != null and param.ids.size > 0">
AND Dev_Id IN
AND dev_index IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>

View File

@@ -11,7 +11,9 @@ import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
import com.njcn.harmonic.mapper.IntegrityMapper;
import com.njcn.harmonic.pojo.dto.PublicDTO;
@@ -346,11 +348,6 @@ public class IntegrityServiceImpl implements IntegrityService {
}
/**
* influxDB相关操作
* 查询监测点的数据完整性
* 前端要求: 返回百分比数据
*/
private List<PublicDTO> getCondition(List<String> lineList, String startTime, String endTime) {
List<PublicDTO> integrityList = new ArrayList<>();
OnlineRateParam param = new OnlineRateParam();
@@ -358,7 +355,12 @@ public class IntegrityServiceImpl implements IntegrityService {
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(startTime)).toString());
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(endTime)).toString());
List<RStatIntegrityVO> data = lineFeignClient.getOnIntegrityByIds(param).getData();
// LineBaseQueryParam param = new LineBaseQueryParam();
// param.setLineIds(lineList);
// param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(startTime)).toString());
// param.setEndTime(DateUtil.endOfDay(DateUtil.parse(endTime)).toString());
// List<RStatIntegrityVO> data = lineFeignClient.getOnIntegrityByIdsAndTime(param).getData();
// List<String> data = lineFeignClient.getOnOrUnLine(param).getData()
if (!CollectionUtils.isEmpty(data)) {
data.forEach(po -> {
PublicDTO publicDTO = new PublicDTO();