瀏覽代碼

Merge remote-tracking branch 'origin/feature/0721-tenant' into feature/0721-tenant

yuanliang 1 年之前
父節點
當前提交
2711a979c1

+ 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)) {

+ 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);
     }

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

@@ -357,8 +357,14 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
             tenantStaffMapper.update(null, Wrappers.<TenantStaff>lambdaUpdate()
                     .set(TenantStaff::getStatus, UserLockFlag.LOCKED)
                     .eq(TenantStaff::getTenantId, updateStatus.getId()));
+        } else {
+            tenantStaffMapper.update(null, Wrappers.<TenantStaff>lambdaUpdate()
+                    .set(TenantStaff::getStatus, UserLockFlag.NORMAL)
+                    .eq(TenantStaff::getTenantId, updateStatus.getId()));
         }
 
+
+
         if (updateStatus.getSettlement() != null) {
             teacherDao.update(null, Wrappers.<Teacher>lambdaUpdate()
                     .set(Teacher::getSettlementFrom, updateStatus.getSettlement())
@@ -393,6 +399,13 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
             // todo 设置默认logo
             info.setLogo(sysConfigService.findConfigValue(SysConfigConstant.TENANT_DEFAULT_HEAD));
         }
+
+        Long id;
+        if(sysUser.getId() == null){
+            id = info.getUserId();
+        } else {
+            id = sysUser.getId();
+        }
         tenantInfoMapper.update(null, Wrappers.<TenantInfo>lambdaUpdate()
                 .set(TenantInfo::getName, info.getName())
                 .set(TenantInfo::getLogo, info.getLogo())
@@ -402,7 +415,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
                 .set(TenantInfo::getRegionCode, info.getRegionCode())
                 .set(TenantInfo::getPhone, info.getPhone())
                 .set(TenantInfo::getUsername, info.getUsername())
-                .set(TenantInfo::getUserId, sysUser.getId())
+                .set(TenantInfo::getUserId, id)
                 .eq(TenantInfo::getId, info.getId())
         );
         return true;

+ 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>