Commit e86a96cc authored by chenzhao's avatar chenzhao

修改代码

parent 353eb0b1
......@@ -278,8 +278,6 @@ public class IdxBizFanHealthIndexController extends BaseController {
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
Collections.reverse(seriesData);
Collections.reverse(axisData);
for (Map<String, Object> map : maps) {
seriesData.add(map.get("value"));
......@@ -469,23 +467,23 @@ public class IdxBizFanHealthIndexController extends BaseController {
if (requiredType.equals("按天")){
if (null != type && type.equals("0")){
// if (null != type && type.equals("0")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
}else{
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
endTimeTop = formatter.format(endDate);
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
}
// }else{
// Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// endTimeTop = formatter.format(endDate);
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
return ResponseHelper.buildResponse(fanHealthIndexDays);
}else if (requiredType.equals("按小时")){
if (null != type && type.equals("0")){
// if (null != type && type.equals("0")){
int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
String day = DateUtils.getDateNowShortStr();
startTimeTop = day + " "+ hour+":00:00";
......@@ -496,32 +494,122 @@ public class IdxBizFanHealthIndexController extends BaseController {
} catch (ParseException e) {
e.printStackTrace();
}
}else{
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
endTimeTop = formatter.format(endDate);
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
}
// }else{
// Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// endTimeTop = formatter.format(endDate);
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
return ResponseHelper.buildResponse(fanHealthIndexHours);
}else {
if (null != type && type.equals("0")){
// if (null != type && type.equals("0")){
Date date = DateUtils.dateAddMinutes(null,-9);
date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
}else{
// }else{
// Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// endTimeTop = formatter.format(endDate);
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
return ResponseHelper.buildResponse(fanHealthIndexMoments);
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 风电折线图", notes = "TD风电折线图")
@GetMapping(value = "/pointHealthIndexTrend")
public ResponseModel<Object> pointHealthIndexTrend(@RequestParam(value = "area",required = false) String area,
@RequestParam(value = "station",required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type,
@RequestParam(value = "requiredType",required = false) String requiredType,
@RequestParam(value = "subSystem",required = false) String subSystem) {
Map<String,Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
if (requiredType.equals("按天")){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
endTimeTop = formatter.format(endDate);
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(FanHealthIndexDay::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexDay obj : fanHealthIndexDays) {
if (type.equals("0")){
seriesData.add(obj.getHealthIndex().intValue());
}else {
seriesData.add(obj.getAnomaly());
}
axisData.add(obj.getAnalysisTime());
}
result.put("seriesData",seriesData);
result.put("axisData",axisData);
return ResponseHelper.buildResponse(result);
}else if (requiredType.equals("按小时")){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(FanHealthIndexHour::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexHour obj : fanHealthIndexHours) {
if (type.equals("0")){
seriesData.add(obj.getHealthIndex().intValue());
}else {
seriesData.add(obj.getAnomaly());
}
axisData.add(obj.getAnalysisTime());
}
result.put("seriesData",seriesData);
result.put("axisData",axisData);
return ResponseHelper.buildResponse(result);
}else {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
endTimeTop = formatter.format(endDate);
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
return ResponseHelper.buildResponse(fanHealthIndexMoments);
fanHealthIndexMoments= fanHealthIndexMoments.stream().sorted(Comparator.comparing(FanHealthIndexMoment::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexMoment obj : fanHealthIndexMoments) {
if (type.equals("0")){
seriesData.add(obj.getHealthIndex().intValue());
}else {
seriesData.add(obj.getAnomaly());
}
axisData.add(obj.getAnalysisTime());
}
result.put("seriesData",seriesData);
result.put("axisData",axisData);
return ResponseHelper.buildResponse(result);
}
}
}
}
......@@ -10,7 +10,7 @@ import java.util.List;
public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, anomaly, rec_date AS recDate, analysis_time AS analysisTime, station,equipment_name AS equipmentName,point_name as pointName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
"SELECT `health_index` AS healthIndex, anomaly, `health_index` AS `value`, rec_date AS recDate, analysis_time AS analysisTime, station,equipment_name AS equipmentName,point_name as pointName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
......
......@@ -12,7 +12,7 @@ import java.util.List;
public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_data WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"SELECT `health_index` AS healthIndex, rec_date AS recDate, `health_index` AS `value`,analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_data WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
......
......@@ -10,7 +10,7 @@ import java.util.List;
public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_day WHERE and analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
......@@ -10,7 +10,7 @@ import java.util.List;
public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_hour WHERE and analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
......@@ -15,7 +15,7 @@ import java.util.List;
public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_data WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
......@@ -10,7 +10,7 @@ import java.util.List;
public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_moment WHERE and analysis_obj_type = #{analysisObjType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
......
......@@ -30,4 +30,5 @@ public class FanHealthIndexHour implements Serializable {
private String analysisTime;
private String kks;
private String status;
private String value;
}
......@@ -30,4 +30,5 @@ public class FanHealthIndexMoment implements Serializable {
private String analysisTime;
private String kks;
private String status;
private String value;
}
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