| | |
| | | comment on column lf.sys_flow.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | select * from lf.sys_flow; |
| | | ----------------------------------------------------------------------------------------------------- 16.å
æ°æ®è¡¨-New |
| | | -- DROP TABLE IF EXISTS lf.sys_meta; DROP TABLE IF EXISTS lf.sys_meta_file; |
| | | create table lf.sys_meta ( |
| | | id serial primary key, |
| | | eventid varchar(38) default new_guid(), |
| | | metaid integer default 0, |
| | | dirid integer default 0, |
| | | depid integer default 0, |
| | | verid integer default 0, |
| | | name varchar(256), |
| | | type varchar(100), |
| | | guid varchar(38) default new_guid(), |
| | | path varchar(512), |
| | | sizes float8 default 0, |
| | | bstab varchar(50), |
| | | bsrows integer default 0, |
| | | mdtab varchar(50), |
| | | mdrows integer default 0, |
| | | create_user integer default 1, |
| | | create_time timestamp(6) without time zone default now(), |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024), |
| | | geom geometry(MultiPolygon, 4490) |
| | | ); |
| | | -- drop index index_sys_meta_geom; |
| | | create index index_sys_meta_geom on lf.sys_meta using GIST (geom); |
| | | comment on table lf.sys_meta is 'å
æ°æ®è¡¨'; |
| | | comment on column lf.sys_meta.id is '主é®ID'; |
| | | comment on column lf.sys_meta.eventid is 'GUID'; |
| | | comment on column lf.sys_meta.metaid is 'ç¶å
æ°æ®IDï¼0-没æ'; |
| | | comment on column lf.sys_meta.dirid is 'ç®å½ID'; |
| | | comment on column lf.sys_meta.depid is 'åä½ID'; |
| | | comment on column lf.sys_meta.verid is 'çæ¬ID'; |
| | | comment on column lf.sys_meta.name is 'åç§°'; |
| | | comment on column lf.sys_meta.type is 'ç±»å:file-æä»¶ï¼shp-ShapeFileï¼gdb-GDBï¼zip-å缩å
'; |
| | | comment on column lf.sys_meta.guid is 'æä»¶GUID'; |
| | | comment on column lf.sys_meta.path is 'åå¨è·¯å¾'; |
| | | comment on column lf.sys_meta.sizes is '大å°ï¼åä½MB'; |
| | | comment on column lf.sys_meta.bstab is 'ä¸å¡è¡¨å'; |
| | | comment on column lf.sys_meta.bsrows is 'ä¸å¡è¡¨è¡æ°'; |
| | | comment on column lf.sys_meta.mdtab is 'å
æ°æ®è¡¨å'; |
| | | comment on column lf.sys_meta.mdrows is 'å
æ°æ®è¡æ°'; |
| | | comment on column lf.sys_meta.create_user is 'å建人ID'; |
| | | comment on column lf.sys_meta.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_meta.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_meta.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column lf.sys_meta.bak is '夿³¨'; |
| | | comment on column lf.sys_meta.geom is '空é´ä½ç½®'; |
| | | -- insert into lf.sys_meta(dirid,depid,geom,sizes,name,path) values (1,1,ST_PolygonFromText('MultiPolygon (((100 0,120 0,120 20,100 20,100 0)))', 4490),0.001,'a.jpg','c:\a.jpg'); |
| | | |
| | | select a.*,st_astext(geom) from lf.sys_meta a; |
| | | ----------------------------------------------------------------------------------------------------- å
æ°æ®æµè¯è¡¨ * |
| | | -- drop table if exists md.md_zxcg; |
| | | create table md.md_zxcg( |
| | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DirEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.VerEntity; |
| | | import com.lf.server.entity.sys.DepEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | |
| | | return fail("ç¨æ·æªç»å½", null); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = baseUploadService.uploadData(null, path, req, res); |
| | | List<MetaEntity> list = baseUploadService.uploadData(null, path, req, res); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("æ²¡ææ¾å°ä¸ä¼ æä»¶", null); |
| | | } |
| | |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/deleteFiles") |
| | | public ResponseMsg<Object> deleteFiles(@RequestBody List<MetaFileEntity> list, HttpServletRequest req) { |
| | | public ResponseMsg<Object> deleteFiles(@RequestBody List<MetaEntity> list, HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | |
| | | import com.lf.server.entity.ctrl.UploadEntity; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | @ApiImplicitParam(name = "path", value = "è·¯å¾", dataType = "String", paramType = "query") |
| | | }) |
| | | @GetMapping(value = "/selectFiles") |
| | | public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) { |
| | | public ResponseMsg<List<MetaEntity>> selectFiles(String path) { |
| | | try { |
| | | List<MetaFileEntity> list = baseUploadService.selectFiles(path, extList); |
| | | List<MetaEntity> list = baseUploadService.selectFiles(path, extList); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | |
| | | MetaEntity me = entity.getMetaEntity(); |
| | | me.setCreateTime(WebHelper.getCurrentTimestamp()); |
| | | me.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(me.getCreateTime().getTime()))); |
| | | // me.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(me.getCreateTime().getTime()))) |
| | | me.setCreateUser(ue.getId()); |
| | | |
| | | dataLoaderService.insertFiles(me, entity.getFileEntities(), entity.getTabEntities()); |
| | |
| | | } |
| | | |
| | | MetaEntity meta = metaService.selectById(id); |
| | | if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { |
| | | if (null == meta || null == meta.getBstab() || !meta.getBstab().contains(StaticData.POINT)) { |
| | | return fail("æ¾ä¸å°å
æ°æ®ä¿¡æ¯", null); |
| | | } |
| | | |
| | | String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | | String entity = meta.getBstab().substring(meta.getBstab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); |
| | | if (null == baseMapper) { |
| | | return null; |
| | |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.ctrl.UploadEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | |
| | | @ApiImplicitParam(name = "path", value = "è·¯å¾", dataType = "String", paramType = "query") |
| | | }) |
| | | @GetMapping(value = "/selectFiles") |
| | | public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) { |
| | | public ResponseMsg<List<MetaEntity>> selectFiles(String path) { |
| | | try { |
| | | List<MetaFileEntity> list = baseUploadService.selectFiles(path, null); |
| | | List<MetaEntity> list = baseUploadService.selectFiles(path, null); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | |
| | | MetaEntity me = entity.getMetaEntity(); |
| | | me.setCreateTime(WebHelper.getCurrentTimestamp()); |
| | | me.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(me.getCreateTime().getTime()))); |
| | | // me.setBatch(StringHelper.YMDHMS_FORMAT.format(new Date(me.getCreateTime().getTime()))) |
| | | me.setCreateUser(ue.getId()); |
| | | |
| | | int rows = dataUploadService.insertFiles(me, entity.getFileEntities()); |
| | |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.Md5Helper; |
| | |
| | | } |
| | | |
| | | MetaEntity meta = metaService.selectById(id); |
| | | if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { |
| | | if (null == meta || null == meta.getBstab() || !meta.getBstab().contains(StaticData.POINT)) { |
| | | return fail("æ¾ä¸å°å
æ°æ®ä¿¡æ¯", null); |
| | | } |
| | | |
| | | String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | | String entity = meta.getBstab().substring(meta.getBstab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); |
| | | if (null == baseMapper) { |
| | | return null; |
| | |
| | | return fail("å¯ç ä¸ç¬¦åè¦æ±"); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | List<MetaEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("æ²¡ææ¾å°å
æ°æ®"); |
| | | } |
| | |
| | | import com.lf.server.entity.ctrl.DownloadReqEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | |
| | | } |
| | | |
| | | MetaEntity meta = metaService.selectById(id); |
| | | if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { |
| | | if (null == meta || null == meta.getBstab() || !meta.getBstab().contains(StaticData.POINT)) { |
| | | return fail("æ¾ä¸å°å
æ°æ®ä¿¡æ¯", null); |
| | | } |
| | | |
| | | String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | | String entity = meta.getBstab().substring(meta.getBstab().indexOf(".") + 1).replace("_", "").toLowerCase(); |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); |
| | | if (null == baseMapper) { |
| | | return null; |
| | |
| | | return fail("å¯ç ä¸ç¬¦åè¦æ±"); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | List<MetaEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("æ²¡ææ¾å°å
æ°æ®"); |
| | | } |
| | |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.ctrl.ShpRecordEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.AesHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | return fail("ç¨æ·æªç»å½", null); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = uploaderService.uploadData(null, null, req, res); |
| | | List<MetaEntity> list = uploaderService.uploadData(null, null, req, res); |
| | | if (list == null || list.size() < StaticData.FOUR) { |
| | | return fail("æ²¡ææ¾å°å·²ä¸ä¼ çæ°æ®æä¸å®æ´", null); |
| | | } |
| | |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.ctrl.MarkJsonEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.show.MarkEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | @ApiOperation(value = "ä¸ä¼ ShapeFileæä»¶") |
| | | @ResponseBody |
| | | @PostMapping(value = "/uploadShp", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<List<MarkJsonEntity>> uploadShp(HttpServletRequest req, HttpServletResponse res) { |
| | | public ResponseMsg<Object> uploadShp(HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("ç¨æ·æªç»å½", null); |
| | | } |
| | | |
| | | List<MetaFileEntity> meList = uploaderService.uploadData(null, null, req, res); |
| | | List<MetaEntity> meList = uploaderService.uploadData(null, null, req, res); |
| | | if (meList == null || meList.size() < StaticData.FOUR) { |
| | | return fail("æ²¡ææ¾å°å·²ä¸ä¼ çæ°æ®æä¸å®æ´", null); |
| | | } |
| | |
| | | |
| | | private String eventid; |
| | | |
| | | private String parentid; |
| | | |
| | | private Integer dirid; |
| | | |
| | | private Integer depid; |
| | |
| | | this.eventid = eventid; |
| | | } |
| | | |
| | | public String getParentid() { |
| | | return parentid; |
| | | } |
| | | |
| | | public void setParentid(String parentid) { |
| | | this.parentid = parentid; |
| | | } |
| | | |
| | | public Integer getDirid() { |
| | | return dirid; |
| | | } |
| | |
| | | package com.lf.server.entity.ctrl; |
| | | |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public class UploadEntity { |
| | | private MetaEntity metaEntity; |
| | | |
| | | private List<MetaFileEntity> fileEntities; |
| | | private List<MetaEntity> fileEntities; |
| | | |
| | | private List<TabMapperEntity> tabEntities; |
| | | |
| | |
| | | this.metaEntity = metaEntity; |
| | | } |
| | | |
| | | public List<MetaFileEntity> getFileEntities() { |
| | | public List<MetaEntity> getFileEntities() { |
| | | return fileEntities; |
| | | } |
| | | |
| | | public void setFileEntities(List<MetaFileEntity> fileEntities) { |
| | | public void setFileEntities(List<MetaEntity> fileEntities) { |
| | | this.fileEntities = fileEntities; |
| | | } |
| | | |
| | |
| | | * @author WWW |
| | | */ |
| | | public class MetaEntity implements Serializable { |
| | | private static final long serialVersionUID = -351865749970015936L; |
| | | private static final long serialVersionUID = -984838663593325184L; |
| | | |
| | | private int id; |
| | | |
| | | private String name; |
| | | private String eventid; |
| | | |
| | | private int metaid; |
| | | |
| | | private int dirid; |
| | | |
| | |
| | | |
| | | private int verid; |
| | | |
| | | private String name; |
| | | |
| | | private String type; |
| | | |
| | | private String guid; |
| | | |
| | | private String path; |
| | | |
| | | private double sizes; |
| | | |
| | | private String tab; |
| | | private String bstab; |
| | | |
| | | private int rows; |
| | | private int bsrows; |
| | | |
| | | private String cs; |
| | | private String mdtab; |
| | | |
| | | private String scale; |
| | | |
| | | private String resolution; |
| | | |
| | | private Timestamp gather; |
| | | |
| | | private String batch; |
| | | |
| | | private String descr; |
| | | private int mdrows; |
| | | |
| | | private int createUser; |
| | | |
| | |
| | | |
| | | private Timestamp updateTime; |
| | | |
| | | private String bak; |
| | | |
| | | private String geom; |
| | | |
| | | private String uname; |
| | | |
| | | private String depName; |
| | | |
| | | private String verName; |
| | | |
| | | private String dirName; |
| | | |
| | | public MetaEntity() { |
| | | } |
| | |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public String getEventid() { |
| | | return eventid; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | public void setEventid(String eventid) { |
| | | this.eventid = eventid; |
| | | } |
| | | |
| | | public int getMetaid() { |
| | | return metaid; |
| | | } |
| | | |
| | | public void setMetaid(int metaid) { |
| | | this.metaid = metaid; |
| | | } |
| | | |
| | | public int getDirid() { |
| | |
| | | this.verid = verid; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getGuid() { |
| | | return guid; |
| | | } |
| | | |
| | | public void setGuid(String guid) { |
| | | this.guid = guid; |
| | | } |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public double getSizes() { |
| | |
| | | this.sizes = sizes; |
| | | } |
| | | |
| | | public String getTab() { |
| | | return tab; |
| | | public String getBstab() { |
| | | return bstab; |
| | | } |
| | | |
| | | public void setTab(String tab) { |
| | | this.tab = tab; |
| | | public void setBstab(String bstab) { |
| | | this.bstab = bstab; |
| | | } |
| | | |
| | | public int getRows() { |
| | | return rows; |
| | | public int getBsrows() { |
| | | return bsrows; |
| | | } |
| | | |
| | | public void setRows(int rows) { |
| | | this.rows = rows; |
| | | public void setBsrows(int bsrows) { |
| | | this.bsrows = bsrows; |
| | | } |
| | | |
| | | public String getCs() { |
| | | return cs; |
| | | public String getMdtab() { |
| | | return mdtab; |
| | | } |
| | | |
| | | public void setCs(String cs) { |
| | | this.cs = cs; |
| | | public void setMdtab(String mdtab) { |
| | | this.mdtab = mdtab; |
| | | } |
| | | |
| | | public String getScale() { |
| | | return scale; |
| | | public int getMdrows() { |
| | | return mdrows; |
| | | } |
| | | |
| | | public void setScale(String scale) { |
| | | this.scale = scale; |
| | | } |
| | | |
| | | public String getResolution() { |
| | | return resolution; |
| | | } |
| | | |
| | | public void setResolution(String resolution) { |
| | | this.resolution = resolution; |
| | | } |
| | | |
| | | public Timestamp getGather() { |
| | | return gather; |
| | | } |
| | | |
| | | public void setGather(Timestamp gather) { |
| | | this.gather = gather; |
| | | } |
| | | |
| | | public String getBatch() { |
| | | return batch; |
| | | } |
| | | |
| | | public void setBatch(String batch) { |
| | | this.batch = batch; |
| | | } |
| | | |
| | | public String getDescr() { |
| | | return descr; |
| | | } |
| | | |
| | | public void setDescr(String descr) { |
| | | this.descr = descr; |
| | | public void setMdrows(int mdrows) { |
| | | this.mdrows = mdrows; |
| | | } |
| | | |
| | | public int getCreateUser() { |
| | |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getBak() { |
| | | return bak; |
| | | } |
| | | |
| | | public void setBak(String bak) { |
| | | this.bak = bak; |
| | | } |
| | | |
| | | public String getGeom() { |
| | | return geom; |
| | | } |
| | | |
| | | public void setGeom(String geom) { |
| | | this.geom = geom; |
| | | } |
| | | |
| | | public String getUname() { |
| | | return uname; |
| | | } |
| | | |
| | | public void setUname(String uname) { |
| | | this.uname = uname; |
| | | } |
| | | |
| | | public String getDepName() { |
| | | return depName; |
| | | } |
| | | |
| | | public void setDepName(String depName) { |
| | | this.depName = depName; |
| | | } |
| | | |
| | | public String getVerName() { |
| | | return verName; |
| | | } |
| | | |
| | | public void setVerName(String verName) { |
| | | this.verName = verName; |
| | | } |
| | | |
| | | public String getDirName() { |
| | | return dirName; |
| | | } |
| | | |
| | | public void setDirName(String dirName) { |
| | | this.dirName = dirName; |
| | | } |
| | | } |
| | |
| | | package com.lf.server.helper; |
| | | |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.twmacinta.util.MD5; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.commons.logging.Log; |
| | |
| | | /** |
| | | * å 餿件 |
| | | */ |
| | | public static void deleteFiles(List<MetaFileEntity> list) { |
| | | public static void deleteFiles(List<MetaEntity> list) { |
| | | try { |
| | | for (MetaFileEntity mf : list) { |
| | | for (MetaEntity mf : list) { |
| | | File f = new File(mf.getPath()); |
| | | if (f.exists()) { |
| | | f.delete(); |
| | |
| | | package com.lf.server.mapper.data; |
| | | |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | * @param ids å
æ°æ®IDéå |
| | | * @return å
æ°æ®æä»¶éå |
| | | */ |
| | | public List<MetaFileEntity> selectMetaFiles(List<Integer> ids); |
| | | public List<MetaEntity> selectMetaFiles(List<Integer> ids); |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡ |
| | |
| | | package com.lf.server.service.all; |
| | | |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.helper.FileHelper; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | /** |
| | | * æ¥è¯¢æä»¶ |
| | | */ |
| | | public List<MetaFileEntity> selectFiles(String subPath, List<String> extList) throws IOException { |
| | | public List<MetaEntity> selectFiles(String subPath, List<String> extList) throws IOException { |
| | | String root = pathHelper.getConfig().getTempPath() + File.separator + subPath; |
| | | |
| | | File file = new File(root); |
| | |
| | | return null; |
| | | } |
| | | |
| | | List<MetaFileEntity> list = new ArrayList<MetaFileEntity>(); |
| | | List<MetaEntity> list = new ArrayList<MetaEntity>(); |
| | | for (File f : files) { |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | if (null != extList) { |
| | |
| | | double sizes = FileHelper.sizeToMb(f.length()); |
| | | String filePath = subPath + File.separator + fileName; |
| | | |
| | | MetaFileEntity mf = new MetaFileEntity(); |
| | | MetaEntity mf = new MetaEntity(); |
| | | mf.setName(fileName); |
| | | mf.setSizes(sizes); |
| | | mf.setPath(filePath); |
| | |
| | | /** |
| | | * ä¸ä¼ æä»¶ |
| | | */ |
| | | public <T> List<MetaFileEntity> uploadData(T t, String path, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | public <T> List<MetaEntity> uploadData(T t, String path, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | StandardMultipartHttpServletRequest request = (StandardMultipartHttpServletRequest) req; |
| | | req.setCharacterEncoding("utf-8"); |
| | | res.setContentType("application/json;charset=utf-8"); |
| | |
| | | if (t != null) { |
| | | setEntity(t, request); |
| | | } |
| | | List<MetaFileEntity> list = getFiles(path, request); |
| | | List<MetaEntity> list = getFiles(path, request); |
| | | |
| | | return list; |
| | | } |
| | |
| | | /** |
| | | * è·åæä»¶ |
| | | */ |
| | | public List<MetaFileEntity> getFiles(String subPath, StandardMultipartHttpServletRequest req) throws Exception { |
| | | List<MetaFileEntity> list = new ArrayList<MetaFileEntity>(); |
| | | public List<MetaEntity> getFiles(String subPath, StandardMultipartHttpServletRequest req) throws Exception { |
| | | List<MetaEntity> list = new ArrayList<MetaEntity>(); |
| | | |
| | | String path = pathHelper.getTempPath(subPath); |
| | | Iterator<String> iterator = req.getFileNames(); |
| | |
| | | } |
| | | |
| | | double sizes = FileHelper.sizeToMb(file.getSize()); |
| | | MetaFileEntity mf = new MetaFileEntity(); |
| | | MetaEntity mf = new MetaEntity(); |
| | | mf.setName(file.getOriginalFilename()); |
| | | mf.setSizes(sizes); |
| | | mf.setPath(path + File.separator + mf.getName()); |
| | |
| | | /** |
| | | * å 餿件 |
| | | */ |
| | | public Integer deleteFiles(List<MetaFileEntity> list) { |
| | | public Integer deleteFiles(List<MetaEntity> list) { |
| | | String root = pathHelper.getConfig().getTempPath(); |
| | | |
| | | int count = 0; |
| | | for (MetaFileEntity entity : list) { |
| | | for (MetaEntity entity : list) { |
| | | if (!StringHelper.isEmpty(entity.getPath())) { |
| | | String file = root + File.separator + entity.getPath(); |
| | | |
| | |
| | | import com.lf.server.entity.all.BaseEntity; |
| | | import com.lf.server.entity.ctrl.TabMapperEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | |
| | | public class DataLoaderService extends BaseUploadService { |
| | | @Autowired |
| | | MetaService metaService; |
| | | |
| | | @Autowired |
| | | MetaFileService metaFileService; |
| | | |
| | | private final static String XLS = ".xls"; |
| | | |
| | |
| | | /** |
| | | * æå
¥æä»¶ |
| | | */ |
| | | public void insertFiles(MetaEntity entity, List<MetaFileEntity> list, List<TabMapperEntity> tabList) { |
| | | public void insertFiles(MetaEntity entity, List<MetaEntity> list, List<TabMapperEntity> tabList) { |
| | | try { |
| | | String temp = pathHelper.getConfig().getTempPath(); |
| | | String upload = pathHelper.getUploadFullPath(); |
| | | |
| | | for (MetaFileEntity mf : list) { |
| | | for (MetaEntity mf : list) { |
| | | File file = new File(temp + File.separator + mf.getPath()); |
| | | File newFile = new File(upload + File.separator + mf.getGuid()); |
| | | |
| | |
| | | continue; |
| | | } |
| | | |
| | | MetaFileEntity old = metaFileService.selectByGuid(mf.getGuid()); |
| | | MetaEntity old = metaService.selectByGuid(mf.getGuid()); |
| | | String filePath = null == old ? newFile.getPath() : old.getPath(); |
| | | |
| | | int count = 0; |
| | |
| | | continue; |
| | | } |
| | | |
| | | MetaFileEntity mfe = createMetaFileEntity(me, mf, filePath); |
| | | if (metaFileService.insert(mfe) == 0) { |
| | | MetaEntity mfe = createMetaFileEntity(me, mf, filePath); |
| | | if (metaService.insert(mfe) == 0) { |
| | | metaService.delete(me.getId()); |
| | | continue; |
| | | } |
| | |
| | | /** |
| | | * è·å Tabs |
| | | */ |
| | | private List<TabMapperEntity> getTabs(MetaFileEntity mfe, List<TabMapperEntity> tabs) { |
| | | private List<TabMapperEntity> getTabs(MetaEntity mfe, List<TabMapperEntity> tabs) { |
| | | List<TabMapperEntity> list = new ArrayList<>(); |
| | | for (TabMapperEntity tab : tabs) { |
| | | if (!tab.getFileName().equals(mfe.getName()) || StringHelper.isEmpty(tab.getEntity())) { |
| | |
| | | /** |
| | | * å建å
æ°æ®å®ä½ |
| | | */ |
| | | private MetaEntity createMetaEntity(MetaEntity entity, MetaFileEntity mf, String tab, int rows) { |
| | | private MetaEntity createMetaEntity(MetaEntity entity, MetaEntity mf, String tab, int rows) { |
| | | MetaEntity me = new MetaEntity(); |
| | | me.setDepid(entity.getDepid()); |
| | | me.setDirid(entity.getDirid()); |
| | | me.setVerid(entity.getVerid()); |
| | | me.setType(getType(mf.getName().toLowerCase())); |
| | | me.setGather(entity.getGather()); |
| | | me.setBatch(entity.getBatch()); |
| | | me.setDescr(entity.getDescr()); |
| | | me.setName(mf.getName()); |
| | | me.setSizes(mf.getSizes()); |
| | | me.setTab(tab); |
| | | me.setRows(rows); |
| | | me.setBstab(tab); |
| | | me.setBsrows(rows); |
| | | me.setCreateTime(entity.getCreateTime()); |
| | | me.setCreateUser(entity.getCreateUser()); |
| | | |
| | |
| | | /** |
| | | * å建å
æ°æ®æä»¶å®ä½ |
| | | */ |
| | | private MetaFileEntity createMetaFileEntity(MetaEntity me, MetaFileEntity entity, String filePath) { |
| | | MetaFileEntity mfe = new MetaFileEntity(); |
| | | private MetaEntity createMetaFileEntity(MetaEntity me, MetaEntity entity, String filePath) { |
| | | MetaEntity mfe = new MetaEntity(); |
| | | mfe.setName(entity.getName()); |
| | | mfe.setMetaid(me.getId()); |
| | | mfe.setGuid(entity.getGuid()); |
| | |
| | | /** |
| | | * æå
¥Excel |
| | | */ |
| | | private void insertXls(String root, MetaEntity me, MetaFileEntity mf, TabMapperEntity tab) { |
| | | private void insertXls(String root, MetaEntity me, MetaEntity mf, TabMapperEntity tab) { |
| | | BasicMapper basicMapper = ClassHelper.getBasicMapper(tab.getEntity()); |
| | | if (null == basicMapper) { |
| | | return; |
| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.helper.FileHelper; |
| | | import com.lf.server.service.all.BaseUploadService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | MetaService metaService; |
| | | |
| | | @Autowired |
| | | MetaFileService metaFileService; |
| | | |
| | | /** |
| | | * æå
¥æä»¶ |
| | | */ |
| | | public int insertFiles(MetaEntity entity, List<MetaFileEntity> list) { |
| | | public int insertFiles(MetaEntity entity, List<MetaEntity> list) { |
| | | int count = 0; |
| | | try { |
| | | String temp = pathHelper.getConfig().getTempPath(); |
| | | String root = pathHelper.getUploadFullPath(); |
| | | |
| | | for (MetaFileEntity mf : list) { |
| | | for (MetaEntity mf : list) { |
| | | String filePath = getFilePath(temp, root, mf); |
| | | |
| | | // å
æ°æ® |
| | |
| | | } |
| | | |
| | | // å
æ°æ®æä»¶ |
| | | MetaFileEntity mfe = createMetaFileEntity(me, mf, filePath); |
| | | if (metaFileService.insert(mfe) > 0) { |
| | | MetaEntity mfe = createMetaFileEntity(me, mf, filePath); |
| | | if (metaService.insert(mfe) > 0) { |
| | | count++; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * è·åæä»¶è·¯å¾ |
| | | */ |
| | | private String getFilePath(String temp, String root, MetaFileEntity mf) { |
| | | private String getFilePath(String temp, String root, MetaEntity mf) { |
| | | // ç§»å¨æä»¶ |
| | | File file = new File(temp + File.separator + mf.getPath()); |
| | | File newFile = new File(root + File.separator + mf.getGuid()); |
| | | |
| | | MetaFileEntity old = metaFileService.selectByGuid(mf.getGuid()); |
| | | MetaEntity old = metaService.selectByGuid(mf.getGuid()); |
| | | |
| | | String filePath = null; |
| | | if (null == old) { |
| | |
| | | /** |
| | | * å建å
æ°æ®å®ä½ |
| | | */ |
| | | private MetaEntity createMetaEntity(MetaEntity entity, MetaFileEntity mf) { |
| | | private MetaEntity createMetaEntity(MetaEntity entity, MetaEntity mf) { |
| | | MetaEntity me = new MetaEntity(); |
| | | me.setDepid(entity.getDepid()); |
| | | me.setDirid(entity.getDirid()); |
| | | me.setVerid(entity.getVerid()); |
| | | me.setType("file"); |
| | | me.setGather(entity.getGather()); |
| | | me.setBatch(entity.getBatch()); |
| | | me.setDescr(entity.getDescr()); |
| | | me.setName(mf.getName()); |
| | | me.setSizes(mf.getSizes()); |
| | | me.setCreateTime(entity.getCreateTime()); |
| | |
| | | /** |
| | | * å建å
æ°æ®æä»¶å®ä½ |
| | | */ |
| | | private MetaFileEntity createMetaFileEntity(MetaEntity me, MetaFileEntity entity, String filePath) { |
| | | MetaFileEntity mfe = new MetaFileEntity(); |
| | | private MetaEntity createMetaFileEntity(MetaEntity me, MetaEntity entity, String filePath) { |
| | | MetaEntity mfe = new MetaEntity(); |
| | | mfe.setName(entity.getName()); |
| | | mfe.setMetaid(me.getId()); |
| | | mfe.setGuid(entity.getGuid()); |
| | |
| | | |
| | | import com.lf.server.entity.ctrl.DownloadReqEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.show.PipelineEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.*; |
| | |
| | | * @param pwd å¯ç |
| | | * @return ä¸è½½æä»¶GUID |
| | | */ |
| | | public String zipFiles(UserEntity ue, List<MetaFileEntity> list, String pwd) throws Exception { |
| | | public String zipFiles(UserEntity ue, List<MetaEntity> list, String pwd) throws Exception { |
| | | rmRepeatMetaFiles(list); |
| | | |
| | | String downloadPath = pathHelper.getDownloadFullPath(); |
| | |
| | | /** |
| | | * ç§»é¤éå¤çå
æ°æ®æä»¶ |
| | | */ |
| | | private void rmRepeatMetaFiles(List<MetaFileEntity> list) { |
| | | private void rmRepeatMetaFiles(List<MetaEntity> list) { |
| | | List<String> guidList = new ArrayList<>(); |
| | | |
| | | int i = 0; |
| | | while (i < list.size()) { |
| | | MetaFileEntity entity = list.get(i); |
| | | MetaEntity entity = list.get(i); |
| | | if (guidList.contains(entity.getGuid())) { |
| | | list.remove(i); |
| | | continue; |
| | |
| | | /** |
| | | * æ·»å å
æ°æ®æä»¶è³Zipå
|
| | | */ |
| | | private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaFileEntity> list) { |
| | | private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) { |
| | | String uploadPath = pathHelper.getConfig().getUploadPath(); |
| | | |
| | | int i = 1; |
| | | for (MetaFileEntity entity : list) { |
| | | for (MetaEntity entity : list) { |
| | | try { |
| | | File file = new File(uploadPath + File.separator + entity.getPath()); |
| | | zip.addFile(file, params); |
| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.data.MetaMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MetaFileEntity> selectMetaFiles(List<Integer> ids) { |
| | | public List<MetaEntity> selectMetaFiles(List<Integer> ids) { |
| | | return metaMapper.selectMetaFiles(ids); |
| | | } |
| | | |
| | |
| | | public Integer updates(List<MetaEntity> list) { |
| | | return metaMapper.updates(list); |
| | | } |
| | | |
| | | public MetaEntity selectByGuid(String guid){ |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.lf.server.service.show; |
| | | |
| | | import com.lf.server.entity.ctrl.ShpRecordEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.helper.FileHelper; |
| | | import com.lf.server.helper.ShpHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public ShpRecordEntity readShpFirstRecord(List<MetaFileEntity> list) { |
| | | public ShpRecordEntity readShpFirstRecord(List<MetaEntity> list) { |
| | | String fileName = null; |
| | | for (MetaFileEntity mf : list) { |
| | | for (MetaEntity mf : list) { |
| | | if (mf.getName().toLowerCase().indexOf(".shp") > -1) { |
| | | fileName = mf.getPath(); |
| | | break; |
| | |
| | | |
| | | import com.lf.server.entity.ctrl.MarkJsonEntity; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.show.MarkEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.*; |
| | |
| | | * @param list ShapeFileæä»¶å表 |
| | | * @return Markå®ä½ç±»éå |
| | | */ |
| | | public List<MarkJsonEntity> readShpForMarks(List<MetaFileEntity> list) { |
| | | public List<MarkJsonEntity> readShpForMarks(List<MetaEntity> list) { |
| | | String fileName = null; |
| | | for (MetaFileEntity mf : list) { |
| | | for (MetaEntity mf : list) { |
| | | if (mf.getName().toLowerCase().indexOf(".shp") > -1) { |
| | | fileName = mf.getPath(); |
| | | break; |
| | |
| | | package com.lf.server.service.show; |
| | | |
| | | import com.lf.server.entity.all.BaseGeoEntity; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.show.PipelineEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.mapper.data.DownloadMapper; |
| | | import com.lf.server.mapper.show.PipelineMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import net.lingala.zip4j.ZipFile; |
| | | import net.lingala.zip4j.model.FileHeader; |
| | | import net.lingala.zip4j.model.ZipParameters; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | |
| | | |
| | | import java.io.File; |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |