增加区块查询过滤;增加维尔普斯气井状态检查逻辑
This commit is contained in:
parent
d2c050780b
commit
b1df896107
|
@ -41,8 +41,9 @@ public class DeviceController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/gasStation")
|
||||
public List<GasStationVO> queryGasStationList(@RequestParam String gasStationName) {
|
||||
return this.deviceService.queryGasStationList(gasStationName);
|
||||
public List<GasStationVO> queryGasStationList(@RequestParam Long blockId,
|
||||
@RequestParam String gasStationName) {
|
||||
return this.deviceService.queryGasStationList(blockId, gasStationName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface DeviceDao extends BaseMapper<Device> {
|
||||
|
||||
List<String> queryGasStationList(String gasStationName);
|
||||
List<String> queryGasStationList(Long blockId, String gasStationName);
|
||||
|
||||
Page<DeviceVO> page(Page<Object> page,
|
||||
@Param("gasWellName") String gasWellName,
|
||||
|
|
|
@ -21,10 +21,7 @@ import org.springframework.amqp.core.Message;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
|
@ -88,10 +85,10 @@ public class BusinessMessageHandlerListener implements BatchMessageListener {
|
|||
//根据对应的产品类型,用对应的气井开关字段获取开关状态(wellStatus,solenoidValveStatus,firstSolenoidStatus)
|
||||
String wellStatusKey = getWellStatusKey(device);
|
||||
//比对新旧数据,看开关状态是否一致
|
||||
if (oldObject.getString(wellStatusKey) != null && (!oldObject.getString(wellStatusKey).equals(newObject.getString(wellStatusKey)))) {
|
||||
deviceWellStatusMap.put(Long.valueOf(deviceId), newObject.getInteger(wellStatusKey));
|
||||
if (Objects.nonNull(oldObject.getString(wellStatusKey)) && !Objects.equals(oldObject.getString(wellStatusKey), newObject.getString(wellStatusKey))) {
|
||||
deviceWellStatusMap.put(Long.valueOf(deviceId), getWellStatusValue(device, newObject, wellStatusKey));
|
||||
|
||||
if(null==newObject.getInteger(wellStatusKey)){
|
||||
if (Objects.isNull(newObject.getInteger(wellStatusKey))) {
|
||||
continue;
|
||||
}
|
||||
//记录开关井状态及对应的套压油压数据
|
||||
|
@ -103,7 +100,7 @@ public class BusinessMessageHandlerListener implements BatchMessageListener {
|
|||
switchStatusExport.setOilPressure(newObject.getString("oilPressure"));
|
||||
switchStatusExport.setBlockId(device.getGasWell().getBlockId());
|
||||
if (newObject.getInteger(wellStatusKey) != null) {
|
||||
switchStatusExport.setSwitchStatus(newObject.getInteger(wellStatusKey) == 1 ? "开井" : "关井");
|
||||
switchStatusExport.setSwitchStatus(getWellStatusValue(device, newObject, wellStatusKey) == 1 ? "开井" : "关井");
|
||||
}
|
||||
switchStatusExportList.add(switchStatusExport);
|
||||
}
|
||||
|
@ -175,7 +172,32 @@ public class BusinessMessageHandlerListener implements BatchMessageListener {
|
|||
wellStatusKey = "solenoidValveStatus";
|
||||
} else if (PersistenceHandler.SCSS_MODBUS_TYPE.equals(device.getProduct().getCode())) {
|
||||
wellStatusKey = "firstSolenoidStatus";
|
||||
} else if (PersistenceHandler.WEPS_PLUG_MODBUS_TYPE.equals(device.getProduct().getCode())) {
|
||||
wellStatusKey = "solenoidValveStatus";
|
||||
} else if (PersistenceHandler.MI_WEPS_PLUG_MODBUS_TYPE.equals(device.getProduct().getCode())) {
|
||||
wellStatusKey = "currentStatus";
|
||||
}
|
||||
return wellStatusKey;
|
||||
}
|
||||
|
||||
private static Integer getWellStatusValue(DeviceVO device, JSONObject newObject, String wellStatusKey) {
|
||||
Integer wellStatus = newObject.getInteger(wellStatusKey);
|
||||
if (PersistenceHandler.WEPS_PLUG_MODBUS_TYPE.equals(device.getProduct().getCode())) {
|
||||
if (Objects.equals(wellStatus, 1)) {
|
||||
wellStatus = 0;
|
||||
} else if (Objects.equals(wellStatus, 2)) {
|
||||
wellStatus = 1;
|
||||
} else {
|
||||
wellStatus = null;
|
||||
}
|
||||
} else if (PersistenceHandler.MI_WEPS_PLUG_MODBUS_TYPE.equals(device.getProduct().getCode())) {
|
||||
if (Objects.equals(wellStatus, 0)) {
|
||||
wellStatus = 0;
|
||||
} else {
|
||||
wellStatus = 1;
|
||||
}
|
||||
}
|
||||
return wellStatus;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.Map;
|
|||
|
||||
public interface DeviceService extends IService<Device> {
|
||||
|
||||
List<GasStationVO> queryGasStationList(String gasStationName);
|
||||
List<GasStationVO> queryGasStationList(Long blockId,String gasStationName);
|
||||
|
||||
Page<DeviceVO> page(Integer currentPage, Integer pageSize, String gasWellName, String gasStationName, String mainPipe, Long deviceTypeId, Long blockId, Integer product);
|
||||
|
||||
|
|
|
@ -48,10 +48,7 @@ public class DeviceOptLogServiceImpl extends ServiceImpl<DeviceOptLogDao, Device
|
|||
deviceOptLog.setGasStation(deviceVO.getGasStation());
|
||||
String content = "";
|
||||
if ("device".equalsIgnoreCase(source)) {
|
||||
content =
|
||||
|
||||
|
||||
isOpen == 1 ? "检测到气井开启" : "检测到气井关闭";
|
||||
content = isOpen == 1 ? "检测到气井开启" : "检测到气井关闭";
|
||||
deviceOptLog.setUsername("系统");
|
||||
deviceOptLog.setName("系统");
|
||||
} else {
|
||||
|
@ -68,5 +65,6 @@ public class DeviceOptLogServiceImpl extends ServiceImpl<DeviceOptLogDao, Device
|
|||
public Page<DeviceOptLog> page(Page<DeviceOptLog> page, Date start, Date end, Long deviceId) {
|
||||
return this.deviceDao.deviceOptLogPage(page, start, end, deviceId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceDao, Device> implements
|
|||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public List<GasStationVO> queryGasStationList(String gasStationName) {
|
||||
List<String> gasStationList = this.deviceDao.queryGasStationList(gasStationName);
|
||||
public List<GasStationVO> queryGasStationList(Long blockId, String gasStationName) {
|
||||
List<String> gasStationList = this.deviceDao.queryGasStationList(blockId, gasStationName);
|
||||
if (ObjectUtils.isEmpty(gasStationList)) {
|
||||
return List.of();
|
||||
}
|
||||
|
|
|
@ -39,8 +39,16 @@
|
|||
<select id="queryGasStationList" resultType="string">
|
||||
select u.gas_station
|
||||
from device u
|
||||
where u.gas_station LIKE CONCAT('%', #{gasStationName}, '%')
|
||||
<where>
|
||||
<if test="gasStationName != null">
|
||||
and u.gas_station LIKE CONCAT('%', #{gasStationName}, '%')
|
||||
</if>
|
||||
<if test="blockId != null">
|
||||
and exists (select 1 from gas_well gw where gw.id = u.gas_well and gw.block_id = #{blockId})
|
||||
</if>
|
||||
</where>
|
||||
order by u.id desc
|
||||
limit 10
|
||||
</select>
|
||||
|
||||
<select id="page" resultMap="DeviceVOMap">
|
||||
|
|
Loading…
Reference in New Issue