|  |  |  | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponseUtils; | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.VoStClientAmountDay; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.VoStClientAmountMonth; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voSt.VoStClientAmountYear; | 
|---|
|  |  |  | import lombok.RequiredArgsConstructor; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(path="stClient") | 
|---|
|  |  |  | @RequiredArgsConstructor | 
|---|
|  |  |  | public class StClientCtrl { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final int startYear4YearStatistics = 2024 ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private StClientSv sv ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | qo.month = ymd[1] ; | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountDay(qo)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询指定年农户各月用水量 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/amountOfMonth") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoStClientAmountMonth>>> amountOfMonth(StClientQo qo) throws Exception { | 
|---|
|  |  |  | if(qo.year == null) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("查询条件年度不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountMonth(qo)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询指定年农户各年用水量 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/amountOfYear") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoStClientAmountYear>>> amountOfYear(StClientQo qo) throws Exception { | 
|---|
|  |  |  | List<Integer> yearGrp = new ArrayList<Integer>(); | 
|---|
|  |  |  | int nowYear = Integer.parseInt(DateTime.yyyy()) ; | 
|---|
|  |  |  | if(qo.year == null) { | 
|---|
|  |  |  | int startYear = nowYear - 4 ;//查5年的 | 
|---|
|  |  |  | if(startYear < startYear4YearStatistics){ | 
|---|
|  |  |  | startYear = startYear4YearStatistics ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(int i = startYear; i <= nowYear; i++) { | 
|---|
|  |  |  | yearGrp.add(i) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | if(qo.year > nowYear){ | 
|---|
|  |  |  | qo.year = nowYear; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(qo.year < startYear4YearStatistics){ | 
|---|
|  |  |  | qo.year = startYear4YearStatistics; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | yearGrp.add(qo.year) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(this.sv.selectStClientAmountYear(qo, yearGrp)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|