zhou-hao 7 년 전
부모
커밋
1b38fd8714

+ 1 - 1
hsweb-examples/hsweb-examples-simple/src/main/java/org/hswebframework/web/example/simple/TestController.java

@@ -82,7 +82,7 @@ public class TestController implements QueryController<UserEntity, String, Query
 
     @PutMapping("/test/testPersonnel")
     public ResponseMessage<PersonnelAuthorization> testPersonnel() {
-        return ResponseMessage.ok(PersonnelAuthorization.current().get());
+        return ResponseMessage.ok(PersonnelAuthorization.current().orElseThrow(UnAuthorizedException::new));
     }
 
     @Override

+ 2 - 2
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-starter/src/main/java/org/hswebframework/web/oauth2/authorization/OAuth2UserTokenParser.java

@@ -49,7 +49,7 @@ public class OAuth2UserTokenParser implements UserTokenParser {
             throw new GrantTokenException(ErrorType.INVALID_TOKEN);
         }
         Long time = auth2AccessToken.getUpdateTime() != null ? auth2AccessToken.getUpdateTime() : auth2AccessToken.getCreateTime();
-        if (System.currentTimeMillis() - time > auth2AccessToken.getExpiresIn() * 1000) {
+        if (System.currentTimeMillis() - time > auth2AccessToken.getExpiresIn() * 1000L) {
             throw new GrantTokenException(ErrorType.EXPIRED_TOKEN);
         }
 
@@ -71,7 +71,7 @@ public class OAuth2UserTokenParser implements UserTokenParser {
 
             @Override
             public long getMaxInactiveInterval() {
-                return auth2AccessToken.getExpiresIn() * 1000;
+                return auth2AccessToken.getExpiresIn() * 1000L;
             }
         };
     }

+ 0 - 1
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-flowable/src/main/java/org/hswebframework/web/workflow/flowable/controller/FlowableModelManagerController.java

@@ -108,7 +108,6 @@ public class FlowableModelManagerController {
         modelObjectNode.put(MODEL_DESCRIPTION, model.getString(MODEL_DESCRIPTION));
         modelObjectNode.put(MODEL_KEY, model.getString(MODEL_KEY));
         modelObjectNode.put(MODEL_NAME, model.getString(MODEL_NAME));
-        modelObjectNode.put(MODEL_DESCRIPTION, model.getString(MODEL_DESCRIPTION));
 
         Model modelData = repositoryService.newModel();
         modelData.setMetaInfo(modelObjectNode.toJSONString());

+ 30 - 29
hsweb-thirdparty/hsweb-thirdparty-ueditor/src/main/java/com/baidu/ueditor/define/ActionMap.java

@@ -1,42 +1,43 @@
 package com.baidu.ueditor.define;
 
+import org.hswebframework.web.Maps;
+
 import java.util.HashMap;
 import java.util.Map;
 
 /**
  * 定义请求action类型
- * @author hancong03@baidu.com
  *
+ * @author hancong03@baidu.com
  */
 @SuppressWarnings("serial")
 public final class ActionMap {
 
-	public static final Map<String, Integer> mapping;
-	// 获取配置请求
-	public static final int CONFIG = 0;
-	public static final int UPLOAD_IMAGE = 1;
-	public static final int UPLOAD_SCRAWL = 2;
-	public static final int UPLOAD_VIDEO = 3;
-	public static final int UPLOAD_FILE = 4;
-	public static final int CATCH_IMAGE = 5;
-	public static final int LIST_FILE = 6;
-	public static final int LIST_IMAGE = 7;
-	
-	static {
-		mapping = new HashMap<String, Integer>(){{
-			put( "config", ActionMap.CONFIG );
-			put( "uploadimage", ActionMap.UPLOAD_IMAGE );
-			put( "uploadscrawl", ActionMap.UPLOAD_SCRAWL );
-			put( "uploadvideo", ActionMap.UPLOAD_VIDEO );
-			put( "uploadfile", ActionMap.UPLOAD_FILE );
-			put( "catchimage", ActionMap.CATCH_IMAGE );
-			put( "listfile", ActionMap.LIST_FILE );
-			put( "listimage", ActionMap.LIST_IMAGE );
-		}};
-	}
-	
-	public static int getType ( String key ) {
-		return ActionMap.mapping.get( key );
-	}
-	
+    public static final Map<String, Integer> mapping;
+    // 获取配置请求
+    public static final int CONFIG = 0;
+    public static final int UPLOAD_IMAGE = 1;
+    public static final int UPLOAD_SCRAWL = 2;
+    public static final int UPLOAD_VIDEO = 3;
+    public static final int UPLOAD_FILE = 4;
+    public static final int CATCH_IMAGE = 5;
+    public static final int LIST_FILE = 6;
+    public static final int LIST_IMAGE = 7;
+
+    static {
+        mapping = Maps.<String, Integer>buildMap().
+                put("config", ActionMap.CONFIG).
+                put("uploadimage", ActionMap.UPLOAD_IMAGE).
+                put("uploadscrawl", ActionMap.UPLOAD_SCRAWL).
+                put("uploadvideo", ActionMap.UPLOAD_VIDEO).
+                put("uploadfile", ActionMap.UPLOAD_FILE).
+                put("catchimage", ActionMap.CATCH_IMAGE).
+                put("listfile", ActionMap.LIST_FILE).
+                put("listimage", ActionMap.LIST_IMAGE).get();
+    }
+
+    public static int getType(String key) {
+        return ActionMap.mapping.get(key);
+    }
+
 }

+ 8 - 11
hsweb-thirdparty/hsweb-thirdparty-ueditor/src/main/java/com/baidu/ueditor/upload/StorageManager.java

@@ -24,9 +24,8 @@ public class StorageManager {
             return state;
         }
 
-        try {
-            BufferedOutputStream bos = new BufferedOutputStream(
-                    new FileOutputStream(file));
+        try (BufferedOutputStream bos = new BufferedOutputStream(
+                new FileOutputStream(file))) {
             bos.write(data);
             bos.flush();
             bos.close();
@@ -46,11 +45,10 @@ public class StorageManager {
         File tmpFile = getTmpFile();
 
         byte[] dataBuf = new byte[2048];
-        BufferedInputStream bis = new BufferedInputStream(is, StorageManager.BUFFER_SIZE);
 
-        try {
-            BufferedOutputStream bos = new BufferedOutputStream(
-                    new FileOutputStream(tmpFile), StorageManager.BUFFER_SIZE);
+        try (BufferedInputStream bis = new BufferedInputStream(is, StorageManager.BUFFER_SIZE);
+             BufferedOutputStream bos = new BufferedOutputStream(
+                     new FileOutputStream(tmpFile), StorageManager.BUFFER_SIZE)) {
 
             int count = 0;
             while ((count = bis.read(dataBuf)) != -1) {
@@ -83,11 +81,10 @@ public class StorageManager {
         File tmpFile = getTmpFile();
 
         byte[] dataBuf = new byte[2048];
-        BufferedInputStream bis = new BufferedInputStream(is, StorageManager.BUFFER_SIZE);
 
-        try {
-            BufferedOutputStream bos = new BufferedOutputStream(
-                    new FileOutputStream(tmpFile), StorageManager.BUFFER_SIZE);
+        try (BufferedInputStream bis = new BufferedInputStream(is, StorageManager.BUFFER_SIZE);
+             BufferedOutputStream bos = new BufferedOutputStream(
+                     new FileOutputStream(tmpFile), StorageManager.BUFFER_SIZE)) {
 
             int count = 0;
             while ((count = bis.read(dataBuf)) != -1) {