Selaa lähdekoodia

feat: 可见光转红外后端搭建基本完成

WANGKANG 9 kuukautta sitten
vanhempi
sitoutus
6fa640a10e

+ 1 - 0
taais-admin/src/main/resources/application-dev.yml

@@ -42,6 +42,7 @@ mybatis-flex:
       url: jdbc:postgresql://110.41.34.83:5432/taais?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
       username: postgres
       password: P3x0LG8jzyHRX59l
+#      password: 123456
 
 #    # 数据源-2
 #    ds2:

+ 108 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/controller/ToInfraredController.java

@@ -0,0 +1,108 @@
+package com.taais.biz.controller;
+
+import com.taais.biz.domain.bo.ToInfraredBo;
+import com.taais.biz.domain.vo.ToInfraredVo;
+import com.taais.biz.service.IToInfraredService;
+import com.taais.common.core.core.page.PageResult;
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import com.taais.common.core.core.domain.CommonResult;
+import com.taais.common.excel.utils.ExcelUtil;
+import com.taais.common.log.annotation.Log;
+import com.taais.common.log.enums.BusinessType;
+import com.taais.common.web.annotation.RepeatSubmit;
+import com.taais.common.web.core.BaseController;
+import jakarta.annotation.Resource;
+
+import java.util.List;
+
+/**
+ * 可见光转红外Controller
+ *
+ * @author 0
+ * 2024-09-20
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/demo/toInfrared")
+public class ToInfraredController extends BaseController {
+    @Resource
+    private IToInfraredService toInfraredService;
+
+    /**
+     * 查询可见光转红外列表
+     */
+    @SaCheckPermission("demo:toInfrared:list")
+    @GetMapping("/list")
+    public CommonResult<PageResult<ToInfraredVo>> list(ToInfraredBo toInfraredBo) {
+        return CommonResult.success(toInfraredService.selectPage(toInfraredBo));
+    }
+
+    /**
+     * 导出可见光转红外列表
+     */
+    @SaCheckPermission("demo:toInfrared:export")
+    @Log(title = "可见光转红外", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ToInfraredBo toInfraredBo) {
+        List<ToInfraredVo> list = toInfraredService.selectList(toInfraredBo);
+        ExcelUtil.exportExcel(list, "可见光转红外", ToInfraredVo.class, response);
+    }
+
+    /**
+     * 获取可见光转红外详细信息
+     */
+    @SaCheckPermission("demo:toInfrared:query")
+    @GetMapping(value = "/{id}")
+    public CommonResult<ToInfraredVo> getInfo(@PathVariable Long id) {
+        return CommonResult.success(toInfraredService.selectById(id));
+    }
+
+    /**
+     * 新增可见光转红外
+     */
+    @SaCheckPermission("demo:toInfrared:add")
+    @Log(title = "可见光转红外", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping
+    public CommonResult<Void> add(@Validated @RequestBody ToInfraredBo toInfraredBo) {
+        boolean inserted = toInfraredService.insert(toInfraredBo);
+        if (!inserted) {
+            return CommonResult.fail("新增可见光转红外记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 修改可见光转红外
+     */
+    @SaCheckPermission("demo:toInfrared:edit")
+    @Log(title = "可见光转红外", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping
+    public CommonResult<Void> edit(@Validated @RequestBody ToInfraredBo toInfraredBo) {
+        Boolean updated = toInfraredService.update(toInfraredBo);
+        if (!updated) {
+            return CommonResult.fail("修改可见光转红外记录失败!");
+        }
+        return CommonResult.success();
+    }
+
+    /**
+     * 删除可见光转红外
+     */
+    @SaCheckPermission("demo:toInfrared:remove")
+    @Log(title = "可见光转红外", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public CommonResult<Void> remove(@PathVariable Long[] ids) {
+        boolean deleted = toInfraredService.deleteByIds(ids);
+        if (!deleted) {
+            return CommonResult.fail("删除可见光转红外记录失败!");
+        }
+        return CommonResult.success();
+    }
+}

+ 101 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/ToInfrared.java

@@ -0,0 +1,101 @@
+package com.taais.biz.domain;
+
+import java.util.Date;
+
+import com.mybatisflex.annotation.Column;
+import com.mybatisflex.annotation.Id;
+import com.mybatisflex.annotation.Table;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+
+import com.taais.common.orm.core.domain.BaseEntity;
+
+/**
+ * 可见光转红外对象 to_infrared
+ *
+ * @author 0
+ * 2024-09-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Table(value = "to_infrared")
+public class ToInfrared extends BaseEntity {
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    @Id
+    private Long id;
+
+    /**
+     * 任务名称
+     */
+    private String name;
+
+    /**
+     * 状态
+     * 0:未开始
+     * 1:进行中
+     * 2:完成
+     * 3:失败
+     * 4:中断
+     */
+    private String status;
+
+    /**
+     * 开始时间
+     */
+    private Date startTime;
+
+    /**
+     * 结束时间
+     */
+    private Date endTime;
+
+    /**
+     * 耗时
+     */
+    private Long costSecond;
+
+    /**
+     * 日志
+     */
+    private String log;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * $column.columnComment
+     */
+    @Column(isLogicDelete = true)
+    private Integer delFlag;
+
+    /**
+     * $column.columnComment
+     */
+    private String url;
+
+    /**
+     * $column.columnComment
+     */
+    private Long inputOssId;
+
+    /**
+     * 输入路径
+     */
+    private String inputPath;
+
+    /**
+     * 输出路径
+     */
+    private String outputPath;
+    private String zipFilePath;
+
+}

+ 93 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/bo/ToInfraredBo.java

@@ -0,0 +1,93 @@
+package com.taais.biz.domain.bo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.taais.biz.domain.ToInfrared;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+import com.taais.common.orm.core.domain.BaseEntity;
+
+import java.util.Date;
+
+/**
+ * 可见光转红外业务对象 to_infrared
+ *
+ * @author 0
+ * @date 2024-09-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = ToInfrared.class, reverseConvertGenerate = false)
+public class ToInfraredBo extends BaseEntity{
+    /**
+     * ID
+     */
+    private Long id;
+
+    /**
+     * 任务名称
+     */
+    @NotBlank(message = "任务名称不能为空")
+    private String name;
+
+    /**
+     * 状态
+        0:未开始
+        1:进行中
+        2:完成
+        3:失败
+        4:中断
+     */
+    private String status;
+
+    /**
+     * 开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date startTime;
+
+    /**
+     * 结束时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date endTime;
+
+    /**
+     * 耗时
+     */
+    private Long costSecond;
+
+    /**
+     * 日志
+     */
+    private String log;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * $column.columnComment
+     */
+    private String url;
+
+    /**
+     * $column.columnComment
+     */
+    @NotNull(message = "上传文件不能为空")
+    private Long inputOssId;
+
+    /**
+     * 输入路径
+     */
+    private String inputPath;
+
+    /**
+     * 输出路径
+     */
+    private String outputPath;
+
+
+}

+ 85 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/vo/ToInfraredImportVo.java

@@ -0,0 +1,85 @@
+package com.taais.biz.domain.vo;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.taais.common.excel.annotation.ExcelDictFormat;
+import com.taais.common.excel.convert.ExcelDictConvert;
+import lombok.Data;
+import java.io.Serial;
+import java.io.Serializable;
+import lombok.NoArgsConstructor;
+
+/**
+ * 可见光转红外导入视图对象 to_infrared
+ *
+ * @author 0
+ * @date 2024-09-20
+ */
+
+@Data
+@NoArgsConstructor
+public class ToInfraredImportVo implements Serializable
+{
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+
+     /** 任务名称 */
+    @ExcelProperty(value = "任务名称")
+    private String name;
+
+     /** 状态
+0:未开始
+1:进行中
+2:完成
+3:失败
+4:中断 */
+    @ExcelProperty(value = "状态 ")
+    private String status;
+
+     /** 开始时间 */
+    @ExcelProperty(value = "开始时间")
+    private Date startTime;
+
+     /** 结束时间 */
+    @ExcelProperty(value = "结束时间")
+    private Date endTime;
+
+     /** 耗时 */
+    @ExcelProperty(value = "耗时")
+    private Long costSecond;
+
+     /** 日志 */
+    @ExcelProperty(value = "日志")
+    private String log;
+
+     /** 备注 */
+    @ExcelProperty(value = "备注")
+    private String remarks;
+
+     /** $column.columnComment */
+    @ExcelProperty(value = "${column.columnComment}")
+    private Integer delFlag;
+
+     /** $column.columnComment */
+    @ExcelProperty(value = "${comment}", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(readConverterExp = "$column.readConverterExp()")
+    private String url;
+
+     /** $column.columnComment */
+    @ExcelProperty(value = "${comment}", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(readConverterExp = "$column.readConverterExp()")
+    private Long inputOssId;
+
+     /** 输入路径 */
+    @ExcelProperty(value = "输入路径")
+    private String inputPath;
+
+     /** 输出路径 */
+    @ExcelProperty(value = "输出路径")
+    private String outputPath;
+
+
+}

+ 95 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/vo/ToInfraredVo.java

@@ -0,0 +1,95 @@
+package com.taais.biz.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.taais.biz.domain.ToInfrared;
+import com.taais.common.excel.annotation.ExcelDictFormat;
+import com.taais.common.excel.convert.ExcelDictConvert;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.taais.common.orm.core.domain.BaseEntity;
+
+/**
+ * 可见光转红外视图对象 to_infrared
+ *
+ * @author 0
+ * @date 2024-09-20
+ */
+@Data
+@ExcelIgnoreUnannotated
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = ToInfrared.class)
+public class ToInfraredVo extends BaseEntity implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    @ExcelProperty(value = "ID")
+    private Long id;
+
+    /**
+     * 任务名称
+     */
+    @ExcelProperty(value = "任务名称")
+    private String name;
+
+    /** 状态
+     0:未开始
+     1:进行中
+     2:完成
+     3:失败
+     4:中断 */
+    @ExcelProperty(value = "状态 ")
+        private String status;
+
+        /** 开始时间 */
+        @ExcelProperty(value = "开始时间")
+        private Date startTime;
+
+        /** 结束时间 */
+        @ExcelProperty(value = "结束时间")
+        private Date endTime;
+
+        /** 耗时 */
+        @ExcelProperty(value = "耗时")
+        private Long costSecond;
+
+        /** 日志 */
+        @ExcelProperty(value = "日志")
+        private String log;
+
+        /** 备注 */
+        @ExcelProperty(value = "备注")
+        private String remarks;
+
+        /** $column.columnComment */
+        @ExcelProperty(value = "${column.columnComment}")
+        private Integer delFlag;
+
+        /** $column.columnComment */
+        @ExcelProperty(value = "${comment}", converter = ExcelDictConvert.class)
+        @ExcelDictFormat(readConverterExp = "$column.readConverterExp()")
+        private String url;
+
+        /** $column.columnComment */
+        @ExcelProperty(value = "${comment}", converter = ExcelDictConvert.class)
+        @ExcelDictFormat(readConverterExp = "$column.readConverterExp()")
+        private Long inputOssId;
+
+        /** 输入路径 */
+        @ExcelProperty(value = "输入路径")
+        private String inputPath;
+
+        /** 输出路径 */
+        @ExcelProperty(value = "输出路径")
+        private String outputPath;
+}

+ 119 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/listener/ToInfraredImportListener.java

@@ -0,0 +1,119 @@
+package com.taais.biz.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 com.taais.biz.domain.bo.ToInfraredBo;
+import com.taais.biz.domain.vo.ToInfraredImportVo;
+import com.taais.biz.domain.vo.ToInfraredVo;
+import com.taais.biz.service.IToInfraredService;
+import com.taais.common.core.exception.ServiceException;
+import com.taais.common.core.utils.SpringUtils;
+import com.taais.common.core.utils.ValidatorUtils;
+import com.taais.common.excel.core.ExcelListener;
+import com.taais.common.excel.core.ExcelResult;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.List;
+
+/**
+ * 可见光转红外自定义导入
+ *
+ * @author 0
+ */
+@Slf4j
+public class ToInfraredImportListener extends AnalysisEventListener<ToInfraredImportVo> implements ExcelListener<ToInfraredImportVo> {
+    private final IToInfraredService toInfraredService;
+
+    private final Boolean isUpdateSupport;
+    private int successNum = 0;
+    private int failureNum = 0;
+    private final StringBuilder successMsg = new StringBuilder();
+    private final StringBuilder failureMsg = new StringBuilder();
+
+    public ToInfraredImportListener(Boolean isUpdateSupport) {
+        this.toInfraredService = SpringUtils.getBean(IToInfraredService.class);
+        this.isUpdateSupport = isUpdateSupport;
+    }
+
+    @Override
+    public void invoke(ToInfraredImportVo toInfraredVo, AnalysisContext context) {
+        try {
+
+            ToInfraredBo toInfraredBo = BeanUtil.toBean(toInfraredVo, ToInfraredBo.class);
+
+            //TODO:根据某个字段,查询数据库表中是否存在记录,不存在就新增,存在就更新
+            ToInfraredVo toInfraredVo1 = null;
+
+            //toInfraredVo1 = toInfraredService.selectBySomefield(toInfraredVo.getSomefield());
+            if (ObjectUtil.isNull(toInfraredVo1)) {
+                //不存在就新增
+                toInfraredBo.setVersion(0);
+                ValidatorUtils.validate(toInfraredBo);
+                boolean inserted = toInfraredService.insert(toInfraredBo);
+
+                if (inserted) {
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、可见光转红外 记录导入成功");
+                    return;
+                } else {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、可见光转红外 记录导入失败");
+                    return;
+                }
+            } else if (isUpdateSupport) {
+                //存在就更新
+                toInfraredBo.setId(toInfraredVo1.getId());//主键
+                toInfraredBo.setVersion(toInfraredVo1.getVersion());
+                boolean updated = toInfraredService.update(toInfraredBo);
+                if (updated) {
+                    successNum++;
+                    successMsg.append("<br/>").append(successNum).append("、可见光转红外 记录更新成功");
+                    return;
+                } else {
+                    failureNum++;
+                    failureMsg.append("<br/>").append(failureNum).append("、可见光转红外 记录更新失败");
+                    return;
+                }
+            }
+        } catch (Exception e) {
+            failureNum++;
+            String msg = "<br/>" + failureNum + "、可见光转红外 记录导入失败:";
+            failureMsg.append(msg).append(e.getMessage());
+            log.error(msg, e);
+        }
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+
+    }
+
+    @Override
+    public ExcelResult<ToInfraredImportVo> getExcelResult() {
+        return new ExcelResult<>() {
+
+            @Override
+            public String getAnalysis() {
+                if (failureNum > 0) {
+                    failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据没有成功导入,错误如下:");
+                    throw new ServiceException(failureMsg.toString());
+                } else {
+                    successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+                }
+                return successMsg.toString();
+            }
+
+            @Override
+            public List<ToInfraredImportVo> getList() {
+                return null;
+            }
+
+            @Override
+            public List<String> getErrorList() {
+                return null;
+            }
+        };
+    }
+}

+ 15 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/mapper/ToInfraredMapper.java

@@ -0,0 +1,15 @@
+package com.taais.biz.mapper;
+import com.mybatisflex.core.BaseMapper;
+import com.taais.biz.domain.ToInfrared;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 可见光转红外Mapper接口
+ *
+ * @author 0
+ * 2024-09-20
+ */
+@Mapper
+public interface ToInfraredMapper extends BaseMapper<ToInfrared> {
+
+}

+ 67 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/service/IToInfraredService.java

@@ -0,0 +1,67 @@
+package com.taais.biz.service;
+
+
+import com.taais.biz.domain.ToInfrared;
+import com.taais.biz.domain.bo.ToInfraredBo;
+import com.taais.biz.domain.vo.ToInfraredVo;
+import com.taais.common.core.core.page.PageResult;
+import com.taais.common.orm.core.service.IBaseService;
+
+import java.util.List;
+
+/**
+ * 可见光转红外Service接口
+ *
+ * @author 0
+ * 2024-09-20
+ */
+public interface IToInfraredService extends IBaseService<ToInfrared> {
+    /**
+     * 查询可见光转红外
+     *
+     * @param id 可见光转红外主键
+     * @return 可见光转红外
+     */
+        ToInfraredVo selectById(Long id);
+
+    /**
+     * 查询可见光转红外列表
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 可见光转红外集合
+     */
+    List<ToInfraredVo> selectList(ToInfraredBo toInfraredBo);
+
+    /**
+     * 分页查询可见光转红外列表
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 分页可见光转红外集合
+     */
+    PageResult<ToInfraredVo> selectPage(ToInfraredBo toInfraredBo);
+
+    /**
+     * 新增可见光转红外
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    boolean insert(ToInfraredBo toInfraredBo);
+
+    /**
+     * 修改可见光转红外
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    boolean update(ToInfraredBo toInfraredBo);
+
+    /**
+     * 批量删除可见光转红外
+     *
+     * @param ids 需要删除的可见光转红外主键集合
+     * @return 结果:true 删除成功,false 删除失败
+     */
+    boolean deleteByIds(Long[] ids);
+
+}

+ 191 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/ToInfraredServiceImpl.java

@@ -0,0 +1,191 @@
+package com.taais.biz.service.impl;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+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 com.taais.biz.domain.ToInfrared;
+import com.taais.biz.domain.Video2image;
+import com.taais.biz.domain.bo.ToInfraredBo;
+import com.taais.biz.domain.vo.ToInfraredVo;
+import com.taais.biz.mapper.ToInfraredMapper;
+import com.taais.biz.service.IToInfraredService;
+import com.taais.common.core.config.TaaisConfig;
+import com.taais.common.core.constant.Constants;
+import com.taais.common.core.utils.MapstructUtils;
+import com.taais.common.core.utils.StringUtils;
+import com.taais.common.orm.core.page.PageQuery;
+import com.taais.common.core.core.page.PageResult;
+import com.taais.common.orm.core.service.impl.BaseServiceImpl;
+import com.taais.system.domain.vo.SysOssVo;
+import com.taais.system.service.ISysOssService;
+import jakarta.annotation.Resource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import static com.taais.biz.constant.BizConstant.VideoStatus.NOT_START;
+import static com.taais.biz.domain.table.ToInfraredTableDef.TO_INFRARED;
+import static com.taais.biz.service.impl.VideoStableServiceImpl.removeFileExtension;
+
+/**
+ * 可见光转红外Service业务层处理
+ *
+ * @author 0
+ * 2024-09-20
+ */
+@Service
+public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToInfrared> implements IToInfraredService {
+    @Autowired
+    private ISysOssService ossService;
+
+    @Resource
+    private ToInfraredMapper toInfraredMapper;
+
+    @Override
+    public QueryWrapper query() {
+        return super.query().from(TO_INFRARED);
+    }
+
+    private QueryWrapper buildQueryWrapper(ToInfraredBo toInfraredBo) {
+        QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
+        queryWrapper.and(TO_INFRARED.NAME.like
+            (toInfraredBo.getName()));
+        queryWrapper.and(TO_INFRARED.STATUS.eq
+            (toInfraredBo.getStatus()));
+        queryWrapper.and(TO_INFRARED.START_TIME.eq
+            (toInfraredBo.getStartTime()));
+        queryWrapper.and(TO_INFRARED.END_TIME.eq
+            (toInfraredBo.getEndTime()));
+        queryWrapper.and(TO_INFRARED.COST_SECOND.eq
+            (toInfraredBo.getCostSecond()));
+        queryWrapper.and(TO_INFRARED.LOG.eq
+            (toInfraredBo.getLog()));
+        queryWrapper.and(TO_INFRARED.REMARKS.eq
+            (toInfraredBo.getRemarks()));
+        queryWrapper.and(TO_INFRARED.URL.eq
+            (toInfraredBo.getUrl()));
+        queryWrapper.and(TO_INFRARED.INPUT_OSS_ID.eq
+            (toInfraredBo.getInputOssId()));
+        queryWrapper.and(TO_INFRARED.INPUT_PATH.eq
+            (toInfraredBo.getInputPath()));
+        queryWrapper.and(TO_INFRARED.OUTPUT_PATH.eq
+            (toInfraredBo.getOutputPath()));
+
+        return queryWrapper;
+    }
+
+    /**
+     * 查询可见光转红外
+     *
+     * @param id 可见光转红外主键
+     * @return 可见光转红外
+     */
+    @Override
+    public ToInfraredVo selectById(Long id) {
+        return this.getOneAs(query().where(TO_INFRARED.ID.eq(id)), ToInfraredVo.class);
+
+    }
+
+    /**
+     * 查询可见光转红外列表
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 可见光转红外集合
+     */
+    @Override
+    public List<ToInfraredVo> selectList(ToInfraredBo toInfraredBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(toInfraredBo);
+        return this.listAs(queryWrapper, ToInfraredVo.class);
+    }
+
+    /**
+     * 分页查询可见光转红外列表
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 分页可见光转红外集合
+     */
+    @Override
+    public PageResult<ToInfraredVo> selectPage(ToInfraredBo toInfraredBo) {
+        QueryWrapper queryWrapper = buildQueryWrapper(toInfraredBo);
+        Page<ToInfraredVo> page = this.pageAs(PageQuery.build(), queryWrapper, ToInfraredVo.class);
+        return PageResult.build(page);
+    }
+
+    /**
+     * 新增可见光转红外
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 结果:true 操作成功,false 操作失败
+     */
+    @Override
+    public boolean insert(ToInfraredBo toInfraredBo) {
+        // 检查input_oss_id是否存在
+        if (ObjectUtil.isNull(toInfraredBo.getInputOssId())) {
+            return false;
+        }
+
+        SysOssVo ossEntity = ossService.getById(toInfraredBo.getInputOssId());
+        if (ObjectUtil.isNull(ossEntity)) {
+            return false;
+        }
+
+        ToInfrared toInfrared = new ToInfrared();
+
+        toInfrared.setInputOssId(toInfraredBo.getInputOssId());
+        toInfrared.setUrl(ossEntity.getUrl());
+
+        String filePath = ossEntity.getFileName();
+        String localPath = TaaisConfig.getProfile();
+        String resourcePath = localPath + StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX);
+        toInfrared.setInputPath(resourcePath);
+
+        String fileName = StringUtils.substringAfterLast(filePath, "/");
+        String fileName_without_suffix = removeFileExtension(fileName);
+
+        Path path = Paths.get(resourcePath);
+        Path outPath = path.resolveSibling(fileName_without_suffix + "_images" + System.currentTimeMillis());
+        toInfrared.setOutputPath(outPath.toString());
+
+        toInfrared.setZipFilePath(path.resolveSibling(fileName_without_suffix + ".zip").toString());
+
+        toInfrared.setName(toInfraredBo.getName());
+        toInfrared.setStatus(NOT_START);
+        toInfrared.setRemarks(toInfraredBo.getRemarks());
+
+        return this.save(toInfrared);// 使用全局配置的雪花算法主键生成器生成ID值
+    }
+
+    /**
+     * 修改可见光转红外
+     *
+     * @param toInfraredBo 可见光转红外Bo
+     * @return 结果:true 更新成功,false 更新失败
+     */
+    @Override
+    public boolean update(ToInfraredBo toInfraredBo) {
+        ToInfrared toInfrared = MapstructUtils.convert(toInfraredBo, ToInfrared.class);
+        if (ObjectUtil.isNotNull(toInfrared) && ObjectUtil.isNotNull(toInfrared.getId())) {
+            boolean updated = this.updateById(toInfrared);
+            return updated;
+        }
+        return false;
+    }
+
+    /**
+     * 批量删除可见光转红外
+     *
+     * @param ids 需要删除的可见光转红外主键集合
+     * @return 结果:true 删除成功,false 删除失败
+     */
+    @Transactional
+    @Override
+    public boolean deleteByIds(Long[] ids) {
+        return this.removeByIds(Arrays.asList(ids));
+    }
+
+}

+ 7 - 0
taais-modules/taais-biz/src/main/resources/mapper/demo/ToInfraredMapper.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="com.taais.biz.mapper.ToInfraredMapper">
+
+</mapper>