实现自动脚本修改产品状态
This commit is contained in:
@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
@@ -11,6 +12,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.web.controller.price;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.price.task.BmsStatusRefreshTask;
|
||||
|
||||
/**
|
||||
* 状态自动刷新 - 手动触发入口
|
||||
*
|
||||
* <p>日常由 BmsStatusRefreshTask 每天 02:00 跑,特殊情况可手动触发。
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/price/status")
|
||||
public class PriceStatusController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private BmsStatusRefreshTask refreshTask;
|
||||
|
||||
/**
|
||||
* 立即刷新 bms_product / bms_product_country 的 status 字段
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('price:product:edit')")
|
||||
@PostMapping("/refresh")
|
||||
public AjaxResult refresh()
|
||||
{
|
||||
int[] counts = refreshTask.refreshNow();
|
||||
String msg = MessageUtils.message("price.status.refresh.success",
|
||||
String.valueOf(counts[0]), String.valueOf(counts[1]));
|
||||
return success(msg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user