1.灿能云代码调整
This commit is contained in:
@@ -153,4 +153,12 @@ public interface GeneralDeviceInfoClient {
|
||||
*/
|
||||
@PostMapping("/getTopMsgInfoByIds")
|
||||
HttpResult<List<TopMsgPO>> getTopMsgInfoByIds(@RequestBody OnlineRateParam param);
|
||||
|
||||
/**
|
||||
* 根据终端id集合获取总终端在线率
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getTotalOnlineRates")
|
||||
HttpResult<Float> getTotalOnlineRates(@RequestBody OnlineRateParam param);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,12 @@ public class GeneralDeviceInfoClientFallbackFactory implements FallbackFactory<G
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据topIds集合获取终端信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Float> getTotalOnlineRates(OnlineRateParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据终端id集合获取总终端在线率", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,5 +23,5 @@ public class RStatOnlinerateVO {
|
||||
|
||||
private Integer offlineMin;
|
||||
|
||||
private Integer onlineRate;
|
||||
private Float onlineRate;
|
||||
}
|
||||
|
||||
@@ -328,4 +328,12 @@ public class GeneralDeviceInfoController extends BaseController {
|
||||
List<TopMsgPO> runLineIds = generalDeviceService.getTopMsgInfoByIds(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,runLineIds,methodDescribe);
|
||||
}
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTotalOnlineRates")
|
||||
@ApiOperation("根据终端id集合获取总终端在线率")
|
||||
public HttpResult<Float> getTotalOnlineRates(@RequestBody OnlineRateParam param) {
|
||||
String methodDescribe = getMethodDescribe("getTotalOnlineRates");
|
||||
Float totalOnlineRates = onlineRateMapper.getTotalOnlineRates(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,totalOnlineRates,methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,12 @@ public interface RStatOnlinerateDMapper extends BaseMapper<RStatOnlinerateD> {
|
||||
* @return List<OnlineRate>
|
||||
*/
|
||||
List<RStatOnlinerateVO> getOnlineRateByDevIds(@Param("param") OnlineRateParam param);
|
||||
|
||||
/**
|
||||
* @Description: 根据终端id集合获取总终端在线lv
|
||||
* @param param
|
||||
* @Author: wr
|
||||
* @Date: 2024/1/5 13:47
|
||||
*/
|
||||
Float getTotalOnlineRates(@Param("param") OnlineRateParam param);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||
import com.njcn.device.pq.pojo.vo.LineFlowMealDetailVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -215,10 +215,10 @@
|
||||
GROUP BY r.dev_index
|
||||
</select>
|
||||
<select id="selectDevByIds" resultType="com.njcn.device.pq.pojo.vo.DevDetail">
|
||||
SELECT
|
||||
SELECT DISTINCT
|
||||
device.id as devIndex,
|
||||
gd.NAME as gdName,
|
||||
substation.NAME as bdzName,
|
||||
device.id as devIndex,
|
||||
device.NAME as devName,
|
||||
lineDetail.Line_Grade AS lineGrade,
|
||||
deviceDetail.Update_Time AS timeID,
|
||||
@@ -232,8 +232,8 @@
|
||||
pq_line gd,
|
||||
pq_device deviceDetail,
|
||||
pq_line_detail lineDetail
|
||||
WHERE
|
||||
<if test="ids!=null and ids.size()!=0">
|
||||
<where>
|
||||
<if test="ids!=null and ids.size()>0">
|
||||
device.id IN
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
@@ -245,6 +245,6 @@
|
||||
AND substation.pid = gd.id
|
||||
AND device.id = deviceDetail.id
|
||||
AND line.id = lineDetail.id
|
||||
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1426,12 +1426,12 @@
|
||||
</select>
|
||||
<select id="selectByIds" resultType="com.njcn.device.pq.pojo.vo.LineDetailVO$Detail">
|
||||
SELECT DISTINCT
|
||||
line.id as lineId,
|
||||
area.name as areaId,
|
||||
gd.NAME gdName,
|
||||
substation.NAME subName,
|
||||
device.id devId,
|
||||
device.NAME devName,
|
||||
line.id as lineId,
|
||||
line.NAME lineName,
|
||||
lineDetail.Time_Interval as timeInterval,
|
||||
lineDetail.PT_Type as ptType,
|
||||
@@ -1454,7 +1454,7 @@
|
||||
pq_device deviceDetail,
|
||||
pq_line_detail lineDetail,
|
||||
pq_voltage vg
|
||||
WHERE
|
||||
<where>
|
||||
line.pid = voltage.id
|
||||
AND voltage.pid = device.id
|
||||
AND device.pid = substation.id
|
||||
@@ -1463,12 +1463,13 @@
|
||||
AND device.id = deviceDetail.id
|
||||
AND line.id = lineDetail.id
|
||||
AND vg.Id = voltage.id
|
||||
<if test="ids!=null and ids.size()!=0">
|
||||
<if test="ids!=null and ids.size() > 0">
|
||||
AND line.id IN
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<select id="getOnlineRateByDevIds" resultType="com.njcn.device.pq.pojo.vo.RStatOnlinerateVO">
|
||||
select
|
||||
dev_index,
|
||||
sum(online_min)/(sum(online_min) + sum(offline_min))*100 as online_rate
|
||||
ROUND( sum(online_min)/(sum(online_min) + sum(offline_min))*100,2) as online_rate
|
||||
from r_stat_onlinerate_d
|
||||
<where>
|
||||
<if test="param!=null and param.ids != null and param.ids.size > 0">
|
||||
@@ -22,4 +22,24 @@
|
||||
</where>
|
||||
group by dev_index ;
|
||||
</select>
|
||||
<select id="getTotalOnlineRates" resultType="java.lang.Float">
|
||||
select
|
||||
ROUND( sum(online_min)/(sum(online_min) + sum(offline_min))*100,2) as online_rate
|
||||
from r_stat_onlinerate_d
|
||||
<where>
|
||||
<if test="param!=null and param.ids != null and param.ids.size > 0">
|
||||
AND dev_index IN
|
||||
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test=" param.startTime != null and param.startTime !=''">
|
||||
AND time_id >= #{param.startTime}
|
||||
</if>
|
||||
<if test="param.endTime != null and param.endTime != ''">
|
||||
AND time_id <= #{param.endTime}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByIds" resultType="com.njcn.device.pq.pojo.po.TopMsgPO">
|
||||
SELECT
|
||||
SELECT DISTINCT
|
||||
top_id as topId,
|
||||
dev.Id AS devId,
|
||||
city.NAME AS cityName,
|
||||
|
||||
Reference in New Issue
Block a user