Commit 1633c285 authored by 朱晨阳's avatar 朱晨阳

添加经销商电站数据统计接口

parent 4867725e
...@@ -13,8 +13,8 @@ import lombok.Data; ...@@ -13,8 +13,8 @@ import lombok.Data;
*/ */
@Data @Data
public class PowerStationStatistics { public class PowerStationStatistics {
private String regionCompanyName; // 区域公司 private String name; // 区域公司/经销商名称
private String regionCompanyOrgCode; // 区域公司orgCode private String code; // 区域公司/经销商code
private Integer powerStationNumber; // 电站总数 private Integer powerStationNumber; // 电站总数
private Double totalCapacity; // 装机容量 private Double totalCapacity; // 装机容量
private Double totalDayGenerate; // 日发电量 private Double totalDayGenerate; // 日发电量
......
...@@ -69,5 +69,9 @@ public interface JpStationMapper extends BaseMapper<JpStation> { ...@@ -69,5 +69,9 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<PowerStationStatistics> getRegionPage(String regionName); List<PowerStationStatistics> getRegionPage(String regionName);
PowerStationStatistics getRegionStatistics(String orgCode); PowerStationStatistics getRegionStatistics(String code);
List<PowerStationStatistics> getDealerPage(String regionCompanyOrgCode, String dealerName);
} }
...@@ -37,4 +37,6 @@ public interface IJpStationService { ...@@ -37,4 +37,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); Page<PowerStationStatistics> getRegionStatistics(Integer current, Integer size, String regionName);
Page<PowerStationStatistics> getDealerStatistics(Integer current, Integer size, String regionCompanyOrgCode, String dealerName);
} }
...@@ -241,20 +241,23 @@ ...@@ -241,20 +241,23 @@
</select> </select>
<select id="getRegion" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown"> <select id="getRegion" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT privilege_company.ORG_CODE orgCode , SELECT privilege_company.ORG_CODE orgCode,
privilege_company.COMPANY_NAME name privilege_company.COMPANY_NAME name
FROM privilege_company FROM privilege_company
WHERE IS_DELETED=0 and privilege_company.COMPANY_TYPE = 'region' WHERE IS_DELETED = 0
and privilege_company.COMPANY_TYPE = 'region'
</select> </select>
<select id="getRegionAll" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown"> <select id="getRegionAll" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT privilege_company.ORG_CODE orgCode , SELECT privilege_company.ORG_CODE orgCode,
privilege_company.COMPANY_NAME name privilege_company.COMPANY_NAME name
FROM privilege_company FROM privilege_company
WHERE IS_DELETED=0 and privilege_company.COMPANY_TYPE = 'region' WHERE IS_DELETED = 0
and privilege_company.COMPANY_TYPE = 'region'
</select> </select>
<select id="getDealer" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown"> <select id="getDealer" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT hygf_unit_info.`name`, hygf_unit_info.amos_company_code orgCode FROM hygf_regional_companies LEFT JOIN hygf_unit_info SELECT hygf_unit_info.`name`, hygf_unit_info.amos_company_code orgCode FROM hygf_regional_companies LEFT JOIN
hygf_unit_info
ON hygf_unit_info.sequence_nbr=hygf_regional_companies.unit_info_id WHERE hygf_unit_info.audit_status='2' ON hygf_unit_info.sequence_nbr=hygf_regional_companies.unit_info_id WHERE hygf_unit_info.audit_status='2'
AND hygf_unit_info.blacklist='0' AND hygf_unit_info.is_delete='0' AND hygf_unit_info.blacklist='0' AND hygf_unit_info.is_delete='0'
<if test="regionalCompaniesCode!=null"> <if test="regionalCompaniesCode!=null">
...@@ -265,7 +268,8 @@ ...@@ -265,7 +268,8 @@
</select> </select>
<select id="getDealerAll" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown"> <select id="getDealerAll" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DropDown">
SELECT hygf_unit_info.`name`, hygf_unit_info.amos_company_code orgCode FROM hygf_regional_companies LEFT JOIN hygf_unit_info SELECT hygf_unit_info.`name`, hygf_unit_info.amos_company_code orgCode FROM hygf_regional_companies LEFT JOIN
hygf_unit_info
ON hygf_unit_info.sequence_nbr=hygf_regional_companies.unit_info_id WHERE hygf_unit_info.audit_status='2' ON hygf_unit_info.sequence_nbr=hygf_regional_companies.unit_info_id WHERE hygf_unit_info.audit_status='2'
AND hygf_unit_info.blacklist='0' AND hygf_unit_info.is_delete='0' AND hygf_unit_info.blacklist='0' AND hygf_unit_info.is_delete='0'
<if test="regionalCompaniesCode!=null"> <if test="regionalCompaniesCode!=null">
...@@ -289,8 +293,6 @@ ...@@ -289,8 +293,6 @@
</select> </select>
<select id="getCountJpStationdata" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto"> <select id="getCountJpStationdata" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
...@@ -579,7 +581,8 @@ ...@@ -579,7 +581,8 @@
`email`, `email`,
rated_power ratedPower, rated_power ratedPower,
ROUND(`day_generate`/capacity,3) fullhour, ROUND(`day_generate`/capacity,3) fullhour,
(select privilege_company.COMPANY_NAME from privilege_company where privilege_company.ORG_CODE=hygf_jp_station.regional_companies_code) regionalCompaniesName (select privilege_company.COMPANY_NAME from privilege_company where
privilege_company.ORG_CODE=hygf_jp_station.regional_companies_code) regionalCompaniesName
from hygf_jp_station from hygf_jp_station
<where> <where>
<if test="dto.name!=null"> <if test="dto.name!=null">
...@@ -617,9 +620,12 @@ ...@@ -617,9 +620,12 @@
</select> </select>
<!-- ========电站监控区域=======-->
<select id="getRegionPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics"> <select id="getRegionPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics">
SELECT privilege_company.ORG_CODE regionCompanyOrgCode , SELECT privilege_company.ORG_CODE code ,
privilege_company.COMPANY_NAME regionCompanyName privilege_company.COMPANY_NAME name
FROM privilege_company FROM privilege_company
<where> <where>
IS_DELETED=0 and privilege_company.COMPANY_TYPE = 'region' IS_DELETED=0 and privilege_company.COMPANY_TYPE = 'region'
...@@ -629,6 +635,7 @@ ...@@ -629,6 +635,7 @@
</where> </where>
</select> </select>
<!-- code参数为区域公司orgCode或经销商orgCode-->
<select id="getRegionStatistics" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics"> <select id="getRegionStatistics" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics">
SELECT COUNT(*) AS powerStationNumber, SELECT COUNT(*) AS powerStationNumber,
ROUND(SUM(capacity), 2) AS totalCapacity, ROUND(SUM(capacity), 2) AS totalCapacity,
...@@ -636,6 +643,24 @@ ...@@ -636,6 +643,24 @@
ROUND(SUM(rated_power), 2) AS totalRatedPower, ROUND(SUM(rated_power), 2) AS totalRatedPower,
ROUND(SUM(day_income), 2) AS totalDayIncome ROUND(SUM(day_income), 2) AS totalDayIncome
FROM hygf_jp_station hjs FROM hygf_jp_station hjs
WHERE hjs.regional_companies_code = #{orgCode} WHERE hjs.regional_companies_code = #{code} or hjs.amos_company_code = #{code}
</select>
<!-- 根据区域orgCode查询经销商-->
<select id="getDealerPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationStatistics">
select hui.name as name, hui.amos_company_code as code
from hygf_regional_companies hrc
RIGHT JOIN hygf_unit_info hui
ON hrc.unit_info_id = hui.sequence_nbr
<where>
hui.blacklist=0 and hui.is_delete=0
<if test="regionCompanyOrgCode != null and regionCompanyOrgCode!=''">
and hrc.regional_companies_code = #{regionCompanyOrgCode}
</if>
<if test="dealerName != null and dealerName!=''">
and hui.name like concat("%",#{dealerName},"%")
</if>
</where>
</select> </select>
</mapper> </mapper>
...@@ -181,8 +181,7 @@ public class JpStationController extends BaseController { ...@@ -181,8 +181,7 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryPage") @GetMapping(value = "/queryPage")
@ApiOperation(httpMethod = "GET", value = "场站列表", notes = "场站列表") @ApiOperation(httpMethod = "GET", value = "场站列表", notes = "场站列表")
public ResponseModel<Page<JpStationDto>> queryForDealerReviewPage(@RequestParam(value = "current") int current, @RequestParam public ResponseModel<Page<JpStationDto>> queryForDealerReviewPage(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, JpStationDto reviewDto) {
(value = "size") int size, JpStationDto reviewDto) {
List<JpPersonStation> pPersonStation = null; List<JpPersonStation> pPersonStation = null;
if (reviewDto.getName() != null && !"".equals(reviewDto.getName())) { if (reviewDto.getName() != null && !"".equals(reviewDto.getName())) {
...@@ -731,8 +730,7 @@ public class JpStationController extends BaseController { ...@@ -731,8 +730,7 @@ public class JpStationController extends BaseController {
@GetMapping(value = "/queryPagenew") @GetMapping(value = "/queryPagenew")
@ApiOperation(httpMethod = "GET", value = "场站列表", notes = "场站列表") @ApiOperation(httpMethod = "GET", value = "场站列表", notes = "场站列表")
@UserLimits @UserLimits
public ResponseModel<Page<JpStationDto>> queryPagenew(@RequestParam(value = "current") int current, @RequestParam public ResponseModel<Page<JpStationDto>> queryPagenew(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, JpStationDto reviewDto) {
(value = "size") int size, JpStationDto reviewDto) {
Page<JpStationDto> page = jpStationServiceImpl.queryForJpStationPagenew(current, size, reviewDto); Page<JpStationDto> page = jpStationServiceImpl.queryForJpStationPagenew(current, size, reviewDto);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
...@@ -740,8 +738,7 @@ public class JpStationController extends BaseController { ...@@ -740,8 +738,7 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/queryReport") @PostMapping(value = "/queryReport")
@ApiOperation(httpMethod = "POST", value = "场站报表", notes = "场站报表") @ApiOperation(httpMethod = "POST", value = "场站报表", notes = "场站报表")
public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, @RequestBody JpStationDto reviewDto, @RequestParam(value = "type") String type) {
(value = "size") int size, @RequestBody JpStationDto reviewDto, @RequestParam(value = "type") String type) {
Page<JpStationDto> page = jpStationServiceImpl.queryReport(current, size, reviewDto, type); Page<JpStationDto> page = jpStationServiceImpl.queryReport(current, size, reviewDto, type);
...@@ -792,10 +789,22 @@ public class JpStationController extends BaseController { ...@@ -792,10 +789,22 @@ public class JpStationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司统计数据", notes = "查询当前登录人权限区域公司统计数据") @ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司统计数据", notes = "查询当前登录人权限区域公司统计数据")
@GetMapping(value = "/getRegionStatistics") @GetMapping(value = "/getRegionStatistics")
// @UserLimits // @UserLimits
public ResponseModel<Page<PowerStationStatistics>> getRegionStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String regionName) { public ResponseModel<Page<PowerStationStatistics>> getRegionStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, @RequestParam(required = false) String regionName) {
Page<PowerStationStatistics> regionStatisticsData = jpStationServiceImpl.getRegionStatistics(current, size, regionName); Page<PowerStationStatistics> poserStatisticsData = jpStationServiceImpl.getRegionStatistics(current, size, regionName);
return ResponseHelper.buildResponse(regionStatisticsData); return ResponseHelper.buildResponse(poserStatisticsData);
}
//查询经销商统计数据(根据区域公司orgCode)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询经销商统计数据", notes = "查询经销商统计数据")
@GetMapping(value = "/getDealerStatistics")
// @UserLimits
public ResponseModel<Page<PowerStationStatistics>> getDealerStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String regionCompanyOrgCode, @RequestParam(required = false) String dealerName) {
Page<PowerStationStatistics> poserStatisticsData = jpStationServiceImpl.getDealerStatistics(current, size, regionCompanyOrgCode, dealerName);
return ResponseHelper.buildResponse(poserStatisticsData);
} }
} }
...@@ -757,9 +757,9 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J ...@@ -757,9 +757,9 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
List<PowerStationStatistics> resultPage = new ArrayList<>(); List<PowerStationStatistics> resultPage = new ArrayList<>();
page.getList().stream().forEach(powerStationStatistics -> { page.getList().stream().forEach(powerStationStatistics -> {
PowerStationStatistics regionStatistics = jpStationMapper.getRegionStatistics(powerStationStatistics.getRegionCompanyOrgCode()); PowerStationStatistics regionStatistics = jpStationMapper.getRegionStatistics(powerStationStatistics.getCode());
regionStatistics.setRegionCompanyName(powerStationStatistics.getRegionCompanyName()); regionStatistics.setName(powerStationStatistics.getName());
regionStatistics.setRegionCompanyOrgCode(powerStationStatistics.getRegionCompanyOrgCode()); regionStatistics.setCode(powerStationStatistics.getCode());
resultPage.add(regionStatistics); resultPage.add(regionStatistics);
}); });
...@@ -772,4 +772,30 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J ...@@ -772,4 +772,30 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
return pagenew; return pagenew;
} }
@Override
public Page<PowerStationStatistics> getDealerStatistics(Integer current, Integer size, String regionCompanyOrgCode, String dealerName) {
PageHelper.startPage(current, size);
// 根据区域公司orgCode查询区域公司下所有的经销商
List<PowerStationStatistics> dealerPage = jpStationMapper.getDealerPage(regionCompanyOrgCode, dealerName);
PageInfo<PowerStationStatistics> page = new PageInfo(dealerPage);
Page<PowerStationStatistics> pagenew = new Page<PowerStationStatistics>();
List<PowerStationStatistics> resultPage = new ArrayList<>();
page.getList().stream().forEach(powerStationStatistics -> {
PowerStationStatistics regionStatistics = jpStationMapper.getRegionStatistics(powerStationStatistics.getCode());
regionStatistics.setName(powerStationStatistics.getName());
regionStatistics.setCode(powerStationStatistics.getCode());
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