Преглед изворни кода

Merge branch 'leng_dev' of https://gitee.ltd/pigx/pigx into sakura_dev

萌萌哒SAKURA酱 пре 6 година
родитељ
комит
08ca2833b1

+ 7 - 6
pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/JacksonConfig.java

@@ -1,5 +1,6 @@
 package com.pig4cloud.pigx.common.core.config;
 
+import cn.hutool.core.date.DatePattern;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
@@ -41,12 +42,12 @@ public class JacksonConfig {
 	public ObjectMapper getObjectMapper() {
 		ObjectMapper objectMapper = new ObjectMapper();
 		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
+		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
+		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
+		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
+		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
+		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
 		// javaTimeModule只能手动注册,参考https://github.com/FasterXML/jackson-modules-java8
 		objectMapper.registerModule(javaTimeModule);
 		// 忽略json字符串中不识别的属性

+ 6 - 4
pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/util/ClassUtils.java

@@ -19,6 +19,7 @@
 
 package com.pig4cloud.pigx.common.core.util;
 
+import lombok.experimental.UtilityClass;
 import org.springframework.core.BridgeMethodResolver;
 import org.springframework.core.DefaultParameterNameDiscoverer;
 import org.springframework.core.MethodParameter;
@@ -36,6 +37,7 @@ import java.lang.reflect.Method;
  *
  * @author L.cm
  */
+@UtilityClass
 public class ClassUtils extends org.springframework.util.ClassUtils {
 	private static final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
 
@@ -46,7 +48,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
 	 * @param parameterIndex 参数序号
 	 * @return {MethodParameter}
 	 */
-	public static MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
+	public MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
 		MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
 		methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
 		return methodParameter;
@@ -59,7 +61,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
 	 * @param parameterIndex 参数序号
 	 * @return {MethodParameter}
 	 */
-	public static MethodParameter getMethodParameter(Method method, int parameterIndex) {
+	public MethodParameter getMethodParameter(Method method, int parameterIndex) {
 		MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
 		methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
 		return methodParameter;
@@ -73,7 +75,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
 	 * @param <A>            泛型标记
 	 * @return {Annotation}
 	 */
-	public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
+	public <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
 		Class<?> targetClass = method.getDeclaringClass();
 		// The method may be on an interface, but we need attributes from the target class.
 		// If the target class is null, the method will be unchanged.
@@ -98,7 +100,7 @@ public class ClassUtils extends org.springframework.util.ClassUtils {
 	 * @param <A>            泛型标记
 	 * @return {Annotation}
 	 */
-	public static <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
+	public <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
 		// 先找方法,再找方法上的类
 		A annotation = handlerMethod.getMethodAnnotation(annotationType);
 		if (null != annotation) {

+ 15 - 13
pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/util/WebUtils.java

@@ -23,6 +23,7 @@ import cn.hutool.core.codec.Base64;
 import cn.hutool.core.util.CharsetUtil;
 import cn.hutool.json.JSONUtil;
 import com.pig4cloud.pigx.common.core.exception.CheckedException;
+import lombok.experimental.UtilityClass;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.http.HttpHeaders;
@@ -47,6 +48,7 @@ import java.io.PrintWriter;
  * @author L.cm
  */
 @Slf4j
+@UtilityClass
 public class WebUtils extends org.springframework.web.util.WebUtils {
 	private static final String BASIC_ = "Basic ";
 	public static final String UNKNOWN = "unknown";
@@ -58,7 +60,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param handlerMethod HandlerMethod
 	 * @return 是否ajax请求
 	 */
-	public static boolean isBody(HandlerMethod handlerMethod) {
+	public boolean isBody(HandlerMethod handlerMethod) {
 		ResponseBody responseBody = ClassUtils.getAnnotation(handlerMethod, ResponseBody.class);
 		return responseBody != null;
 	}
@@ -69,7 +71,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param name cookie name
 	 * @return cookie value
 	 */
-	public static String getCookieVal(String name) {
+	public String getCookieVal(String name) {
 		HttpServletRequest request = WebUtils.getRequest();
 		Assert.notNull(request, "request from RequestContextHolder is null");
 		return getCookieVal(request, name);
@@ -82,7 +84,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param name    cookie name
 	 * @return cookie value
 	 */
-	public static String getCookieVal(HttpServletRequest request, String name) {
+	public String getCookieVal(HttpServletRequest request, String name) {
 		Cookie cookie = getCookie(request, name);
 		return cookie != null ? cookie.getValue() : null;
 	}
@@ -93,7 +95,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param response HttpServletResponse
 	 * @param key      cookie key
 	 */
-	public static void removeCookie(HttpServletResponse response, String key) {
+	public void removeCookie(HttpServletResponse response, String key) {
 		setCookie(response, key, null, 0);
 	}
 
@@ -105,7 +107,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param value           cookie value
 	 * @param maxAgeInSeconds maxage
 	 */
-	public static void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
+	public void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
 		Cookie cookie = new Cookie(name, value);
 		cookie.setPath("/");
 		cookie.setMaxAge(maxAgeInSeconds);
@@ -118,7 +120,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 *
 	 * @return {HttpServletRequest}
 	 */
-	public static HttpServletRequest getRequest() {
+	public HttpServletRequest getRequest() {
 		return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
 	}
 
@@ -127,7 +129,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 *
 	 * @return {HttpServletResponse}
 	 */
-	public static HttpServletResponse getResponse() {
+	public HttpServletResponse getResponse() {
 		return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
 	}
 
@@ -137,7 +139,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param response HttpServletResponse
 	 * @param result   结果对象
 	 */
-	public static void renderJson(HttpServletResponse response, Object result) {
+	public void renderJson(HttpServletResponse response, Object result) {
 		renderJson(response, result, MediaType.APPLICATION_JSON_UTF8_VALUE);
 	}
 
@@ -148,7 +150,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param result      结果对象
 	 * @param contentType contentType
 	 */
-	public static void renderJson(HttpServletResponse response, Object result, String contentType) {
+	public void renderJson(HttpServletResponse response, Object result, String contentType) {
 		response.setCharacterEncoding("UTF-8");
 		response.setContentType(contentType);
 		try (PrintWriter out = response.getWriter()) {
@@ -163,7 +165,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 *
 	 * @return {String}
 	 */
-	public static String getIP() {
+	public String getIP() {
 		return getIP(WebUtils.getRequest());
 	}
 
@@ -173,7 +175,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 * @param request HttpServletRequest
 	 * @return {String}
 	 */
-	public static String getIP(HttpServletRequest request) {
+	public String getIP(HttpServletRequest request) {
 		Assert.notNull(request, "HttpServletRequest is null");
 		String ip = request.getHeader("X-Requested-For");
 		if (StringUtils.isBlank(ip) || UNKNOWN.equalsIgnoreCase(ip)) {
@@ -202,7 +204,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 	 *
 	 * @return
 	 */
-	public static String[] getClientId(ServerHttpRequest request) throws Exception {
+	public String[] getClientId(ServerHttpRequest request) throws Exception {
 		String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
 
 		if (header == null || !header.startsWith(BASIC_)) {
@@ -214,7 +216,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
 			decoded = Base64.decode(base64Token);
 		} catch (IllegalArgumentException e) {
 			throw new CheckedException(
-				"Failed to decode basic authentication token");
+					"Failed to decode basic authentication token");
 		}
 
 		String token = new String(decoded, CharsetUtil.UTF_8);

+ 6 - 4
pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/util/SysLogUtils.java

@@ -23,6 +23,7 @@ import cn.hutool.core.util.URLUtil;
 import cn.hutool.http.HttpUtil;
 import com.pig4cloud.pigx.admin.api.entity.SysLog;
 import com.pig4cloud.pigx.common.core.constant.CommonConstant;
+import lombok.experimental.UtilityClass;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.oauth2.provider.OAuth2Authentication;
@@ -37,10 +38,11 @@ import java.util.Objects;
  *
  * @author L.cm
  */
+@UtilityClass
 public class SysLogUtils {
-	public static SysLog getSysLog() {
+	public SysLog getSysLog() {
 		HttpServletRequest request = ((ServletRequestAttributes) Objects
-			.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
+				.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
 		SysLog sysLog = new SysLog();
 		sysLog.setCreateBy(Objects.requireNonNull(getUsername()));
 		sysLog.setType(CommonConstant.STATUS_NORMAL);
@@ -58,7 +60,7 @@ public class SysLogUtils {
 	 *
 	 * @return clientId
 	 */
-	private static String getClientId() {
+	private String getClientId() {
 		Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
 		if (authentication instanceof OAuth2Authentication) {
 			OAuth2Authentication auth2Authentication = (OAuth2Authentication) authentication;
@@ -72,7 +74,7 @@ public class SysLogUtils {
 	 *
 	 * @return username
 	 */
-	private static String getUsername() {
+	private String getUsername() {
 		Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
 		if (authentication == null) {
 			return null;

+ 7 - 5
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/util/AuthUtils.java

@@ -19,6 +19,7 @@ package com.pig4cloud.pigx.common.security.util;
 
 import cn.hutool.core.codec.Base64;
 import cn.hutool.core.util.CharsetUtil;
+import lombok.experimental.UtilityClass;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.HttpHeaders;
 
@@ -31,6 +32,7 @@ import java.io.IOException;
  * 认证授权相关工具类
  */
 @Slf4j
+@UtilityClass
 public class AuthUtils {
 	private static final String BASIC_ = "Basic ";
 
@@ -41,8 +43,8 @@ public class AuthUtils {
 	 * @throws RuntimeException if the Basic header is not present or is not valid
 	 *                          Base64
 	 */
-	public static String[] extractAndDecodeHeader(String header)
-		throws IOException {
+	public String[] extractAndDecodeHeader(String header)
+			throws IOException {
 
 		byte[] base64Token = header.substring(6).getBytes("UTF-8");
 		byte[] decoded;
@@ -50,7 +52,7 @@ public class AuthUtils {
 			decoded = Base64.decode(base64Token);
 		} catch (IllegalArgumentException e) {
 			throw new RuntimeException(
-				"Failed to decode basic authentication token");
+					"Failed to decode basic authentication token");
 		}
 
 		String token = new String(decoded, CharsetUtil.UTF_8);
@@ -70,8 +72,8 @@ public class AuthUtils {
 	 * @return
 	 * @throws IOException
 	 */
-	public static String[] extractAndDecodeHeader(HttpServletRequest request)
-		throws IOException {
+	public String[] extractAndDecodeHeader(HttpServletRequest request)
+			throws IOException {
 		String header = request.getHeader(HttpHeaders.AUTHORIZATION);
 
 		if (header == null || !header.startsWith(BASIC_)) {

+ 15 - 16
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/util/SecurityUtils.java

@@ -23,6 +23,7 @@ package com.pig4cloud.pigx.common.security.util;
 import cn.hutool.core.util.StrUtil;
 import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
 import com.pig4cloud.pigx.common.security.service.PigxUser;
+import lombok.experimental.UtilityClass;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -37,11 +38,12 @@ import java.util.List;
  *
  * @author L.cm
  */
+@UtilityClass
 public class SecurityUtils {
 	/**
 	 * 获取Authentication
 	 */
-	public static Authentication getAuthentication() {
+	public Authentication getAuthentication() {
 		return SecurityContextHolder.getContext().getAuthentication();
 	}
 
@@ -51,13 +53,10 @@ public class SecurityUtils {
 	 * @param authentication
 	 * @return PigxUser
 	 * <p>
-	 * 获取当前用户的全部信息
-	 * 每次check—token 后根据用户名调用 remoteService 查询用户信息,效率比较低。
-	 * 建议长链路调用不要使用,重写configure() 例如  codegen 模块ResourceServerConfigurer
-	 * 1.前提使用继承BaseResourceServerConfigurerAdapter
-	 * 2. 使用默认 configure()
+	 * 获取当前用户的全部信息 EnablePigxResourceServer true
+	 * 获取当前用户的用户名 EnablePigxResourceServer false
 	 */
-	public static PigxUser getUser(Authentication authentication) {
+	public PigxUser getUser(Authentication authentication) {
 		Object principal = authentication.getPrincipal();
 		if (principal instanceof PigxUser) {
 			return (PigxUser) principal;
@@ -70,7 +69,7 @@ public class SecurityUtils {
 	 *
 	 * @return String
 	 */
-	public static String getUsername() {
+	public String getUsername() {
 		Object principal = getAuthentication().getPrincipal();
 		if (principal instanceof String) {
 			return principal.toString();
@@ -79,7 +78,7 @@ public class SecurityUtils {
 	}
 
 
-	public static String getClientId() {
+	public String getClientId() {
 		Authentication authentication = getAuthentication();
 		if (authentication instanceof OAuth2Authentication) {
 			OAuth2Authentication auth2Authentication = (OAuth2Authentication) authentication;
@@ -91,7 +90,7 @@ public class SecurityUtils {
 	/**
 	 * 获取用户
 	 */
-	public static PigxUser getUser() {
+	public PigxUser getUser() {
 		Authentication authentication = getAuthentication();
 		if (authentication == null) {
 			return null;
@@ -104,17 +103,17 @@ public class SecurityUtils {
 	 *
 	 * @return 角色集合
 	 */
-	public static List<Integer> getRoles() {
+	public List<Integer> getRoles() {
 		Authentication authentication = getAuthentication();
 		Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
 
 		List<Integer> roleIds = new ArrayList<>();
 		authorities.stream()
-			.filter(granted -> StrUtil.startWith(granted.getAuthority(), SecurityConstants.ROLE))
-			.forEach(granted -> {
-				String id = StrUtil.removePrefix(granted.getAuthority(), SecurityConstants.ROLE);
-				roleIds.add(Integer.parseInt(id));
-			});
+				.filter(granted -> StrUtil.startWith(granted.getAuthority(), SecurityConstants.ROLE))
+				.forEach(granted -> {
+					String id = StrUtil.removePrefix(granted.getAuthority(), SecurityConstants.ROLE);
+					roleIds.add(Integer.parseInt(id));
+				});
 		return roleIds;
 	}
 

+ 1 - 4
pigx-config/src/main/resources/config/application-dev.yml

@@ -7,10 +7,7 @@ spring:
   redis:
     password:
     host: pigx-redis
-  # Jackson配置
-  jackson:
-    time-zone: GMT+8
-    date-format: yyyy-MM-dd HH:mm:ss
+
 # 暴露监控端点
 management:
   endpoints:

+ 6 - 4
pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/TreeUtil.java

@@ -23,6 +23,7 @@ package com.pig4cloud.pigx.admin.api.vo;
 import com.pig4cloud.pigx.admin.api.dto.MenuTree;
 import com.pig4cloud.pigx.admin.api.dto.TreeNode;
 import com.pig4cloud.pigx.admin.api.entity.SysMenu;
+import lombok.experimental.UtilityClass;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -31,6 +32,7 @@ import java.util.List;
  * @author lengleng
  * @date 2017年11月9日23:34:11
  */
+@UtilityClass
 public class TreeUtil {
 	/**
 	 * 两层循环实现建树
@@ -38,7 +40,7 @@ public class TreeUtil {
 	 * @param treeNodes 传入的树节点列表
 	 * @return
 	 */
-	public static <T extends TreeNode> List<T> bulid(List<T> treeNodes, Object root) {
+	public <T extends TreeNode> List<T> bulid(List<T> treeNodes, Object root) {
 
 		List<T> trees = new ArrayList<>();
 
@@ -66,7 +68,7 @@ public class TreeUtil {
 	 * @param treeNodes
 	 * @return
 	 */
-	public static <T extends TreeNode> List<T> buildByRecursive(List<T> treeNodes, Object root) {
+	public <T extends TreeNode> List<T> buildByRecursive(List<T> treeNodes, Object root) {
 		List<T> trees = new ArrayList<T>();
 		for (T treeNode : treeNodes) {
 			if (root.equals(treeNode.getParentId())) {
@@ -82,7 +84,7 @@ public class TreeUtil {
 	 * @param treeNodes
 	 * @return
 	 */
-	public static <T extends TreeNode> T findChildren(T treeNode, List<T> treeNodes) {
+	public <T extends TreeNode> T findChildren(T treeNode, List<T> treeNodes) {
 		for (T it : treeNodes) {
 			if (treeNode.getId() == it.getParentId()) {
 				if (treeNode.getChildren() == null) {
@@ -101,7 +103,7 @@ public class TreeUtil {
 	 * @param root
 	 * @return
 	 */
-	public static List<MenuTree> bulidTree(List<SysMenu> menus, int root) {
+	public List<MenuTree> bulidTree(List<SysMenu> menus, int root) {
 		List<MenuTree> trees = new ArrayList<>();
 		MenuTree node;
 		for (SysMenu menu : menus) {

+ 13 - 11
pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java

@@ -26,6 +26,7 @@ import com.pig4cloud.pigx.codegen.entity.GenConfig;
 import com.pig4cloud.pigx.codegen.entity.TableEntity;
 import com.pig4cloud.pigx.common.core.constant.CommonConstant;
 import com.pig4cloud.pigx.common.core.exception.CheckedException;
+import lombok.experimental.UtilityClass;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
@@ -50,6 +51,7 @@ import java.util.zip.ZipOutputStream;
  * @date 2018-07-30
  */
 @Slf4j
+@UtilityClass
 public class GenUtils {
 
 	private static final String ENTITY_JAVA_VM = "Entity.java.vm";
@@ -63,7 +65,7 @@ public class GenUtils {
 	private static final String API_JS_VM = "api.js.vm";
 	private static final String CRUD_JS_VM = "crud.js.vm";
 
-	private static List<String> getTemplates() {
+	private List<String> getTemplates() {
 		List<String> templates = new ArrayList<>();
 		templates.add("template/Entity.java.vm");
 		templates.add("template/Mapper.java.vm");
@@ -82,8 +84,8 @@ public class GenUtils {
 	/**
 	 * 生成代码
 	 */
-	public static void generatorCode(GenConfig genConfig, Map<String, String> table,
-									 List<Map<String, String>> columns, ZipOutputStream zip) {
+	public void generatorCode(GenConfig genConfig, Map<String, String> table,
+							  List<Map<String, String>> columns, ZipOutputStream zip) {
 		//配置信息
 		Configuration config = getConfig();
 		boolean hasBigDecimal = false;
@@ -196,8 +198,8 @@ public class GenUtils {
 			try {
 				//添加到zip
 				zip.putNextEntry(new ZipEntry(Objects
-					.requireNonNull(getFileName(template, tableEntity.getCaseClassName()
-						, map.get("package").toString(), map.get("moduleName").toString()))));
+						.requireNonNull(getFileName(template, tableEntity.getCaseClassName()
+								, map.get("package").toString(), map.get("moduleName").toString()))));
 				IoUtil.write(zip, CharsetUtil.UTF_8, false, sw.toString());
 				IoUtil.close(sw);
 				zip.closeEntry();
@@ -211,14 +213,14 @@ public class GenUtils {
 	/**
 	 * 列名转换成Java属性名
 	 */
-	private static String columnToJava(String columnName) {
+	private String columnToJava(String columnName) {
 		return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "");
 	}
 
 	/**
 	 * 表名转换成Java类名
 	 */
-	private static String tableToJava(String tableName, String tablePrefix) {
+	private String tableToJava(String tableName, String tablePrefix) {
 		if (StringUtils.isNotBlank(tablePrefix)) {
 			tableName = tableName.replace(tablePrefix, "");
 		}
@@ -228,7 +230,7 @@ public class GenUtils {
 	/**
 	 * 获取配置信息
 	 */
-	private static Configuration getConfig() {
+	private Configuration getConfig() {
 		try {
 			return new PropertiesConfiguration("generator.properties");
 		} catch (ConfigurationException e) {
@@ -239,7 +241,7 @@ public class GenUtils {
 	/**
 	 * 获取文件名
 	 */
-	private static String getFileName(String template, String className, String packageName, String moduleName) {
+	private String getFileName(String template, String className, String packageName, String moduleName) {
 		String packagePath = CommonConstant.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator;
 		if (StringUtils.isNotBlank(packageName)) {
 			packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator;
@@ -275,7 +277,7 @@ public class GenUtils {
 
 		if (template.contains(INDEX_VUE_VM)) {
 			return CommonConstant.FRONT_END_PROJECT + File.separator + "src" + File.separator + "views" +
-				File.separator + moduleName + File.separator + className.toLowerCase() + File.separator + "index.vue";
+					File.separator + moduleName + File.separator + className.toLowerCase() + File.separator + "index.vue";
 		}
 
 		if (template.contains(API_JS_VM)) {
@@ -284,7 +286,7 @@ public class GenUtils {
 
 		if (template.contains(CRUD_JS_VM)) {
 			return CommonConstant.FRONT_END_PROJECT + File.separator + "src" + File.separator + "const" +
-				File.separator + "crud" + File.separator + className.toLowerCase() + ".js";
+					File.separator + "crud" + File.separator + className.toLowerCase() + ".js";
 		}
 
 		return null;

+ 6 - 4
pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/framework/utils/SocketUtils.java

@@ -22,13 +22,15 @@ import io.netty.buffer.Unpooled;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.util.ReferenceCountUtil;
+import lombok.experimental.UtilityClass;
 
 /**
- *@author LCN on 2017/7/6.
+ * @author LCN on 2017/7/6.
  */
+@UtilityClass
 public class SocketUtils {
 
-	public static String getJson(Object msg) {
+	public String getJson(Object msg) {
 		String json;
 		try {
 			ByteBuf buf = (ByteBuf) msg;
@@ -42,12 +44,12 @@ public class SocketUtils {
 
 	}
 
-	public static void sendMsg(ChannelHandlerContext ctx, String msg) {
+	public void sendMsg(ChannelHandlerContext ctx, String msg) {
 		ctx.writeAndFlush(Unpooled.buffer().writeBytes(msg.getBytes()));
 	}
 
 
-	public static void sendMsg(Channel ctx, String msg) {
+	public void sendMsg(Channel ctx, String msg) {
 		ctx.writeAndFlush(Unpooled.buffer().writeBytes(msg.getBytes()));
 	}
 }