| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.alibaba.druid.support.spring.stat.annotation.Stat; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.data.CoordEntity; |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.data.FmeLogEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.mapper.data.UploadMapper; |
| | | import com.lf.server.service.all.BaseUploadService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public List<FmeLogEntity> selectFmeLog(String parentid) { |
| | | return uploadMapper.selectFmeLog(parentid); |
| | | } |
| | | |
| | | /** |
| | | * 插入文件 |
| | | */ |
| | | public void insertFiles(UserEntity ue, List<MetaFileEntity> list) { |
| | | checkMetaFiles(ue, list); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 检查元数据文件 |
| | | */ |
| | | private void checkMetaFiles(UserEntity ue, List<MetaFileEntity> list) { |
| | | String tempPath = pathHelper.getConfig().getTempPath(); |
| | | |
| | | int i = 0; |
| | | while (i < list.size()) { |
| | | MetaFileEntity mf = list.get(i); |
| | | File f = new File(tempPath + File.separator + mf.getPath()); |
| | | if (!f.exists()) { |
| | | list.remove(i); |
| | | continue; |
| | | } |
| | | |
| | | // mf.setCreateUser(ue.getId()); mf.setDepid(ue.getDepid()) |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取Excel文件 |
| | | */ |
| | | private List<String> getExcelFiles(List<MetaFileEntity> list) { |
| | | String tempPath = pathHelper.getConfig().getTempPath(); |
| | | |
| | | List<String> xlsList = new ArrayList<>(); |
| | | for (MetaFileEntity mf : list) { |
| | | if (StaticData.XLS.equals(mf.getExtName()) || StaticData.XLSX.equals(mf.getExtName())) { |
| | | File f = new File(tempPath + File.separator + mf.getPath()); |
| | | if (f.exists() && !f.isDirectory()) { |
| | | xlsList.add(f.getPath()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return xlsList; |
| | | } |
| | | } |