chentaisen 2024-08-25 10:36:02 +08:00
commit 58e77303ee
8 changed files with 60 additions and 7 deletions

View File

@ -65,7 +65,7 @@ public class Result<T> implements Serializable {
}
public static <T> Result<T> success (T data) {
return restResult(null, SUCCESS, "操作成功");
return restResult(data, SUCCESS, "操作成功");
}
public static <T> Result<T> success (T data, String msg) {

View File

@ -35,4 +35,17 @@ public enum SysApiState {
.map(SysApiState::getCode)
.anyMatch(c -> c.equals(code));
}
/**
* ,
* @param code
* @return
*/
public static String getInfoByCode(String code){
return Arrays.stream(values())
.filter(c -> c.getCode().equals(code))
.findFirst()
.map(SysApiState::getInfo)
.orElse("-");
}
}

View File

@ -37,4 +37,17 @@ public enum SysCheckState {
.map(SysCheckState::getCode)
.anyMatch(c -> c.equals(code));
}
/**
* ,
* @param code
* @return
*/
public static String getInfoByCode(String code){
return Arrays.stream(values())
.filter(c -> c.getCode().equals(code))
.findFirst()
.map(SysCheckState::getInfo)
.orElse("-");
}
}

View File

@ -38,4 +38,17 @@ public enum SysDBType {
.map(SysDBType::getCode)
.anyMatch(c -> c.equals(code));
}
/**
* ,
* @param code
* @return
*/
public static String getInfoByCode(String code){
return Arrays.stream(values())
.filter(c -> c.getCode().equals(code))
.findFirst()
.map(SysDBType::getInfo)
.orElse("-");
}
}

View File

@ -35,9 +35,9 @@ public enum SysPayType {
}
/**
* ,
* @param code
* @return
* ,
* @param code
* @return
*/
public static String getInfoByCode(String code){
return Arrays.stream(values())

View File

@ -32,4 +32,17 @@ public enum SysYesNo {
.map(SysYesNo::getCode)
.anyMatch(c -> c.equals(code));
}
/**
* ,
* @param code
* @return
*/
public static String getInfoByCode(String code){
return Arrays.stream(values())
.filter(c -> c.getCode().equals(code))
.findFirst()
.map(SysYesNo::getInfo)
.orElse("-");
}
}

View File

@ -19,4 +19,5 @@ public enum UserStatus {
this.info = info;
}
}

View File

@ -1,5 +1,6 @@
package com.muyu.common.core.text;
import com.muyu.common.core.constant.Constants;
import com.muyu.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@ -689,11 +690,10 @@ public class Convert {
* @return
*/
public static String str (Object obj, String charsetName) {
System.out.println(obj);
try{
return str(obj, Charset.forName(charsetName));
return str(obj, Charset.forName(charsetName.isEmpty()? Constants.UTF8 : charsetName));
// return str(obj, Charset.forName(charsetName));
}catch (Exception exception){
System.out.println("字符转换异常: [{"+obj+"}-{"+charsetName+"}] -> {"+exception.getMessage()+"}");
log.error("字符转换异常: [{}-{}] -> {}",obj,charsetName,exception.getMessage(),exception);
throw new RuntimeException(exception);
}