Commit 889f7e54 authored by wujiang's avatar wujiang

修改曲线同步

parent a26b01d7
......@@ -35,4 +35,5 @@ public class JpCollectorHistoryAllDto {
@ApiModelProperty(value = "年")
private String year;
private long createdTime;
}
......@@ -14,12 +14,11 @@ import java.util.Date;
* @date 2023-09-20
*/
@Data
@ApiModel(value="JpCollectorHistoryYearDto", description="户用光伏监盘采集器历史表")
@ApiModel(value = "JpCollectorHistoryYearDto", description = "户用光伏监盘采集器历史表")
public class JpCollectorHistoryYearDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码")
private String snCode;
......@@ -38,4 +37,6 @@ public class JpCollectorHistoryYearDto {
@ApiModelProperty(value = "年")
private String year;
private long createdTime;
}
......@@ -52,4 +52,6 @@ public class JpInvertorElecHistoryAllDto {
@ApiModelProperty(value = "年")
private String year;
private Long createdTime;
}
......@@ -56,4 +56,5 @@ public class JpInvertorElecHistoryMonthDto {
@ApiModelProperty(value = "年月")
private String yearMonth;
private Long createdTime;
}
......@@ -15,12 +15,11 @@ import java.util.Date;
* @date 2023-09-20
*/
@Data
@ApiModel(value="JpInvertorElecHistoryYearDto", description="户用光伏监盘逆变器电能历史表")
@ApiModel(value = "JpInvertorElecHistoryYearDto", description = "户用光伏监盘逆变器电能历史表")
public class JpInvertorElecHistoryYearDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码")
private String snCode;
......@@ -48,10 +47,12 @@ public class JpInvertorElecHistoryYearDto {
@ApiModelProperty(value = "第三方厂商标识")
private String thirdCode;
@ApiModelProperty(value = "日期")
private String day;
@ApiModelProperty(value = "月")
private String month;
@ApiModelProperty(value = "年")
private String year;
@ApiModelProperty(value = "年月")
private String yearMonth;
private Long createdTime;
}
......@@ -51,4 +51,6 @@ public class TdHygfJpInvertorElecHistoryDto {
@ApiModelProperty(value = "第三方厂商标识")
private String thirdCode;
private Long createdTime;
}
......@@ -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.JpCollectorHistoryMonthDto;
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.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory;
......@@ -111,22 +113,52 @@ public class TdHygfJpCollectorHistoryServiceImpl
monthList.get(i).put("day", day);
monthList.get(i).put("year_month", year + "-" + month);
}
if (!monthList.isEmpty()) {
this.baseMapper.updateMonth(monthList);
// 年表
List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month));
List<JpCollectorHistoryYearDto> oldYearList = this.baseMapper.yearList(null, null, String.valueOf(year));
for (int i = 0; i < yearList.size(); i++) {
yearList.get(i).put("created_time", dayTime.getTime() + i);
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++) {
allList.get(i).put("created_time", dayTime.getTime() + 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);
}
}
}
return null;
}
}
\ No newline at end of file
......@@ -96,7 +96,6 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
return new ArrayList<>();
}
public Object syncData() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
......@@ -112,22 +111,52 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
monthList.get(i).put("day", day);
monthList.get(i).put("year_month", year + "-" + month);
}
if (!monthList.isEmpty()) {
this.baseMapper.updateMonth(monthList);
// 年表
List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month));
List<JpInvertorElecHistoryYearDto> oldYearList = this.baseMapper.yearList(null, null, String.valueOf(year));
for (int i = 0; i < yearList.size(); i++) {
yearList.get(i).put("created_time", dayTime.getTime() + i);
Map<String, Object> map = yearList.get(i);
long time = dayTime.getTime() + i;
for (JpInvertorElecHistoryYearDto 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<JpInvertorElecHistoryAllDto> oldAllList = this.baseMapper.allList(null, null);
for (int i = 0; i < allList.size(); i++) {
allList.get(i).put("created_time", dayTime.getTime() + 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);
}
}
}
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