Merge branch 'master' into docker_package
This commit is contained in:
commit
a29c377456
|
@ -27,6 +27,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* 浏览记录
|
||||
|
@ -38,6 +41,7 @@ import java.util.Map;
|
|||
@RequestMapping("/resourceBrowse")
|
||||
@Api(tags = "浏览记录")
|
||||
public class ResourceBrowseController {
|
||||
private static final ExecutorService executor = Executors.newWorkStealingPool();
|
||||
@Autowired
|
||||
private ResourceBrowseService resourceBrowseService;
|
||||
@Autowired
|
||||
|
@ -86,7 +90,9 @@ public class ResourceBrowseController {
|
|||
dto.setCreator(SecurityUser.getUserId());
|
||||
dto.setUserId(SecurityUser.getUserId());
|
||||
resourceBrowseService.save(dto);
|
||||
jdbcTemplate.update("UPDATE tb_data_resource SET visitor = (SELECT COUNT(id) FROM tb_resource_browse WHERE resource_id = tb_data_resource.id) WHERE tb_data_resource.id = " + dto.getResourceId());
|
||||
CompletableFuture.runAsync(() -> {
|
||||
jdbcTemplate.update("UPDATE tb_data_resource SET visitor = (SELECT COUNT(id) FROM tb_resource_browse WHERE resource_id = tb_data_resource.id) WHERE tb_data_resource.id = " + dto.getResourceId());
|
||||
}, executor);
|
||||
return new Result().ok(dto);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue