Bläddra i källkod

数值比较修改

Zhaops 6 år sedan
förälder
incheckning
7780053e6b

+ 3 - 3
diagbotman-service/src/main/java/com/diagbot/facade/ServiceInfoFacade.java

@@ -44,7 +44,7 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
             throw new CommonException(CommonErrorCode.IS_EXISTS,
                     "服务端【" + serviceSaveVO.getName() + "】已存在,不允许重复建立");
         }
-        serviceInfo =new ServiceInfo();
+        serviceInfo = new ServiceInfo();
         serviceInfo.setName(serviceSaveVO.getName());
         serviceInfo.setDescription(serviceSaveVO.getDescription());
         serviceInfo.setType(serviceSaveVO.getType());
@@ -63,7 +63,7 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
      */
     public Boolean updateService(ServiceInfo serviceInfo) {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
-        if (userId != serviceInfo.getUserId()) {
+        if (!userId.equals(serviceInfo.getUserId())) {
             throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "服务端【" + serviceInfo.getName() + "】关联用户与当前登录用户不匹配");
         }
@@ -85,7 +85,7 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
         ServiceInfo serviceInfo = this.getById(serviceId);
         if (serviceInfo == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "服务端不存在");
-        } else if (userId != serviceInfo.getUserId()) {
+        } else if (!userId.equals(serviceInfo.getUserId())) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "服务端【" + serviceInfo.getName() + "】关联用户与当前登录用户不匹配,不允许删除");
         }

+ 2 - 2
user-service/src/main/java/com/diagbot/facade/UserAuthenticationFacade.java

@@ -48,7 +48,7 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
         if (user == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
                     "用户【" + userAuthenticationVO.getUserName() + "】不存在,不允许验证");
-        } else if (user.getId() != userId) {
+        } else if (!userId.equals(user.getId())) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "登录用户【" + user_old.getUsername() + "】与验证用户【" + user.getUsername() + "】不符,不允许验证");
         }
@@ -67,7 +67,7 @@ public class UserAuthenticationFacade extends UserAuthenticationServiceImpl {
         if (organization == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS,
                     "找不到机构【" + userAuthenticationVO.getOrganization() + "】");
-        } else if (organization.getId() != organization_old.getId()) {
+        } else if (!organization.getId().equals(organization_old.getId())) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
                     "当前用户已关联到机构【" + organization_old.getName() + "】,不允许修改机构");
         }