Commit bc6a40b5 by wutong

新增定时任务抓取Ebay的费用

parent 1a8e49da
FROM maven:3.6.0-alpine
RUN apk add ca-certificates && \
apk add tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
# make source folder
RUN mkdir -p /usr/app
WORKDIR /usr/app
# install maven dependency packages (keep in image)
COPY data-parent /usr/app/data-parent
COPY data-common /usr/app/data-common
COPY data-base /usr/app/data-base
COPY data-mid /usr/app/data-mid
COPY data-show /usr/app/data-show
RUN cd /usr/app/data-parent && mvn -T 1C install -pl ../data-base/base-sync-finance-ebay -am
#指定容器启动程序及参数 <ENTRYPOINT> "<CMD>"
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/app/data-base/base-sync-finance-ebay/target/base-sync-finance-ebay-1.0-SNAPSHOT.jar"]
\ No newline at end of file
<?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>data-base</artifactId>
<groupId>com.bailuntec</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>base-sync-finance-ebay</artifactId>
<dependencies>
<dependency>
<groupId>com.bailuntec</groupId>
<artifactId>data-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>com.bailuntec.Application</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<!--默认是true-->
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
package com.bailuntec;
import com.alibaba.druid.pool.DruidDataSource;
import com.bailuntec.job.EbayFinanceSyncJob;
import com.bailuntec.utils.PropertiesUtil;
import com.dangdang.ddframe.job.config.JobCoreConfiguration;
import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration;
import com.dangdang.ddframe.job.event.JobEventConfiguration;
import com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration;
import com.dangdang.ddframe.job.lite.api.JobScheduler;
import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration;
import com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import lombok.extern.slf4j.Slf4j;
import javax.sql.DataSource;
@Slf4j
public class Application {
private static PropertiesUtil propertiesUtil = PropertiesUtil.getInstance("job");
private static final String EVENT_RDB_STORAGE_DRIVER = propertiesUtil.getPropertyAsString("EVENT_RDB_STORAGE_DRIVER");
private static final String EVENT_RDB_STORAGE_URL = propertiesUtil.getPropertyAsString("EVENT_RDB_STORAGE_URL");
private static final String EVENT_RDB_STORAGE_USERNAME = propertiesUtil.getPropertyAsString("EVENT_RDB_STORAGE_USERNAME");
private static final String EVENT_RDB_STORAGE_PASSWORD = propertiesUtil.getPropertyAsString("EVENT_RDB_STORAGE_PASSWORD");
public static void main(String[] args) {
new JobScheduler(createRegistryCenter(), createJobConfiguration1()).init();
}
private static CoordinatorRegistryCenter createRegistryCenter() {
CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new ZookeeperConfiguration(propertiesUtil.getPropertyAsString("ZOOKEEPER_SERVER"), propertiesUtil.getPropertyAsString("NAME_SPACE")));
regCenter.init();
return regCenter;
}
private static LiteJobConfiguration createJobConfiguration1() {
JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(propertiesUtil.getPropertyAsString("JOB_NAME"), propertiesUtil.getPropertyAsString("JOB_CRON"), propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT")).build();
SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, EbayFinanceSyncJob.class.getCanonicalName());
LiteJobConfiguration simpleJobRootConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).build();
return simpleJobRootConfig;
}
private static JobEventConfiguration createJobEventConfiguration() {
JobEventConfiguration jobEventRdbConfig = new JobEventRdbConfiguration(setUpEventTraceDataSource());
return jobEventRdbConfig;
}
private static DataSource setUpEventTraceDataSource() {
DruidDataSource result = new DruidDataSource();
result.setDriverClassName(EVENT_RDB_STORAGE_DRIVER);
result.setUrl(EVENT_RDB_STORAGE_URL);
result.setUsername(EVENT_RDB_STORAGE_USERNAME);
result.setPassword(EVENT_RDB_STORAGE_PASSWORD);
return result;
}
}
package com.bailuntec.domain.pojo;
import lombok.Data;
import java.util.List;
@Data
public class AccountEntries {
private List<AccountEntry> accountEntry;
}
package com.bailuntec.domain.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class AccountEntry {
@JSONField(name = "AccountDetailsEntryType")
private String accountEntryType;
@JSONField(name = "Description")
private String description;
@JSONField(name = "Date")
private String gmtDate_;
@JSONField(name = "GrossDetailAmount")
private Currency grossAmount_;
@JSONField(name = "ItemID")
private String itemId;
@JSONField(name = "Memo")
private String memo;
@JSONField(name = "NetDetailAmount")
private Currency netAmount_;
@JSONField(name = "RefNumber")
private String refNumber;
@JSONField(name = "VATPercent")
private BigDecimal vatPercent;
@JSONField(name = "Title")
private String title;
@JSONField(name = "OrderLineItemID")
private String orderLineId;
@JSONField(name = "TransactionID")
private String transactionId;
@JSONField(name = "ReceivedTopRatedDiscount")
private String receivedTopRatedDiscount;
}
package com.bailuntec.domain.pojo;
import lombok.Data;
@Data
public class AccountSummary {
private String accountState;
private AdditionalAccount additionalAccount;
private Currency amountPastDue;
private String billingCycleDate;
private Currency lastAmountPaid;
private String lastPaymentDate;
private String pastDue;
private String paymentMethod;
}
package com.bailuntec.domain.pojo;
import lombok.Data;
@Data
public class AdditionalAccount {
private Currency balance;
private String currency;
private String accountCode;
}
package com.bailuntec.domain.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class Currency {
@JSONField(name = "_currencyID")
private String currency;
private BigDecimal value;
}
package com.bailuntec.domain.pojo;
import lombok.Data;
@Data
public class EbayResult {
private String timestamp;
private String ack;
private String version;
private String build;
private String accountID;
private AccountSummary accountSummary;
private String currency;
private AccountEntries accountEntries;
private PaginationResult paginationResult;
private String entriesPerPage;
private Integer pageNumber;
}
package com.bailuntec.domain.pojo;
import lombok.Data;
@Data
public class PaginationResult {
private Integer totalNumberOfPages;
}
package com.bailuntec.job;
import com.alibaba.fastjson.JSON;
import com.bailuntec.domain.entity.DcBaseFinanceEbay;
import com.bailuntec.domain.entity.JobAccountLog;
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBaseCompanyAccountExample;
import com.bailuntec.domain.example.DcBaseFinanceEbayExample;
import com.bailuntec.domain.example.JobAccountLogExample;
import com.bailuntec.domain.pojo.AccountEntries;
import com.bailuntec.domain.pojo.AccountEntry;
import com.bailuntec.domain.pojo.EbayResult;
import com.bailuntec.mapper.DcBaseCompanyAccountMapper;
import com.bailuntec.mapper.DcBaseFinanceEbayMapper;
import com.bailuntec.mapper.JobAccountLogMapper;
import com.bailuntec.support.CallBailunSystem;
import com.bailuntec.support.PointJob;
import com.bailuntec.utils.OkHttpUtil;
import com.bailuntec.utils.PropertiesUtil;
import com.bailuntec.utils.SessionUtil;
import com.dangdang.ddframe.job.api.ShardingContext;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.apache.commons.beanutils.BeanUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
@Slf4j
public class EbayFinanceSyncJob extends PointJob {
private PropertiesUtil propertiesUtil = PropertiesUtil.getInstance("const");
private OkHttpClient client = OkHttpUtil.getInstance();
@Override
public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) {
try {
JobAccountLogMapper jobAccountLogMapper = SessionUtil.getSession().getMapper(JobAccountLogMapper.class);
int totalPage = getTotalPage(jobPointLog);
/*
* 根据不同分片
* 再分页去处理数据
*/
int shardingSize = totalPage % shardingContext.getShardingTotalCount() == 0 ? totalPage / shardingContext.getShardingTotalCount() : totalPage / shardingContext.getShardingTotalCount() + 1;
if (shardingContext.getShardingItem() + 1 < shardingContext.getShardingTotalCount()) {
totalPage = shardingSize * (shardingContext.getShardingItem() + 1);
}
int page = 0;
if (shardingContext.getShardingItem() > 0) {
page = shardingSize * shardingContext.getShardingItem();
}
do {
//拿到账号和任务信息去调接口
List<JobAccountLog> listByPage = jobAccountLogMapper.getListByPage(12,page * jobPointLog.getPageSize(), jobPointLog.getPageSize());
if (listByPage != null && listByPage.size() > 0) {
for (JobAccountLog jobAccountLog : listByPage) {
if (jobAccountLog.getId() == null) { //在任务表无记录
BeanUtils.copyProperties(jobAccountLog, jobPointLog);
jobAccountLog.setId(null);
}
callSaasApi(jobAccountLog);
if (jobAccountLog.getId() == null) { //在任务表无记录
jobAccountLogMapper.insertSelective(jobAccountLog);
} else {
jobAccountLog.setBjModified(LocalDateTime.now());
jobAccountLogMapper.updateByExampleSelective(jobAccountLog,JobAccountLogExample.newAndCreateCriteria().andAccountIdEqualTo(jobAccountLog.getAccountId()).andJobNameEqualTo(jobAccountLog.getJobName()).example());
}
}
}
jobPointLog.setPageIndex(jobPointLog.getPageIndex() + 1);
} while (jobPointLog.getPageIndex() <= totalPage);
} catch (Exception e) {
e.printStackTrace();
log.warn("Ebay定时同步费用接口错误",e);
} finally {
SessionUtil.closeSession();
}
}
private int getTotalPage(JobPointLog jobPointLog) throws Exception {
DcBaseCompanyAccountMapper accountMapper = SessionUtil.getSession().getMapper(DcBaseCompanyAccountMapper.class);
int l = (int)accountMapper.countByExample(DcBaseCompanyAccountExample.newAndCreateCriteria().andPlatformIdEqualTo(12).example());
return l % jobPointLog.getPageSize() == 0? l % jobPointLog.getPageSize() : l % jobPointLog.getPageSize() + 1;
}
private void callSaasApi(JobAccountLog job) {
HashMap<String, Object> map = new HashMap<>(5);
map.put("account_id",job.getAccountId());
map.put("AccountEntrySortType","AccountEntryItemNumberAscending");
map.put("BeginDate", job.getStartTime().minusHours(8).minusMinutes(2));
map.put("EndDate",job.getEndTime().minusHours(8));
MediaType mediaType = MediaType.parse("application/json");
Integer pageNumber = 0;
DcBaseFinanceEbay dcBaseFinanceEbay = new DcBaseFinanceEbay();
Response response = null;
try {
DcBaseFinanceEbayMapper dcBaseFinanceEbayMapper = SessionUtil.getSession().getMapper(DcBaseFinanceEbayMapper.class);
do {
map.put("PageNumber",job.getPageIndex() > 0?job.getPageIndex(): 1);
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(map));
Request request = new Request.Builder()
.url(propertiesUtil.getPropertyAsString("EBAY_FINANCE_URL"))
.post(body)
.addHeader("Content-Type", "application/json")
.build();
response = client.newCall(request).execute();
log.warn(JSON.toJSONString(map));
EbayResult ebayResult = JSON.parseObject(response.body().byteStream(), EbayResult.class);
AccountEntries accountEntries = ebayResult.getAccountEntries();
if (accountEntries != null) {
List<AccountEntry> accountEntryList = accountEntries.getAccountEntry();
if (accountEntryList != null && accountEntryList.size() > 0) {
for (AccountEntry accountEntry : accountEntryList) {
LocalDateTime gmt = LocalDateTime.from(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(accountEntry.getGmtDate_()));
dcBaseFinanceEbay.setGmtDate(gmt);
dcBaseFinanceEbay.setBjDate(dcBaseFinanceEbay.getGmtDate().plusHours(8));
BeanUtils.copyProperties(dcBaseFinanceEbay, accountEntry);
if (accountEntry.getGrossAmount_() != null) {
dcBaseFinanceEbay.setGrossAmount(accountEntry.getGrossAmount_().getValue());
dcBaseFinanceEbay.setCurrency(accountEntry.getGrossAmount_().getCurrency());
dcBaseFinanceEbay.setExchangeRate(CallBailunSystem.getExchangeRate(dcBaseFinanceEbay.getCurrency(),"CNY",dcBaseFinanceEbay.getBjDate()));
}
if (accountEntry.getGrossAmount_() != null) {
dcBaseFinanceEbay.setNetAmount(accountEntry.getNetAmount_().getValue());
}
dcBaseFinanceEbay.setAccountId(job.getAccountId());
dcBaseFinanceEbay.setCompanyId(job.getCompanyId());
dcBaseFinanceEbay.setBjModified(LocalDateTime.now());
int i = dcBaseFinanceEbayMapper.updateByExampleSelective(dcBaseFinanceEbay, DcBaseFinanceEbayExample.newAndCreateCriteria().andAccountIdEqualTo(dcBaseFinanceEbay.getAccountId()).andRefNumberEqualTo(dcBaseFinanceEbay.getRefNumber()).example());
if (i == 0) {
dcBaseFinanceEbayMapper.insertSelective(dcBaseFinanceEbay);
}
}
}
}
pageNumber = ebayResult.getPageNumber();
job.setPageIndex(job.getPageIndex() + 1);
} while (job.getPageIndex() <= pageNumber);
job.setPageIndex(1);
job.setStartTime(job.getEndTime());
job.setEndTime(job.getStartTime().plusDays(job.getIntervalTime()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : job.getEndTime().plusDays(job.getIntervalTime()));
job.setMessage("success");
} catch (Exception e) {
e.printStackTrace();
job.setMessage(e.getCause().toString());
} finally {
if (response != null) {
response.close();
}
}
}
}
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcBaseCompanyAccount;
import com.bailuntec.domain.example.DcBaseCompanyAccountExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DcBaseCompanyAccountMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
long countByExample(DcBaseCompanyAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int deleteByExample(DcBaseCompanyAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int insert(DcBaseCompanyAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int insertSelective(DcBaseCompanyAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
DcBaseCompanyAccount selectOneByExample(DcBaseCompanyAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
List<DcBaseCompanyAccount> selectByExample(DcBaseCompanyAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
DcBaseCompanyAccount selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") DcBaseCompanyAccount record, @Param("example") DcBaseCompanyAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int updateByExample(@Param("record") DcBaseCompanyAccount record, @Param("example") DcBaseCompanyAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(DcBaseCompanyAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
*/
int updateByPrimaryKey(DcBaseCompanyAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcBaseCompanyAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_company_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcBaseCompanyAccount record);
}
\ No newline at end of file
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcBaseFinanceEbay;
import com.bailuntec.domain.example.DcBaseFinanceEbayExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DcBaseFinanceEbayMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
long countByExample(DcBaseFinanceEbayExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int deleteByExample(DcBaseFinanceEbayExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int insert(DcBaseFinanceEbay record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int insertSelective(DcBaseFinanceEbay record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
DcBaseFinanceEbay selectOneByExample(DcBaseFinanceEbayExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
List<DcBaseFinanceEbay> selectByExample(DcBaseFinanceEbayExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
DcBaseFinanceEbay selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") DcBaseFinanceEbay record, @Param("example") DcBaseFinanceEbayExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int updateByExample(@Param("record") DcBaseFinanceEbay record, @Param("example") DcBaseFinanceEbayExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(DcBaseFinanceEbay record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
*/
int updateByPrimaryKey(DcBaseFinanceEbay record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcBaseFinanceEbay record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcBaseFinanceEbay record);
}
\ No newline at end of file
EBAY_FINANCE_URL=http://10.0.3.7:8888/ebay/get_account
#EBAY_FINANCE_URL=http://111.230.84.223:8888/ebay/get_account
#EVENT_RDB_STORAGE_URL=jdbc:mysql://192.168.6.140:3306/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
#EVENT_RDB_STORAGE_USERNAME=root
#EVENT_RDB_STORAGE_PASSWORD=123456
#ZOOKEEPER_SERVER=127.0.0.1:2181
EVENT_RDB_STORAGE_DRIVER=com.mysql.jdbc.Driver
EVENT_RDB_STORAGE_URL=jdbc:mysql://10.0.8.15:3306/bailun_datacenter?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
EVENT_RDB_STORAGE_USERNAME=root
EVENT_RDB_STORAGE_PASSWORD=#7kfnymAM$Y9-Ntf
ZOOKEEPER_SERVER=172.31.255.120:2181
NAME_SPACE=data-center
JOB_NAME=base-sync-finance-ebay
JOB_CRON=0 0/20 * * * ? *
SHARDING_TOTAL_COUNT=3
\ No newline at end of file
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.job.EbayFinanceSyncJob;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.executor.ShardingContexts;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import java.util.HashMap;
public class EbayFinanceSyncJobTest {
@Test
public void test3() {
EbayFinanceSyncJob skuSyncJob = new EbayFinanceSyncJob();
ShardingContext job = new ShardingContext(new ShardingContexts("1", "job", 3, "", new HashMap<>()), 1);
skuSyncJob.executeJob(job, new JobPointLog("",1 ,100,1,1, LocalDateTime.now().minusMonths(1),LocalDateTime.now().minusDays(29)));
}
}
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<module>base-sync-oms-order-for-tj</module> <module>base-sync-oms-order-for-tj</module>
<module>base-sync-cost-first</module> <module>base-sync-cost-first</module>
<module>base-sync-company</module> <module>base-sync-company</module>
<module>base-sync-finance-ebay</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>
......
package com.bailuntec.domain.entity;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class JobAccountLog {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.company_id
*
* @mbg.generated
*/
private Integer companyId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.account_id
*
* @mbg.generated
*/
private Integer accountId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.job_name
*
* @mbg.generated
*/
private String jobName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.page_index
*
* @mbg.generated
*/
private Integer pageIndex;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.page_size
*
* @mbg.generated
*/
private Integer pageSize;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.type
*
* @mbg.generated
*/
private Integer type;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.interval_time
*
* @mbg.generated
*/
private Integer intervalTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.start_time
*
* @mbg.generated
*/
private LocalDateTime startTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.end_time
*
* @mbg.generated
*/
private LocalDateTime endTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.bj_create
*
* @mbg.generated
*/
private LocalDateTime bjCreate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.bj_modified
*
* @mbg.generated
*/
private LocalDateTime bjModified;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_account_log.message
*
* @mbg.generated
*/
private String message;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", companyId=").append(companyId);
sb.append(", accountId=").append(accountId);
sb.append(", jobName=").append(jobName);
sb.append(", pageIndex=").append(pageIndex);
sb.append(", pageSize=").append(pageSize);
sb.append(", type=").append(type);
sb.append(", intervalTime=").append(intervalTime);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", bjCreate=").append(bjCreate);
sb.append(", bjModified=").append(bjModified);
sb.append(", message=").append(message);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
JobAccountLog other = (JobAccountLog) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getAccountId() == null ? other.getAccountId() == null : this.getAccountId().equals(other.getAccountId()))
&& (this.getJobName() == null ? other.getJobName() == null : this.getJobName().equals(other.getJobName()))
&& (this.getPageIndex() == null ? other.getPageIndex() == null : this.getPageIndex().equals(other.getPageIndex()))
&& (this.getPageSize() == null ? other.getPageSize() == null : this.getPageSize().equals(other.getPageSize()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getIntervalTime() == null ? other.getIntervalTime() == null : this.getIntervalTime().equals(other.getIntervalTime()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
&& (this.getBjCreate() == null ? other.getBjCreate() == null : this.getBjCreate().equals(other.getBjCreate()))
&& (this.getBjModified() == null ? other.getBjModified() == null : this.getBjModified().equals(other.getBjModified()))
&& (this.getMessage() == null ? other.getMessage() == null : this.getMessage().equals(other.getMessage()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
result = prime * result + ((getAccountId() == null) ? 0 : getAccountId().hashCode());
result = prime * result + ((getJobName() == null) ? 0 : getJobName().hashCode());
result = prime * result + ((getPageIndex() == null) ? 0 : getPageIndex().hashCode());
result = prime * result + ((getPageSize() == null) ? 0 : getPageSize().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getIntervalTime() == null) ? 0 : getIntervalTime().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
result = prime * result + ((getBjCreate() == null) ? 0 : getBjCreate().hashCode());
result = prime * result + ((getBjModified() == null) ? 0 : getBjModified().hashCode());
result = prime * result + ((getMessage() == null) ? 0 : getMessage().hashCode());
return result;
}
}
\ No newline at end of file
package com.bailuntec.domain.enumerate; package com.bailuntec.domain.enumerate;
/**
* 这是OMS的平台枚举值
*/
public enum PlatformType { public enum PlatformType {
Amazon(1,"AMAZON"), Amazon(1,"AMAZON"),
Ebay(2,"EBAY"), Ebay(2,"EBAY"),
......
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.JobAccountLog;
import com.bailuntec.domain.example.JobAccountLogExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface JobAccountLogMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
long countByExample(JobAccountLogExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int deleteByExample(JobAccountLogExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int insert(JobAccountLog record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int insertSelective(JobAccountLog record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
JobAccountLog selectOneByExample(JobAccountLogExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
List<JobAccountLog> selectByExample(JobAccountLogExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
JobAccountLog selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") JobAccountLog record, @Param("example") JobAccountLogExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int updateByExample(@Param("record") JobAccountLog record, @Param("example") JobAccountLogExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(JobAccountLog record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
*/
int updateByPrimaryKey(JobAccountLog record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(JobAccountLog record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table job_account_log
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(JobAccountLog record);
List<JobAccountLog> getListByPage(@Param("platformId") Integer platformId, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
}
\ No newline at end of file
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