Commit 53e49fab authored by tangwei's avatar tangwei

增加设备统计

parent 2787b259
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.JpCollector;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 户用光伏监盘采集器表 Mapper 接口
......@@ -10,5 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2023-09-19
*/
public interface JpCollectorMapper extends BaseMapper<JpCollector> {
List<Map<String,Object>> queryCountStatus(@Param("dto") JpStationDto reviewDto);
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
......@@ -15,5 +16,5 @@ import java.util.Map;
*/
public interface JpInverterMapper extends BaseMapper<JpInverter> {
Map<String,Object> queryCountStatus(@Param("dto") JpStationDto reviewDto);
List<Map<String,Object>> queryCountStatus(@Param("dto") JpStationDto reviewDto);
}
<?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">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper">
<select id="queryCountStatus" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select
hygf_jp_collector.`status`,
count(hygf_jp_collector.sequence_nbr) num
from hygf_jp_collector left JOIN hygf_jp_station
on hygf_jp_station.third_station_id=hygf_jp_collector.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_collector.`status`
</select>
</mapper>
......@@ -49,7 +49,7 @@
<dependency>
<groupId>com.qiyuesuo.sdk</groupId>
<artifactId>sdk-java</artifactId>
<version>3.6.3</version>
<version>3.0.0</version>
</dependency>
</dependencies>
......
......@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.PersonnelBusiness;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper;
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;
......@@ -43,6 +45,11 @@ public class JpStationController extends BaseController {
JpPersonStationMapper pPersonStationMapper;
@Autowired
JpStationMapper jpStationMapper;
@Autowired
JpCollectorMapper jpCollectorMapper;
@Autowired
JpInverterMapper jpInverterMapper;
/**
* 新增第三方场站
*
......@@ -135,11 +142,24 @@ public class JpStationController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getpStation")
@ApiOperation(httpMethod = "GET",value = "设备监控", notes = "设备监控")
public ResponseModel<Map<String,Object>> getpStation(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);
List<Map<String,Object>> listCollector= jpCollectorMapper.queryCountStatus(reviewDto);
List<Map<String,Object>> listInverter= jpInverterMapper.queryCountStatus(reviewDto);
Map<String,Object> map=new HashMap<>();
map.put("collector",listCollector);
map.put("inverter",listInverter);
return ResponseHelper.buildResponse(map);
}
......
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