Commit 65f757b3 authored by zhangsen's avatar zhangsen

bug修改

parent a43cbbaf
...@@ -20,6 +20,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -20,6 +20,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -139,6 +140,23 @@ public class AnalyseController extends BaseController { ...@@ -139,6 +140,23 @@ public class AnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据") @ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据")
@GetMapping(value = "/getInfluxdbDataByConditon") @GetMapping(value = "/getInfluxdbDataByConditon")
public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (!StringUtils.isEmpty(startTime)) {
try {
Date date = DateUtils.dateAddHours(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN), -8);
startTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
}
if (!StringUtils.isEmpty(endTime)) {
try {
Date date = DateUtils.dateAddHours(DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN), -8);
endTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
}
if (StringUtils.isEmpty(startTime)) { if (StringUtils.isEmpty(startTime)) {
Date sevenAgoDayStartTime = null; Date sevenAgoDayStartTime = null;
try { try {
...@@ -181,7 +199,22 @@ public class AnalyseController extends BaseController { ...@@ -181,7 +199,22 @@ public class AnalyseController extends BaseController {
} }
} }
if (!StringUtils.isEmpty(startTime)) {
try {
Date date = DateUtils.dateAddHours(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN), -8);
startTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
}
if (!StringUtils.isEmpty(endTime)) {
try {
Date date = DateUtils.dateAddHours(DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN), -8);
endTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
}
if (StringUtils.isEmpty(startTime)) { if (StringUtils.isEmpty(startTime)) {
Date sevenAgoDayStartTime = null; Date sevenAgoDayStartTime = null;
try { try {
......
...@@ -38,6 +38,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -38,6 +38,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -632,23 +633,28 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -632,23 +633,28 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(value = "风站/光伏 右下实时趋势") @ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddress") @GetMapping("/getTrendInfoByAddress")
public ResponseModel<Map<String, Object>> getTrendInfoByAddress(@RequestParam(value = "indexAddress", required = false) String indexAddress, public ResponseModel<Map<String, Object>> getTrendInfoByAddress(@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) { @RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "tableName", required = false) String tableName,
@RequestParam(value = "tableName2", required = false) String tableName2) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); List<Map<String, Object>> resultListData = new ArrayList<>();
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); String recDate = idxBizFanHealthIndexMapper.getRecDateByIndexAddress(stationBasic.getFanGatewayId(), indexAddress, tableName);
String startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); if (CharSequenceUtil.isNotEmpty(recDate)) {
String endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); resultListData = idxBizFanHealthIndexMapper.getInfoListByTableName(stationBasic.getFanGatewayId(), indexAddress, tableName2, recDate);
List<IndicatorData> indicatorData = indicatorDataMapper.selectDataByAddressAndtime(indexAddress, startTime, endTime, stationBasic.getFanGatewayId()); }
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<String> time = new ArrayList<>(); List<String> time = new ArrayList<>();
List<Object> valueList = new ArrayList<>(); List<Object> valueList = new ArrayList<>();
indicatorData.forEach(item -> { resultListData.forEach(item -> {
String date = DateUtils.convertDateToString(item.getCreatedTime(), "HH:mm:ss"); String date = "";
try {
date = DateUtils.convertDateToString(DateUtils.dateParse(item.get("REC_DATE").toString(), DateUtils.DATE_TIME_PATTERN), "MM-dd HH:mm:ss");
} catch (ParseException e) {
}
time.add(date); time.add(date);
String value = StrUtil.isEmpty(item.getValue()) ? "0.0" : item.getValue(); String value = CharSequenceUtil.isEmpty(item.get("healthIndex").toString().replace(".0", "")) ? "100" : item.get("healthIndex").toString().replace(".0", "");
double v = Double.parseDouble(value); valueList.add(value);
valueList.add(v);
}); });
List<Map<String, Object>> arrayList = new ArrayList<>(); List<Map<String, Object>> arrayList = new ArrayList<>();
HashMap<String, Object> stringStringHashMap = new HashMap<>(); HashMap<String, Object> stringStringHashMap = new HashMap<>();
...@@ -656,19 +662,36 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -656,19 +662,36 @@ public class BigScreenAnalyseController extends BaseController {
arrayList.add(stringStringHashMap); arrayList.add(stringStringHashMap);
resultMap.put("axisData", time); resultMap.put("axisData", time);
resultMap.put("seriesData", arrayList); resultMap.put("seriesData", arrayList);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据测点ID查询测点名称")
@GetMapping("/getMapStringByString")
public ResponseModel<Map<String, Object>> getMapStringByString(@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId", required = true) String stationId,
@RequestParam(value = "tableName2", required = false) String tableName2) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName, stationBasic.getFanGatewayId());
int num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(), tableName2);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("text", nameByIndexAddress);
resultMap.put("warningNum", num);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下诊断分析") @ApiOperation(value = "风站/光伏 右下诊断分析")
@GetMapping("/getRiskHandleByVarDesc") @GetMapping("/getRiskHandleByVarDesc")
public ResponseModel<Map<String, String>> getRiskHandleByVarDesc(@RequestParam(value = "varDesc", required = false) String varDesc, public ResponseModel<Map<String, String>> getRiskHandleByVarDesc(@RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName) { @RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId") String stationId) {
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName, stationBasic.getFanGatewayId());
FeignClientResult<List<String>> sevenEntityMcb = null; FeignClientResult<List<String>> sevenEntityMcb = null;
try { try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc); sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
......
...@@ -85,7 +85,8 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -85,7 +85,8 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String getPointNameByIndexAddress(@Param("varDesc") String varDesc, String getPointNameByIndexAddress(@Param("varDesc") String varDesc,
@Param("tableName") String tableName); @Param("tableName") String tableName,
@Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall(); List<FullViewRecallDataDTO> getFullViewRecall();
...@@ -122,4 +123,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -122,4 +123,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
Integer pointNum(String STATION, String SUBARRAY, String EQUIPMENTNAME); Integer pointNum(String STATION, String SUBARRAY, String EQUIPMENTNAME);
Map<String, Object> getPvEquipStatusByStation(String station); Map<String, Object> getPvEquipStatusByStation(String station);
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName);
List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress,
@Param("tableName") String tableName,
@Param("recDate") String recDate);
int getIsWarningByPointId(@Param("indexAddress") String indexAddress, @Param("fanGatewayId") String fanGatewayId, @Param("tableName") String tableName);
} }
...@@ -584,6 +584,8 @@ ...@@ -584,6 +584,8 @@
FROM FROM
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
<where> <where>
EQUIPMENT_NAME IS NOT NULL
AND EQUIPMENT_NAME != ''
<if test="subarray != null and subarray != ''"> <if test="subarray != null and subarray != ''">
AND SUBARRAY = concat('#', #{subarray}) AND SUBARRAY = concat('#', #{subarray})
</if> </if>
...@@ -664,7 +666,10 @@ ...@@ -664,7 +666,10 @@
<select id="getPointNameByIndexAddress" resultType="java.lang.String"> <select id="getPointNameByIndexAddress" resultType="java.lang.String">
select POINT_NAME select POINT_NAME
from ${tableName} from ${tableName}
where INDEX_ADDRESS = #{varDesc} limit 1 where INDEX_ADDRESS = #{varDesc}
and GATEWAY_ID = #{gatewayId}
limit 1
</select> </select>
...@@ -1227,4 +1232,54 @@ ...@@ -1227,4 +1232,54 @@
) a ) a
</select> </select>
<select id="getRecDateByIndexAddress" resultType="java.lang.String">
SELECT
a.REC_DATE
FROM
(
SELECT
*,(
CASE
WHEN WARNING_NAME = '注意' THEN
1
WHEN WARNING_NAME = '警告' THEN
2
WHEN WARNING_NAME = '危险' THEN
3 ELSE 0
END
) AS sort
FROM
${tableName}
WHERE
INDEX_ADDRESS = #{indexAddress}
AND DISPOSOTION_STATE = '未处置'
and GATEWAY_ID = #{fanGatewayId}
ORDER BY
sort DESC
LIMIT 1
) a
</select>
<select id="getInfoListByTableName" resultType="java.util.Map">
SELECT
*,
CEILING(HEALTH_INDEX) as healthIndex
FROM
${tableName}
WHERE
#{recDate} >= REC_DATE
AND REC_DATE >= DATE_ADD( #{recDate}, INTERVAL - 12 hour )
AND ANALYSIS_TYPE = '按时刻'
AND INDEX_ADDRESS = #{indexAddress}
AND GATEWAY_ID = #{fanGatewayId}
</select>
<select id="getIsWarningByPointId" resultType="int">
select count(1) from ${tableName}
where INDEX_ADDRESS = #{indexAddress}
AND GATEWAY_ID = #{fanGatewayId}
and DISPOSOTION_STATE = '未处置'
</select>
</mapper> </mapper>
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