zhaowenyu
2026-03-07 d7fef91a4cbb702988dc820bcde82c166253ceec
ard-inspection/src/main/java/com/ard/inspection/service/impl/ArdPointCloudServiceImpl.java
New file
@@ -0,0 +1,116 @@
package com.ard.inspection.service.impl;
import java.util.List;
import com.ard.common.utils.DateUtils;
import com.ard.common.utils.uuid.IdUtils;
import com.ard.inspection.utils.ZipFileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ard.inspection.mapper.ArdPointCloudMapper;
import com.ard.inspection.domain.ArdPointCloud;
import com.ard.inspection.service.IArdPointCloudService;
import javax.annotation.Resource;
/**
 * 点云文件Service业务层处理
 *
 * @author xia
 * @date 2026-03-03
 */
@Service
public class ArdPointCloudServiceImpl implements IArdPointCloudService {
    @Autowired
    private ArdPointCloudMapper ardPointCloudMapper;
    @Resource
    private ZipFileUtils zipFileUtils;
    /**
     * 查询点云文件
     *
     * @param id 点云文件主键
     * @return 点云文件
     */
    @Override
    public ArdPointCloud selectArdPointCloudById(String id) {
        return ardPointCloudMapper.selectArdPointCloudById(id);
    }
    /**
     * 查询点云文件列表
     *
     * @param ardPointCloud 点云文件
     * @return 点云文件
     */
    @Override
    public List<ArdPointCloud> selectArdPointCloudList(ArdPointCloud ardPointCloud) {
        return ardPointCloudMapper.selectArdPointCloudList(ardPointCloud);
    }
    /**
     * 新增点云文件
     *
     * @param ardPointCloud 点云文件
     * @return 结果
     */
    @Override
    public int insertArdPointCloud(ArdPointCloud ardPointCloud) {
        ardPointCloud.setId(IdUtils.simpleUUID());
        ardPointCloud.setCreateTime(DateUtils.getNowDate());
        ardPointCloud.setAssociatedState("0");
        return ardPointCloudMapper.insertArdPointCloud(ardPointCloud);
    }
    /**
     * 修改点云文件
     *
     * @param ardPointCloud 点云文件
     * @return 结果
     */
    @Override
    public int updateArdPointCloud(ArdPointCloud ardPointCloud) {
        ardPointCloud.setUpdateTime(DateUtils.getNowDate());
        return ardPointCloudMapper.updateArdPointCloud(ardPointCloud);
    }
    /**
     * 批量删除点云文件
     *
     * @param ids 需要删除的点云文件主键
     * @return 结果
     */
    @Override
    public int deleteArdPointCloudByIds(String[] ids) {
        // 删除点云文件
        String folderPath = "/home/inspection/uploadPath/zip/";
        int count = 0;
        for (String id : ids) {
            ArdPointCloud ardPointCloud = ardPointCloudMapper.selectArdPointCloudById(id);
            if (zipFileUtils.deleteZipFile(folderPath + ardPointCloud.getFolderName())){
                ardPointCloudMapper.deleteArdPointCloudById(id);
                count++;
            }
        }
        return count;
    }
    /**
     * 删除点云文件信息
     *
     * @param id 点云文件主键
     * @return 结果
     */
    @Override
    public int deleteArdPointCloudById(String id) {
        return ardPointCloudMapper.deleteArdPointCloudById(id);
    }
    @Override
    public ArdPointCloud selectArdPointCloudByFileName(String filename) {
        return ardPointCloudMapper.selectArdPointCloudByFileName(filename);
    }
}