liurunyu
2025-02-07 6fa8408c8133e8c9aee2bbcdec37bf95c20951c0
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
package com.dy.pipIrrStatistics.special;
 
import com.dy.common.mw.protocol.p206V1.CommonV1;
import com.dy.common.util.DateTime;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoSpecial.SpecialMapper;
import com.dy.pipIrrGlobal.voSpecial.VoSteal;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Map;
import java.util.Optional;
 
/**
 * @Author: liurunyu
 * @Date: 2025/2/7 13:52
 * @Description 专题统计服务
 */
@Slf4j
@Service
public class SpecialSv {
    private SpecialMapper dao ;
 
    @Autowired
    private void setDao(SpecialMapper dao){
        this.dao = dao;
    }
 
    /**
     * 涉嫌偷水统计
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoSteal>> steal(QoSteal qo) throws Exception {
        if(qo.fromDt != null && qo.fromDt != "") {
            qo.fromDate = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(qo.fromDt + " 00:00:00") ;
        }
        if(qo.duration == null || qo.duration < 0){
            qo.duration = 0 ;
        }
 
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
 
        Long itemTotal = Optional.ofNullable(this.dao.selectStealTotal(params)).orElse(0L);
 
        QueryResultVo<List<VoSteal>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
 
        List<VoSteal> list = this.dao.selectStealSome(params) ;
        if (list != null && list.size() > 0) {
            for (VoSteal vo : list) {
                vo.openType = CommonV1.openCloseValveType(vo.opType) ;
                vo.closeType = CommonV1.openCloseValveType(vo.clType) ;
            }
        }
        rsVo.obj = list;
        return rsVo ;
    }
 
}