From f7944790f33131633e9007fb5652dd4fe7919fd7 Mon Sep 17 00:00:00 2001 From: chengqf <584883665@139.com> Date: Thu, 13 Apr 2023 06:57:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=9E=E9=80=9A=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../idc/controller/ConnectController.java | 36 +++++++++ .../admin/idc/service/ConnectService.java | 14 ++++ .../idc/service/impl/ConnectServiceImpl.java | 77 +++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/idc/controller/ConnectController.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/idc/service/ConnectService.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/ConnectServiceImpl.java diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/ConnectController.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/ConnectController.java new file mode 100644 index 0000000..2f7d951 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/controller/ConnectController.java @@ -0,0 +1,36 @@ +package com.glxp.sale.admin.idc.controller; + +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import com.glxp.sale.admin.idc.service.ConnectService; +import com.glxp.sale.common.res.BaseResponse; + + + + + +/** + * 中继服务接口 + */ + +@RestController +public class ConnectController { + @Resource + ConnectService connectService; + + @RequestMapping(value = "/spssync/common/connect") + @ResponseBody + public BaseResponse connect(HttpServletRequest request, @RequestBody Map params) { + + return connectService.connectStatus(request,params); + } + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/ConnectService.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/ConnectService.java new file mode 100644 index 0000000..4dab1c1 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/ConnectService.java @@ -0,0 +1,14 @@ +package com.glxp.sale.admin.idc.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.glxp.sale.common.res.BaseResponse; + + +/*连通状态服务*/ +public interface ConnectService { + + BaseResponse connectStatus(HttpServletRequest request,Map params); +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/ConnectServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/ConnectServiceImpl.java new file mode 100644 index 0000000..b2832e5 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/idc/service/impl/ConnectServiceImpl.java @@ -0,0 +1,77 @@ +package com.glxp.sale.admin.idc.service.impl; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.glxp.sale.admin.idc.dao.DbDao; +import com.glxp.sale.admin.idc.service.ConnectService; +import com.glxp.sale.admin.idc.utils.IDCUtils; +import com.glxp.sale.common.res.BaseResponse; +import com.glxp.sale.common.util.ResultVOUtils; + + + +/*连通检测*/ +@Service +public class ConnectServiceImpl implements ConnectService { + private static final Logger logger = LoggerFactory.getLogger(IdcServiceImpl.class); + @Resource + private DbDao dbDao; + private static String NUM_STRS = "⊙①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯"; + //⊙①②③④⑤⑥⑦⑧⑨⑩→⊗ + @Override + public BaseResponse connectStatus(HttpServletRequest request,Map params) { + int level = 0; + if(params.get("level")!=null) { + level = Integer.valueOf(params.get("level").toString()); + } else if(params.get("data")!=null) { + Map data = JSONObject.parseObject(JSON.toJSONString(params.get("data")), Map.class); + if(data.get("level")!=null) { + level = Integer.valueOf(data.get("level").toString()); + } + } + level++; + Map map = new HashMap(); + map.put("level", level); + Map config = new HashMap<>(); + try + { + config = dbDao.get("select * from system_param_config where paramKey='upper_server_ip'"); + } catch (Exception ex) { + + } + String msg = "管理系统"; + for(int i=1;i