管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-05 ef750a9e4f4382ebcc508fe433f3afe044d426fc
1
已修改4个文件
50 ■■■■ 文件已修改
data/ts.sql 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/upload/UploadController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/all/UploadAttachService.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/DataQueryService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/ts.sql
@@ -110,14 +110,13 @@
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;
src/main/java/com/lf/server/controller/data/upload/UploadController.java
@@ -88,6 +88,10 @@
    @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集合");
            }
@@ -102,7 +106,7 @@
                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("没有要更新的元数据");
            }
src/main/java/com/lf/server/service/all/UploadAttachService.java
@@ -125,7 +125,7 @@
        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) {
@@ -167,7 +167,7 @@
    /**
     * 上传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;
@@ -175,7 +175,7 @@
        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)));
        }
@@ -253,14 +253,14 @@
    /**
     * 上传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) {
@@ -275,7 +275,7 @@
            }
            BaseEntity be = (BaseEntity) obj;
            rows += insertXlsAnnex(be, files);
            rows += insertXlsAnnex(ue, be, files, file);
        }
        return rows;
@@ -338,7 +338,7 @@
     * 查找附件文件
     */
    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;
@@ -356,8 +356,27 @@
    /**
     * 插入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;
    }
}
src/main/java/com/lf/server/service/data/DataQueryService.java
@@ -73,7 +73,7 @@
        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) {