Commit 717cac69 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents f5726225 9ed22b01
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 {
if (jsonArray.size() != 0) {
for( int i=0; i<jsonArray.size();i++ ) {
JSONObject jsonObject1 = (JSONObject) jsonArray.get(i);
JSONObject jsonObject2 = (JSONObject)jsonObject1.get("dataItemMap");
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("dataItemMap") != null) {
JSONObject jsonObject2 = (JSONObject)jsonObject1.get("dataItemMap");
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("collectTime") != null) {
jsonObject2.put("collectTime", jsonObject1.get("collectTime").toString());
}
jsonArrayRet.add(jsonObject2);
jsonArrayRet.add(jsonObject2);
}
}
}
}
......
......@@ -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>() {
{
put("1", "未处理");
......@@ -41,12 +48,17 @@ public class ImasterConstant {
public static String requestGET="GET";
public static String stationListUrl="/thirdData/stations";
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 collectorDetailUrl = "/thirdData/getDevRealKpi";
public static String collectorDetailMonthUrl = "/thirdData/getDevKpiMonth";
public static String collectorDetailYearUrl = "/thirdData/getDevKpiYear";
public static String alarmListUrl = "/thirdData/getAlarmList";
public static String resovleRule_data_page_records = "data";
public static String resovle_rows="rows";
public static int devTypeC=62;
public static int devTypeI=1;
public static Double kwhToMwh = 0.0001;
}
......@@ -135,16 +135,10 @@ public class HouseholdTestController {
@PostMapping(value = "/imasterNew")
@ApiOperation(httpMethod = "POST", value = "北向", notes = "北向")
public void imasterNew() throws IOException {
// imasterDataService.stationList();
// imasterDataService.stationDetail();
// imasterDataService.collectorList();
// imasterDataService.inverterList();
imasterDataService.stationList();
imasterDataService.stationDetail();
imasterDataService.collectorList();
imasterDataService.inverterList();
imasterDataService.inverterDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
}
......@@ -42,7 +42,7 @@ public class ImasterInverterListDetails {
Double pv11_u ;
Double mppt_power ;
Double pv13_u ;
Double run_state ;
int run_state ;
Double close_time ;
Double pv19_i ;
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 {
private Long createdTime;
private String stationCode ;
private Double installedCapacity ;
private Double radiationIntensity;
private Double theoryPower ;
private Double performanceRatio ;
private Double inverterPower ;
private Double ongridPower ;
private Double usePower ;
private Double powerProfit ;
private Double perpowerRatio;
private Double reductionTotalCo2 ;
private Double reductionTotalCoal ;
private Double reductionTotalTree;
private Double installed_capacity ; // 装机容量
private Double inverter_power; // 逆变器发电量
private Double power_profit ; // 发电收益
private Double reduction_total_coal ; // 标准煤节省量
private Double perpower_ratio ; /// 等效利用小时数
private Double reduction_total_co2 ; // 二氧化碳减排量
private String collectTime;
}
......@@ -9,17 +9,12 @@ public class ImasterStationDetailsYear {
private Long createdTime;
private String stationCode ;
private Double installedCapacity ;
private Double radiationIntensity;
private Double theoryPower ;
private Double performanceRatio ;
private Double inverterPower ;
private Double ongridPower ;
private Double usePower ;
private Double powerProfit ;
private Double perpowerRatio;
private Double reductionTotalCo2 ;
private Double reductionTotalCoal ;
private Double reductionTotalTree;
private Double installed_capacity ;
private Double inverter_power;
private Double power_profit ;
private Double reduction_total_coal ;
private Double perpower_ratio ;
private Double reduction_total_co2 ;
private String collectTime;
}
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> {
}
......@@ -168,7 +168,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpStation.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
// 业主姓名
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.setDayGenerate(ksolarStation.getDayGeneration() * KSolarConstant.kwhToMwh);
......
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