Ver código fonte

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

4.0
郑根木 2 anos atrás
pai
commit
62e650d600
4 arquivos alterados com 6 adições e 6 exclusões
  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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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() {


Carregando…
Cancelar
Salvar