Commit 216fc36f authored by tangwei's avatar tangwei

解决冲突

parents a0ecae62 c82d315d
package com.yeejoin.amos.api.householdapi.Utils;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.TimeZone;
public class CalendarAdjust {
/**
* 获取指定某一天的开始时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getDailyStartTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取指定某一天的结束时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getDailyEndTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
return calendar.getTimeInMillis();
}
/**
* 获取当月开始时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getMonthStartTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取当月的结束时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getMonthEndTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));// 获取当前月最后一天
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
return calendar.getTimeInMillis();
}
/**
* 获取当年的开始时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getYearStartTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
calendar.add(Calendar.YEAR, 0);
calendar.add(Calendar.DATE, 0);
calendar.add(Calendar.MONTH, 0);
calendar.set(Calendar.DAY_OF_YEAR, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
/**
* 获取当年的最后时间戳
*
* @param timeStamp 毫秒级时间戳
* @param timeZone 如 GMT+8:00
* @return
*/
public static Long getYearEndTime(Long timeStamp, String timeZone) {
Calendar calendar = Calendar.getInstance();// 获取当前日期
calendar.setTimeZone(TimeZone.getTimeZone(timeZone));
calendar.setTimeInMillis(timeStamp);
int year = calendar.get(Calendar.YEAR);
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
return calendar.getTimeInMillis();
}
/**
* 时间戳转字符串
*
* @param timestamp 毫秒级时间戳
* @param zoneId 如 GMT+8或UTC+08:00
* @return
*/
public static String timestampToStr(long timestamp, String zoneId) {
ZoneId timezone = ZoneId.of(zoneId);
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), timezone);
return localDateTime.toString();
}
public static void main(String[] args) {
Long currentTime = System.currentTimeMillis();
System.out.println("Current Time : " + currentTime + " = " + timestampToStr(currentTime, "GMT+8"));
Long dailyStart = getDailyStartTime(currentTime, "GMT+8:00");
Long dailyEnd = getDailyEndTime(currentTime, "GMT+8:00");
Long monthStart = getMonthStartTime(currentTime, "GMT+8:00");
Long monthEnd = getMonthEndTime(currentTime, "GMT+8:00");
Long yearStart = getYearStartTime(currentTime, "GMT+8:00");
Long yearEnd = getYearEndTime(currentTime, "GMT+8:00");
System.out.println("Daily Start : " + dailyStart + " = " + timestampToStr(dailyStart, "GMT+8") + " Daily End : " + dailyEnd + " = " + timestampToStr(dailyEnd, "GMT+8"));
System.out.println("Month Start : " + monthStart + " = " + timestampToStr(monthStart, "GMT+8") + " Month End : " + monthEnd + " = " + timestampToStr(monthEnd, "GMT+8"));
System.out.println("Year Start : " + yearStart + " = " + timestampToStr(yearStart, "GMT+8") + " Year End : " + yearEnd + " = " + timestampToStr(yearEnd, "GMT+8"));
}
}
\ No newline at end of file
...@@ -207,15 +207,20 @@ public class ImasterUtils { ...@@ -207,15 +207,20 @@ public class ImasterUtils {
if (jsonArray.size() != 0) { if (jsonArray.size() != 0) {
for( int i=0; i<jsonArray.size();i++ ) { for( int i=0; i<jsonArray.size();i++ ) {
JSONObject jsonObject1 = (JSONObject) jsonArray.get(i); JSONObject jsonObject1 = (JSONObject) jsonArray.get(i);
JSONObject jsonObject2 = (JSONObject)jsonObject1.get("dataItemMap"); if(jsonObject1.get("dataItemMap") != null) {
if(jsonObject1.get("sn") != null) { JSONObject jsonObject2 = (JSONObject)jsonObject1.get("dataItemMap");
jsonObject2.put("inverterId", jsonObject1.get("sn").toString()); if(jsonObject1.get("sn") != null) {
} jsonObject2.put("inverterId", jsonObject1.get("sn").toString());
if(jsonObject1.get("stationCode") != null) { }
jsonObject2.put("stationCode", jsonObject1.get("stationCode").toString()); if(jsonObject1.get("stationCode") != null) {
} jsonObject2.put("stationCode", jsonObject1.get("stationCode").toString());
}
if(jsonObject1.get("collectTime") != null) {
jsonObject2.put("collectTime", jsonObject1.get("collectTime").toString());
}
jsonArrayRet.add(jsonObject2); jsonArrayRet.add(jsonObject2);
}
} }
} }
} }
......
...@@ -15,6 +15,13 @@ public class ImasterConstant { ...@@ -15,6 +15,13 @@ public class ImasterConstant {
} }
}; };
public static final HashMap<String, String> inverterStaus = new HashMap<String, String>() {
{
put("0", "离线");
put("1", "在线");
}
};
public static final HashMap<String, String> alarmstatus = new HashMap<String, String>() { public static final HashMap<String, String> alarmstatus = new HashMap<String, String>() {
{ {
put("1", "未处理"); put("1", "未处理");
...@@ -41,12 +48,17 @@ public class ImasterConstant { ...@@ -41,12 +48,17 @@ public class ImasterConstant {
public static String requestGET="GET"; public static String requestGET="GET";
public static String stationListUrl="/thirdData/stations"; public static String stationListUrl="/thirdData/stations";
public static String stationDetailUrl = "/thirdData/getStationRealKpi"; public static String stationDetailUrl = "/thirdData/getStationRealKpi";
public static String stationDetailMonthUrl = "/thirdData/getKpiStationMonth";
public static String stationDetailYearUrl = "/thirdData/getKpiStationYear";
public static String collectorListUrl = "/thirdData/getDevList"; public static String collectorListUrl = "/thirdData/getDevList";
public static String collectorDetailUrl = "/thirdData/getDevRealKpi"; public static String collectorDetailUrl = "/thirdData/getDevRealKpi";
public static String collectorDetailMonthUrl = "/thirdData/getDevKpiMonth";
public static String collectorDetailYearUrl = "/thirdData/getDevKpiYear";
public static String alarmListUrl = "/thirdData/getAlarmList"; public static String alarmListUrl = "/thirdData/getAlarmList";
public static String resovleRule_data_page_records = "data"; public static String resovleRule_data_page_records = "data";
public static String resovle_rows="rows"; public static String resovle_rows="rows";
public static int devTypeC=62; public static int devTypeC=62;
public static int devTypeI=1; public static int devTypeI=1;
public static Double kwhToMwh = 0.0001;
} }
...@@ -114,8 +114,8 @@ public class HouseholdTestController { ...@@ -114,8 +114,8 @@ public class HouseholdTestController {
@ApiOperation(httpMethod = "POST", value = "科士达", notes = "科士达") @ApiOperation(httpMethod = "POST", value = "科士达", notes = "科士达")
public void ksolarnew() throws IOException { public void ksolarnew() throws IOException {
// kSolarDataAcquisitionService.stationList(); // kSolarDataAcquisitionService.stationList();
kSolarDataAcquisitionService.stationDetail();
kSolarDataAcquisitionService.stationList(); kSolarDataAcquisitionService.stationList();
kSolarDataAcquisitionService.stationDetail();
kSolarDataAcquisitionService.collectorList(); kSolarDataAcquisitionService.collectorList();
kSolarDataAcquisitionService.collectorDetail(); kSolarDataAcquisitionService.collectorDetail();
//// goLangDataAcquisitionService.inverterList(); //// goLangDataAcquisitionService.inverterList();
...@@ -135,16 +135,10 @@ public class HouseholdTestController { ...@@ -135,16 +135,10 @@ public class HouseholdTestController {
@PostMapping(value = "/imasterNew") @PostMapping(value = "/imasterNew")
@ApiOperation(httpMethod = "POST", value = "北向", notes = "北向") @ApiOperation(httpMethod = "POST", value = "北向", notes = "北向")
public void imasterNew() throws IOException { public void imasterNew() throws IOException {
// imasterDataService.stationList(); imasterDataService.stationList();
// imasterDataService.stationDetail(); imasterDataService.stationDetail();
// imasterDataService.collectorList(); imasterDataService.collectorList();
// imasterDataService.inverterList(); imasterDataService.inverterList();
imasterDataService.inverterDetail(); imasterDataService.inverterDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
} }
} }
...@@ -11,6 +11,7 @@ public class ImasterInverterList { ...@@ -11,6 +11,7 @@ public class ImasterInverterList {
private Long id; private Long id;
private String stationCode; private String stationCode;
private String stationName; private String stationName;
private String addr;
private String collectorSnCode; private String collectorSnCode;
private String devName; private String devName;
private String esnCode; private String esnCode;
......
...@@ -42,7 +42,7 @@ public class ImasterInverterListDetails { ...@@ -42,7 +42,7 @@ public class ImasterInverterListDetails {
Double pv11_u ; Double pv11_u ;
Double mppt_power ; Double mppt_power ;
Double pv13_u ; Double pv13_u ;
Double run_state ; int run_state ;
Double close_time ; Double close_time ;
Double pv19_i ; Double pv19_i ;
Double mppt_7_cap ; Double mppt_7_cap ;
......
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "imaster_inverter_details_month" ,autoResultMap = true)
public class ImasterInverterMonth {
private Long createdTime;
private String stationCode ;
private Double installed_capacity ; // 装机容量
private Double product_power; // 发电量
private Double power_profit ; // 发电收益
private String collectTime;
private String inverterId;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "imaster_inverter_details_year" ,autoResultMap = true)
public class ImasterInverterYear {
private Long createdTime;
private String stationCode ;
private Double installed_capacity ; // 装机容量
private Double product_power; // 发电量
private Double power_profit ; // 发电收益
private String collectTime;
private String inverterId;
}
...@@ -9,16 +9,11 @@ public class ImasterStationDetailsMonth { ...@@ -9,16 +9,11 @@ public class ImasterStationDetailsMonth {
private Long createdTime; private Long createdTime;
private String stationCode ; private String stationCode ;
private Double installedCapacity ; private Double installed_capacity ; // 装机容量
private Double radiationIntensity; private Double inverter_power; // 逆变器发电量
private Double theoryPower ; private Double power_profit ; // 发电收益
private Double performanceRatio ; private Double reduction_total_coal ; // 标准煤节省量
private Double inverterPower ; private Double perpower_ratio ; /// 等效利用小时数
private Double ongridPower ; private Double reduction_total_co2 ; // 二氧化碳减排量
private Double usePower ; private String collectTime;
private Double powerProfit ;
private Double perpowerRatio;
private Double reductionTotalCo2 ;
private Double reductionTotalCoal ;
private Double reductionTotalTree;
} }
...@@ -9,17 +9,12 @@ public class ImasterStationDetailsYear { ...@@ -9,17 +9,12 @@ public class ImasterStationDetailsYear {
private Long createdTime; private Long createdTime;
private String stationCode ; private String stationCode ;
private Double installedCapacity ; private Double installed_capacity ;
private Double radiationIntensity; private Double inverter_power;
private Double theoryPower ; private Double power_profit ;
private Double performanceRatio ; private Double reduction_total_coal ;
private Double inverterPower ; private Double perpower_ratio ;
private Double ongridPower ; private Double reduction_total_co2 ;
private Double usePower ; private String collectTime;
private Double powerProfit ;
private Double perpowerRatio;
private Double reductionTotalCo2 ;
private Double reductionTotalCoal ;
private Double reductionTotalTree;
} }
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterInverterMonth;
public interface ImasterInverterMonthMapper extends BaseMapper<ImasterInverterMonth> {
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterInverterYear;
public interface ImasterInverterYearMapper extends BaseMapper<ImasterInverterYear> {
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterStationDetailsMonth;
public interface ImasterStationMonthMapper extends BaseMapper<ImasterStationDetailsMonth> {
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.ImasterStationDetailsYear;
public interface ImasterStationYearMapper extends BaseMapper<ImasterStationDetailsYear> {
}
...@@ -120,6 +120,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -120,6 +120,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
for (String stationId : stationIds) { for (String stationId : stationIds) {
LambdaQueryWrapper<KsolarStationList> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<KsolarStationList> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(KsolarStationList::getStationId, stationId); wrapper.eq(KsolarStationList::getStationId, stationId);
wrapper.orderByDesc(KsolarStationList::getCreatedTime);
List<KsolarStationList> ksolarStationLists = kSolarStationMapper.selectList(wrapper); List<KsolarStationList> ksolarStationLists = kSolarStationMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(ksolarStationLists)) { if (!CollectionUtils.isEmpty(ksolarStationLists)) {
KsolarStationList ksolarStation = ksolarStationLists.get(0); KsolarStationList ksolarStation = ksolarStationLists.get(0);
...@@ -167,18 +168,18 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -167,18 +168,18 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpStation.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode()); jpStation.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
// 业主姓名 // 业主姓名
jpStation.setUserName(ksolarStation.getUserName()); jpStation.setUserName(ksolarStation.getUserName());
jpStation.setState(KSolarConstant.stationStaus.get(String.valueOf(ksolarStation.getStatus()))); jpStation.setState(KSolarConstant.collectStaus.get(String.valueOf(ksolarStation.getStatus())));
jpStation.setRealTimePower(ksolarStation.getPowerInter()); jpStation.setRealTimePower(ksolarStation.getPowerInter());
jpStation.setDayGenerate(ksolarStation.getDayGeneration()); jpStation.setDayGenerate(ksolarStation.getDayGeneration());
jpStation.setAccumulatedPower(ksolarStation.getTotalGeneration()); jpStation.setAccumulatedPower(ksolarStation.getTotalGeneration());
jpStation.setArea(ksolarStation.getAddress()); jpStation.setArea(ksolarStation.getAddress());
// 日收益 // 日收益
jpStation.setDayIncome(stationEarn.getDayEarn() * KSolarConstant.kwhToMwh); jpStation.setDayIncome(stationEarn.getDayEarn());
// 月发电量 // 月发电量
jpStation.setMonthGenerate(stationEarn.getMonthGeneration() * KSolarConstant.kwhToMwh); jpStation.setMonthGenerate(stationEarn.getMonthGeneration());
// 年发电量 // 年发电量
jpStation.setYearGenerate(stationEarn.getYearGeneration() * KSolarConstant.kwhToMwh); jpStation.setYearGenerate(stationEarn.getYearGeneration());
// 月收益 // 月收益
jpStation.setMonthIncome(monthEarn.get("monthEarn")); jpStation.setMonthIncome(monthEarn.get("monthEarn"));
...@@ -331,6 +332,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -331,6 +332,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
for (String stationId : stationIds) { for (String stationId : stationIds) {
LambdaQueryWrapper<KsolarStationList> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<KsolarStationList> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(KsolarStationList::getStationId, stationId); wrapper.eq(KsolarStationList::getStationId, stationId);
wrapper.orderByDesc(KsolarStationList::getCreatedTime);
List<KsolarStationList> ksolarStationLists = kSolarStationMapper.selectList(wrapper); List<KsolarStationList> ksolarStationLists = kSolarStationMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(ksolarStationLists)) { if (!CollectionUtils.isEmpty(ksolarStationLists)) {
KsolarStationList ksolarStationList = ksolarStationLists.get(0); KsolarStationList ksolarStationList = ksolarStationLists.get(0);
...@@ -416,6 +418,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -416,6 +418,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
collectIds.forEach(collectId -> { collectIds.forEach(collectId -> {
LambdaQueryWrapper<KsolarStationCollectList> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<KsolarStationCollectList> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(KsolarStationCollectList::getCollectId, collectId); wrapper.eq(KsolarStationCollectList::getCollectId, collectId);
wrapper.orderByDesc(KsolarStationCollectList::getCreatedTime);
List<KsolarStationCollectList> ksolarStationCollectLists = ksolarStationCollectListMapper.selectList(wrapper); List<KsolarStationCollectList> ksolarStationCollectLists = ksolarStationCollectListMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(ksolarStationCollectLists)) { if (!CollectionUtils.isEmpty(ksolarStationCollectLists)) {
KsolarStationCollectList ksolarStationCollectList = ksolarStationCollectLists.get(0); KsolarStationCollectList ksolarStationCollectList = ksolarStationCollectLists.get(0);
...@@ -455,21 +458,22 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -455,21 +458,22 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
// jpInverter.setCapacity(inverterDetailDto.getPower().intValue()); // jpInverter.setCapacity(inverterDetailDto.getPower().intValue());
jpInverter.setSnCode(ksolarStationCollectData.getInverterId()); jpInverter.setSnCode(ksolarStationCollectData.getInverterId());
jpInverter.setState(KSolarConstant.collectStaus.get(ksolarStationCollectData.getStatus())); jpInverter.setState(KSolarConstant.stationStaus.get(ksolarStationCollectData.getStatus()));
jpInverter.setCollectorId(ksolarStationCollectList.getCollectId()); jpInverter.setCollectorId(ksolarStationCollectList.getCollectId());
jpInverter.setCollectorSnCode(ksolarStationCollectList.getCollectId()); jpInverter.setCollectorSnCode(ksolarStationCollectList.getCollectId());
jpInverter.setUpdateTime(new Date()); jpInverter.setUpdateTime(new Date());
jpInverter.setCurrentPower(ksolarStationCollectData.getPowerApparent()); jpInverter.setCurrentPower(ksolarStationCollectData.getPowerApparent());
jpInverter.setDayPowerGeneration(ksolarStationCollectData.getDayGeneration()); jpInverter.setDayPowerGeneration(ksolarStationCollectData.getDayGeneration());
jpInverter.setMonthPowerGeneration(ksolarStationCollectData.getMonthGeneration() * KSolarConstant.kwhToMwh); jpInverter.setMonthPowerGeneration(ksolarStationCollectData.getMonthGeneration());
jpInverter.setYearPowerGeneration(ksolarStationCollectData.getYearGeneration() * KSolarConstant.kwhToMwh); jpInverter.setYearPowerGeneration(ksolarStationCollectData.getYearGeneration());
jpInverter.setTotalPowerGeneration(ksolarStationCollectData.getTotalGeneration() * KSolarConstant.kwhToMwh); jpInverter.setTotalPowerGeneration(ksolarStationCollectData.getTotalGeneration());
jpInverter.setModel(ksolarStationCollectData.getDeviceModel()); jpInverter.setModel(ksolarStationCollectData.getDeviceModel());
jpInverter.setVersion(ksolarStationCollectData.getVersion()); jpInverter.setVersion(ksolarStationCollectData.getVersion());
jpInverter.setThirdStationId(ksolarStationCollectList.getThirdStationId()); jpInverter.setThirdStationId(ksolarStationCollectList.getThirdStationId());
jpInverter.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode()); jpInverter.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
jpInverter.setStationName(ksolarStationCollectList.getStationName()); jpInverter.setStationName(ksolarStationCollectList.getStationName());
jpInverter.setAddr(ksolarStationCollectList.getAddress());
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) { if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter); jpInverterMapper.updateById(jpInverter);
} else { } else {
......
package com.yeejoin.amos.boot.module.jxiop.biz.Enum;
import com.yeejoin.amos.boot.module.jxiop.api.Enum.AlarmDesc;
public enum WarningNameEnum {
ANQUAN(0,"安全"),
ZHUYI(1,"注意"),
JINGGAO(2, "警告"),
WEIXIAN(3,"危险");
private int code;
private String name;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
WarningNameEnum(int code, String name) {
this.code = code;
this.name = name;
}
public static int getCode(String name) {
for (WarningNameEnum warningNameEnum : WarningNameEnum.values())
{
if (warningNameEnum.getName().equals(name))
{
return warningNameEnum.getCode();
}
}
return 0;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Component
public class AsyncScheduledTaskConfig {
@Bean("async")
public Executor asyncScheduledTask(){
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setMaxPoolSize(50);
executor.setCorePoolSize(20);
executor.setQueueCapacity(50);
executor.setThreadNamePrefix("async-thread-");
executor.setKeepAliveSeconds(60);
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy(){});
executor.initialize();
return executor;
}
}
...@@ -25,7 +25,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; ...@@ -25,7 +25,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -955,4 +954,24 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -955,4 +954,24 @@ public class BigScreenAnalyseController extends BaseController {
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取区域信息,根据层级查询单位信息 key 和 value都是区域名称")
@GetMapping("/getAreaListByLevel")
public ResponseModel<List<Map<String, String>>> getAreaListByLevel(@RequestParam("level") String level) throws Exception {
FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList(level);
ArrayList<Map<String, String>> maps = new ArrayList<>();
if (!ObjectUtils.isEmpty(listFeignClientResult)) {
if (listFeignClientResult.getStatus() == 200) {
listFeignClientResult.getResult().forEach(item -> {
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("text", item.getCompanyName());
resultMap.put("value", item.getCompanyName());
maps.add(resultMap);
});
} else {
throw new RuntimeException(listFeignClientResult.getMessage());
}
}
return ResponseHelper.buildResponse(maps);
}
} }
package com.yeejoin.amos.boot.module.jxiop.biz.emqx;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRecordServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@Component
@Slf4j
public class WarningRecordStatusMessage extends EmqxListener {
@Autowired
protected EmqKeeper emqKeeper;
// 江西电建接收红黄绿码主题
private static final String QUESTION_STATUS_CHANGE = "question/status/change";
private static final BlockingQueue<JSONObject> blockingQueue = new LinkedBlockingQueue<JSONObject>();
@Autowired
private IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService;
@Autowired
private IdxBizPvWarningRecordServiceImpl idxBizPvWarningRecordService;
@PostConstruct
void init() throws Exception {
new Thread(taskRunnable).start();
emqKeeper.subscript(QUESTION_STATUS_CHANGE, 2, this);
}
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
log.info("人员赋码消息{}", new String(message.getPayload()));
JSONObject ja = JSON.parseObject(new String(message.getPayload()));
blockingQueue.add(ja);
}
Runnable taskRunnable = new Runnable() {
@Override
public void run() {
boolean isRun = true;
int k = 0;
while (isRun) {
k++;
isRun = k < Integer.MAX_VALUE;
try {
JSONObject analysisResult = blockingQueue.take();
jxIopUpdate(analysisResult);
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
public void jxIopUpdate(JSONObject analysisResult) {
log.info("修改预警状态信息:{}", analysisResult);
if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("pv")) {
LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
lambda.eq(IdxBizFanWarningRecord::getSequenceNbr, analysisResult.get("objectId"));
idxBizFanWarningRecordService.update(lambda);
} else if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("fan")) {
LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
lambda.eq(IdxBizPvWarningRecord::getSequenceNbr, analysisResult.get("objectId"));
idxBizPvWarningRecordService.update(lambda);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.emqx;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRecordServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* 处理无需处置情况
*/
@Component
@Slf4j
public class WarningRecordStatusMessage2 extends EmqxListener {
@Autowired
protected EmqKeeper emqKeeper;
/**
* 无需处置
*/
public static final String NOT_DISPOSE_AMOS = "not/dispose/amos";
private static final BlockingQueue<JSONObject> blockingQueue = new LinkedBlockingQueue<JSONObject>();
@Autowired
private IdxBizFanWarningRecordServiceImpl idxBizFanWarningRecordService;
@Autowired
private IdxBizPvWarningRecordServiceImpl idxBizPvWarningRecordService;
@PostConstruct
void init() throws Exception {
new Thread(taskRunnable).start();
emqKeeper.subscript(NOT_DISPOSE_AMOS, 2, this);
}
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
log.info("修改预警状态消息{}", new String(message.getPayload()));
JSONObject ja = JSON.parseObject(new String(message.getPayload()));
blockingQueue.add(ja);
}
Runnable taskRunnable = new Runnable() {
@Override
public void run() {
boolean isRun = true;
int k = 0;
while (isRun) {
k++;
isRun = k < Integer.MAX_VALUE;
try {
JSONObject analysisResult = blockingQueue.take();
jxIopUpdate(analysisResult);
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
public void jxIopUpdate(JSONObject analysisResult) {
log.info("修改预警状态信息:{}", analysisResult);
if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("pv")) {
LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已处置");
List<String> traceIds = (List<String>) analysisResult.get("traceIds");
lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
idxBizFanWarningRecordService.update(lambda);
} else if (ObjectUtils.isNotEmpty(analysisResult) && analysisResult.get("warningObjectType").toString().equals("fan")) {
LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
List<String> traceIds = (List<String>) analysisResult.get("traceIds");
lambda.eq(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
idxBizPvWarningRecordService.update(lambda);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity; package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
...@@ -29,7 +31,7 @@ public class IdxBizFanWarningRecord{ ...@@ -29,7 +31,7 @@ public class IdxBizFanWarningRecord{
/** /**
* *
*/ */
@TableField("SEQUENCE_NBR") @TableId(value = "SEQUENCE_NBR", type = IdType.ID_WORKER_STR)
private String sequenceNbr; private String sequenceNbr;
/** /**
...@@ -133,4 +135,10 @@ public class IdxBizFanWarningRecord{ ...@@ -133,4 +135,10 @@ public class IdxBizFanWarningRecord{
* */ * */
@TableField("CONTENT") @TableField("CONTENT")
private String CONTENT; private String CONTENT;
@TableField("POINT_NAME")
private String pointName;
@TableField("HEALTH_LEVEL")
private String healthLevel;
} }
...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; ...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
...@@ -39,7 +40,7 @@ public class IdxBizFanWarningRuleSet{ ...@@ -39,7 +40,7 @@ public class IdxBizFanWarningRuleSet{
* *
*/ */
@TableField("REC_DATE") @TableField("REC_DATE")
private LocalDateTime recDate; private Date recDate;
/** /**
* *
...@@ -81,7 +82,7 @@ public class IdxBizFanWarningRuleSet{ ...@@ -81,7 +82,7 @@ public class IdxBizFanWarningRuleSet{
* *
*/ */
@TableField("ANALYSIS_POINT_ID") @TableField("ANALYSIS_POINT_ID")
private Integer analysisPointId; private String analysisPointId;
/** /**
* 分析周期((按天、10min、小时) * 分析周期((按天、10min、小时)
......
package com.yeejoin.amos.boot.module.jxiop.biz.entity; package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
...@@ -8,6 +10,7 @@ import lombok.EqualsAndHashCode; ...@@ -8,6 +10,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
...@@ -26,7 +29,7 @@ public class IdxBizPvWarningRecord{ ...@@ -26,7 +29,7 @@ public class IdxBizPvWarningRecord{
/** /**
* *
*/ */
@TableField("SEQUENCE_NBR") @TableId(value = "SEQUENCE_NBR", type = IdType.ID_WORKER_STR)
private String sequenceNbr; private String sequenceNbr;
/** /**
...@@ -39,7 +42,7 @@ public class IdxBizPvWarningRecord{ ...@@ -39,7 +42,7 @@ public class IdxBizPvWarningRecord{
* *
*/ */
@TableField("REC_DATE") @TableField("REC_DATE")
private LocalDateTime recDate; private Date recDate;
/** /**
* *
...@@ -69,7 +72,7 @@ public class IdxBizPvWarningRecord{ ...@@ -69,7 +72,7 @@ public class IdxBizPvWarningRecord{
* *
*/ */
@TableField("HEALTH_INDEX_SEQ") @TableField("HEALTH_INDEX_SEQ")
private Integer healthIndexSeq; private String healthIndexSeq;
/** /**
* *
...@@ -136,4 +139,8 @@ public class IdxBizPvWarningRecord{ ...@@ -136,4 +139,8 @@ public class IdxBizPvWarningRecord{
* */ * */
@TableField("CONTENT") @TableField("CONTENT")
private String CONTENT; private String CONTENT;
@TableField("POINT_NAME")
private String pointName;
@TableField("HEALTH_LEVEL")
private String healthLevel;
} }
...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; ...@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
...@@ -39,7 +40,7 @@ public class IdxBizPvWarningRuleSet{ ...@@ -39,7 +40,7 @@ public class IdxBizPvWarningRuleSet{
* *
*/ */
@TableField("REC_DATE") @TableField("REC_DATE")
private LocalDateTime recDate; private Date recDate;
/** /**
* *
...@@ -81,7 +82,7 @@ public class IdxBizPvWarningRuleSet{ ...@@ -81,7 +82,7 @@ public class IdxBizPvWarningRuleSet{
* 分析变量测点ID * 分析变量测点ID
*/ */
@TableField("ANALYSIS_POINT_ID") @TableField("ANALYSIS_POINT_ID")
private Integer analysisPointId; private String analysisPointId;
/** /**
* 分析周期((按天、10min、小时) * 分析周期((按天、10min、小时)
......
...@@ -277,11 +277,13 @@ ...@@ -277,11 +277,13 @@
<select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map"> <select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map">
SELECT SELECT
( SELECT POINT_NAME FROM ${tableName2} WHERE GATEWAY_ID = a.GATEWAY_ID AND INDEX_ADDRESS = a.INDEX_ADDRESS ) AS pointName, <!-- ( SELECT POINT_NAME FROM ${tableName2} WHERE GATEWAY_ID = a.GATEWAY_ID AND INDEX_ADDRESS = a.INDEX_ADDRESS ) AS pointName,-->
b.POINT_NAME as pointName,
a.WARNING_NAME as warningName, a.WARNING_NAME as warningName,
count(1) as num count(1) as num
FROM FROM
${tableName} a ${tableName} a
LEFT JOIN ${tableName2} b on b.GATEWAY_ID = a.GATEWAY_ID and b.INDEX_ADDRESS = a.INDEX_ADDRESS
<where> <where>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
a.ARAE like concat('%', #{areaCode}, '%') a.ARAE like concat('%', #{areaCode}, '%')
...@@ -299,33 +301,35 @@ ...@@ -299,33 +301,35 @@
FROM FROM
( (
SELECT SELECT
( SELECT POINT_NAME FROM idx_biz_pv_point_process_variable_classification WHERE GATEWAY_ID = idx_biz_pv_warning_record.GATEWAY_ID AND INDEX_ADDRESS = idx_biz_pv_warning_record.INDEX_ADDRESS ) AS pointName, wr.WARNING_NAME AS warningName,
WARNING_NAME AS warningName, vc.POINT_NAME AS pointName,
count( 1 ) AS num count( 1 ) AS num
FROM FROM
idx_biz_pv_warning_record idx_biz_pv_warning_record wr
LEFT JOIN idx_biz_pv_point_process_variable_classification vc on vc.GATEWAY_ID = wr.GATEWAY_ID and vc.INDEX_ADDRESS = wr.INDEX_ADDRESS
<where> <where>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
ARAE like concat('%', #{areaCode}, '%') wr.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
pointName, pointName,
WARNING_NAME UNION ALL warningName UNION ALL
SELECT SELECT
( SELECT POINT_NAME FROM idx_biz_fan_point_process_variable_classification WHERE GATEWAY_ID = idx_biz_fan_warning_record.GATEWAY_ID AND INDEX_ADDRESS = idx_biz_fan_warning_record.INDEX_ADDRESS ) AS pointName, wr.WARNING_NAME AS warningName,
WARNING_NAME AS warningName, vc.POINT_NAME AS pointName,
count( 1 ) AS num count( 1 ) AS num
FROM FROM
idx_biz_fan_warning_record idx_biz_fan_warning_record wr
LEFT JOIN idx_biz_fan_point_process_variable_classification vc on vc.GATEWAY_ID = wr.GATEWAY_ID and vc.INDEX_ADDRESS = wr.INDEX_ADDRESS
<where> <where>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
ARAE like concat('%', #{areaCode}, '%') wr.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
pointName, pointName,
WARNING_NAME warningName
) a ) a
WHERE WHERE
a.pointName IS NOT NULL a.pointName IS NOT NULL
...@@ -339,7 +343,7 @@ ...@@ -339,7 +343,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' 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
<if test="equipmentName != null and equipmentName != ''"> <if test="equipmentName != null and equipmentName != ''">
...@@ -378,7 +382,7 @@ ...@@ -378,7 +382,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
ANALYSIS_OBJ_TYPE = '场站' 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
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
...@@ -490,8 +494,7 @@ ...@@ -490,8 +494,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '子阵'
AND STATION != ''
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
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
...@@ -509,8 +512,7 @@ ...@@ -509,8 +512,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '设备'
AND STATION != ''
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
<if test="subarray != null and subarray != ''"> <if test="subarray != null and subarray != ''">
...@@ -555,8 +557,7 @@ ...@@ -555,8 +557,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '测点'
AND STATION != ''
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
AND POINT_NAME IS NOT NULL AND POINT_NAME IS NOT NULL
...@@ -616,7 +617,14 @@ ...@@ -616,7 +617,14 @@
FROM FROM
idx_biz_fan_point_process_variable_classification idx_biz_fan_point_process_variable_classification
WHERE WHERE
TAG_CODE = '分析变量' UNION ALL TAG_CODE = '分析变量'
AND ARAE is not null
AND STATION is not null
AND EQUIPMENT_NAME is not null
AND SUB_SYSTEM is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
UNION ALL
SELECT SELECT
ARAE AS area, ARAE AS area,
STATION AS station, STATION AS station,
...@@ -628,6 +636,12 @@ ...@@ -628,6 +636,12 @@
idx_biz_pv_point_process_variable_classification idx_biz_pv_point_process_variable_classification
WHERE WHERE
TAG_CODE = '分析变量' TAG_CODE = '分析变量'
AND ARAE is not null
AND STATION is not null
AND SUBARRAY is not null
AND EQUIPMENT_NAME is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
) a ) a
</select> </select>
...@@ -643,8 +657,7 @@ ...@@ -643,8 +657,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '场站'
AND STATION != ''
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
GROUP BY GROUP BY
...@@ -656,8 +669,7 @@ ...@@ -656,8 +669,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '场站'
AND STATION != ''
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
GROUP BY GROUP BY
...@@ -680,8 +692,7 @@ ...@@ -680,8 +692,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '设备'
AND STATION != ''
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
GROUP BY GROUP BY
...@@ -693,8 +704,7 @@ ...@@ -693,8 +704,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '子阵'
AND STATION != ''
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
GROUP BY GROUP BY
...@@ -718,8 +728,7 @@ ...@@ -718,8 +728,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '子系统'
AND STATION != ''
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
GROUP BY GROUP BY
...@@ -731,8 +740,7 @@ ...@@ -731,8 +740,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '设备'
AND STATION != ''
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
GROUP BY GROUP BY
...@@ -752,8 +760,7 @@ ...@@ -752,8 +760,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '测点'
AND STATION != ''
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
GROUP BY GROUP BY
...@@ -765,8 +772,7 @@ ...@@ -765,8 +772,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
WHERE WHERE
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '测点'
AND STATION != ''
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
GROUP BY GROUP BY
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
AND a.GATEWAY_ID = #{stationId} AND a.GATEWAY_ID = #{stationId}
</if> </if>
</where> </where>
order by recDate DESC
limit #{current}, #{size} limit #{current}, #{size}
</select> </select>
......
package com.yeejoin.amos.boot.module.jxiop.biz.listener; package com.yeejoin.amos.boot.module.jxiop.biz.listener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.dto.ProduceMsg;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccountFed; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccountFed;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.activemq.QuerueProduce;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.activemq.command.ActiveMQTextMessage; import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -14,6 +21,9 @@ import org.springframework.jms.annotation.JmsListener; ...@@ -14,6 +21,9 @@ import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.Map;
import javax.jms.Message; import javax.jms.Message;
@Component @Component
...@@ -24,7 +34,9 @@ public class PlatformModifyPasswordistener { ...@@ -24,7 +34,9 @@ public class PlatformModifyPasswordistener {
@Autowired @Autowired
PersonAccountFedMapper personAccountFedMapper; PersonAccountFedMapper personAccountFedMapper;
@Value("${amos.secret.key}") @Value("${amos.secret.key}")
private String secretKey; private String secretKey;
@Autowired
QuerueProduce querueProduce;
@JmsListener(destination = "${modifypasswordqueue}") @JmsListener(destination = "${modifypasswordqueue}")
public void reciveMesssage(Message message) { public void reciveMesssage(Message message) {
...@@ -45,6 +57,15 @@ public class PlatformModifyPasswordistener { ...@@ -45,6 +57,15 @@ public class PlatformModifyPasswordistener {
personAccountFed.setSecondaryPassword((String) jsonObject.get("rePassword")); personAccountFed.setSecondaryPassword((String) jsonObject.get("rePassword"));
personAccountFedMapper.updateById(personAccountFed); personAccountFedMapper.updateById(personAccountFed);
} }
//发消息通知集成方修改
if(personAccount!=null)
{
Map<String, Object> data=new HashMap<>();
data.put("SEQUENCE_NBR",jsonObject.get("sequenceNbr"));
ProduceMsg produceMsg= new ProduceMsg(data, "UPDATE",personAccount.getPuserId());
querueProduce.produceMsg(JSON.toJSONString(produceMsg));
}
message.acknowledge(); message.acknowledge();
log.info("--------------------消息消费成功 {}", jsonObject); log.info("--------------------消息消费成功 {}", jsonObject);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -440,7 +440,13 @@ public class MonitorFanIdxController extends BaseController { ...@@ -440,7 +440,13 @@ public class MonitorFanIdxController extends BaseController {
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "统一获取集电线与风机状态")
@GetMapping("/fanLineList")
public void getFanLineList() {
getStatusJDX();
getListByFJ();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取升压站信息 通过排序等") @ApiOperation(value = "获取升压站信息 通过排序等")
......
...@@ -4,9 +4,12 @@ import java.text.SimpleDateFormat; ...@@ -4,9 +4,12 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,8 +20,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -17,8 +20,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.AlarmEventDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.AlarmEventDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel; import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock; import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
...@@ -39,6 +44,21 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -39,6 +44,21 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
@Autowired @Autowired
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private RedisUtils redisUtils;
@Autowired
private static Map<String, EquipmentSpecificIndex> map;
@PostConstruct
public void init() {
QueryWrapper<EquipmentSpecificIndex> wrapper = new QueryWrapper<>();
wrapper.eq("is_alarm", 1);
List<EquipmentSpecificIndex> list = equipmentSpecificIndexMapper.selectList(wrapper);
map = list.stream().collect(Collectors.toMap(EquipmentSpecificIndex::getEquipmentSpecificName,
Function.identity(), (key1, key2) -> key2));
}
@Async("jxiopAsyncExecutor") @Async("jxiopAsyncExecutor")
public void handleMessage(List<ConsumerRecord<String, String>> record) { public void handleMessage(List<ConsumerRecord<String, String>> record) {
List<AlarmEvent> alarmEvents = new ArrayList<>(); List<AlarmEvent> alarmEvents = new ArrayList<>();
...@@ -62,15 +82,20 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -62,15 +82,20 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
} else { } else {
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent(); EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent();
if (indexName.contains("实时故障") && objName.contains("风机")) { if (indexName.contains("实时故障") && objName.contains("风机")) {
LambdaQueryWrapper<EquipmentSpecificIndex> wrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<EquipmentSpecificIndex> wrapper = new
wrapper.eq(EquipmentSpecificIndex::getEquipmentSpecificName, objName); // LambdaQueryWrapper<>();
EquipmentSpecificIndex equipmentSpecificIndex = equipmentSpecificIndexMapper.selectOne(wrapper); // wrapper.eq(EquipmentSpecificIndex::getEquipmentSpecificName, objName);
// EquipmentSpecificIndex equipmentSpecificIndex =
// equipmentSpecificIndexMapper.selectOne(wrapper);
EquipmentSpecificIndex equipmentSpecificIndex = map.get(objName);
if (equipmentSpecificIndex == null) {
continue;
}
String valueEnum = equipmentSpecificIndex.getValueEnum(); String valueEnum = equipmentSpecificIndex.getValueEnum();
JSONArray arr = JSONObject.parseArray(valueEnum); JSONArray arr = JSONObject.parseArray(valueEnum);
for(Object o:arr) for (Object o : arr) {
{ JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(o));
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(o)); if (json.containsKey("key") && value.equals(json.get("key"))) {
if (json.containsKey("key")&&value.equals(json.get("key"))) {
String warn = json.getString("label"); String warn = json.getString("label");
if (warn.indexOf("备留") == -1) { if (warn.indexOf("备留") == -1) {
equipAlarmEvent.setEquipName(objName); equipAlarmEvent.setEquipName(objName);
...@@ -118,9 +143,9 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -118,9 +143,9 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
i.setValue("分"); i.setValue("分");
} }
i.setStationName("升压站"); i.setStationName("升压站");
long mills = i.getCreatedTime()/1000000; long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
//System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
i.setTime(sdf.format(car.getTime())); i.setTime(sdf.format(car.getTime()));
}); });
PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList); PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList);
...@@ -131,8 +156,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -131,8 +156,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc"); ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc");
ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid", ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid",
"alarmGroupName"); "alarmGroupName");
ColModel colModelEventTime = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", ColModel colModelEventTime = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", "time");
"time");
ColModel colModelEventMovement = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value"); ColModel colModelEventMovement = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value");
List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName, List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName,
colModelEventTime, colModelEventMovement); colModelEventTime, colModelEventMovement);
......
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