修正渗流数据公式计算的单位

master
李一帆 2022-11-29 17:16:40 +08:00
parent 7d3047eb5c
commit 0ef16c7afa
6 changed files with 18 additions and 21 deletions

View File

@ -22,9 +22,9 @@ public class ScheduledTask {
String OS = System.getProperty("os.name").toLowerCase(); String OS = System.getProperty("os.name").toLowerCase();
// 简单粗暴的判断,在 linux 环境下运行时,为生成环境 // 简单粗暴的判断,在 linux 环境下运行时,为生成环境
if (OS.contains("linux")) { // if (OS.contains("linux")) {
iDeviceDataService.syncData(); // iDeviceDataService.syncData();
iDeviceSLDataService.syncData(); iDeviceSLDataService.syncData();
} // }
} }
} }

View File

@ -39,7 +39,7 @@ public class DeviceSLData {
*/ */
@ApiParam(value = "堰上水头") @ApiParam(value = "堰上水头")
@ApiModelProperty(value = "堰上水头", dataType = "java.math.BigDecimal") @ApiModelProperty(value = "堰上水头", dataType = "java.math.BigDecimal")
@TableField("DATA") @TableField("L")
private BigDecimal l; private BigDecimal l;
/** /**

View File

@ -127,7 +127,6 @@ public class DeviceSLDataServiceImpl extends ServiceImpl<DeviceSLDataMapper, Dev
.setDataA(record.getDataA()) .setDataA(record.getDataA())
.setDataB(record.getDataB()) .setDataB(record.getDataB())
.setDataC(record.getDataC()); .setDataC(record.getDataC());
String formula = di.getFormula(); String formula = di.getFormula();
BigDecimal R0 = di.getReading0();// initialReading 初始读数 BigDecimal R0 = di.getReading0();// initialReading 初始读数
BigDecimal R1 = record.getDataC();// initialReading 初始读数 BigDecimal R1 = record.getDataC();// initialReading 初始读数
@ -150,15 +149,15 @@ public class DeviceSLDataServiceImpl extends ServiceImpl<DeviceSLDataMapper, Dev
} else { } else {
L = null; L = null;
} }
dd.setL(L); dd.setL(L);
BigDecimal Q; //单位L/s BigDecimal Q; //单位L/s
//Q=1343H^2.47 //Q=1343H^2.47
//H=h+P //H=h+P
BigDecimal P = di.getZeroPointHeight();//单位mm BigDecimal P = di.getZeroPointHeight();//单位mm
BigDecimal h = L; //单位m? BigDecimal h = L; //单位mm
BigDecimal H = h.add(P); //单位m BigDecimal H = h.add(P); //单位mm
H = H.divide(BigDecimal.valueOf(1000)); //单位m
BigDecimal maxH = di.getMaxH(); //单位m BigDecimal maxH = di.getMaxH(); //单位m
if (H.doubleValue() > maxH.doubleValue()) { if (H.doubleValue() > maxH.doubleValue()) {
Q = new BigDecimal(1343).multiply(BigDecimal.valueOf(Math.pow(maxH.doubleValue(), 2.47))); Q = new BigDecimal(1343).multiply(BigDecimal.valueOf(Math.pow(maxH.doubleValue(), 2.47)));
@ -167,7 +166,6 @@ public class DeviceSLDataServiceImpl extends ServiceImpl<DeviceSLDataMapper, Dev
} }
dd.setQ(Q); dd.setQ(Q);
} }
if (super.save(dd)) { if (super.save(dd)) {
cnt += 1; cnt += 1;

View File

@ -9,16 +9,14 @@ import com.whdc.zhdbaqapi.exception.MyException;
import com.whdc.zhdbaqapi.mapper.DeviceDataMapper; import com.whdc.zhdbaqapi.mapper.DeviceDataMapper;
import com.whdc.zhdbaqapi.mapper.DeviceSLInfoMapper; import com.whdc.zhdbaqapi.mapper.DeviceSLInfoMapper;
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto; import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
import com.whdc.zhdbaqapi.model.entity.DeviceSLInfo; import com.whdc.zhdbaqapi.model.entity.DeviceSLInfo;
import com.whdc.zhdbaqapi.model.vo.DeviceInfoImpVo;
import com.whdc.zhdbaqapi.model.vo.DeviceSLInfoImpVo; import com.whdc.zhdbaqapi.model.vo.DeviceSLInfoImpVo;
import com.whdc.zhdbaqapi.service.IDeviceSLInfoService; import com.whdc.zhdbaqapi.service.IDeviceSLInfoService;
import com.whdc.zhdbaqapi.utils.DataUtils; import com.whdc.zhdbaqapi.utils.DataUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict; //import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; //import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -58,7 +56,7 @@ public class DeviceSLInfoServiceimpl extends ServiceImpl<DeviceSLInfoMapper, Dev
} }
@Override @Override
@CacheEvict(Constants.CACHE_NAME) // @CacheEvict(Constants.CACHE_NAME)
public boolean save(DeviceSLInfo entity) { public boolean save(DeviceSLInfo entity) {
if (baseMapper.checkValidStationCode(entity.getStationCode()) != null) { if (baseMapper.checkValidStationCode(entity.getStationCode()) != null) {
throw new MyException("stationCode=" + entity.getStationCode() + " 已被其他有效数据使用,不能恢复"); throw new MyException("stationCode=" + entity.getStationCode() + " 已被其他有效数据使用,不能恢复");
@ -69,7 +67,7 @@ public class DeviceSLInfoServiceimpl extends ServiceImpl<DeviceSLInfoMapper, Dev
} }
@Override @Override
@CacheEvict(Constants.CACHE_NAME) // @CacheEvict(Constants.CACHE_NAME)
public boolean updateById(DeviceSLInfo entity) { public boolean updateById(DeviceSLInfo entity) {
DeviceSLInfo old = baseMapper.checkValidStationCode(entity.getStationCode()); DeviceSLInfo old = baseMapper.checkValidStationCode(entity.getStationCode());
if (old == null) { if (old == null) {
@ -96,7 +94,7 @@ public class DeviceSLInfoServiceimpl extends ServiceImpl<DeviceSLInfoMapper, Dev
} }
@Override @Override
@CacheEvict(Constants.CACHE_NAME) // @CacheEvict(Constants.CACHE_NAME)
public boolean updateByIdInternal(DeviceSLInfo entity) { public boolean updateByIdInternal(DeviceSLInfo entity) {
DeviceSLInfo old = baseMapper.checkValidStationCode(entity.getStationCode()); DeviceSLInfo old = baseMapper.checkValidStationCode(entity.getStationCode());
if (old != null && !old.getId().equals(entity.getId())) { if (old != null && !old.getId().equals(entity.getId())) {
@ -108,7 +106,7 @@ public class DeviceSLInfoServiceimpl extends ServiceImpl<DeviceSLInfoMapper, Dev
} }
@Override @Override
@CacheEvict(Constants.CACHE_NAME) // @CacheEvict(Constants.CACHE_NAME)
public boolean removeById(Serializable id) { public boolean removeById(Serializable id) {
DeviceSLInfo entity = baseMapper.selectById(id); DeviceSLInfo entity = baseMapper.selectById(id);
entity.setDel(1); entity.setDel(1);
@ -116,7 +114,7 @@ public class DeviceSLInfoServiceimpl extends ServiceImpl<DeviceSLInfoMapper, Dev
} }
@Override @Override
@CacheEvict(Constants.CACHE_NAME) // @CacheEvict(Constants.CACHE_NAME)
public boolean restore(Integer id) { public boolean restore(Integer id) {
DeviceSLInfo entity = baseMapper.selectById(id); DeviceSLInfo entity = baseMapper.selectById(id);
@ -138,7 +136,7 @@ public class DeviceSLInfoServiceimpl extends ServiceImpl<DeviceSLInfoMapper, Dev
} }
@Override @Override
@Cacheable(Constants.CACHE_NAME) // @Cacheable(Constants.CACHE_NAME)
public List<DeviceSLInfo> listAll() { public List<DeviceSLInfo> listAll() {
return baseMapper.listAll(); return baseMapper.listAll();
} }

View File

@ -6,7 +6,8 @@ spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: dm.jdbc.driver.DmDriver driver-class-name: dm.jdbc.driver.DmDriver
url: jdbc:dm://120.76.31.37:5236/DAM_SAFE?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 # url: jdbc:dm://120.76.31.37:5236/DAM_SAFE?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
url: jdbc:dm://172.20.1.100:5236/DAM_SAFE?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
username: DAM_SAFE username: DAM_SAFE
password: Dam_safe_890 password: Dam_safe_890
druid: druid:
@ -79,7 +80,7 @@ sa-token:
is-log: false is-log: false
# 大坝安全监测数据获取接口 # 大坝安全监测数据获取接口
cklat_data_api: http://localhost:8008/api/v1/devices/records cklat_data_api: http://172.20.1.202:8008/api/v1/devices/records
# 渗压换算管内水位系数 # 渗压换算管内水位系数
o_z_modulus: 0.10197 o_z_modulus: 0.10197