commit
8c6ec2e922
21
pom.xml
21
pom.xml
@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.qiwenshare</groupId>
|
||||
<artifactId>qiwenshare</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>1.2.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>qiwen-file</artifactId>
|
||||
<version>1.2.1-SNAPSHOT</version>
|
||||
<version>1.2.2-SNAPSHOT</version>
|
||||
<name>qiwen-file</name>
|
||||
<description>pan.qiwenshare.com</description>
|
||||
<packaging>jar</packaging>
|
||||
@ -35,7 +35,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -55,10 +54,6 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--jpa-->
|
||||
@ -109,7 +104,6 @@
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.11.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -117,20 +111,10 @@
|
||||
<artifactId>jaudiotagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.stuxuhai</groupId>
|
||||
<artifactId>jpinyin</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- </plugin>-->
|
||||
<!--排除静态文件-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -192,6 +176,7 @@
|
||||
<delete dir="${release-path}" />
|
||||
<copy todir="${release-path}" >
|
||||
<fileset dir="target/${app-name}/${app-name}">
|
||||
<exclude name="**/*-android-*.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
@ -5,7 +5,6 @@ import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.util.security.JwtUser;
|
||||
import com.qiwenshare.common.util.security.SessionUtil;
|
||||
import com.qiwenshare.file.api.IOperationLogService;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
import com.qiwenshare.file.util.OperationLogUtil;
|
||||
import com.qiwenshare.file.vo.user.UserLoginVo;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
|
@ -190,6 +190,7 @@ public class AsyncTaskComp {
|
||||
saveUserFile.setFileName(fileName);
|
||||
userFileMapper.insert(saveUserFile);
|
||||
}
|
||||
fileDealComp.restoreParentFilePath(qiwenFile, userFile.getUserId());
|
||||
|
||||
return new AsyncResult<String>("saveUnzipFile");
|
||||
}
|
||||
|
@ -5,11 +5,8 @@ import cn.hutool.core.util.IdUtil;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.stuxuhai.jpinyin.PinyinException;
|
||||
import com.github.stuxuhai.jpinyin.PinyinFormat;
|
||||
import com.github.stuxuhai.jpinyin.PinyinHelper;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.util.HttpsUtils;
|
||||
import com.qiwenshare.common.util.MusicUtils;
|
||||
import com.qiwenshare.file.api.IShareFileService;
|
||||
import com.qiwenshare.file.api.IShareService;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
@ -400,7 +397,7 @@ public class FileDealComp {
|
||||
downloadFile.getOssClient().shutdown();
|
||||
}
|
||||
fileBean.setFileUrl(fileUrl);
|
||||
fileBean.setFileId(null);
|
||||
fileBean.setFileId(IdUtil.getSnowflakeNextIdStr());
|
||||
fileMapper.insert(fileBean);
|
||||
userFile.setFileId(fileBean.getFileId());
|
||||
userFile.setUploadTime(DateUtil.getCurrentTime());
|
||||
@ -527,7 +524,8 @@ public class FileDealComp {
|
||||
|
||||
if (StringUtils.isEmpty(music.getLyrics())) {
|
||||
try {
|
||||
String lyc = getLyc(music.getArtist(), music.getTitle());
|
||||
|
||||
String lyc = MusicUtils.getLyc(music.getArtist(), music.getTitle(), music.getAlbum());
|
||||
music.setLyrics(lyc);
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
@ -548,87 +546,4 @@ public class FileDealComp {
|
||||
}
|
||||
}
|
||||
|
||||
public String getLyc(String singerName, String mp3Name) {
|
||||
Map<String, Object> headMap = new HashMap<>();
|
||||
headMap.put("Referer", "https://y.qq.com/");
|
||||
String s = HttpsUtils.doGetString("https://c.y.qq.com/splcloud/fcgi-bin/smartbox_new.fcg?_=1651992748984&cv=4747474&ct=24&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=1&uin=0&g_tk_new_20200303=5381&g_tk=5381&hostUin=0&is_xml=0&key=" + mp3Name.replaceAll(" ", ""), headMap);
|
||||
Map map = JSON.parseObject(s, Map.class);
|
||||
Map data = (Map) map.get("data");
|
||||
Map song = (Map) data.get("song");
|
||||
List<Map> list = (List<Map>) song.get("itemlist");
|
||||
String singer = "";
|
||||
String id = "";
|
||||
String mid = "";
|
||||
boolean isMatch = false;
|
||||
for (Map item : list) {
|
||||
singer = (String) item.get("singer");
|
||||
id = (String) item.get("id");
|
||||
mid = (String) item.get("mid");
|
||||
try {
|
||||
String singer1 = PinyinHelper.convertToPinyinString(singerName.replaceAll(" ", ""), ",", PinyinFormat.WITHOUT_TONE);
|
||||
String singer2 = PinyinHelper.convertToPinyinString(singer.replaceAll(" ", ""), ",", PinyinFormat.WITHOUT_TONE);
|
||||
if (singer1.contains(singer2) || singer2.contains(singer1)) {
|
||||
isMatch = true;
|
||||
break;
|
||||
}
|
||||
} catch (PinyinException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
if (!isMatch) {
|
||||
for (Map item : list) {
|
||||
singer = (String) item.get("singer");
|
||||
id = String.valueOf(item.get("id"));
|
||||
mid = String.valueOf(item.get("mid"));
|
||||
try {
|
||||
String singer2 = PinyinHelper.convertToPinyinString(singer.replaceAll(" ", ""), ",", PinyinFormat.WITHOUT_TONE);
|
||||
String singer3 = PinyinHelper.convertToPinyinString(mp3Name.replaceAll(" ", ""), ",", PinyinFormat.WITHOUT_TONE);
|
||||
if (singer3.contains(singer2) || singer2.contains(singer3)) {
|
||||
isMatch = true;
|
||||
break;
|
||||
}
|
||||
} catch (PinyinException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!isMatch) {
|
||||
Map album = (Map) data.get("album");
|
||||
List<Map> albumlist = (List<Map>) album.get("itemlist");
|
||||
for (Map item : albumlist) {
|
||||
String mp3name = (String) item.get("name");
|
||||
singer = (String) item.get("singer");
|
||||
id = (String) item.get("id");
|
||||
mid = (String) item.get("mid");
|
||||
if (singer.equals(singerName) && mp3Name.equals(mp3name)) {
|
||||
String res = HttpsUtils.doGetString("https://c.y.qq.com/v8/fcg-bin/musicmall.fcg?_=1652026128283&cv=4747474&ct=24&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=1&uin=0&g_tk_new_20200303=5381&g_tk=5381&cmd=get_album_buy_page&albummid=" + mid + "&albumid=0", headMap);
|
||||
Map map1 = JSON.parseObject(res, Map.class);
|
||||
Map data1 = (Map) map1.get("data");
|
||||
List<Map> list1 = (List<Map>) data1.get("songlist");
|
||||
for (Map item1 : list1) {
|
||||
if (mp3Name.equals((String) item1.get("songname"))) {
|
||||
id = String.valueOf(item1.get("songid"));
|
||||
mid = String.valueOf(item1.get("songmid"));
|
||||
isMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isMatch) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String s1 = HttpsUtils.doGetString("https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg?_=1651993218842&cv=4747474&ct=24&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=1&uin=0&g_tk_new_20200303=5381&g_tk=5381&loginUin=0&" +
|
||||
"songmid="+mid+"&" +
|
||||
"musicid=" + id, headMap);
|
||||
Map map1 = JSON.parseObject(s1, Map.class);
|
||||
return (String) map1.get("lyric");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
package com.qiwenshare.file.config;
|
||||
|
||||
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
|
||||
@Bean
|
||||
public KeyGenerator keyGenerator() {
|
||||
return (target, method, params) -> {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(target.getClass().getName());
|
||||
sb.append(method.getName());
|
||||
for (Object obj : params) {
|
||||
sb.append(obj.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 设置 redisTemplate 的序列化设置
|
||||
* @param redisConnectionFactory redis连接工厂
|
||||
* @return redisTemplate
|
||||
*/
|
||||
@Bean
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
// 1.创建 redisTemplate 模版
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
// 2.关联 redisConnectionFactory
|
||||
template.setConnectionFactory(redisConnectionFactory);
|
||||
// 3.创建 序列化类
|
||||
GenericToStringSerializer genericToStringSerializer = new GenericToStringSerializer(Object.class);
|
||||
// 6.序列化类,对象映射设置
|
||||
// 7.设置 value 的转化格式和 key 的转化格式
|
||||
template.setValueSerializer(genericToStringSerializer);
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
template.afterPropertiesSet();
|
||||
return template;
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) {
|
||||
// RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig()
|
||||
// .entryTtl(Duration.ofHours(1)); // 设置缓存有效期一小时
|
||||
// return RedisCacheManager
|
||||
// .builder(RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory))
|
||||
// .cacheDefaults(redisCacheConfiguration).build();
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -7,20 +7,22 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.file.io.QiwenFile;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@Table(name = "userfile", uniqueConstraints = {
|
||||
@UniqueConstraint(name = "fileindex", columnNames = { "userId", "filePath", "fileName", "extendName", "deleteFlag", "isDir"})}
|
||||
)
|
||||
@UniqueConstraint(name = "fileindex", columnNames = {"userId", "filePath", "fileName", "extendName", "deleteFlag", "isDir"})
|
||||
})
|
||||
@Entity
|
||||
@TableName("userfile")
|
||||
public class UserFile {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@TableId(type = IdType.AUTO)
|
||||
@Column(columnDefinition = "varchar(20)")
|
||||
@Column(nullable = false, columnDefinition = "varchar(20)")
|
||||
private String userFileId;
|
||||
|
||||
@Column(columnDefinition = "bigint(20) comment '用户id'")
|
||||
|
@ -38,7 +38,6 @@ public class ConfigManager
|
||||
{
|
||||
properties = new Properties();
|
||||
InputStream stream = ConfigManager.class.getResourceAsStream("/config/settings.properties");
|
||||
// InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("settings.properties");
|
||||
properties.load(stream);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -358,53 +358,6 @@ public class DocumentManager
|
||||
}
|
||||
}
|
||||
|
||||
// public static String GetInternalExtension(FileType fileType)
|
||||
// {
|
||||
// if (fileType.equals(FileType.Word))
|
||||
// return ".docx";
|
||||
//
|
||||
// if (fileType.equals(FileType.Cell))
|
||||
// return ".xlsx";
|
||||
//
|
||||
// if (fileType.equals(FileType.Slide))
|
||||
// return ".pptx";
|
||||
//
|
||||
// return ".docx";
|
||||
// }
|
||||
|
||||
// public static String CreateToken(Map<String, Object> payloadClaims)
|
||||
// {
|
||||
// jwtComp.createJWT(payloadClaims);
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// Signer signer = HMACSigner.newSHA256Signer(GetTokenSecret());
|
||||
// JWT jwt = new JWT();
|
||||
// for (String key : payloadClaims.keySet())
|
||||
// {
|
||||
// jwt.addClaim(key, payloadClaims.get(key));
|
||||
// }
|
||||
// return JWT.getEncoder().encode(jwt, signer);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static JWT ReadToken(String token)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Verifier verifier = HMACVerifier.newVerifier(GetTokenSecret());
|
||||
// return JWT.getDecoder().decode(token, verifier);
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
public static Boolean TokenEnabled()
|
||||
{
|
||||
String secret = GetTokenSecret();
|
||||
|
@ -101,25 +101,6 @@ public class TrackManager {
|
||||
throw new Exception("{\"error\":1,\"message\":\"JWT validation failed\"}");
|
||||
}
|
||||
|
||||
// if (jwt.getObject("payload") != null) {
|
||||
// try {
|
||||
// @SuppressWarnings("unchecked") LinkedHashMap<String, Object> payload =
|
||||
// (LinkedHashMap<String, Object>)jwt.getObject("payload");
|
||||
//
|
||||
// jwt.claims = payload;
|
||||
// } catch (Exception ex) {
|
||||
// writer.write("{\"error\":1,\"message\":\"Wrong payload\"}");
|
||||
// throw ex;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// Gson gson = new Gson();
|
||||
// body = JSONObject.parseObject(gson.toJson(jwt.claims));
|
||||
// } catch (Exception ex) {
|
||||
// writer.write("JSONParser.parse error:" + ex.getMessage());
|
||||
// throw ex;
|
||||
// }
|
||||
}
|
||||
|
||||
return body;
|
||||
|
Loading…
Reference in New Issue
Block a user