diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/httpinterface/controller/httpController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/httpinterface/controller/httpController.java index 84979c15..ac7df41b 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/httpinterface/controller/httpController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/httpinterface/controller/httpController.java @@ -5,10 +5,12 @@ import cn.hutool.core.net.url.UrlBuilder; import cn.hutool.core.util.CharsetUtil; import cn.hutool.crypto.SecureUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.google.common.collect.Maps; import com.xkcoding.http.HttpUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; @@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController; import java.util.Arrays; import java.util.List; +import java.util.Map; /** * @Description: 对外部访问接口 @@ -44,6 +47,9 @@ public class httpController extends JeecgController { @ApiOperation(value="T_BKS-抓取-通过id查询", notes="T_BKS-抓取-通过id查询") @GetMapping(value = "/runAvyApiByIds") public Result runAvyApiByIds(String ids,String type){ + Result res = Result.OK("操作成功"); + List> resultList = Lists.newArrayList(); + res.setResult(resultList); if(StringUtils.isNotBlank(ids)){ List idList = Arrays.asList(ids.split(",")); QueryWrapper qw = new QueryWrapper<>(); @@ -66,12 +72,20 @@ public class httpController extends JeecgController { .addQuery("data", hex) .build(); log.info("访问奥威亚接口地址"+buildUrl); + Map rm = Maps.newHashMap(); + resultList.add(rm); + rm.put("xm",x.getXm()); + rm.put("jsmc",x.getJsmc()); + rm.put("url",buildUrl); try{ - - String res = HttpUtil.get(buildUrl); - log.info("奥威亚返回接口内容:" + res);//live_setParam_ret=ok + String resText = HttpUtil.get(buildUrl); + log.info("奥威亚返回接口内容:" + resText);//live_setParam_ret=ok + rm.put("resText",resText); +// res.setResult(rm); } catch (Exception e){ log.error(e.getMessage(),e); + rm.put("resText",e.getMessage()); +// res.setResult(rm); } //解析,决定最后返回结果 }); @@ -79,20 +93,23 @@ public class httpController extends JeecgController { return Result.ok("操作失败"); } //URL url = new URL("www.hutool.cn") - return Result.ok("操作成功"); + return res; } public static void main(String[] args) { String hex = Convert.toHex("live_setParam_enable=1", CharsetUtil.CHARSET_UTF_8);//开始 //String hex = Convert.toHex("live_setParam_enable=0", CharsetUtil.CHARSET_UTF_8);//停止 + String ip = "10.68.100.46"; + String user = "admin"; + String pwd = "admin"; String buildUrl = UrlBuilder.create() .setScheme("http") - .setHost("10.68.100.2") + .setHost(ip) .addPath("/cgi-bin") .addPath("/plat.cgi") .addQuery("action", "9") - .addQuery("user", "admin") - .addQuery("pwsd", SecureUtil.md5("admin")) + .addQuery("user", user) + .addQuery("pwsd", SecureUtil.md5(pwd)) .addQuery("command", "1") .addQuery("data", hex) .build(); diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java index 8b5fd6a6..2b22686d 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java @@ -1,5 +1,9 @@ package org.jeecg.modules.kc.grab.SynchronizationService; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.net.url.UrlBuilder; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.crypto.SecureUtil; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.beust.jcommander.internal.Sets; import com.google.common.collect.Maps; @@ -53,6 +57,37 @@ public class RefreshLiveServer extends BaseSync { // liveOnMap.put(x.getId(),false); outList.add(x.getId()); log.error(e.getMessage(),e); + //打开推送开关 + //访问。汇总结果 + //http://${ip}/cgi-bin/plat.cgi?action=9&user=${user}&pwsd=${getMd5Str(pwd)}&command=1 + String hex = Convert.toHex("live_setParam_enable=1", CharsetUtil.CHARSET_UTF_8); + String buildUrl = UrlBuilder.create() + .setScheme("http") + .setHost(x.getIp()) + .addPath("/cgi-bin") + .addPath("/plat.cgi") + .addQuery("action", "9") + .addQuery("user", x.getUser()) + .addQuery("pwsd", SecureUtil.md5(x.getMima())) + .addQuery("command", "1") + .addQuery("data", hex) + .build(); + log.info("访问奥威亚接口地址"+buildUrl); + Map rm = Maps.newHashMap(); + rm.put("xm",x.getXm()); + rm.put("jsmc",x.getJsmc()); + rm.put("url",buildUrl); + try{ + String resText = HttpUtil.get(buildUrl); + log.info("奥威亚返回接口内容:" + resText);//live_setParam_ret=ok + rm.put("resText",resText); +// res.setResult(rm); + } catch (Exception e2){ + log.error(e2.getMessage(),e2); + rm.put("resText",e2.getMessage()); +// res.setResult(rm); + } + } }); if(!onList.isEmpty()){