| | |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.ctrl.FmeReqEntity; |
| | | import com.lf.server.entity.ctrl.RegisterEntity; |
| | | import com.lf.server.helper.HttpHelper; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | @GetMapping(value = "/selectServerRegister") |
| | | public ResponseMsg<Object> selectServerRegister(HttpServletRequest req) { |
| | | try { |
| | | String rs = fmeService.serverRegister("西气东输四线天然气管道工程(吐鲁番-中卫)(00116DT02)", "http://127.0.0.1/LFData/2d/tiles/01/{z}/{x}/{y}.png", "DOM", req); |
| | | if (StringHelper.isEmpty(rs)) { |
| | | RegisterEntity rs = fmeService.serverRegister("西气东输四线天然气管道工程(吐鲁番-中卫)(00116DT02)", "http://127.0.0.1/LFData/2d/tiles/01/{z}/{x}/{y}.png", "DOM", req); |
| | | if (null == rs || StringHelper.isEmpty(rs.getSerialnum())) { |
| | | return fail("失败"); |
| | | } |
| | | |
| | |
| | | @ApiImplicitParam(name = "id", value = "服务ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b"), |
| | | @ApiImplicitParam(name = "pubid", value = "发布ID", dataType = "Integer", paramType = "query", example = "1"), |
| | | }) |
| | | @GetMapping(value = "/serverApply") |
| | | public ResponseMsg<Object> serverApply(String id, Integer pubid, HttpServletRequest req) { |
| | | @GetMapping(value = "/selectServerApply") |
| | | public ResponseMsg<Object> selectServerApply(String id, Integer pubid, HttpServletRequest req) { |
| | | try { |
| | | String rs = fmeService.serverApply(id, pubid, req); |
| | | if (StringHelper.isEmpty(rs)) { |
| | | return fail("失败"); |
| | | } |
| | | fmeService.serverApply(id, pubid, req); |
| | | |
| | | return success(rs); |
| | | return success("OK"); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "删除资源") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "服务ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b") |
| | | @ApiImplicitParam(name = "id", value = "服务ID", dataType = "String", paramType = "query", example = "6f4b6783-4b98-4d46-a0d9-43cdb5f339dc") |
| | | }) |
| | | @GetMapping(value = "/deleteRes") |
| | | public ResponseMsg<Object> deleteRes(String id, HttpServletRequest req) { |
| | | @GetMapping(value = "/selectDeleteRes") |
| | | public ResponseMsg<Object> selectDeleteRes(String id, HttpServletRequest req) { |
| | | try { |
| | | fmeService.deleteRes(id, req); |
| | | |
| | |
| | | package com.lf.server.entity.ctrl; |
| | | |
| | | import com.lf.server.helper.StringHelper; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | this.type = type; |
| | | this.description = name; |
| | | this.isrequest = true; |
| | | this.hashid = StringHelper.getGuid(); |
| | | } |
| | | |
| | | public RegisterEntity(Integer pubid) { |
| | | this.reason = "注册"; |
| | | this.serialnum = pubid.toString(); |
| | | } |
| | | |
| | | private List<String> tags; |
| | |
| | | private String description; |
| | | |
| | | private Boolean isrequest; |
| | | |
| | | private String hashid; |
| | | |
| | | private String reason; |
| | | |
| | | private String serialnum; |
| | | |
| | | public List<String> getTags() { |
| | | return tags; |
| | |
| | | public void setIsrequest(Boolean isrequest) { |
| | | this.isrequest = isrequest; |
| | | } |
| | | |
| | | public String getHashid() { |
| | | return hashid; |
| | | } |
| | | |
| | | public void setHashid(String hashid) { |
| | | this.hashid = hashid; |
| | | } |
| | | |
| | | public String getReason() { |
| | | return reason; |
| | | } |
| | | |
| | | public void setReason(String reason) { |
| | | this.reason = reason; |
| | | } |
| | | |
| | | public String getSerialnum() { |
| | | return serialnum; |
| | | } |
| | | |
| | | public void setSerialnum(String serialnum) { |
| | | this.serialnum = serialnum; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 15.服务注册 |
| | | */ |
| | | public String serverRegister(String name, String serverUri, String type, HttpServletRequest req) { |
| | | 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); |
| | | |
| | | return RestHelper.postForRest(url, entity); |
| | | String resid= RestHelper.postForRest(url, entity); |
| | | entity.setSerialnum(resid); |
| | | |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * 16.服务申请 |
| | | */ |
| | | public String serverApply(String id, Integer pubid, HttpServletRequest req) { |
| | | public void 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())); |
| | | RegisterEntity entity = new RegisterEntity(pubid); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | RestHelper.postForRest(url, entity); |
| | | } |
| | | |
| | | /** |