Author | SHA1 | Message | Date |
---|---|---|---|
yaoq | a1af8a48a8 | Merge remote-tracking branch 'origin/4.0' into 4.0 | 2 years ago |
yaoq | 6e8c81bda4 | 优化 | 2 years ago |
@@ -207,4 +207,17 @@ | |||||
</build> | </build> | ||||
</profile> | </profile> | ||||
</profiles> | </profiles> | ||||
<distributionManagement> | |||||
<repository> | |||||
<id>nexus-releases</id> | |||||
<name>Nexus Release Repository</name> | |||||
<url>http://47.92.149.153:7000/repository/maven-releases/</url> | |||||
</repository> | |||||
<snapshotRepository> | |||||
<id>nexus-snapshots</id> | |||||
<name>Nexus Snapshot Repository</name> | |||||
<url>http://47.92.149.153:7000/repository/maven-snapshots/</url> | |||||
</snapshotRepository> | |||||
</distributionManagement> | |||||
</project> | </project> |
@@ -16,7 +16,7 @@ public class ClientStartedListener implements IStartListener { | |||||
@Override | @Override | ||||
public int order() { | public int order() { | ||||
return SwConsts.DEFAULT_ORDER + 3; | |||||
return SwConsts.DEFAULT_ORDER + 99; | |||||
} | } | ||||
@@ -43,7 +43,7 @@ | |||||
<version>3.1.0-SNAPSHOT</version> | <version>3.1.0-SNAPSHOT</version> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<!--<dependency> | |||||
<groupId>cc.smtweb</groupId> | <groupId>cc.smtweb</groupId> | ||||
<artifactId>canal.example</artifactId> | <artifactId>canal.example</artifactId> | ||||
<version>1.1.5</version> | <version>1.1.5</version> | ||||
@@ -53,7 +53,7 @@ | |||||
<groupId>cc.smtweb</groupId> | <groupId>cc.smtweb</groupId> | ||||
<artifactId>canal.deployer</artifactId> | <artifactId>canal.deployer</artifactId> | ||||
<version>1.1.5</version> | <version>1.1.5</version> | ||||
</dependency> | |||||
</dependency>--> | |||||
<dependency> | <dependency> | ||||
@@ -92,4 +92,16 @@ | |||||
</plugins> | </plugins> | ||||
</build> | </build> | ||||
<distributionManagement> | |||||
<repository> | |||||
<id>nexus-releases</id> | |||||
<name>Nexus Release Repository</name> | |||||
<url>http://47.92.149.153:7000/repository/maven-releases/</url> | |||||
</repository> | |||||
<snapshotRepository> | |||||
<id>nexus-snapshots</id> | |||||
<name>Nexus Snapshot Repository</name> | |||||
<url>http://47.92.149.153:7000/repository/maven-snapshots/</url> | |||||
</snapshotRepository> | |||||
</distributionManagement> | |||||
</project> | </project> |
@@ -4,6 +4,8 @@ import cc.smtweb.framework.core.annotation.SwStartListener; | |||||
import cc.smtweb.framework.core.common.SwConsts; | import cc.smtweb.framework.core.common.SwConsts; | ||||
import cc.smtweb.framework.core.mvc.controller.IStartListener; | import cc.smtweb.framework.core.mvc.controller.IStartListener; | ||||
import cc.smtweb.framework.core.systask.SysServiceFactory; | import cc.smtweb.framework.core.systask.SysServiceFactory; | ||||
import cc.smtweb.framework.core.util.SpringUtil; | |||||
import cc.smtweb.system.canal.file.common.FileDecodeConfig; | |||||
import cc.smtweb.system.canal.file.common.FileDecodeService; | import cc.smtweb.system.canal.file.common.FileDecodeService; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
@@ -24,9 +26,10 @@ public class CanalFileStartedListener implements IStartListener { | |||||
@Override | @Override | ||||
public void init() { | public void init() { | ||||
FileDecodeConfig config = SpringUtil.getBean(FileDecodeConfig.class); | |||||
SwConsts.SysParam.enableCanal = true; | SwConsts.SysParam.enableCanal = true; | ||||
SwConsts.SysParam.RUN_PROJECTS = ""; | SwConsts.SysParam.RUN_PROJECTS = ""; | ||||
SysServiceFactory.getInstance().reg(new FileDecodeService()); | |||||
if(config.isEnable()) SysServiceFactory.getInstance().reg(new FileDecodeService()); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -7,7 +7,6 @@ import cc.smtweb.framework.core.exception.SwException; | |||||
import cc.smtweb.framework.core.util.*; | import cc.smtweb.framework.core.util.*; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
import org.apache.commons.lang.StringUtils; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.io.File; | import java.io.File; | ||||
@@ -140,7 +139,7 @@ public abstract class AbstractFileWork { | |||||
for (String field : fields) { | for (String field : fields) { | ||||
sql.append("?").append(","); | sql.append("?").append(","); | ||||
String value = data.get(field); | String value = data.get(field); | ||||
if (StringUtils.isEmpty(value)) { | |||||
if (StringUtil.isEmpty(value)) { | |||||
args.add(null); | args.add(null); | ||||
} else { | } else { | ||||
args.add(value); | args.add(value); | ||||
@@ -161,7 +160,7 @@ public abstract class AbstractFileWork { | |||||
if (field.equals(canalVO.getIdField())) continue; | if (field.equals(canalVO.getIdField())) continue; | ||||
sql.append(field).append("=").append("?").append(","); | sql.append(field).append("=").append("?").append(","); | ||||
String value = data.get(field); | String value = data.get(field); | ||||
if (StringUtils.isEmpty(value)) { | |||||
if (StringUtil.isEmpty(value)) { | |||||
args.add(null); | args.add(null); | ||||
} else { | } else { | ||||
args.add(value); | args.add(value); | ||||
@@ -14,9 +14,16 @@ public class FileDecodeConfig { | |||||
@Value("${canal.file.path}") | @Value("${canal.file.path}") | ||||
private String path; | private String path; | ||||
@Value("${canal.file.enable}") | |||||
private boolean enable; | |||||
public String getPath() { | public String getPath() { | ||||
return path; | return path; | ||||
} | } | ||||
public boolean isEnable() { | |||||
return enable; | |||||
} | |||||
} | } | ||||
@@ -4,10 +4,7 @@ import cc.smtweb.framework.core.db.DbEngine; | |||||
import cc.smtweb.framework.core.systask.BaseSysService; | import cc.smtweb.framework.core.systask.BaseSysService; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
/** | |||||
* Created by Akmm at 2021/12/6 19:19 | |||||
* 清除当前已结束任务, 10分钟一次 | |||||
*/ | |||||
@Slf4j | @Slf4j | ||||
public class FileDecodeService extends BaseSysService { | public class FileDecodeService extends BaseSysService { | ||||
@Override | @Override | ||||
@@ -17,7 +14,7 @@ public class FileDecodeService extends BaseSysService { | |||||
@Override | @Override | ||||
public int getInterval() { | public int getInterval() { | ||||
return 5; | |||||
return 10; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -2,8 +2,8 @@ package cc.smtweb.system.canal.file.impl; | |||||
import cc.smtweb.framework.core.common.CanalVO; | import cc.smtweb.framework.core.common.CanalVO; | ||||
import cc.smtweb.framework.core.common.SwEnum; | import cc.smtweb.framework.core.common.SwEnum; | ||||
import cc.smtweb.framework.core.util.StringUtil; | |||||
import cc.smtweb.system.canal.file.common.AbstractFileWork; | import cc.smtweb.system.canal.file.common.AbstractFileWork; | ||||
import org.apache.commons.lang.StringUtils; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
@@ -47,7 +47,7 @@ public class MySqlFileWork extends AbstractFileWork { | |||||
for (String field : fields) { | for (String field : fields) { | ||||
sql.append("?").append(","); | sql.append("?").append(","); | ||||
String value = data.get(field); | String value = data.get(field); | ||||
if (StringUtils.isEmpty(value)) { | |||||
if (StringUtil.isEmpty(value)) { | |||||
args.add(null); | args.add(null); | ||||
} else { | } else { | ||||
args.add(value); | args.add(value); | ||||
@@ -69,7 +69,7 @@ public class MySqlFileWork extends AbstractFileWork { | |||||
if (field.equals(canalVO.getIdField())) continue; | if (field.equals(canalVO.getIdField())) continue; | ||||
sql.append(field).append("=").append("?").append(","); | sql.append(field).append("=").append("?").append(","); | ||||
String value = data.get(field); | String value = data.get(field); | ||||
if (StringUtils.isEmpty(value)) { | |||||
if (StringUtil.isEmpty(value)) { | |||||
args.add(null); | args.add(null); | ||||
} else { | } else { | ||||
args.add(value); | args.add(value); | ||||
@@ -189,4 +189,17 @@ | |||||
</build> | </build> | ||||
</profile> | </profile> | ||||
</profiles> | </profiles> | ||||
<distributionManagement> | |||||
<repository> | |||||
<id>nexus-releases</id> | |||||
<name>Nexus Release Repository</name> | |||||
<url>http://47.92.149.153:7000/repository/maven-releases/</url> | |||||
</repository> | |||||
<snapshotRepository> | |||||
<id>nexus-snapshots</id> | |||||
<name>Nexus Snapshot Repository</name> | |||||
<url>http://47.92.149.153:7000/repository/maven-snapshots/</url> | |||||
</snapshotRepository> | |||||
</distributionManagement> | |||||
</project> | </project> |
@@ -18,7 +18,7 @@ public class CanalStartedListener implements IStartListener { | |||||
@Override | @Override | ||||
public int order() { | public int order() { | ||||
return SwConsts.DEFAULT_ORDER + 2; | |||||
return SwConsts.DEFAULT_ORDER + 90; | |||||
} | } | ||||