Commit 5976382e authored by zhangsen's avatar zhangsen

飞书 bug修改

parent 6c76c951
...@@ -202,7 +202,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -202,7 +202,7 @@ public class BigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception { public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea(); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea();
Map<String, Integer> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", "")))); Map<String, Object> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> t.get("healthIndex")));
// List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区"); // List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区");
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
...@@ -220,7 +220,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -220,7 +220,7 @@ public class BigScreenAnalyseController extends BaseController {
} }
list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList()); list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList());
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
list.forEach(item -> seriesData.add(collect.getOrDefault(item, 100))); list.forEach(item -> seriesData.add(collect.getOrDefault(item, 100.0)));
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
......
...@@ -4,6 +4,7 @@ import static com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_TIME_PATTERN ...@@ -4,6 +4,7 @@ import static com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_TIME_PATTERN
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -121,22 +122,23 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -121,22 +122,23 @@ public class TDBigScreenAnalyseController extends BaseController {
@Autowired @Autowired
private IdxBizPvWarningRuleSetServiceImpl idxBizPvWarningRuleSetService; private IdxBizPvWarningRuleSetServiceImpl idxBizPvWarningRuleSetService;
public final DecimalFormat df = new DecimalFormat("#.0");
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘")
@GetMapping(value = "/getHealthScoreInfo") @GetMapping(value = "/getHealthScoreInfo")
public ResponseModel<Map<String, Integer>> getHealthScoreInfo(@RequestParam(required = false) String areaCode, public ResponseModel<Map<String, Object>> getHealthScoreInfo(@RequestParam(required = false) String areaCode,
@RequestParam(required = false) String stationCode, @RequestParam(required = false) String tableName) { @RequestParam(required = false) String stationCode, @RequestParam(required = false) String tableName) {
HashMap<String, Integer> stringBigDecimalHashMap = new HashMap<>(); HashMap<String, Object> stringBigDecimalHashMap = new HashMap<>();
if (CharSequenceUtil.isNotEmpty(stationCode)) { if (CharSequenceUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode); StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId(); stationCode = stationBasic.getFanGatewayId();
stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper
.getHealthScoreInfoByStation(stationCode, tableName).toString().replace(".0", ""))); .getHealthScoreInfoByStation(stationCode, tableName));
return ResponseHelper.buildResponse(stringBigDecimalHashMap); return ResponseHelper.buildResponse(stringBigDecimalHashMap);
} }
stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper
.getHealthScoreInfoByLatest(areaCode, stationCode).toString().replace(".0", ""))); .getHealthScoreInfoByLatest(areaCode, stationCode));
return ResponseHelper.buildResponse(stringBigDecimalHashMap); return ResponseHelper.buildResponse(stringBigDecimalHashMap);
} }
...@@ -300,12 +302,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -300,12 +302,8 @@ public class TDBigScreenAnalyseController extends BaseController {
@GetMapping(value = "/getHealthInfoByArea") @GetMapping(value = "/getHealthInfoByArea")
public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception { public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
// List<Map<String, Object>> healthListInfo = List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea();
// idxBizFanHealthIndexMapper.getHealthInfoByArea(); Map<String, Object> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> t.get("healthIndex")));
List<Map<String, Object>> healthListInfo = fanHealthIndexDayMapper.getHealthInfoByArea();
Map<String, Integer> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(),
t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", ""))));
// List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区");
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
...@@ -322,7 +320,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -322,7 +320,7 @@ public class TDBigScreenAnalyseController extends BaseController {
} }
list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList()); list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList());
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
list.forEach(item -> seriesData.add(collect.getOrDefault(item, 100))); list.forEach(item -> seriesData.add(collect.getOrDefault(item, 100.0)));
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
...@@ -431,7 +429,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -431,7 +429,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
healthListInfo.forEach(item -> { healthListInfo.forEach(item -> {
list.add(item.get("station").toString()); list.add(item.get("station").toString());
seriesData.add(item.get("healthIndex").toString().replace(".0", "")); seriesData.add(item.get("healthIndex"));
}); });
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
...@@ -570,8 +568,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -570,8 +568,8 @@ public class TDBigScreenAnalyseController extends BaseController {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName, List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName,
stationBasic.getFanGatewayId()); stationBasic.getFanGatewayId());
Map<Object, Integer> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap( Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(
t -> t.get("subSystem"), t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", "")))); t -> t.get("subSystem"), t -> t.get("healthIndex")));
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
...@@ -579,7 +577,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -579,7 +577,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getSumSystemListByEquipment(stationBasic.getFanGatewayId(), equipmentName); .getSumSystemListByEquipment(stationBasic.getFanGatewayId(), equipmentName);
equipmentList.forEach(item -> { equipmentList.forEach(item -> {
Integer equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100); Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100.0);
seriesData.add(equipmentHealthScore); seriesData.add(equipmentHealthScore);
axisData.add(item.get("subSystem")); axisData.add(item.get("subSystem"));
}); });
...@@ -678,7 +676,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -678,7 +676,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray, List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray,
stationBasic.getFanGatewayId()); stationBasic.getFanGatewayId());
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors
.toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex").toString().replace(".0", ""))); .toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex")));
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
...@@ -686,7 +684,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -686,7 +684,7 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getPvSumSystemListByEquipment(stationBasic.getFanGatewayId(), subarray); .getPvSumSystemListByEquipment(stationBasic.getFanGatewayId(), subarray);
equipmentList.forEach(item -> { equipmentList.forEach(item -> {
Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100); Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0);
seriesData.add(equipmentHealthScore); seriesData.add(equipmentHealthScore);
axisData.add(item.get("equipmentName")); axisData.add(item.get("equipmentName"));
}); });
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
</select> </select>
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal">
SELECT SELECT
CEILING(IFNULL( HEALTH_INDEX , 100 )) AS healthIndex round(IFNULL( HEALTH_INDEX , 100 ), 1) AS healthIndex
FROM FROM
${tableName} ${tableName}
<where> <where>
...@@ -205,11 +205,11 @@ ...@@ -205,11 +205,11 @@
</select> </select>
<select id="getHealthInfoByArea" resultType="java.util.Map"> <select id="getHealthInfoByArea" resultType="java.util.Map">
SELECT ARAE as area, SELECT ARAE as area,
CEILING(avg(a.avgHealthIndex)) AS healthIndex round(avg(a.avgHealthIndex), 1) AS healthIndex
FROM ( FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE ARAE
FROM idx_biz_fan_health_index FROM fan_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区' WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
( (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE ARAE
FROM idx_biz_pv_health_index FROM pv_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区' WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE AND DATE_FORMAT(REC_DATE, "%Y-%m-%d") = CURRENT_DATE
...@@ -267,14 +267,14 @@ ...@@ -267,14 +267,14 @@
<select id="getHealthInfoByStation" resultType="java.util.Map"> <select id="getHealthInfoByStation" resultType="java.util.Map">
SELECT SELECT
a.STATION as station, a.STATION as station,
CEILING(avg( a.avgHealthIndex )) AS healthIndex round(avg( a.avgHealthIndex ), 1) AS healthIndex
FROM FROM
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
STATION STATION
FROM FROM
idx_biz_fan_health_index fan_health_index_latest
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
...@@ -290,7 +290,7 @@ ...@@ -290,7 +290,7 @@
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
STATION STATION
FROM FROM
idx_biz_pv_health_index pv_health_index_latest
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
...@@ -434,7 +434,7 @@ ...@@ -434,7 +434,7 @@
</select> </select>
<select id="getSubSystemInfo" resultType="java.util.Map"> <select id="getSubSystemInfo" resultType="java.util.Map">
SELECT SELECT
CEILING(IFNULL( HEALTH_INDEX, 100 )) AS healthIndex, round(IFNULL( HEALTH_INDEX, 100 ), 1) AS healthIndex,
SUB_SYSTEM AS subSystem SUB_SYSTEM AS subSystem
FROM FROM
fan_health_index_latest_data fan_health_index_latest_data
...@@ -599,7 +599,7 @@ ...@@ -599,7 +599,7 @@
</select> </select>
<select id="getPvSubSystemInfo" resultType="java.util.Map"> <select id="getPvSubSystemInfo" resultType="java.util.Map">
SELECT SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex, round(IFNULL( AVG( HEALTH_INDEX ), 100 ), 1) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName EQUIPMENT_NAME AS equipmentName
FROM FROM
pv_health_index_latest_data pv_health_index_latest_data
...@@ -1538,7 +1538,7 @@ ...@@ -1538,7 +1538,7 @@
</select> </select>
<select id="getHealthScoreInfoByLatest" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfoByLatest" resultType="java.math.BigDecimal">
SELECT SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex round(avg( a.avgHealthIndex ), 1) AS healthIndex
FROM FROM
( (
SELECT SELECT
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<select id="getHealthInfoByArea" resultType="java.util.Map"> <select id="getHealthInfoByArea" resultType="java.util.Map">
select area as area, select area as area,
ceil(avg(a.avghealthindex)) as healthIndex avg(a.avghealthindex) as healthIndex
from ( from (
select avg(health_index) as avghealthindex, select avg(health_index) as avghealthindex,
area area
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment