2023年10月27日 修复问题
This commit is contained in:
parent
e3405ff747
commit
9f72f902c0
|
@ -115,6 +115,73 @@ public class httpController extends JeecgController<TBks, ITBksService> {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "对外部访问接口-通过jsbh访问奥威亚接口")
|
||||||
|
@ApiOperation(value="对外部访问接口-通过jsbh访问奥威亚接口", notes="对外部访问接口-通过jsbh访问奥威亚接口")
|
||||||
|
@GetMapping(value = "/runAvyApiByJsbhs")
|
||||||
|
public Result<?> runAvyApiByJsbhs(String jsbhs,String type){
|
||||||
|
Result<List<Map<String,String>>> res = Result.OK("操作成功");
|
||||||
|
List<Map<String,String>> resultList = Lists.newArrayList();
|
||||||
|
res.setResult(resultList);
|
||||||
|
if(StringUtils.isNotBlank(jsbhs)){
|
||||||
|
List<String> jsbhList = Arrays.asList(jsbhs.split(","));
|
||||||
|
QueryWrapper<KcZhihuijiaoshi> qw = new QueryWrapper<>();
|
||||||
|
qw.in("jsbh",jsbhList);
|
||||||
|
qw.eq("xm","教师近景");
|
||||||
|
List<KcZhihuijiaoshi> list = kcZhihuijiaoshiService.list(qw);
|
||||||
|
|
||||||
|
list.forEach(x -> {
|
||||||
|
KcZhihuijiaoshiOperateLog operateLog = new KcZhihuijiaoshiOperateLog();
|
||||||
|
//访问。汇总结果
|
||||||
|
//http://${ip}/cgi-bin/plat.cgi?action=9&user=${user}&pwsd=${getMd5Str(pwd)}&command=1
|
||||||
|
String hex = Convert.toHex("live_setParam_enable=" + type, 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<String,String> rm = Maps.newHashMap();
|
||||||
|
resultList.add(rm);
|
||||||
|
rm.put("xm",x.getXm());
|
||||||
|
rm.put("jsmc",x.getJsmc());
|
||||||
|
rm.put("url",buildUrl);
|
||||||
|
operateLog.setOperateUrl(buildUrl);//操作URL
|
||||||
|
operateLog.setJxlId(x.getJxlId());//教学楼ID
|
||||||
|
operateLog.setJxlName(x.getJxlName());//教学楼名称
|
||||||
|
operateLog.setJsbh(x.getJsbh());//教室编号
|
||||||
|
operateLog.setJsmc(x.getJsmc());//教室名称
|
||||||
|
operateLog.setOperateType(type);//操作类型(打开还是关闭)
|
||||||
|
operateLog.setLogType(2);//日志类型
|
||||||
|
operateLog.setOperateResultType("0");//调用成功还是失败
|
||||||
|
try{
|
||||||
|
String resText = HttpUtil.get(buildUrl);
|
||||||
|
log.info("奥威亚返回接口内容:" + resText);//live_setParam_ret=ok
|
||||||
|
rm.put("resText",resText);
|
||||||
|
operateLog.setOperateResult(resText);
|
||||||
|
// res.setResult(rm);
|
||||||
|
} catch (Exception e){
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
rm.put("resText",e.getMessage());
|
||||||
|
operateLog.setOperateResultType("1");
|
||||||
|
operateLog.setOperateResult(e.getMessage());
|
||||||
|
// res.setResult(rm);
|
||||||
|
}finally {
|
||||||
|
kcZhihuijiaoshiOperateLogService.save(operateLog);
|
||||||
|
}
|
||||||
|
//解析,决定最后返回结果
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
return Result.ok("操作失败");
|
||||||
|
}
|
||||||
|
//URL url = new URL("www.hutool.cn")
|
||||||
|
return res;
|
||||||
|
}
|
||||||
public static void main(String[] args) {
|
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=1", CharsetUtil.CHARSET_UTF_8);//开始
|
||||||
//String hex = Convert.toHex("live_setParam_enable=0", CharsetUtil.CHARSET_UTF_8);//停止
|
//String hex = Convert.toHex("live_setParam_enable=0", CharsetUtil.CHARSET_UTF_8);//停止
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
|
||||||
Set<String> nextKcJieciSet = Sets.newHashSet();
|
Set<String> nextKcJieciSet = Sets.newHashSet();
|
||||||
kcJieciList.forEach(x -> {
|
kcJieciList.forEach(x -> {
|
||||||
JieciIntTime jieciIntTime = new JieciIntTime();
|
JieciIntTime jieciIntTime = new JieciIntTime();
|
||||||
jieciIntTime.setKsTime(Integer.parseInt(x.getHhks()));
|
jieciIntTime.setKsTime(Integer.parseInt(x.getHhks())+30);//提前30分钟
|
||||||
jieciIntTime.setJsTime(Integer.parseInt(x.getHhjs()));
|
jieciIntTime.setJsTime(Integer.parseInt(x.getHhjs()));
|
||||||
|
|
||||||
if(jieciIntTime.getKsTime() <= nowTimeNum && nowTimeNum <= jieciIntTime.getJsTime()){
|
if(jieciIntTime.getKsTime() <= nowTimeNum && nowTimeNum <= jieciIntTime.getJsTime()){
|
||||||
|
|
Loading…
Reference in New Issue