package com.iailab.module.system.framework.operatelog.core;
|
|
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.util.StrUtil;
|
import com.iailab.framework.ip.core.utils.AreaUtils;
|
import com.mzt.logapi.service.IParseFunction;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 地名的 {@link IParseFunction} 实现类
|
*
|
* @author HUIHUI
|
*/
|
@Slf4j
|
@Component
|
public class AreaParseFunction implements IParseFunction {
|
|
public static final String NAME = "getArea";
|
|
@Override
|
public boolean executeBefore() {
|
return true; // 先转换值后对比
|
}
|
|
@Override
|
public String functionName() {
|
return NAME;
|
}
|
|
@Override
|
public String apply(Object value) {
|
if (StrUtil.isEmptyIfStr(value)) {
|
return "";
|
}
|
return AreaUtils.format(Convert.toInt(value));
|
}
|
|
}
|