Commit ba1565dd authored by 赵啸非's avatar 赵啸非

添加修改终端访问ip

parent 55a6bae7
......@@ -19,5 +19,15 @@ public class SetupProjectVo extends BaseEntityLong {
/** ID,主键,自增长列表 */
private List <Long> idList;
/**
* 终端访问服务端ip,可是局域网也可以是政务外网等
*/
private String clientToServerIp;
/**
* 服务端内部ip,特指内网ip
*/
private String innerServerIp;
}
\ No newline at end of file
package com.mortals.xhx.module.setup.web;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Validator;
import cn.hutool.core.net.Ipv4Util;
import cn.hutool.http.HttpUtil;
import cn.hutool.system.SystemUtil;
import com.alibaba.fastjson.JSON;
......@@ -186,6 +188,59 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
return ret.toJSONString();
}
/**
* 更新终端访问服务端ip地址
*
* @return
*/
@PostMapping("/serverIp/update")
@UnAuth
public String serverIpUpdate(@RequestBody SetupProjectEntity setupProjectEntity) {
JSONObject ret = new JSONObject();
int code = VALUE_RESULT_SUCCESS;
String clientToServerIp = setupProjectEntity.getClientToServerIp();
//String innerServerIp = setupProjectEntity.getInnerServerIp();
try {
boolean ipv4 = Validator.isIpv4(clientToServerIp);
if (!ipv4) {
throw new AppException("请输入正确的ip地址");
}
/*
ipv4 = Validator.isIpv4(innerServerIp);
if (!ipv4) {
throw new AppException("请输入正确的ip地址");
}*/
HashMap<String, Object> params = new HashMap<>();
params.put("serverIp", clientToServerIp);
//更新基础服务
String resp = HttpUtil.get("http://127.0.0.1:11078/base/param/updateServerIp", params);
Rest rest = JSON.parseObject(resp, Rest.class);
if (YesNoEnum.NO.getValue() == rest.getCode()) {
throw new AppException(rest.getMsg());
}
//更新设备管理系统
resp = HttpUtil.get("http://127.0.0.1:11078/fm/param/updateServerIp", params);
rest = JSON.parseObject(resp, Rest.class);
if (YesNoEnum.NO.getValue() == rest.getCode()) {
throw new AppException(rest.getMsg());
}
//更新php 终端访问地址 todo
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
log.error("服务ip更新失败", e);
ret.put(KEY_RESULT_MSG, e.getMessage());
}
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/**
* 更新基础服务子区域
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment