/**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springblade.modules.rsvr.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.modules.city.service.CityService;
import org.springblade.modules.rsvr.entity.RsvrR;
import org.springblade.modules.rsvr.service.IRsvrRService;
import org.springblade.modules.rsvr.vo.RsvrRVO;
import org.springblade.modules.rsvr.wrapper.RsvrRWrapper;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 控制器
*
* @author Blade
* @since 2019-11-11
*/
@RestController
@AllArgsConstructor
@RequestMapping("/rsvrr")
@Api(value = "", tags = "接口")
public class RsvrRController extends BladeController {
private IRsvrRService rsvrRService;
private CityService cityService;
/**
* 详情
*/
@ApiLog("详情")
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入rsvrR")
public R detail(RsvrR rsvrR) {
RsvrR detail = rsvrRService.getOne(Condition.getQueryWrapper(rsvrR));
return R.data(RsvrRWrapper.build().entityVO(detail));
}
/**
* 分页
*/
@ApiLog("分页")
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入rsvrR")
public R> list(RsvrR rsvrR, Query query) {
IPage pages = rsvrRService.page(Condition.getPage(query), Condition.getQueryWrapper(rsvrR));
return R.data(RsvrRWrapper.build().pageVO(pages));
}
/**
* 新增
*/
@ApiLog("新增")
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入rsvrR")
public R save(@Valid @RequestBody RsvrR rsvrR) {
return R.status(rsvrRService.save(rsvrR));
}
/**
* 修改
*/
@ApiLog("修改")
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入rsvrR")
public R update(@Valid @RequestBody RsvrR rsvrR) {
return R.status(rsvrRService.updateById(rsvrR));
}
/**
* 新增或修改
*/
@ApiLog(" 新增或修改")
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入rsvrR")
public R submit(@Valid @RequestBody RsvrR rsvrR) {
return R.status(rsvrRService.saveOrUpdate(rsvrR));
}
/**
* 水库水情自定义信息
*/
@PostMapping("/selectsk")
public R selectyjck(String beginTime, String endTime) throws ParseException {
String substring = beginTime.substring(0, 10);
String r = beginTime.substring(11, 13);
//截取月日
String[] strs = substring.split("-");
//月
String year = strs[1].toString();
//日
String day = strs[2].toString();
String substrings = endTime.substring(0, 10);
String rs = endTime.substring(11, 13);
//截取月日
String[] strss = substrings.split("-");
//月
String years = strss[1].toString();
//日
String days = strss[2].toString();
//定义短信内容头
String text = year + "月" + day + "日" + r + "时-" + years + "月" + days + "日" + rs + "时:";
String texta = "";
String texth = "";
//定义统计数量
int number = 0;
String mouz = year + day;
Integer mou = Integer.parseInt(mouz);
String egmd = "";
String edmd = "";
List