浏览代码

feat: 保障规则/保障规则子表

wanggaokun 11 月之前
父节点
当前提交
1a0f7dcfac
共有 20 个文件被更改,包括 1741 次插入0 次删除
  1. 144 0
      als-modules/agile-assurance/src/main/java/org/eco/als/controller/SafeRuleController.java
  2. 144 0
      als-modules/agile-assurance/src/main/java/org/eco/als/controller/SafeRuleSubController.java
  3. 58 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/SafeRule.java
  4. 78 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/SafeRuleSub.java
  5. 49 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/bo/SafeRuleBo.java
  6. 70 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/bo/SafeRuleSubBo.java
  7. 58 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/vo/SafeRuleImportVo.java
  8. 82 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/vo/SafeRuleSubImportVo.java
  9. 104 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/vo/SafeRuleSubVo.java
  10. 80 0
      als-modules/agile-assurance/src/main/java/org/eco/als/domain/vo/SafeRuleVo.java
  11. 128 0
      als-modules/agile-assurance/src/main/java/org/eco/als/listener/SafeRuleImportListener.java
  12. 128 0
      als-modules/agile-assurance/src/main/java/org/eco/als/listener/SafeRuleSubImportListener.java
  13. 16 0
      als-modules/agile-assurance/src/main/java/org/eco/als/mapper/SafeRuleMapper.java
  14. 16 0
      als-modules/agile-assurance/src/main/java/org/eco/als/mapper/SafeRuleSubMapper.java
  15. 97 0
      als-modules/agile-assurance/src/main/java/org/eco/als/service/ISafeRuleService.java
  16. 97 0
      als-modules/agile-assurance/src/main/java/org/eco/als/service/ISafeRuleSubService.java
  17. 186 0
      als-modules/agile-assurance/src/main/java/org/eco/als/service/impl/SafeRuleServiceImpl.java
  18. 192 0
      als-modules/agile-assurance/src/main/java/org/eco/als/service/impl/SafeRuleSubServiceImpl.java
  19. 7 0
      als-modules/agile-assurance/src/main/resources/mapper/als/SafeRuleMapper.xml
  20. 7 0
      als-modules/agile-assurance/src/main/resources/mapper/als/SafeRuleSubMapper.xml

+ 144 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/controller/SafeRuleController.java

@@ -0,0 +1,144 @@
+package org.eco.als.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.collection.CollUtil;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.eco.als.domain.bo.SafeRuleBo;
+import org.eco.als.domain.vo.SafeRuleImportVo;
+import org.eco.als.domain.vo.SafeRuleVo;
+import org.eco.als.service.ISafeRuleService;
+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-24
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/als/safeRule")
+public class SafeRuleController extends BaseController {
+    @Resource
+    private ISafeRuleService safeRuleService;
+
+    /**
+     * 查询保障规则列表
+     */
+    @SaCheckPermission("als:safeRule:list")
+    @GetMapping("/list")
+    public CommonResult<PageResult<SafeRuleVo>> list(SafeRuleBo safeRuleBo) {
+        return CommonResult.success(safeRuleService.selectPage(safeRuleBo));
+    }
+
+    /**
+     * 导出保障规则列表
+     */
+    @SaCheckPermission("als:safeRule:export")
+    @Log(title = "保障规则", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public CommonResult<Void> export(SafeRuleBo safeRuleBo) {
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        List<SafeRuleVo> list = safeRuleService.selectList(safeRuleBo);
+        if (CollUtil.isEmpty(list)) {
+            return CommonResult.fail("导出列表为空");
+        }
+        safeRuleService.asyncExport(list, "保障规则", loginUser);
+        return CommonResult.success();
+    }
+
+    @SaCheckPermission("als:safeRule:import")
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response) {
+        ExcelUtil.exportExcel(new ArrayList<>(), "保障规则", SafeRuleImportVo.class, response);
+    }
+
+    /**
+     * 导入保障规则列表
+     */
+    @Log(title = "保障规则", businessType = BusinessType.IMPORT)
+    @SaCheckPermission("als:safeRule:import")
+    @PostMapping("/importData")
+    public CommonResult<Void> importData(MultipartFile file, boolean updateSupport) {
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        safeRuleService.asyncImportData(file, updateSupport, loginUser);
+        return CommonResult.success();
+    }
+
+    /**
+     * 获取保障规则详细信息
+     */
+    @SaCheckPermission("als:safeRule:query")
+    @GetMapping(value = "/{id}")
+    public CommonResult<SafeRuleVo> getInfo(@PathVariable Long id) {
+        return CommonResult.success(safeRuleService.selectById(id));
+    }
+
+    /**
+     * 新增保障规则
+     */
+    @SaCheckPermission("als:safeRule:add")
+    @Log(title = "保障规则", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping
+    public CommonResult<Void> add(@Validated @RequestBody SafeRuleBo safeRuleBo) {
+        boolean inserted = safeRuleService.insert(safeRuleBo);
+        if (!inserted) {
+            return CommonResult.fail("新增保障规则记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 修改保障规则
+     */
+    @SaCheckPermission("als:safeRule:edit")
+    @Log(title = "保障规则", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping
+    public CommonResult<Void> edit(@Validated @RequestBody SafeRuleBo safeRuleBo) {
+        boolean updated = safeRuleService.update(safeRuleBo);
+        if (!updated) {
+            return CommonResult.fail("修改保障规则记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 删除保障规则
+     */
+    @SaCheckPermission("als:safeRule:remove")
+    @Log(title = "保障规则", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public CommonResult<Void> remove(@PathVariable Long[] ids) {
+        boolean deleted = safeRuleService.deleteByIds(ids);
+        if (!deleted) {
+            return CommonResult.fail("删除保障规则记录失败!");
+        }
+        return CommonResult.success();
+    }
+}

+ 144 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/controller/SafeRuleSubController.java

@@ -0,0 +1,144 @@
+package org.eco.als.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.hutool.core.collection.CollUtil;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.eco.als.domain.bo.SafeRuleSubBo;
+import org.eco.als.domain.vo.SafeRuleSubImportVo;
+import org.eco.als.domain.vo.SafeRuleSubVo;
+import org.eco.als.service.ISafeRuleSubService;
+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-24
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/als/safeRuleSub")
+public class SafeRuleSubController extends BaseController {
+    @Resource
+    private ISafeRuleSubService safeRuleSubService;
+
+    /**
+     * 查询保障规则子列表
+     */
+    @SaCheckPermission("als:safeRuleSub:list")
+    @GetMapping("/list")
+    public CommonResult<PageResult<SafeRuleSubVo>> list(SafeRuleSubBo safeRuleSubBo) {
+        return CommonResult.success(safeRuleSubService.selectPage(safeRuleSubBo));
+    }
+
+    /**
+     * 导出保障规则子列表
+     */
+    @SaCheckPermission("als:safeRuleSub:export")
+    @Log(title = "保障规则子", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public CommonResult<Void> export(SafeRuleSubBo safeRuleSubBo) {
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        List<SafeRuleSubVo> list = safeRuleSubService.selectList(safeRuleSubBo);
+        if (CollUtil.isEmpty(list)) {
+            return CommonResult.fail("导出列表为空");
+        }
+        safeRuleSubService.asyncExport(list, "保障规则子", loginUser);
+        return CommonResult.success();
+    }
+
+    @SaCheckPermission("als:safeRuleSub:import")
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response) {
+        ExcelUtil.exportExcel(new ArrayList<>(), "保障规则子", SafeRuleSubImportVo.class, response);
+    }
+
+    /**
+     * 导入保障规则子列表
+     */
+    @Log(title = "保障规则子", businessType = BusinessType.IMPORT)
+    @SaCheckPermission("als:safeRuleSub:import")
+    @PostMapping("/importData")
+    public CommonResult<Void> importData(MultipartFile file, boolean updateSupport) {
+        LoginUser loginUser = LoginHelper.getLoginUser();
+        safeRuleSubService.asyncImportData(file, updateSupport, loginUser);
+        return CommonResult.success();
+    }
+
+    /**
+     * 获取保障规则子详细信息
+     */
+    @SaCheckPermission("als:safeRuleSub:query")
+    @GetMapping(value = "/{id}")
+    public CommonResult<SafeRuleSubVo> getInfo(@PathVariable Long id) {
+        return CommonResult.success(safeRuleSubService.selectById(id));
+    }
+
+    /**
+     * 新增保障规则子
+     */
+    @SaCheckPermission("als:safeRuleSub:add")
+    @Log(title = "保障规则子", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping
+    public CommonResult<Void> add(@Validated @RequestBody SafeRuleSubBo safeRuleSubBo) {
+        boolean inserted = safeRuleSubService.insert(safeRuleSubBo);
+        if (!inserted) {
+            return CommonResult.fail("新增保障规则子记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 修改保障规则子
+     */
+    @SaCheckPermission("als:safeRuleSub:edit")
+    @Log(title = "保障规则子", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping
+    public CommonResult<Void> edit(@Validated @RequestBody SafeRuleSubBo safeRuleSubBo) {
+        boolean updated = safeRuleSubService.update(safeRuleSubBo);
+        if (!updated) {
+            return CommonResult.fail("修改保障规则子记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 删除保障规则子
+     */
+    @SaCheckPermission("als:safeRuleSub:remove")
+    @Log(title = "保障规则子", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public CommonResult<Void> remove(@PathVariable Long[] ids) {
+        boolean deleted = safeRuleSubService.deleteByIds(ids);
+        if (!deleted) {
+            return CommonResult.fail("删除保障规则子记录失败!");
+        }
+        return CommonResult.success();
+    }
+}

+ 58 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/domain/SafeRule.java

@@ -0,0 +1,58 @@
+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_safe_rule_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table(value = "als_safe_rule_t")
+public class SafeRule extends BaseEntity {
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @Id
+    private Long id;
+
+    /**
+     * 机型
+     */
+    private String aircraftModel;
+
+    /**
+     * 时长
+     */
+    private String duration;
+
+    /**
+     * 飞行课目
+     */
+    private String trainExercise;
+
+    /**
+     * 状态(1正常)
+     */
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    @Column(isLogicDelete = true)
+    private Integer delFlag;
+
+
+}

+ 78 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/domain/SafeRuleSub.java

@@ -0,0 +1,78 @@
+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_safe_rule_sub_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table(value = "als_safe_rule_sub_t")
+public class SafeRuleSub extends BaseEntity {
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @Id
+    private Long id;
+
+    /**
+     * 机型
+     */
+    private String aircraftModel;
+
+    /**
+     * 机组
+     */
+    private String aircraftGroup;
+
+    /**
+     * 时长
+     */
+    private String duration;
+
+    /**
+     * 设备
+     */
+    private String device;
+
+    /**
+     * 数量
+     */
+    private Integer deviceCount;
+
+    /**
+     * 单位
+     */
+    private String unit;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态(1正常)
+     */
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    @Column(isLogicDelete = true)
+    private Integer delFlag;
+
+
+}

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

@@ -0,0 +1,49 @@
+package org.eco.als.domain.bo;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.eco.als.domain.SafeRule;
+import org.eco.common.orm.core.domain.BaseEntity;
+
+/**
+ * 保障规则业务对象 als_safe_rule_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = SafeRule.class, reverseConvertGenerate = false)
+public class SafeRuleBo extends BaseEntity {
+    /**
+     * 编号
+     */
+    private Long id;
+
+    /**
+     * 机型
+     */
+    @NotBlank(message = "机型不能为空")
+    private String aircraftModel;
+
+    /**
+     * 时长
+     */
+    @NotBlank(message = "时长不能为空")
+    private String duration;
+
+    /**
+     * 飞行课目
+     */
+    @NotBlank(message = "飞行课目不能为空")
+    private String trainExercise;
+
+    /**
+     * 状态(1正常)
+     */
+    private String status;
+
+
+}

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

@@ -0,0 +1,70 @@
+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.SafeRuleSub;
+import org.eco.common.orm.core.domain.BaseEntity;
+
+/**
+ * 保障规则子业务对象 als_safe_rule_sub_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = SafeRuleSub.class, reverseConvertGenerate = false)
+public class SafeRuleSubBo extends BaseEntity {
+
+    private Long id;
+    /**
+     * 机型
+     */
+    @NotBlank(message = "机型不能为空")
+    private String aircraftModel;
+
+    /**
+     * 机组
+     */
+    @NotBlank(message = "机组不能为空")
+    private String aircraftGroup;
+
+    /**
+     * 时长
+     */
+    @NotBlank(message = "时长不能为空")
+    private String duration;
+
+    /**
+     * 设备
+     */
+    @NotBlank(message = "设备不能为空")
+    private String device;
+
+    /**
+     * 数量
+     */
+    @NotNull(message = "数量不能为空")
+    private Integer deviceCount;
+
+    /**
+     * 单位
+     */
+    @NotBlank(message = "单位不能为空")
+    private String unit;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态(1正常)
+     */
+    private String status;
+
+
+}

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

@@ -0,0 +1,58 @@
+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 java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 保障规则导入视图对象 als_safe_rule_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+
+@Data
+@NoArgsConstructor
+@ExcelIgnoreUnannotated
+public class SafeRuleImportVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * 机型
+     */
+    @ExcelProperty(value = "机型")
+    private String aircraftModel;
+
+    /**
+     * 时长
+     */
+    @ExcelProperty(value = "时长")
+    private String duration;
+
+    /**
+     * 飞行课目
+     */
+    @ExcelProperty(value = "飞行课目")
+    private String trainExercise;
+
+    /**
+     * 状态(1正常)
+     */
+    @ExcelProperty(value = "状态(1正常)")
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    @ExcelProperty(value = "删除标识(1删除 0未删除)")
+    private Integer delFlag;
+
+
+}

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

@@ -0,0 +1,82 @@
+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 java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 保障规则子导入视图对象 als_safe_rule_sub_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+
+@Data
+@NoArgsConstructor
+@ExcelIgnoreUnannotated
+public class SafeRuleSubImportVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * 机型
+     */
+    @ExcelProperty(value = "机型")
+    private String aircraftModel;
+
+    /**
+     * 机组
+     */
+    @ExcelProperty(value = "机组")
+    private String aircraftGroup;
+
+    /**
+     * 时长
+     */
+    @ExcelProperty(value = "时长")
+    private String duration;
+
+    /**
+     * 设备
+     */
+    @ExcelProperty(value = "设备")
+    private String device;
+
+    /**
+     * 数量
+     */
+    @ExcelProperty(value = "数量")
+    private Integer deviceCount;
+
+    /**
+     * 单位
+     */
+    @ExcelProperty(value = "单位")
+    private String unit;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    /**
+     * 状态(1正常)
+     */
+    @ExcelProperty(value = "状态(1正常)")
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    @ExcelProperty(value = "删除标识(1删除 0未删除)")
+    private Integer delFlag;
+
+
+}

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

@@ -0,0 +1,104 @@
+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.SafeRuleSub;
+import org.eco.common.orm.core.domain.BaseEntity;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 保障规则子视图对象 als_safe_rule_sub_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Data
+@ExcelIgnoreUnannotated
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = SafeRuleSub.class)
+public class SafeRuleSubVo extends BaseEntity implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @ExcelProperty(value = "编号")
+    private Long id;
+
+    /**
+     * 机型
+     */
+    @ExcelProperty(value = "机型")
+    private String aircraftModel;
+
+    /**
+     * 机组
+     */
+    @ExcelProperty(value = "机组")
+    private String aircraftGroup;
+
+    /**
+     * 时长
+     */
+    @ExcelProperty(value = "时长")
+    private String duration;
+
+    /**
+     * 设备
+     */
+    @ExcelProperty(value = "设备")
+    private String device;
+
+    /**
+     * 数量
+     */
+    @ExcelProperty(value = "数量")
+    private Integer deviceCount;
+
+    /**
+     * 单位
+     */
+    @ExcelProperty(value = "单位")
+    private String unit;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    /**
+     * 状态(1正常)
+     */
+    @ExcelProperty(value = "状态(1正常)")
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    @ExcelProperty(value = "删除标识(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;
+
+}

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

@@ -0,0 +1,80 @@
+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.SafeRule;
+import org.eco.common.orm.core.domain.BaseEntity;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 保障规则视图对象 als_safe_rule_t
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Data
+@ExcelIgnoreUnannotated
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = SafeRule.class)
+public class SafeRuleVo extends BaseEntity implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @ExcelProperty(value = "编号")
+    private Long id;
+
+    /**
+     * 机型
+     */
+    @ExcelProperty(value = "机型")
+    private String aircraftModel;
+
+    /**
+     * 时长
+     */
+    @ExcelProperty(value = "时长")
+    private String duration;
+
+    /**
+     * 飞行课目
+     */
+    @ExcelProperty(value = "飞行课目")
+    private String trainExercise;
+
+    /**
+     * 状态(1正常)
+     */
+    @ExcelProperty(value = "状态(1正常)")
+    private String status;
+
+    /**
+     * 删除标识(1删除 0未删除)
+     */
+    @ExcelProperty(value = "删除标识(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;
+
+}

+ 128 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/listener/SafeRuleImportListener.java

@@ -0,0 +1,128 @@
+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.SafeRuleBo;
+import org.eco.als.domain.vo.SafeRuleImportVo;
+import org.eco.als.domain.vo.SafeRuleVo;
+import org.eco.als.service.ISafeRuleService;
+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 SafeRuleImportListener extends AnalysisEventListener<SafeRuleImportVo> implements ExcelListener<SafeRuleImportVo> {
+    private final ISafeRuleService safeRuleService;
+
+    private final Boolean isUpdateSupport;
+    private final LoginUser loginUser;
+    private final StringBuilder successMsg = new StringBuilder();
+    private final StringBuilder failureMsg = new StringBuilder();
+    private int successNum = 0;
+    private int failureNum = 0;
+
+    public SafeRuleImportListener(Boolean isUpdateSupport, LoginUser loginUser) {
+        this.safeRuleService = SpringUtils.getBean(ISafeRuleService.class);
+        this.isUpdateSupport = isUpdateSupport;
+        this.loginUser = loginUser;
+    }
+
+    @Override
+    public void invoke(SafeRuleImportVo safeRuleVo, AnalysisContext context) {
+        try {
+
+            SafeRuleBo safeRuleBo = BeanUtil.toBean(safeRuleVo, SafeRuleBo.class);
+
+            //TODO:根据某个字段,查询数据库表中是否存在记录,不存在就新增,存在就更新
+            SafeRuleVo safeRuleVo1 = null;
+
+            //safeRuleVo1 = safeRuleService.selectBySomefield(safeRuleVo.getSomefield());
+            if (ObjectUtil.isNull(safeRuleVo1)) {
+                //不存在就新增
+                setBo(safeRuleBo);
+                ValidatorUtils.validate(safeRuleBo);
+                boolean inserted = safeRuleService.insert(safeRuleBo);
+
+                if (inserted) {
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、保障规则 记录导入成功");
+                } else {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、保障规则 记录导入失败");
+                }
+            } else if (isUpdateSupport) {
+                //存在就更新
+                safeRuleBo.setId(safeRuleVo1.getId());//主键
+                safeRuleBo.setVersion(safeRuleVo1.getVersion());
+                boolean updated = safeRuleService.update(safeRuleBo);
+                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(SafeRuleBo safeRuleBo) {
+        safeRuleBo.setVersion(0);
+        safeRuleBo.setCreateBy(loginUser.getUserId());
+        safeRuleBo.setUpdateBy(loginUser.getUserId());
+        safeRuleBo.setTenantId(loginUser.getTenantId());
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        log.info("解析完成");
+    }
+
+    @Override
+    public ExcelResult<SafeRuleImportVo> 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<SafeRuleImportVo> getList() {
+                return null;
+            }
+
+            @Override
+            public List<String> getErrorList() {
+                return null;
+            }
+        };
+    }
+}

+ 128 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/listener/SafeRuleSubImportListener.java

@@ -0,0 +1,128 @@
+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.SafeRuleSubBo;
+import org.eco.als.domain.vo.SafeRuleSubImportVo;
+import org.eco.als.domain.vo.SafeRuleSubVo;
+import org.eco.als.service.ISafeRuleSubService;
+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 SafeRuleSubImportListener extends AnalysisEventListener<SafeRuleSubImportVo> implements ExcelListener<SafeRuleSubImportVo> {
+    private final ISafeRuleSubService safeRuleSubService;
+
+    private final Boolean isUpdateSupport;
+    private final LoginUser loginUser;
+    private final StringBuilder successMsg = new StringBuilder();
+    private final StringBuilder failureMsg = new StringBuilder();
+    private int successNum = 0;
+    private int failureNum = 0;
+
+    public SafeRuleSubImportListener(Boolean isUpdateSupport, LoginUser loginUser) {
+        this.safeRuleSubService = SpringUtils.getBean(ISafeRuleSubService.class);
+        this.isUpdateSupport = isUpdateSupport;
+        this.loginUser = loginUser;
+    }
+
+    @Override
+    public void invoke(SafeRuleSubImportVo safeRuleSubVo, AnalysisContext context) {
+        try {
+
+            SafeRuleSubBo safeRuleSubBo = BeanUtil.toBean(safeRuleSubVo, SafeRuleSubBo.class);
+
+            //TODO:根据某个字段,查询数据库表中是否存在记录,不存在就新增,存在就更新
+            SafeRuleSubVo safeRuleSubVo1 = null;
+
+            //safeRuleSubVo1 = safeRuleSubService.selectBySomefield(safeRuleSubVo.getSomefield());
+            if (ObjectUtil.isNull(safeRuleSubVo1)) {
+                //不存在就新增
+                setBo(safeRuleSubBo);
+                ValidatorUtils.validate(safeRuleSubBo);
+                boolean inserted = safeRuleSubService.insert(safeRuleSubBo);
+
+                if (inserted) {
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、保障规则子 记录导入成功");
+                } else {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、保障规则子 记录导入失败");
+                }
+            } else if (isUpdateSupport) {
+                //存在就更新
+                safeRuleSubBo.setId(safeRuleSubVo1.getId());//主键
+                safeRuleSubBo.setVersion(safeRuleSubVo1.getVersion());
+                boolean updated = safeRuleSubService.update(safeRuleSubBo);
+                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(SafeRuleSubBo safeRuleSubBo) {
+        safeRuleSubBo.setVersion(0);
+        safeRuleSubBo.setCreateBy(loginUser.getUserId());
+        safeRuleSubBo.setUpdateBy(loginUser.getUserId());
+        safeRuleSubBo.setTenantId(loginUser.getTenantId());
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        log.info("解析完成");
+    }
+
+    @Override
+    public ExcelResult<SafeRuleSubImportVo> 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<SafeRuleSubImportVo> getList() {
+                return null;
+            }
+
+            @Override
+            public List<String> getErrorList() {
+                return null;
+            }
+        };
+    }
+}

+ 16 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/mapper/SafeRuleMapper.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.SafeRule;
+
+/**
+ * 保障规则Mapper接口
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Mapper
+public interface SafeRuleMapper extends BaseMapper<SafeRule> {
+
+}

+ 16 - 0
als-modules/agile-assurance/src/main/java/org/eco/als/mapper/SafeRuleSubMapper.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.SafeRuleSub;
+
+/**
+ * 保障规则子Mapper接口
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Mapper
+public interface SafeRuleSubMapper extends BaseMapper<SafeRuleSub> {
+
+}

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

@@ -0,0 +1,97 @@
+package org.eco.als.service;
+
+import org.eco.als.domain.SafeRule;
+import org.eco.als.domain.bo.SafeRuleBo;
+import org.eco.als.domain.vo.SafeRuleVo;
+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-24
+ */
+public interface ISafeRuleService extends IBaseService<SafeRule> {
+    /**
+     * 查询保障规则
+     *
+     * @param id 保障规则主键
+     * @return 保障规则
+     */
+    SafeRuleVo selectById(Long id);
+
+    /**
+     * 查询保障规则列表
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 保障规则集合
+     */
+    List<SafeRuleVo> selectList(SafeRuleBo safeRuleBo);
+
+    /**
+     * 分页查询保障规则列表
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 分页保障规则集合
+     */
+    PageResult<SafeRuleVo> selectPage(SafeRuleBo safeRuleBo);
+
+    /**
+     * 新增保障规则
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    boolean insert(SafeRuleBo safeRuleBo);
+
+    /**
+     * 新增保障规则,前台提供主键值,一般用于导入的场合
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    boolean insertWithPk(SafeRuleBo safeRuleBo);
+
+    /**
+     * 修改保障规则
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    boolean update(SafeRuleBo safeRuleBo);
+
+    /**
+     * 批量删除保障规则
+     *
+     * @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<SafeRuleVo> listVo, String sheetName, LoginUser user);
+
+}

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

@@ -0,0 +1,97 @@
+package org.eco.als.service;
+
+import org.eco.als.domain.SafeRuleSub;
+import org.eco.als.domain.bo.SafeRuleSubBo;
+import org.eco.als.domain.vo.SafeRuleSubVo;
+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-24
+ */
+public interface ISafeRuleSubService extends IBaseService<SafeRuleSub> {
+    /**
+     * 查询保障规则子
+     *
+     * @param id 保障规则子主键
+     * @return 保障规则子
+     */
+    SafeRuleSubVo selectById(Long id);
+
+    /**
+     * 查询保障规则子列表
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 保障规则子集合
+     */
+    List<SafeRuleSubVo> selectList(SafeRuleSubBo safeRuleSubBo);
+
+    /**
+     * 分页查询保障规则子列表
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 分页保障规则子集合
+     */
+    PageResult<SafeRuleSubVo> selectPage(SafeRuleSubBo safeRuleSubBo);
+
+    /**
+     * 新增保障规则子
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    boolean insert(SafeRuleSubBo safeRuleSubBo);
+
+    /**
+     * 新增保障规则子,前台提供主键值,一般用于导入的场合
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    boolean insertWithPk(SafeRuleSubBo safeRuleSubBo);
+
+    /**
+     * 修改保障规则子
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    boolean update(SafeRuleSubBo safeRuleSubBo);
+
+    /**
+     * 批量删除保障规则子
+     *
+     * @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<SafeRuleSubVo> listVo, String sheetName, LoginUser user);
+
+}

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

@@ -0,0 +1,186 @@
+package org.eco.als.service.impl;
+
+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.SafeRule;
+import org.eco.als.domain.bo.SafeRuleBo;
+import org.eco.als.domain.vo.SafeRuleImportVo;
+import org.eco.als.domain.vo.SafeRuleVo;
+import org.eco.als.listener.SafeRuleImportListener;
+import org.eco.als.mapper.SafeRuleMapper;
+import org.eco.als.service.ISafeRuleService;
+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.orm.core.page.PageQuery;
+import org.eco.common.orm.core.service.impl.BaseServiceImpl;
+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 java.util.Arrays;
+import java.util.List;
+
+import static org.eco.als.domain.table.SafeRuleTableDef.SAFE_RULE;
+
+/**
+ * 保障规则Service业务层处理
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Service
+@Slf4j
+public class SafeRuleServiceImpl extends BaseServiceImpl<SafeRuleMapper, SafeRule> implements ISafeRuleService {
+    @Resource
+    private SafeRuleMapper safeRuleMapper;
+
+    @Resource
+    private IExcelService excelService;
+
+    @Resource
+    private IImportExportService importExportService;
+
+    @Override
+    public QueryWrapper query() {
+        return super.query().from(SAFE_RULE);
+    }
+
+    private QueryWrapper buildQueryWrapper(SafeRuleBo safeRuleBo) {
+        QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
+        queryWrapper.and(SAFE_RULE.AIRCRAFT_MODEL.eq
+            (safeRuleBo.getAircraftModel()));
+        queryWrapper.and(SAFE_RULE.DURATION.eq
+            (safeRuleBo.getDuration()));
+        queryWrapper.and(SAFE_RULE.TRAIN_EXERCISE.eq
+            (safeRuleBo.getTrainExercise()));
+        queryWrapper.and(SAFE_RULE.STATUS.eq
+            (safeRuleBo.getStatus()));
+
+        return queryWrapper;
+    }
+
+    /**
+     * 查询保障规则
+     *
+     * @param id 保障规则主键
+     * @return 保障规则
+     */
+    @Override
+    public SafeRuleVo selectById(Long id) {
+        return this.getOneAs(query().where(SAFE_RULE.ID.eq(id)), SafeRuleVo.class);
+
+    }
+
+
+    /**
+     * 查询保障规则列表
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 保障规则集合
+     */
+    @Override
+    public List<SafeRuleVo> selectList(SafeRuleBo safeRuleBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(safeRuleBo);
+        return this.listAs(queryWrapper, SafeRuleVo.class);
+    }
+
+    /**
+     * 分页查询保障规则列表
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 分页保障规则集合
+     */
+    @Override
+    public PageResult<SafeRuleVo> selectPage(SafeRuleBo safeRuleBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(safeRuleBo);
+        Page<SafeRuleVo> page = this.pageAs(PageQuery.build(), queryWrapper, SafeRuleVo.class);
+        return PageResult.build(page);
+    }
+
+    /**
+     * 新增保障规则
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    @Override
+    public boolean insert(SafeRuleBo safeRuleBo) {
+        SafeRule safeRule = MapstructUtils.convert(safeRuleBo, SafeRule.class);
+
+        return this.save(safeRule);//使用全局配置的雪花算法主键生成器生成ID值
+    }
+
+    /**
+     * 新增保障规则,前台提供主键值,一般用于导入的场合
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    @Override
+    public boolean insertWithPk(SafeRuleBo safeRuleBo) {
+        SafeRule safeRule = MapstructUtils.convert(safeRuleBo, SafeRule.class);
+
+
+        return safeRuleMapper.insertWithPk(safeRule) > 0;//前台传来主键值
+    }
+
+    /**
+     * 修改保障规则
+     *
+     * @param safeRuleBo 保障规则Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    @Override
+    public boolean update(SafeRuleBo safeRuleBo) {
+        SafeRule safeRule = MapstructUtils.convert(safeRuleBo, SafeRule.class);
+        if (ObjectUtil.isNotNull(safeRule) && ObjectUtil.isNotNull(safeRule.getId())) {
+            return this.updateById(safeRule);
+        }
+        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, SafeRuleImportVo.class, new SafeRuleImportListener(updateSupport, loginUser));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        boolean flag = importExportService.saveInfo(result, loginUser, "0");
+        if (flag) {
+            log.info("异步导入日志写入成功");
+        }
+    }
+
+    @Override
+    public void asyncExport(List<SafeRuleVo> listVo, String sheetName, LoginUser loginUser) {
+        ExcelResultRes result = excelService.exportExcel(listVo, sheetName, SafeRuleVo.class);
+        boolean flag = importExportService.saveInfo(result, loginUser, "1");
+        if (flag) {
+            log.info("异步导出日志写入成功");
+        }
+    }
+
+    /**
+     * 批量删除保障规则
+     *
+     * @param ids 需要删除的保障规则主键集合
+     * @return 结果:true 删除成功,false 删除失败
+     */
+    @Transactional
+    @Override
+    public boolean deleteByIds(Long[] ids) {
+        return this.removeByIds(Arrays.asList(ids));
+    }
+
+}

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

@@ -0,0 +1,192 @@
+package org.eco.als.service.impl;
+
+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.SafeRuleSub;
+import org.eco.als.domain.bo.SafeRuleSubBo;
+import org.eco.als.domain.vo.SafeRuleSubImportVo;
+import org.eco.als.domain.vo.SafeRuleSubVo;
+import org.eco.als.listener.SafeRuleSubImportListener;
+import org.eco.als.mapper.SafeRuleSubMapper;
+import org.eco.als.service.ISafeRuleSubService;
+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.orm.core.page.PageQuery;
+import org.eco.common.orm.core.service.impl.BaseServiceImpl;
+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 java.util.Arrays;
+import java.util.List;
+
+import static org.eco.als.domain.table.SafeRuleSubTableDef.SAFE_RULE_SUB;
+
+/**
+ * 保障规则子Service业务层处理
+ *
+ * @author wgk
+ * @date 2024-07-24
+ */
+@Service
+@Slf4j
+public class SafeRuleSubServiceImpl extends BaseServiceImpl<SafeRuleSubMapper, SafeRuleSub> implements ISafeRuleSubService {
+    @Resource
+    private SafeRuleSubMapper safeRuleSubMapper;
+
+    @Resource
+    private IExcelService excelService;
+
+    @Resource
+    private IImportExportService importExportService;
+
+    @Override
+    public QueryWrapper query() {
+        return super.query().from(SAFE_RULE_SUB);
+    }
+
+    private QueryWrapper buildQueryWrapper(SafeRuleSubBo safeRuleSubBo) {
+        QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
+        queryWrapper.and(SAFE_RULE_SUB.AIRCRAFT_MODEL.eq
+            (safeRuleSubBo.getAircraftModel()));
+        queryWrapper.and(SAFE_RULE_SUB.AIRCRAFT_GROUP.eq
+            (safeRuleSubBo.getAircraftGroup()));
+        queryWrapper.and(SAFE_RULE_SUB.DURATION.eq
+            (safeRuleSubBo.getDuration()));
+        queryWrapper.and(SAFE_RULE_SUB.DEVICE.eq
+            (safeRuleSubBo.getDevice()));
+        queryWrapper.and(SAFE_RULE_SUB.DEVICE_COUNT.eq
+            (safeRuleSubBo.getDeviceCount()));
+        queryWrapper.and(SAFE_RULE_SUB.UNIT.eq
+            (safeRuleSubBo.getUnit()));
+        queryWrapper.and(SAFE_RULE_SUB.STATUS.eq
+            (safeRuleSubBo.getStatus()));
+
+        return queryWrapper;
+    }
+
+    /**
+     * 查询保障规则子
+     *
+     * @param id 保障规则子主键
+     * @return 保障规则子
+     */
+    @Override
+    public SafeRuleSubVo selectById(Long id) {
+        return this.getOneAs(query().where(SAFE_RULE_SUB.ID.eq(id)), SafeRuleSubVo.class);
+
+    }
+
+
+    /**
+     * 查询保障规则子列表
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 保障规则子集合
+     */
+    @Override
+    public List<SafeRuleSubVo> selectList(SafeRuleSubBo safeRuleSubBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(safeRuleSubBo);
+        return this.listAs(queryWrapper, SafeRuleSubVo.class);
+    }
+
+    /**
+     * 分页查询保障规则子列表
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 分页保障规则子集合
+     */
+    @Override
+    public PageResult<SafeRuleSubVo> selectPage(SafeRuleSubBo safeRuleSubBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(safeRuleSubBo);
+        Page<SafeRuleSubVo> page = this.pageAs(PageQuery.build(), queryWrapper, SafeRuleSubVo.class);
+        return PageResult.build(page);
+    }
+
+    /**
+     * 新增保障规则子
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    @Override
+    public boolean insert(SafeRuleSubBo safeRuleSubBo) {
+        SafeRuleSub safeRuleSub = MapstructUtils.convert(safeRuleSubBo, SafeRuleSub.class);
+
+        return this.save(safeRuleSub);//使用全局配置的雪花算法主键生成器生成ID值
+    }
+
+    /**
+     * 新增保障规则子,前台提供主键值,一般用于导入的场合
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    @Override
+    public boolean insertWithPk(SafeRuleSubBo safeRuleSubBo) {
+        SafeRuleSub safeRuleSub = MapstructUtils.convert(safeRuleSubBo, SafeRuleSub.class);
+
+
+        return safeRuleSubMapper.insertWithPk(safeRuleSub) > 0;//前台传来主键值
+    }
+
+    /**
+     * 修改保障规则子
+     *
+     * @param safeRuleSubBo 保障规则子Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    @Override
+    public boolean update(SafeRuleSubBo safeRuleSubBo) {
+        SafeRuleSub safeRuleSub = MapstructUtils.convert(safeRuleSubBo, SafeRuleSub.class);
+        if (ObjectUtil.isNotNull(safeRuleSub) && ObjectUtil.isNotNull(safeRuleSub.getId())) {
+            return this.updateById(safeRuleSub);
+        }
+        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, SafeRuleSubImportVo.class, new SafeRuleSubImportListener(updateSupport, loginUser));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        boolean flag = importExportService.saveInfo(result, loginUser, "0");
+        if (flag) {
+            log.info("异步导入日志写入成功");
+        }
+    }
+
+    @Override
+    public void asyncExport(List<SafeRuleSubVo> listVo, String sheetName, LoginUser loginUser) {
+        ExcelResultRes result = excelService.exportExcel(listVo, sheetName, SafeRuleSubVo.class);
+        boolean flag = importExportService.saveInfo(result, loginUser, "1");
+        if (flag) {
+            log.info("异步导出日志写入成功");
+        }
+    }
+
+    /**
+     * 批量删除保障规则子
+     *
+     * @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/SafeRuleMapper.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.SafeRuleMapper">
+
+</mapper>

+ 7 - 0
als-modules/agile-assurance/src/main/resources/mapper/als/SafeRuleSubMapper.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.SafeRuleSubMapper">
+
+</mapper>