compile error fix

master
yixian 4 years ago
parent 8fe1b1256f
commit f1cf317943

@ -10,13 +10,18 @@ import com.yixsoft.support.mybatis.utils.FieldDescription;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.hibernate.validator.constraints.Range;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.AnnotatedElementUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@JSONType(naming = PropertyNamingStrategy.SnakeCase)
public class DefaultClientProfile {
private final Logger logger = LoggerFactory.getLogger(getClass());
@ProfileDesc(value = "周末延迟清算", detail = "周末交易延迟到周二清算")
private boolean weekendDelay = true;
@ProfileDesc("手续费包含GST")
@ -35,10 +40,12 @@ public class DefaultClientProfile {
return new ClassFieldsDescription<>(getClass()).getFields().stream()
.filter(field -> !"class".equalsIgnoreCase(field.getFieldName()))
.map(this::convertFieldInfo)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
private JSONObject convertFieldInfo(FieldDescription field) {
try {
Object value = field.readField(this);
String fieldName = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.LOWER_UNDERSCORE).convert(field.getFieldName());
JSONObject info = new JSONObject();
@ -69,6 +76,10 @@ public class DefaultClientProfile {
} catch (NoSuchFieldException e) {
}
return info;
} catch (IllegalAccessException | InvocationTargetException e) {
logger.error("failed to access getter of field {}", field.getFieldName(), e);
return null;
}
}
public void applyToClientConfig(JSONObject client) {

Loading…
Cancel
Save