|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.mh.user.service.impl; |
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.util.StringUtil; |
|
|
|
|
import com.mh.user.entity.DeviceCodeParamEntity; |
|
|
|
|
import com.mh.user.entity.DeviceInstallEntity; |
|
|
|
|
import com.mh.user.entity.DeviceInstallTempEntity; |
|
|
|
@ -40,8 +41,12 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int saveDevice(DeviceInstallEntity deviceInstallEntity) { |
|
|
|
|
String buildingName = buildingService.selectBuildingNameById(deviceInstallEntity.getBuildingId()); |
|
|
|
|
deviceInstallEntity.setBuildingName(buildingName); |
|
|
|
|
if (StringUtil.isEmpty(deviceInstallEntity.getBuildingId()) && !StringUtil.isEmpty(deviceInstallEntity.getBuildingName())) { |
|
|
|
|
Integer buildingId = buildingService.selectBuildingIdByName(deviceInstallEntity.getBuildingName()); |
|
|
|
|
deviceInstallEntity.setBuildingId(String.valueOf(buildingId)); |
|
|
|
|
} else if (StringUtil.isEmpty(deviceInstallEntity.getBuildingName()) && !StringUtil.isEmpty(deviceInstallEntity.getBuildingId())) { |
|
|
|
|
deviceInstallEntity.setBuildingName(buildingService.selectBuildingNameById(deviceInstallEntity.getBuildingId())); |
|
|
|
|
} |
|
|
|
|
if ("电表".equalsIgnoreCase(deviceInstallEntity.getDeviceType())) { |
|
|
|
|
// 000005500773
|
|
|
|
|
deviceInstallEntity.setDeviceAddr(ExchangeStringUtil.addZeroForNum(deviceInstallEntity.getDeviceAddr(), 12)); |
|
|
|
@ -273,8 +278,8 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int selectDeviceCount(String deviceAddr, String deviceType) { |
|
|
|
|
return deviceInstallMapper.selectDeviceCount(deviceAddr, deviceType); |
|
|
|
|
public int selectDeviceCount(String buildingName, String deviceAddr, String deviceType) { |
|
|
|
|
return deviceInstallMapper.selectDeviceCount(buildingName, deviceAddr, deviceType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|