Commit 6235f1f1 by yinyong

数据中心--ebay代码调整

parent 05fd6bb1
...@@ -24,6 +24,7 @@ import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; ...@@ -24,6 +24,7 @@ import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType;
import com.ebay.soap.eBLBaseComponents.PaginationType; import com.ebay.soap.eBLBaseComponents.PaginationType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -59,7 +60,7 @@ public class EbayFinanceAdSyncJob extends PointJob { ...@@ -59,7 +60,7 @@ public class EbayFinanceAdSyncJob extends PointJob {
jobAccountLog.setId(null); jobAccountLog.setId(null);
} }
if(!jobAccountLog.getStartTime().isAfter(LocalDateTime.now().withHour(0).withMinute(0).withSecond(0))) { if(!jobAccountLog.getStartTime().isAfter(LocalDateTime.now().withHour(0).withMinute(0).withSecond(0))) {
callSaasApi(jobAccountLog); callSaasApi(jobAccountLog, shardingContext);
} }
if (jobAccountLog.getId() == null) { //在任务表无记录 if (jobAccountLog.getId() == null) { //在任务表无记录
jobAccountLogMapper = SessionUtil.getSession().getMapper(JobAccountLogMapper.class); jobAccountLogMapper = SessionUtil.getSession().getMapper(JobAccountLogMapper.class);
...@@ -94,7 +95,7 @@ public class EbayFinanceAdSyncJob extends PointJob { ...@@ -94,7 +95,7 @@ public class EbayFinanceAdSyncJob extends PointJob {
return i; return i;
} }
public void callSaasApi(JobAccountLog jobAccountLog) { public void callSaasApi(JobAccountLog jobAccountLog, ShardingContext shardingContext) {
try{ try{
DcBaseCompanyAccount dcBaseCompanyAccount = getToken(jobAccountLog); DcBaseCompanyAccount dcBaseCompanyAccount = getToken(jobAccountLog);
...@@ -120,14 +121,15 @@ public class EbayFinanceAdSyncJob extends PointJob { ...@@ -120,14 +121,15 @@ public class EbayFinanceAdSyncJob extends PointJob {
getAccountCall.setViewPeriod(timeFilter); getAccountCall.setViewPeriod(timeFilter);
getAccountCall.setInvoiceDate(cal); getAccountCall.setInvoiceDate(cal);
getAccountInfo(getAccountCall, dcBaseCompanyAccount, jobAccountLog); getAccountInfo(getAccountCall, dcBaseCompanyAccount, jobAccountLog, shardingContext);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
jobAccountLog.setMessage("执行失败"+ e); jobAccountLog.setMessage("执行失败"+ e);
} }
} }
public void getAccountInfo(GetAccountCall getAccountCall, DcBaseCompanyAccount dcBaseCompanyAccount, JobAccountLog jobAccountLog) throws Exception { public void getAccountInfo(GetAccountCall getAccountCall, DcBaseCompanyAccount dcBaseCompanyAccount, JobAccountLog jobAccountLog, ShardingContext shardingContext) throws Exception {
PaginationType paginationType = new PaginationType(); PaginationType paginationType = new PaginationType();
Integer pageIndex = 1; Integer pageIndex = 1;
...@@ -146,7 +148,7 @@ public class EbayFinanceAdSyncJob extends PointJob { ...@@ -146,7 +148,7 @@ public class EbayFinanceAdSyncJob extends PointJob {
// LocalDateTime gmt = LocalDateTime.from(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(accountEntry.getDate().getTime())); // LocalDateTime gmt = LocalDateTime.from(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(accountEntry.getDate().getTime()));
dcBaseFinanceEbay.setGmtDate(gmt); dcBaseFinanceEbay.setGmtDate(gmt);
dcBaseFinanceEbay.setBjDate(dcBaseFinanceEbay.getGmtDate().minusHours(15L)); dcBaseFinanceEbay.setBjDate(dcBaseFinanceEbay.getGmtDate().minusHours(15L));
dcBaseFinanceEbay.setAccountEntryType(accountEntry.getAccountDetailsEntryType().value()); dcBaseFinanceEbay.setAccountEntryType(accountEntry.getAccountDetailsEntryType() == null ? "" : accountEntry.getAccountDetailsEntryType().value());
dcBaseFinanceEbay.setVatPercent(accountEntry.getVATPercent()); dcBaseFinanceEbay.setVatPercent(accountEntry.getVATPercent());
dcBaseFinanceEbay.setItemId(accountEntry.getItemID()); dcBaseFinanceEbay.setItemId(accountEntry.getItemID());
dcBaseFinanceEbay.setTransactionId(accountEntry.getTransactionID()); dcBaseFinanceEbay.setTransactionId(accountEntry.getTransactionID());
...@@ -173,7 +175,11 @@ public class EbayFinanceAdSyncJob extends PointJob { ...@@ -173,7 +175,11 @@ public class EbayFinanceAdSyncJob extends PointJob {
DcBaseFinanceEbayMapper dcBaseFinanceEbayMapper = SessionUtil.getSession().getMapper(DcBaseFinanceEbayMapper.class); DcBaseFinanceEbayMapper dcBaseFinanceEbayMapper = SessionUtil.getSession().getMapper(DcBaseFinanceEbayMapper.class);
/*int i = dcBaseFinanceEbayMapper.updateByExampleSelective(dcBaseFinanceEbay, DcBaseFinanceEbayExample.newAndCreateCriteria().andRefNumberEqualTo(dcBaseFinanceEbay.getRefNumber() == null ? "" : dcBaseFinanceEbay.getRefNumber()).andItemIdEqualTo(dcBaseFinanceEbay.getItemId() == null ? "" : dcBaseFinanceEbay.getItemId()).andAccountEntryTypeEqualTo(dcBaseFinanceEbay.getAccountEntryType() == null ? "" : dcBaseFinanceEbay.getAccountEntryType()).andGmtDateEqualTo(dcBaseFinanceEbay.getGmtDate()).example()); /*int i = dcBaseFinanceEbayMapper.updateByExampleSelective(dcBaseFinanceEbay, DcBaseFinanceEbayExample.newAndCreateCriteria().andRefNumberEqualTo(dcBaseFinanceEbay.getRefNumber() == null ? "" : dcBaseFinanceEbay.getRefNumber()).andItemIdEqualTo(dcBaseFinanceEbay.getItemId() == null ? "" : dcBaseFinanceEbay.getItemId()).andAccountEntryTypeEqualTo(dcBaseFinanceEbay.getAccountEntryType() == null ? "" : dcBaseFinanceEbay.getAccountEntryType()).andGmtDateEqualTo(dcBaseFinanceEbay.getGmtDate()).example());
if (i == 0) {*/ if (i == 0) {*/
dcBaseFinanceEbayMapper.insertSelective(dcBaseFinanceEbay); if(StringUtils.isBlank(shardingContext.getJobParameter())) {
dcBaseFinanceEbayMapper.insertSelective(dcBaseFinanceEbay);
}else {
dcBaseFinanceEbayMapper.insertTestSelective(dcBaseFinanceEbay);
}
/*}*/ /*}*/
}pageIndex = pageIndex + 1; }pageIndex = pageIndex + 1;
} }
......
...@@ -47,6 +47,8 @@ public interface DcBaseFinanceEbayMapper { ...@@ -47,6 +47,8 @@ public interface DcBaseFinanceEbayMapper {
*/ */
int insertSelective(DcBaseFinanceEbay record); int insertSelective(DcBaseFinanceEbay record);
int insertTestSelective(DcBaseFinanceEbay record);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_ebay * This method corresponds to the database table dc_base_finance_ebay
......
...@@ -187,6 +187,156 @@ ...@@ -187,6 +187,156 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
insert into dc_base_finance_ebay
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="bjCreate != null">
bj_create,
</if>
<if test="bjModified != null">
bj_modified,
</if>
<if test="accountEntryType != null">
account_entry_type,
</if>
<if test="description != null">
description,
</if>
<if test="gmtDate != null">
gmt_date,
</if>
<if test="bjDate != null">
bj_date,
</if>
<if test="grossAmount != null">
gross_amount,
</if>
<if test="itemId != null">
item_id,
</if>
<if test="memo != null">
memo,
</if>
<if test="netAmount != null">
net_amount,
</if>
<if test="refNumber != null">
ref_number,
</if>
<if test="vatPercent != null">
vat_percent,
</if>
<if test="title != null">
title,
</if>
<if test="orderLineId != null">
order_line_id,
</if>
<if test="transactionId != null">
transaction_id,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="receivedTopRatedDiscount != null">
received_top_rated_discount,
</if>
<if test="accountId != null">
account_id,
</if>
<if test="currency != null">
currency,
</if>
<if test="exchangeRate != null">
exchange_rate,
</if>
<if test="exchangeRateUsd != null">
exchange_rate_usd,
</if>
<if test="reportDate != null">
report_date,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="bjCreate != null">
#{bjCreate,jdbcType=TIMESTAMP},
</if>
<if test="bjModified != null">
#{bjModified,jdbcType=TIMESTAMP},
</if>
<if test="accountEntryType != null">
#{accountEntryType,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="gmtDate != null">
#{gmtDate,jdbcType=TIMESTAMP},
</if>
<if test="bjDate != null">
#{bjDate,jdbcType=TIMESTAMP},
</if>
<if test="grossAmount != null">
#{grossAmount,jdbcType=DECIMAL},
</if>
<if test="itemId != null">
#{itemId,jdbcType=VARCHAR},
</if>
<if test="memo != null">
#{memo,jdbcType=VARCHAR},
</if>
<if test="netAmount != null">
#{netAmount,jdbcType=DECIMAL},
</if>
<if test="refNumber != null">
#{refNumber,jdbcType=VARCHAR},
</if>
<if test="vatPercent != null">
#{vatPercent,jdbcType=DECIMAL},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="orderLineId != null">
#{orderLineId,jdbcType=VARCHAR},
</if>
<if test="transactionId != null">
#{transactionId,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
<if test="receivedTopRatedDiscount != null">
#{receivedTopRatedDiscount,jdbcType=BIT},
</if>
<if test="accountId != null">
#{accountId,jdbcType=INTEGER},
</if>
<if test="currency != null">
#{currency,jdbcType=VARCHAR},
</if>
<if test="exchangeRate != null">
#{exchangeRate,jdbcType=DECIMAL},
</if>
<if test="exchangeRateUsd != null">
#{exchangeRateUsd,jdbcType=DECIMAL},
</if>
<if test="reportDate != null">
#{reportDate,jdbcType=DATE},
</if>
</trim>
</insert>
<insert id="insertTestSelective" parameterType="com.bailuntec.domain.entity.DcBaseFinanceEbay">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into dc_base_finance_ebay3_copy insert into dc_base_finance_ebay3_copy
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -331,6 +481,7 @@ ...@@ -331,6 +481,7 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceEbayExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceEbayExample" resultType="java.lang.Long">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
......
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