1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package info.aspirecn.iov.sjjh.supplier10000027;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.commons.io.FileUtils;
- import org.springframework.boot.ApplicationArguments;
- import org.springframework.boot.ApplicationRunner;
- import org.springframework.core.io.ClassPathResource;
- import org.springframework.stereotype.Component;
- import java.io.File;
- import java.io.InputStream;
- /**
- * @description:
- * @author: xusonglin
- * @create: 2019/10/24 15:52
- * @version: V1.0
- **/
- @Component
- @Slf4j
- public class ApplicationInitialize implements ApplicationRunner {
- @Override
- public void run(ApplicationArguments args) throws Exception {
- File bjcaRoot = new File("/usr/share/bjcaRoot");
- if(!bjcaRoot.exists()){
- bjcaRoot.mkdirs();
- }
- File bjcalog = new File("/usr/share/bjcaRoot/BJCAlog");
- if(!bjcalog.exists()){
- bjcalog.mkdirs();
- }
- File xtx = new File("/usr/share/bjcaRoot/BJCAlog/xtx");
- if(!xtx.exists()){
- xtx.mkdirs();
- }
- File xtxCoreSvr2 = new File("/usr/share/bjcaRoot/BJCAlog/XTXCoreSvr2");
- if(!xtxCoreSvr2.exists()){
- xtxCoreSvr2.mkdirs();
- }
- File bjcalogs = new File("/usr/share/bjcaRoot/logs");
- if(!bjcalogs.exists()){
- bjcalogs.mkdirs();
- }
- File xtxtradelog = new File("/usr/share/bjcaRoot/xtxtradelog");
- if(!xtxtradelog.exists()){
- xtxtradelog.mkdirs();
- }
- InputStream XTXAppCOM = new ClassPathResource("bjcaRoot/BJCAlog/xtx/XTXAppCOM.log").getInputStream();
- FileUtils.copyInputStreamToFile(XTXAppCOM,new File("/usr/share/bjcaRoot/BJCAlog/xtx/XTXAppCOM.log"));
- InputStream logxtxCoreSvr2 = new ClassPathResource("bjcaRoot/BJCAlog/XTXCoreSvr2/logXTXCoreSvr2.log").getInputStream();
- FileUtils.copyInputStreamToFile(logxtxCoreSvr2,new File("/usr/share/bjcaRoot/BJCAlog/XTXCoreSvr2/logXTXCoreSvr2.log"));
- InputStream svsError = new ClassPathResource("bjcaRoot/logs/SVSClient_error.log").getInputStream();
- FileUtils.copyInputStreamToFile(svsError,new File("/usr/share/bjcaRoot/logs/SVSClient_error.log"));
- InputStream svsSystem = new ClassPathResource("bjcaRoot/logs/SVSClient_system.log").getInputStream();
- FileUtils.copyInputStreamToFile(svsSystem,new File("/usr/share/bjcaRoot/logs/SVSClient_system.log"));
- InputStream bjcaConfig = new ClassPathResource("bjcaRoot/BJCA_Config.xml").getInputStream();
- FileUtils.copyInputStreamToFile(bjcaConfig,new File("/usr/share/bjcaRoot/BJCA_Config.xml"));
- InputStream properties = new ClassPathResource("bjcaRoot/SVSClient.properties").getInputStream();
- FileUtils.copyInputStreamToFile(properties,new File("/usr/share/bjcaRoot/SVSClient.properties"));
- log.info("文件夹已拷贝");
- }
- }
|