mi_weps查询错误修改

This commit is contained in:
wangshilong 2025-02-28 22:47:43 +08:00
parent ce8cd2402c
commit 7b2efe8b35
5 changed files with 37 additions and 18 deletions

View File

@ -44,7 +44,7 @@ public interface DeviceDao extends BaseMapper<Device> {
List<DeviceVO> getDeviceVOByIds(@Param("idList") List<Long> deviceIdList);
List<DeviceHistoryVO> getPressureChartData(Long deviceId, String startTime, String endTime, String tableName);
List<DeviceHistoryVO> getPressureChartData(Long deviceId, String startTime, String endTime, String tableName, String deviceProduct);
List<DeviceHistoryVO> getSwitchStatusData(Long deviceId, String startTime, String endTime, String tableName, String deviceProduct);

View File

@ -37,7 +37,7 @@ public interface DeviceService extends IService<Device> {
List<DeviceVO> getDeviceVOByIds(List<Long> deviceIdList);
List<DeviceHistoryVO> getPressureChartData(Long deviceId, String startTime, String endTime);
List<DeviceHistoryVO> getPressureChartData(Long deviceId, String startTime, String endTime, String deviceProduct);
List<DeviceHistoryVO> getSwitchStatusData(Long deviceId, String startTime, String endTime, String deviceProduct);

View File

@ -282,9 +282,9 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceDao, Device> implements
}
@Override
public List<DeviceHistoryVO> getPressureChartData(Long deviceId, String startTime, String endTime) {
public List<DeviceHistoryVO> getPressureChartData(Long deviceId, String startTime, String endTime, String deviceProduct) {
String tableName = Redis2DBPersistenceService.DEFAULT_DATA_TABLE + deviceId;
return this.deviceDao.getPressureChartData(deviceId, startTime, endTime, tableName);
return this.deviceDao.getPressureChartData(deviceId, startTime, endTime, tableName, deviceProduct);
}
@Override

View File

@ -101,7 +101,7 @@ public class SummaryServiceImpl implements SummaryService {
}
List<String> xAxisData = new ArrayList<>();
List<DeviceHistoryVO> dataList = this.deviceService.getPressureChartData(deviceId, startTime, endTime);
List<DeviceHistoryVO> dataList = this.deviceService.getPressureChartData(deviceId, startTime, endTime, deviceVO.getProduct().getCode());
//将查询到的结果组装成LineSummaryVO返回给前端
LineSummaryVO lineSummaryVO = new LineSummaryVO();
lineSummaryVO.setTitle(deviceVO.getGasWell().getName());

View File

@ -97,27 +97,28 @@
<select id="historyPage" resultType="com.isu.gaswellwatch.vo.DeviceHistoryVO">
select t.collection_time,t.oil_pressure,t.cas_pressure,t.pre_pressure
select t.collection_time,t.oil_pressure,t.cas_pressure
<choose>
<when test="deviceProduct!=null and deviceProduct=='knpc'">
,'knpc' as type,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
,t.pre_pressure,'knpc' as
type,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
</when>
<when test="deviceProduct!=null and deviceProduct=='etc'">
,'etc' as type,t.current_status_remaining_time as statusEndTime
,t.pre_pressure,'etc' as type,t.current_status_remaining_time as statusEndTime
,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='scss'">
,'scss' as type,t.ctl_model as runMode,t.remaining_time_action as statusEndTime
,t.pre_pressure,'scss' as type,t.ctl_model as runMode,t.remaining_time_action as statusEndTime
,t.solar_voltage,t.first_solenoid_status as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='weps_plug'">
,'weps_plug' as type, t.run_mode as runMode
,t.pre_pressure,'weps_plug' as type, t.run_mode as runMode
,case t.solenoid_valve_status when 2 then t.open_well_remaining_time
when 1 then t.close_well_remaining_time else null end as statusEndTime
,case t.solenoid_valve_status when 2 then 1 when 1 then 0 else null end as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='mi_weps_plug'">
,t.produce_mode as runMode,t.remaining_time as statusEndTime
,'mi_weps_plug' as type,t.produce_mode as runMode,t.remaining_time as statusEndTime
,case t.current_status when 0 then 0 else 1 end as wellStatus
,t.current_status as plugStatus
</when>
@ -161,7 +162,24 @@
</select>
<select id="getPressureChartData" resultType="com.isu.gaswellwatch.vo.DeviceHistoryVO">
select t.collection_time,t.oil_pressure,t.cas_pressure,t.pre_pressure
select t.collection_time,t.oil_pressure,t.cas_pressure
<choose>
<when test="deviceProduct!=null and deviceProduct=='knpc'">
,t.pre_pressure,'knpc' as type
</when>
<when test="deviceProduct!=null and deviceProduct=='etc'">
,t.pre_pressure,'etc' as type
</when>
<when test="deviceProduct!=null and deviceProduct=='scss'">
,t.pre_pressure,'scss' as type
</when>
<when test="deviceProduct!=null and deviceProduct=='weps_plug'">
,t.pre_pressure,'weps_plug' as type
</when>
<when test="deviceProduct!=null and deviceProduct=='mi_weps_plug'">
,'mi_weps_plug' as type
</when>
</choose>
from ${tableName} t
<where>
t.device_id = #{deviceId}
@ -203,27 +221,28 @@
<select id="getDeviceHistoryData" resultType="com.isu.gaswellwatch.vo.DeviceHistoryVO">
select t.collection_time,t.oil_pressure,t.cas_pressure,t.pre_pressure
select t.collection_time,t.oil_pressure,t.cas_pressure
<choose>
<when test="deviceProduct!=null and deviceProduct=='knpc'">
,'knpc' as type,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
,t.pre_pressure,'knpc' as
type,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
</when>
<when test="deviceProduct!=null and deviceProduct=='etc'">
,'etc' as type,t.current_status_remaining_time as statusEndTime
,t.pre_pressure,'etc' as type,t.current_status_remaining_time as statusEndTime
,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='scss'">
,'scss' as type,t.ctl_model as runMode,t.remaining_time_action as statusEndTime
,t.pre_pressure,'scss' as type,t.ctl_model as runMode,t.remaining_time_action as statusEndTime
,t.solar_voltage,t.first_solenoid_status as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='weps_plug'">
,'weps_plug' as type, t.run_mode as runMode
,t.pre_pressure,'weps_plug' as type, t.run_mode as runMode
,case t.solenoid_valve_status when 2 then t.open_well_remaining_time
when 1 then t.close_well_remaining_time else null end as statusEndTime
,case t.solenoid_valve_status when 2 then 1 when 1 then 0 else null end as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='mi_weps_plug'">
,t.produce_mode as runMode,t.remaining_time as statusEndTime
,'mi_weps_plug' as type,t.produce_mode as runMode,t.remaining_time as statusEndTime
,case t.current_status when 0 then 0 else 1 end as wellStatus
,t.current_status as plugStatus
</when>