|
|
@@ -21,17 +21,14 @@ import com.xjrsoft.module.magicapi.vo.MagicApiInfoVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import org.ssssssss.magicapi.core.service.MagicAPIService;
|
|
|
import org.ssssssss.magicapi.modules.db.model.PageResult;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -59,6 +56,9 @@ public class LedgerExportController {
|
|
|
@PostMapping("/export-query")
|
|
|
@ApiOperation(value = "导出")
|
|
|
public ResponseEntity<byte[]> exportData(@Valid @RequestBody LedgerExportDataDto dto) {
|
|
|
+// @GetMapping("/export-query")
|
|
|
+// @ApiOperation(value = "导出")
|
|
|
+// public ResponseEntity<byte[]> exportData(@Valid LedgerExportDataDto dto) {
|
|
|
LedgerConfigRelease release = ledgerConfigReleaseService.getById(dto.getConfigIntoId());
|
|
|
if (release == null) {
|
|
|
throw new MyException("导出数据失败");
|
|
|
@@ -84,7 +84,14 @@ public class LedgerExportController {
|
|
|
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
|
EasyExcel.write(bot).head(headlist).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
|
|
|
|
|
|
- return RT.fileStream(bot.toByteArray(), ledgerConfig.getName() + ExcelTypeEnum.XLSX.getValue());
|
|
|
+ String encodedFileName = "";
|
|
|
+ try{
|
|
|
+ encodedFileName = URLEncoder.encode(ledgerConfig.getName() , "UTF-8");
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return RT.fileStream(bot.toByteArray(), encodedFileName + ExcelTypeEnum.XLSX.getValue());
|
|
|
}
|
|
|
|
|
|
/**
|