Browse Source

Merge branch 'feature/0721-tenant'

liujc 1 năm trước cách đây
mục cha
commit
26e6b51348

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/mapper/UserTenantAlbumRecordMapper.java

@@ -30,5 +30,5 @@ public interface UserTenantAlbumRecordMapper extends BaseMapper<UserTenantAlbumR
 
 	List<TenantAlbum> selectTenantAlbumInfo(@Param("tenantIds") List<Long> tenantIds);
 
-	Long ifBuy(@Param("tenantAlbumId") Long tenantAlbumId);
+    Long ifBuy(@Param("tenantAlbumId") Long tenantAlbumId, @Param("studentId") Long studentId);
 }

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -551,7 +551,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                 List<Long> musicIdList = records.stream().map(MusicSheetVo::getId).collect(Collectors.toList());
                 List<MusicFavorite> musicFavoriteList = musicFavoriteService.lambdaQuery()
                                                                 .eq(MusicFavorite::getUserId, query.getStudentId())
-                                                                .eq(MusicFavorite::getClientType, query.getClientType())
+                                                                .eq(MusicFavorite::getClientType, clientType)
                                                                 .in(MusicFavorite::getMusicSheetId, musicIdList)
                                                                 .list();
                 if (CollectionUtils.isNotEmpty(musicFavoriteList)) {

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

@@ -413,6 +413,11 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
             sysUser = insertSysUser(teacherSubmitReq);
             teacherSubmitReq.setUserId(sysUser.getId());
         } else {
+            String userType = sysUser.getUserType();
+            List<String> userTypes = Arrays.stream(userType.split(",")).collect(Collectors.toList());
+            if (userTypes.contains(ClientEnum.TEACHER.getCode())) {
+                throw new BizException("该手机号已经注册老师账号");
+            }
             teacherSubmitReq.setUserId(sysUser.getId());
             updateSysUser(teacherSubmitReq);
         }

+ 8 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantActivationCodeServiceImpl.java

@@ -29,6 +29,7 @@ import com.yonge.toolset.utils.easyexcel.ExcelDataReaderProperty;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -420,20 +421,25 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
 
         Calendar instance = Calendar.getInstance();
         if (userTenantAlbumRecords.isEmpty()) {
-            instance.setTime(new Date());
+            instance.setTime(DateTime.now().withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).toDate());
         } else {
             // 如果最后一次的时间的小于当前时间,则以当前时间为会员的开始时间
             // 如果最后一次的时间的大于当前时间,则以最后一次的结束时间为记录的开始时间,相当会员续期
             UserTenantAlbumRecord lastRecord = userTenantAlbumRecords.get(0);
             Date lastEndTime = lastRecord.getEndTime();
             if (lastEndTime.before(new Date())) {
-                instance.setTime(new Date());
+                instance.setTime(DateTime.now().withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).toDate());
             } else {
                 instance.setTime(lastEndTime);
             }
         }
         userTenantAlbumRecord.setStartTime(instance.getTime());
         instance.add(Calendar.MONTH, userTenantAlbumRecord.getTimes());
+
+        instance.set(Calendar.HOUR_OF_DAY, 23);
+        instance.set(Calendar.MINUTE, 59);
+        instance.set(Calendar.SECOND, 59);
+        instance.set(Calendar.MILLISECOND, 0);
         userTenantAlbumRecord.setEndTime(instance.getTime());
         userTenantAlbumRecordMapper.insert(userTenantAlbumRecord);
     }

+ 6 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserTenantAlbumRecordServiceImpl.java

@@ -220,10 +220,13 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
     @Override
     public TenantAlbumWrapper.TenantAlbum detailAlbum(String albumId) {
 
+        //如果没传专辑id  则查询对应机构的专辑详情
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户不存在");
+        }
         Long tenantAlbumId;
         if (StringUtils.isEmpty(albumId)){
-            //如果没传专辑id  则查询对应机构的专辑详情
-            SysUser sysUser = sysUserFeignService.queryUserInfo();
             Long id = sysUser.getId();
             List<Student> list = studentService.lambdaQuery().eq(Student::getUserId, id).list();
             if (CollectionUtils.isEmpty(list)) {
@@ -248,7 +251,7 @@ public class UserTenantAlbumRecordServiceImpl extends ServiceImpl<UserTenantAlbu
         TenantAlbumWrapper.TenantAlbum album = new TenantAlbumWrapper.TenantAlbum();
 
         //查询是否已经购买专辑
-        Long buyTenantAlbumId = userTenantAlbumRecordMapper.ifBuy(tenantAlbumId);
+        Long buyTenantAlbumId = userTenantAlbumRecordMapper.ifBuy(tenantAlbumId,sysUser.getId());
 
         if (buyTenantAlbumId != null){
             album.setIfBuy(true);

+ 3 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserTenantAlbumRecordMapper.xml

@@ -68,6 +68,9 @@
             <if test="tenantAlbumId != null">
                 and tenant_album_id_ = #{tenantAlbumId}
             </if>
+            <if test="studentId != null">
+                and user_id_ = #{studentId}
+            </if>
         </where>
 
     </select>