Browse Source

1、楼栋管理添加高低区域水箱高度设置;

2、温度、水位变化表添加14点数据计算以及展示;
dev
mh 4 months ago
parent
commit
6ccc5be414
  1. 8
      2024数据库脚本.sql
  2. 8
      user-service/src/main/java/com/mh/user/controller/BuildingController.java
  3. 1
      user-service/src/main/java/com/mh/user/entity/BuildingEntity.java
  4. 1
      user-service/src/main/java/com/mh/user/entity/WaterLevelEntity.java
  5. 2
      user-service/src/main/java/com/mh/user/entity/WaterTempEntity.java
  6. 4
      user-service/src/main/java/com/mh/user/job/DealDataJob.java
  7. 12
      user-service/src/main/java/com/mh/user/mapper/BuildingMapper.java
  8. 8
      user-service/src/main/java/com/mh/user/mapper/provider/NowDataProvider.java
  9. 2
      user-service/src/main/java/com/mh/user/service/BuildingService.java
  10. 5
      user-service/src/main/java/com/mh/user/service/impl/BuildingServiceImpl.java
  11. 17
      user-service/src/main/java/com/mh/user/strategy/PressureTransStrategy.java

8
2024数据库脚本.sql

@ -189,3 +189,11 @@ EXEC sp_addextendedproperty @name=N'MS_Description', @value=N'状态', @level0ty
EXEC sp_addextendedproperty @name=N'MS_Description', @value=N'备注', @level0type=N'Schema', @level0name=N'dbo', @level1type=N'Table', @level1name=N'knowledge_data', @level2type=N'Column', @level2name=N'remark';
create index knowledge_data_create_time on history_data_pre (create_time);
-- 2024-07-01 水位变换添加
ALTER TABLE chws_gsh.dbo.waterLevel ADD level14 varchar(50) NULL;
EXEC chws_gsh.sys.sp_addextendedproperty 'MS_Description', N'14点水位', 'schema', N'dbo', 'table', N'waterLevel', 'column', N'level14';
ALTER TABLE chws_gsh.dbo.building ADD low_tank_height numeric(24,2) NULL;
EXEC chws_gsh.sys.sp_addextendedproperty 'MS_Description', N'低区域水箱高度', 'schema', N'dbo', 'table', N'building', 'column', N'low_tank_height';

8
user-service/src/main/java/com/mh/user/controller/BuildingController.java

@ -176,6 +176,9 @@ public class BuildingController {
rolName = "水箱高度";
break;
case 8 :
rolName = "水箱高度(低区)";
break;
case 9 :
rolName = "热泵个数";
break;
}
@ -195,8 +198,9 @@ public class BuildingController {
uploadEntity.setHouseCount(Integer.parseInt(deviceList.get(3))); //每层宿舍数
uploadEntity.setBedCount(Integer.parseInt(deviceList.get(4))); //床位数
uploadEntity.setCheckInCount(Integer.parseInt(deviceList.get(5))); //实际入住数
uploadEntity.setTankHeight(Double.parseDouble(deviceList.get(6))); //实际入住数
uploadEntity.setPumpCount(Integer.parseInt(deviceList.get(7))); //实际入住数
uploadEntity.setTankHeight(Double.parseDouble(deviceList.get(6))); //默认(高区)水箱高度
uploadEntity.setLowTankHeight(Double.parseDouble(deviceList.get(7))); //低区水箱高度
uploadEntity.setPumpCount(Integer.parseInt(deviceList.get(8))); //热泵个数
deviceList.clear();

1
user-service/src/main/java/com/mh/user/entity/BuildingEntity.java

@ -16,6 +16,7 @@ public class BuildingEntity {
private String areaId;
private String remarks;
private Double tankHeight;
private Double lowTankHeight;
private int pumpCount;
}

1
user-service/src/main/java/com/mh/user/entity/WaterLevelEntity.java

@ -16,6 +16,7 @@ public class WaterLevelEntity {
private String level08;
private String level11;
private String level13;
private String level14;
private String level15;
private String level16;
private String level17;

2
user-service/src/main/java/com/mh/user/entity/WaterTempEntity.java

@ -25,7 +25,7 @@ public class WaterTempEntity {
private String temp11;
// private String temp12;
private String temp13;
// private String temp14;
private String temp14;
private String temp15;
private String temp16;
private String temp17;

4
user-service/src/main/java/com/mh/user/job/DealDataJob.java

@ -50,7 +50,7 @@ public class DealDataJob {
/**
* 定时处理汇总数据每15分钟处理一次,十分钟(0 0/10 * * * ?)
*/
@Scheduled(cron = "0 0/15 * * * ?")
// @Scheduled(cron = "0 0/15 * * * ?")
public void ProEnergy() {
try {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
@ -148,7 +148,7 @@ public class DealDataJob {
/**
* 定时处理数据每十五分钟处理一次
*/
@Scheduled(cron = "0 0/15 * * * ?")
// @Scheduled(cron = "0 0/15 * * * ?")
public void dealData() {
try {
StopWatch stopWatch = new StopWatch();

12
user-service/src/main/java/com/mh/user/mapper/BuildingMapper.java

@ -15,8 +15,8 @@ public interface BuildingMapper {
* 保存楼栋信息
* @param buildingEntity
*/
@Insert("insert into building(building_name,levels_count,begin_level,house_count,bed_count,check_in_count,area_id,remarks,tankHeight,pump_count) values (" +
"#{buildingName},#{levelsCount},#{beginLevel},#{houseCount},#{bedCount},#{checkInCount},#{areaId},#{remarks},#{tankHeight}, #{pumpCount})")
@Insert("insert into building(building_name,levels_count,begin_level,house_count,bed_count,check_in_count,area_id,remarks,tankHeight,pump_count,low_tank_height) values (" +
"#{buildingName},#{levelsCount},#{beginLevel},#{houseCount},#{bedCount},#{checkInCount},#{areaId},#{remarks},#{tankHeight}, #{pumpCount}, #{lowTabkHeight})")
int saveBuilding(BuildingEntity buildingEntity);
/**
@ -35,6 +35,7 @@ public interface BuildingMapper {
" <if test='areaId!=null'> , area_id = #{areaId} </if>" +
" <if test='remarks!=null'> , remarks = #{remarks} </if>" +
" <if test='tankHeight!=null'> , tankHeight = #{tankHeight} </if>" +
" <if test='lowTankHeight!=null'> , low_tank_height = #{lowTankHeight} </if>" +
" <if test='pumpCount!=null'> , pump_count = #{pumpCount} </if>" +
" where id = #{id} " +
"</script>")
@ -57,7 +58,9 @@ public interface BuildingMapper {
@Result(property="checkInCount",column="check_in_count"),
@Result(property="areaId",column="area_id"),
@Result(property="pumpCount",column="pump_count"),
@Result(property="remarks",column="remarks")
@Result(property="remarks",column="remarks"),
@Result(property="tankHeight",column="tankHeight"),
@Result(property="lowTankHeight",column="low_tank_height")
})
@SelectProvider(type = BuildingProvider.class,method = "queryBuilding")
@ -116,4 +119,7 @@ public interface BuildingMapper {
@Select("select building_name from building where id = #{buildingId} ")
String selectBuildingNameById(@Param("buildingId") String buildingId);
@Select("select low_tank_height from building where id=#{id}" )
Double queryLowTankHeight(@Param("id") String buildingId);
}

8
user-service/src/main/java/com/mh/user/mapper/provider/NowDataProvider.java

@ -176,7 +176,9 @@ public class NowDataProvider {
"convert(decimal(8,1),AVG(convert(float,t1.temp02)))as temp02," +
"convert(decimal(8,1),AVG(convert(float,t1.temp06)))as temp06," +
"convert(decimal(8,1),AVG(convert(float,t1.temp08)))as temp08,convert(decimal(8,1),AVG(convert(float,t1.temp11)))as temp11," +
"convert(decimal(8,1),AVG(convert(float,t1.temp13)))as temp13,convert(decimal(8,1),AVG(convert(float,t1.temp15)))as temp15," +
"convert(decimal(8,1),AVG(convert(float,t1.temp13)))as temp13," +
"convert(decimal(8,1),AVG(convert(float,t1.temp14)))as temp14," +
"convert(decimal(8,1),AVG(convert(float,t1.temp15)))as temp15," +
"convert(decimal(8,1),AVG(convert(float,t1.temp16)))as temp16,convert(decimal(8,1),AVG(convert(float,t1.temp17)))as temp17," +
"convert(decimal(8,1),AVG(convert(float,t1.temp18)))as temp18,convert(decimal(8,1),AVG(convert(float,t1.temp19)))as temp19," +
"convert(decimal(8,1),AVG(convert(float,t1.temp20)))as temp20,convert(decimal(8,1),AVG(convert(float,t1.temp21)))as temp21," +
@ -200,7 +202,9 @@ public class NowDataProvider {
"select t1.cur_date,t1.building_id,t2.building_name,t2.sort,convert(decimal(8,1),AVG(convert(float,t1.temp00)))as temp00," +
"convert(decimal(8,1),AVG(convert(float,t1.temp02)))as temp02,convert(decimal(8,1),AVG(convert(float,t1.temp06)))as temp06," +
"convert(decimal(8,1),AVG(convert(float,t1.temp08)))as temp08,convert(decimal(8,1),AVG(convert(float,t1.temp11)))as temp11," +
"convert(decimal(8,1),AVG(convert(float,t1.temp13)))as temp13,convert(decimal(8,1),AVG(convert(float,t1.temp15)))as temp15," +
"convert(decimal(8,1),AVG(convert(float,t1.temp13)))as temp13," +
"convert(decimal(8,1),AVG(convert(float,t1.temp14)))as temp14," +
"convert(decimal(8,1),AVG(convert(float,t1.temp15)))as temp15," +
"convert(decimal(8,1),AVG(convert(float,t1.temp16)))as temp16,convert(decimal(8,1),AVG(convert(float,t1.temp17)))as temp17," +
"convert(decimal(8,1),AVG(convert(float,t1.temp18)))as temp18,convert(decimal(8,1),AVG(convert(float,t1.temp19)))as temp19," +
"convert(decimal(8,1),AVG(convert(float,t1.temp20)))as temp20,convert(decimal(8,1),AVG(convert(float,t1.temp21)))as temp21," +

2
user-service/src/main/java/com/mh/user/service/BuildingService.java

@ -72,4 +72,6 @@ public interface BuildingService {
int selectPumpCount(String buildingId);
String selectBuildingNameById(String buildingId);
Double queryLowTankHeight(String buildingId);
}

5
user-service/src/main/java/com/mh/user/service/impl/BuildingServiceImpl.java

@ -93,4 +93,9 @@ public class BuildingServiceImpl implements BuildingService {
public String selectBuildingNameById(String buildingId) {
return buildingMapper.selectBuildingNameById(buildingId);
}
@Override
public Double queryLowTankHeight(String buildingId) {
return buildingMapper.queryLowTankHeight(buildingId);
}
}

17
user-service/src/main/java/com/mh/user/strategy/PressureTransStrategy.java

@ -1,7 +1,9 @@
package com.mh.user.strategy;
import com.mh.common.utils.StringUtils;
import com.mh.user.constants.Constant;
import com.mh.user.entity.DeviceCodeParamEntity;
import com.mh.user.entity.DeviceInstallEntity;
import com.mh.user.service.*;
import com.mh.user.utils.ExchangeStringUtil;
import com.mh.user.utils.SpringBeanUtil;
@ -84,10 +86,23 @@ public class PressureTransStrategy implements DeviceStrategy {
data = ExchangeStringUtil.hexToDec(checkStr.substring(6, 10));//十六进制转整形
wtHeight = Double.parseDouble(data) / 100 * 0.102; //通过压力求水高
}
Double tankHeight = buildingService.queryTankHeight(buildingId);//水箱高,从数据库获取
Double tankHeight;
// 默认是高区域
tankHeight = buildingService.queryTankHeight(buildingId);//水箱高,从数据库获取
if (tankHeight == null) {
tankHeight = 2.0;
}
// 查询当前压变有低区
DeviceInstallEntity deviceInstallEntity = deviceInstallService.selectDevice(addr, "压变", buildingId);
if (null != deviceInstallEntity
&& !StringUtils.isBlank(deviceInstallEntity.getDeviceName())) {
if (deviceInstallEntity.getDeviceName().contains("低")) {
tankHeight = buildingService.queryLowTankHeight(buildingId);//水箱高,从数据库获取
if (tankHeight == null) {
tankHeight = 2.0;
}
}
}
Double wtLevel = wtHeight / tankHeight * 100; //水箱水位
log.info("------水箱水高:" + wtLevel + "------");
if (wtLevel <= 0) {

Loading…
Cancel
Save