| | |
| | | |
| | | import com.ard.common.utils.uuid.IdUtils; |
| | | import com.ard.work.component.forest.TyClient; |
| | | import com.ard.work.component.netty.TyTcpClientManager; |
| | | import com.ard.work.domain.cache.TyTcpServerCache; |
| | | import com.ard.work.domain.dto.TokenDTO; |
| | | import com.ard.work.domain.entity.ArdServerInfo; |
| | | import com.ard.work.domain.receiver.AccessTokenReceiver; |
| | |
| | | private ArdServerInfoMapper ardServerInfoMapper; |
| | | @Resource |
| | | private TyClient tyClient; |
| | | @Resource |
| | | private TyTcpClientManager tyTcpClientManager; |
| | | |
| | | /** |
| | | * 查询服务器管理 |
| | |
| | | @Override |
| | | public int insertArdServerManagement(ArdServerInfo ardServerInfo) { |
| | | ardServerInfo.setId(IdUtils.fastUUID()); |
| | | return ardServerInfoMapper.insertArdServerManagement(ardServerInfo); |
| | | int i = ardServerInfoMapper.insertArdServerManagement(ardServerInfo); |
| | | if (i > 0) { |
| | | tyTcpClientManager.connectServer(ardServerInfo); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int updateArdServerManagement(ArdServerInfo ardServerInfo) { |
| | | return ardServerInfoMapper.updateArdServerManagement(ardServerInfo); |
| | | int i = ardServerInfoMapper.updateArdServerManagement(ardServerInfo); |
| | | if (i > 0) { |
| | | tyTcpClientManager.connectServer(ardServerInfo); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int deleteArdServerManagementByIds(String[] ids) { |
| | | return ardServerInfoMapper.deleteArdServerManagementByIds(ids); |
| | | int i = ardServerInfoMapper.deleteArdServerManagementByIds(ids); |
| | | if (i > 0) { |
| | | for (String id : ids) { |
| | | //移除tcp连接 |
| | | tyTcpClientManager.disconnectServer(id); |
| | | } |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |