|
@@ -9,6 +9,7 @@ import com.hr.param.IpAccountParam;
|
|
|
import com.hr.param.SwitchStatusParam;
|
|
import com.hr.param.SwitchStatusParam;
|
|
|
import com.hr.repository.domain.IpAccountPO;
|
|
import com.hr.repository.domain.IpAccountPO;
|
|
|
import com.hr.repository.jpa.IpAccountRepository;
|
|
import com.hr.repository.jpa.IpAccountRepository;
|
|
|
|
|
+import com.hr.repository.jpa.IpInterfaceRepository;
|
|
|
import com.hr.service.IpAccountService;
|
|
import com.hr.service.IpAccountService;
|
|
|
import com.hr.util.SnowflakeIdWorker;
|
|
import com.hr.util.SnowflakeIdWorker;
|
|
|
import com.hr.vo.IpAccountVO;
|
|
import com.hr.vo.IpAccountVO;
|
|
@@ -35,6 +36,10 @@ public class IpAccountServiceImpl implements IpAccountService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IpAccountRepository ipAccountRepository;
|
|
private IpAccountRepository ipAccountRepository;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IpInterfaceRepository ipInterfaceRepository;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private static final Cache<String, IpAccountVO> QUERY_CACHE = CacheBuilder.newBuilder()
|
|
private static final Cache<String, IpAccountVO> QUERY_CACHE = CacheBuilder.newBuilder()
|
|
|
.expireAfterWrite(100, TimeUnit.SECONDS)
|
|
.expireAfterWrite(100, TimeUnit.SECONDS)
|
|
|
.build();
|
|
.build();
|
|
@@ -155,6 +160,10 @@ public class IpAccountServiceImpl implements IpAccountService {
|
|
|
*/
|
|
*/
|
|
|
public boolean deleteById(Long id, LoginUser user){
|
|
public boolean deleteById(Long id, LoginUser user){
|
|
|
IpAccountPO ipAccountPO = ipAccountRepository.findById(id).get();
|
|
IpAccountPO ipAccountPO = ipAccountRepository.findById(id).get();
|
|
|
|
|
+ Integer countNum = ipInterfaceRepository.countEnableAccountRef(id);
|
|
|
|
|
+ if(countNum > 0){
|
|
|
|
|
+ throw new RuntimeException("存在激活的接口关联,请先停用关联的接口");
|
|
|
|
|
+ }
|
|
|
ipAccountPO.setStatus("delete");
|
|
ipAccountPO.setStatus("delete");
|
|
|
ipAccountPO.setUpdateTime(new Date());
|
|
ipAccountPO.setUpdateTime(new Date());
|
|
|
ipAccountPO.setUpdateUserId(user.getUserid());
|
|
ipAccountPO.setUpdateUserId(user.getUserid());
|