12 changed files with 683 additions and 346 deletions
@ -0,0 +1,42 @@ |
|||||||
|
package org.springblade.ftpdemo.task; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.tool.utils.DateUtil; |
||||||
|
import org.springblade.ftpdemo.controller.SSHRemoteCall; |
||||||
|
import org.springblade.ftpdemo.service.Method; |
||||||
|
import org.springblade.ftpdemo.util.Constant; |
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling; |
||||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
import org.springframework.util.StopWatch; |
||||||
|
|
||||||
|
import java.util.Vector; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author laifeng |
||||||
|
* @since 2022/12/1 |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
@EnableScheduling |
||||||
|
@AllArgsConstructor |
||||||
|
public class TestTask { |
||||||
|
private final Method method; |
||||||
|
|
||||||
|
@Scheduled(cron = "0 0/1 * * * ?") |
||||||
|
public void refreshAliDeviceStatus() throws Exception { |
||||||
|
// StopWatch stopWatch = new StopWatch("读取表6日志,生成加密文件,上传" );
|
||||||
|
// stopWatch.start();
|
||||||
|
// String yyyyMMdd = DateUtil.format(DateUtil.now(), "yyyyMMdd");
|
||||||
|
//
|
||||||
|
// method.creatSixUpFileAndUp(yyyyMMdd, "1");
|
||||||
|
// stopWatch.stop();
|
||||||
|
// double seconds = stopWatch.getTotalTimeSeconds();
|
||||||
|
// System.out.println("完成,花费:"+seconds);
|
||||||
|
|
||||||
|
|
||||||
|
// 1、首先远程连接ssh
|
||||||
|
SSHRemoteCall.getInstance().sshRemoteCallLogin(Constant.host, Constant.user,Constant.password1); |
||||||
|
SSHRemoteCall.getInstance().listFiles("/opt/2022-11-30"); |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -1,46 +0,0 @@ |
|||||||
package org.springblade.test; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
||||||
import org.junit.jupiter.api.Test; |
|
||||||
import org.junit.jupiter.api.extension.ExtendWith; |
|
||||||
import org.springblade.core.test.BladeBootTest; |
|
||||||
import org.springblade.core.test.BladeSpringExtension; |
|
||||||
import org.springblade.core.tool.utils.StringUtil; |
|
||||||
import org.springblade.flow.engine.entity.FlowModel; |
|
||||||
import org.springblade.flow.engine.service.FlowEngineService; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* Blade单元测试 |
|
||||||
* |
|
||||||
* @author Chill |
|
||||||
*/ |
|
||||||
@ExtendWith(BladeSpringExtension.class) |
|
||||||
@BladeBootTest(appName = "blade-runner", enableLoader = true) |
|
||||||
public class BladeTest { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private FlowEngineService service; |
|
||||||
|
|
||||||
@Test |
|
||||||
public void contextLoads() { |
|
||||||
System.out.println("=====数据迁移启动====="); |
|
||||||
|
|
||||||
// 获取 ACT_DE_MODEL 表需要转换的数据
|
|
||||||
List<FlowModel> list = service.list(); |
|
||||||
// 循环转换
|
|
||||||
list.forEach(flowModel -> { |
|
||||||
if (StringUtil.isBlank(flowModel.getModelEditorXml())) { |
|
||||||
service.update(Wrappers.<FlowModel>lambdaUpdate() |
|
||||||
.set(FlowModel::getModelEditorXml, new String(service.getModelEditorXML(flowModel))) |
|
||||||
.ge(FlowModel::getId, flowModel.getId()) |
|
||||||
); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
System.out.println("=====数据迁移完毕====="); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,49 @@ |
|||||||
|
package org.springblade.test; |
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.junit.jupiter.api.Test; |
||||||
|
import org.springblade.core.tool.utils.DateUtil; |
||||||
|
import org.springblade.ftpdemo.controller.SSHRemoteCall; |
||||||
|
import org.springblade.ftpdemo.service.Method; |
||||||
|
import org.springblade.ftpdemo.service.impl.MethodImpl; |
||||||
|
import org.springblade.ftpdemo.util.Constant; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.Vector; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author laifeng |
||||||
|
* @since 2022/11/30 |
||||||
|
*/ |
||||||
|
|
||||||
|
@SpringBootTest |
||||||
|
public class TestMethod { |
||||||
|
|
||||||
|
|
||||||
|
@Test |
||||||
|
void test1() { |
||||||
|
String operatorTime = "20221201000030"; |
||||||
|
|
||||||
|
Date date = DateUtil.parse(operatorTime, DateUtil.PATTERN_DATETIME_MINI); |
||||||
|
String format = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss"); |
||||||
|
System.out.println(format); |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
void test2() throws Exception { |
||||||
|
|
||||||
|
// 1、首先远程连接ssh
|
||||||
|
SSHRemoteCall.getInstance().sshRemoteCallLogin(Constant.host, Constant.user,Constant.password1); |
||||||
|
Vector files = SSHRemoteCall.getInstance().listFiles("/opt/2022-11-30"); |
||||||
|
for (Object file : files) { |
||||||
|
System.out.println(file.toString()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue