Browse Source

1、修改热泵信息同步修改设备监视信息bug。

dev
mh 3 weeks ago
parent
commit
7ae632a2be
  1. 24
      user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java
  2. 17
      user-service/src/main/java/com/mh/user/mapper/NowDataMapper.java
  3. 2
      user-service/src/main/java/com/mh/user/service/NowDataService.java
  4. 9
      user-service/src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java
  5. 5
      user-service/src/main/java/com/mh/user/service/impl/NowDataServiceImpl.java

24
user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java

@ -7,10 +7,7 @@ import com.mh.user.annotation.SysLogger;
import com.mh.user.entity.BuildingEntity;
import com.mh.user.entity.DeviceInstallEntity;
import com.mh.user.model.DeviceModel;
import com.mh.user.service.BuildingService;
import com.mh.user.service.DealDataService;
import com.mh.user.service.DeviceInstallService;
import com.mh.user.service.SummaryService;
import com.mh.user.service.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@ -34,6 +31,10 @@ public class DeviceInstallController {
@Autowired
BuildingService buildingService;
@Autowired
private NowDataService nowDataService;
private final DealDataService dealDataService;
public DeviceInstallController(DealDataService dealDataService)
@ -54,6 +55,21 @@ public class DeviceInstallController {
public HttpResult updateDevice(@RequestBody DeviceInstallEntity deviceInstallEntity) {
// 根据id查询对应的deviceInstall
DeviceInstallEntity oldEntity = deviceInstallService.selectDeviceById(deviceInstallEntity.getId());
// 更新对应的实时记录内容
if (oldEntity.getDeviceType().equals("热泵")) {
String oldPumpId = oldEntity.getDeviceAddr();
String oldPumpName = oldEntity.getDeviceName();
String oldBuildingId = oldEntity.getBuildingId();
String pumpId = deviceInstallEntity.getDeviceAddr();
String pumpName = deviceInstallEntity.getDeviceName();
String buildingId = deviceInstallEntity.getBuildingId();
String buildingName = deviceInstallEntity.getBuildingName();
nowDataService.updatePumpName(oldPumpId, oldPumpName, oldBuildingId, pumpId, pumpName, buildingId, buildingName);
}
// 删除全部的device_code_param值
deviceInstallService.deleteParamCode(oldEntity);
// 设置校验位

17
user-service/src/main/java/com/mh/user/mapper/NowDataMapper.java

@ -499,4 +499,21 @@ public interface NowDataMapper {
"</if>" +
"</script>")
String selectMaxTemp(@Param("buildingId") String buildingId, @Param("temp") Integer temp);
@Update("update now_data set " +
" pump_name=#{pumpName}, " +
" pump_id = #{pumpId}, " +
" building_id = #{buildingId}" +
" where pump_id=#{oldPumpId} and pump_name=#{oldPumpName} and building_id=#{oldBuildingId} ")
void updatePumpName(@Param("oldPumpId") String oldPumpId,
@Param("oldPumpName") String oldPumpName,
@Param("oldBuildingId") String oldBuildingId,
@Param("pumpId") String pumpId,
@Param("pumpName") String pumpName,
@Param("buildingId") String buildingId,
@Param("buildingName") String buildingName);
@Delete("delete from now_data where pump_id=#{pumpId} and building_id=#{buildingId}")
void deleteNowDataByDeviceAddr(@Param("pumpId") String pumpId,
@Param("buildingId") String buildingId);
}

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

@ -145,5 +145,7 @@ public interface NowDataService {
Map<String, Object> selectTopOneState(String buildingId);
void updateNowPublicData(NowPublicDataEntity publicData);
void updatePumpName(String oldPumpId, String oldPumpName, String oldBuildingId, String pumpId, String pumpName, String buildingId, String buildingName);
}

9
user-service/src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java

@ -6,6 +6,7 @@ import com.mh.user.entity.DeviceInstallTempEntity;
import com.mh.user.entity.UploadDeviceInstallEntity;
import com.mh.user.mapper.DeviceCodeParamMapper;
import com.mh.user.mapper.DeviceInstallMapper;
import com.mh.user.mapper.NowDataMapper;
import com.mh.user.model.DeviceModel;
import com.mh.user.service.BuildingService;
import com.mh.user.service.DeviceInstallService;
@ -34,6 +35,8 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
@Autowired
private DeviceCodeParamMapper deviceCodeParamMapper;
@Autowired
private NowDataMapper nowDataMapper;
@Override
public int saveDevice(DeviceInstallEntity deviceInstallEntity) {
@ -275,7 +278,7 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
@Override
public int deleteDevice(List<DeviceInstallEntity> records) {
for(DeviceInstallEntity record:records) {
deviceInstallMapper.deleteDevice(record.getId().toString());
// deviceInstallMapper.deleteDevice(record.getId().toString());
}
return 0;
}
@ -286,6 +289,10 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
DeviceInstallEntity oldEntity = deviceInstallMapper.selectDeviceById(Long.valueOf(id));
// 删除全部的device_code_param值
this.deleteParamCode(oldEntity);
if (oldEntity.getDeviceType().equals("热泵")) {
// 删除now_data表数据
nowDataMapper.deleteNowDataByDeviceAddr(oldEntity.getDeviceAddr(), oldEntity.getBuildingId());
}
return deviceInstallMapper.deleteDevice(id);
}

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

@ -567,4 +567,9 @@ public class NowDataServiceImpl implements NowDataService {
public void updateNowPublicData(NowPublicDataEntity publicData) {
nowPublicDataMapper.updateNowPublicData(publicData);
}
@Override
public void updatePumpName(String oldPumpId, String oldPumpName, String oldBuildingId, String pumpId, String pumpName, String buildingId, String buildingName) {
nowDataMapper.updatePumpName(oldPumpId, oldPumpName, oldBuildingId, pumpId, pumpName, buildingId, buildingName);
}
}

Loading…
Cancel
Save