网络设置
This commit is contained in:
parent
c95a584357
commit
cbb23dc612
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.web.controller.data;
|
||||
|
||||
import com.bonus.common.annotation.RequiresPermissions;
|
||||
import com.bonus.common.annotation.SysLog;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.domain.data.dto.NetworkEthernetDto;
|
||||
import com.bonus.common.domain.data.dto.NetworkSimDto;
|
||||
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||
import com.bonus.common.enums.OperaType;
|
||||
import com.bonus.web.service.data.NetworkService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @className:NetworkController
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:13
|
||||
* @version:1.0
|
||||
* @description:网络设置-web层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/data/network/")
|
||||
public class NetworkController {
|
||||
|
||||
@Resource(name = "NetworkService")
|
||||
private NetworkService networkService;
|
||||
|
||||
@ApiOperation(notes = "查询网络设置",value = "查询网络设置")
|
||||
@RequiresPermissions("data:network:query")
|
||||
@GetMapping("/getNetworkDetail")
|
||||
@SysLog(title = "系统运维", businessType = OperaType.QUERY, logType = 1, module = "设备管理->网络设置", details = "查询网络设置")
|
||||
public AjaxResult getNetworkDetail(ParamsDto dto) {
|
||||
return networkService.getNetworkDetail(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(notes = "以太网网络设置",value = "以太网网络设置")
|
||||
@RequiresPermissions("data:network:update")
|
||||
@PostMapping("/updateNetworkEthernet")
|
||||
@SysLog(title = "系统运维", businessType = OperaType.UPDATE, logType = 1, module = "设备管理->网络设置", details = "以太网网络设置")
|
||||
public AjaxResult updateNetwork(@RequestBody NetworkEthernetDto dto) {
|
||||
return networkService.updateNetworkEthernet(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(notes = "SIM网络设置",value = "SIM网络设置")
|
||||
@RequiresPermissions("data:network:update")
|
||||
@PostMapping("/updateNetworkSim")
|
||||
@SysLog(title = "系统运维", businessType = OperaType.UPDATE, logType = 1, module = "设备管理->网络设置", details = "SIM网络设置")
|
||||
public AjaxResult updateNetworkSim(@RequestBody NetworkSimDto dto) {
|
||||
return networkService.updateNetworkSim(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.bonus.web.service.data;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.domain.admin.dto.TeamDto;
|
||||
import com.bonus.common.domain.data.dto.LineDto;
|
||||
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||
import com.bonus.common.domain.data.vo.LineVo;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,134 @@
|
|||
package com.bonus.web.service.data;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.domain.data.dto.LineDto;
|
||||
import com.bonus.common.domain.data.dto.NetworkEthernetDto;
|
||||
import com.bonus.common.domain.data.dto.NetworkSimDto;
|
||||
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||
import com.bonus.common.domain.data.vo.NetworkEthernetVo;
|
||||
import com.bonus.common.domain.data.vo.NetworkSimVo;
|
||||
import com.bonus.common.utils.ValidatorsUtils;
|
||||
import com.bonus.data.service.DINetworkService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @className:NetworkService
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:14
|
||||
* @version:1.0
|
||||
* @description:网络设置业务逻辑层
|
||||
*/
|
||||
@Slf4j
|
||||
@Service(value = "NetworkService")
|
||||
public class NetworkService {
|
||||
|
||||
@Resource(name = "DINetworkService")
|
||||
private DINetworkService diNetworkService;
|
||||
|
||||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
/**
|
||||
* 网络设置
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 14:54
|
||||
*/
|
||||
public AjaxResult getNetworkDetail(ParamsDto dto) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
NetworkEthernetVo ethernetVo = null;
|
||||
NetworkSimVo simVo = null;
|
||||
try {
|
||||
// 查询以太网和sim的网络设置
|
||||
ethernetVo = diNetworkService.getNetworkEthernet(dto);
|
||||
simVo = diNetworkService.getNetworkSim(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
map.put("ethernet", ethernetVo);
|
||||
map.put("sim", simVo);
|
||||
return AjaxResult.success(map);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 以太网网络设置
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 15:59
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updateNetworkEthernet(NetworkEthernetDto dto) {
|
||||
// 校验数据是否合法
|
||||
if(dto.getNetworkEthernetId() == null) {
|
||||
String validResult = validatorsUtils.valid(dto, NetworkEthernetDto.ADD.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
if(Objects.equals(dto.getEnableDhcp(),"0")){
|
||||
String validResult2 = validatorsUtils.valid(dto, NetworkEthernetDto.ENABLE.class);
|
||||
if (StringUtils.isNotBlank(validResult2)) {
|
||||
return AjaxResult.error(validResult2);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String validResult = validatorsUtils.valid(dto, NetworkEthernetDto.UPDATE.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
if(Objects.equals(dto.getEnableDhcp(),"0")){
|
||||
String validResult2 = validatorsUtils.valid(dto, NetworkEthernetDto.ENABLE.class);
|
||||
if (StringUtils.isNotBlank(validResult2)) {
|
||||
return AjaxResult.error(validResult2);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
// 1.以太网网络设置
|
||||
diNetworkService.updateNetworkEthernet(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* SIM网络设置
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 15:59
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updateNetworkSim(NetworkSimDto dto) {
|
||||
// 校验数据是否合法
|
||||
String validResult = validatorsUtils.valid(dto, dto.getSimId() == null ? NetworkSimDto.ADD.class : NetworkSimDto.UPDATE.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
try {
|
||||
// SIM 网络设置
|
||||
diNetworkService.updateNetworkSim(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.bonus.common.domain.data.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @className:NetworkEthernetDto
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:48
|
||||
* @version:1.0
|
||||
* @description:网络设置-以太网-dto
|
||||
*/
|
||||
@Data
|
||||
public class NetworkEthernetDto {
|
||||
|
||||
/**
|
||||
* 网络以太网id
|
||||
*/
|
||||
@NotNull(message = "网络以太网id不能为空", groups = {UPDATE.class})
|
||||
private Long networkEthernetId;
|
||||
|
||||
/**
|
||||
* 系统id
|
||||
*/
|
||||
private Long systemId = 1L;
|
||||
|
||||
/**
|
||||
* 以太网接口
|
||||
*/
|
||||
@NotBlank(message = "以太网接口不能为空", groups = {ADD.class, UPDATE.class, ENABLE.class, NOENABLE.class})
|
||||
@Length(max = 32, message = "以太网接口字符长度不能超过32", groups = {ADD.class, UPDATE.class, ENABLE.class, NOENABLE.class})
|
||||
private String ethernetInterface;
|
||||
|
||||
/**
|
||||
* 启用DHCP 0.未启用 1.已启用
|
||||
*/
|
||||
@NotBlank(message = "启用DHCP状态不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 1, message = "启用DHCP状态长度错误", groups = {ADD.class, UPDATE.class})
|
||||
@Pattern(regexp = "^[01]$", message = "启用DHCP只能是 0 或 1", groups = {ADD.class, UPDATE.class})
|
||||
private String enableDhcp;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
@NotBlank(message = "IP地址不能为空", groups = {NOENABLE.class})
|
||||
@Length(max = 32, message = "IP地址字符长度不能超过32", groups = {NOENABLE.class})
|
||||
@Pattern(regexp = "^(?=.{1,255}$)(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$|^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$",
|
||||
message = "IP地址格式不正确(需为有效IP或域名)", groups = {NOENABLE.class})
|
||||
private String ipAddress;
|
||||
|
||||
/**
|
||||
* 子网掩码
|
||||
*/
|
||||
@NotBlank(message = "子网掩码不能为空", groups = {NOENABLE.class})
|
||||
@Length(max = 15, message = "子网掩码长度不正确", groups = {NOENABLE.class})
|
||||
@Pattern(
|
||||
regexp = "^(254|252|248|240|224|192|128|0)\\.0\\.0\\.0$|^(255\\.(254|252|248|240|224|192|128|0)\\.0\\.0)$|^(255\\.255\\.(254|252|248|240|224|192|128|0)\\.0)$|^(255\\.255\\.255\\.(255|254|252|248|240|224|192|128|0))$",
|
||||
message = "子网掩码格式不正确",
|
||||
groups = {NOENABLE.class}
|
||||
)
|
||||
private String subnetMask;
|
||||
|
||||
/**
|
||||
* 默认网关
|
||||
*/
|
||||
@NotBlank(message = "默认网关不能为空", groups = {NOENABLE.class})
|
||||
@Length(max = 15, message = "默认网关长度不正确", groups = {NOENABLE.class})
|
||||
@Pattern(
|
||||
regexp = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$",
|
||||
message = "默认网关格式不正确",
|
||||
groups = {NOENABLE.class}
|
||||
)
|
||||
private String defaultGateway;
|
||||
|
||||
/**
|
||||
* DNS
|
||||
*/
|
||||
@NotBlank(message = "DNS不能为空", groups = {NOENABLE.class})
|
||||
@Length(max = 512, message = "DNS字符长度不能超过512", groups = {NOENABLE.class})
|
||||
private String dns;
|
||||
|
||||
/**
|
||||
* MAC地址
|
||||
*/
|
||||
private String macAddress;
|
||||
|
||||
/**
|
||||
* 新增条件限制
|
||||
*/
|
||||
public interface ADD {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改条件限制
|
||||
*/
|
||||
public interface UPDATE {
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用修改条件限制
|
||||
*/
|
||||
public interface ENABLE {
|
||||
}
|
||||
|
||||
/**
|
||||
* 未启用修改条件限制
|
||||
*/
|
||||
public interface NOENABLE {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package com.bonus.common.domain.data.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @className:NetworkSimDto
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:49
|
||||
* @version:1.0
|
||||
* @description:网络设置-sim-dto
|
||||
*/
|
||||
@Data
|
||||
public class NetworkSimDto {
|
||||
|
||||
/**
|
||||
* SIM_ID
|
||||
*/
|
||||
@NotNull(message = "网SIM_ID不能为空", groups = {UPDATE.class})
|
||||
private Long simId;
|
||||
|
||||
/**
|
||||
* 系统id
|
||||
*/
|
||||
private Long systemId = 1L;
|
||||
|
||||
/**
|
||||
* 模块状态
|
||||
*/
|
||||
private String moduleStatus;
|
||||
|
||||
/**
|
||||
* 信号强度
|
||||
*/
|
||||
private String signalStrength;
|
||||
|
||||
/**
|
||||
* 拨号获取的IP地址
|
||||
*/
|
||||
private String dialingIpAddress;
|
||||
|
||||
/**
|
||||
* 当前网络模式
|
||||
*/
|
||||
private String currentNetworkMode;
|
||||
|
||||
/**
|
||||
* 当前网络运营商
|
||||
*/
|
||||
private String currentNetworkOperators;
|
||||
|
||||
/**
|
||||
* 模块IMEI
|
||||
*/
|
||||
private String moduleImel;
|
||||
|
||||
/**
|
||||
* 4G/5G
|
||||
*/
|
||||
private String signalType;
|
||||
|
||||
/**
|
||||
* 启用拨号 0.未启用 1,已启用
|
||||
*/
|
||||
private String enableDialing;
|
||||
|
||||
/**
|
||||
* APN
|
||||
*/
|
||||
@Length(max = 32, message = "APN字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
private String apn;
|
||||
|
||||
/**
|
||||
* 接入号
|
||||
*/
|
||||
@Length(max = 32, message = "接入号字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
private String accessNumber;
|
||||
|
||||
/**
|
||||
* 拨号用户名
|
||||
*/
|
||||
@Length(max = 32, message = "拨号用户名字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
private String dialUpUsername;
|
||||
|
||||
/**
|
||||
* 拨号密码
|
||||
*/
|
||||
@Length(max = 32, message = "拨号密码字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
private String dialingPassword;
|
||||
|
||||
/**
|
||||
* 新增条件限制
|
||||
*/
|
||||
public interface ADD {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增条件限制
|
||||
*/
|
||||
public interface UPDATE {
|
||||
}
|
||||
}
|
||||
|
|
@ -38,4 +38,14 @@ public class ParamsDto {
|
|||
|
||||
/**系统设置ID*/
|
||||
private Long systemSettingId;
|
||||
|
||||
/**
|
||||
* 网络以太网id
|
||||
*/
|
||||
private Long networkEthernetId;
|
||||
|
||||
/**
|
||||
* SIM_ID
|
||||
*/
|
||||
private Long simId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bonus.common.domain.data.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @className:NetworkEthernetVo
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:48
|
||||
* @version:1.0
|
||||
* @description:网络设置-以太网-vo
|
||||
*/
|
||||
@Data
|
||||
public class NetworkEthernetVo {
|
||||
|
||||
/**
|
||||
* 网络以太网id
|
||||
*/
|
||||
private Long networkEthernetId;
|
||||
|
||||
/**
|
||||
* 系统id
|
||||
*/
|
||||
private Long systemId;
|
||||
|
||||
/**
|
||||
* 以太网接口
|
||||
*/
|
||||
private String ethernetInterface;
|
||||
|
||||
/**
|
||||
* 启用DHCP 0.未启用 1.已启用
|
||||
*/
|
||||
private String enableDhcp;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
private String ipAddress;
|
||||
|
||||
/**
|
||||
* 子网掩码
|
||||
*/
|
||||
private String subnetMask;
|
||||
|
||||
/**
|
||||
* 默认网关
|
||||
*/
|
||||
private String defaultGateway;
|
||||
|
||||
/**
|
||||
* DNS
|
||||
*/
|
||||
private String dns;
|
||||
|
||||
/**
|
||||
* MAC地址
|
||||
*/
|
||||
private String macAddress;
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.bonus.common.domain.data.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @className:NetworkSimVo
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:49
|
||||
* @version:1.0
|
||||
* @description:网络设置-sim-vo
|
||||
*/
|
||||
@Data
|
||||
public class NetworkSimVo {
|
||||
|
||||
/**
|
||||
* SIM_ID
|
||||
*/
|
||||
private Long simId;
|
||||
|
||||
/**
|
||||
* 系统id
|
||||
*/
|
||||
private Long systemId;
|
||||
|
||||
/**
|
||||
* 模块状态
|
||||
*/
|
||||
private String moduleStatus;
|
||||
|
||||
/**
|
||||
* 信号强度
|
||||
*/
|
||||
private String signalStrength;
|
||||
|
||||
/**
|
||||
* 拨号获取的IP地址
|
||||
*/
|
||||
private String dialingIpAddress;
|
||||
|
||||
/**
|
||||
* 当前网络模式
|
||||
*/
|
||||
private String currentNetworkMode;
|
||||
|
||||
/**
|
||||
* 当前网络运营商
|
||||
*/
|
||||
private String currentNetworkOperators;
|
||||
|
||||
/**
|
||||
* 模块IMEI
|
||||
*/
|
||||
private String moduleImel;
|
||||
|
||||
/**
|
||||
* 4G/5G
|
||||
*/
|
||||
private String signalType;
|
||||
|
||||
/**
|
||||
* 启用拨号 0.未启用 1,已启用
|
||||
*/
|
||||
private String enableDialing;
|
||||
|
||||
/**
|
||||
* APN
|
||||
*/
|
||||
private String apn;
|
||||
|
||||
/**
|
||||
* 接入号
|
||||
*/
|
||||
private String accessNumber;
|
||||
|
||||
/**
|
||||
* 拨号用户名
|
||||
*/
|
||||
private String dialUpUsername;
|
||||
|
||||
/**
|
||||
* 拨号密码
|
||||
*/
|
||||
private String dialingPassword;
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.data.mapper;
|
||||
|
||||
import com.bonus.common.domain.data.dto.NetworkEthernetDto;
|
||||
import com.bonus.common.domain.data.dto.NetworkSimDto;
|
||||
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||
import com.bonus.common.domain.data.vo.NetworkEthernetVo;
|
||||
import com.bonus.common.domain.data.vo.NetworkSimVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @className:DINetworkMapper
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:16
|
||||
* @version:1.0
|
||||
* @description:网络设置-数据层
|
||||
*/
|
||||
@Repository(value = "DINetworkMapper")
|
||||
public interface DINetworkMapper {
|
||||
/**
|
||||
* 查询以太网的网络设置
|
||||
* @param dto
|
||||
* @return NetworkEthernetVo
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 15:00
|
||||
*/
|
||||
NetworkEthernetVo getNetworkEthernet(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 查询sim的网络设置
|
||||
* @param dto
|
||||
* @return NetworkSimVo
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 15:00
|
||||
*/
|
||||
NetworkSimVo getNetworkSim(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 以太网络设置
|
||||
* @param dto
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 16:07
|
||||
*/
|
||||
void updateNetworkEthernet(NetworkEthernetDto dto);
|
||||
|
||||
/**
|
||||
* sim网络设置
|
||||
* @param dto
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 16:07
|
||||
*/
|
||||
void updateNetworkSim(NetworkSimDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.data.service;
|
||||
|
||||
import com.bonus.common.domain.data.dto.NetworkEthernetDto;
|
||||
import com.bonus.common.domain.data.dto.NetworkSimDto;
|
||||
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||
import com.bonus.common.domain.data.vo.NetworkEthernetVo;
|
||||
import com.bonus.common.domain.data.vo.NetworkSimVo;
|
||||
|
||||
/**
|
||||
* @className:DINetworkService
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:15
|
||||
* @version:1.0
|
||||
* @description:网络设置-业务层
|
||||
*/
|
||||
public interface DINetworkService {
|
||||
/**
|
||||
* 查询以太网的网络设置
|
||||
* @param dto
|
||||
* @return NetworkEthernetVo
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 14:59
|
||||
*/
|
||||
NetworkEthernetVo getNetworkEthernet(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 查询sim的网络设置
|
||||
* @param dto
|
||||
* @return NetworkSimVo
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 14:59
|
||||
*/
|
||||
NetworkSimVo getNetworkSim(ParamsDto dto);
|
||||
|
||||
/**
|
||||
* 以太网络设置
|
||||
* @param dto
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 16:05
|
||||
*/
|
||||
void updateNetworkEthernet(NetworkEthernetDto dto);
|
||||
|
||||
/**
|
||||
* sim网络设置
|
||||
* @param dto
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/12/25 16:06
|
||||
*/
|
||||
void updateNetworkSim(NetworkSimDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.data.service.impl;
|
||||
|
||||
import com.bonus.common.domain.data.dto.NetworkEthernetDto;
|
||||
import com.bonus.common.domain.data.dto.NetworkSimDto;
|
||||
import com.bonus.common.domain.data.dto.ParamsDto;
|
||||
import com.bonus.common.domain.data.vo.NetworkEthernetVo;
|
||||
import com.bonus.common.domain.data.vo.NetworkSimVo;
|
||||
import com.bonus.data.mapper.DINetworkMapper;
|
||||
import com.bonus.data.service.DINetworkService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @className:DNetworkServiceImpl
|
||||
* @author:cwchen
|
||||
* @date:2025-12-25-14:15
|
||||
* @version:1.0
|
||||
* @description:网络设置业务逻辑层
|
||||
*/
|
||||
@Service(value = "DINetworkService")
|
||||
public class DNetworkServiceImpl implements DINetworkService {
|
||||
|
||||
@Resource(name = "DINetworkMapper")
|
||||
private DINetworkMapper diNetworkMapper;
|
||||
|
||||
@Override
|
||||
public NetworkEthernetVo getNetworkEthernet(ParamsDto dto) {
|
||||
return diNetworkMapper.getNetworkEthernet(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkSimVo getNetworkSim(ParamsDto dto) {
|
||||
return diNetworkMapper.getNetworkSim(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkEthernet(NetworkEthernetDto dto) {
|
||||
diNetworkMapper.updateNetworkEthernet(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkSim(NetworkSimDto dto) {
|
||||
diNetworkMapper.updateNetworkSim(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.data.mapper.DINetworkMapper">
|
||||
<!--以太网络设置-->
|
||||
<insert id="updateNetworkEthernet">
|
||||
<if test="networkEthernetId == null">
|
||||
INSERT INTO tb_system_network_ethernet
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="systemId != null">system_id,</if>
|
||||
<if test="ethernetInterface != null and ethernetInterface!=''">ethernet_interface,</if>
|
||||
<if test="enableDhcp != null and enableDhcp!=''">enable_dhcp,</if>
|
||||
<if test="ipAddress != null and ipAddress!=''">ip_address,</if>
|
||||
<if test="subnetMask != null and subnetMask!=''">subnet_mask,</if>
|
||||
<if test="defaultGateway != null and defaultGateway!=''">default_gateway,</if>
|
||||
<if test="dns != null and dns!=''">dns,</if>
|
||||
<if test="macAddress != null and macAddress!=''">mac_address,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="systemId != null">#{systemId},</if>
|
||||
<if test="ethernetInterface != null and ethernetInterface!=''">#{ethernetInterface},</if>
|
||||
<if test="enableDhcp != null and enableDhcp!=''">#{enableDhcp},</if>
|
||||
<if test="ipAddress != null and ipAddress!=''">#{ipAddress},</if>
|
||||
<if test="subnetMask != null and subnetMask!=''">#{subnetMask},</if>
|
||||
<if test="defaultGateway != null and defaultGateway!=''">#{defaultGateway},</if>
|
||||
<if test="dns != null and dns!=''">#{dns},</if>
|
||||
<if test="macAddress != null and macAddress!=''">#{macAddress},</if>
|
||||
</trim>
|
||||
</if>
|
||||
<if test="networkEthernetId != null">
|
||||
UPDATE tb_system_network_ethernet SET ethernet_interface = #{ethernetInterface},
|
||||
enable_dhcp = #{enableDhcp},
|
||||
ip_address = #{ipAddress},
|
||||
subnet_mask = #{subnetMask},
|
||||
default_gateway = #{defaultGateway},
|
||||
dns = #{dns},
|
||||
mac_address = #{macAddress}
|
||||
WHERE network_ethernet_id = #{networkEthernetId}
|
||||
</if>
|
||||
</insert>
|
||||
<!--sim网络设置-->
|
||||
<insert id="updateNetworkSim">
|
||||
<if test="simId == null">
|
||||
INSERT INTO tb_system_network_sim
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="systemId != null">system_id,</if>
|
||||
<if test="moduleStatus != null and moduleStatus!=''">module_status,</if>
|
||||
<if test="signalStrength != null and signalStrength!=''">signal_strength,</if>
|
||||
<if test="dialingIpAddress != null and dialingIpAddress!=''">dialing_ip_address,</if>
|
||||
<if test="currentNetworkMode != null and currentNetworkMode!=''">current_network_mode,</if>
|
||||
<if test="currentNetworkOperators != null and currentNetworkOperators!=''">current_network_operators,</if>
|
||||
<if test="moduleImel != null and moduleImel!=''">module_imel,</if>
|
||||
<if test="signalType != null and signalType!=''">signal_type,</if>
|
||||
<if test="enableDialing != null and enableDialing!=''">enable_dialing,</if>
|
||||
<if test="apn != null and apn!=''">apn,</if>
|
||||
<if test="accessNumber != null and accessNumber!=''">access_number,</if>
|
||||
<if test="dialUpUsername != null and dialUpUsername!=''">dial_up_username,</if>
|
||||
<if test="dialingPassword != null and dialingPassword!=''">dialing_password,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="systemId != null">#{systemId},</if>
|
||||
<if test="moduleStatus != null and moduleStatus!=''">#{moduleStatus},</if>
|
||||
<if test="signalStrength != null and signalStrength!=''">#{signalStrength},</if>
|
||||
<if test="dialingIpAddress != null and dialingIpAddress!=''">#{dialingIpAddress},</if>
|
||||
<if test="currentNetworkMode != null and currentNetworkMode!=''">#{currentNetworkMode},</if>
|
||||
<if test="currentNetworkOperators != null and currentNetworkOperators!=''">#{currentNetworkOperators},</if>
|
||||
<if test="moduleImel != null and moduleImel!=''">#{moduleImel},</if>
|
||||
<if test="signalType != null and signalType!=''">#{signalType},</if>
|
||||
<if test="enableDialing != null and enableDialing!=''">#{enableDialing},</if>
|
||||
<if test="apn != null and apn!=''">#{apn},</if>
|
||||
<if test="accessNumber != null and accessNumber!=''">#{accessNumber},</if>
|
||||
<if test="dialUpUsername != null and dialUpUsername!=''">#{dialUpUsername},</if>
|
||||
<if test="dialingPassword != null and dialingPassword!=''">#{dialingPassword},</if>
|
||||
</trim>
|
||||
</if>
|
||||
<if test="simId != null">
|
||||
UPDATE tb_system_network_sim SET module_status = #{moduleStatus},
|
||||
signal_strength = #{signalStrength},
|
||||
dialing_ip_address = #{dialingIpAddress},
|
||||
current_network_mode = #{currentNetworkMode},
|
||||
current_network_operators = #{currentNetworkOperators},
|
||||
module_imel = #{moduleImel},
|
||||
signal_type = #{signalType},
|
||||
enable_dialing = #{enableDialing},
|
||||
apn = #{apn},
|
||||
access_number = #{accessNumber},
|
||||
dial_up_username = #{dialUpUsername},
|
||||
dialing_password = #{dialingPassword}
|
||||
WHERE sim_id = #{simId}
|
||||
</if>
|
||||
</insert>
|
||||
<!--查询以太网的网络设置-->
|
||||
<select id="getNetworkEthernet" resultType="com.bonus.common.domain.data.vo.NetworkEthernetVo">
|
||||
SELECT
|
||||
network_ethernet_id AS networkEthernetId,
|
||||
ethernet_interface AS ethernetInterface,
|
||||
enable_dhcp AS enableDhcp,
|
||||
ip_address AS ipAddress,
|
||||
subnet_mask AS subnetMask,
|
||||
default_gateway AS defaultGateway,
|
||||
dns
|
||||
FROM tb_system_network_ethernet
|
||||
WHERE system_id = #{systemId}
|
||||
<if test="networkEthernetId!=null">
|
||||
AND network_ethernet_id = #{networkEthernetId}
|
||||
</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
<!--查询sim的网络设置-->
|
||||
<select id="getNetworkSim" resultType="com.bonus.common.domain.data.vo.NetworkSimVo">
|
||||
SELECT sim_id AS simId,
|
||||
module_status AS moduleStatus,
|
||||
signal_strength AS signalStrength,
|
||||
dialing_ip_address AS dialingIpAddress,
|
||||
current_network_mode AS currentNetworkMode,
|
||||
current_network_operators AS currentNetworkOperators,
|
||||
module_imel AS moduleImel,
|
||||
signal_type AS signalType,
|
||||
enable_dialing AS enableDialing,
|
||||
apn,
|
||||
access_number AS accessNumber,
|
||||
dial_up_username AS dialUpUsername,
|
||||
dialing_password AS dialingPassword
|
||||
FROM tb_system_network_sim
|
||||
WHERE system_id = #{systemId}
|
||||
<if test="networkEthernetId!=null">
|
||||
AND sim_id = #{simId}
|
||||
</if>
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue