Browse Source

1、修复水表校验

dev
mh 5 months ago
parent
commit
659913fd1d
  1. 4
      user-service/src/main/java/com/mh/user/mapper/DeviceInstallMapper.java
  2. 4
      user-service/src/main/java/com/mh/user/service/impl/DeviceInstallServiceImpl.java

4
user-service/src/main/java/com/mh/user/mapper/DeviceInstallMapper.java

@ -312,11 +312,11 @@ public interface DeviceInstallMapper extends BaseMapper<DeviceInstallEntity> {
@Select("select seat from device_install where device_type=#{deviceType} and device_addr=#{deviceAddr} and building_id=#{buildingId} ")
String selectSeat(@Param("deviceType") String deviceType,@Param("deviceAddr") String deviceAddr,@Param("buildingId") String buildingId);
@Update("update device_install set deviation_value = #{dataValue} where device_type = #{deviceType} and building_id = #{buildingId}")
@Update("update device_install set deviation_value = #{realValue}-isnull(last_value,0) where device_type = #{deviceType} and building_id = #{buildingId}")
void updateDeviation(@Param("buildingId") Integer buildingId,
@Param("deviceType") String deviceType,
@Param("param") Integer param,
@Param("dataValue") String dataValue);
@Param("realValue") String realValue);
@Select("select isnull(deviation_value,0) from device_install where device_addr = #{deviceAddr} and device_type = #{deviceType} and building_id = #{buildingId}")
Double selectDeviceDeviation(@Param("deviceAddr") String deviceAddr,

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

@ -387,9 +387,9 @@ public class DeviceInstallServiceImpl implements DeviceInstallService {
// 更新电表
deviceTypeStr = "电表";
}
String dataValue = new BigDecimal(realValue).subtract(new BigDecimal(readValue)).toString();
// String dataValue = new BigDecimal(realValue).subtract(new BigDecimal(readValue)).toString();
try {
deviceInstallMapper.updateDeviation(buildingId, deviceTypeStr, param, dataValue);
deviceInstallMapper.updateDeviation(buildingId, deviceTypeStr, param, realValue);
return true;
} catch (Exception e) {
throw new RuntimeException(e);

Loading…
Cancel
Save