|
@@ -1,42 +1,40 @@
|
|
|
package org.eco.als.service.impl;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.mybatisflex.core.paginate.Page;
|
|
|
import com.mybatisflex.core.query.QueryWrapper;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.eco.als.domain.Communication;
|
|
|
+import org.eco.als.domain.bo.CommunicationBo;
|
|
|
+import org.eco.als.domain.vo.CommunicationImportVo;
|
|
|
+import org.eco.als.domain.vo.CommunicationVo;
|
|
|
+import org.eco.als.listener.CommunicationImportListener;
|
|
|
+import org.eco.als.mapper.CommunicationMapper;
|
|
|
+import org.eco.als.service.ICommunicationService;
|
|
|
import org.eco.common.core.core.domain.model.LoginUser;
|
|
|
+import org.eco.common.core.core.page.PageResult;
|
|
|
+import org.eco.common.core.utils.MapstructUtils;
|
|
|
import org.eco.common.excel.entity.ExcelResultRes;
|
|
|
import org.eco.common.excel.service.IExcelService;
|
|
|
-import org.eco.common.core.utils.bean.BeanUtils;
|
|
|
-import org.eco.common.core.utils.MapstructUtils;
|
|
|
-import org.eco.system.service.IImportExportService;
|
|
|
-import org.eco.common.core.utils.StringUtils;
|
|
|
-import org.eco.system.domain.bo.ImportExportBo;
|
|
|
import org.eco.common.orm.core.page.PageQuery;
|
|
|
-import org.eco.common.core.core.page.PageResult;
|
|
|
import org.eco.common.orm.core.service.impl.BaseServiceImpl;
|
|
|
-import jakarta.annotation.Resource;
|
|
|
+import org.eco.system.service.IImportExportService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
import java.io.IOException;
|
|
|
-import org.eco.als.mapper.CommunicationMapper;
|
|
|
-import org.eco.als.domain.Communication;
|
|
|
-import org.eco.als.domain.bo.CommunicationBo;
|
|
|
-import org.eco.als.domain.vo.CommunicationVo;
|
|
|
-import org.eco.als.domain.vo.CommunicationImportVo;
|
|
|
-import org.eco.als.listener.CommunicationImportListener;
|
|
|
-import org.eco.als.service.ICommunicationService;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import static org.eco.als.domain.table.CommunicationTableDef.COMMUNICATION;
|
|
|
|
|
|
/**
|
|
|
* 通讯管理Service业务层处理
|
|
|
*
|
|
|
* @author wgk
|
|
|
- * @date 2024-12-14
|
|
|
+ * @date 2024-12-17
|
|
|
*/
|
|
|
@Service
|
|
|
@Slf4j
|
|
@@ -58,25 +56,25 @@ public class CommunicationServiceImpl extends BaseServiceImpl<CommunicationMappe
|
|
|
private QueryWrapper buildQueryWrapper(CommunicationBo communicationBo) {
|
|
|
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
|
|
queryWrapper.and(COMMUNICATION.NAME.like
|
|
|
- (communicationBo.getName()));
|
|
|
+ (communicationBo.getName()));
|
|
|
queryWrapper.and(COMMUNICATION.IP_ADDRESS.eq
|
|
|
- (communicationBo.getIpAddress()));
|
|
|
+ (communicationBo.getIpAddress()));
|
|
|
queryWrapper.and(COMMUNICATION.NETWORK_SEGMENT.eq
|
|
|
- (communicationBo.getNetworkSegment()));
|
|
|
+ (communicationBo.getNetworkSegment()));
|
|
|
queryWrapper.and(COMMUNICATION.SUBNET_MASK.eq
|
|
|
- (communicationBo.getSubnetMask()));
|
|
|
+ (communicationBo.getSubnetMask()));
|
|
|
queryWrapper.and(COMMUNICATION.DNS.eq
|
|
|
- (communicationBo.getDns()));
|
|
|
+ (communicationBo.getDns()));
|
|
|
queryWrapper.and(COMMUNICATION.GATEWAY.eq
|
|
|
- (communicationBo.getGateway()));
|
|
|
+ (communicationBo.getGateway()));
|
|
|
queryWrapper.and(COMMUNICATION.HTTP.eq
|
|
|
- (communicationBo.getHttp()));
|
|
|
+ (communicationBo.getHttp()));
|
|
|
queryWrapper.and(COMMUNICATION.PORT.eq
|
|
|
- (communicationBo.getPort()));
|
|
|
+ (communicationBo.getPort()));
|
|
|
queryWrapper.and(COMMUNICATION.USER_NAME.like
|
|
|
- (communicationBo.getUserName()));
|
|
|
+ (communicationBo.getUserName()));
|
|
|
queryWrapper.and(COMMUNICATION.PASSWORD.eq
|
|
|
- (communicationBo.getPassword()));
|
|
|
+ (communicationBo.getPassword()));
|
|
|
|
|
|
return queryWrapper;
|
|
|
}
|
|
@@ -89,7 +87,7 @@ public class CommunicationServiceImpl extends BaseServiceImpl<CommunicationMappe
|
|
|
*/
|
|
|
@Override
|
|
|
public CommunicationVo selectById(Long id) {
|
|
|
- return this.getOneAs(query().where(COMMUNICATION.ID.eq(id)), CommunicationVo.class);
|
|
|
+ return this.getOneAs(query().where(COMMUNICATION.ID.eq(id)), CommunicationVo.class);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -103,7 +101,7 @@ public class CommunicationServiceImpl extends BaseServiceImpl<CommunicationMappe
|
|
|
@Override
|
|
|
public List<CommunicationVo> selectList(CommunicationBo communicationBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(communicationBo);
|
|
|
- return this.listAs(queryWrapper, CommunicationVo.class);
|
|
|
+ return this.listAs(queryWrapper, CommunicationVo.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -115,7 +113,7 @@ public class CommunicationServiceImpl extends BaseServiceImpl<CommunicationMappe
|
|
|
@Override
|
|
|
public PageResult<CommunicationVo> selectPage(CommunicationBo communicationBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(communicationBo);
|
|
|
- Page<CommunicationVo> page = this.pageAs(PageQuery.build(), queryWrapper, CommunicationVo.class);
|
|
|
+ Page<CommunicationVo> page = this.pageAs(PageQuery.build(), queryWrapper, CommunicationVo.class);
|
|
|
return PageResult.build(page);
|
|
|
}
|
|
|
|
|
@@ -127,7 +125,7 @@ public class CommunicationServiceImpl extends BaseServiceImpl<CommunicationMappe
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean insert(CommunicationBo communicationBo) {
|
|
|
- Communication communication =MapstructUtils.convert(communicationBo, Communication. class);
|
|
|
+ Communication communication = MapstructUtils.convert(communicationBo, Communication.class);
|
|
|
|
|
|
return this.save(communication);//使用全局配置的雪花算法主键生成器生成ID值
|
|
|
}
|
|
@@ -139,12 +137,11 @@ public class CommunicationServiceImpl extends BaseServiceImpl<CommunicationMappe
|
|
|
* @return 结果:true 操作成功,false 操作失败
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean insertWithPk(CommunicationBo communicationBo)
|
|
|
- {
|
|
|
+ public boolean insertWithPk(CommunicationBo communicationBo) {
|
|
|
Communication communication = MapstructUtils.convert(communicationBo, Communication.class);
|
|
|
|
|
|
|
|
|
- return communicationMapper.insertWithPk(communication) > 0;//前台传来主键值
|
|
|
+ return communicationMapper.insertWithPk(communication) > 0;//前台传来主键值
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -155,10 +152,10 @@ public class CommunicationServiceImpl extends BaseServiceImpl<CommunicationMappe
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean update(CommunicationBo communicationBo) {
|
|
|
- Communication communication =MapstructUtils.convert(communicationBo, Communication. class);
|
|
|
- if (ObjectUtil.isNotNull(communication) && ObjectUtil.isNotNull(communication.getId())){
|
|
|
+ Communication communication = MapstructUtils.convert(communicationBo, Communication.class);
|
|
|
+ if (ObjectUtil.isNotNull(communication) && ObjectUtil.isNotNull(communication.getId())) {
|
|
|
boolean updated = this.updateById(communication);
|
|
|
- return updated;
|
|
|
+ return updated;
|
|
|
}
|
|
|
return false;
|
|
|
}
|