| | |
| | | |
| | | 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.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | public class FmeService { |
| | | @Value("${sys.fmeUrl}") |
| | | private String fmeUrl; |
| | | |
| | | @Value("${sys.fmeToken}") |
| | | private String fmeToken; |
| | | |
| | | private final static Log log = LogFactory.getLog(FmeService.class); |
| | | |
| | | /** |
| | | * 获取任务状态 |
| | |
| | | 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.polyTolerance)); |
| | | list.add(new NameValueEntity("S_XCDRC", fme.lineTolerance)); |
| | | list.add(new NameValueEntity("S_DCDRC", fme.pointTolerance)); |
| | | 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)); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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) { |
| | | try { |
| | | String url = getUrl("resource/res/request", req) + "&resourceid=" + id; |
| | | |
| | | RegisterEntity entity = new RegisterEntity(pubid); |
| | | |
| | | RestHelper.postForRest(url, entity); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 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) { |
| | | String url = getUrl("datax/task/run/数据占地面积计算"); |
| | | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 获取Url |
| | | */ |
| | | public String getUrl(String subUrl, HttpServletRequest req) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取Url |
| | | */ |
| | | public String getUrl(String subUrl) { |
| | | return fmeUrl + subUrl + "?token=" + fmeToken; |
| | | } |
| | | |
| | | /** |
| | | * 获取名称值对集合 |
| | | */ |
| | | public List<NameValueEntity> getKeyValues(String name) { |