Przeglądaj źródła

Merge branch 'online' of http://git.dayaedu.com/yonge/cooleshow into test

zouxuan 4 miesięcy temu
rodzic
commit
9d4be49641

+ 1 - 0
cooleshow-app/src/main/resources/logback-spring.xml

@@ -41,6 +41,7 @@
 			<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] %p %c{0} %m%n</pattern>
 		</encoder>
 	</appender>
+
 	<logger name="com.yonge" level="INFO" />
 
 	<!--本地环境:打印控制台 -->

+ 0 - 1
cooleshow-auth/auth-server/src/main/resources/logback-spring.xml

@@ -26,7 +26,6 @@
 			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
 		</encoder>
 	</appender>
-
 	<logger name="com.yonge" level="INFO" />
 	<springProfile name="pre">
 		<root level="WARN">

+ 0 - 1
cooleshow-mall/mall-admin/src/main/resources/logback-spring.xml

@@ -26,7 +26,6 @@
 			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
 		</encoder>
 	</appender>
-
 	<logger name="com.yonge" level="info" />
 
 	<!--本地环境:打印控制台 -->

+ 0 - 1
cooleshow-mall/mall-common/pom.xml

@@ -18,7 +18,6 @@
     </parent>
 
     <dependencies>
-
         <dependency>
             <groupId>com.yonge.cooleshow</groupId>
             <artifactId>cooleshow-common</artifactId>

+ 26 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java

@@ -1527,13 +1527,32 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
     }
 
     private void addBindUnBindRecord(Long teacherId, Long tenantId, Boolean bind) {
-        UserTenantBindRecord bindRecord = new UserTenantBindRecord();
-        bindRecord.setUserId(teacherId);
-        bindRecord.setUserType("TEACHER");
-        bindRecord.setTenantId(tenantId);
-        bindRecord.setBindStatus(bind);
-        bindRecord.setBindTime(new Date());
-        userTenantBindRecordService.save(bindRecord);
+        if (bind){
+            UserTenantBindRecord bindRecord = userTenantBindRecordService.lambdaQuery()
+                    .eq(UserTenantBindRecord::getUserId, teacherId)
+                    .eq(UserTenantBindRecord::getUserType, "TEACHER")
+                    .eq(UserTenantBindRecord::getTenantId, tenantId).one();
+            if (bindRecord != null) {
+                bindRecord.setBindStatus(true);
+                bindRecord.setBindTime(new Date());
+                userTenantBindRecordService.updateById(bindRecord);
+            }else {
+                UserTenantBindRecord userTenantBindRecord = new UserTenantBindRecord();
+                userTenantBindRecord.setUserId(teacherId);
+                userTenantBindRecord.setUserType("TEACHER");
+                userTenantBindRecord.setTenantId(tenantId);
+                userTenantBindRecord.setBindStatus(true);
+                userTenantBindRecord.setBindTime(new Date());
+                userTenantBindRecordService.save(userTenantBindRecord);
+            }
+        }else {
+            userTenantBindRecordService.lambdaUpdate()
+                    .eq(UserTenantBindRecord::getUserId, teacherId)
+                    .eq(UserTenantBindRecord::getUserType, "TEACHER")
+                    .eq(UserTenantBindRecord::getTenantId, tenantId)
+                    .set(UserTenantBindRecord::getBindStatus, false)
+                    .update();
+        }
     }
 
     private void sendBindUnBindSMS(Long userId, String phone, MessageTypeEnum messageType, Long tenantId) {