Commit 4867725e authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer' into developer

parents d670cce5 872e97e4
package com.yeejoin.amos.boot.module.hygf.api.dto;
import lombok.Data;
/**
* ClassName: PowerStationStatistics
* Package: com.yeejoin.amos.boot.module.hygf.api.dto
* Description: 查询区域公司下电站统计信息
*
* @Author zcy
* @Create 2024/4/19 11:09
* @Version 1.0
*/
@Data
public class PowerStationStatistics {
private String regionCompanyName; // 区域公司
private String regionCompanyOrgCode; // 区域公司orgCode
private Integer powerStationNumber; // 电站总数
private Double totalCapacity; // 装机容量
private Double totalDayGenerate; // 日发电量
private Double totalRatedPower; // 额定功率
private Double totalDayIncome; // 日收益
}
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import org.apache.ibatis.annotations.Param;
......@@ -63,4 +64,10 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto);
List<DropDown> getDealerNew(@Param("regionalCompaniesSeq") String regionalCompaniesSeq);
// @UserEmpower(field ={"ORG_CODE"} ,dealerField ={"ORG_CODE"}, fieldConditions ={"in","in"} ,relationship="and",specific=false)
List<PowerStationStatistics> getRegionPage(String regionName);
PowerStationStatistics getRegionStatistics(String orgCode);
}
package com.yeejoin.amos.boot.module.hygf.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import java.util.List;
......@@ -33,4 +35,6 @@ public interface IJpStationService {
Map<String, List<Object>> getPowerqxnew(String date, JpStationDto reviewDto);
Page<PowerStationStatistics> getRegionStatistics(Integer current, Integer size, String regionName);
}
......@@ -615,4 +615,27 @@
</where>
</select>
<select id="getRegionPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics">
SELECT privilege_company.ORG_CODE regionCompanyOrgCode ,
privilege_company.COMPANY_NAME regionCompanyName
FROM privilege_company
<where>
IS_DELETED=0 and privilege_company.COMPANY_TYPE = 'region'
<if test="regionName != null and regionName !=''">
and privilege_company.COMPANY_NAME like concat("%",#{regionName},"%")
</if>
</where>
</select>
<select id="getRegionStatistics" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics">
SELECT COUNT(*) AS powerStationNumber,
ROUND(SUM(capacity), 2) AS totalCapacity,
ROUND(SUM(day_generate), 2) AS totalDayGenerate,
ROUND(SUM(rated_power), 2) AS totalRatedPower,
ROUND(SUM(day_income), 2) AS totalDayIncome
FROM hygf_jp_station hjs
WHERE hjs.regional_companies_code = #{orgCode}
</select>
</mapper>
......@@ -9,6 +9,8 @@ import com.yeejoin.amos.boot.module.hygf.api.config.DealerRestrict;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.MaintenanceDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DayGenerateServiceImpl;
......@@ -552,31 +554,31 @@ public class JpStationController extends BaseController {
map.put("name1", "实时功率(kW)");
map.put("name2", "组件总容量(MWp)");
map.put("value1", jpStation.getRealTimePower()!=null?format2.format(jpStation.getRealTimePower()):0);
map.put("value1", jpStation.getRealTimePower() != null ? format2.format(jpStation.getRealTimePower()) : 0);
//硫
map.put("value2", jpStation.getCapacity()!=null?format2.format(jpStation.getCapacity()):0);
map.put("value2", jpStation.getCapacity() != null ? format2.format(jpStation.getCapacity()) : 0);
Map<String, Object> map2 = new HashMap<>();
map2.put("name1", "当日电量(MWh)");
map2.put("name2", "当日收益(元)");
//炭
map2.put("value1", jpStation.getDayGenerate()!=null?format2.format(jpStation.getDayGenerate()):0);
map2.put("value1", jpStation.getDayGenerate() != null ? format2.format(jpStation.getDayGenerate()) : 0);
//硫
map2.put("value2", jpStation.getDayIncome()!=null?format2.format(jpStation.getDayIncome()):0);
map2.put("value2", jpStation.getDayIncome() != null ? format2.format(jpStation.getDayIncome()) : 0);
Map<String, Object> map3 = new HashMap<>();
map3.put("name1", "当月电量(MWh)");
map3.put("name2", "当月收益(万元)");
//炭
map3.put("value1", jpStation.getMonthGenerate()!=null?format2.format(jpStation.getMonthGenerate()):0);
map3.put("value1", jpStation.getMonthGenerate() != null ? format2.format(jpStation.getMonthGenerate()) : 0);
//硫
map3.put("value2", jpStation.getMonthIncome()!=null?format2.format(jpStation.getMonthIncome()):0);
map3.put("value2", jpStation.getMonthIncome() != null ? format2.format(jpStation.getMonthIncome()) : 0);
Map<String, Object> map4 = new HashMap<>();
map4.put("name1", "累计电量(MWh)");
map4.put("name2", "累计收益(万元)");
//炭
map4.put("value1", jpStation.getAccumulatedPower()!=null?format2.format(jpStation.getAccumulatedPower()):0);
map4.put("value1", jpStation.getAccumulatedPower() != null ? format2.format(jpStation.getAccumulatedPower()) : 0);
//硫
map4.put("value2", jpStation.getCumulativeIncome()!=null?format2.format(jpStation.getCumulativeIncome()):0);
map4.put("value2", jpStation.getCumulativeIncome() != null ? format2.format(jpStation.getCumulativeIncome()) : 0);
date.add(map);
date.add(map2);
......@@ -687,7 +689,7 @@ public class JpStationController extends BaseController {
map.put("id", jpStation.getSequenceNbr());
map.put("name", jpStation.getName());
map.put("address", jpStation.getAddress());
map.put("fullhour", dayGenerate.getFullhour()!=null?format2.format(dayGenerate.getFullhour()):0);
map.put("fullhour", dayGenerate.getFullhour() != null ? format2.format(dayGenerate.getFullhour()) : 0);
li.add(map);
break;
}
......@@ -785,4 +787,15 @@ public class JpStationController extends BaseController {
}
//查询当前登录人权限区域公司统计数据
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司统计数据", notes = "查询当前登录人权限区域公司统计数据")
@GetMapping(value = "/getRegionStatistics")
// @UserLimits
public ResponseModel<Page<PowerStationStatistics>> getRegionStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String regionName) {
Page<PowerStationStatistics> regionStatisticsData = jpStationServiceImpl.getRegionStatistics(current, size, regionName);
return ResponseHelper.buildResponse(regionStatisticsData);
}
}
......@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
* @date 2023-09-19
*/
@Service
public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpStationMapper> implements IJpStationService {
public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, JpStationMapper> implements IJpStationService {
@Autowired
JpStationMapper jpStationMapper;
......@@ -54,18 +54,19 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Autowired
DayGenerateMapper dayGenerateMapper;
DayGenerateMapper dayGenerateMapper;
@Autowired
MonthGenerateMapper monthGenerateMapper;
MonthGenerateMapper monthGenerateMapper;
@Autowired
YearGenerateMapper yearGenerateMapper;
YearGenerateMapper yearGenerateMapper;
private static double FDL = 0.001;
private static int FD = 1000;
private static double FDL=0.001;
private static int FD=1000;
/**
* 分页查询
*/
public Page<JpStationDto> queryForJpStationPage(int pageNum, int pageSize, JpStationDto reviewDto) {
public Page<JpStationDto> queryForJpStationPage(int pageNum, int pageSize, JpStationDto reviewDto) {
PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> list = jpStationMapper.queryForDealerReviewPage(reviewDto);
PageInfo<JpStationDto> page = new PageInfo(list);
......@@ -76,6 +77,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
pagenew.setRecords(page.getList());
return pagenew;
}
@Async
public void getMonthPower() {
monthPowerServiceImpl.getMonthPower();
......@@ -86,7 +88,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
* 分页查询
*/
public Page<JpStationDto> queryForJpStationPagenew(int pageNum, int pageSize, JpStationDto reviewDto) {
public Page<JpStationDto> queryForJpStationPagenew(int pageNum, int pageSize, JpStationDto reviewDto) {
Page<JpStationDto> pageNew = new Page<>(pageNum, pageSize);
// com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
PageHelper.startPage(pageNum, pageSize);
......@@ -100,56 +102,56 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
@Override
public Map<String, List<Object>> getPowerqx(String date, String type,List<String> statioId) {
List<PowerCurveDto> data=null;
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>();
public Map<String, List<Object>> getPowerqx(String date, String type, List<String> statioId) {
List<PowerCurveDto> data = null;
List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
Map<String, List<Object>> map = new HashMap<>();
try {
if(type.equals("day")){
map= gethourList();
data =monthPowerMapper.getDayPowercount(date, statioId);
}else if(type.equals("month")){
map= getDayListOfMonth(date);
data=monthPowerMapper.getMonthPower(date, statioId);
}else if(type.equals("year")){
map= getyearListOfMonth(date);
data= monthPowerMapper.getYearPower(date,statioId);
}else{
map= getyearList();
data= monthPowerMapper.getAllPower(date, statioId);
if (type.equals("day")) {
map = gethourList();
data = monthPowerMapper.getDayPowercount(date, statioId);
} else if (type.equals("month")) {
map = getDayListOfMonth(date);
data = monthPowerMapper.getMonthPower(date, statioId);
} else if (type.equals("year")) {
map = getyearListOfMonth(date);
data = monthPowerMapper.getYearPower(date, statioId);
} else {
map = getyearList();
data = monthPowerMapper.getAllPower(date, statioId);
}
listx =map.get("x");
listy =map.get("y");
if(data!=null&&!data.isEmpty()){
listx = map.get("x");
listy = map.get("y");
if (data != null && !data.isEmpty()) {
for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) {
if(datum.getDate().equals(listx.get(i).toString())){
listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()):null;
listy.add(i,format);
break;
}
if (datum.getDate().equals(listx.get(i).toString())) {
listy.remove(i);
String format = datum.getNum() != null ? new DecimalFormat("0.000").format(datum.getNum()) : null;
listy.add(i, format);
break;
}
}
}
}
if(type.equals("month")||type.equals("year")){
if (type.equals("month") || type.equals("year")) {
listx= listx.stream().map(e-> String.valueOf(e).substring(String.valueOf(e).length()-2)).collect(Collectors.toList());
listx = listx.stream().map(e -> String.valueOf(e).substring(String.valueOf(e).length() - 2)).collect(Collectors.toList());
}
}
map.put("x",listx);
map.put("y",listy);
map.put("x", listx);
map.put("y", listy);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("系统异常!");
throw new BadRequest("系统异常!");
}
return map;
......@@ -157,7 +159,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Override
@UserLimits
public Map<String,Object> getcount(JpStationDto reviewDto) {
public Map<String, Object> getcount(JpStationDto reviewDto) {
return jpStationMapper.getcount(reviewDto);
}
......@@ -174,18 +176,19 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
public List<JpStation>getJpStationList (JpStationDto reviewDto){
List<JpInverter> dataJpInverter=jpInverterMapper.selectList(new QueryWrapper<JpInverter>().isNotNull("third_station_id").isNotNull("sn_code"));
Map<String,List<String>> inverterMap=dataJpInverter.stream().collect(Collectors.groupingBy(JpInverter::getThirdStationId,Collectors.mapping(JpInverter::getSnCode,Collectors.toList())));
List<JpStation> list= jpStationMapper.getJpStationList(reviewDto);
public List<JpStation> getJpStationList(JpStationDto reviewDto) {
List<JpInverter> dataJpInverter = jpInverterMapper.selectList(new QueryWrapper<JpInverter>().isNotNull("third_station_id").isNotNull("sn_code"));
Map<String, List<String>> inverterMap = dataJpInverter.stream().collect(Collectors.groupingBy(JpInverter::getThirdStationId, Collectors.mapping(JpInverter::getSnCode, Collectors.toList())));
List<JpStation> list = jpStationMapper.getJpStationList(reviewDto);
list.forEach(jpStation -> {
List<String> sncodes =inverterMap.get(jpStation.getThirdStationId()).stream().distinct().collect(Collectors.toList());
sncodes = sncodes.stream().filter(s->s.trim().length()>1).collect(Collectors.toList());
List<String> sncodes = inverterMap.get(jpStation.getThirdStationId()).stream().distinct().collect(Collectors.toList());
sncodes = sncodes.stream().filter(s -> s.trim().length() > 1).collect(Collectors.toList());
jpStation.setSnCodes(sncodes);
});
list =list.stream().filter(jpStation -> jpStation.getSnCodes().size()>0).collect(Collectors.toList());
list = list.stream().filter(jpStation -> jpStation.getSnCodes().size() > 0).collect(Collectors.toList());
return list;
}
@Override
@UserLimits
public Map<String, Object> getcountStatejs(JpStationDto reviewDto) {
......@@ -208,59 +211,59 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@UserLimits
public Map<String, List<Object>> getGenerateqx(String date, String type, JpStationDto reviewDto) {
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation=jpStationMapper.getJpStation(reviewDto);
List<String> statioId = new ArrayList();
List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
List<PowerCurveDto> data=null;
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>();
Map<String, List<Object>> map1 =new HashMap<>();
List<PowerCurveDto> data = null;
List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
Map<String, List<Object>> map = new HashMap<>();
Map<String, List<Object>> map1 = new HashMap<>();
try {
if(type.equals("month")){
map= getDayListOfMonth(reviewDto.getTimeDateMonth());
if(statioId!=null&&!statioId.isEmpty()) {
if (type.equals("month")) {
map = getDayListOfMonth(reviewDto.getTimeDateMonth());
if (statioId != null && !statioId.isEmpty()) {
data = dayGenerateMapper.getDayGeneratqx(reviewDto.getTimeDateMonth(), statioId);
}
}else if(type.equals("year")){
map= getyearListOfMonth(reviewDto.getTimeDateYear());
if(statioId!=null&&!statioId.isEmpty()) {
} else if (type.equals("year")) {
map = getyearListOfMonth(reviewDto.getTimeDateYear());
if (statioId != null && !statioId.isEmpty()) {
data = dayGenerateMapper.getMonthGenerateqx(reviewDto.getTimeDateYear(), statioId);
}
}else{
map= getyearList();
if(statioId!=null&&!statioId.isEmpty()) {
} else {
map = getyearList();
if (statioId != null && !statioId.isEmpty()) {
data = dayGenerateMapper.getYearGenerateqx(null, statioId);
}
}
listx =map.get("x");
listy =map.get("y");
if(data!=null&&!data.isEmpty()){
listx = map.get("x");
listy = map.get("y");
if (data != null && !data.isEmpty()) {
for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) {
if(datum.getDate().equals(listx.get(i).toString())){
if (datum.getDate().equals(listx.get(i).toString())) {
listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()*FDL):null;
listy.add(i,format);
String format = datum.getNum() != null ? new DecimalFormat("0.000").format(datum.getNum() * FDL) : null;
listy.add(i, format);
break;
}
}
}
}
if(type.equals("month")||type.equals("year")){
if (type.equals("month") || type.equals("year")) {
listx= listx.stream().map(e-> String.valueOf(e).substring(String.valueOf(e).length()-2)).collect(Collectors.toList());
listx = listx.stream().map(e -> String.valueOf(e).substring(String.valueOf(e).length() - 2)).collect(Collectors.toList());
}
map1.put("axisData",listx);
map1.put("seriesData",listy);
map1.put("axisData", listx);
map1.put("seriesData", listy);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("系统异常!");
throw new BadRequest("系统异常!");
}
return map1;
......@@ -268,44 +271,44 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Override
@UserLimits
public Map<String, List<Object>> getPowerqxnew(String date,JpStationDto reviewDto) {
date = DateUtil.format(new Date(), "yyyy-MM-dd");
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto);
public Map<String, List<Object>> getPowerqxnew(String date, JpStationDto reviewDto) {
date = DateUtil.format(new Date(), "yyyy-MM-dd");
List<String> statioId = new ArrayList();
List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
List<PowerCurveDto> data=null;
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>();
map= gethourList();
data =monthPowerMapper.getDayPowercount(date, statioId);
listx =map.get("x");
listy =map.get("y");
if(data!=null&&!data.isEmpty()){
List<PowerCurveDto> data = null;
List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
Map<String, List<Object>> map = new HashMap<>();
map = gethourList();
data = monthPowerMapper.getDayPowercount(date, statioId);
listx = map.get("x");
listy = map.get("y");
if (data != null && !data.isEmpty()) {
for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) {
if(datum.getDate().equals(listx.get(i).toString())){
if (datum.getDate().equals(listx.get(i).toString())) {
listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()):null;
listy.add(i,format);
String format = datum.getNum() != null ? new DecimalFormat("0.000").format(datum.getNum()) : null;
listy.add(i, format);
break;
}
}
}
}
map.put("axisData",listx);
map.put("seriesData",listy);
map.put("axisData", listx);
map.put("seriesData", listy);
return map;
}
public static Map<String, List<Object>> getDayListOfMonth(String date) {
Map<String, List<Object>> map =new HashMap<>();
public static Map<String, List<Object>> getDayListOfMonth(String date) {
Map<String, List<Object>> map = new HashMap<>();
try {
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
Date dat = sdf.parse(date);
Calendar aCalendar = Calendar.getInstance();
......@@ -313,147 +316,149 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
int month = aCalendar.get(Calendar.MONTH) + 1;//月份
int day = aCalendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) {
String aDate =null;
if(i<10){
aDate = date+"-0"+i;
}else{
aDate = date+"-"+i;
String aDate = null;
if (i < 10) {
aDate = date + "-0" + i;
} else {
aDate = date + "-" + i;
}
listx.add(aDate);
listy.add(null);
}
map.put("x",listx);
map.put("y",listy);
}catch (Exception e){
map.put("x", listx);
map.put("y", listy);
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("系统异常!");
throw new BadRequest("系统异常!");
}
return map;
}
public static Map<String, List<Object>> getyearListOfMonth(String date) {
Map<String, List<Object>> map =new HashMap<>();
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
public static Map<String, List<Object>> getyearListOfMonth(String date) {
Map<String, List<Object>> map = new HashMap<>();
List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
for (int i = 1; i <= 12; i++) {
String aDate =null;
if(i<10){
aDate = date+"-0"+i;
}else{
aDate = date+"-"+i;
String aDate = null;
if (i < 10) {
aDate = date + "-0" + i;
} else {
aDate = date + "-" + i;
}
listx.add(aDate);
listy.add(null);
}
map.put("x",listx);
map.put("y",listy);
map.put("x", listx);
map.put("y", listy);
return map;
}
public static Map<String, List<Object>> getyearList() {
Map<String, List<Object>> map =new HashMap<>();
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
public static Map<String, List<Object>> getyearList() {
Map<String, List<Object>> map = new HashMap<>();
List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
Calendar aCalendar = Calendar.getInstance(Locale.CHINA);
int year = aCalendar.get(Calendar.YEAR);//年份
for (int i = 1; i <= 10; i++) {
int aDate = year-(10-i);
int aDate = year - (10 - i);
listx.add(String.valueOf(aDate));
listy.add(null);
}
map.put("x",listx);
map.put("y",listy);
map.put("x", listx);
map.put("y", listy);
return map;
}
public static Map<String, List<Object>> gethourList() {
Map<String, List<Object>> map =new HashMap<>();
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
public static Map<String, List<Object>> gethourList() {
Map<String, List<Object>> map = new HashMap<>();
List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
try {
ArrayList<String> dates = new ArrayList<String>();
for (int i = 0; i < 24; i++) {
String s1 =i+":00";
String s1 = i + ":00";
listx.add(s1);
listy.add(null);
}
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest("系统异常!");
throw new BadRequest("系统异常!");
}
map.put("x",listx);
map.put("y",listy);
map.put("x", listx);
map.put("y", listy);
return map;
}
@UserLimits
public Page<JpStationDto> queryReport(int pageNum, int pageSize, JpStationDto reviewDto,String type) {
public Page<JpStationDto> queryReport(int pageNum, int pageSize, JpStationDto reviewDto, String type) {
//权限
List<String> statioId=new ArrayList();
List<String> statioId = new ArrayList();
// if(reviewDto.getThirdStationIds()!=null){
// List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null;
// reviewDto.setThirdStationIds(dd);
// }
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto);
if(reviewDto.getThirdStationIds()==null||reviewDto.getThirdStationIds().isEmpty()){
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
reviewDto.setThirdStationIds(statioId);
List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
if (reviewDto.getThirdStationIds() == null || reviewDto.getThirdStationIds().isEmpty()) {
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
reviewDto.setThirdStationIds(statioId);
}
List<JpStationDto> list = null;
int count=0;
if(dataJpStation!=null&&dataJpStation.size()>0){
switch (type){
case"day":
if (StringUtils.isEmpty(reviewDto.getTimeDate())){
reviewDto.setTimeDate(DateUtil.format(new Date(),"yyyy-MM-dd"));
}
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(DayGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper.eq(reviewDto.getTimeDate()!=null&&!reviewDto.getTimeDate().equals(""),DayGenerate::getDayTime,reviewDto.getTimeDate());
count= dayGenerateMapper.selectCount(wapper);
List<DayGenerate> listday= dayGenerateMapper.selectPagenewDayGenerate((pageNum-1)*pageSize,pageSize,reviewDto.getThirdStationIds(),reviewDto.getTimeDate());
list = getJpStationDtoday( dataJpStation, listday);
break;
case"month":
if (StringUtils.isEmpty(reviewDto.getTimeDate())){
reviewDto.setTimeDate(DateUtil.format(new Date(),"yyyy-MM"));
}
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(MonthGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper1.eq(reviewDto.getTimeDate()!=null&&!reviewDto.getTimeDate().equals(""),MonthGenerate::getMonthTime,reviewDto.getTimeDate());
count= monthGenerateMapper.selectCount(wapper1);
List<MonthGenerate> listmonth= monthGenerateMapper.selectPagenewMonthGenerate((pageNum-1)*pageSize,pageSize,reviewDto.getThirdStationIds(),reviewDto.getTimeDate());
list = getJpStationDtomonth( dataJpStation, listmonth);
break;
case"year":
if (StringUtils.isEmpty(reviewDto.getTimeDate())){
reviewDto.setTimeDate(DateUtil.format(new Date(),"yyyy"));
}
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(YearGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper2.eq(reviewDto.getTimeDate()!=null&&!reviewDto.getTimeDate().equals(""),YearGenerate::getYear,reviewDto.getTimeDate());
count= yearGenerateMapper.selectCount(wapper2);
List<YearGenerate> listyear= yearGenerateMapper.selectPagenewYearGenerate((pageNum-1)*pageSize,pageSize,reviewDto.getThirdStationIds(),reviewDto.getTimeDate());
int count = 0;
if (dataJpStation != null && dataJpStation.size() > 0) {
switch (type) {
case "day":
if (StringUtils.isEmpty(reviewDto.getTimeDate())) {
reviewDto.setTimeDate(DateUtil.format(new Date(), "yyyy-MM-dd"));
}
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(DayGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper.eq(reviewDto.getTimeDate() != null && !reviewDto.getTimeDate().equals(""), DayGenerate::getDayTime, reviewDto.getTimeDate());
count = dayGenerateMapper.selectCount(wapper);
List<DayGenerate> listday = dayGenerateMapper.selectPagenewDayGenerate((pageNum - 1) * pageSize, pageSize, reviewDto.getThirdStationIds(), reviewDto.getTimeDate());
list = getJpStationDtoday(dataJpStation, listday);
break;
case "month":
if (StringUtils.isEmpty(reviewDto.getTimeDate())) {
reviewDto.setTimeDate(DateUtil.format(new Date(), "yyyy-MM"));
}
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(MonthGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper1.eq(reviewDto.getTimeDate() != null && !reviewDto.getTimeDate().equals(""), MonthGenerate::getMonthTime, reviewDto.getTimeDate());
count = monthGenerateMapper.selectCount(wapper1);
List<MonthGenerate> listmonth = monthGenerateMapper.selectPagenewMonthGenerate((pageNum - 1) * pageSize, pageSize, reviewDto.getThirdStationIds(), reviewDto.getTimeDate());
list = getJpStationDtomonth(dataJpStation, listmonth);
break;
case "year":
if (StringUtils.isEmpty(reviewDto.getTimeDate())) {
reviewDto.setTimeDate(DateUtil.format(new Date(), "yyyy"));
}
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(YearGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper2.eq(reviewDto.getTimeDate() != null && !reviewDto.getTimeDate().equals(""), YearGenerate::getYear, reviewDto.getTimeDate());
count = yearGenerateMapper.selectCount(wapper2);
List<YearGenerate> listyear = yearGenerateMapper.selectPagenewYearGenerate((pageNum - 1) * pageSize, pageSize, reviewDto.getThirdStationIds(), reviewDto.getTimeDate());
list = getJpStationDtoyear( dataJpStation, listyear);
break;
default:
count= reviewDto.getThirdStationIds()!=null?reviewDto.getThirdStationIds().size():0;
PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> listJ= jpStationMapper.queryForDealerReviewPage(reviewDto);
list = getJpStationDtoyear(dataJpStation, listyear);
break;
default:
list = getJpStationDtoAlldto(listJ);
}
count = reviewDto.getThirdStationIds() != null ? reviewDto.getThirdStationIds().size() : 0;
PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> listJ = jpStationMapper.queryForDealerReviewPage(reviewDto);
list = getJpStationDtoAlldto(listJ);
}
}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(count);
......@@ -463,68 +468,66 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
public List<JpStationDto> getJpStationDtoAlldto( List<JpStationDto> da){
List<JpStationDto> ld=new ArrayList<>();
for (JpStationDto jpStation : da) {
JpStationDto hd=new JpStationDto();
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower())):null);
hd.setFullhour(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()*FD/jpStation.getCapacity())));
hd.setCumulativeIncome(jpStation.getCumulativeIncome()!=null?Double.valueOf(String.format("%.3f",jpStation.getCumulativeIncome())):null);
ld.add(hd);
}
public List<JpStationDto> getJpStationDtoAlldto(List<JpStationDto> da) {
List<JpStationDto> ld = new ArrayList<>();
for (JpStationDto jpStation : da) {
JpStationDto hd = new JpStationDto();
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower())) : null);
hd.setFullhour(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FD / jpStation.getCapacity())));
hd.setCumulativeIncome(jpStation.getCumulativeIncome() != null ? Double.valueOf(String.format("%.3f", jpStation.getCumulativeIncome())) : null);
ld.add(hd);
}
return ld;
}
public List<JpStationDto> getJpStationDtoAll( List<JpStation> da){
List<JpStationDto> ld=new ArrayList<>();
public List<JpStationDto> getJpStationDtoAll(List<JpStation> da) {
List<JpStationDto> ld = new ArrayList<>();
for (JpStation jpStation : da) {
JpStationDto hd=new JpStationDto();
JpStationDto hd = new JpStationDto();
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setFullhour(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()/jpStation.getCapacity())));
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setFullhour(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() / jpStation.getCapacity())));
hd.setCumulativeIncome(jpStation.getCumulativeIncome()!=null?Double.valueOf(String.format("%.3f",jpStation.getCumulativeIncome())):null);
hd.setCumulativeIncome(jpStation.getCumulativeIncome() != null ? Double.valueOf(String.format("%.3f", jpStation.getCumulativeIncome())) : null);
ld.add(hd);
}
return ld;
}
public List<JpStationDto> getJpStationDtoday( List<JpStation> da, List<DayGenerate> listday){
List<JpStationDto> ld=new ArrayList<>();
public List<JpStationDto> getJpStationDtoday(List<JpStation> da, List<DayGenerate> listday) {
List<JpStationDto> ld = new ArrayList<>();
for (DayGenerate dayGenerate : listday) {
JpStationDto hd=new JpStationDto();
JpStationDto hd = new JpStationDto();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setDayGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setDayIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
break;
}
}
......@@ -532,12 +535,13 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
return ld;
}
public List<JpStationDto> getJpStationDtomonth( List<JpStation> da, List<MonthGenerate> listmonth){
List<JpStationDto> ld=new ArrayList<>();
public List<JpStationDto> getJpStationDtomonth(List<JpStation> da, List<MonthGenerate> listmonth) {
List<JpStationDto> ld = new ArrayList<>();
for (MonthGenerate dayGenerate : listmonth) {
JpStationDto hd=new JpStationDto();
JpStationDto hd = new JpStationDto();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
......@@ -545,11 +549,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setMonthGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setMonthIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setMonthGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
break;
}
}
......@@ -557,24 +561,25 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
return ld;
}
public List<JpStationDto> getJpStationDtoyear( List<JpStation> da,List<YearGenerate> listyear){
List<JpStationDto> ld=new ArrayList<>();
public List<JpStationDto> getJpStationDtoyear(List<JpStation> da, List<YearGenerate> listyear) {
List<JpStationDto> ld = new ArrayList<>();
for (YearGenerate dayGenerate : listyear) {
JpStationDto hd=new JpStationDto();
JpStationDto hd = new JpStationDto();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setYearGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setYearIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setYearGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime());
break;
}
......@@ -585,16 +590,16 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
@UserLimits
public List<JpStationDto> selectReportDate(JpStationDto reviewDto,String type,HttpServletResponse response) {
public List<JpStationDto> selectReportDate(JpStationDto reviewDto, String type, HttpServletResponse response) {
//权限
//权限
List<String> statioId=new ArrayList();
List<String> statioId = new ArrayList();
// if(reviewDto.getThirdStationIds()!=null){
// List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null;
// reviewDto.setThirdStationIds(dd);
// }
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto);
if(reviewDto.getThirdStationIds()==null||reviewDto.getThirdStationIds().isEmpty()){
List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
if (reviewDto.getThirdStationIds() == null || reviewDto.getThirdStationIds().isEmpty()) {
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
......@@ -604,12 +609,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
List<JpStationDto> list = null;
try {
if(dataJpStation!=null&&dataJpStation.size()>0) {
if (dataJpStation != null && dataJpStation.size() > 0) {
switch (type) {
case "day":
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(DayGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper.eq(reviewDto.getTimeDate() != null&&!reviewDto.getTimeDate().equals(""), DayGenerate::getDayTime, reviewDto.getTimeDate());
wapper.eq(reviewDto.getTimeDate() != null && !reviewDto.getTimeDate().equals(""), DayGenerate::getDayTime, reviewDto.getTimeDate());
List<DayGenerate> listday = dayGenerateMapper.selectList(wapper);
List<DayGenerateEX> listne = getJpStationDtodaynew(dataJpStation, listday);
......@@ -621,7 +626,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
case "month":
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(MonthGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper1.eq(reviewDto.getTimeDate() != null&&!reviewDto.getTimeDate().equals(""), MonthGenerate::getMonthTime, reviewDto.getTimeDate());
wapper1.eq(reviewDto.getTimeDate() != null && !reviewDto.getTimeDate().equals(""), MonthGenerate::getMonthTime, reviewDto.getTimeDate());
List<MonthGenerate> listmonth = monthGenerateMapper.selectList(wapper1);
List<MonthGenerateEX> lo = getJpStationDtomonthnew(dataJpStation, listmonth);
......@@ -633,7 +638,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
case "year":
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(YearGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper2.eq(reviewDto.getTimeDate() != null&&!reviewDto.getTimeDate().equals(""), YearGenerate::getYear, reviewDto.getTimeDate());
wapper2.eq(reviewDto.getTimeDate() != null && !reviewDto.getTimeDate().equals(""), YearGenerate::getYear, reviewDto.getTimeDate());
List<YearGenerate> listyear = yearGenerateMapper.selectList(wapper2);
List<YearGenerateEX> listy = getJpStationDtoyearnew(dataJpStation, listyear);
setResponseHeadForDowload(response, "电站年报表.xls");
......@@ -655,23 +660,23 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return list;
}
public List<DayGenerateEX> getJpStationDtodaynew( List<JpStation> da, List<DayGenerate> listday){
List<DayGenerateEX> ld=new ArrayList<>();
public List<DayGenerateEX> getJpStationDtodaynew(List<JpStation> da, List<DayGenerate> listday) {
List<DayGenerateEX> ld = new ArrayList<>();
for (DayGenerate dayGenerate : listday) {
DayGenerateEX hd=new DayGenerateEX();
DayGenerateEX hd = new DayGenerateEX();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setDayGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setDayIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
break;
}
}
......@@ -680,21 +685,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return ld;
}
public List<MonthGenerateEX> getJpStationDtomonthnew( List<JpStation> da, List<MonthGenerate> listmonth){
List<MonthGenerateEX> ld=new ArrayList<>();
public List<MonthGenerateEX> getJpStationDtomonthnew(List<JpStation> da, List<MonthGenerate> listmonth) {
List<MonthGenerateEX> ld = new ArrayList<>();
for (MonthGenerate dayGenerate : listmonth) {
MonthGenerateEX hd=new MonthGenerateEX();
MonthGenerateEX hd = new MonthGenerateEX();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setMonthGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setMonthIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setMonthGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
break;
}
}
......@@ -703,21 +708,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return ld;
}
public List<YearGenerateEX> getJpStationDtoyearnew( List<JpStation> da,List<YearGenerate> listyear){
List<YearGenerateEX> ld=new ArrayList<>();
public List<YearGenerateEX> getJpStationDtoyearnew(List<JpStation> da, List<YearGenerate> listyear) {
List<YearGenerateEX> ld = new ArrayList<>();
for (YearGenerate dayGenerate : listyear) {
YearGenerateEX hd=new YearGenerateEX();
YearGenerateEX hd = new YearGenerateEX();
for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setYearGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setYearIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setYearGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime());
break;
}
......@@ -739,4 +744,32 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
e.printStackTrace();
}
}
@Override
public Page<PowerStationStatistics> getRegionStatistics(Integer current, Integer size, String regionName) {
PageHelper.startPage(current, size);
List<PowerStationStatistics> regionPage = jpStationMapper.getRegionPage(regionName);
PageInfo<PowerStationStatistics> page = new PageInfo(regionPage);
Page<PowerStationStatistics> pagenew = new Page<PowerStationStatistics>();
List<PowerStationStatistics> resultPage = new ArrayList<>();
page.getList().stream().forEach(powerStationStatistics -> {
PowerStationStatistics regionStatistics = jpStationMapper.getRegionStatistics(powerStationStatistics.getRegionCompanyOrgCode());
regionStatistics.setRegionCompanyName(powerStationStatistics.getRegionCompanyName());
regionStatistics.setRegionCompanyOrgCode(powerStationStatistics.getRegionCompanyOrgCode());
resultPage.add(regionStatistics);
});
pagenew.setCurrent(current);
pagenew.setTotal(page.getTotal());
pagenew.setSize(size);
pagenew.setRecords(resultPage);
return pagenew;
}
}
\ 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