diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java index 524d0182..a092fd80 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java @@ -6,12 +6,16 @@ import ${basePackage}.frame.utils.MapperUtil; import ${basePackage}.module.system.mgr.DictManager; import ${basePackage}.module.system.req.*; import ${basePackage}.module.system.rsp.*; +import ${basePackage}.frame.base.BaseResponse; +import ${basePackage}.frame.base.ErrorType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import java.io.IOException; + public class DictAjax { @Autowired @@ -47,12 +51,18 @@ public class DictAjax { return dictManager.load(request, LocalData.getToken()); } - public ResponseEntity template(String jsonParam) throws IOException { - WSheet sheet = new WSheet<>(DictCreateRequest.class); - byte[] bytes = sheet.getBytes(); - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); - headers.setContentDispositionFormData("attachment", new String((sheet.getName() + ".xlsx").getBytes("UTF-8"), "iso-8859-1")); - return new ResponseEntity(bytes, headers, HttpStatus.OK); + public Object template(String jsonParam){ + try { + WSheet sheet = new WSheet<>(DictCreateRequest.class); + byte[] bytes = sheet.getBytes(); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); + headers.setContentDispositionFormData("attachment", new String((sheet.getName() + ".xlsx").getBytes("UTF-8"), "iso-8859-1")); + return new ResponseEntity<>(bytes, headers, HttpStatus.OK); + } catch (IOException e) { + BaseResponse baseResponse = new BaseResponse(); + baseResponse.addError(ErrorType.BUSINESS_ERROR, ""); + return baseResponse; + } } } diff --git a/src/main/resources/modules/SpringBoot/resources/application-dev.ftl b/src/main/resources/modules/SpringBoot/resources/application-dev.ftl index 650ede13..1a075204 100644 --- a/src/main/resources/modules/SpringBoot/resources/application-dev.ftl +++ b/src/main/resources/modules/SpringBoot/resources/application-dev.ftl @@ -27,7 +27,7 @@ spring.datasource.password=123456 <#if dataBase == 'MYSQL'> # mysql spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false +spring.datasource.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.username=test spring.datasource.password=123456 diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl index 147e38ca..8f20231d 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl @@ -1,14 +1,13 @@
-
+
@@ -36,7 +35,7 @@