Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 năm trước cách đây
mục cha
commit
0c73110d4a

+ 1 - 1
cms/src/main/java/com/ym/mec/cms/CmsServerApplication.java

@@ -17,7 +17,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @EnableDiscoveryClient
 @EnableFeignClients
 @MapperScan("com.ym.mec.cms.dal.dao")
-@ComponentScan(basePackages = { "com.ym.mec.cms", "com.ym.mec.common.config", "com.ym.mec.common.security" })
+@ComponentScan(basePackages = { "com.ym.mec.cms", "com.ym.mec.im", "com.ym.mec.auth", "com.ym.mec.common.config", "com.ym.mec.common.security" })
 @Configuration
 @EnableSwagger2Doc
 public class CmsServerApplication {

+ 0 - 2
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
 import com.ym.mec.cms.service.SysNewsInformationService;

+ 15 - 13
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -83,24 +83,26 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 
 		boolean isNewer = false;
 		Date date = new Date();
-		String startDateStr = "2020-05-01";
-		Date startDate = null;
-		try {
-			startDate = sdf.parse(startDateStr);
-		} catch (ParseException e) {
-			throw new RuntimeException(e);
+		Date startDate = queryInfo.getDate();
+		if (startDate == null) {
+			try {
+				String startDateStr = "2020-05-01";
+				startDate = sdf.parse(startDateStr);
+			} catch (ParseException e) {
+				throw new RuntimeException(e);
+			}
 		}
-		if (date.after(startDate)) {
-			if (user != null) {
+		if (queryInfo.getTenantId() == 1 && date.after(startDate)) {
+			if (user != null && "18696158274".equals(user.getPhone()) == false) {
 				isNewer = webFeignService.isPurchasedPracticeCourse(user.getId()) == false;
 				SysNewsInformation info = new SysNewsInformation();
 				info.setOrder(1);
 				if (isNewer) {
 					info.setLinkUrl(serverContextPath + "/#/auditionActive/1");
-					info.setCoverImage("");
+					info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/3_1.jpg");
 				} else {
 					info.setLinkUrl(serverContextPath + "/#/auditionActive/1");
-					info.setCoverImage("");
+					info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/3_2.jpg");
 				}
 				pageInfos.getRows().add(info);
 			}
@@ -126,13 +128,13 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		SysNewsInformation info = new SysNewsInformation();
 		info.setOrder(1);
 
-		if (date.after(startDate)) {
+		if (queryInfo.getTenantId() == 1 && date.after(startDate)) {
 			if (isNewer) {
 				info.setLinkUrl(serverContextPath + "/#/auditionActive/1");
-				info.setCoverImage("");
+				info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/5_1.jpg");
 			} else {
 				info.setLinkUrl(serverContextPath + "/#/auditionActive/1");
-				info.setCoverImage("");
+				info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/5_2.jpg");
 			}
 			pageInfos.getRows().add(info);
 		} else {

+ 27 - 15
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -518,10 +518,10 @@
         SELECT
             DISTINCT su.id_ userId,su.username_ userName, su.avatar_ avatar, su.phone_ phone
         FROM
-            practice_group pg
-            LEFT JOIN sys_user su ON pg.student_id_ = su.id_
+            sys_user su
         WHERE
-            pg.type_ IN ('FREE', 'TRIAL')
+            1=1
+			AND FIND_IN_SET('STUDENT',su.user_type_)
             <if test="organIdList!=null">
                 AND su.organ_id_ IN
                 <foreach collection="organIdList" item="organId" open="(" close=")" separator=",">
@@ -531,11 +531,11 @@
             <if test="search != null">
                 AND (su.username_ LIKE CONCAT('%', #{search}, '%') OR su.phone_ LIKE CONCAT('%', #{search}, '%'))
             </if>
-            AND pg.student_id_ NOT IN (
-                SELECT student_id_ FROM practice_group WHERE type_='CHARGE'
+            AND su.id_ NOT IN (
+                SELECT student_id_ FROM practice_group WHERE type_='CHARGE' AND group_status_ IN ('NORMAL', 'FINISH')
             )
             AND NOT EXISTS (
-                SELECT user_id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=pg.student_id_ AND cs.teach_mode_='ONLINE' AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW()
+                SELECT user_id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=su.id_ AND cs.teach_mode_='ONLINE' AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW()
             )
         <include refid="global.limit"/>
     </select>
@@ -543,10 +543,10 @@
         SELECT
             COUNT(DISTINCT su.id_)
         FROM
-            practice_group pg
-            LEFT JOIN sys_user su ON pg.student_id_ = su.id_
+            sys_user su
         WHERE
-            pg.type_ IN ('FREE', 'TRIAL')
+            1=1
+			AND FIND_IN_SET('STUDENT',su.user_type_)
             <if test="organIdList!=null">
             AND su.organ_id_ IN
                 <foreach collection="organIdList" item="organId" open="(" close=")" separator=",">
@@ -556,11 +556,11 @@
             <if test="search != null">
                 AND (su.username_ LIKE CONCAT('%', #{search}, '%') OR su.phone_ LIKE CONCAT('%', #{search}, '%'))
             </if>
-            AND pg.student_id_ NOT IN (
-                SELECT student_id_ FROM practice_group WHERE type_='CHARGE'
+            AND su.id_ NOT IN (
+                SELECT student_id_ FROM practice_group WHERE type_='CHARGE' AND group_status_ IN ('NORMAL', 'FINISH')
             )
             AND NOT EXISTS (
-                SELECT user_id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=pg.student_id_ AND cs.teach_mode_='ONLINE' AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW()
+                SELECT user_id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_ WHERE cssp.user_id_=su.id_ AND cs.teach_mode_='ONLINE' AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW()
             )
     </select>
     <select id="findEnableAssignTeachers" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
@@ -570,7 +570,17 @@
         WHERE
             FIND_IN_SET(#{subjectId}, t.subject_id_)
             AND (t.organ_id_ = #{studentOrganId} OR FIND_IN_SET(#{studentOrganId},t.flow_organ_range_))
-            AND NOT EXISTS (SELECT user_id_ FROM practice_group WHERE student_id_=#{studentId} AND t.id_=user_id_ AND type_='TRIAL')
+            AND NOT EXISTS (SELECT
+                cs.actual_teacher_id_
+            FROM
+                course_schedule_student_payment cssp
+                LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
+		        LEFT JOIN practice_group pg ON cssp.music_group_id_=pg.id_
+            WHERE
+                cssp.user_id_ = #{studentId}
+                AND cs.actual_teacher_id_ = t.id_
+		        AND pg.type_='TRIAL'
+                AND cssp.group_type_ = 'PRACTICE')
     </select>
 
     <select id="findLastPracticeSubject" resultType="int">
@@ -601,11 +611,13 @@
     </select>
     <select id="countStudentTrialPractices" resultType="int">
         SELECT
-            COUNT(pg.id_)
+            COUNT( DISTINCT pg.id_ )
         FROM
-            practice_group pg
+            course_schedule cs
+            LEFT JOIN practice_group pg ON pg.id_ = cs.music_group_id_
         WHERE
             pg.student_id_ = #{studentId}
+            AND cs.group_type_ = 'PRACTICE'
             AND pg.type_ = 'TRIAL'
     </select>
     <select id="findStudentAndTeacherTrialPractices" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">

+ 2 - 1
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -349,12 +349,13 @@ public class RoomServiceImpl implements RoomService {
         roomMemberDao.save(roomMember);
     }
 
-    @Transactional(rollbackFor = Exception.class)
+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     @Override
     public Boolean leaveRoom(String roomId) throws Exception {
         SysUser user = sysUserFeignService.queryUserInfo();
         String userId = user.getId().toString();
         log.info("leaveRoom: roomId={}, userId={}", roomId,userId);
+        studentDao.lockUser(user.getId());
         Teacher teacher = teacherDao.get(user.getId());
         CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId.substring(1)));
         try {