refactor all
This commit is contained in:
@@ -1,32 +1,11 @@
|
||||
package com.imyeyu.api.modules.lyric.controller;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.imyeyu.io.IOSize;
|
||||
import com.imyeyu.java.bean.timi.TimiCode;
|
||||
import com.imyeyu.java.bean.timi.TimiException;
|
||||
import com.imyeyu.api.annotation.CaptchaValid;
|
||||
import com.imyeyu.api.bean.CaptchaFrom;
|
||||
import com.imyeyu.api.modules.common.service.UserService;
|
||||
import com.imyeyu.api.modules.lyric.entity.Lyric;
|
||||
import com.imyeyu.api.modules.lyric.entity.LyricCorrect;
|
||||
import com.imyeyu.api.modules.user.service.UserService;
|
||||
import com.imyeyu.api.modules.lyric.service.LyricCorrectService;
|
||||
import com.imyeyu.api.modules.lyric.service.LyricService;
|
||||
import com.imyeyu.api.modules.lyric.vo.LyricCorrectRequest;
|
||||
import com.imyeyu.api.modules.lyric.vo.LyricRequest;
|
||||
import com.imyeyu.spring.annotation.AOPLog;
|
||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
||||
import com.imyeyu.spring.annotation.RequiredToken;
|
||||
import com.imyeyu.spring.bean.CaptchaData;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
@@ -44,38 +23,36 @@ public class LyricController {
|
||||
private final UserService userService;
|
||||
private final LyricService service;
|
||||
private final LyricCorrectService correctService;
|
||||
|
||||
@AOPLog
|
||||
@RequestRateLimit
|
||||
@PostMapping("")
|
||||
public Lyric get(@Valid @RequestBody LyricRequest request) {
|
||||
return service.get(request);
|
||||
}
|
||||
|
||||
@AOPLog
|
||||
@CaptchaValid(CaptchaFrom.LYRIC_CORRECT)
|
||||
@RequestRateLimit
|
||||
@PostMapping("/correct")
|
||||
public long correctRequest(CaptchaData<LyricCorrectRequest> request) {
|
||||
if (IOSize.MB * 120 < request.getData().getFile().getSize()) {
|
||||
throw new TimiException(TimiCode.ARG_BAD).msgKey("lyric.correct_request.too_big");
|
||||
}
|
||||
return correctService.correctRequest(request.getData());
|
||||
}
|
||||
|
||||
@AOPLog
|
||||
@RequiredToken
|
||||
@RequestRateLimit
|
||||
@PostMapping("/correct/list")
|
||||
public PageResult<LyricCorrect> listCorrect(@Valid @RequestBody Page page) {
|
||||
return correctService.pageByToken(page);
|
||||
}
|
||||
|
||||
@AOPLog
|
||||
@RequiredToken
|
||||
@RequestRateLimit
|
||||
@PostMapping("/correct/cancel")
|
||||
public void cancelCorrectRequest(@Min(1) @NotNull @RequestParam Long id) {
|
||||
correctService.cancelCorrectRequest(id);
|
||||
}
|
||||
//
|
||||
// @AOPLog
|
||||
// @RequestRateLimit
|
||||
// @PostMapping("")
|
||||
// public Lyric get(@Valid @RequestBody LyricRequest request) {
|
||||
// return service.get(request);
|
||||
// }
|
||||
//
|
||||
// @AOPLog
|
||||
// @CaptchaValid(CaptchaFrom.LYRIC_CORRECT)
|
||||
// @RequestRateLimit
|
||||
// @PostMapping("/correct")
|
||||
// public long correctRequest(CaptchaData<LyricCorrectRequest> request) {
|
||||
// if (IOSize.MB * 120 < request.getData().getFile().getSize()) {
|
||||
// throw new TimiException(TimiCode.ARG_BAD).msgKey("lyric.correct_request.too_big");
|
||||
// }
|
||||
// return correctService.correctRequest(request.getData());
|
||||
// }
|
||||
//
|
||||
// @AOPLog
|
||||
// @RequestRateLimit
|
||||
// @PostMapping("/correct/list")
|
||||
// public PageResult<LyricCorrect> listCorrect(@Valid @RequestBody Page page) {
|
||||
// return correctService.pageByToken(page);
|
||||
// }
|
||||
//
|
||||
// @AOPLog
|
||||
// @RequestRateLimit
|
||||
// @PostMapping("/correct/cancel")
|
||||
// public void cancelCorrectRequest(@Min(1) @NotNull @RequestParam Long id) {
|
||||
// correctService.cancelCorrectRequest(id);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.imyeyu.api.modules.lyric.entity;
|
||||
|
||||
import com.imyeyu.spring.annotation.table.PageIgnore;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.imyeyu.spring.entity.Entity;
|
||||
|
||||
/**
|
||||
* 歌词
|
||||
@@ -12,7 +13,7 @@ import com.imyeyu.spring.entity.Entity;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Lyric extends Entity {
|
||||
public class Lyric extends UUIDEntity {
|
||||
|
||||
/** 歌曲名称 */
|
||||
private String song;
|
||||
@@ -21,7 +22,11 @@ public class Lyric extends Entity {
|
||||
private String singer;
|
||||
|
||||
/** 歌词 */
|
||||
private String data;
|
||||
@PageIgnore
|
||||
private String content;
|
||||
|
||||
/** 被引用次数 */
|
||||
private Long citations;
|
||||
|
||||
/** 更新者 ID */
|
||||
private Long updatedBy;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.imyeyu.api.modules.lyric.entity;
|
||||
|
||||
import com.imyeyu.spring.annotation.table.PageIgnore;
|
||||
import com.imyeyu.spring.entity.UUIDEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.imyeyu.spring.entity.Entity;
|
||||
|
||||
/**
|
||||
* 歌词更新请求
|
||||
@@ -12,10 +13,10 @@ import com.imyeyu.spring.entity.Entity;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LyricCorrect extends Entity {
|
||||
public class LyricCorrect extends UUIDEntity {
|
||||
|
||||
/** 歌词 ID */
|
||||
private Long lyricId;
|
||||
private String lyricId;
|
||||
|
||||
/** 歌曲名 */
|
||||
private String song;
|
||||
@@ -24,10 +25,11 @@ public class LyricCorrect extends Entity {
|
||||
private String singer;
|
||||
|
||||
/** 歌词 */
|
||||
private String data;
|
||||
@PageIgnore
|
||||
private String content;
|
||||
|
||||
/** 申请人 */
|
||||
private Long requestBy;
|
||||
private String requestBy;
|
||||
|
||||
/** 申请 IP */
|
||||
private String requestIP;
|
||||
@@ -42,7 +44,7 @@ public class LyricCorrect extends Entity {
|
||||
private Long rejectAt;
|
||||
|
||||
/** 拒绝原因 */
|
||||
private Long rejectReason;
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 是否可取消
|
||||
@@ -50,7 +52,7 @@ public class LyricCorrect extends Entity {
|
||||
* @param requestBy 操作人
|
||||
* @return true 为可取消
|
||||
*/
|
||||
public boolean canCancel(Long requestBy) {
|
||||
public boolean canCancel(String requestBy) {
|
||||
return id != null && this.requestBy.equals(requestBy) && approvalAt == null && rejectAt == null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Select;
|
||||
* @author 夜雨
|
||||
* @since 2023-04-24 17:06
|
||||
*/
|
||||
public interface LyricCorrectMapper extends BaseMapper<LyricCorrect, Long> {
|
||||
public interface LyricCorrectMapper extends BaseMapper<LyricCorrect, String> {
|
||||
|
||||
@Select("UPDATE lyric_corrects SET cancel_at = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000) WHERE id = #{id}")
|
||||
void cancelCorrectRequest(long id);
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
* @author 夜雨
|
||||
* @since 2023-02-02 11:54
|
||||
*/
|
||||
public interface LyricMapper extends BaseMapper<Lyric, Long> {
|
||||
public interface LyricMapper extends BaseMapper<Lyric, String> {
|
||||
|
||||
@Select("SELECT * FROM lyric WHERE song LIKE CONCAT('%', #{song}, '%') OR singer LIKE CONCAT('%', #{singer}, '%') LIMIT 1")
|
||||
Lyric selectBySong(String song, String singer);
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.imyeyu.api.modules.lyric.service;
|
||||
|
||||
import com.imyeyu.api.modules.lyric.entity.LyricCorrect;
|
||||
import com.imyeyu.api.modules.lyric.vo.LyricCorrectRequest;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.service.CreatableService;
|
||||
|
||||
/**
|
||||
@@ -13,10 +10,4 @@ import com.imyeyu.spring.service.CreatableService;
|
||||
* @since 2023-04-24 17:04
|
||||
*/
|
||||
public interface LyricCorrectService extends CreatableService<LyricCorrect> {
|
||||
|
||||
PageResult<LyricCorrect> pageByToken(Page page);
|
||||
|
||||
long correctRequest(LyricCorrectRequest request);
|
||||
|
||||
void cancelCorrectRequest(long id);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.imyeyu.api.modules.lyric.service;
|
||||
|
||||
import com.imyeyu.java.bean.timi.TimiException;
|
||||
import com.imyeyu.api.modules.lyric.entity.Lyric;
|
||||
import com.imyeyu.api.modules.lyric.vo.LyricRequest;
|
||||
import com.imyeyu.spring.service.GettableService;
|
||||
|
||||
import java.util.List;
|
||||
import com.imyeyu.spring.service.BaseService;
|
||||
|
||||
/**
|
||||
* 歌词服务
|
||||
@@ -13,15 +9,5 @@ import java.util.List;
|
||||
* @author 夜雨
|
||||
* @since 2023-02-02 11:55
|
||||
*/
|
||||
public interface LyricService extends GettableService<Lyric, Long> {
|
||||
|
||||
/**
|
||||
* 获取歌词
|
||||
*
|
||||
* @return 歌词
|
||||
* @throws TimiException 服务异常
|
||||
*/
|
||||
Lyric get(LyricRequest request);
|
||||
|
||||
List<Lyric> listAll4Simple();
|
||||
public interface LyricService extends BaseService<Lyric, String> {
|
||||
}
|
||||
|
||||
+3
-79
@@ -1,27 +1,15 @@
|
||||
package com.imyeyu.api.modules.lyric.service.implement;
|
||||
|
||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||
import com.imyeyu.api.modules.common.entity.Attachment;
|
||||
import com.imyeyu.api.modules.common.entity.User;
|
||||
import com.imyeyu.api.modules.common.service.AttachmentService;
|
||||
import com.imyeyu.api.modules.common.service.UserService;
|
||||
import com.imyeyu.api.modules.user.service.UserService;
|
||||
import com.imyeyu.api.modules.lyric.entity.LyricCorrect;
|
||||
import com.imyeyu.api.modules.lyric.mapper.LyricCorrectMapper;
|
||||
import com.imyeyu.api.modules.lyric.service.LyricCorrectService;
|
||||
import com.imyeyu.api.modules.lyric.vo.LyricCorrectRequest;
|
||||
import com.imyeyu.java.TimiJava;
|
||||
import com.imyeyu.java.bean.timi.TimiCode;
|
||||
import com.imyeyu.java.bean.timi.TimiException;
|
||||
import com.imyeyu.spring.TimiSpring;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.bean.PageResult;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import com.imyeyu.spring.service.AbstractEntityService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @author 夜雨
|
||||
@@ -30,78 +18,14 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LyricCorrectServiceImplement extends AbstractEntityService<LyricCorrect, Long> implements LyricCorrectService {
|
||||
public class LyricCorrectServiceImplement extends AbstractEntityService<LyricCorrect, String> implements LyricCorrectService {
|
||||
|
||||
private final UserService userService;
|
||||
private final AttachmentService attachmentService;
|
||||
private final LyricCorrectMapper mapper;
|
||||
|
||||
@Override
|
||||
protected BaseMapper<LyricCorrect, Long> mapper() {
|
||||
protected BaseMapper<LyricCorrect, String> mapper() {
|
||||
return mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(LyricCorrect lyricCorrect) {
|
||||
if (TimiJava.isNotEmpty(lyricCorrect.getRequestBy())) {
|
||||
User user = userService.get(lyricCorrect.getRequestBy());
|
||||
if (user.isBanning()) {
|
||||
throw new TimiException(TimiCode.RESULT_BAN).msgKey("user.banded");
|
||||
}
|
||||
}
|
||||
super.create(lyricCorrect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<LyricCorrect> pageByToken(Page page) {
|
||||
throw new TimiException(TimiCode.ERROR_NOT_SUPPORT).msgKey("TODO");
|
||||
}
|
||||
|
||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||
@Override
|
||||
public long correctRequest(LyricCorrectRequest request) {
|
||||
LyricCorrect correct = new LyricCorrect();
|
||||
correct.setLyricId(request.getLyricId());
|
||||
correct.setSong(request.getSong());
|
||||
correct.setSinger(request.getSinger());
|
||||
correct.setData(request.getData());
|
||||
correct.setRequestIP(TimiSpring.getRequestIP());
|
||||
|
||||
String token = TimiSpring.getToken();
|
||||
if (TimiJava.isNotEmpty(token)) {
|
||||
User user = userService.getLoginUser();
|
||||
correct.setRequestBy(user.getId());
|
||||
}
|
||||
create(correct);
|
||||
try {
|
||||
MultipartFile file = request.getFile();
|
||||
Attachment attachment = new Attachment();
|
||||
attachment.setBizType(Attachment.BizType.LYRIC);
|
||||
attachment.setBizId(correct.getId());
|
||||
attachment.setName(correct.getId() + ".lrc");
|
||||
attachment.setAttachTypeValue(User.AttachType.WRAPPER);
|
||||
attachment.setSize(file.getSize());
|
||||
attachment.setInputStream(file.getInputStream());
|
||||
attachmentService.create(attachment);
|
||||
} catch (Exception e) {
|
||||
log.error("save lyric error", e);
|
||||
throw new TimiException(TimiCode.ERROR).msgKey("TODO save lyric error");
|
||||
}
|
||||
return correct.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelCorrectRequest(long id) {
|
||||
User requestBy = userService.getLoginUser();
|
||||
LyricCorrect correct = mapper.select(id);
|
||||
if (correct == null) {
|
||||
throw new TimiException(TimiCode.RESULT_NULL).msgKey("lyric.correct_request.not_found");
|
||||
}
|
||||
if (!correct.canCancel(requestBy.getId())) {
|
||||
throw new TimiException(TimiCode.RESULT_BAD).msgKey("lyric.correct_request.unsupported_cancel");
|
||||
}
|
||||
Attachment attachment = attachmentService.getByBizId(Attachment.BizType.LYRIC, correct.getId());
|
||||
attachmentService.delete(attachment.getId());
|
||||
mapper.cancelCorrectRequest(correct.getId());
|
||||
}
|
||||
}
|
||||
|
||||
+46
-46
@@ -2,24 +2,20 @@ package com.imyeyu.api.modules.lyric.service.implement;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.imyeyu.java.bean.timi.TimiCode;
|
||||
import com.imyeyu.java.bean.timi.TimiException;
|
||||
import com.imyeyu.api.modules.lyric.entity.Lyric;
|
||||
import com.imyeyu.api.modules.lyric.mapper.LyricMapper;
|
||||
import com.imyeyu.api.modules.lyric.service.LyricService;
|
||||
import com.imyeyu.api.modules.lyric.vo.LyricRequest;
|
||||
import com.imyeyu.utils.Collect;
|
||||
import com.imyeyu.java.bean.timi.TimiCode;
|
||||
import com.imyeyu.java.bean.timi.TimiException;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import com.imyeyu.spring.service.AbstractEntityService;
|
||||
import com.imyeyu.utils.Encoder;
|
||||
import com.imyeyu.utils.Text;
|
||||
import com.imyeyu.utils.Time;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.hc.client5.http.fluent.Request;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -31,7 +27,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LyricServiceImplement implements LyricService {
|
||||
public class LyricServiceImplement extends AbstractEntityService<Lyric, String> implements LyricService {
|
||||
|
||||
/** 酷狗歌曲查询接口 */
|
||||
private static final String API_GET_SONG = "http://mobilecdn.kugou.com/api/v3/search/song?";
|
||||
@@ -53,44 +49,49 @@ public class LyricServiceImplement implements LyricService {
|
||||
private final ObjectMapper jackson;
|
||||
|
||||
@Override
|
||||
public Lyric get(Long id) {
|
||||
return mapper.select(id);
|
||||
protected BaseMapper<Lyric, String> mapper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Lyric get(LyricRequest request) {
|
||||
// 从数据库模糊搜索获取
|
||||
Lyric lyric = mapper.selectBySong(request.getSong().trim(), request.getSinger().trim());
|
||||
if (lyric != null) {
|
||||
return lyric;
|
||||
}
|
||||
{
|
||||
// 从缓存模糊字符串搜索
|
||||
String name = request.getSong().trim() + "_" + request.getSinger().trim();
|
||||
Map<Long, Number> result = new HashMap<>();
|
||||
for (Map.Entry<Long, String> item : allLyric.entrySet()) {
|
||||
result.put(item.getKey(), Text.similarityRatio(name, item.getValue()));
|
||||
}
|
||||
LinkedHashMap<Long, Number> sortedMap = Collect.sortMapByNumberValueDESC(result);
|
||||
if (sortedMap.keySet().iterator().hasNext()) {
|
||||
Long guessID = sortedMap.keySet().iterator().next();
|
||||
Number ratio = result.get(guessID);
|
||||
if (.7 < ratio.doubleValue()) {
|
||||
return this.get(guessID);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 从 API 创建
|
||||
lyric = fetchLyric(request.getSong(), request.getSinger(), request.getTl());
|
||||
lyric.setCreatedAt(Time.now());
|
||||
mapper.insert(lyric);
|
||||
return lyric;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Lyric> listAll4Simple() {
|
||||
return mapper.listAll4Simple();
|
||||
}
|
||||
// @Override
|
||||
// public Lyric get(Long id) {
|
||||
// return mapper.select(id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Lyric get(LyricRequest request) {
|
||||
// // 从数据库模糊搜索获取
|
||||
// Lyric lyric = mapper.selectBySong(request.getSong().trim(), request.getSinger().trim());
|
||||
// if (lyric != null) {
|
||||
// return lyric;
|
||||
// }
|
||||
// {
|
||||
// // 从缓存模糊字符串搜索
|
||||
// String name = request.getSong().trim() + "_" + request.getSinger().trim();
|
||||
// Map<Long, Number> result = new HashMap<>();
|
||||
// for (Map.Entry<Long, String> item : allLyric.entrySet()) {
|
||||
// result.put(item.getKey(), Text.similarityRatio(name, item.getValue()));
|
||||
// }
|
||||
// LinkedHashMap<Long, Number> sortedMap = Collect.sortMapByNumberValueDESC(result);
|
||||
// if (sortedMap.keySet().iterator().hasNext()) {
|
||||
// Long guessID = sortedMap.keySet().iterator().next();
|
||||
// Number ratio = result.get(guessID);
|
||||
// if (.7 < ratio.doubleValue()) {
|
||||
// return this.get(guessID);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // 从 API 创建
|
||||
// lyric = fetchLyric(request.getSong(), request.getSinger(), request.getTl());
|
||||
// lyric.setCreatedAt(Time.now());
|
||||
// mapper.insert(lyric);
|
||||
// return lyric;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<Lyric> listAll4Simple() {
|
||||
// return mapper.listAll4Simple();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 从 API 获取
|
||||
@@ -131,7 +132,6 @@ public class LyricServiceImplement implements LyricService {
|
||||
Lyric lyric = new Lyric();
|
||||
lyric.setSong(data.path("songname").asText());
|
||||
lyric.setSinger(data.path("singername").asText());
|
||||
lyric.setData(response);
|
||||
return lyric;
|
||||
} catch (Exception e) {
|
||||
log.error("fetch lyric fail", e);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.imyeyu.api.modules.lyric.util;
|
||||
|
||||
import com.imyeyu.api.modules.lyric.entity.Lyric;
|
||||
import com.imyeyu.api.modules.lyric.service.LyricService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
@@ -9,7 +8,6 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -29,10 +27,10 @@ public class InitLyricSearch implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
List<Lyric> list = service.listAll4Simple();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
allLyric.put(list.get(i).getId(), list.get(i).getSong() + "_" + list.get(i).getSinger());
|
||||
}
|
||||
// List<Lyric> list = service.listAll4Simple();
|
||||
// for (int i = 0; i < list.size(); i++) {
|
||||
// allLyric.put(list.get(i).getId(), list.get(i).getSong() + "_" + list.get(i).getSinger());
|
||||
// }
|
||||
}
|
||||
|
||||
/** @return 所有歌词映射,Map<ID, Song_Singer> */
|
||||
|
||||
Reference in New Issue
Block a user