Commit 7f8cd1c6 authored by 赵啸非's avatar 赵啸非

添加修改终端访问ip

parent f3a67990
update mortals_xhx_setup_project SET siteId=null,siteCode='',siteName='',areaName='',projectStatus=1 update mortals_xhx_setup_project SET siteId=null,siteCode='',siteName='',areaName='',projectStatus=1;
\ No newline at end of file
ALTER TABLE mortals_xhx_setup_project ADD COLUMN `clientToServerIp` varchar(255) COMMENT '终端连接客户端ip' AFTER areaName;
ALTER TABLE mortals_xhx_setup_project ADD COLUMN `clientToServerIpStatus` tinyint(2) DEFAULT '0' COMMENT '终端连接客户端ip更新状态' AFTER areaName;
ALTER TABLE mortals_xhx_setup_project ADD COLUMN `innerServerIp` varchar(255) COMMENT '服务端内部ip' AFTER areaName;
ALTER TABLE mortals_xhx_setup_project ADD COLUMN `innerServerIpStatus` tinyint(2) DEFAULT '0' COMMENT '服务端内部ip更新状态' AFTER areaName;
...@@ -13,18 +13,22 @@ import com.mortals.xhx.base.system.user.service.UserService; ...@@ -13,18 +13,22 @@ import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.ProductDisEnum; import com.mortals.xhx.common.code.ProductDisEnum;
import com.mortals.xhx.common.code.ProjectStatusEnum; import com.mortals.xhx.common.code.ProjectStatusEnum;
import com.mortals.xhx.common.code.ProjectTypeEnum; import com.mortals.xhx.common.code.ProjectTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.ListItem; import com.mortals.xhx.common.pdu.ListItem;
import com.mortals.xhx.common.pdu.NacosResponse; import com.mortals.xhx.common.pdu.NacosResponse;
import com.mortals.xhx.module.setup.model.SetupProjectEntity; import com.mortals.xhx.module.setup.model.SetupProjectEntity;
import com.mortals.xhx.module.setup.model.SetupProjectQuery;
import com.mortals.xhx.module.setup.service.SetupProjectService; import com.mortals.xhx.module.setup.service.SetupProjectService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.io.File; import java.io.File;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
...@@ -42,6 +46,62 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService { ...@@ -42,6 +46,62 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService {
log.info("检测项目运行状态任务"); log.info("检测项目运行状态任务");
setupProjectService.updateProjectsStatus(); setupProjectService.updateProjectsStatus();
log.info("检测项目运行状态任务完毕!"); log.info("检测项目运行状态任务完毕!");
//更新项目服务ip
List<SetupProjectEntity> setupProjectEntities = setupProjectService.find(new SetupProjectQuery().clientToServerIpStatus(YesNoEnum.NO.getValue()));
for (SetupProjectEntity setupProjectEntity : setupProjectEntities) {
if (!ObjectUtils.isEmpty(setupProjectEntity.getClientToServerIp()) && setupProjectEntity.getProjectCode().equals(ProductDisEnum.基础服务后端.getValue())) {
try {
HashMap<String, Object> params = new HashMap<>();
params.put("serverIp", setupProjectEntity.getClientToServerIp());
//更新基础服务
String resp = HttpUtil.get("http://127.0.0.1:11078/base/param/updateServerIp", params);
Rest rest = JSON.parseObject(resp, Rest.class);
if (YesNoEnum.YES.getValue() == rest.getCode()) {
setupProjectEntity.setClientToServerIpStatus(YesNoEnum.YES.getValue());
setupProjectService.update(setupProjectEntity);
}
} catch (Exception e) {
log.info("更新基础项目服务ip失败");
}
}
if (!ObjectUtils.isEmpty(setupProjectEntity.getClientToServerIp()) && setupProjectEntity.getProjectCode().equals(ProductDisEnum.设备管理服务后端.getValue())) {
try {
HashMap<String, Object> params = new HashMap<>();
params.put("serverIp", setupProjectEntity.getClientToServerIp());
//更新基础服务
String resp = HttpUtil.get("http://127.0.0.1:11078/fm/param/updateServerIp", params);
Rest rest = JSON.parseObject(resp, Rest.class);
if (YesNoEnum.YES.getValue() == rest.getCode()) {
setupProjectEntity.setClientToServerIpStatus(YesNoEnum.YES.getValue());
setupProjectService.update(setupProjectEntity);
}
} catch (Exception e) {
log.info("更新设备管理项目服务ip失败");
}
}
if (!ObjectUtils.isEmpty(setupProjectEntity.getClientToServerIp()) && setupProjectEntity.getProjectCode().equals(ProductDisEnum.排号系统PHP后端.getValue())) {
try {
HashMap<String, Object> params = new HashMap<>();
params.put("serverIp", setupProjectEntity.getClientToServerIp());
//更新基础服务
/* String resp = HttpUtil.get("http://127.0.0.1:11078/fm/param/updateServerIp", params);
Rest rest = JSON.parseObject(resp, Rest.class);
if (YesNoEnum.YES.getValue() == rest.getCode()) {
setupProjectEntity.setClientToServerIpStatus(YesNoEnum.YES.getValue());
setupProjectService.update(setupProjectEntity);
}*/
} catch (Exception e) {
log.info("更新排号项目服务ip失败");
}
}
}
} }
......
...@@ -6,16 +6,14 @@ import cn.hutool.core.date.DateUtil; ...@@ -6,16 +6,14 @@ import cn.hutool.core.date.DateUtil;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.module.setup.model.vo.SetupProjectVo; import com.mortals.xhx.module.setup.model.vo.SetupProjectVo;
import lombok.Data; import lombok.Data;
/** /**
* 项目工程信息实体对象 * 项目工程信息实体对象
* *
* @author zxfei * @author zxfei
* @date 2024-10-24 * @date 2025-02-14
*/ */
@Data @Data
public class SetupProjectEntity extends SetupProjectVo { public class SetupProjectEntity extends SetupProjectVo {
...@@ -101,6 +99,22 @@ public class SetupProjectEntity extends SetupProjectVo { ...@@ -101,6 +99,22 @@ public class SetupProjectEntity extends SetupProjectVo {
* 区域名称 * 区域名称
*/ */
private String areaName; private String areaName;
/**
* 终端连接客户端ip
*/
private String clientToServerIp;
/**
* 终端连接客户端ip更新状态
*/
private Integer clientToServerIpStatus;
/**
* 服务端内部ip
*/
private String innerServerIp;
/**
* 服务端内部ip更新状态
*/
private Integer innerServerIpStatus;
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -120,7 +134,7 @@ public class SetupProjectEntity extends SetupProjectVo { ...@@ -120,7 +134,7 @@ public class SetupProjectEntity extends SetupProjectVo {
public void initAttrValue(){ public void initAttrValue(){
this.name = ""; this.name = "";
this.projectCode = ""; this.projectCode = "";
this.projectPath = "/home/publish/"; this.projectPath = "";
this.projectShell = ""; this.projectShell = "";
this.sourceProject = ""; this.sourceProject = "";
this.dbHost = "127.0.0.1"; this.dbHost = "127.0.0.1";
...@@ -138,7 +152,9 @@ public class SetupProjectEntity extends SetupProjectVo { ...@@ -138,7 +152,9 @@ public class SetupProjectEntity extends SetupProjectVo {
this.siteName = ""; this.siteName = "";
this.areaCode = ""; this.areaCode = "";
this.areaName = ""; this.areaName = "";
this.clientToServerIp = "";
this.clientToServerIpStatus = 0;
this.innerServerIp = "";
this.innerServerIpStatus = 0;
} }
} }
\ No newline at end of file
...@@ -15,6 +15,7 @@ import com.mortals.framework.exception.AppException; ...@@ -15,6 +15,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.ProductDisEnum;
import com.mortals.xhx.common.code.ProjectStatusEnum; import com.mortals.xhx.common.code.ProjectStatusEnum;
import com.mortals.xhx.common.code.ProjectTypeEnum; import com.mortals.xhx.common.code.ProjectTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
...@@ -207,6 +208,29 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se ...@@ -207,6 +208,29 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
if (!ipv4) { if (!ipv4) {
throw new AppException("请输入正确的ip地址"); throw new AppException("请输入正确的ip地址");
} }
SetupProjectEntity setupProjectBase = this.service.selectOne(new SetupProjectQuery().projectCode(基础服务后端.getValue()));
if (!ObjectUtils.isEmpty(setupProjectBase)) {
setupProjectBase.setClientToServerIp(clientToServerIp);
setupProjectBase.setClientToServerIpStatus(YesNoEnum.NO.getValue());
this.service.update(setupProjectBase);
}
SetupProjectEntity setupProjectDevice = this.service.selectOne(new SetupProjectQuery().projectCode(设备管理服务后端.getValue()));
if (!ObjectUtils.isEmpty(setupProjectDevice)) {
setupProjectDevice.setClientToServerIp(clientToServerIp);
setupProjectDevice.setClientToServerIpStatus(YesNoEnum.NO.getValue());
this.service.update(setupProjectDevice);
}
SetupProjectEntity setupProjectPHP = this.service.selectOne(new SetupProjectQuery().projectCode(排号系统PHP后端.getValue()));
if (!ObjectUtils.isEmpty(setupProjectPHP)) {
setupProjectPHP.setClientToServerIp(clientToServerIp);
setupProjectPHP.setClientToServerIpStatus(YesNoEnum.NO.getValue());
this.service.update(setupProjectPHP);
}
/* /*
ipv4 = Validator.isIpv4(innerServerIp); ipv4 = Validator.isIpv4(innerServerIp);
if (!ipv4) { if (!ipv4) {
......
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