Jelajahi Sumber

警告信息

wanggaokun 11 bulan lalu
induk
melakukan
de5669b127

+ 140 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/controller/WarningController.java

@@ -0,0 +1,140 @@
+package org.eco.als.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+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.service.IWarningService;
+import org.eco.common.core.core.domain.CommonResult;
+import org.eco.common.core.core.domain.model.LoginUser;
+import org.eco.common.core.core.page.PageResult;
+import org.eco.common.excel.utils.ExcelUtil;
+import org.eco.common.log.annotation.Log;
+import org.eco.common.log.enums.BusinessType;
+import org.eco.common.security.utils.LoginHelper;
+import org.eco.common.web.annotation.RepeatSubmit;
+import org.eco.common.web.core.BaseController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 警告信息Controller
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/als/warning")
+public class WarningController extends BaseController {
+    @Resource
+    private IWarningService warningService;
+
+    /**
+     * 查询警告信息列表
+     */
+    @SaCheckPermission("als:warning:list")
+    @GetMapping("/list")
+    public CommonResult<PageResult<WarningVo>> list(WarningBo warningBo) {
+        return CommonResult.success(warningService.selectPage(warningBo));
+    }
+
+    /**
+     * 导出警告信息列表
+     */
+    @SaCheckPermission("als:warning:export")
+    @Log(title = "警告信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public CommonResult<Void> export(HttpServletResponse response, WarningBo warningBo) {
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        List<WarningVo> list = warningService.selectList(warningBo);
+        warningService.asyncExport(list, "警告信息", loginUser);
+        return CommonResult.success();
+    }
+
+    @SaCheckPermission("als:warning:import")
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response) {
+        ExcelUtil.exportExcel(new ArrayList<>(), "警告信息", WarningImportVo.class, response);
+    }
+
+    /**
+     * 导入警告信息列表
+     */
+    @Log(title = "警告信息", businessType = BusinessType.IMPORT)
+    @SaCheckPermission("als:warning:import")
+    @PostMapping("/importData")
+    public CommonResult<Void> importData(MultipartFile file, boolean updateSupport) {
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        warningService.asyncImportData(file, updateSupport, loginUser);
+        return CommonResult.success();
+    }
+
+    /**
+     * 获取警告信息详细信息
+     */
+    @SaCheckPermission("als:warning:query")
+    @GetMapping(value = "/{id}")
+    public CommonResult<WarningVo> getInfo(@PathVariable Long id) {
+        return CommonResult.success(warningService.selectById(id));
+    }
+
+    /**
+     * 新增警告信息
+     */
+    @SaCheckPermission("als:warning:add")
+    @Log(title = "警告信息", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping
+    public CommonResult<Void> add(@Validated @RequestBody WarningBo warningBo) {
+        boolean inserted = warningService.insert(warningBo);
+        if (!inserted) {
+            return CommonResult.fail("新增警告信息记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 修改警告信息
+     */
+    @SaCheckPermission("als:warning:edit")
+    @Log(title = "警告信息", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping
+    public CommonResult<Void> edit(@Validated @RequestBody WarningBo warningBo) {
+        boolean updated = warningService.update(warningBo);
+        if (!updated) {
+            return CommonResult.fail("修改警告信息记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 删除警告信息
+     */
+    @SaCheckPermission("als:warning:remove")
+    @Log(title = "警告信息", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public CommonResult<Void> remove(@PathVariable Long[] ids) {
+        boolean deleted = warningService.deleteByIds(ids);
+        if (!deleted) {
+            return CommonResult.fail("删除警告信息记录失败!");
+        }
+        return CommonResult.success();
+    }
+}

+ 68 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/domain/Warning.java

@@ -0,0 +1,68 @@
+package org.eco.als.domain;
+
+import com.mybatisflex.annotation.Column;
+import com.mybatisflex.annotation.Id;
+import com.mybatisflex.annotation.Table;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.eco.common.orm.core.domain.BaseEntity;
+
+import java.io.Serial;
+
+/**
+ * 警告信息对象 als_warning_t
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table(value = "als_warning_t")
+public class Warning extends BaseEntity {
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @Id
+    private Long id;
+
+    /**
+     * 架次号
+     */
+    private Long sortieNo;
+
+    /**
+     * 机号
+     */
+    private Integer aircraftNo;
+
+    /**
+     * 警告代码
+     */
+    private String code;
+
+    /**
+     * 警告名称
+     */
+    private String name;
+
+    /**
+     * 警告描述
+     */
+    private String describe;
+
+    /**
+     * 状态
+     */
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    @Column(isLogicDelete = true)
+    private Integer delFlag;
+
+
+}

+ 61 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/domain/bo/WarningBo.java

@@ -0,0 +1,61 @@
+package org.eco.als.domain.bo;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.eco.als.domain.Warning;
+import org.eco.common.orm.core.domain.BaseEntity;
+
+/**
+ * 警告信息业务对象 als_warning_t
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = Warning.class, reverseConvertGenerate = false)
+public class WarningBo extends BaseEntity {
+    /**
+     * 编号
+     */
+    private Long id;
+
+    /**
+     * 架次号
+     */
+    @NotNull(message = "架次号不能为空")
+    private Long sortieNo;
+
+    /**
+     * 机号
+     */
+    @NotNull(message = "机号不能为空")
+    private Integer aircraftNo;
+
+    /**
+     * 警告代码
+     */
+    @NotBlank(message = "警告代码不能为空")
+    private String code;
+
+    /**
+     * 警告名称
+     */
+    @NotBlank(message = "警告名称不能为空")
+    private String name;
+
+    /**
+     * 警告描述
+     */
+    private String describe;
+
+    /**
+     * 状态
+     */
+    private String status;
+
+
+}

+ 72 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/domain/vo/WarningImportVo.java

@@ -0,0 +1,72 @@
+package org.eco.als.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.eco.common.excel.annotation.ExcelDictFormat;
+import org.eco.common.excel.convert.ExcelDictConvert;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 警告信息导入视图对象 als_warning_t
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+
+@Data
+@NoArgsConstructor
+@ExcelIgnoreUnannotated
+public class WarningImportVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * 架次号
+     */
+    @ExcelProperty(value = "架次号")
+    private Long sortieNo;
+
+    /**
+     * 机号
+     */
+    @ExcelProperty(value = "机号")
+    private Integer aircraftNo;
+
+    /**
+     * 警告代码
+     */
+    @ExcelProperty(value = "警告代码")
+    private String code;
+
+    /**
+     * 警告名称
+     */
+    @ExcelProperty(value = "警告名称")
+    private String name;
+
+    /**
+     * 警告描述
+     */
+    @ExcelProperty(value = "警告描述")
+    private String describe;
+
+    /**
+     * 状态
+     */
+    @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "common_type")
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    private Integer delFlag;
+
+
+}

+ 94 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/domain/vo/WarningVo.java

@@ -0,0 +1,94 @@
+package org.eco.als.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.eco.common.mapper.annotation.FieldMapper;
+import com.eco.common.mapper.constant.MapperConstant;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.eco.als.domain.Warning;
+import org.eco.common.excel.annotation.ExcelDictFormat;
+import org.eco.common.excel.convert.ExcelDictConvert;
+import org.eco.common.orm.core.domain.BaseEntity;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 警告信息视图对象 als_warning_t
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+@Data
+@ExcelIgnoreUnannotated
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = Warning.class)
+public class WarningVo extends BaseEntity implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @ExcelProperty(value = "编号")
+    private Long id;
+
+    /**
+     * 架次号
+     */
+    @ExcelProperty(value = "架次号")
+    private Long sortieNo;
+
+    /**
+     * 机号
+     */
+    @ExcelProperty(value = "机号")
+    private Integer aircraftNo;
+
+    /**
+     * 警告代码
+     */
+    @ExcelProperty(value = "警告代码")
+    private String code;
+
+    /**
+     * 警告名称
+     */
+    @ExcelProperty(value = "警告名称")
+    private String name;
+
+    /**
+     * 警告描述
+     */
+    @ExcelProperty(value = "警告描述")
+    private String describe;
+
+    /**
+     * 状态
+     */
+    @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "common_type")
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    private Integer delFlag;
+
+
+    /**
+     * 创建人名称
+     */
+    @FieldMapper(type = MapperConstant.USER_ID_TO_NAME, mapper = "createBy")
+    private String createByName;
+
+    /**
+     * 创建人名称
+     */
+    @FieldMapper(type = MapperConstant.USER_ID_TO_NAME, mapper = "updateBy")
+    private String updateByName;
+
+}

+ 126 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/listener/WarningImportListener.java

@@ -0,0 +1,126 @@
+package org.eco.als.listener;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import lombok.extern.slf4j.Slf4j;
+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.service.IWarningService;
+import org.eco.common.core.core.domain.model.LoginUser;
+import org.eco.common.core.utils.SpringUtils;
+import org.eco.common.core.utils.ValidatorUtils;
+import org.eco.common.excel.core.ExcelListener;
+import org.eco.common.excel.core.ExcelResult;
+import org.eco.common.excel.entity.ExcelResultRes;
+
+import java.util.List;
+
+/**
+ * 警告信息自定义导入
+ *
+ * @author wgk
+ */
+@Slf4j
+public class WarningImportListener extends AnalysisEventListener<WarningImportVo> implements ExcelListener<WarningImportVo> {
+    private final IWarningService warningService;
+
+    private final Boolean isUpdateSupport;
+    private final LoginUser loginUser;
+    private int successNum = 0;
+    private int failureNum = 0;
+    private final StringBuilder successMsg = new StringBuilder();
+    private final StringBuilder failureMsg = new StringBuilder();
+
+    public WarningImportListener(Boolean isUpdateSupport, LoginUser loginUser) {
+        this.warningService = SpringUtils.getBean(IWarningService.class);
+        this.isUpdateSupport = isUpdateSupport;
+        this.loginUser = loginUser;
+    }
+
+    @Override
+    public void invoke(WarningImportVo warningVo, AnalysisContext context) {
+        try {
+
+            WarningBo warningBo = BeanUtil.toBean(warningVo, WarningBo.class);
+            WarningVo warningVo1 = null;
+
+            //warningVo1 = warningService.selectBySomefield(warningVo.getSomefield());
+            if (ObjectUtil.isNull(warningVo1)) {
+                //不存在就新增
+                setBo(warningBo);
+                ValidatorUtils.validate(warningBo);
+                boolean inserted = warningService.insert(warningBo);
+
+                if (inserted) {
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、警告信息 记录导入成功");
+                } else {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、警告信息 记录导入失败");
+                }
+            } else if (isUpdateSupport) {
+                //存在就更新
+                warningBo.setId(warningVo1.getId());//主键
+                warningBo.setVersion(warningVo1.getVersion());
+                boolean updated = warningService.update(warningBo);
+                if (updated) {
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、警告信息 记录更新成功");
+                } else {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、警告信息 记录更新失败");
+                }
+            }
+        } catch (Exception e) {
+            failureNum++;
+            String msg = "<br/>" + failureNum + "、警告信息 记录导入失败:" ;
+            failureMsg.append(msg).append(e.getMessage());
+            log.error(msg, e);
+        }
+    }
+
+    private void setBo(WarningBo warningBo) {
+        warningBo.setVersion(0);
+        warningBo.setCreateBy(loginUser.getUserId());
+        warningBo.setUpdateBy(loginUser.getUserId());
+        warningBo.setTenantId(loginUser.getTenantId());
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        log.info("解析完成");
+    }
+
+    @Override
+    public ExcelResult<WarningImportVo> getExcelResult() {
+        return new ExcelResult<>() {
+
+            @Override
+            public ExcelResultRes getAnalysis() {
+                if (failureNum > 0 && successNum == 0) {
+                    failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据没有成功导入,错误如下:");
+                    return ExcelResultRes.builder().logInfo(failureMsg.toString()).status("0").build();
+                } else if (failureNum > 0 && successNum > 0) {
+                    failureMsg.insert(0, "很抱歉,部分导入失败!共 " + failureNum + " 条数据没有成功导入,错误如下:");
+                    return ExcelResultRes.builder().logInfo(failureMsg.toString()).status("2").build();
+                } else {
+                    successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+                    return ExcelResultRes.builder().logInfo(successMsg.toString()).status("1").build();
+                }
+            }
+
+            @Override
+            public List<WarningImportVo> getList() {
+                return null;
+            }
+
+            @Override
+            public List<String> getErrorList() {
+                return null;
+            }
+        };
+    }
+}

+ 16 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/mapper/WarningMapper.java

@@ -0,0 +1,16 @@
+package org.eco.als.mapper;
+
+import com.mybatisflex.core.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.eco.als.domain.Warning;
+
+/**
+ * 警告信息Mapper接口
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+@Mapper
+public interface WarningMapper extends BaseMapper<Warning> {
+
+}

+ 97 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/service/IWarningService.java

@@ -0,0 +1,97 @@
+package org.eco.als.service;
+
+import org.eco.als.domain.Warning;
+import org.eco.als.domain.bo.WarningBo;
+import org.eco.als.domain.vo.WarningVo;
+import org.eco.common.core.core.domain.model.LoginUser;
+import org.eco.common.core.core.page.PageResult;
+import org.eco.common.orm.core.service.IBaseService;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * 警告信息Service接口
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+public interface IWarningService extends IBaseService<Warning> {
+    /**
+     * 查询警告信息
+     *
+     * @param id 警告信息主键
+     * @return 警告信息
+     */
+    WarningVo selectById(Long id);
+
+    /**
+     * 查询警告信息列表
+     *
+     * @param warningBo 警告信息Bo
+     * @return 警告信息集合
+     */
+    List<WarningVo> selectList(WarningBo warningBo);
+
+    /**
+     * 分页查询警告信息列表
+     *
+     * @param warningBo 警告信息Bo
+     * @return 分页警告信息集合
+     */
+    PageResult<WarningVo> selectPage(WarningBo warningBo);
+
+    /**
+     * 新增警告信息
+     *
+     * @param warningBo 警告信息Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    boolean insert(WarningBo warningBo);
+
+    /**
+     * 新增警告信息,前台提供主键值,一般用于导入的场合
+     *
+     * @param warningBo 警告信息Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    boolean insertWithPk(WarningBo warningBo);
+
+    /**
+     * 修改警告信息
+     *
+     * @param warningBo 警告信息Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    boolean update(WarningBo warningBo);
+
+    /**
+     * 批量删除警告信息
+     *
+     * @param ids 需要删除的警告信息主键集合
+     * @return 结果:true 删除成功,false 删除失败
+     */
+    boolean deleteByIds(Long[] ids);
+
+    /**
+     * 异步导入
+     *
+     * @param file          导入的文件
+     * @param updateSupport 是否覆盖
+     * @param user          用户上下文信息
+     */
+    @Async
+    void asyncImportData(MultipartFile file, boolean updateSupport, LoginUser user);
+
+    /**
+     * asyncExport 异步导出
+     *
+     * @param listVo    数据列表
+     * @param sheetName 文件名称
+     * @param user      上下文
+     */
+    @Async
+    void asyncExport(List<WarningVo> listVo, String sheetName, LoginUser user);
+
+}

+ 203 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/service/impl/WarningServiceImpl.java

@@ -0,0 +1,203 @@
+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 lombok.extern.slf4j.Slf4j;
+import org.eco.common.core.core.domain.model.LoginUser;
+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.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 static org.eco.als.domain.table.WarningTableDef.WARNING;
+
+/**
+ * 警告信息Service业务层处理
+ *
+ * @author wgk
+ * @date 2024-07-22
+ */
+@Service
+@Slf4j
+public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning> implements IWarningService {
+    @Resource
+    private WarningMapper warningMapper;
+
+    @Resource
+    private IExcelService excelService;
+
+    @Resource
+    private IImportExportService importExportService;
+
+    @Override
+    public QueryWrapper query() {
+        return super.query().from(WARNING);
+    }
+
+    private QueryWrapper buildQueryWrapper(WarningBo warningBo) {
+        QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
+        queryWrapper.and(WARNING.SORTIE_NO.eq
+        (warningBo.getSortieNo()));
+        queryWrapper.and(WARNING.AIRCRAFT_NO.eq
+        (warningBo.getAircraftNo()));
+        queryWrapper.and(WARNING.CODE.eq
+        (warningBo.getCode()));
+        queryWrapper.and(WARNING.NAME.like
+        (warningBo.getName()));
+        queryWrapper.and(WARNING.DESCRIBE.eq
+        (warningBo.getDescribe()));
+
+        return queryWrapper;
+    }
+
+    /**
+     * 查询警告信息
+     *
+     * @param id 警告信息主键
+     * @return 警告信息
+     */
+    @Override
+    public WarningVo selectById(Long id) {
+            return this.getOneAs(query().where(WARNING.ID.eq(id)), WarningVo.class);
+
+    }
+
+
+    /**
+     * 查询警告信息列表
+     *
+     * @param warningBo 警告信息Bo
+     * @return 警告信息集合
+     */
+    @Override
+    public List<WarningVo> selectList(WarningBo warningBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(warningBo);
+            return this.listAs(queryWrapper, WarningVo.class);
+    }
+
+    /**
+     * 分页查询警告信息列表
+     *
+     * @param warningBo 警告信息Bo
+     * @return 分页警告信息集合
+     */
+    @Override
+    public PageResult<WarningVo> selectPage(WarningBo warningBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(warningBo);
+            Page<WarningVo> page = this.pageAs(PageQuery.build(), queryWrapper, WarningVo.class);
+        return PageResult.build(page);
+    }
+
+    /**
+     * 新增警告信息
+     *
+     * @param warningBo 警告信息Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    @Override
+    public boolean insert(WarningBo warningBo) {
+    Warning warning =MapstructUtils.convert(warningBo, Warning. class);
+
+        return this.save(warning);//使用全局配置的雪花算法主键生成器生成ID值
+    }
+
+    /**
+     * 新增警告信息,前台提供主键值,一般用于导入的场合
+     *
+     * @param warningBo 警告信息Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    @Override
+    public boolean insertWithPk(WarningBo warningBo)
+    {
+        Warning warning = MapstructUtils.convert(warningBo, Warning.class);
+
+
+            return warningMapper.insertWithPk(warning) > 0;//前台传来主键值
+    }
+
+    /**
+     * 修改警告信息
+     *
+     * @param warningBo 警告信息Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    @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;
+        }
+        return false;
+    }
+
+    @Override
+    public void asyncImportData(MultipartFile file, boolean updateSupport, LoginUser loginUser) {
+        ExcelResultRes result;
+        try {
+            String name = file.getOriginalFilename();
+            result = excelService.importExcel(file.getInputStream(), name, WarningImportVo.class, new WarningImportListener(updateSupport, loginUser));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        ImportExportBo bo = getImportExportBo(result, loginUser, "0");
+        boolean flag = importExportService.insert(bo);
+        if (flag) {
+            log.info("异步导入日志写入成功");
+        }
+    }
+
+    @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);
+        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;
+    }
+
+    /**
+     * 批量删除警告信息
+     *
+     * @param ids 需要删除的警告信息主键集合
+     * @return 结果:true 删除成功,false 删除失败
+     */
+    @Transactional
+    @Override
+    public boolean deleteByIds(Long[] ids) {
+        return this.removeByIds(Arrays.asList(ids));
+    }
+
+}

+ 7 - 0
als-modules/agile-assurance/src/main/resources/mapper/als/WarningMapper.xml

@@ -0,0 +1,7 @@
+<?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="org.eco.als.mapper.WarningMapper">
+
+</mapper>