道路线索应急巡查系统服务后台
feiyu02
2025-09-30 84569abda51ecf6c5549dec4cadee8d043422379
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
package com.flightfeather.grid.service.impl
 
import com.flightfeather.grid.config.exception.BizException
import com.flightfeather.grid.constant.ConstantHttp
import com.flightfeather.grid.domain.ds1.entity.ClueInternal
import com.flightfeather.grid.domain.ds1.entity.ClueTask
import com.flightfeather.grid.domain.ds1.mapper.ClueInternalMapper
import com.flightfeather.grid.service.ClueInternalService
import com.flightfeather.grid.service.ClueTaskService
import com.flightfeather.grid.vo.DataHead
import com.github.pagehelper.PageHelper
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
 
/**
 *
 * @date 2025/4/24
 * @author feiyu02
 */
@Service
class ClueInternalServiceImpl(
    private val clueInternalMapper: ClueInternalMapper,
    private val clueTaskService: ClueTaskService,
) : ClueInternalService {
 
    override fun getClueInternal(
        sTime: String?,
        eTime: String?,
        pageNum: Int?,
        pageSize: Int?,
    ): Pair<DataHead, List<ClueInternal?>> {
        val p = PageHelper.startPage<ClueInternal>(pageNum ?: ConstantHttp.DEFAULT_PAGE_NUM,
            pageSize ?: ConstantHttp.DEFAULT_PAGE_SIZE)
        val res = clueInternalMapper.getClue(sTime, eTime)
        return DataHead(p.pageNum, p.pages, p.total) to res
    }
 
    override fun searchClueInternal(clueInternal: ClueInternal): List<ClueInternal?> {
        return clueInternalMapper.select(clueInternal)
    }
 
    override fun createClueInternal(clueInternal: ClueInternal): Int {
        return clueInternalMapper.insert(clueInternal)
    }
 
    override fun updateClueInternal(clueInternal: ClueInternal): Int {
        return clueInternalMapper.updateByPrimaryKey(clueInternal)
    }
 
    @Transactional
    override fun deleteClueInternal(clueInternal: ClueInternal): Int {
        clueInternal.cId ?: throw BizException("删除内部线索失败,缺少线索主键cId")
 
        clueTaskService.deleteClueTask(ClueTask().apply {
            clueId = clueInternal.cId
            internalTask = true
        })
        return clueInternalMapper.delete(clueInternal)
    }
}