liyong
2026-07-03 bee96a1d36c86068cd5a7eb69f4e3294a8123b04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package cn.iocoder.yudao.module.crm.framework.operatelog.core;
 
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService;
import com.mzt.logapi.service.IParseFunction;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
 
/**
 * CRM 商机的 {@link IParseFunction} 实现类
 *
 * @author HUIHUI
 */
@Component
@Slf4j
public class CrmBusinessParseFunction implements IParseFunction {
 
    public static final String NAME = "getBusinessById";
 
    @Resource
    private CrmBusinessService businessService;
 
    @Override
    public boolean executeBefore() {
        return true; // 先转换值后对比
    }
 
    @Override
    public String functionName() {
        return NAME;
    }
 
    @Override
    public String apply(Object value) {
        if (StrUtil.isEmptyIfStr(value)) {
            return "";
        }
        CrmBusinessDO businessDO = businessService.getBusiness(Long.parseLong(value.toString()));
        return businessDO == null ? "" : businessDO.getName();
    }
 
}