|
@@ -1,35 +1,33 @@
|
|
|
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.Warning;
|
|
|
+import org.eco.als.domain.bo.WarningBo;
|
|
|
+import org.eco.als.domain.vo.WarningImportVo;
|
|
|
+import org.eco.als.domain.vo.WarningVo;
|
|
|
+import org.eco.als.listener.WarningImportListener;
|
|
|
+import org.eco.als.mapper.WarningMapper;
|
|
|
+import org.eco.als.service.IWarningService;
|
|
|
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.WarningMapper;
|
|
|
-import org.eco.als.domain.Warning;
|
|
|
-import org.eco.als.domain.bo.WarningBo;
|
|
|
-import org.eco.als.domain.vo.WarningVo;
|
|
|
-import org.eco.als.domain.vo.WarningImportVo;
|
|
|
-import org.eco.als.listener.WarningImportListener;
|
|
|
-import org.eco.als.service.IWarningService;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import static org.eco.als.domain.table.WarningTableDef.WARNING;
|
|
|
|
|
|
/**
|
|
@@ -58,15 +56,15 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
private QueryWrapper buildQueryWrapper(WarningBo warningBo) {
|
|
|
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
|
|
queryWrapper.and(WARNING.SORTIE_NO.eq
|
|
|
- (warningBo.getSortieNo()));
|
|
|
+ (warningBo.getSortieNo()));
|
|
|
queryWrapper.and(WARNING.AIRCRAFT_NO.eq
|
|
|
- (warningBo.getAircraftNo()));
|
|
|
+ (warningBo.getAircraftNo()));
|
|
|
queryWrapper.and(WARNING.CODE.eq
|
|
|
- (warningBo.getCode()));
|
|
|
+ (warningBo.getCode()));
|
|
|
queryWrapper.and(WARNING.NAME.like
|
|
|
- (warningBo.getName()));
|
|
|
+ (warningBo.getName()));
|
|
|
queryWrapper.and(WARNING.DESCRIBE.eq
|
|
|
- (warningBo.getDescribe()));
|
|
|
+ (warningBo.getDescribe()));
|
|
|
|
|
|
return queryWrapper;
|
|
|
}
|
|
@@ -79,7 +77,7 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
*/
|
|
|
@Override
|
|
|
public WarningVo selectById(Long id) {
|
|
|
- return this.getOneAs(query().where(WARNING.ID.eq(id)), WarningVo.class);
|
|
|
+ return this.getOneAs(query().where(WARNING.ID.eq(id)), WarningVo.class);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -93,7 +91,7 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
@Override
|
|
|
public List<WarningVo> selectList(WarningBo warningBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(warningBo);
|
|
|
- return this.listAs(queryWrapper, WarningVo.class);
|
|
|
+ return this.listAs(queryWrapper, WarningVo.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -105,7 +103,7 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
@Override
|
|
|
public PageResult<WarningVo> selectPage(WarningBo warningBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(warningBo);
|
|
|
- Page<WarningVo> page = this.pageAs(PageQuery.build(), queryWrapper, WarningVo.class);
|
|
|
+ Page<WarningVo> page = this.pageAs(PageQuery.build(), queryWrapper, WarningVo.class);
|
|
|
return PageResult.build(page);
|
|
|
}
|
|
|
|
|
@@ -117,7 +115,7 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean insert(WarningBo warningBo) {
|
|
|
- Warning warning =MapstructUtils.convert(warningBo, Warning. class);
|
|
|
+ Warning warning = MapstructUtils.convert(warningBo, Warning.class);
|
|
|
|
|
|
return this.save(warning);//使用全局配置的雪花算法主键生成器生成ID值
|
|
|
}
|
|
@@ -129,12 +127,11 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
* @return 结果:true 操作成功,false 操作失败
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean insertWithPk(WarningBo warningBo)
|
|
|
- {
|
|
|
+ public boolean insertWithPk(WarningBo warningBo) {
|
|
|
Warning warning = MapstructUtils.convert(warningBo, Warning.class);
|
|
|
|
|
|
|
|
|
- return warningMapper.insertWithPk(warning) > 0;//前台传来主键值
|
|
|
+ return warningMapper.insertWithPk(warning) > 0;//前台传来主键值
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -145,10 +142,9 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean update(WarningBo warningBo) {
|
|
|
- Warning warning =MapstructUtils.convert(warningBo, Warning. class);
|
|
|
- if (ObjectUtil.isNotNull(warning) && ObjectUtil.isNotNull(warning.getId())){
|
|
|
- boolean updated = this.updateById(warning);
|
|
|
- return updated;
|
|
|
+ Warning warning = MapstructUtils.convert(warningBo, Warning.class);
|
|
|
+ if (ObjectUtil.isNotNull(warning) && ObjectUtil.isNotNull(warning.getId())) {
|
|
|
+ return this.updateById(warning);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -162,8 +158,7 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
- ImportExportBo bo = getImportExportBo(result, loginUser, "0");
|
|
|
- boolean flag = importExportService.insert(bo);
|
|
|
+ boolean flag = importExportService.saveInfo(result, loginUser, "0");
|
|
|
if (flag) {
|
|
|
log.info("异步导入日志写入成功");
|
|
|
}
|
|
@@ -172,22 +167,12 @@ public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning>
|
|
|
@Override
|
|
|
public void asyncExport(List<WarningVo> listVo, String sheetName, LoginUser loginUser) {
|
|
|
ExcelResultRes result = excelService.exportExcel(listVo, sheetName, WarningVo.class);
|
|
|
- ImportExportBo bo = getImportExportBo(result, loginUser, "1");
|
|
|
- boolean flag = importExportService.insert(bo);
|
|
|
+ boolean flag = importExportService.saveInfo(result, loginUser, "1");
|
|
|
if (flag) {
|
|
|
log.info("异步导出日志写入成功");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static ImportExportBo getImportExportBo(ExcelResultRes result, LoginUser loginUser, String type) {
|
|
|
- ImportExportBo bo = new ImportExportBo();
|
|
|
- BeanUtils.copyProperties(result, bo);
|
|
|
- bo.setUpdateBy(loginUser.getUserId());
|
|
|
- bo.setCreateBy(loginUser.getUserId());
|
|
|
- bo.setType(type);
|
|
|
- return bo;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 批量删除警告信息
|
|
|
*
|