| | |
| | | select * from lf.sys_download; |
| | | |
| | | select * from bs.m_marker; -- 三桩一牌 photono |
| | | -- alter table bs.m_marker add |
| | | -- update bs.m_marker set parentid='df150a0d-eb8c-48d6-887d-c0901f4f61c5' where photono in ('警示牌10002', '警示牌10004', '警示牌10013'); |
| | | -- INSERT INTO bs.m_marker(eventid, segname, markername, photono, createtime, createuser, dirid, depid, verid) VALUES (md5(''), 'seg', '10002', '警示牌10002', now(), 1, 1, 1, 0); |
| | | -- INSERT INTO bs.m_marker(eventid, segname, markername, photono, createtime, createuser, dirid, depid, verid) VALUES (md5(''), 'seg', '10004', '警示牌10004', now(), 1, 1, 1, 0); |
| | | -- df150a0d-eb8c-48d6-887d-c0901f4f61c5 |
| | | -- |
| | | select * from lf.sys_meta where type='xls' order by id desc; |
| | | select * from lf.sys_meta where type in ('xls', 'xlsx') and tab is not null and rows > 0 and id in (1209,1180,1387) |
| | | |
| | |
| | | return fail("没有找到上传文件", null); |
| | | } |
| | | |
| | | Map<String, Integer> map = uploadAttachService.uploadXlsAnnex(ms, list); |
| | | Map<String, Integer> map = uploadAttachService.uploadXlsAnnex(ms, list, path); |
| | | if (null == map || map.size() == 0) { |
| | | return fail("没有要更新的元数据"); |
| | | } |
| | |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.AttachEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.FileHelper; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.service.sys.AttachService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | |
| | | /** |
| | | * 上传Excel附件 |
| | | */ |
| | | public Map<String, Integer> uploadXlsAnnex(List<MetaEntity> ms, List<MetaFileEntity> list) { |
| | | public Map<String, Integer> uploadXlsAnnex(List<MetaEntity> ms, List<MetaFileEntity> list, String path) { |
| | | Map<String, Integer> map = new HashMap<>(3); |
| | | for (MetaEntity me:ms) { |
| | | |
| | | } |
| | | List<String> files = getAttachFiles(list, path); |
| | | |
| | | |
| | | return map; |
| | | } |
| | | |
| | | private void getAttachFiles(List<MetaFileEntity> list){ |
| | | /** |
| | | * 获取附件文件 |
| | | */ |
| | | private List<String> getAttachFiles(List<MetaFileEntity> list, String path) { |
| | | List<String> files = new ArrayList<>(); |
| | | |
| | | for (MetaFileEntity mf : list) { |
| | | if (mf.getName().contains(StaticData.ZIP)) { |
| | | List<String> subs = getZipFiles(mf, path); |
| | | if (null == subs || subs.size() > 0) { |
| | | files.addAll(subs); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | files.add(mf.getPath()); |
| | | } |
| | | |
| | | return files; |
| | | } |
| | | |
| | | /** |
| | | * 获取zip中的文件 |
| | | */ |
| | | private List<String> getZipFiles(MetaFileEntity mf, String path) { |
| | | File file = new File(mf.getPath()); |
| | | if (!file.exists() || file.isDirectory()) { |
| | | return null; |
| | | } |
| | | |
| | | File zipFolder = new File(pathHelper.getConfig().getTempPath() + File.separator + path + "_zip"); |
| | | if (!zipFolder.exists() || !zipFolder.isDirectory()) { |
| | | zipFolder.mkdirs(); |
| | | } |
| | | |
| | | String subPath = zipFolder + File.separator + mf.getName().toLowerCase().replace(".zip", ""); |
| | | ZipHelper.unzip(mf.getPath(), subPath); |
| | | |
| | | List<String> files = new ArrayList<>(); |
| | | getFilesByPath(files, subPath); |
| | | |
| | | return files; |
| | | } |
| | | |
| | | /** |
| | | * 根据路径获取文件 |
| | | */ |
| | | private void getFilesByPath(List<String> list, String path) { |
| | | File file = new File(path); |
| | | if (!file.isDirectory()) { |
| | | list.add(file.getPath()); |
| | | return; |
| | | } |
| | | |
| | | File[] files = file.listFiles(); |
| | | if (null == files) { |
| | | return; |
| | | } |
| | | |
| | | for (File f : files) { |
| | | if (f.isDirectory()) { |
| | | getFilesByPath(list, f.getPath()); |
| | | } else { |
| | | list.add(f.getPath()); |
| | | } |
| | | } |
| | | } |
| | | } |