zhaowenyu
2026-03-07 d7fef91a4cbb702988dc820bcde82c166253ceec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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);
    }
 
}