diff --git a/setup-project-manager/db/add.sql b/setup-project-manager/db/add.sql index b2c0e54d444ae1b4682927e71c624f9a49f11ddd..c39dabed4ee2cd82ef2cb46c6db04ac8b1ebb5e7 100644 --- a/setup-project-manager/db/add.sql +++ b/setup-project-manager/db/add.sql @@ -1 +1,11 @@ -update mortals_xhx_setup_project SET siteId=null,siteCode='',siteName='',areaName='',projectStatus=1 \ No newline at end of file +update mortals_xhx_setup_project SET siteId=null,siteCode='',siteName='',areaName='',projectStatus=1; + + +ALTER TABLE mortals_xhx_setup_project ADD COLUMN `clientToServerIp` varchar(255) COMMENT '缁堢杩炴帴瀹㈡埛绔痠p' AFTER areaName; +ALTER TABLE mortals_xhx_setup_project ADD COLUMN `clientToServerIpStatus` tinyint(2) DEFAULT '0' COMMENT '缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€�' AFTER areaName; + + +ALTER TABLE mortals_xhx_setup_project ADD COLUMN `innerServerIp` varchar(255) COMMENT '鏈嶅姟绔唴閮╥p' AFTER areaName; +ALTER TABLE mortals_xhx_setup_project ADD COLUMN `innerServerIpStatus` tinyint(2) DEFAULT '0' COMMENT '鏈嶅姟绔唴閮╥p鏇存柊鐘舵€�' AFTER areaName; + + diff --git a/setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java b/setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java index 14fc5f369dff07f606d01394cca1e07b358b1839..ad08627e3c886eb78a6e12ae2b682602322c7791 100644 --- a/setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java +++ b/setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java @@ -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.ProjectStatusEnum; 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.NacosResponse; 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 lombok.extern.slf4j.Slf4j; import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; import java.io.File; import java.util.Date; +import java.util.HashMap; import java.util.List; /** @@ -42,6 +46,62 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService { log.info("妫€娴嬮」鐩繍琛岀姸鎬佷换鍔�"); setupProjectService.updateProjectsStatus(); 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澶辫触"); + } + } + + } + + } diff --git a/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectEntity.java b/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectEntity.java index bf0b4c8a506e152389bb99a8ce54ad2eccbe87fb..ad2fb452fa1e538d304f12d161a8ea4cc7ef5b4b 100644 --- a/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectEntity.java +++ b/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectEntity.java @@ -6,16 +6,14 @@ import cn.hutool.core.date.DateUtil; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import com.mortals.framework.annotation.Excel; -import com.mortals.framework.exception.AppException; import com.mortals.framework.model.BaseEntityLong; -import com.mortals.framework.util.ThreadPool; import com.mortals.xhx.module.setup.model.vo.SetupProjectVo; import lombok.Data; /** * 椤圭洰宸ョ▼淇℃伅瀹炰綋瀵硅薄 * * @author zxfei - * @date 2024-10-24 + * @date 2025-02-14 */ @Data public class SetupProjectEntity extends SetupProjectVo { @@ -101,6 +99,22 @@ public class SetupProjectEntity extends SetupProjectVo { * 鍖哄煙鍚嶇О */ private String areaName; + /** + * 缁堢杩炴帴瀹㈡埛绔痠p + */ + private String clientToServerIp; + /** + * 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + */ + private Integer clientToServerIpStatus; + /** + * 鏈嶅姟绔唴閮╥p + */ + private String innerServerIp; + /** + * 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + */ + private Integer innerServerIpStatus; @Override public int hashCode() { return this.getId().hashCode(); @@ -120,7 +134,7 @@ public class SetupProjectEntity extends SetupProjectVo { public void initAttrValue(){ this.name = ""; this.projectCode = ""; - this.projectPath = "/home/publish/"; + this.projectPath = ""; this.projectShell = ""; this.sourceProject = ""; this.dbHost = "127.0.0.1"; @@ -138,7 +152,9 @@ public class SetupProjectEntity extends SetupProjectVo { this.siteName = ""; this.areaCode = ""; this.areaName = ""; + this.clientToServerIp = ""; + this.clientToServerIpStatus = 0; + this.innerServerIp = ""; + this.innerServerIpStatus = 0; } - - } \ No newline at end of file diff --git a/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectQuery.java b/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectQuery.java index e74beeb6556d4f9577b2fce5529221a0d90f7082..f42cd7988d9a827fc480593aeec6d2d36c43b823 100644 --- a/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectQuery.java +++ b/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectQuery.java @@ -6,7 +6,7 @@ import com.mortals.xhx.module.setup.model.SetupProjectEntity; * 椤圭洰宸ョ▼淇℃伅鏌ヨ瀵硅薄 * * @author zxfei - * @date 2024-10-24 + * @date 2025-02-14 */ public class SetupProjectQuery extends SetupProjectEntity { /** 寮€濮� ID,涓婚敭锛岃嚜澧為暱 */ @@ -216,6 +216,46 @@ public class SetupProjectQuery extends SetupProjectEntity { /** 鍖哄煙鍚嶇О鎺掗櫎鍒楄〃 */ private List <String> areaNameNotList; + /** 缁堢杩炴帴瀹㈡埛绔痠p */ + private List<String> clientToServerIpList; + + /** 缁堢杩炴帴瀹㈡埛绔痠p鎺掗櫎鍒楄〃 */ + private List <String> clientToServerIpNotList; + /** 寮€濮� 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� */ + private Integer clientToServerIpStatusStart; + + /** 缁撴潫 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� */ + private Integer clientToServerIpStatusEnd; + + /** 澧炲姞 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� */ + private Integer clientToServerIpStatusIncrement; + + /** 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€佸垪琛� */ + private List <Integer> clientToServerIpStatusList; + + /** 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€佹帓闄ゅ垪琛� */ + private List <Integer> clientToServerIpStatusNotList; + + /** 鏈嶅姟绔唴閮╥p */ + private List<String> innerServerIpList; + + /** 鏈嶅姟绔唴閮╥p鎺掗櫎鍒楄〃 */ + private List <String> innerServerIpNotList; + /** 寮€濮� 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� */ + private Integer innerServerIpStatusStart; + + /** 缁撴潫 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� */ + private Integer innerServerIpStatusEnd; + + /** 澧炲姞 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� */ + private Integer innerServerIpStatusIncrement; + + /** 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€佸垪琛� */ + private List <Integer> innerServerIpStatusList; + + /** 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€佹帓闄ゅ垪琛� */ + private List <Integer> innerServerIpStatusNotList; + /** OR鏉′欢闆嗗悎锛屽垪琛ㄩ」涔嬮棿鏄疧R锛岄」鍐呭涔嬮棿鏄疉ND锛屽锛�(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ private List<SetupProjectQuery> orConditionList; @@ -1431,6 +1471,232 @@ public class SetupProjectQuery extends SetupProjectEntity { this.areaNameNotList = areaNameNotList; } + /** + * 鑾峰彇 缁堢杩炴帴瀹㈡埛绔痠p + * @return clientToServerIpList + */ + public List<String> getClientToServerIpList(){ + return this.clientToServerIpList; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p + * @param clientToServerIpList + */ + public void setClientToServerIpList(List<String> clientToServerIpList){ + this.clientToServerIpList = clientToServerIpList; + } + + /** + * 鑾峰彇 缁堢杩炴帴瀹㈡埛绔痠p + * @return clientToServerIpNotList + */ + public List<String> getClientToServerIpNotList(){ + return this.clientToServerIpNotList; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p + * @param clientToServerIpNotList + */ + public void setClientToServerIpNotList(List<String> clientToServerIpNotList){ + this.clientToServerIpNotList = clientToServerIpNotList; + } + + /** + * 鑾峰彇 寮€濮� 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @return clientToServerIpStatusStart + */ + public Integer getClientToServerIpStatusStart(){ + return this.clientToServerIpStatusStart; + } + + /** + * 璁剧疆 寮€濮� 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusStart + */ + public void setClientToServerIpStatusStart(Integer clientToServerIpStatusStart){ + this.clientToServerIpStatusStart = clientToServerIpStatusStart; + } + + /** + * 鑾峰彇 缁撴潫 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @return $clientToServerIpStatusEnd + */ + public Integer getClientToServerIpStatusEnd(){ + return this.clientToServerIpStatusEnd; + } + + /** + * 璁剧疆 缁撴潫 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusEnd + */ + public void setClientToServerIpStatusEnd(Integer clientToServerIpStatusEnd){ + this.clientToServerIpStatusEnd = clientToServerIpStatusEnd; + } + + /** + * 鑾峰彇 澧炲姞 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @return clientToServerIpStatusIncrement + */ + public Integer getClientToServerIpStatusIncrement(){ + return this.clientToServerIpStatusIncrement; + } + + /** + * 璁剧疆 澧炲姞 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusIncrement + */ + public void setClientToServerIpStatusIncrement(Integer clientToServerIpStatusIncrement){ + this.clientToServerIpStatusIncrement = clientToServerIpStatusIncrement; + } + + /** + * 鑾峰彇 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @return clientToServerIpStatusList + */ + public List<Integer> getClientToServerIpStatusList(){ + return this.clientToServerIpStatusList; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusList + */ + public void setClientToServerIpStatusList(List<Integer> clientToServerIpStatusList){ + this.clientToServerIpStatusList = clientToServerIpStatusList; + } + + /** + * 鑾峰彇 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @return clientToServerIpStatusNotList + */ + public List<Integer> getClientToServerIpStatusNotList(){ + return this.clientToServerIpStatusNotList; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusNotList + */ + public void setClientToServerIpStatusNotList(List<Integer> clientToServerIpStatusNotList){ + this.clientToServerIpStatusNotList = clientToServerIpStatusNotList; + } + + + /** + * 鑾峰彇 鏈嶅姟绔唴閮╥p + * @return innerServerIpList + */ + public List<String> getInnerServerIpList(){ + return this.innerServerIpList; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p + * @param innerServerIpList + */ + public void setInnerServerIpList(List<String> innerServerIpList){ + this.innerServerIpList = innerServerIpList; + } + + /** + * 鑾峰彇 鏈嶅姟绔唴閮╥p + * @return innerServerIpNotList + */ + public List<String> getInnerServerIpNotList(){ + return this.innerServerIpNotList; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p + * @param innerServerIpNotList + */ + public void setInnerServerIpNotList(List<String> innerServerIpNotList){ + this.innerServerIpNotList = innerServerIpNotList; + } + + /** + * 鑾峰彇 寮€濮� 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @return innerServerIpStatusStart + */ + public Integer getInnerServerIpStatusStart(){ + return this.innerServerIpStatusStart; + } + + /** + * 璁剧疆 寮€濮� 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusStart + */ + public void setInnerServerIpStatusStart(Integer innerServerIpStatusStart){ + this.innerServerIpStatusStart = innerServerIpStatusStart; + } + + /** + * 鑾峰彇 缁撴潫 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @return $innerServerIpStatusEnd + */ + public Integer getInnerServerIpStatusEnd(){ + return this.innerServerIpStatusEnd; + } + + /** + * 璁剧疆 缁撴潫 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusEnd + */ + public void setInnerServerIpStatusEnd(Integer innerServerIpStatusEnd){ + this.innerServerIpStatusEnd = innerServerIpStatusEnd; + } + + /** + * 鑾峰彇 澧炲姞 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @return innerServerIpStatusIncrement + */ + public Integer getInnerServerIpStatusIncrement(){ + return this.innerServerIpStatusIncrement; + } + + /** + * 璁剧疆 澧炲姞 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusIncrement + */ + public void setInnerServerIpStatusIncrement(Integer innerServerIpStatusIncrement){ + this.innerServerIpStatusIncrement = innerServerIpStatusIncrement; + } + + /** + * 鑾峰彇 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @return innerServerIpStatusList + */ + public List<Integer> getInnerServerIpStatusList(){ + return this.innerServerIpStatusList; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusList + */ + public void setInnerServerIpStatusList(List<Integer> innerServerIpStatusList){ + this.innerServerIpStatusList = innerServerIpStatusList; + } + + /** + * 鑾峰彇 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @return innerServerIpStatusNotList + */ + public List<Integer> getInnerServerIpStatusNotList(){ + return this.innerServerIpStatusNotList; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusNotList + */ + public void setInnerServerIpStatusNotList(List<Integer> innerServerIpStatusNotList){ + this.innerServerIpStatusNotList = innerServerIpStatusNotList; + } + + /** * 璁剧疆 ID,涓婚敭锛岃嚜澧為暱 * @param id @@ -2153,6 +2419,152 @@ public class SetupProjectQuery extends SetupProjectEntity { return this; } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p + * @param clientToServerIp + */ + public SetupProjectQuery clientToServerIp(String clientToServerIp){ + setClientToServerIp(clientToServerIp); + return this; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p + * @param clientToServerIpList + */ + public SetupProjectQuery clientToServerIpList(List<String> clientToServerIpList){ + this.clientToServerIpList = clientToServerIpList; + return this; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatus + */ + public SetupProjectQuery clientToServerIpStatus(Integer clientToServerIpStatus){ + setClientToServerIpStatus(clientToServerIpStatus); + return this; + } + + /** + * 璁剧疆 寮€濮� 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusStart + */ + public SetupProjectQuery clientToServerIpStatusStart(Integer clientToServerIpStatusStart){ + this.clientToServerIpStatusStart = clientToServerIpStatusStart; + return this; + } + + /** + * 璁剧疆 缁撴潫 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusEnd + */ + public SetupProjectQuery clientToServerIpStatusEnd(Integer clientToServerIpStatusEnd){ + this.clientToServerIpStatusEnd = clientToServerIpStatusEnd; + return this; + } + + /** + * 璁剧疆 澧炲姞 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusIncrement + */ + public SetupProjectQuery clientToServerIpStatusIncrement(Integer clientToServerIpStatusIncrement){ + this.clientToServerIpStatusIncrement = clientToServerIpStatusIncrement; + return this; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusList + */ + public SetupProjectQuery clientToServerIpStatusList(List<Integer> clientToServerIpStatusList){ + this.clientToServerIpStatusList = clientToServerIpStatusList; + return this; + } + + /** + * 璁剧疆 缁堢杩炴帴瀹㈡埛绔痠p鏇存柊鐘舵€� + * @param clientToServerIpStatusNotList + */ + public SetupProjectQuery clientToServerIpStatusNotList(List<Integer> clientToServerIpStatusNotList){ + this.clientToServerIpStatusNotList = clientToServerIpStatusNotList; + return this; + } + + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p + * @param innerServerIp + */ + public SetupProjectQuery innerServerIp(String innerServerIp){ + setInnerServerIp(innerServerIp); + return this; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p + * @param innerServerIpList + */ + public SetupProjectQuery innerServerIpList(List<String> innerServerIpList){ + this.innerServerIpList = innerServerIpList; + return this; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatus + */ + public SetupProjectQuery innerServerIpStatus(Integer innerServerIpStatus){ + setInnerServerIpStatus(innerServerIpStatus); + return this; + } + + /** + * 璁剧疆 寮€濮� 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusStart + */ + public SetupProjectQuery innerServerIpStatusStart(Integer innerServerIpStatusStart){ + this.innerServerIpStatusStart = innerServerIpStatusStart; + return this; + } + + /** + * 璁剧疆 缁撴潫 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusEnd + */ + public SetupProjectQuery innerServerIpStatusEnd(Integer innerServerIpStatusEnd){ + this.innerServerIpStatusEnd = innerServerIpStatusEnd; + return this; + } + + /** + * 璁剧疆 澧炲姞 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusIncrement + */ + public SetupProjectQuery innerServerIpStatusIncrement(Integer innerServerIpStatusIncrement){ + this.innerServerIpStatusIncrement = innerServerIpStatusIncrement; + return this; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusList + */ + public SetupProjectQuery innerServerIpStatusList(List<Integer> innerServerIpStatusList){ + this.innerServerIpStatusList = innerServerIpStatusList; + return this; + } + + /** + * 璁剧疆 鏈嶅姟绔唴閮╥p鏇存柊鐘舵€� + * @param innerServerIpStatusNotList + */ + public SetupProjectQuery innerServerIpStatusNotList(List<Integer> innerServerIpStatusNotList){ + this.innerServerIpStatusNotList = innerServerIpStatusNotList; + return this; + } + /** * 鑾峰彇 OR鏉′欢闆嗗悎锛屽垪琛ㄩ」涔嬮棿鏄疧R锛岄」鍐呭涔嬮棿鏄疉ND锛屽锛�(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * @return orConditionList diff --git a/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java b/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java index 59dbdd77db5f14b3d77d2ba35f5acd05d057817a..d698f8473f17523d71a259b5c72ef4faaaa749a0 100644 --- a/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java +++ b/setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java @@ -15,6 +15,7 @@ import com.mortals.framework.exception.AppException; import com.mortals.framework.model.Context; import com.mortals.framework.model.OrderCol; 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.ProjectTypeEnum; import com.mortals.xhx.common.code.YesNoEnum; @@ -207,6 +208,29 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se if (!ipv4) { 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); if (!ipv4) { diff --git a/setup-project-manager/src/main/resources/sqlmap/module/setup/SetupProjectMapper.xml b/setup-project-manager/src/main/resources/sqlmap/module/setup/SetupProjectMapper.xml index aadb1976c90b1efc6a9688d127221e95d18c4eb9..dea09bd78daf5376ec85aa3b2a143de55bca1a9c 100644 --- a/setup-project-manager/src/main/resources/sqlmap/module/setup/SetupProjectMapper.xml +++ b/setup-project-manager/src/main/resources/sqlmap/module/setup/SetupProjectMapper.xml @@ -32,6 +32,10 @@ <result property="siteName" column="siteName" /> <result property="areaCode" column="areaCode" /> <result property="areaName" column="areaName" /> + <result property="clientToServerIp" column="clientToServerIp" /> + <result property="clientToServerIpStatus" column="clientToServerIpStatus" /> + <result property="innerServerIp" column="innerServerIp" /> + <result property="innerServerIpStatus" column="innerServerIpStatus" /> </resultMap> <!-- 琛ㄦ墍鏈夊垪 --> @@ -118,23 +122,35 @@ <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('areaName') or colPickMode == 1 and data.containsKey('areaName')))"> a.areaName, </if> + <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('clientToServerIp') or colPickMode == 1 and data.containsKey('clientToServerIp')))"> + a.clientToServerIp, + </if> + <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('clientToServerIpStatus') or colPickMode == 1 and data.containsKey('clientToServerIpStatus')))"> + a.clientToServerIpStatus, + </if> + <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('innerServerIp') or colPickMode == 1 and data.containsKey('innerServerIp')))"> + a.innerServerIp, + </if> + <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('innerServerIpStatus') or colPickMode == 1 and data.containsKey('innerServerIpStatus')))"> + a.innerServerIpStatus, + </if> </trim> </sql> <!-- 鏂板 鍖哄垎涓婚敭鑷鍔犺繕鏄笟鍔℃彃鍏� --> <insert id="insert" parameterType="SetupProjectEntity" useGeneratedKeys="true" keyProperty="id"> insert into mortals_xhx_setup_project - (name,projectCode,projectPath,projectShell,sourceProject,dbHost,dbPort,dbUser,dbPassword,dbName,version,projectType,projectStatus,remark,updateTime,updateUser,createTime,createUser,orderNum,updateUserId,createUserId,siteId,siteCode,siteName,areaCode,areaName) + (name,projectCode,projectPath,projectShell,sourceProject,dbHost,dbPort,dbUser,dbPassword,dbName,version,projectType,projectStatus,remark,updateTime,updateUser,createTime,createUser,orderNum,updateUserId,createUserId,siteId,siteCode,siteName,areaCode,areaName,clientToServerIp,clientToServerIpStatus,innerServerIp,innerServerIpStatus) VALUES - (#{name},#{projectCode},#{projectPath},#{projectShell},#{sourceProject},#{dbHost},#{dbPort},#{dbUser},#{dbPassword},#{dbName},#{version},#{projectType},#{projectStatus},#{remark},#{updateTime},#{updateUser},#{createTime},#{createUser},#{orderNum},#{updateUserId},#{createUserId},#{siteId},#{siteCode},#{siteName},#{areaCode},#{areaName}) + (#{name},#{projectCode},#{projectPath},#{projectShell},#{sourceProject},#{dbHost},#{dbPort},#{dbUser},#{dbPassword},#{dbName},#{version},#{projectType},#{projectStatus},#{remark},#{updateTime},#{updateUser},#{createTime},#{createUser},#{orderNum},#{updateUserId},#{createUserId},#{siteId},#{siteCode},#{siteName},#{areaCode},#{areaName},#{clientToServerIp},#{clientToServerIpStatus},#{innerServerIp},#{innerServerIpStatus}) </insert> <!-- 鎵归噺鏂板 --> <insert id="insertBatch" parameterType="paramDto"> insert into mortals_xhx_setup_project - (name,projectCode,projectPath,projectShell,sourceProject,dbHost,dbPort,dbUser,dbPassword,dbName,version,projectType,projectStatus,remark,updateTime,updateUser,createTime,createUser,orderNum,updateUserId,createUserId,siteId,siteCode,siteName,areaCode,areaName) + (name,projectCode,projectPath,projectShell,sourceProject,dbHost,dbPort,dbUser,dbPassword,dbName,version,projectType,projectStatus,remark,updateTime,updateUser,createTime,createUser,orderNum,updateUserId,createUserId,siteId,siteCode,siteName,areaCode,areaName,clientToServerIp,clientToServerIpStatus,innerServerIp,innerServerIpStatus) VALUES <foreach collection="data.dataList" item="item" index="index" separator="," > - (#{item.name},#{item.projectCode},#{item.projectPath},#{item.projectShell},#{item.sourceProject},#{item.dbHost},#{item.dbPort},#{item.dbUser},#{item.dbPassword},#{item.dbName},#{item.version},#{item.projectType},#{item.projectStatus},#{item.remark},#{item.updateTime},#{item.updateUser},#{item.createTime},#{item.createUser},#{item.orderNum},#{item.updateUserId},#{item.createUserId},#{item.siteId},#{item.siteCode},#{item.siteName},#{item.areaCode},#{item.areaName}) + (#{item.name},#{item.projectCode},#{item.projectPath},#{item.projectShell},#{item.sourceProject},#{item.dbHost},#{item.dbPort},#{item.dbUser},#{item.dbPassword},#{item.dbName},#{item.version},#{item.projectType},#{item.projectStatus},#{item.remark},#{item.updateTime},#{item.updateUser},#{item.createTime},#{item.createUser},#{item.orderNum},#{item.updateUserId},#{item.createUserId},#{item.siteId},#{item.siteCode},#{item.siteName},#{item.areaCode},#{item.areaName},#{item.clientToServerIp},#{item.clientToServerIpStatus},#{item.innerServerIp},#{item.innerServerIpStatus}) </foreach> </insert> @@ -240,6 +256,24 @@ <if test="(colPickMode==0 and data.containsKey('areaName')) or (colPickMode==1 and !data.containsKey('areaName'))"> a.areaName=#{data.areaName}, </if> + <if test="(colPickMode==0 and data.containsKey('clientToServerIp')) or (colPickMode==1 and !data.containsKey('clientToServerIp'))"> + a.clientToServerIp=#{data.clientToServerIp}, + </if> + <if test="(colPickMode==0 and data.containsKey('clientToServerIpStatus')) or (colPickMode==1 and !data.containsKey('clientToServerIpStatus'))"> + a.clientToServerIpStatus=#{data.clientToServerIpStatus}, + </if> + <if test="(colPickMode==0 and data.containsKey('clientToServerIpStatusIncrement')) or (colPickMode==1 and !data.containsKey('clientToServerIpStatusIncrement'))"> + a.clientToServerIpStatus=ifnull(a.clientToServerIpStatus,0) + #{data.clientToServerIpStatusIncrement}, + </if> + <if test="(colPickMode==0 and data.containsKey('innerServerIp')) or (colPickMode==1 and !data.containsKey('innerServerIp'))"> + a.innerServerIp=#{data.innerServerIp}, + </if> + <if test="(colPickMode==0 and data.containsKey('innerServerIpStatus')) or (colPickMode==1 and !data.containsKey('innerServerIpStatus'))"> + a.innerServerIpStatus=#{data.innerServerIpStatus}, + </if> + <if test="(colPickMode==0 and data.containsKey('innerServerIpStatusIncrement')) or (colPickMode==1 and !data.containsKey('innerServerIpStatusIncrement'))"> + a.innerServerIpStatus=ifnull(a.innerServerIpStatus,0) + #{data.innerServerIpStatusIncrement}, + </if> </trim> <trim suffixOverrides="where" suffix=""> where @@ -464,6 +498,44 @@ </if> </foreach> </trim> + <trim prefix="clientToServerIp=(case" suffix="ELSE clientToServerIp end),"> + <foreach collection="data.dataList" item="item" index="index" separator="" > + <if test="(colPickMode==0 and item.containsKey('clientToServerIp')) or (colPickMode==1 and !item.containsKey('clientToServerIp'))"> + when a.id=#{item.id} then #{item.clientToServerIp} + </if> + </foreach> + </trim> + <trim prefix="clientToServerIpStatus=(case" suffix="ELSE clientToServerIpStatus end),"> + <foreach collection="data.dataList" item="item" index="index" separator="" > + <choose> + <when test="(colPickMode==0 and item.containsKey('clientToServerIpStatus')) or (colPickMode==1 and !item.containsKey('clientToServerIpStatus'))"> + when a.id=#{item.id} then #{item.clientToServerIpStatus} + </when> + <when test="(colPickMode==0 and item.containsKey('clientToServerIpStatusIncrement')) or (colPickMode==1 and !item.containsKey('clientToServerIpStatusIncrement'))"> + when a.id=#{item.id} then ifnull(a.clientToServerIpStatus,0) + #{item.clientToServerIpStatusIncrement} + </when> + </choose> + </foreach> + </trim> + <trim prefix="innerServerIp=(case" suffix="ELSE innerServerIp end),"> + <foreach collection="data.dataList" item="item" index="index" separator="" > + <if test="(colPickMode==0 and item.containsKey('innerServerIp')) or (colPickMode==1 and !item.containsKey('innerServerIp'))"> + when a.id=#{item.id} then #{item.innerServerIp} + </if> + </foreach> + </trim> + <trim prefix="innerServerIpStatus=(case" suffix="ELSE innerServerIpStatus end),"> + <foreach collection="data.dataList" item="item" index="index" separator="" > + <choose> + <when test="(colPickMode==0 and item.containsKey('innerServerIpStatus')) or (colPickMode==1 and !item.containsKey('innerServerIpStatus'))"> + when a.id=#{item.id} then #{item.innerServerIpStatus} + </when> + <when test="(colPickMode==0 and item.containsKey('innerServerIpStatusIncrement')) or (colPickMode==1 and !item.containsKey('innerServerIpStatusIncrement'))"> + when a.id=#{item.id} then ifnull(a.innerServerIpStatus,0) + #{item.innerServerIpStatusIncrement} + </when> + </choose> + </foreach> + </trim> </trim> where id in <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> @@ -1181,6 +1253,102 @@ #{item} </foreach> </if> + + <if test="conditionParamRef.containsKey('clientToServerIp')"> + <if test="conditionParamRef.clientToServerIp != null and conditionParamRef.clientToServerIp != ''"> + ${_conditionType_} a.clientToServerIp like #{${_conditionParam_}.clientToServerIp} + </if> + <if test="conditionParamRef.clientToServerIp == null"> + ${_conditionType_} a.clientToServerIp is null + </if> + </if> + <if test="conditionParamRef.containsKey('clientToServerIpList') and conditionParamRef.clientToServerIpList.size() > 0"> + ${_conditionType_} a.clientToServerIp in + <foreach collection="conditionParamRef.clientToServerIpList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('clientToServerIpNotList') and conditionParamRef.clientToServerIpNotList.size() > 0"> + ${_conditionType_} a.clientToServerIp not in + <foreach collection="conditionParamRef.clientToServerIpNotList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('clientToServerIpStatus')"> + <if test="conditionParamRef.clientToServerIpStatus != null "> + ${_conditionType_} a.clientToServerIpStatus = #{${_conditionParam_}.clientToServerIpStatus} + </if> + <if test="conditionParamRef.clientToServerIpStatus == null"> + ${_conditionType_} a.clientToServerIpStatus is null + </if> + </if> + <if test="conditionParamRef.containsKey('clientToServerIpStatusList') and conditionParamRef.clientToServerIpStatusList.size() > 0"> + ${_conditionType_} a.clientToServerIpStatus in + <foreach collection="conditionParamRef.clientToServerIpStatusList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('clientToServerIpStatusNotList') and conditionParamRef.clientToServerIpStatusNotList.size() > 0"> + ${_conditionType_} a.clientToServerIpStatus not in + <foreach collection="conditionParamRef.clientToServerIpStatusNotList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('clientToServerIpStatusStart') and conditionParamRef.clientToServerIpStatusStart != null"> + ${_conditionType_} a.clientToServerIpStatus <![CDATA[ >= ]]> #{${_conditionParam_}.clientToServerIpStatusStart} + </if> + <if test="conditionParamRef.containsKey('clientToServerIpStatusEnd') and conditionParamRef.clientToServerIpStatusEnd != null"> + ${_conditionType_} a.clientToServerIpStatus <![CDATA[ <= ]]> #{${_conditionParam_}.clientToServerIpStatusEnd} + </if> + + + <if test="conditionParamRef.containsKey('innerServerIp')"> + <if test="conditionParamRef.innerServerIp != null and conditionParamRef.innerServerIp != ''"> + ${_conditionType_} a.innerServerIp like #{${_conditionParam_}.innerServerIp} + </if> + <if test="conditionParamRef.innerServerIp == null"> + ${_conditionType_} a.innerServerIp is null + </if> + </if> + <if test="conditionParamRef.containsKey('innerServerIpList') and conditionParamRef.innerServerIpList.size() > 0"> + ${_conditionType_} a.innerServerIp in + <foreach collection="conditionParamRef.innerServerIpList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('innerServerIpNotList') and conditionParamRef.innerServerIpNotList.size() > 0"> + ${_conditionType_} a.innerServerIp not in + <foreach collection="conditionParamRef.innerServerIpNotList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('innerServerIpStatus')"> + <if test="conditionParamRef.innerServerIpStatus != null "> + ${_conditionType_} a.innerServerIpStatus = #{${_conditionParam_}.innerServerIpStatus} + </if> + <if test="conditionParamRef.innerServerIpStatus == null"> + ${_conditionType_} a.innerServerIpStatus is null + </if> + </if> + <if test="conditionParamRef.containsKey('innerServerIpStatusList') and conditionParamRef.innerServerIpStatusList.size() > 0"> + ${_conditionType_} a.innerServerIpStatus in + <foreach collection="conditionParamRef.innerServerIpStatusList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('innerServerIpStatusNotList') and conditionParamRef.innerServerIpStatusNotList.size() > 0"> + ${_conditionType_} a.innerServerIpStatus not in + <foreach collection="conditionParamRef.innerServerIpStatusNotList" open="(" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + </if> + <if test="conditionParamRef.containsKey('innerServerIpStatusStart') and conditionParamRef.innerServerIpStatusStart != null"> + ${_conditionType_} a.innerServerIpStatus <![CDATA[ >= ]]> #{${_conditionParam_}.innerServerIpStatusStart} + </if> + <if test="conditionParamRef.containsKey('innerServerIpStatusEnd') and conditionParamRef.innerServerIpStatusEnd != null"> + ${_conditionType_} a.innerServerIpStatus <![CDATA[ <= ]]> #{${_conditionParam_}.innerServerIpStatusEnd} + </if> + </sql> <sql id="_orderCols_"> <if test="orderColList != null and !orderColList.isEmpty()"> @@ -1234,6 +1402,20 @@ </foreach> , </if> + <if test="conditionParamRef.containsKey('clientToServerIpStatusList') and conditionParamRef.clientToServerIpStatusList.size() > 0"> + field(a.clientToServerIpStatus, + <foreach collection="conditionParamRef.clientToServerIpStatusList" open="" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + , + </if> + <if test="conditionParamRef.containsKey('innerServerIpStatusList') and conditionParamRef.innerServerIpStatusList.size() > 0"> + field(a.innerServerIpStatus, + <foreach collection="conditionParamRef.innerServerIpStatusList" open="" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + , + </if> <trim suffixOverrides="," suffix=""> <foreach collection="orderColList" open="" close="" index="index" item="item" separator=","> a.${item.colName} ${item.sortKind} @@ -1291,6 +1473,20 @@ </foreach> , </if> + <if test="conditionParamRef.containsKey('clientToServerIpStatusList') and conditionParamRef.clientToServerIpStatusList.size() > 0"> + field(a.clientToServerIpStatus, + <foreach collection="conditionParamRef.clientToServerIpStatusList" open="" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + , + </if> + <if test="conditionParamRef.containsKey('innerServerIpStatusList') and conditionParamRef.innerServerIpStatusList.size() > 0"> + field(a.innerServerIpStatus, + <foreach collection="conditionParamRef.innerServerIpStatusList" open="" close=")" index="index" item="item" separator=","> + #{item} + </foreach> + , + </if> <trim suffixOverrides="," suffix=""> <if test="orderCol.containsKey('id')"> a.id @@ -1427,6 +1623,26 @@ <if test='orderCol.areaName != null and "DESC".equalsIgnoreCase(orderCol.areaName)'>DESC</if> , </if> + <if test="orderCol.containsKey('clientToServerIp')"> + a.clientToServerIp + <if test='orderCol.clientToServerIp != null and "DESC".equalsIgnoreCase(orderCol.clientToServerIp)'>DESC</if> + , + </if> + <if test="orderCol.containsKey('clientToServerIpStatus')"> + a.clientToServerIpStatus + <if test='orderCol.clientToServerIpStatus != null and "DESC".equalsIgnoreCase(orderCol.clientToServerIpStatus)'>DESC</if> + , + </if> + <if test="orderCol.containsKey('innerServerIp')"> + a.innerServerIp + <if test='orderCol.innerServerIp != null and "DESC".equalsIgnoreCase(orderCol.innerServerIp)'>DESC</if> + , + </if> + <if test="orderCol.containsKey('innerServerIpStatus')"> + a.innerServerIpStatus + <if test='orderCol.innerServerIpStatus != null and "DESC".equalsIgnoreCase(orderCol.innerServerIpStatus)'>DESC</if> + , + </if> </trim> </if>