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.data.MetaFileEntity;
|
import com.lf.server.entity.data.PublishEntity;
|
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;
|
|
/**
|
* FME服务类
|
* @author WWW
|
*/
|
@Service
|
public class FmeService {
|
@Value("${sys.fmeUrl}")
|
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 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 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 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 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 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 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 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 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 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(FmeReqEntity fme, HttpServletRequest req) {
|
String url = getUrl("datax/task/run/B1入库质检_数学基础检查", 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);
|
}
|
|
/**
|
* 11.元数据检查:*元数据*.xls/.xlsx
|
*/
|
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.表格入库: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);
|
}
|
|
/**
|
* 14.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);
|
}
|
|
/**
|
* 服务注册
|
*/
|
public void serverRegiste() {
|
//
|
}
|
|
/**
|
* 服务申请
|
*/
|
public String serverApply(String id, Integer pubid, HttpServletRequest req) {
|
String url = getUrl("resource/res/request", req) + "&resourceid=" + id;
|
|
List<NameValueEntity> list = new ArrayList<>();
|
list.add(new NameValueEntity("reason", "注册"));
|
list.add(new NameValueEntity("serialnum", pubid.toString()));
|
|
return RestHelper.postForRest(url, list);
|
}
|
|
/**
|
* 删除资源
|
*/
|
public void deleteRes(String id, HttpServletRequest req) {
|
String url = getUrl("resource/res/hashid", req) + "&hashid=" + id;
|
|
RestHelper.deleteForRest(url);
|
}
|
|
/**
|
* 获取Url
|
*/
|
public String getUrl(String subUrl, HttpServletRequest req) {
|
String token = WebHelper.getToken(req);
|
|
return fmeUrl + subUrl + "?token=" + token;
|
}
|
|
/**
|
* 获取名称值对集合
|
*/
|
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", false));
|
list.add(new NameValueEntity("IID", ""));
|
list.add(new NameValueEntity("FANOUT_DIR", "$(OrgResultStorage)"));
|
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;
|
}
|
}
|