Commit 40b0dc1b authored by tangwei's avatar tangwei

增加修改历史数据接口

parent 05b07135
...@@ -3,16 +3,16 @@ package com.yeejoin.amos.api.householdapi.controller; ...@@ -3,16 +3,16 @@ package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils; import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.face.dto.GoodWEGenStation; import com.yeejoin.amos.api.householdapi.face.dto.GoodWEGenStation;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.*; import com.yeejoin.amos.api.householdapi.face.service.*;
import com.yeejoin.amos.api.householdapi.face.service.business.*;
import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl; import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl; import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl;
import fastjson.JSON; import fastjson.JSON;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -43,6 +43,39 @@ public class HouseholdTestController { ...@@ -43,6 +43,39 @@ public class HouseholdTestController {
private SofarDataAcquisitionService sofarDataAcquisitionService; private SofarDataAcquisitionService sofarDataAcquisitionService;
@Autowired
private TdHYGFInverterDayGenerateImpl tdHYGFInverterDayGenerateImpl;
@Autowired
private TdHYGFInverterMonthGenerateImpl tdHYGFInverterMonthGenerateImpl;
@Autowired
private TdHYGFInverterYearGenerateImpl tdHYGFInverterYearGenerateImpl;
@Autowired
private TdHYGFStationDayGenerateImpl tdHYGFStationDayGenerateImpl;
@Autowired
private TdHYGFStationMonthGenerateImpl tdHYGFStationMonthGenerateImpl;
@Autowired
private TdHYGFInverterTotalGenerateImpl tdHYGFInverterTotalGenerateImpl;
@Autowired
TdHYGFStationYearGenerateImpl tdHYGFStationYearGenerateImpl;
//户用光伏日发电量
@Autowired
private HYGFJPDayPowerImpl hygfjpDayPowerImpl;
@Autowired
private HYGFJPStationPowerHistoryImpl hygfjpStationPowerHistoryImpl;
@Autowired
private HYGFJPInverterWarnImpl hygfjpInverterWarnImpl;
/** /**
* 新增户用光伏-厂商API haders * 新增户用光伏-厂商API haders
* *
...@@ -158,4 +191,75 @@ public class HouseholdTestController { ...@@ -158,4 +191,75 @@ public class HouseholdTestController {
// imasterDataService.inverterDetail(null); // imasterDataService.inverterDetail(null);
kSolarDataAcquisitionService.collectorDetail(); kSolarDataAcquisitionService.collectorDetail();
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping (value = "/imasterNew")
@ApiOperation(httpMethod = "GET", value = "手动同步数据", notes = "手动同步数据")
public void updateAscription(
@RequestParam(value = "table",required=false) String table,//表名
@RequestParam(value = "time",required=false) String time
){
AscriptionService ascriptionService= this.updateAscriptionlist(table);
ascriptionService.updateAscription(time);
}
public AscriptionService updateAscriptionlist( String table){
AscriptionService ascriptionService=null;
switch (table) {
case "td_hygf_day_power":
ascriptionService=hygfjpDayPowerImpl;
break;
case "td_hygf_jp_inverter_warn":
ascriptionService=hygfjpInverterWarnImpl;
break;
case "td_hygf_jp_station_power_history":
ascriptionService=hygfjpStationPowerHistoryImpl;
break;
case "td_hygf_station_day_generate":
ascriptionService=tdHYGFStationDayGenerateImpl;
break;
case "td_hygf_station_month_generate":
ascriptionService=tdHYGFStationMonthGenerateImpl;
break;
case "td_hygf_station_year_generate":
ascriptionService=tdHYGFStationYearGenerateImpl;
break;
case "td_hygf_inverter_day_generate":
ascriptionService=tdHYGFInverterDayGenerateImpl;
break;
case "td_hygf_inverter_month_generate":
ascriptionService=tdHYGFInverterMonthGenerateImpl;
break;
case "td_hygf_inverter_year_generate":
ascriptionService=tdHYGFInverterYearGenerateImpl;
break;
case "td_hygf_inverter_total_generate":
ascriptionService=tdHYGFInverterTotalGenerateImpl;
break;
default:
break;
}
return ascriptionService;
}
} }
package com.yeejoin.amos.api.householdapi.face.service;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
public interface AscriptionService {
void updateAscription( String today);
}
...@@ -26,5 +26,4 @@ public interface SunlightService { ...@@ -26,5 +26,4 @@ public interface SunlightService {
} }
package com.yeejoin.amos.api.householdapi.face.service.business;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPDayPowerMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class HYGFJPDayPowerImpl implements AscriptionService {
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Autowired
private JpStationMapper jpStationMapper;
@Override
public void updateAscription( String today) {
List<HYGFJPDayPower> hygfjpDayPower = hygfjpDayPowerMapper.selectList(
new QueryWrapper<HYGFJPDayPower>().
eq("year_month_day", today).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (HYGFJPDayPower dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getTationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
hygfjpDayPowerMapper.insert(dayPower);
}
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPInverterWarn;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPInverterWarnMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class HYGFJPInverterWarnImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
Date star = dft.parse(timeNum);//开始时间
Date endDay= dft.parse(dft.format(new Date()));//结束时间
Long starTime=star.getTime();
Long endTime=endDay.getTime();
Long num=endTime-starTime;//时间戳相差的毫秒数
Long d= num/24/60/60/1000;
int day=d.intValue();
String sql="";
if(day==0){
sql=" created_time>=TODAY() and created_time< TODAY() + 1d ";
}else{
sql=" created_time>=TODAY() - "+day+"d and created_time< TODAY() - "+(day-1)+"d ";
}
List<HYGFJPInverterWarn> hygfjpDayPower = hygfjpInverterWarnMapper.selectList(
new QueryWrapper<HYGFJPInverterWarn>().last(sql)
.and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (HYGFJPInverterWarn dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
hygfjpInverterWarnMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPInverterWarn;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPStationPowerHistory;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPStationPowerHistoryMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class HYGFJPStationPowerHistoryImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private HYGFJPStationPowerHistoryMapper hygfjpStationPowerHistoryMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
Date star = dft.parse(timeNum);//开始时间
Date endDay= dft.parse(dft.format(new Date()));//结束时间
Long starTime=star.getTime();
Long endTime=endDay.getTime();
Long num=endTime-starTime;//时间戳相差的毫秒数
Long d= num/24/60/60/1000;
int day=d.intValue();
String sql="";
if(day==0){
sql=" created_time>=TODAY() and created_time< TODAY() + 1d ";
}else{
sql=" created_time>=TODAY() - "+day+"d and created_time< TODAY() - "+(day-1)+"d ";
}
List<HYGFJPStationPowerHistory> hygfjpDayPower = hygfjpStationPowerHistoryMapper.selectList(
new QueryWrapper<HYGFJPStationPowerHistory>().last(sql)
.and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (HYGFJPStationPowerHistory dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
hygfjpStationPowerHistoryMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPStationPowerHistory;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterDayGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterDayGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
Date star = dft.parse(timeNum);//开始时间
Date endDay= dft.parse(dft.format(new Date()));//结束时间
Long starTime=star.getTime();
Long endTime=endDay.getTime();
Long num=endTime-starTime;//时间戳相差的毫秒数
Long d= num/24/60/60/1000;
int day=d.intValue();
String sql="";
if(day==0){
sql=" created_time>=TODAY() and created_time< TODAY() + 1d ";
}else{
sql=" created_time>=TODAY() - "+day+"d and created_time< TODAY() - "+(day-1)+"d ";
}
List<TdHYGFInverterDayGenerate> hygfjpDayPower = tdHYGFInverterDayGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterDayGenerate>().last(sql)
.and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterDayGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterDayGenerateMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterMonthGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterMonthGenerateMapper tdHYGFInverterMonthGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy-MM");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFInverterMonthGenerate> hygfjpDayPower = tdHYGFInverterMonthGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterMonthGenerate>().
eq("year_month", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterMonthGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterMonthGenerateMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterTotalGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterTotalGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFInverterTotalGenerate> hygfjpDayPower = tdHYGFInverterTotalGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterTotalGenerate>().
eq("year_time", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterTotalGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterTotalGenerateMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterYearGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterYearGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterYearGenerateMapper tdHYGFInverterYearGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFInverterYearGenerate> hygfjpDayPower = tdHYGFInverterYearGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterYearGenerate>().
eq("year", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterYearGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterYearGenerateMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationDayGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationDayGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFStationDayGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFStationDayGenerateMapper tdHYGFStationDayGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy-MM");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFStationDayGenerate> hygfjpDayPower = tdHYGFStationDayGenerateMapper.selectList(
new QueryWrapper<TdHYGFStationDayGenerate>().
eq("year_month", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFStationDayGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFStationDayGenerateMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationMonthGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFStationMonthGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFStationMonthGenerateMapper tdHYGFStationMonthGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFStationMonthGenerate> hygfjpDayPower = tdHYGFStationMonthGenerateMapper.selectList(
new QueryWrapper<TdHYGFStationMonthGenerate>().
eq("year", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFStationMonthGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFStationMonthGenerateMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationYearGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFStationYearGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFStationYearGenerateMapper tdHYGFStationYearGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFStationYearGenerate> hygfjpDayPower = tdHYGFStationYearGenerateMapper.selectList(
new QueryWrapper<TdHYGFStationYearGenerate>().
eq("year", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFStationYearGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFStationYearGenerateMapper.insert(dayPower);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
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