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; ...@@ -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.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown; 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.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -63,4 +64,10 @@ public interface JpStationMapper extends BaseMapper<JpStation> { ...@@ -63,4 +64,10 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto); List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto);
List<DropDown> getDealerNew(@Param("regionalCompaniesSeq") String regionalCompaniesSeq); 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; 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.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import java.util.List; import java.util.List;
...@@ -33,4 +35,6 @@ public interface IJpStationService { ...@@ -33,4 +35,6 @@ public interface IJpStationService {
Map<String, List<Object>> getPowerqxnew(String date, JpStationDto reviewDto); Map<String, List<Object>> getPowerqxnew(String date, JpStationDto reviewDto);
Page<PowerStationStatistics> getRegionStatistics(Integer current, Integer size, String regionName);
} }
...@@ -615,4 +615,27 @@ ...@@ -615,4 +615,27 @@
</where> </where>
</select> </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> </mapper>
...@@ -9,6 +9,8 @@ import com.yeejoin.amos.boot.module.hygf.api.config.DealerRestrict; ...@@ -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.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.DropDown; 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.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.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*; import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DayGenerateServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DayGenerateServiceImpl;
...@@ -552,31 +554,31 @@ public class JpStationController extends BaseController { ...@@ -552,31 +554,31 @@ public class JpStationController extends BaseController {
map.put("name1", "实时功率(kW)"); map.put("name1", "实时功率(kW)");
map.put("name2", "组件总容量(MWp)"); 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<>(); Map<String, Object> map2 = new HashMap<>();
map2.put("name1", "当日电量(MWh)"); map2.put("name1", "当日电量(MWh)");
map2.put("name2", "当日收益(元)"); 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<>(); Map<String, Object> map3 = new HashMap<>();
map3.put("name1", "当月电量(MWh)"); map3.put("name1", "当月电量(MWh)");
map3.put("name2", "当月收益(万元)"); 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<>(); Map<String, Object> map4 = new HashMap<>();
map4.put("name1", "累计电量(MWh)"); map4.put("name1", "累计电量(MWh)");
map4.put("name2", "累计收益(万元)"); 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(map);
date.add(map2); date.add(map2);
...@@ -687,7 +689,7 @@ public class JpStationController extends BaseController { ...@@ -687,7 +689,7 @@ public class JpStationController extends BaseController {
map.put("id", jpStation.getSequenceNbr()); map.put("id", jpStation.getSequenceNbr());
map.put("name", jpStation.getName()); map.put("name", jpStation.getName());
map.put("address", jpStation.getAddress()); 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); li.add(map);
break; break;
} }
...@@ -785,4 +787,15 @@ public class JpStationController extends BaseController { ...@@ -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; ...@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
* @date 2023-09-19 * @date 2023-09-19
*/ */
@Service @Service
public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpStationMapper> implements IJpStationService { public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, JpStationMapper> implements IJpStationService {
@Autowired @Autowired
JpStationMapper jpStationMapper; JpStationMapper jpStationMapper;
...@@ -54,18 +54,19 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -54,18 +54,19 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Autowired @Autowired
DayGenerateMapper dayGenerateMapper; DayGenerateMapper dayGenerateMapper;
@Autowired @Autowired
MonthGenerateMapper monthGenerateMapper; MonthGenerateMapper monthGenerateMapper;
@Autowired @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); PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> list = jpStationMapper.queryForDealerReviewPage(reviewDto); List<JpStationDto> list = jpStationMapper.queryForDealerReviewPage(reviewDto);
PageInfo<JpStationDto> page = new PageInfo(list); PageInfo<JpStationDto> page = new PageInfo(list);
...@@ -76,6 +77,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -76,6 +77,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
pagenew.setRecords(page.getList()); pagenew.setRecords(page.getList());
return pagenew; return pagenew;
} }
@Async @Async
public void getMonthPower() { public void getMonthPower() {
monthPowerServiceImpl.getMonthPower(); monthPowerServiceImpl.getMonthPower();
...@@ -86,7 +88,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -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); 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>(); // com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
...@@ -100,56 +102,56 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -100,56 +102,56 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} }
@Override @Override
public Map<String, List<Object>> getPowerqx(String date, String type,List<String> statioId) { public Map<String, List<Object>> getPowerqx(String date, String type, List<String> statioId) {
List<PowerCurveDto> data=null; List<PowerCurveDto> data = null;
List<Object> listx =new ArrayList<>(); List<Object> listx = new ArrayList<>();
List<Object> listy =new ArrayList<>(); List<Object> listy = new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>(); Map<String, List<Object>> map = new HashMap<>();
try { try {
if(type.equals("day")){ if (type.equals("day")) {
map= gethourList(); map = gethourList();
data =monthPowerMapper.getDayPowercount(date, statioId); data = monthPowerMapper.getDayPowercount(date, statioId);
}else if(type.equals("month")){ } else if (type.equals("month")) {
map= getDayListOfMonth(date); map = getDayListOfMonth(date);
data=monthPowerMapper.getMonthPower(date, statioId); data = monthPowerMapper.getMonthPower(date, statioId);
}else if(type.equals("year")){ } else if (type.equals("year")) {
map= getyearListOfMonth(date); map = getyearListOfMonth(date);
data= monthPowerMapper.getYearPower(date,statioId); data = monthPowerMapper.getYearPower(date, statioId);
}else{ } else {
map= getyearList(); map = getyearList();
data= monthPowerMapper.getAllPower(date, statioId); data = monthPowerMapper.getAllPower(date, statioId);
} }
listx =map.get("x"); listx = map.get("x");
listy =map.get("y"); listy = map.get("y");
if(data!=null&&!data.isEmpty()){ if (data != null && !data.isEmpty()) {
for (PowerCurveDto datum : data) { for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) { 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); listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()):null; String format = datum.getNum() != null ? new DecimalFormat("0.000").format(datum.getNum()) : null;
listy.add(i,format); listy.add(i, format);
break; 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("x", listx);
map.put("y",listy); map.put("y", listy);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("系统异常!"); throw new BadRequest("系统异常!");
} }
return map; return map;
...@@ -157,7 +159,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -157,7 +159,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Override @Override
@UserLimits @UserLimits
public Map<String,Object> getcount(JpStationDto reviewDto) { public Map<String, Object> getcount(JpStationDto reviewDto) {
return jpStationMapper.getcount(reviewDto); return jpStationMapper.getcount(reviewDto);
} }
...@@ -174,18 +176,19 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -174,18 +176,19 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} }
public List<JpStation>getJpStationList (JpStationDto reviewDto){ public List<JpStation> getJpStationList(JpStationDto reviewDto) {
List<JpInverter> dataJpInverter=jpInverterMapper.selectList(new QueryWrapper<JpInverter>().isNotNull("third_station_id").isNotNull("sn_code")); 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()))); 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<JpStation> list = jpStationMapper.getJpStationList(reviewDto);
list.forEach(jpStation -> { list.forEach(jpStation -> {
List<String> sncodes =inverterMap.get(jpStation.getThirdStationId()).stream().distinct().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()); sncodes = sncodes.stream().filter(s -> s.trim().length() > 1).collect(Collectors.toList());
jpStation.setSnCodes(sncodes); 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; return list;
} }
@Override @Override
@UserLimits @UserLimits
public Map<String, Object> getcountStatejs(JpStationDto reviewDto) { public Map<String, Object> getcountStatejs(JpStationDto reviewDto) {
...@@ -208,59 +211,59 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -208,59 +211,59 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@UserLimits @UserLimits
public Map<String, List<Object>> getGenerateqx(String date, String type, JpStationDto reviewDto) { public Map<String, List<Object>> getGenerateqx(String date, String type, JpStationDto reviewDto) {
List<String> statioId=new ArrayList(); List<String> statioId = new ArrayList();
List<JpStation> dataJpStation=jpStationMapper.getJpStation(reviewDto); List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) { for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId()); statioId.add(jpStation.getThirdStationId());
} }
List<PowerCurveDto> data=null; List<PowerCurveDto> data = null;
List<Object> listx =new ArrayList<>(); List<Object> listx = new ArrayList<>();
List<Object> listy =new ArrayList<>(); List<Object> listy = new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>(); Map<String, List<Object>> map = new HashMap<>();
Map<String, List<Object>> map1 =new HashMap<>(); Map<String, List<Object>> map1 = new HashMap<>();
try { try {
if(type.equals("month")){ if (type.equals("month")) {
map= getDayListOfMonth(reviewDto.getTimeDateMonth()); map = getDayListOfMonth(reviewDto.getTimeDateMonth());
if(statioId!=null&&!statioId.isEmpty()) { if (statioId != null && !statioId.isEmpty()) {
data = dayGenerateMapper.getDayGeneratqx(reviewDto.getTimeDateMonth(), statioId); data = dayGenerateMapper.getDayGeneratqx(reviewDto.getTimeDateMonth(), statioId);
} }
}else if(type.equals("year")){ } else if (type.equals("year")) {
map= getyearListOfMonth(reviewDto.getTimeDateYear()); map = getyearListOfMonth(reviewDto.getTimeDateYear());
if(statioId!=null&&!statioId.isEmpty()) { if (statioId != null && !statioId.isEmpty()) {
data = dayGenerateMapper.getMonthGenerateqx(reviewDto.getTimeDateYear(), statioId); data = dayGenerateMapper.getMonthGenerateqx(reviewDto.getTimeDateYear(), statioId);
} }
}else{ } else {
map= getyearList(); map = getyearList();
if(statioId!=null&&!statioId.isEmpty()) { if (statioId != null && !statioId.isEmpty()) {
data = dayGenerateMapper.getYearGenerateqx(null, statioId); data = dayGenerateMapper.getYearGenerateqx(null, statioId);
} }
} }
listx =map.get("x"); listx = map.get("x");
listy =map.get("y"); listy = map.get("y");
if(data!=null&&!data.isEmpty()){ if (data != null && !data.isEmpty()) {
for (PowerCurveDto datum : data) { for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) { 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); listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()*FDL):null; String format = datum.getNum() != null ? new DecimalFormat("0.000").format(datum.getNum() * FDL) : null;
listy.add(i,format); listy.add(i, format);
break; 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("axisData", listx);
map1.put("seriesData",listy); map1.put("seriesData", listy);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("系统异常!"); throw new BadRequest("系统异常!");
} }
return map1; return map1;
...@@ -268,44 +271,44 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -268,44 +271,44 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Override @Override
@UserLimits @UserLimits
public Map<String, List<Object>> getPowerqxnew(String date,JpStationDto reviewDto) { public Map<String, List<Object>> getPowerqxnew(String date, JpStationDto reviewDto) {
date = DateUtil.format(new Date(), "yyyy-MM-dd"); date = DateUtil.format(new Date(), "yyyy-MM-dd");
List<String> statioId=new ArrayList(); List<String> statioId = new ArrayList();
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto); List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) { for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId()); statioId.add(jpStation.getThirdStationId());
} }
List<PowerCurveDto> data=null; List<PowerCurveDto> data = null;
List<Object> listx =new ArrayList<>(); List<Object> listx = new ArrayList<>();
List<Object> listy =new ArrayList<>(); List<Object> listy = new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>(); Map<String, List<Object>> map = new HashMap<>();
map= gethourList(); map = gethourList();
data =monthPowerMapper.getDayPowercount(date, statioId); data = monthPowerMapper.getDayPowercount(date, statioId);
listx =map.get("x"); listx = map.get("x");
listy =map.get("y"); listy = map.get("y");
if(data!=null&&!data.isEmpty()){ if (data != null && !data.isEmpty()) {
for (PowerCurveDto datum : data) { for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) { 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); listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()):null; String format = datum.getNum() != null ? new DecimalFormat("0.000").format(datum.getNum()) : null;
listy.add(i,format); listy.add(i, format);
break; break;
} }
} }
} }
} }
map.put("axisData",listx); map.put("axisData", listx);
map.put("seriesData",listy); map.put("seriesData", listy);
return map; return map;
} }
public static Map<String, List<Object>> getDayListOfMonth(String date) { public static Map<String, List<Object>> getDayListOfMonth(String date) {
Map<String, List<Object>> map =new HashMap<>(); Map<String, List<Object>> map = new HashMap<>();
try { try {
List<Object> listx =new ArrayList<>(); List<Object> listx = new ArrayList<>();
List<Object> listy =new ArrayList<>(); List<Object> listy = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
Date dat = sdf.parse(date); Date dat = sdf.parse(date);
Calendar aCalendar = Calendar.getInstance(); Calendar aCalendar = Calendar.getInstance();
...@@ -313,147 +316,149 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -313,147 +316,149 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
int month = aCalendar.get(Calendar.MONTH) + 1;//月份 int month = aCalendar.get(Calendar.MONTH) + 1;//月份
int day = aCalendar.getActualMaximum(Calendar.DATE); int day = aCalendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) { for (int i = 1; i <= day; i++) {
String aDate =null; String aDate = null;
if(i<10){ if (i < 10) {
aDate = date+"-0"+i; aDate = date + "-0" + i;
}else{ } else {
aDate = date+"-"+i; aDate = date + "-" + i;
} }
listx.add(aDate); listx.add(aDate);
listy.add(null); listy.add(null);
} }
map.put("x",listx); map.put("x", listx);
map.put("y",listy); map.put("y", listy);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("系统异常!"); throw new BadRequest("系统异常!");
} }
return map; return map;
} }
public static Map<String, List<Object>> getyearListOfMonth(String date) {
Map<String, List<Object>> map =new HashMap<>(); public static Map<String, List<Object>> getyearListOfMonth(String date) {
List<Object> listx =new ArrayList<>(); Map<String, List<Object>> map = new HashMap<>();
List<Object> listy =new ArrayList<>(); List<Object> listx = new ArrayList<>();
List<Object> listy = new ArrayList<>();
for (int i = 1; i <= 12; i++) { for (int i = 1; i <= 12; i++) {
String aDate =null; String aDate = null;
if(i<10){ if (i < 10) {
aDate = date+"-0"+i; aDate = date + "-0" + i;
}else{ } else {
aDate = date+"-"+i; aDate = date + "-" + i;
} }
listx.add(aDate); listx.add(aDate);
listy.add(null); listy.add(null);
} }
map.put("x",listx); map.put("x", listx);
map.put("y",listy); map.put("y", listy);
return map; return map;
} }
public static Map<String, List<Object>> getyearList() { public static Map<String, List<Object>> getyearList() {
Map<String, List<Object>> map =new HashMap<>(); Map<String, List<Object>> map = new HashMap<>();
List<Object> listx =new ArrayList<>(); List<Object> listx = new ArrayList<>();
List<Object> listy =new ArrayList<>(); List<Object> listy = new ArrayList<>();
Calendar aCalendar = Calendar.getInstance(Locale.CHINA); Calendar aCalendar = Calendar.getInstance(Locale.CHINA);
int year = aCalendar.get(Calendar.YEAR);//年份 int year = aCalendar.get(Calendar.YEAR);//年份
for (int i = 1; i <= 10; i++) { for (int i = 1; i <= 10; i++) {
int aDate = year-(10-i); int aDate = year - (10 - i);
listx.add(String.valueOf(aDate)); listx.add(String.valueOf(aDate));
listy.add(null); listy.add(null);
} }
map.put("x",listx); map.put("x", listx);
map.put("y",listy); map.put("y", listy);
return map; return map;
} }
public static Map<String, List<Object>> gethourList() { public static Map<String, List<Object>> gethourList() {
Map<String, List<Object>> map =new HashMap<>(); Map<String, List<Object>> map = new HashMap<>();
List<Object> listx =new ArrayList<>(); List<Object> listx = new ArrayList<>();
List<Object> listy =new ArrayList<>(); List<Object> listy = new ArrayList<>();
try { try {
ArrayList<String> dates = new ArrayList<String>(); ArrayList<String> dates = new ArrayList<String>();
for (int i = 0; i < 24; i++) { for (int i = 0; i < 24; i++) {
String s1 =i+":00"; String s1 = i + ":00";
listx.add(s1); listx.add(s1);
listy.add(null); listy.add(null);
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("系统异常!"); throw new BadRequest("系统异常!");
} }
map.put("x",listx); map.put("x", listx);
map.put("y",listy); map.put("y", listy);
return map; return map;
} }
@UserLimits @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){ // if(reviewDto.getThirdStationIds()!=null){
// List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null; // List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null;
// reviewDto.setThirdStationIds(dd); // reviewDto.setThirdStationIds(dd);
// } // }
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto); List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
if(reviewDto.getThirdStationIds()==null||reviewDto.getThirdStationIds().isEmpty()){ if (reviewDto.getThirdStationIds() == null || reviewDto.getThirdStationIds().isEmpty()) {
for (JpStation jpStation : dataJpStation) { for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId()); statioId.add(jpStation.getThirdStationId());
}
reviewDto.setThirdStationIds(statioId);
} }
reviewDto.setThirdStationIds(statioId);
}
List<JpStationDto> list = null; List<JpStationDto> list = null;
int count=0; int count = 0;
if(dataJpStation!=null&&dataJpStation.size()>0){ if (dataJpStation != null && dataJpStation.size() > 0) {
switch (type){ switch (type) {
case"day": case "day":
if (StringUtils.isEmpty(reviewDto.getTimeDate())){ if (StringUtils.isEmpty(reviewDto.getTimeDate())) {
reviewDto.setTimeDate(DateUtil.format(new Date(),"yyyy-MM-dd")); reviewDto.setTimeDate(DateUtil.format(new Date(), "yyyy-MM-dd"));
} }
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>(); LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(DayGenerate::getThirdStationId,reviewDto.getThirdStationIds()); 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());
count= dayGenerateMapper.selectCount(wapper); count = dayGenerateMapper.selectCount(wapper);
List<DayGenerate> listday= dayGenerateMapper.selectPagenewDayGenerate((pageNum-1)*pageSize,pageSize,reviewDto.getThirdStationIds(),reviewDto.getTimeDate()); List<DayGenerate> listday = dayGenerateMapper.selectPagenewDayGenerate((pageNum - 1) * pageSize, pageSize, reviewDto.getThirdStationIds(), reviewDto.getTimeDate());
list = getJpStationDtoday( dataJpStation, listday); list = getJpStationDtoday(dataJpStation, listday);
break; break;
case"month": case "month":
if (StringUtils.isEmpty(reviewDto.getTimeDate())){ if (StringUtils.isEmpty(reviewDto.getTimeDate())) {
reviewDto.setTimeDate(DateUtil.format(new Date(),"yyyy-MM")); reviewDto.setTimeDate(DateUtil.format(new Date(), "yyyy-MM"));
} }
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>(); LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(MonthGenerate::getThirdStationId,reviewDto.getThirdStationIds()); 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());
count= monthGenerateMapper.selectCount(wapper1); count = monthGenerateMapper.selectCount(wapper1);
List<MonthGenerate> listmonth= monthGenerateMapper.selectPagenewMonthGenerate((pageNum-1)*pageSize,pageSize,reviewDto.getThirdStationIds(),reviewDto.getTimeDate()); 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 = 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; list = getJpStationDtoyear(dataJpStation, listyear);
PageHelper.startPage(pageNum, pageSize); break;
List<JpStationDto> listJ= jpStationMapper.queryForDealerReviewPage(reviewDto); 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>(); com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
pagenew.setTotal(count); pagenew.setTotal(count);
...@@ -463,68 +468,66 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -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();
public List<JpStationDto> getJpStationDtoAlldto( List<JpStationDto> da){ hd.setSequenceNbr(jpStation.getSequenceNbr());
List<JpStationDto> ld=new ArrayList<>(); hd.setCode(jpStation.getCode());
for (JpStationDto jpStation : da) { hd.setName(jpStation.getName());
JpStationDto hd=new JpStationDto(); hd.setUserName(jpStation.getUserName());
hd.setSequenceNbr(jpStation.getSequenceNbr()); hd.setStationContact(jpStation.getStationContact());
hd.setCode(jpStation.getCode()); hd.setState(jpStation.getState());
hd.setName(jpStation.getName()); hd.setThirdStationId(jpStation.getThirdStationId());
hd.setUserName(jpStation.getUserName()); hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower())) : null);
hd.setStationContact(jpStation.getStationContact()); hd.setFullhour(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FD / jpStation.getCapacity())));
hd.setState(jpStation.getState()); hd.setCumulativeIncome(jpStation.getCumulativeIncome() != null ? Double.valueOf(String.format("%.3f", jpStation.getCumulativeIncome())) : null);
hd.setThirdStationId(jpStation.getThirdStationId()); ld.add(hd);
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; 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) { for (JpStation jpStation : da) {
JpStationDto hd=new JpStationDto(); JpStationDto hd = new JpStationDto();
hd.setSequenceNbr(jpStation.getSequenceNbr()); hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode()); hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); 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(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()/jpStation.getCapacity()))); 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); ld.add(hd);
} }
return ld; 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) { for (DayGenerate dayGenerate : listday) {
JpStationDto hd=new JpStationDto(); JpStationDto hd = new JpStationDto();
for (JpStation jpStation : da) { for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){ if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr()); hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode()); hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); 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.setThirdStationId(jpStation.getThirdStationId());
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);
hd.setDayGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null); hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime()); 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; break;
} }
} }
...@@ -532,12 +535,13 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -532,12 +535,13 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} }
return ld; 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) { for (MonthGenerate dayGenerate : listmonth) {
JpStationDto hd=new JpStationDto(); JpStationDto hd = new JpStationDto();
for (JpStation jpStation : da) { for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){ if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr()); hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode()); hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
...@@ -545,11 +549,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -545,11 +549,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId()); hd.setThirdStationId(jpStation.getThirdStationId());
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.setMonthGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):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.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime()); 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; break;
} }
} }
...@@ -557,24 +561,25 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -557,24 +561,25 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} }
return ld; 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) { for (YearGenerate dayGenerate : listyear) {
JpStationDto hd=new JpStationDto(); JpStationDto hd = new JpStationDto();
for (JpStation jpStation : da) { for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){ if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setSequenceNbr(jpStation.getSequenceNbr()); hd.setSequenceNbr(jpStation.getSequenceNbr());
hd.setCode(jpStation.getCode()); hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); 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.setThirdStationId(jpStation.getThirdStationId());
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);
hd.setYearGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):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.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime()); hd.setTimeDate(dayGenerate.getYearTime());
break; break;
} }
...@@ -585,16 +590,16 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -585,16 +590,16 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} }
@UserLimits @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){ // if(reviewDto.getThirdStationIds()!=null){
// List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null; // List<String> dd= reviewDto.getThirdStationIds()!=null? JSON.parseArray(reviewDto.getThirdStationIds().get(0),String.class):null;
// reviewDto.setThirdStationIds(dd); // reviewDto.setThirdStationIds(dd);
// } // }
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto); List<JpStation> dataJpStation = jpStationMapper.getJpStation(reviewDto);
if(reviewDto.getThirdStationIds()==null||reviewDto.getThirdStationIds().isEmpty()){ if (reviewDto.getThirdStationIds() == null || reviewDto.getThirdStationIds().isEmpty()) {
for (JpStation jpStation : dataJpStation) { for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId()); statioId.add(jpStation.getThirdStationId());
} }
...@@ -604,12 +609,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -604,12 +609,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
List<JpStationDto> list = null; List<JpStationDto> list = null;
try { try {
if(dataJpStation!=null&&dataJpStation.size()>0) { if (dataJpStation != null && dataJpStation.size() > 0) {
switch (type) { switch (type) {
case "day": case "day":
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>(); LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(DayGenerate::getThirdStationId, reviewDto.getThirdStationIds()); 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<DayGenerate> listday = dayGenerateMapper.selectList(wapper);
List<DayGenerateEX> listne = getJpStationDtodaynew(dataJpStation, listday); List<DayGenerateEX> listne = getJpStationDtodaynew(dataJpStation, listday);
...@@ -621,7 +626,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -621,7 +626,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
case "month": case "month":
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>(); LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(MonthGenerate::getThirdStationId, reviewDto.getThirdStationIds()); 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<MonthGenerate> listmonth = monthGenerateMapper.selectList(wapper1);
List<MonthGenerateEX> lo = getJpStationDtomonthnew(dataJpStation, listmonth); List<MonthGenerateEX> lo = getJpStationDtomonthnew(dataJpStation, listmonth);
...@@ -633,7 +638,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -633,7 +638,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
case "year": case "year":
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>(); LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(YearGenerate::getThirdStationId, reviewDto.getThirdStationIds()); 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<YearGenerate> listyear = yearGenerateMapper.selectList(wapper2);
List<YearGenerateEX> listy = getJpStationDtoyearnew(dataJpStation, listyear); List<YearGenerateEX> listy = getJpStationDtoyearnew(dataJpStation, listyear);
setResponseHeadForDowload(response, "电站年报表.xls"); setResponseHeadForDowload(response, "电站年报表.xls");
...@@ -655,23 +660,23 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -655,23 +660,23 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return list; return list;
} }
public List<DayGenerateEX> getJpStationDtodaynew( List<JpStation> da, List<DayGenerate> listday){ public List<DayGenerateEX> getJpStationDtodaynew(List<JpStation> da, List<DayGenerate> listday) {
List<DayGenerateEX> ld=new ArrayList<>(); List<DayGenerateEX> ld = new ArrayList<>();
for (DayGenerate dayGenerate : listday) { for (DayGenerate dayGenerate : listday) {
DayGenerateEX hd=new DayGenerateEX(); DayGenerateEX hd = new DayGenerateEX();
for (JpStation jpStation : da) { for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){ if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode()); hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); 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.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.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime()); 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; break;
} }
} }
...@@ -680,21 +685,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -680,21 +685,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return ld; return ld;
} }
public List<MonthGenerateEX> getJpStationDtomonthnew( List<JpStation> da, List<MonthGenerate> listmonth){ public List<MonthGenerateEX> getJpStationDtomonthnew(List<JpStation> da, List<MonthGenerate> listmonth) {
List<MonthGenerateEX> ld=new ArrayList<>(); List<MonthGenerateEX> ld = new ArrayList<>();
for (MonthGenerate dayGenerate : listmonth) { for (MonthGenerate dayGenerate : listmonth) {
MonthGenerateEX hd=new MonthGenerateEX(); MonthGenerateEX hd = new MonthGenerateEX();
for (JpStation jpStation : da) { for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){ if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode()); hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); 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.setMonthGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):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.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime()); 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; break;
} }
} }
...@@ -703,21 +708,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -703,21 +708,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return ld; return ld;
} }
public List<YearGenerateEX> getJpStationDtoyearnew( List<JpStation> da,List<YearGenerate> listyear){ public List<YearGenerateEX> getJpStationDtoyearnew(List<JpStation> da, List<YearGenerate> listyear) {
List<YearGenerateEX> ld=new ArrayList<>(); List<YearGenerateEX> ld = new ArrayList<>();
for (YearGenerate dayGenerate : listyear) { for (YearGenerate dayGenerate : listyear) {
YearGenerateEX hd=new YearGenerateEX(); YearGenerateEX hd = new YearGenerateEX();
for (JpStation jpStation : da) { for (JpStation jpStation : da) {
if(jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())){ if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode()); hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); 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.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.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.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime()); hd.setTimeDate(dayGenerate.getYearTime());
break; break;
} }
...@@ -739,4 +744,32 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -739,4 +744,32 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
e.printStackTrace(); 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