正在显示
5 个修改的文件
包含
8 行增加
和
146 行删除
| @@ -8,7 +8,7 @@ spring: | @@ -8,7 +8,7 @@ spring: | ||
| 8 | datasource: | 8 | datasource: |
| 9 | type: com.alibaba.druid.pool.DruidDataSource | 9 | type: com.alibaba.druid.pool.DruidDataSource |
| 10 | driver-class-name: oracle.jdbc.OracleDriver | 10 | driver-class-name: oracle.jdbc.OracleDriver |
| 11 | - url: jdbc:oracle:thin:@192.168.1.4:10068:CGODW | 11 | + url: jdbc:oracle:thin:@192.168.1.2:10068:CGODW |
| 12 | username: CGOETL | 12 | username: CGOETL |
| 13 | password: 1q2w3e4r | 13 | password: 1q2w3e4r |
| 14 | 14 | ||
| @@ -39,13 +39,13 @@ mybatis: | @@ -39,13 +39,13 @@ mybatis: | ||
| 39 | type-aliases-package: com.sunyo.wlpt.data.warehouse.domain | 39 | type-aliases-package: com.sunyo.wlpt.data.warehouse.domain |
| 40 | 40 | ||
| 41 | # \u65E5\u5FD7\u6253\u5370 | 41 | # \u65E5\u5FD7\u6253\u5370 |
| 42 | -#logging: | ||
| 43 | -# config: config/logback-dev.xml | ||
| 44 | -# level: | ||
| 45 | -# com.sunyo.wlpt.data.warehouse.mapper: debug | ||
| 46 | -#logback: | ||
| 47 | -# appname: data-warehouse | ||
| 48 | -# logdir: ./log | 42 | +logging: |
| 43 | + config: config/logback-dev.xml | ||
| 44 | + level: | ||
| 45 | + com.sunyo.wlpt.data.warehouse.mapper: debug | ||
| 46 | +logback: | ||
| 47 | + appname: data-warehouse | ||
| 48 | + logdir: ./log | ||
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | #eureka client | 51 | #eureka client |
| 1 | -package com.sunyo.wlpt.data.warehouse.feign; | ||
| 2 | - | ||
| 3 | -import com.sunyo.wlpt.data.warehouse.commons.ResultExitData; | ||
| 4 | -import org.springframework.cloud.openfeign.FeignClient; | ||
| 5 | -import org.springframework.stereotype.Component; | ||
| 6 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 7 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 8 | - | ||
| 9 | -import java.util.Date; | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * @author 子诚 | ||
| 14 | - * Description: | ||
| 15 | - * 时间:2020/5/25 9:48 | ||
| 16 | - */ | ||
| 17 | -//@Component | ||
| 18 | -//@FeignClient(value = "cgonms-provide", fallback = GetCgoNmsFeignHystrix.class) | ||
| 19 | -public interface GetCgoNmsFeign { | ||
| 20 | - /** | ||
| 21 | - * 根据航班日期、航班号,获取出出港业务统计数据 | ||
| 22 | - * | ||
| 23 | - * @param flightDate 航班日期 | ||
| 24 | - * @param flightNo 航班号 | ||
| 25 | - * @return {@link ResultExitData} | ||
| 26 | - */ | ||
| 27 | - @GetMapping("/cgonms/getInfo") | ||
| 28 | - public List<ResultExitData> getData( | ||
| 29 | - @RequestParam(value = "flightDate", required = false) Date flightDate, | ||
| 30 | - @RequestParam(value = "flightNo", required = false) String flightNo); | ||
| 31 | -} |
| 1 | -package com.sunyo.wlpt.data.warehouse.feign; | ||
| 2 | - | ||
| 3 | -import com.sunyo.wlpt.data.warehouse.commons.ResultExitData; | ||
| 4 | -import org.springframework.stereotype.Service; | ||
| 5 | - | ||
| 6 | -import java.util.Date; | ||
| 7 | -import java.util.List; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * @author 子诚 | ||
| 11 | - * Description:GetCgoNmsFeign的熔断器 | ||
| 12 | - * 时间:2020/5/25 9:48 | ||
| 13 | - */ | ||
| 14 | -@Service | ||
| 15 | -public class GetCgoNmsFeignHystrix implements GetCgoNmsFeign{ | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * 熔断器方法 | ||
| 19 | - * | ||
| 20 | - * @param flightDate 航班日期 | ||
| 21 | - * @param flightNo 航班号 | ||
| 22 | - * @return | ||
| 23 | - */ | ||
| 24 | - @Override | ||
| 25 | - public List<ResultExitData> getData(Date flightDate, String flightNo) { | ||
| 26 | - System.out.println("与 新舱单服务 断开连接"); | ||
| 27 | - return null; | ||
| 28 | - } | ||
| 29 | -} |
| 1 | -package com.sunyo.wlpt.data.warehouse.schedule; | ||
| 2 | - | ||
| 3 | -import org.quartz.*; | ||
| 4 | -import org.springframework.context.annotation.Bean; | ||
| 5 | -import org.springframework.context.annotation.Configuration; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * @author 子诚 | ||
| 9 | - * Description:Quartz定时配置类 | ||
| 10 | - * 时间:2020/5/25 9:40 | ||
| 11 | - */ | ||
| 12 | -@Configuration | ||
| 13 | -public class QuartzConfig { | ||
| 14 | - /** | ||
| 15 | - * 指定具体的定时任务类. | ||
| 16 | - * | ||
| 17 | - * @return | ||
| 18 | - */ | ||
| 19 | - @Bean | ||
| 20 | - public JobDetail uploadTaskDetail() { | ||
| 21 | - return JobBuilder.newJob(QuartzTask.class).withIdentity("QuartzTask").storeDurably().build(); | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - @Bean | ||
| 25 | - public Trigger uploadTaskTrigger() { | ||
| 26 | - /** | ||
| 27 | - * 这里设定触发执行的方式 | ||
| 28 | - * 每天4点执行任务 | ||
| 29 | - */ | ||
| 30 | - CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("0 0 4 * * ?"); | ||
| 31 | - // 返回任务触发器 | ||
| 32 | - return TriggerBuilder.newTrigger().forJob(uploadTaskDetail()) | ||
| 33 | - .withIdentity("QuartzTask") | ||
| 34 | - .withSchedule(scheduleBuilder) | ||
| 35 | - .build(); | ||
| 36 | - } | ||
| 37 | -} |
| 1 | -package com.sunyo.wlpt.data.warehouse.schedule; | ||
| 2 | - | ||
| 3 | -import org.quartz.JobExecutionContext; | ||
| 4 | -import org.quartz.JobExecutionException; | ||
| 5 | -import org.springframework.scheduling.quartz.QuartzJobBean; | ||
| 6 | - | ||
| 7 | -import java.util.Calendar; | ||
| 8 | -import java.util.Date; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * @author 子诚 | ||
| 12 | - * Description:定时任务类 | ||
| 13 | - * 时间:2020/5/25 9:38 | ||
| 14 | - */ | ||
| 15 | -public class QuartzTask extends QuartzJobBean { | ||
| 16 | - /** | ||
| 17 | - * 创建需要被定时执行的方法 | ||
| 18 | - * | ||
| 19 | - * @param jobExecutionContext | ||
| 20 | - * @throws JobExecutionException | ||
| 21 | - */ | ||
| 22 | - @Override | ||
| 23 | - protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { | ||
| 24 | - //每天凌晨四点查询昨天的数据 | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | - /** | ||
| 28 | - * 返回昨天. | ||
| 29 | - * | ||
| 30 | - * @param today | ||
| 31 | - * @return | ||
| 32 | - */ | ||
| 33 | - public Date yesterday(Date today) { | ||
| 34 | - Calendar calendar = Calendar.getInstance(); | ||
| 35 | - calendar.setTime(today); | ||
| 36 | - calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 1); | ||
| 37 | - return calendar.getTime(); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - | ||
| 41 | -} |
-
请 注册 或 登录 后发表评论