修改事务管理

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.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R; import com.peanut.common.utils.R;
@@ -345,23 +346,12 @@ public class BookController {
* 常规章节拆分 * 常规章节拆分
*/ */
@RequestMapping("/getChapter") @RequestMapping("/getChapter")
@Transactional
public R getChapter(@RequestParam("id") Integer id) { public R getChapter(@RequestParam("id") Integer id) {
bookService.getWordSection(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);
}
});
BookEntity bookEntity = bookService.getBaseMapper().selectById(id); BookEntity bookEntity = bookService.getBaseMapper().selectById(id);
bookEntity.setChapterStatus("2"); bookEntity.setChapterStatus("2");
bookService.updateById(bookEntity); bookService.updateById(bookEntity);
return R.ok(); return R.ok();
} }

View File

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