Commit 889f7e54 authored by wujiang's avatar wujiang

修改曲线同步

parent a26b01d7
...@@ -35,4 +35,5 @@ public class JpCollectorHistoryAllDto { ...@@ -35,4 +35,5 @@ public class JpCollectorHistoryAllDto {
@ApiModelProperty(value = "年") @ApiModelProperty(value = "年")
private String year; private String year;
private long createdTime;
} }
...@@ -14,28 +14,29 @@ import java.util.Date; ...@@ -14,28 +14,29 @@ import java.util.Date;
* @date 2023-09-20 * @date 2023-09-20
*/ */
@Data @Data
@ApiModel(value="JpCollectorHistoryYearDto", description="户用光伏监盘采集器历史表") @ApiModel(value = "JpCollectorHistoryYearDto", description = "户用光伏监盘采集器历史表")
public class JpCollectorHistoryYearDto { public class JpCollectorHistoryYearDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码")
private String snCode;
@ApiModelProperty(value = "sn编码") @ApiModelProperty(value = "信号强度")
private String snCode; private Double signalStrength;
@ApiModelProperty(value = "信号强度") @ApiModelProperty(value = "第三方电站id")
private Double signalStrength; private String thirdStationId;
@ApiModelProperty(value = "第三方电站id") @ApiModelProperty(value = "第三方厂商标识")
private String thirdStationId; private String thirdCode;
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "日期")
private String thirdCode; private String month;
@ApiModelProperty(value = "日期") @ApiModelProperty(value = "年")
private String month; private String year;
@ApiModelProperty(value = "年") private long createdTime;
private String year;
} }
...@@ -51,5 +51,7 @@ public class JpInvertorElecHistoryAllDto { ...@@ -51,5 +51,7 @@ public class JpInvertorElecHistoryAllDto {
@ApiModelProperty(value = "年") @ApiModelProperty(value = "年")
private String year; private String year;
private Long createdTime;
} }
...@@ -55,5 +55,6 @@ public class JpInvertorElecHistoryMonthDto { ...@@ -55,5 +55,6 @@ public class JpInvertorElecHistoryMonthDto {
@ApiModelProperty(value = "年月") @ApiModelProperty(value = "年月")
private String yearMonth; private String yearMonth;
private Long createdTime;
} }
...@@ -15,43 +15,44 @@ import java.util.Date; ...@@ -15,43 +15,44 @@ import java.util.Date;
* @date 2023-09-20 * @date 2023-09-20
*/ */
@Data @Data
@ApiModel(value="JpInvertorElecHistoryYearDto", description="户用光伏监盘逆变器电能历史表") @ApiModel(value = "JpInvertorElecHistoryYearDto", description = "户用光伏监盘逆变器电能历史表")
public class JpInvertorElecHistoryYearDto { public class JpInvertorElecHistoryYearDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码")
private String snCode;
@ApiModelProperty(value = "sn编码") @ApiModelProperty(value = "U交流电压")
private String snCode; private Double uAcVoltage;
@ApiModelProperty(value = "U交流电压") @ApiModelProperty(value = "V交流电压")
private Double uAcVoltage; private Double vAcVoltage;
@ApiModelProperty(value = "V交流电压") @ApiModelProperty(value = "W交流电压")
private Double vAcVoltage; private Double wAcVoltage;
@ApiModelProperty(value = "W交流电压") @ApiModelProperty(value = "U交流电流")
private Double wAcVoltage; private Double uAcCurrent;
@ApiModelProperty(value = "U交流电流") @ApiModelProperty(value = "V交流电流")
private Double uAcCurrent; private Double vAcCurrent;
@ApiModelProperty(value = "V交流电流") @ApiModelProperty(value = "W交流电流")
private Double vAcCurrent; private Double wAcCurrent;
@ApiModelProperty(value = "W交流电流") @ApiModelProperty(value = "第三方电站id")
private Double wAcCurrent; private String thirdStationId;
@ApiModelProperty(value = "第三方电站id") @ApiModelProperty(value = "第三方厂商标识")
private String thirdStationId; private String thirdCode;
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "月")
private String thirdCode; private String month;
@ApiModelProperty(value = "日期") @ApiModelProperty(value = "年")
private String day; private String year;
@ApiModelProperty(value = "年月") private Long createdTime;
private String yearMonth;
} }
...@@ -50,5 +50,7 @@ public class TdHygfJpInvertorElecHistoryDto { ...@@ -50,5 +50,7 @@ public class TdHygfJpInvertorElecHistoryDto {
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "第三方厂商标识")
private String thirdCode; private String thirdCode;
private Long createdTime;
} }
...@@ -14,6 +14,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -14,6 +14,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryAllDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryAllDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryMonthDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryMonthDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryYearDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryYearDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInvertorElecHistoryAllDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInvertorElecHistoryYearDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector; import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory;
...@@ -111,22 +113,52 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -111,22 +113,52 @@ public class TdHygfJpCollectorHistoryServiceImpl
monthList.get(i).put("day", day); monthList.get(i).put("day", day);
monthList.get(i).put("year_month", year + "-" + month); monthList.get(i).put("year_month", year + "-" + month);
} }
this.baseMapper.updateMonth(monthList); if (!monthList.isEmpty()) {
// 年表 this.baseMapper.updateMonth(monthList);
List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month)); // 年表
for (int i = 0; i < yearList.size(); i++) { List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month));
yearList.get(i).put("created_time", dayTime.getTime() + i); List<JpCollectorHistoryYearDto> oldYearList = this.baseMapper.yearList(null, null, String.valueOf(year));
yearList.get(i).put("month", month); for (int i = 0; i < yearList.size(); i++) {
yearList.get(i).put("year", year); Map<String, Object> map = yearList.get(i);
long time = dayTime.getTime() + i;
for (JpCollectorHistoryYearDto dto : oldYearList) {
if (dto.getThirdStationId() != null && dto.getSnCode() != null
&& dto.getThirdStationId().equals(map.get("third_station_id"))
&& dto.getSnCode().equals(map.get("sn_code")) && dto.getYear().equals(map.get("year"))
&& dto.getMonth().equals(map.get("month"))) {
time = dto.getCreatedTime();
break;
}
}
yearList.get(i).put("created_time", time);
yearList.get(i).put("month", month);
yearList.get(i).put("year", year);
}
if (!yearList.isEmpty()) {
this.baseMapper.updateYear(yearList);
// 总表
List<Map<String, Object>> allList = this.baseMapper.yearToAll(String.valueOf(year));
List<JpCollectorHistoryAllDto> oldAllList = this.baseMapper.allList(null, null);
for (int i = 0; i < allList.size(); i++) {
Map<String, Object> map = allList.get(i);
long time = dayTime.getTime() + i;
for (JpCollectorHistoryAllDto dto : oldAllList) {
if (dto.getThirdStationId() != null && dto.getSnCode() != null
&& dto.getThirdStationId().equals(map.get("third_station_id"))
&& dto.getSnCode().equals(map.get("sn_code"))
&& dto.getYear().equals(map.get("year"))) {
time = dto.getCreatedTime();
break;
}
}
allList.get(i).put("created_time", time);
allList.get(i).put("year", year);
}
if (!allList.isEmpty()) {
this.baseMapper.updateAll(allList);
}
}
} }
this.baseMapper.updateYear(yearList);
// 总表
List<Map<String, Object>> allList = this.baseMapper.yearToAll(String.valueOf(year));
for (int i = 0; i < allList.size(); i++) {
allList.get(i).put("created_time", dayTime.getTime() + i);
allList.get(i).put("year", year);
}
this.baseMapper.updateAll(allList);
return null; return null;
} }
} }
\ No newline at end of file
...@@ -95,8 +95,7 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -95,8 +95,7 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
} }
return new ArrayList<>(); return new ArrayList<>();
} }
public Object syncData() { public Object syncData() {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1); cal.add(Calendar.DATE, -1);
...@@ -112,22 +111,52 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -112,22 +111,52 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
monthList.get(i).put("day", day); monthList.get(i).put("day", day);
monthList.get(i).put("year_month", year + "-" + month); monthList.get(i).put("year_month", year + "-" + month);
} }
this.baseMapper.updateMonth(monthList); if (!monthList.isEmpty()) {
// 年表 this.baseMapper.updateMonth(monthList);
List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month)); // 年表
for (int i = 0; i < yearList.size(); i++) { List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month));
yearList.get(i).put("created_time", dayTime.getTime() + i); List<JpInvertorElecHistoryYearDto> oldYearList = this.baseMapper.yearList(null, null, String.valueOf(year));
yearList.get(i).put("month", month); for (int i = 0; i < yearList.size(); i++) {
yearList.get(i).put("year", year); Map<String, Object> map = yearList.get(i);
} long time = dayTime.getTime() + i;
this.baseMapper.updateYear(yearList); for (JpInvertorElecHistoryYearDto dto : oldYearList) {
// 总表 if (dto.getThirdStationId() != null && dto.getSnCode() != null
List<Map<String, Object>> allList = this.baseMapper.yearToAll(String.valueOf(year)); && dto.getThirdStationId().equals(map.get("third_station_id"))
for (int i = 0; i < allList.size(); i++) { && dto.getSnCode().equals(map.get("sn_code")) && dto.getYear().equals(map.get("year"))
allList.get(i).put("created_time", dayTime.getTime() + i); && dto.getMonth().equals(map.get("month"))) {
allList.get(i).put("year", year); time = dto.getCreatedTime();
break;
}
}
yearList.get(i).put("created_time", time);
yearList.get(i).put("month", month);
yearList.get(i).put("year", year);
}
if (!yearList.isEmpty()) {
this.baseMapper.updateYear(yearList);
// 总表
List<Map<String, Object>> allList = this.baseMapper.yearToAll(String.valueOf(year));
List<JpInvertorElecHistoryAllDto> oldAllList = this.baseMapper.allList(null, null);
for (int i = 0; i < allList.size(); i++) {
Map<String, Object> map = allList.get(i);
long time = dayTime.getTime() + i;
for (JpInvertorElecHistoryAllDto dto : oldAllList) {
if (dto.getThirdStationId() != null && dto.getSnCode() != null
&& dto.getThirdStationId().equals(map.get("third_station_id"))
&& dto.getSnCode().equals(map.get("sn_code"))
&& dto.getYear().equals(map.get("year"))) {
time = dto.getCreatedTime();
break;
}
}
allList.get(i).put("created_time", time);
allList.get(i).put("year", year);
}
if (!allList.isEmpty()) {
this.baseMapper.updateAll(allList);
}
}
} }
this.baseMapper.updateAll(allList);
return null; return null;
} }
} }
\ No newline at end of file
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