package com.dy.pipIrrStatistics.intaker;
|
|
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.VoDayIntakeAmount;
|
import com.dy.pipIrrGlobal.voSt.VoMonthAmount;
|
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.util.List;
|
|
/**
|
* @Author: liurunyu
|
* @Date: 2024/12/12 16:24
|
* @Description 有关取水口用水统计
|
*/
|
@Slf4j
|
@RestController
|
@RequestMapping(path="intake")
|
@RequiredArgsConstructor
|
public class IntakerCtrl {
|
|
private IntakerSv sv;
|
|
@Autowired
|
public void setSv(IntakerSv sv){
|
this.sv = sv ;
|
}
|
|
/**
|
* 查询指定月份各日用水量
|
* @param qo
|
* @return
|
*/
|
@GetMapping(path = "/amountOfDay")
|
@SsoAop()
|
public BaseResponse<QueryResultVo<List<VoDayIntakeAmount>>> amountOfDay(IntakerQo 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.amountOfDay(qo));
|
}
|
|
/**
|
* 查询指定月份各日用水量
|
* @param qo
|
* @return
|
*/
|
@GetMapping(path = "/amountOfMonth")
|
@SsoAop()
|
public BaseResponse<QueryResultVo<List<VoMonthAmount>>> amountOfMonth(IntakerQo qo) throws Exception {
|
if(qo.getYear() == null) {
|
return BaseResponseUtils.buildErrorMsg("查询条件年度不能为空");
|
}
|
return BaseResponseUtils.buildSuccess(this.sv.amountOfMonth(qo));
|
}
|
}
|