/**
* 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.mountainrain.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jodd.io.PathUtil;
import liquibase.pro.packaged.S;
import lombok.AllArgsConstructor;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.python.antlr.ast.Str;
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.tool.api.R;
import org.springblade.modules.mountainrain.entity.Yucbig;
import org.springblade.modules.mountainrain.service.IBigriverService;
import org.springblade.modules.mountainrain.vo.BigriverVO;
import org.springblade.modules.mountainrain.wrapper.BigriverWrapper;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.awt.image.BufferedImage;
import java.io.*;
import java.math.BigDecimal;
import java.security.MessageDigest;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 控制器
*
* @author Blade
* @since 2019-11-07
*/
@RestController
@AllArgsConstructor
@RequestMapping("/bigriver")
@Api(value = "", tags = "接口")
public class BigriverController extends BladeController {
private IBigriverService iBigriverService;
/**
* 详情
*/
@ApiLog("详情")
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "site")
public R detail(Yucbig yucbig) {
Yucbig detail = iBigriverService.getOne(Condition.getQueryWrapper(yucbig));
return R.data(BigriverWrapper.build().entityVO(detail));
}
/**
* 新增
*/
@ApiLog("新增")
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入site")
public R save(@Valid @RequestBody Yucbig yucbig) {
return R.status(iBigriverService.save(yucbig));
}
/**
* 修改
*/
@ApiLog("修改")
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入site")
public R update(@Valid @RequestBody Yucbig yucbig) {
return R.status(iBigriverService.updateById(yucbig));
}
// /**
// * 大江大河预报数据导入
// */
// @PostMapping("import-bgr")
// public R importbgr(MultipartFile file) {
// BgrImporter bgrImporter = new BgrImporter(iBigriverService, false);
// ExcelUtil.save(file, bgrImporter, BgrExcel.class);
// return R.success("导入成功");
// }
/**
* 大江大河预警
*
* @return
*/
@GetMapping("/selectbgriver")
public R selectbgriver() {
List