liurunyu
2024-12-12 db8bd443faa40789e3b82a75ccebeb744d55a5ae
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
package com.dy.pipIrrStatistics.loss;
 
import com.dy.common.aop.SsoAop;
import com.dy.common.util.DateTime;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.voSt.VoDayLoss;
import com.dy.pipIrrStatistics.intake.IntakeSv;
import com.dy.pipIrrStatistics.intake.qo.IntakeAmountQO;
import com.dy.pipIrrStatistics.result.StatisticlResultCode;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
 
/**
 * @Author: liurunyu
 * @Date: 2024/12/12 8:33
 * @Description 有关漏损的统计
 */
@Slf4j
@RestController
@RequestMapping(path="loss")
@RequiredArgsConstructor
public class LossCtrl {
 
    private LossSv sv;
 
    @Autowired
    public void setSv(LossSv sv){
        this.sv = sv ;
    }
 
    /**
     * 查询指定月份各日漏损量
     * @param qo
     * @return
     */
    @GetMapping(path = "/lossAmountOfDay")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoDayLoss>>> lossAmountOfDay(LossQo qo) throws Exception {
        String yearMonth = qo.getYearMonth();
        if(yearMonth == null || yearMonth.trim().equals("")) {
            return BaseResponseUtils.buildErrorMsg("查询条件年月不能为空");
        }
        qo.startDt = DateTime.dateFrom_yyyy_MM_dd(yearMonth + "-01");
        qo.endDt = DateTime.dateFrom_yyyy_MM_dd(yearMonth + "-31");
 
        int[] ymd = DateTime.yyyy_MM_ymdGroup(yearMonth) ;
        qo.year = ymd[0] ;
        qo.month = ymd[1] ;
 
        return BaseResponseUtils.buildSuccess(this.sv.lossAmountOfDay(qo));
    }
 
}