| | |
| | | package org.dromara.demo.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.core.validate.EditGroup; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.excel.core.ExcelResult; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.demo.domain.vo.RsSceneryOperationDataVo; |
| | | import org.dromara.demo.domain.bo.RsSceneryOperationDataBo; |
| | | import org.dromara.demo.service.IRsSceneryOperationDataService; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.demo.domain.RsSceneryOperationData; |
| | | import org.dromara.demo.domain.bo.RsSceneryOperationDataBo; |
| | | import org.dromara.demo.domain.vo.RsSceneryOperationDataVo; |
| | | import org.dromara.demo.service.IRsSceneryOperationDataService; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 景区运行数据 |
| | |
| | | public class RsSceneryOperationDataController extends BaseController { |
| | | |
| | | private final IRsSceneryOperationDataService rsSceneryOperationDataService; |
| | | private final StringBuilder successMsg = new StringBuilder(); |
| | | private final StringBuilder failureMsg = new StringBuilder(); |
| | | |
| | | /** |
| | | * 查询景区运行数据列表 |
| | |
| | | ExcelUtil.exportExcel(list, "景区运行数据", RsSceneryOperationDataVo.class, response); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导入数据 |
| | | * |
| | | * @param file 导入文件 |
| | | */ |
| | | @Log(title = "导入数据", businessType = BusinessType.IMPORT) |
| | | @SaCheckPermission("demo:sceneryOperationData:import") |
| | | @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public R<Void> importData(@RequestPart("file") MultipartFile file) throws Exception { |
| | | ExcelResult<RsSceneryOperationDataVo> result = ExcelUtil.importExcel(file.getInputStream(), RsSceneryOperationDataVo.class, true); |
| | | List<RsSceneryOperationData> list = MapstructUtils.convert(result.getList(), RsSceneryOperationData.class); |
| | | return R.ok(rsSceneryOperationDataService.importExcel(list)); |
| | | } |
| | | |
| | | /** |
| | | * 获取导入模板 |
| | | */ |
| | | @SaCheckPermission("demo:sceneryOperationData:importTemplate") |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil.exportExcel(new ArrayList<>(), "景区运行数据", RsSceneryOperationDataVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * 获取景区运行数据详细信息 |
| | | * |