Sfoglia il codice sorgente

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

4.0
郑根木 2 anni fa
parent
commit
62e650d600
4 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  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 Vedi File

@@ -1,5 +1,6 @@
smtweb:
machine-id: 1
enable-job: true
file:
local-path: /data/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 Vedi File

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

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



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

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

//错误码


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

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

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

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


Caricamento…
Annulla
Salva