| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.ctrl.FmeReqEntity; |
| | | import com.lf.server.entity.ctrl.NameValueEntity; |
| | | import com.lf.server.entity.ctrl.RegisterEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.helper.RestHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private String fmeUrl; |
| | | |
| | | /** |
| | | * 获取任务状态 |
| | | */ |
| | | public Object getTaskStatus(String id, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/get", req) + "&id=" + id; |
| | | |
| | | return RestHelper.getForRest(url, Object.class); |
| | | } |
| | | |
| | | /** |
| | | * 下载质检错误结果 |
| | | */ |
| | | public String getDownloadUrl(String id, HttpServletRequest req) { |
| | | return getUrl("datax/task/downloadResult", req) + "&id=" + id; |
| | | } |
| | | |
| | | /** |
| | | * 1.OSGB检查:.osgb + *倾斜摄影*.xls/.xlsx |
| | | */ |
| | | public void checkOsgb(String path) { |
| | | public String checkOsgb(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A8成果质检_OSGB检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("OSGB检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("DMYX_FBL", fme.imgResolution)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 2.表格数据检查:.xls/.xlsx(排除元数据) |
| | | */ |
| | | public void checkXls() { |
| | | public String checkXls(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A3成果质检_表格数据检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("表格数据检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 3.点云检查:.laz + *激光点云*.xls/.xlsx |
| | | */ |
| | | public void checkLaz() { |
| | | public String checkLaz(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A9成果质检_点云检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("点云检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("LAZ_MD", fme.lazDensity)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 4.高程检查:.tif/.prj/.tfw/.tif.ovr + *地形图*.dwg |
| | | */ |
| | | public void checkDem() { |
| | | public String checkDem(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A6成果质检_高程检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("高程检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("GCZWC", fme.demTolerance)); |
| | | list.add(new NameValueEntity("ChangeRate", fme.demChangeRate)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 5.属性检查:*dlg*.gdb + *地形图*.dwg |
| | | */ |
| | | public void checkAttrs() { |
| | | public String checkAttrs(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A5成果质检_属性检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("属性检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 6.拓扑检查:*地形图*.dwg |
| | | */ |
| | | public void checkTopology() { |
| | | public String checkTopology(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A4成果质检_拓扑检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("拓扑检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("S_MCDRC", fme.tolerance)); |
| | | list.add(new NameValueEntity("S_XCDRC", fme.tolerance)); |
| | | list.add(new NameValueEntity("S_DCDRC", fme.tolerance)); |
| | | list.add(new NameValueEntity("OFFSET_GCD", fme.gcdOffset)); |
| | | list.add(new NameValueEntity("OFFSET_KZD", fme.kzdOffset)); |
| | | list.add(new NameValueEntity("Range_OFFSET", fme.rangeOffset)); |
| | | list.add(new NameValueEntity("XG_MAX", fme.xgMax)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 7.图面整饰检查:.dwg |
| | | */ |
| | | public void checkDecorate() { |
| | | public String checkDecorate(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A10成果质检_图面整饰检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("图面整饰检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("S_XLS", "$(ZJPZWJ)\\质检配置表总.xlsx")); |
| | | list.add(new NameValueEntity("S_XLS2", "D:\\Project\\Data\\LF\\temp\\20230107010101\\文件清单.xlsx")); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 8.原点检查:*剖面图*.dwg |
| | | */ |
| | | public void checkOrigin() { |
| | | public String checkOrigin(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A11成果质检_原点检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("原点检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 9.栅格检查:.tif/.prj/.tfw/.tif.ovr + .xls/.xlsx |
| | | */ |
| | | public void checkDom() { |
| | | public String checkDom(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/A7成果质检_栅格检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("栅格检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("S_CoordinateSystem", fme.coordinateSystem)); |
| | | list.add(new NameValueEntity("DMYX_FBL", fme.imgResolution)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 10.数学基础检查:.shp, .gdb, *元数据*.xls/.xlsx |
| | | */ |
| | | public String checkMath(String taskGuid, String xmmc, String sjzy, String filePath, HttpServletRequest req) { |
| | | public String checkMath(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/B1入库质检_数学基础检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyVals(); |
| | | list.add(new NameValueEntity("_name", taskGuid)); |
| | | list.add(new NameValueEntity("XMMC", xmmc)); |
| | | list.add(new NameValueEntity("SJZY", sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", filePath)); |
| | | List<NameValueEntity> list = getKeyValues("数学基础检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | |
| | | /** |
| | | * 11.元数据检查:*元数据*.xls/.xlsx |
| | | */ |
| | | public void checkMeta() { |
| | | public String checkMeta(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/B5入库质检_元数据检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("元数据检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 12.总质检:.zip/.7z + .xls/.xlsx |
| | | */ |
| | | public String checkMain(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/B0入库质检__总", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("总质检"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("S_WBSBG", fme.wbsPath)); |
| | | list.add(new NameValueEntity("S_DZDK", fme.isDiZai)); |
| | | list.add(new NameValueEntity("DZ_ZLLX", fme.diZaiType)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 13.逻辑一致性检查:.dwg/.xls/.xlsx |
| | | */ |
| | | public String checkLogical(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/B3入库质检_逻辑一致性检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("逻辑一致性检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 14.单项成果完整性检查:.* |
| | | */ |
| | | public String checkSingleIntegrity(FmeReqEntity fme, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/B6入库质检_单项成果完整性检查", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("单项成果完整性检查"); |
| | | list.add(new NameValueEntity("XMMC", fme.xmmc)); |
| | | list.add(new NameValueEntity("SJZY", fme.sjzy)); |
| | | list.add(new NameValueEntity("GCXMYSB", fme.zipPath)); |
| | | list.add(new NameValueEntity("SJFL", fme.sjfl)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * a.表格入库:S_RKBG、dirid、parentid,多个以英文逗号隔开 |
| | | */ |
| | | public String excelLoader(MetaFileEntity meta, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/表格入库", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("表格入库"); |
| | | list.add(new NameValueEntity("S_RKBG", meta.getPath())); |
| | | list.add(new NameValueEntity("COORDSYS", meta.getEpsgCode())); |
| | | list.add(new NameValueEntity("dirid", meta.getName())); |
| | | list.add(new NameValueEntity("depid", meta.getDepcode())); |
| | | list.add(new NameValueEntity("verid", meta.getVerid())); |
| | | list.add(new NameValueEntity("createuser", meta.getCreateUser())); |
| | | list.add(new NameValueEntity("parentid", meta.getEventid())); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * b.CRDS平台交付 |
| | | */ |
| | | public String crdsPackaging(String dirCode, String major, String isCut, HttpServletRequest req) { |
| | | // datax/task/run/CRDS平台交付_测试 |
| | | String url = getUrl("datax/task/run/CRDS平台交付_code测试", req); |
| | | |
| | | List<NameValueEntity> list = getKeyValues("CRDS平台交付"); |
| | | list.add(new NameValueEntity("S_FFXMMC", dirCode)); |
| | | list.add(new NameValueEntity("MBZY", major)); |
| | | list.add(new NameValueEntity("P_WBFW", isCut)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * c.服务注册 |
| | | */ |
| | | public RegisterEntity serverRegister(String name, String serverUri, String type, HttpServletRequest req) { |
| | | String url = getUrl("resource/res/item", req); |
| | | |
| | | RegisterEntity entity = new RegisterEntity(name, serverUri, type); |
| | | |
| | | String resid = RestHelper.postForRest(url, entity); |
| | | entity.setSerialnum(resid); |
| | | |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * d.服务申请 |
| | | */ |
| | | public void serverApply(String id, Integer pubid, HttpServletRequest req) { |
| | | String url = getUrl("resource/res/request", req) + "&resourceid=" + id; |
| | | |
| | | RegisterEntity entity = new RegisterEntity(pubid); |
| | | |
| | | RestHelper.postForRest(url, entity); |
| | | } |
| | | |
| | | /** |
| | | * e.删除资源 |
| | | */ |
| | | public void deleteRes(String id, HttpServletRequest req) { |
| | | String url = getUrl("resource/res/hashid", req) + "&hashid=" + id; |
| | | |
| | | RestHelper.deleteForRest(url); |
| | | } |
| | | |
| | | /** |
| | | * f.计算面积 |
| | | */ |
| | | public String calcArea(String sjfl, String id, String wjlj, HttpServletRequest req) { |
| | | String url = getUrl("datax/task/run/数据占地面积计算", req); |
| | | |
| | | List<NameValueEntity> list = new ArrayList<>(); |
| | | list.add(new NameValueEntity("_name", String.format("%s_%s", "数据占地面积计算", StringHelper.YMDHMS2_FORMAT.format(new Date())))); |
| | | list.add(new NameValueEntity("_terminate_on_error", false)); |
| | | list.add(new NameValueEntity("_priority", 100)); |
| | | list.add(new NameValueEntity("SJFL", sjfl)); |
| | | list.add(new NameValueEntity("ID", id)); |
| | | list.add(new NameValueEntity("WJLJ", wjlj)); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 获取名称值对集合 |
| | | * |
| | | * @return 名称值对集合 |
| | | */ |
| | | public List<NameValueEntity> getKeyVals() { |
| | | public List<NameValueEntity> getKeyValues(String name) { |
| | | List<NameValueEntity> list = new ArrayList<>(); |
| | | list.add(new NameValueEntity("_name", String.format("%s_%s", name, StringHelper.YMDHMS2_FORMAT.format(new Date())))); |
| | | list.add(new NameValueEntity("_priority", 100)); |
| | | list.add(new NameValueEntity("_terminate_on_error", true)); |
| | | list.add(new NameValueEntity("_terminate_on_error", false)); |
| | | list.add(new NameValueEntity("IID", "")); |
| | | list.add(new NameValueEntity("FANOUT_DIR", "$(OrgResultStorage)")); |
| | | list.add(new NameValueEntity("IID_JL", "$(OrgUserStorage)\\质检配置文件\\IID记录表.xlsx")); |
| | | list.add(new NameValueEntity("S_BZPZB", "$(OrgUserStorage)\\质检配置文件\\质检配置表总.xlsx")); |
| | | list.add(new NameValueEntity("S_ZJXZ", "$(OrgUserStorage)\\质检配置文件\\质检细则总.xlsx")); |
| | | list.add(new NameValueEntity("IID_JL", "$(ZJPZWJ)\\IID记录表.xlsx")); |
| | | list.add(new NameValueEntity("S_ZJXZ", "$(ZJPZWJ)\\质检细则总.xlsx")); |
| | | list.add(new NameValueEntity("S_BZPZB", "$(ZJPZWJ)\\质检配置表总.xlsx")); |
| | | |
| | | return list; |
| | | } |