| | |
| | | select * from lf.sys_user where id in (47,48,49); |
| | | select * from lf.sys_download; |
| | | |
| | | select * from bs.m_marker; -- 三桩一牌 photono |
| | | select * from bs.m_marker where parentid is not null; -- 三桩一牌 photono |
| | | -- 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); |
| | | -- |
| | | 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) |
| | | |
| | | select * from lf.sys_meta where type in ('xls', 'xlsx') and eventid is not null and tab is not null and rows > 0 and id in (1209,1180,1387); |
| | | select * from lf.sys_attach; |
| | | |
| | | |
| | | |
| | |
| | | @PostMapping(value = "/uploadXlsAnnex") |
| | | public ResponseMsg<Object> uploadXlsAnnex(String path, Integer[] ids, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("用户未登录", null); |
| | | } |
| | | if (null == ids || ids.length == 0) { |
| | | return fail("找不到元数据的ID集合"); |
| | | } |
| | |
| | | return fail("没有找到上传文件", null); |
| | | } |
| | | |
| | | List<KeyValueEntity> rs = uploadAttachService.uploadXlsAnnex(ms, list, path); |
| | | List<KeyValueEntity> rs = uploadAttachService.uploadXlsAnnex(ue, ms, list, path); |
| | | if (null == rs || rs.size() == 0) { |
| | | return fail("没有要更新的元数据"); |
| | | } |
| | |
| | | entity.setName(oldName); |
| | | entity.setTab(tab); |
| | | entity.setGuid(md5); |
| | | String subPath = PathHelper.getUploadPath() + File.separator + md5; |
| | | String subPath = PathHelper.getUploadPath() + File.separator + md5 + FileHelper.getExtension(oldName); |
| | | entity.setPath(subPath); |
| | | entity.setSizes(sizes); |
| | | if (ue != null) { |
| | |
| | | /** |
| | | * 上传Excel附件 |
| | | */ |
| | | public List<KeyValueEntity> uploadXlsAnnex(List<MetaEntity> ms, List<MetaFileEntity> list, String path) { |
| | | public List<KeyValueEntity> uploadXlsAnnex(UserEntity ue, List<MetaEntity> ms, List<MetaFileEntity> list, String path) { |
| | | List<String> files = getAttachFiles(list, path); |
| | | if (files.size() == 0) { |
| | | return null; |
| | |
| | | |
| | | List<KeyValueEntity> rs = new ArrayList<>(); |
| | | for (MetaEntity meta : ms) { |
| | | int rows = uploadXlsAnnex(meta, files); |
| | | int rows = uploadXlsAnnex(ue, meta, files); |
| | | rs.add(new KeyValueEntity(meta.getName(), String.valueOf(rows))); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 上传Excel附件 |
| | | */ |
| | | private int uploadXlsAnnex(MetaEntity meta, List<String> files) { |
| | | private int uploadXlsAnnex(UserEntity ue, MetaEntity meta, List<String> files) { |
| | | List<?> list = queryXlsData(meta); |
| | | if (null == list || list.size() == 0) { |
| | | return 0; |
| | | } |
| | | |
| | | Field field = getAnnexField(list.get(0), meta); |
| | | String folder = meta.getName().split(".")[0].trim().toLowerCase() + File.separator; |
| | | String folder = meta.getName().split("\\.")[0].trim().toLowerCase() + File.separator; |
| | | |
| | | int rows = 0; |
| | | for (Object obj : list) { |
| | |
| | | } |
| | | |
| | | BaseEntity be = (BaseEntity) obj; |
| | | rows += insertXlsAnnex(be, files); |
| | | rows += insertXlsAnnex(ue, be, files, file); |
| | | } |
| | | |
| | | return rows; |
| | |
| | | * 查找附件文件 |
| | | */ |
| | | private String findAnnexFile(String name, String folder, List<String> files) { |
| | | name = File.separator + name.split(".")[0].toLowerCase(); |
| | | name = File.separator + name.split("\\.")[0].trim().toLowerCase(); |
| | | for (String file : files) { |
| | | if (file.toLowerCase().contains(folder) && file.toLowerCase().contains(name)) { |
| | | return file; |
| | |
| | | /** |
| | | * 插入Excel附件 |
| | | */ |
| | | private int insertXlsAnnex(BaseEntity be, List<String> files) { |
| | | private int insertXlsAnnex(UserEntity ue, BaseEntity be, List<String> files, String file) { |
| | | |
| | | |
| | | files.remove(file); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | private AttachEntity getAttachEntity(UserEntity ue, String file) { |
| | | AttachEntity entity = new AttachEntity(); |
| | | // entity.setTab(tabName); |
| | | // entity.setTabGuid(eventid); |
| | | // entity.setName(fileName); |
| | | // entity.setGuid(md5); |
| | | // String subPath = PathHelper.getUploadPath() + File.separator + md5+ FileHelper.getExtension(fileName); |
| | | // entity.setPath(subPath); |
| | | // entity.setSizes(sizes); |
| | | // if (ue != null) { |
| | | // entity.setCreateUser(ue.getId()); |
| | | // } |
| | | |
| | | return entity; |
| | | } |
| | | } |
| | |
| | | entity.setTabGuid(eventid); |
| | | entity.setName(fileName); |
| | | entity.setGuid(md5); |
| | | String subPath = PathHelper.getUploadPath() + File.separator + md5; |
| | | String subPath = PathHelper.getUploadPath() + File.separator + md5+ FileHelper.getExtension(fileName); |
| | | entity.setPath(subPath); |
| | | entity.setSizes(sizes); |
| | | if (ue != null) { |