Commit fee95307 authored by tangwei's avatar tangwei

增加电站统计接口

parent cafc9eac
...@@ -25,7 +25,7 @@ public class JpCollectorDto extends BaseDto { ...@@ -25,7 +25,7 @@ public class JpCollectorDto extends BaseDto {
private String snCode; private String snCode;
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private Integer state; private String state;
@ApiModelProperty(value = "类型") @ApiModelProperty(value = "类型")
private String type; private String type;
......
...@@ -26,7 +26,7 @@ public class JpInverterDto extends BaseDto { ...@@ -26,7 +26,7 @@ public class JpInverterDto extends BaseDto {
private String snCode; private String snCode;
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private Integer state; private String state;
@ApiModelProperty(value = "额定功率") @ApiModelProperty(value = "额定功率")
private Double ratedPower; private Double ratedPower;
......
...@@ -32,7 +32,7 @@ public class JpCollector extends BaseEntity { ...@@ -32,7 +32,7 @@ public class JpCollector extends BaseEntity {
* 状态 * 状态
*/ */
@TableField("state") @TableField("state")
private Integer state; private String state;
/** /**
* 类型 * 类型
......
...@@ -32,7 +32,7 @@ public class JpInverter extends BaseEntity { ...@@ -32,7 +32,7 @@ public class JpInverter extends BaseEntity {
* 状态 * 状态
*/ */
@TableField("state") @TableField("state")
private Integer state; private String state;
/** /**
* 额定功率 * 额定功率
......
package com.yeejoin.amos.boot.module.hygf.api.mapper; package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter; import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/** /**
* 户用光伏监盘逆变器表 Mapper 接口 * 户用光伏监盘逆变器表 Mapper 接口
...@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface JpInverterMapper extends BaseMapper<JpInverter> { public interface JpInverterMapper extends BaseMapper<JpInverter> {
Map<String,Object> queryCountStatus(@Param("dto") JpStationDto reviewDto);
} }
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 第三方场站 Mapper 接口 * 第三方场站 Mapper 接口
...@@ -16,4 +17,7 @@ import java.util.List; ...@@ -16,4 +17,7 @@ import java.util.List;
*/ */
public interface JpStationMapper extends BaseMapper<JpStation> { public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStationDto> queryForDealerReviewPage(@Param("dto") JpStationDto reviewDto); List<JpStationDto> queryForDealerReviewPage(@Param("dto") JpStationDto reviewDto);
JpStationDto queryCount(@Param("dto") JpStationDto reviewDto);
Map<String,Object> countState(@Param("dto") JpStationDto reviewDto);
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper">
<select id="queryCountStatus" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select
hygf_jp_inverter.`status`,
count(hygf_jp_inverter.sequence_nbr) num
from hygf_jp_inverter left JOIN hygf_jp_station
on hygf_jp_station.third_station_id=hygf_jp_inverter.third_station_id
<where>
<if test="dto.nauserNameme!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%")
</if>
<if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if>
<if test="dto.statioId!=null">
and hygf_jp_station.third_station_id in
<foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")">
#{item.stationId}
</foreach>
</if>
<if test="dto.thirdStationId!=null">
and hygf_jp_station.third_station_id =#{dto.thirdStationId}
</if>
</where>
GROUP BY hygf_jp_inverter.`status`
</select>
</mapper> </mapper>
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
<if test="dto.name!=null"> <if test="dto.name!=null">
and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%") and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if> </if>
<if test="dto.nauserNameme!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.nauserNameme}),"%")
</if>
<if test="dto.address!=null"> <if test="dto.address!=null">
and hygf_jp_station.address like concat(concat("%",#{dto.address}),"%") and hygf_jp_station.address like concat(concat("%",#{dto.address}),"%")
</if> </if>
...@@ -31,4 +33,69 @@ ...@@ -31,4 +33,69 @@
</select> </select>
<select id="queryCount" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select
sum(real_time_power) realTimePower,
sum(capacity) capacity,
sum(day_generate) dayGenerate,
sum(month_generate) monthGenerate,
sum(year_generate) yearGenerate,
sum(accumulated_power) accumulatedPower,
sum(day_income) dayIncome,
sum(month_income) monthIncome,
sum(year_income) yearIncome,
sum(cumulative_income) cumulativeIncome,
sum(day_power_use) dayPowerUse,
sum(month_power_use) monthPowerUse,
sum(year_power_use) yearPowerUse,
count(*) countBuiltNum
from hygf_jp_station
<where>
<if test="dto.nauserNameme!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%")
</if>
<if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if>
<if test="dto.statioId!=null">
and hygf_jp_station.third_station_id in
<foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")">
#{item.stationId}
</foreach>
</if>
<if test="dto.thirdStationId!=null">
and hygf_jp_station.third_station_id =#{dto.thirdStationId}
</if>
</where>
</select>
<select id="countState" resultType="map">
select
state,
count(*) num
from hygf_jp_station
<where>
<if test="dto.name!=null">
and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if>
<if test="dto.nauserNameme!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%")
</if>
<if test="dto.statioId!=null">
and hygf_jp_station.third_station_id in
<foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")">
#{item.stationId}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto; ...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.PersonnelBusiness; import com.yeejoin.amos.boot.module.hygf.api.entity.PersonnelBusiness;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser; import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -40,6 +41,8 @@ public class JpStationController extends BaseController { ...@@ -40,6 +41,8 @@ public class JpStationController extends BaseController {
JpStationServiceImpl jpStationServiceImpl; JpStationServiceImpl jpStationServiceImpl;
@Autowired @Autowired
JpPersonStationMapper pPersonStationMapper; JpPersonStationMapper pPersonStationMapper;
@Autowired
JpStationMapper jpStationMapper;
/** /**
* 新增第三方场站 * 新增第三方场站
* *
...@@ -117,6 +120,26 @@ public class JpStationController extends BaseController { ...@@ -117,6 +120,26 @@ public class JpStationController extends BaseController {
Page<JpStationDto> page=jpStationServiceImpl.queryForJpStationPage(current,size,reviewDto); Page<JpStationDto> page=jpStationServiceImpl.queryForJpStationPage(current,size,reviewDto);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryPage")
@ApiOperation(httpMethod = "GET",value = "场站列表", notes = "场站列表")
public ResponseModel<Map<String,Object>> queryForDealerReviewPage(JpStationDto reviewDto) {
//获取当前人管理场站
LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId());
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug);
reviewDto.setStatioId(pPersonStation.isEmpty()?null:pPersonStation);
return ResponseHelper.buildResponse(jpStationMapper.countState(reviewDto));
}
...@@ -162,18 +185,16 @@ public class JpStationController extends BaseController { ...@@ -162,18 +185,16 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "电站监控电量收益", notes = "电站监控电量收益") @ApiOperation(httpMethod = "GET",value = "电站监控电量收益", notes = "电站监控电量收益")
@GetMapping(value = "/getIncomePower") @GetMapping(value = "/getIncomePower")
public ResponseModel<List<JpStationDto>> getIncomePower() { public ResponseModel<JpStationDto> getIncomePower(JpStationDto reviewDto) {
//获取登陆人所管理电站
//获取当前人管理场站 //获取当前人管理场站
LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>(); if(reviewDto.getThirdStationId()==null){
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId()); //获取当前人管理场站
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug); LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId());
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug);
reviewDto.setStatioId(pPersonStation.isEmpty()?null:pPersonStation);
}
return ResponseHelper.buildResponse(jpStationMapper.queryCount(reviewDto));
return ResponseHelper.buildResponse();
} }
......
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