package org.jeecg.modules.moban.service.impl;

import cn.hutool.core.io.FileUtil;
import org.jeecg.modules.baogao.entity.ItdmBaogao;
import org.jeecg.modules.baogao.vo.ItdmBaogaoVO;
import org.jeecg.modules.moban.entity.ItdmMoban;
import org.jeecg.modules.moban.mapper.ItdmMobanMapper;
import org.jeecg.modules.moban.service.IItdmMobanService;
import org.jeecg.modules.moban.vo.IItdmMobanVO;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 模板
 * @Author: jeecg-boot
 * @Date:   2023-05-19
 * @Version: V1.0
 */
@Service
public class ItdmMobanServiceImpl extends ServiceImpl<ItdmMobanMapper, ItdmMoban> implements IItdmMobanService {


    @Override
    public IItdmMobanVO wordById(String id) {
        ItdmMoban baoVo = this.baseMapper.selectById(id);

        String filepath = baoVo.getFilePath();


        String key = FileUtil.mainName(filepath) + "="+filepath.substring(0, filepath.lastIndexOf("/")).replaceAll("/", "=")+"=" + System.currentTimeMillis();
        String fileType = FileUtil.extName(filepath);
        String url = filepath;
        String title = FileUtil.getName(filepath);


        return new IItdmMobanVO(key, url,fileType, title);
    }


    public static void main(String[] args) {
        String filepath = "temp/报告模板中文1_1684804499341.docx";


    }
}
