Browse Source

系统:系统任务和一次性任务

4.0
郑根木 2 years ago
parent
commit
62e650d600
4 changed files with 6 additions and 6 deletions
  1. +1
    -0
      smtweb-framework/bpm/src/main/resources/config/application.yaml
  2. +3
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/CoreAutoConfiguration.java
  3. +2
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java
  4. +0
    -6
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/systask/BaseSysService.java

+ 1
- 0
smtweb-framework/bpm/src/main/resources/config/application.yaml View File

@@ -1,5 +1,6 @@
smtweb: smtweb:
machine-id: 1 machine-id: 1
enable-job: true
file: file:
local-path: /data/sw/files/ local-path: /data/sw/files/
url: http://127.0.0.1:8888/sw/files/ url: http://127.0.0.1:8888/sw/files/


+ 3
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/CoreAutoConfiguration.java View File

@@ -23,10 +23,13 @@ public class CoreAutoConfiguration implements WebMvcConfigurer {
*/ */
@Value("${smtweb.machine-id}") @Value("${smtweb.machine-id}")
private int machineId; private int machineId;
@Value("${smtweb.enable-job}")
private boolean enableJob;


@Bean @Bean
public IdGenerator idGenerator() { public IdGenerator idGenerator() {
SwConsts.SysParam.machineId = machineId; SwConsts.SysParam.machineId = machineId;
SwConsts.SysParam.enableJob = enableJob;
return new IdGenerator(machineId); return new IdGenerator(machineId);
} }




+ 2
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java View File

@@ -13,6 +13,8 @@ public interface SwConsts {
public static String RUN_PROJECTS = ""; public static String RUN_PROJECTS = "";
//启动时赋值:服务器编号 //启动时赋值:服务器编号
public static int machineId; public static int machineId;
//是否执行定时任务
public static boolean enableJob = false;
} }


//错误码 //错误码


+ 0
- 6
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/systask/BaseSysService.java View File

@@ -21,12 +21,6 @@ public abstract class BaseSysService implements Runnable {


@Override @Override
public void run() { public void run() {
boolean isNeedJob = true;
if (!isNeedJob) {
log.debug(getTitle() + ":::未开启需要执行任务,忽略执行.........");
return;
}

try { try {
final String id = this.getClass().getName(); final String id = this.getClass().getName();
SingleRequestHelper.singleRequest(SwConsts.REDIS_KEY_BASE_JOB, id, "任务执行中,本次忽略.........", new SingleRequestHelper.ISingleWork() { SingleRequestHelper.singleRequest(SwConsts.REDIS_KEY_BASE_JOB, id, "任务执行中,本次忽略.........", new SingleRequestHelper.ISingleWork() {


Loading…
Cancel
Save