Browse Source

BUG修复

yingp 6 years ago
parent
commit
f691bf7022

+ 2 - 1
db/app-schema.sql

@@ -17,7 +17,8 @@ android_widget varchar(100) comment 'android控件',
 ios_widget varchar(100) comment 'ios控件',
 web_url varchar(300) comment '网页',
 scope_platform int default 0 comment '专属平台的应用 0 -ALL',
-scope_company_id bigint comment '专属企业的应用'
+scope_company_id bigint comment '专属企业的应用',
+company_relate int comment '与公司相关的类型 0 - COMPANY_OR_PERSONAL'
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应用组';
 
 create table if not exists `app_company`

+ 1 - 1
db/home-schema.sql

@@ -15,6 +15,6 @@ company_relate int comment '与公司相关的类型 0 - COMPANY_OR_PERSONAL'
 
 create table if not exists `home_company`
 (
-account_id bigint not null,
+config_id int not null,
 company_id bigint not null
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='企业绑定个人主页配置';

+ 1 - 1
db/message-schema.sql

@@ -16,7 +16,7 @@ company_relate int comment '与公司相关的类型 0 - COMPANY_OR_PERSONAL'
 
 create table if not exists `message_company`
 (
-account_id bigint not null,
+config_id int not null,
 company_id bigint not null
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='企业绑定消息配置';
 

+ 18 - 3
runtime/mobile-grpc-server/src/test/java/com/usoftchina/uu/mobile/grpc/test/MobileAccountServiceTest.java

@@ -30,7 +30,7 @@ public class MobileAccountServiceTest extends AbstractGRpcServerTest {
     public void testA_signin() {
         try {
             AccountSigninResponse response = accountServiceBlockingStub.signin(AccountSigninRequest.newBuilder()
-                    .setMobile("15018524229")
+                    .setMobile("13798490565")
                     .setPassword("111111")
                     .setDeviceInfo(DeviceInfo.newBuilder()
                             .setOs(DeviceInfo.OS.ANDROID))
@@ -96,15 +96,30 @@ public class MobileAccountServiceTest extends AbstractGRpcServerTest {
 
     @Test
     public void testC_switchCompany() {
-        Authentication.set("IivkR1tkBV4Ev4Qhmb0BoFMfZHh92E3y");
+        Authentication.set("tCENvFUmQaJ4bRnFnQlAR5es53RxkNXZ");
         SwitchCompanyRequest request = SwitchCompanyRequest.newBuilder()
-                .setCompanyId(10050540).build();
+                .setCompanyId(10050506).build();
         try {
             SwitchCompanyResponse response = accountServiceBlockingStub.switchCompany(request);
             ResponseHeader header = response.getResponseHeader();
             if (header.getSuccess()) {
                 // new authentication
                 System.out.println(response.getAuthedToken());
+                if (response.getMessageConfigCount() > 0) {
+                    response.getMessageConfigList().forEach(System.out::println);
+                }
+                if (response.getAppGroupConfigCount() > 0) {
+                    response.getAppGroupConfigList().forEach(appGroupConfig -> {
+                        System.out.println(appGroupConfig.getName());
+                        appGroupConfig.getAppConfigList().forEach(System.out::println);
+                    });
+                }
+                if (response.getHomeConfigCount() > 0) {
+                    response.getHomeConfigList().forEach(System.out::println);
+                }
+                if (response.getUnreadMessageCountCount() > 0) {
+                    response.getUnreadMessageCountList().forEach(System.out::println);
+                }
             } else {
                 // error return by ResponseHeader
                 System.err.println(header.getCode() + "," + header.getMessage());

+ 1 - 1
services/home-service/src/main/resources/mapper/HomeConfigMapper.xml

@@ -293,7 +293,7 @@
         home_config.scope_company_id=#{scopeCompanyId,jdbcType=BIGINT}) order by home_config.order_num
     </select>
     <select id="selectEnabledByScopeCompanyId" resultMap="BaseResultMap" parameterType="java.lang.Long">
-        select home_config.* from home_config,home_company where home_config.id=home_config.config_id
+        select home_config.* from home_config,home_company where home_config.id=home_company.config_id
         and home_company.company_id=#{scopeCompanyId,jdbcType=BIGINT} and
         (home_config.scope_company_id is null or home_config.scope_company_id=#{scopeCompanyId,jdbcType=BIGINT})
         order by home_config.order_num

+ 2 - 0
services/mobile-grpc-service/src/main/java/com/usoftchina/uu/mobile/grpc/service/impl/MobileAccountServiceImpl.java

@@ -217,6 +217,8 @@ public class MobileAccountServiceImpl extends AccountServiceGrpc.AccountServiceI
 
                 builder.setResponseHeader(ResponseUtils.success())
                         .setAuthedToken(token);
+            } else {
+                builder.setResponseHeader(ResponseUtils.error(ExceptionCode.COMPANY_NOT_BIND.asBizException()));
             }
         } catch (Exception e) {
             logger.error("switchCompany error", e);