parent
c68a20d106
commit
cc170e79b3
|
@ -50,17 +50,18 @@ public interface DisposeDeviceManager {
|
|||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* Gets all dispose devices.
|
||||
* Gets all normal dispose devices.
|
||||
*
|
||||
* @return the all dispose devices
|
||||
* @return the all normal dispose devices
|
||||
*/
|
||||
List<DisposeDevice> getAllNormalDisposeDevices();
|
||||
|
||||
/**
|
||||
* Gets all dispose devices.
|
||||
* Gets dispose devices.
|
||||
*
|
||||
* @param areaCode the areaCode
|
||||
* @param devId the dev id
|
||||
* @param areaCode the area code
|
||||
* @return the dispose devices
|
||||
*/
|
||||
List<DisposeDevice> getDisposeDevices(Integer areaCode);
|
||||
List<DisposeDevice> getDisposeDevices(Long devId, Integer areaCode);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
|||
fdDest.setAccessible(true);
|
||||
if (!obj.equals(fdDest.get(destDev))) {
|
||||
log.debug("Upgrade field [{}] value form [{}] to [{}]", fdSrc.getName(), fdDest.get(destDev),
|
||||
obj);
|
||||
obj);
|
||||
fdDest.set(destDev, obj);
|
||||
}
|
||||
fdDest.setAccessible(false);
|
||||
|
@ -143,11 +143,11 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
|||
// HTTP 默认端口
|
||||
if (dev.getUrlType() == HttpType.HTTP) {
|
||||
tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(),
|
||||
HttpType.getDefaultPort(HttpType.HTTP));
|
||||
HttpType.getDefaultPort(HttpType.HTTP));
|
||||
} else if (dev.getUrlType() == HttpType.HTTPS) {
|
||||
// HTTPS 默认端口
|
||||
tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(),
|
||||
HttpType.getDefaultPort(HttpType.HTTPS));
|
||||
HttpType.getDefaultPort(HttpType.HTTPS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,9 +264,9 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets all dispose devices.
|
||||
* Gets all normal dispose devices.
|
||||
*
|
||||
* @return the all dispose devices
|
||||
* @return the all normal dispose devices
|
||||
*/
|
||||
@Override
|
||||
public List<DisposeDevice> getAllNormalDisposeDevices() {
|
||||
|
@ -277,13 +277,14 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
|||
|
||||
|
||||
/**
|
||||
* Gets dispose devices by areaCode.
|
||||
* Gets dispose devices.
|
||||
*
|
||||
* @param areaCode the areaCode
|
||||
* @return the dispose devices by areaCode.
|
||||
* @param devId the dev id
|
||||
* @param areaCode the area code
|
||||
* @return the dispose devices
|
||||
*/
|
||||
@Override
|
||||
public List<DisposeDevice> getDisposeDevices(Integer areaCode) {
|
||||
return disposeDeviceMapper.getDeviceByAreaCode(areaCode);
|
||||
public List<DisposeDevice> getDisposeDevices(Long devId, Integer areaCode) {
|
||||
return disposeDeviceMapper.getDeviceByAreaCode(devId, areaCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,6 @@ public interface DisposeDeviceMapper {
|
|||
* @param areaCode the areaCode
|
||||
* @return the list
|
||||
*/
|
||||
List<DisposeDevice> getDeviceByAreaCode(@Param("areaCode") Integer areaCode);
|
||||
List<DisposeDevice> getDeviceByAreaCode(@Param("id") Long id, @Param("areaCode") Integer areaCode);
|
||||
|
||||
}
|
||||
|
|
|
@ -57,10 +57,11 @@ public interface DisposeDeviceManagerService {
|
|||
List<DisposeDevice> getAllDisposeDevice();
|
||||
|
||||
/**
|
||||
* Gets dispose device by areaCode.
|
||||
* Gets dispose device by area code.
|
||||
*
|
||||
* @param areaCode the areaCode
|
||||
* @return the all dispose device
|
||||
* @param devId the dev id
|
||||
* @param areaCode the area code
|
||||
* @return the dispose device by area code
|
||||
*/
|
||||
List<DisposeDevice> getDisposeDeviceByAreaCode(Integer areaCode);
|
||||
List<DisposeDevice> getDisposeDeviceByAreaCode(Long devId, Integer areaCode);
|
||||
}
|
||||
|
|
|
@ -130,14 +130,15 @@ public class DisposeDeviceManagerServiceImpl implements DisposeDeviceManagerServ
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets dispose device by areaCode.
|
||||
* Gets dispose device by area code.
|
||||
*
|
||||
* @param areaCode the areaCode
|
||||
* @return the all dispose device by areaCode
|
||||
* @param devId the dev id
|
||||
* @param areaCode the area code
|
||||
* @return the dispose device by area code
|
||||
*/
|
||||
@Override
|
||||
public List<DisposeDevice> getDisposeDeviceByAreaCode(Integer areaCode) {
|
||||
List<DisposeDevice> disposeDevices = disposeDeviceManager.getDisposeDevices(areaCode);
|
||||
public List<DisposeDevice> getDisposeDeviceByAreaCode(Long devId, Integer areaCode) {
|
||||
List<DisposeDevice> disposeDevices = disposeDeviceManager.getDisposeDevices(devId, areaCode);
|
||||
|
||||
if (disposeDevices == null) {
|
||||
return new ArrayList<>();
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The type Dispose task service.
|
||||
|
@ -65,12 +64,10 @@ public class DisposeTaskServiceImpl implements DisposeTaskService {
|
|||
}
|
||||
|
||||
//areaCode获取对应的deviceId
|
||||
List<DisposeDevice> devices = disposeDeviceManagerService.getDisposeDeviceByAreaCode(task.getAreaCode());
|
||||
List<DisposeDevice> devices = disposeDeviceManagerService.getDisposeDeviceByAreaCode(task.getDeviceId(),
|
||||
task.getAreaCode());
|
||||
|
||||
// 获取请求id列表
|
||||
List<Long> deviceIds = devices.stream().map(DisposeDevice::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
if (deviceIds.size() == 0 || !deviceIds.contains(task.getDeviceId())) {
|
||||
if (devices.size() == 0) {
|
||||
return new MulReturnType<>(ErrorCode.ERR_NODEVICE_AREACODE, task);
|
||||
} else {
|
||||
return new MulReturnType<>(disposeTaskManager.addDisposeTask(task),
|
||||
|
|
|
@ -141,6 +141,11 @@
|
|||
c.reserveNetflow reserveNetflow
|
||||
FROM dispose_device d
|
||||
LEFT JOIN dispose_capacity c ON d.id = c.deviceId
|
||||
WHERE d.areaCode = #{areaCode}
|
||||
<if test="areaCode != -1">
|
||||
WHERE d.areaCode = #{areaCode}
|
||||
<if test="id != -1">
|
||||
AND d.id = #{id}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue