修改事务管理

This commit is contained in:
wuchunlei
2024-12-04 14:55:29 +08:00
parent 6371192282
commit 1094f986c1
2 changed files with 3 additions and 14 deletions

View File

@@ -20,6 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
@@ -345,23 +346,12 @@ public class BookController {
* 常规章节拆分
*/
@RequestMapping("/getChapter")
@Transactional
public R getChapter(@RequestParam("id") Integer id) {
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
singleThreadExecutor.execute(new Runnable() {
@Override
public void run() {
// bookService.getWordChapter(id);
// bookService.getChapter(id);
// bookService.getWord(id);
bookService.getWordSection(id);
}
});
bookService.getWordSection(id);
BookEntity bookEntity = bookService.getBaseMapper().selectById(id);
bookEntity.setChapterStatus("2");
bookService.updateById(bookEntity);
return R.ok();
}

View File

@@ -452,7 +452,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
* @return0
*/
@Override
@Transactional
public boolean getWordSection(Integer bookId) {
try{
int topText = 22;