package cn.stylefeng.team.view.modular.format;

import cn.hutool.extra.spring.SpringUtil;
import cn.stylefeng.roses.kernel.file.api.FileInfoApi;
import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
import com.alibaba.fastjson.JSON;

import java.util.List;

public class FileUrlMultiFormatProcess extends BaseSimpleFieldFormatProcess {

    @Override
    public Class<?> getItemClass() {
        return String.class;
    }

    @Override
    public Object simpleItemFormat(Object businessId) {
        FileInfoApi fileInfoApi = SpringUtil.getBean(FileInfoApi.class);
        List<Long> fileIdList = JSON.parseArray(String.valueOf(businessId), Long.class);
        return fileInfoApi.batchGetFileUnAuthUrl(fileIdList);
    }

}
