Commit 776eb93e by huluobin

fee

parent dd99f46f
...@@ -35,7 +35,7 @@ public class AmazonAdJob { ...@@ -35,7 +35,7 @@ public class AmazonAdJob {
* </p> * </p>
*/ */
// @Scheduled(cron = "0 0 13 * * ?") // @Scheduled(cron = "0 0 13 * * ?")
@Scheduled(cron = "0/1 * * * * ?") // @Scheduled(cron = "0/1 * * * * ?")
public void generateAmazonAdReport() { public void generateAmazonAdReport() {
log.info("每天下午1点生成昨天的亚马逊广告报告 任务开始"); log.info("每天下午1点生成昨天的亚马逊广告报告 任务开始");
amazonJobService.generateAmazonAdReport(); amazonJobService.generateAmazonAdReport();
...@@ -47,7 +47,7 @@ public class AmazonAdJob { ...@@ -47,7 +47,7 @@ public class AmazonAdJob {
* 每小时下载未下载的报告 * 每小时下载未下载的报告
* </p> * </p>
*/ */
@Scheduled(cron = "0/1 * * * * ?") // @Scheduled(cron = "0/1 * * * * ?")
// @Scheduled(cron = "0 1 0/1 * * ?") // @Scheduled(cron = "0 1 0/1 * * ?")
public void downloadAmazonAdReport() { public void downloadAmazonAdReport() {
log.info("每小时下载未下载的报告 任务开始"); log.info("每小时下载未下载的报告 任务开始");
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>datacenter-base</artifactId>
<groupId>com.bailuntec</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>base-sync-ebay</artifactId>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.3.RELEASE</version>
<configuration>
<mainClass>com.bailuntec.job.SampleApp</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<skipDockerBuild>false</skipDockerBuild>
<imageName>ccr.ccs.tencentyun.com/blt.data.job/base-sync-sample:${maven.build.timestamp}
</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<serverId>bailuntec-docker</serverId>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.bailuntec.job;
import com.bailuntec.job.service.EbayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Slf4j
@Component
public class EbayJob {
@Resource
EbayService ebayService;
@Scheduled(cron = "0 0/1 * * * ?")
public void baseSyncFinanceFee() {
try {
log.info("每分钟同步费用单 开始");
ebayService.sync();
log.info("每分钟同步费用单 结束");
} catch (Exception ex) {
log.error("每分钟同步费用单 异常:", ex);
}
}
}
package com.bailuntec.job;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/28 3:16 下午
*/
@SpringBootApplication
@EnableScheduling
@ComponentScan("com.bailuntec")
@EnableFeignClients(basePackages = {"com.bailuntec.api", "com.bailuntec.*.api"})
public class SampleApp {
public static void main(String[] args) {
SpringApplication.run(SampleApp.class, args);
}
}
package com.bailuntec.job.service;
import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.ListUtil;
import com.bailuntec.cost.api.CostApi;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.ManageCostDto;
import com.bailuntec.cost.api.response.CostResult;
import com.bailuntec.domain.DcBaseFinanceFee;
import com.bailuntec.domain.DcBaseFinanceLogistics;
import com.bailuntec.domain.DcBaseFinanceManagecost;
import com.bailuntec.domain.DcJobConfig;
import com.bailuntec.infrastructure.mapper.DcBaseFinanceFeeMapper;
import com.bailuntec.infrastructure.mapper.DcBaseFinanceLogisticsMapper;
import com.bailuntec.infrastructure.mapper.DcBaseFinanceManagecostMapper;
import com.bailuntec.infrastructure.mapper.DcJobConfigMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/7 11:38 上午
*/
@Slf4j
@Service
public class EbayService {
public void sync() {
}
}
spring:
# 服务名称
application:
name: base-sync-sample
# 数据配置
datasource:
url: jdbc:mysql://10.0.8.15:3306/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
main:
allow-bean-definition-overriding: true
#mybatis plus 配置
mybatis-plus:
mapper-locations:
- classpath*:com/bailuntec/mapper/*.xml
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
feign:
hystrix:
enabled: false
client:
config:
default:
connectTimeout: 30000
readTimeout: 30000
server:
port: 8080
spring:
# 服务名称
application:
name: base-sync-sample
# 数据配置
datasource:
url: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
main:
allow-bean-definition-overriding: true
#mybatis plus 配置
mybatis-plus:
mapper-locations:
- classpath*:com/bailuntec/mapper/*.xml
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
feign:
hystrix:
enabled: false
client:
config:
default:
connectTimeout: 30000
readTimeout: 30000
server:
port: 1224
...@@ -63,6 +63,7 @@ public class SyncFeeService { ...@@ -63,6 +63,7 @@ public class SyncFeeService {
result.getData().forEach(costDto -> { result.getData().forEach(costDto -> {
DcBaseFinanceFee dcBaseFinanceFee = new DcBaseFinanceFee(); DcBaseFinanceFee dcBaseFinanceFee = new DcBaseFinanceFee();
BeanUtils.copyProperties(costDto, dcBaseFinanceFee, "id"); BeanUtils.copyProperties(costDto, dcBaseFinanceFee, "id");
dcBaseFinanceFee.setCreateTime(LocalDateTime.ofInstant(costDto.getCreateTime().toInstant(), ZoneId.systemDefault()));
//更新 //更新
int update = dcBaseFinanceFeeMapper.update(dcBaseFinanceFee, new LambdaQueryWrapper<DcBaseFinanceFee>() int update = dcBaseFinanceFeeMapper.update(dcBaseFinanceFee, new LambdaQueryWrapper<DcBaseFinanceFee>()
.eq(DcBaseFinanceFee::getCostNo, dcBaseFinanceFee.getCostNo())); .eq(DcBaseFinanceFee::getCostNo, dcBaseFinanceFee.getCostNo()));
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<module>base-sync-oms-order</module> <module>base-sync-oms-order</module>
<module>base-sync-company</module> <module>base-sync-company</module>
<module>base-sync-purchase-details</module> <module>base-sync-purchase-details</module>
<module>base-sync-ebay</module>
</modules> </modules>
</project> </project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment