提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.framework.operatelog.core; |
H |
2 |
|
|
3 |
import cn.hutool.core.convert.Convert; |
|
4 |
import cn.hutool.core.util.StrUtil; |
|
5 |
import com.iailab.module.system.dal.dataobject.dept.PostDO; |
|
6 |
import com.iailab.module.system.service.dept.PostService; |
|
7 |
import com.mzt.logapi.service.IParseFunction; |
|
8 |
import lombok.extern.slf4j.Slf4j; |
|
9 |
import org.springframework.stereotype.Component; |
|
10 |
|
|
11 |
import javax.annotation.Resource; |
|
12 |
|
|
13 |
/** |
|
14 |
* 岗位名字的 {@link IParseFunction} 实现类 |
|
15 |
* |
|
16 |
* @author HUIHUI |
|
17 |
*/ |
|
18 |
@Slf4j |
|
19 |
@Component |
|
20 |
public class PostParseFunction implements IParseFunction { |
|
21 |
|
|
22 |
public static final String NAME = "getPostById"; |
|
23 |
|
|
24 |
@Resource |
|
25 |
private PostService postService; |
|
26 |
|
|
27 |
@Override |
|
28 |
public String functionName() { |
|
29 |
return NAME; |
|
30 |
} |
|
31 |
|
|
32 |
@Override |
|
33 |
public String apply(Object value) { |
|
34 |
if (StrUtil.isEmptyIfStr(value)) { |
|
35 |
return ""; |
|
36 |
} |
|
37 |
|
|
38 |
// 获取岗位信息 |
|
39 |
PostDO post = postService.getPost(Convert.toLong(value)); |
|
40 |
if (post == null) { |
|
41 |
log.warn("[apply][获取岗位{{}}为空", value); |
|
42 |
return ""; |
|
43 |
} |
|
44 |
return post.getName(); |
|
45 |
} |
|
46 |
|
|
47 |
} |