Explorar el Código

Merge branch 'feature/1221-tenant' into develop-new

yuanliang hace 1 año
padre
commit
e884f8fc34

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

@@ -165,49 +165,26 @@ public class SysUserServiceImpl implements SysUserService {
     @Override
     public void imDeviceId(UserInfoWrapper.UpdateUser info) {
 
-        String teacherDeviceId = null;
-        String studentDeviceId = null;
-
         switch (info.getClient()) {
             case STUDENT:
             case TENANT_STUDENT:
-                studentDeviceId = info.getImDeviceId();
                 Student student = new Student();
                 student.setUserId(info.getUserId().longValue());
                 student.setImDeviceId(info.getImDeviceId());
                 studentService.updateById(student);
 
-                Teacher teacher1 = teacherService.getById(info.getUserId().longValue());
-                if (teacher1 != null) {
-                    if (StringUtils.isEmpty(teacher1.getImDeviceId())) {
-                        return;
-                    }
-                    teacherDeviceId = teacher1.getImDeviceId();
-                }
-
                 break;
             case TEACHER:
-                teacherDeviceId = info.getImDeviceId();
                 Teacher teacher = new Teacher();
                 teacher.setUserId(info.getUserId().longValue());
                 teacher.setImDeviceId(info.getImDeviceId());
                 teacherService.updateById(teacher);
-
-                Student student1 = studentService.getById(info.getUserId().longValue());
-                if (student1 != null) {
-                    if (StringUtils.isEmpty(student1.getImDeviceId())) {
-                        return;
-                    }
-                    studentDeviceId = student1.getImDeviceId();
-                }
                 break;
             default:
                 break;
         }
-        List<String> list = Lists.newArrayList(studentDeviceId, teacherDeviceId).stream()
-            .filter(StringUtil::isNotBlank).collect(Collectors.toList());
 
         messageSenderPluginContext.getMessageSenderPlugin(MessageSenderPluginContext.MessageSender.JIGUANG)
-            .deviceRemoveAlias(info.getUserId().toString(),list,info.getClient().getCode());
+            .deviceRemoveAlias(info.getUserId().toString(),Lists.newArrayList(info.getImDeviceId()),info.getClient().getCode());
     }
 }

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

@@ -21,6 +21,10 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -223,6 +227,24 @@ public class UserMusicServiceImpl extends ServiceImpl<UserMusicMapper, UserMusic
             }
         }
 
+        // 草稿过期时间
+        SysConfig byParamName = sysConfigService.findByParamName(SysConfigConstant.USER_MUSIC_DRAFT_TIME);
+        Integer time = 7;
+        try {
+            time = Integer.parseInt(byParamName.getParamName());
+        }catch (Exception e){
+            log.error("作品草稿过期时间配置错误");
+        }
+
+        for (UserMusicWrapper.UserMusic record : records) {
+            if (record.getType() == EUserMusicType.DRAFT && record.getCreateTime() != null) {
+                LocalDate localDate = record.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusDays(time);
+                LocalDateTime localDateTime = LocalDateTime.of(localDate, LocalTime.MAX);
+                record.setExpireTime(Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()));
+            }
+        }
+
+
         // 评测记录ID集合
         List<Long> musicPracticeRecordIds = records.stream()
             .map(UserMusicWrapper.UserMusic::getMusicPracticeRecordId).collect(Collectors.toList());

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/UserMusicWrapper.java

@@ -165,6 +165,8 @@ public class UserMusicWrapper {
         @ApiModelProperty("录制上传时间")
         private Date createTime;
 
+        @ApiModelProperty("过期时间")
+        private Date expireTime;
         public String jsonString() {
             return JSON.toJSONString(this);
         }

+ 15 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserMusicMapper.xml

@@ -5,8 +5,21 @@
 
 
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.UserMusicWrapper$UserMusic">
-		SELECT
-            t.*
+        SELECT t.id_,
+        t.user_id_,
+        t.client_type_,
+        t.music_practice_record_id_,
+        t.music_sheet_id_,
+        t.accompany_url_,
+        t.type_,
+        t.img_,
+        t.video_img_,
+        t.desc_,
+        t.video_url_,
+        t.json_config_,
+        t.like_num_,
+        t.submit_time_,
+        t.update_time_ as createTime
 		FROM user_music t
         left join music_sheet t1 on t1.id_ = t.music_sheet_id_
         <where>