Commit 67d8e7e6 by huluobin

亚马逊广告

parent 0f93a03e
...@@ -90,7 +90,8 @@ public class AmazonAdDownloadReportJob implements SimpleJob { ...@@ -90,7 +90,8 @@ public class AmazonAdDownloadReportJob implements SimpleJob {
.andReportDateEqualTo(jobAmazonAdLog.getReportDate()) .andReportDateEqualTo(jobAmazonAdLog.getReportDate())
.andCampaignIdEqualTo(amazonAdProduct.getCampaignId()) .andCampaignIdEqualTo(amazonAdProduct.getCampaignId())
.andAdGroupIdEqualTo(amazonAdProduct.getAdGroupId()) .andAdGroupIdEqualTo(amazonAdProduct.getAdGroupId())
.andSkuEqualTo(amazonAdProduct.getSku()) // .andSkuEqualTo(amazonAdProduct.getSku())
.andTypeEqualTo(jobAmazonAdLog.getType())
.example(); .example();
DcBaseFinanceAmazonAdProduct dcBaseFinanceAmazonAdProduct = dcBaseFinanceAmazonAdProductMapper.selectOneByExample(example); DcBaseFinanceAmazonAdProduct dcBaseFinanceAmazonAdProduct = dcBaseFinanceAmazonAdProductMapper.selectOneByExample(example);
...@@ -104,6 +105,7 @@ public class AmazonAdDownloadReportJob implements SimpleJob { ...@@ -104,6 +105,7 @@ public class AmazonAdDownloadReportJob implements SimpleJob {
dcBaseFinanceAmazonAdProduct.setExchangeRate(CallBailunSystem.getExchangeRate(dcBaseFinanceAmazonAdProduct.getCurrency(), CurrencyType.CNY.value(), jobAmazonAdLog.getReportDate().atStartOfDay())); dcBaseFinanceAmazonAdProduct.setExchangeRate(CallBailunSystem.getExchangeRate(dcBaseFinanceAmazonAdProduct.getCurrency(), CurrencyType.CNY.value(), jobAmazonAdLog.getReportDate().atStartOfDay()));
dcBaseFinanceAmazonAdProduct.setExchangeRateUsd(CallBailunSystem.getExchangeRate(dcBaseFinanceAmazonAdProduct.getCurrency(), CurrencyType.USD.value(), jobAmazonAdLog.getReportDate().atStartOfDay())); dcBaseFinanceAmazonAdProduct.setExchangeRateUsd(CallBailunSystem.getExchangeRate(dcBaseFinanceAmazonAdProduct.getCurrency(), CurrencyType.USD.value(), jobAmazonAdLog.getReportDate().atStartOfDay()));
dcBaseFinanceAmazonAdProduct.setBjModifyTime(LocalDateTime.now()); dcBaseFinanceAmazonAdProduct.setBjModifyTime(LocalDateTime.now());
dcBaseFinanceAmazonAdProduct.setType(jobAmazonAdLog.getType());
if (dcBaseFinanceAmazonAdProduct.getId() == null) { if (dcBaseFinanceAmazonAdProduct.getId() == null) {
dcBaseFinanceAmazonAdProductMapper.insertSelective(dcBaseFinanceAmazonAdProduct, null); dcBaseFinanceAmazonAdProductMapper.insertSelective(dcBaseFinanceAmazonAdProduct, null);
......
...@@ -50,7 +50,6 @@ public class AmazonAdGenerateReportIdJob implements SimpleJob { ...@@ -50,7 +50,6 @@ public class AmazonAdGenerateReportIdJob implements SimpleJob {
.forEach(dcBaseCompanyAccount -> { .forEach(dcBaseCompanyAccount -> {
try { try {
LocalDateTime reportDate = LocalDateTime.now().minusDays(1).minusHours(12); LocalDateTime reportDate = LocalDateTime.now().minusDays(1).minusHours(12);
// LocalDateTime reportDate = LocalDateTime.of(2020, 8, finalI, 0, 0);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("reportDate", reportDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"))); jsonObject.put("reportDate", reportDate.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
jsonObject.put("metrics", propertiesUtil.getPropertyAsString("METRICS")); jsonObject.put("metrics", propertiesUtil.getPropertyAsString("METRICS"));
...@@ -91,7 +90,8 @@ public class AmazonAdGenerateReportIdJob implements SimpleJob { ...@@ -91,7 +90,8 @@ public class AmazonAdGenerateReportIdJob implements SimpleJob {
LocalDateTime.now(), LocalDateTime.now(),
LocalDateTime.now(), LocalDateTime.now(),
dcBaseCompanyAccount.getSiteEn(), dcBaseCompanyAccount.getSiteEn(),
dcBaseCompanyAccount.getCompanyId()); dcBaseCompanyAccount.getCompanyId(),
1);
} }
//如果已经生成了报告 是否设置为需要重新下载?//yes //如果已经生成了报告 是否设置为需要重新下载?//yes
else { else {
...@@ -103,6 +103,7 @@ public class AmazonAdGenerateReportIdJob implements SimpleJob { ...@@ -103,6 +103,7 @@ public class AmazonAdGenerateReportIdJob implements SimpleJob {
jobAmazonAdLogMapper.upsert(jobAmazonAdLog); jobAmazonAdLogMapper.upsert(jobAmazonAdLog);
log.info("生成报告成功,报告日志:{}", JSON.toJSONString(jobAmazonAdLog)); log.info("生成报告成功,报告日志:{}", JSON.toJSONString(jobAmazonAdLog));
} else { } else {
log.error(JSON.toJSONString(response)); log.error(JSON.toJSONString(response));
throw new RuntimeException("生成报告失败"); throw new RuntimeException("生成报告失败");
......
...@@ -11,11 +11,11 @@ import okhttp3.Request; ...@@ -11,11 +11,11 @@ import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.IOException; import java.io.*;
import java.io.InputStreamReader;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Scanner;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
/** /**
...@@ -47,12 +47,27 @@ class AmazonAdDownloadReportJobTest { ...@@ -47,12 +47,27 @@ class AmazonAdDownloadReportJobTest {
.build(); .build();
Response response = new OkHttpClient().newCall(request).execute(); Response response = new OkHttpClient().newCall(request).execute();
// File file = new File("/Users/huluobin/Downloads/adProfile")
GZIPInputStream inputStream = new GZIPInputStream(response.body().byteStream()); GZIPInputStream inputStream = new GZIPInputStream(response.body().byteStream());
Type type = new TypeToken<List<AmazonAdProduct>>() { Type type = new TypeToken<List<AmazonAdProduct>>() {
}.getType(); }.getType();
List<AmazonAdProduct> amazonAdProductList = new Gson().fromJson(new InputStreamReader(inputStream), type);
log.warn("的Report解析完成");
StringBuilder html= new StringBuilder();
Scanner sc = new Scanner(inputStream);
while (sc.hasNextLine()) {
html.append(sc.nextLine().toString() + "\r\n");
}
System.out.println(html);
// List<AmazonAdProduct> amazonAdProductList = new Gson().fromJson(new InputStreamReader(inputStream), type);
// log.warn("的Report解析完成");
} }
} }
package com.bailuntec.domain.entity; package com.bailuntec.domain.entity;
import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import lombok.Data;
@Data @Data
public class DcBaseFinanceAmazonAdProduct { public class DcBaseFinanceAmazonAdProduct {
...@@ -396,6 +395,15 @@ public class DcBaseFinanceAmazonAdProduct { ...@@ -396,6 +395,15 @@ public class DcBaseFinanceAmazonAdProduct {
private BigDecimal exchangeRateUsd; private BigDecimal exchangeRateUsd;
/** /**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_finance_amazon_ad_product.type
*
* @mbg.generated
*/
private Integer type;
/**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_finance_amazon_ad_product * This method corresponds to the database table dc_base_finance_amazon_ad_product
* *
...@@ -450,6 +458,7 @@ public class DcBaseFinanceAmazonAdProduct { ...@@ -450,6 +458,7 @@ public class DcBaseFinanceAmazonAdProduct {
sb.append(", reportType=").append(reportType); sb.append(", reportType=").append(reportType);
sb.append(", exchangeRate=").append(exchangeRate); sb.append(", exchangeRate=").append(exchangeRate);
sb.append(", exchangeRateUsd=").append(exchangeRateUsd); sb.append(", exchangeRateUsd=").append(exchangeRateUsd);
sb.append(", type=").append(type);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
...@@ -514,7 +523,8 @@ public class DcBaseFinanceAmazonAdProduct { ...@@ -514,7 +523,8 @@ public class DcBaseFinanceAmazonAdProduct {
&& (this.getReportDate() == null ? other.getReportDate() == null : this.getReportDate().equals(other.getReportDate())) && (this.getReportDate() == null ? other.getReportDate() == null : this.getReportDate().equals(other.getReportDate()))
&& (this.getReportType() == null ? other.getReportType() == null : this.getReportType().equals(other.getReportType())) && (this.getReportType() == null ? other.getReportType() == null : this.getReportType().equals(other.getReportType()))
&& (this.getExchangeRate() == null ? other.getExchangeRate() == null : this.getExchangeRate().equals(other.getExchangeRate())) && (this.getExchangeRate() == null ? other.getExchangeRate() == null : this.getExchangeRate().equals(other.getExchangeRate()))
&& (this.getExchangeRateUsd() == null ? other.getExchangeRateUsd() == null : this.getExchangeRateUsd().equals(other.getExchangeRateUsd())); && (this.getExchangeRateUsd() == null ? other.getExchangeRateUsd() == null : this.getExchangeRateUsd().equals(other.getExchangeRateUsd()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
} }
/** /**
...@@ -570,6 +580,7 @@ public class DcBaseFinanceAmazonAdProduct { ...@@ -570,6 +580,7 @@ public class DcBaseFinanceAmazonAdProduct {
result = prime * result + ((getReportType() == null) ? 0 : getReportType().hashCode()); result = prime * result + ((getReportType() == null) ? 0 : getReportType().hashCode());
result = prime * result + ((getExchangeRate() == null) ? 0 : getExchangeRate().hashCode()); result = prime * result + ((getExchangeRate() == null) ? 0 : getExchangeRate().hashCode());
result = prime * result + ((getExchangeRateUsd() == null) ? 0 : getExchangeRateUsd().hashCode()); result = prime * result + ((getExchangeRateUsd() == null) ? 0 : getExchangeRateUsd().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
return result; return result;
} }
} }
\ No newline at end of file
...@@ -8,11 +8,10 @@ import java.time.LocalDate; ...@@ -8,11 +8,10 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
@NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor
public class JobAmazonAdLog { public class JobAmazonAdLog {
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.id * This field corresponds to the database column job_amazon_ad_log.id
* *
...@@ -21,7 +20,6 @@ public class JobAmazonAdLog { ...@@ -21,7 +20,6 @@ public class JobAmazonAdLog {
private Integer id; private Integer id;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.account_id * This field corresponds to the database column job_amazon_ad_log.account_id
* *
...@@ -30,7 +28,6 @@ public class JobAmazonAdLog { ...@@ -30,7 +28,6 @@ public class JobAmazonAdLog {
private Integer accountId; private Integer accountId;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.report_id * This field corresponds to the database column job_amazon_ad_log.report_id
* *
...@@ -39,7 +36,6 @@ public class JobAmazonAdLog { ...@@ -39,7 +36,6 @@ public class JobAmazonAdLog {
private String reportId; private String reportId;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.report_date * This field corresponds to the database column job_amazon_ad_log.report_date
* *
...@@ -48,7 +44,6 @@ public class JobAmazonAdLog { ...@@ -48,7 +44,6 @@ public class JobAmazonAdLog {
private LocalDate reportDate; private LocalDate reportDate;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.status * This field corresponds to the database column job_amazon_ad_log.status
* *
...@@ -57,7 +52,6 @@ public class JobAmazonAdLog { ...@@ -57,7 +52,6 @@ public class JobAmazonAdLog {
private Boolean status; private Boolean status;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.bj_create * This field corresponds to the database column job_amazon_ad_log.bj_create
* *
...@@ -66,7 +60,6 @@ public class JobAmazonAdLog { ...@@ -66,7 +60,6 @@ public class JobAmazonAdLog {
private LocalDateTime bjCreate; private LocalDateTime bjCreate;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.bj_modified * This field corresponds to the database column job_amazon_ad_log.bj_modified
* *
...@@ -75,7 +68,6 @@ public class JobAmazonAdLog { ...@@ -75,7 +68,6 @@ public class JobAmazonAdLog {
private LocalDateTime bjModified; private LocalDateTime bjModified;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.site_en * This field corresponds to the database column job_amazon_ad_log.site_en
* *
...@@ -84,7 +76,6 @@ public class JobAmazonAdLog { ...@@ -84,7 +76,6 @@ public class JobAmazonAdLog {
private String siteEn; private String siteEn;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.company_id * This field corresponds to the database column job_amazon_ad_log.company_id
* *
...@@ -93,6 +84,14 @@ public class JobAmazonAdLog { ...@@ -93,6 +84,14 @@ public class JobAmazonAdLog {
private Integer companyId; private Integer companyId;
/** /**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column job_amazon_ad_log.type
*
* @mbg.generated
*/
private Integer type;
/**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table job_amazon_ad_log * This method corresponds to the database table job_amazon_ad_log
* *
...@@ -113,6 +112,7 @@ public class JobAmazonAdLog { ...@@ -113,6 +112,7 @@ public class JobAmazonAdLog {
sb.append(", bjModified=").append(bjModified); sb.append(", bjModified=").append(bjModified);
sb.append(", siteEn=").append(siteEn); sb.append(", siteEn=").append(siteEn);
sb.append(", companyId=").append(companyId); sb.append(", companyId=").append(companyId);
sb.append(", type=").append(type);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
...@@ -136,14 +136,15 @@ public class JobAmazonAdLog { ...@@ -136,14 +136,15 @@ public class JobAmazonAdLog {
} }
JobAmazonAdLog other = (JobAmazonAdLog) that; JobAmazonAdLog other = (JobAmazonAdLog) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAccountId() == null ? other.getAccountId() == null : this.getAccountId().equals(other.getAccountId())) && (this.getAccountId() == null ? other.getAccountId() == null : this.getAccountId().equals(other.getAccountId()))
&& (this.getReportId() == null ? other.getReportId() == null : this.getReportId().equals(other.getReportId())) && (this.getReportId() == null ? other.getReportId() == null : this.getReportId().equals(other.getReportId()))
&& (this.getReportDate() == null ? other.getReportDate() == null : this.getReportDate().equals(other.getReportDate())) && (this.getReportDate() == null ? other.getReportDate() == null : this.getReportDate().equals(other.getReportDate()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getBjCreate() == null ? other.getBjCreate() == null : this.getBjCreate().equals(other.getBjCreate())) && (this.getBjCreate() == null ? other.getBjCreate() == null : this.getBjCreate().equals(other.getBjCreate()))
&& (this.getBjModified() == null ? other.getBjModified() == null : this.getBjModified().equals(other.getBjModified())) && (this.getBjModified() == null ? other.getBjModified() == null : this.getBjModified().equals(other.getBjModified()))
&& (this.getSiteEn() == null ? other.getSiteEn() == null : this.getSiteEn().equals(other.getSiteEn())) && (this.getSiteEn() == null ? other.getSiteEn() == null : this.getSiteEn().equals(other.getSiteEn()))
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())); && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
} }
/** /**
...@@ -165,6 +166,7 @@ public class JobAmazonAdLog { ...@@ -165,6 +166,7 @@ public class JobAmazonAdLog {
result = prime * result + ((getBjModified() == null) ? 0 : getBjModified().hashCode()); result = prime * result + ((getBjModified() == null) ? 0 : getBjModified().hashCode());
result = prime * result + ((getSiteEn() == null) ? 0 : getSiteEn().hashCode()); result = prime * result + ((getSiteEn() == null) ? 0 : getSiteEn().hashCode());
result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
return result; return result;
} }
} }
\ No newline at end of file
...@@ -3171,6 +3171,66 @@ public class DcBaseFinanceAmazonAdProductExample { ...@@ -3171,6 +3171,66 @@ public class DcBaseFinanceAmazonAdProductExample {
addCriterion("exchange_rate_usd not between", value1, value2, "exchangeRateUsd"); addCriterion("exchange_rate_usd not between", value1, value2, "exchangeRateUsd");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
} }
/** /**
...@@ -3402,6 +3462,6 @@ public class DcBaseFinanceAmazonAdProductExample { ...@@ -3402,6 +3462,6 @@ public class DcBaseFinanceAmazonAdProductExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
void example(DcBaseFinanceAmazonAdProductExample example); void example(com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample example);
} }
} }
\ No newline at end of file
...@@ -930,6 +930,66 @@ public class JobAmazonAdLogExample { ...@@ -930,6 +930,66 @@ public class JobAmazonAdLogExample {
addCriterion("company_id not between", value1, value2, "companyId"); addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
} }
/** /**
...@@ -1161,6 +1221,6 @@ public class JobAmazonAdLogExample { ...@@ -1161,6 +1221,6 @@ public class JobAmazonAdLogExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
void example(JobAmazonAdLogExample example); void example(com.bailuntec.domain.example.JobAmazonAdLogExample example);
} }
} }
\ No newline at end of file
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
and (t4.config_id = t5.id or t5.id not in (select config_id and (t4.config_id = t5.id or t5.id not in (select config_id
from dc_auto_sales_forecast_product_code_config from dc_auto_sales_forecast_product_code_config
where product_code = t1.product_code)) where product_code = t1.product_code))
and (t6.warehouse_code = t5.warehouse_code or length(trim(t5.warehouse_code)) = 0) and (t6.warehouse_code = t5.wareListenerContainerhouse_code or length(trim(t5.warehouse_code)) = 0)
and (t6.hq_type = t5.warehouse_type or length(trim(t5.warehouse_type)) = 0) and (t6.hq_type = t5.warehouse_type or length(trim(t5.warehouse_type)) = 0)
and (t2.product_type = t5.category or length(trim(t5.category)) = 0) and (t2.product_type = t5.category or length(trim(t5.category)) = 0)
and (t6.area_id = t5.warehouse_area_id or length(trim(t5.warehouse_area_id)) = 0) and (t6.area_id = t5.warehouse_area_id or length(trim(t5.warehouse_area_id)) = 0)
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
t1.daily_weighted_sales &lt;= t7.sales_upper_limit or t1.daily_weighted_sales &lt;= t7.sales_upper_limit or
t1.daily_weighted_sales &gt;= t7.sales_lower_limit or t1.daily_weighted_sales is null or t1.daily_weighted_sales &gt;= t7.sales_lower_limit or t1.daily_weighted_sales is null or
length(trim(t1.daily_weighted_sales)) = 0)) length(trim(t1.daily_weighted_sales)) = 0))
-- where t1.bailun_sku ='sku' and t1.warehouse_code = 'wa'
where t5.id is not null where t5.id is not null
ORDER BY t5.`level` desc) aaa ORDER BY t5.`level` desc) aaa
GROUP BY bailun_sku, warehouse_code; GROUP BY bailun_sku, warehouse_code;
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<result column="report_type" jdbcType="VARCHAR" property="reportType"/> <result column="report_type" jdbcType="VARCHAR" property="reportType"/>
<result column="exchange_rate" jdbcType="DECIMAL" property="exchangeRate"/> <result column="exchange_rate" jdbcType="DECIMAL" property="exchangeRate"/>
<result column="exchange_rate_usd" jdbcType="DECIMAL" property="exchangeRateUsd"/> <result column="exchange_rate_usd" jdbcType="DECIMAL" property="exchangeRateUsd"/>
<result column="type" jdbcType="INTEGER" property="type"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -150,7 +151,7 @@ ...@@ -150,7 +151,7 @@
attributed_units_ordered_sevenday_same_sku, attributed_units_ordered_sevenday_same_sku,
attributed_units_ordered_fourteenday_same_sku, attributed_units_ordered_thirtyday_same_sku, attributed_units_ordered_fourteenday_same_sku, attributed_units_ordered_thirtyday_same_sku,
account_id, company_id, bj_create_time, bj_modify_time, report_date, report_type, account_id, company_id, bj_create_time, bj_modify_time, report_date, report_type,
exchange_rate, exchange_rate_usd exchange_rate, exchange_rate_usd,type
</sql> </sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample" <select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample"
resultMap="BaseResultMap"> resultMap="BaseResultMap">
...@@ -230,7 +231,7 @@ ...@@ -230,7 +231,7 @@
attributed_units_ordered_thirtyday_same_sku, account_id, attributed_units_ordered_thirtyday_same_sku, account_id,
company_id, bj_create_time, bj_modify_time, company_id, bj_create_time, bj_modify_time,
report_date, report_type, exchange_rate, report_date, report_type, exchange_rate,
exchange_rate_usd) exchange_rate_usd,type)
values (#{id,jdbcType=INTEGER}, #{campaignName,jdbcType=VARCHAR}, #{campaignId,jdbcType=VARCHAR}, values (#{id,jdbcType=INTEGER}, #{campaignName,jdbcType=VARCHAR}, #{campaignId,jdbcType=VARCHAR},
#{adGroupName,jdbcType=VARCHAR}, #{adGroupId,jdbcType=VARCHAR}, #{impressions,jdbcType=INTEGER}, #{adGroupName,jdbcType=VARCHAR}, #{adGroupId,jdbcType=VARCHAR}, #{impressions,jdbcType=INTEGER},
#{clicks,jdbcType=INTEGER}, #{cost,jdbcType=DECIMAL}, #{currency,jdbcType=VARCHAR}, #{clicks,jdbcType=INTEGER}, #{cost,jdbcType=DECIMAL}, #{currency,jdbcType=VARCHAR},
...@@ -251,7 +252,7 @@ ...@@ -251,7 +252,7 @@
#{attributedUnitsOrderedThirtydaySameSku,jdbcType=VARCHAR}, #{accountId,jdbcType=INTEGER}, #{attributedUnitsOrderedThirtydaySameSku,jdbcType=VARCHAR}, #{accountId,jdbcType=INTEGER},
#{companyId,jdbcType=INTEGER}, #{bjCreateTime,jdbcType=TIMESTAMP}, #{bjModifyTime,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER}, #{bjCreateTime,jdbcType=TIMESTAMP}, #{bjModifyTime,jdbcType=TIMESTAMP},
#{reportDate,jdbcType=DATE}, #{reportType,jdbcType=VARCHAR}, #{exchangeRate,jdbcType=DECIMAL}, #{reportDate,jdbcType=DATE}, #{reportType,jdbcType=VARCHAR}, #{exchangeRate,jdbcType=DECIMAL},
#{exchangeRateUsd,jdbcType=DECIMAL}) #{exchangeRateUsd,jdbcType=DECIMAL},#{type,jdbctype=INTEGER})
</insert> </insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct"> <insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct">
<!-- <!--
...@@ -396,6 +397,9 @@ ...@@ -396,6 +397,9 @@
<if test="record.exchangeRateUsd != null"> <if test="record.exchangeRateUsd != null">
exchange_rate_usd, exchange_rate_usd,
</if> </if>
<if test="record.type != null">
type,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.id != null"> <if test="record.id != null">
...@@ -527,6 +531,9 @@ ...@@ -527,6 +531,9 @@
<if test="record.exchangeRateUsd != null"> <if test="record.exchangeRateUsd != null">
#{record.exchangeRateUsd,jdbcType=DECIMAL}, #{record.exchangeRateUsd,jdbcType=DECIMAL},
</if> </if>
<if test="record.type != null">
#{record.type,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample" <select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample"
...@@ -690,6 +697,9 @@ ...@@ -690,6 +697,9 @@
<if test="record.exchangeRateUsd != null"> <if test="record.exchangeRateUsd != null">
exchange_rate_usd = #{record.exchangeRateUsd,jdbcType=DECIMAL}, exchange_rate_usd = #{record.exchangeRateUsd,jdbcType=DECIMAL},
</if> </if>
<if test="record.type != null">
type = #{record.type,jdbcType=INTEGER},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause"/>
...@@ -745,7 +755,8 @@ ...@@ -745,7 +755,8 @@
report_date = #{record.reportDate,jdbcType=DATE}, report_date = #{record.reportDate,jdbcType=DATE},
report_type = #{record.reportType,jdbcType=VARCHAR}, report_type = #{record.reportType,jdbcType=VARCHAR},
exchange_rate = #{record.exchangeRate,jdbcType=DECIMAL}, exchange_rate = #{record.exchangeRate,jdbcType=DECIMAL},
exchange_rate_usd = #{record.exchangeRateUsd,jdbcType=DECIMAL} exchange_rate_usd = #{record.exchangeRateUsd,jdbcType=DECIMAL},
type = #{record.type,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
...@@ -886,6 +897,9 @@ ...@@ -886,6 +897,9 @@
<if test="exchangeRateUsd != null"> <if test="exchangeRateUsd != null">
exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL}, exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL},
</if> </if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -936,7 +950,8 @@ ...@@ -936,7 +950,8 @@
report_date = #{reportDate,jdbcType=DATE}, report_date = #{reportDate,jdbcType=DATE},
report_type = #{reportType,jdbcType=VARCHAR}, report_type = #{reportType,jdbcType=VARCHAR},
exchange_rate = #{exchangeRate,jdbcType=DECIMAL}, exchange_rate = #{exchangeRate,jdbcType=DECIMAL},
exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL} exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL},
type = #{type,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct"> <insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct">
...@@ -1076,6 +1091,9 @@ ...@@ -1076,6 +1091,9 @@
<if test="exchangeRateUsd != null"> <if test="exchangeRateUsd != null">
exchange_rate_usd, exchange_rate_usd,
</if> </if>
<if test="type != null">
type,
</if>
</trim> </trim>
values values
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -1208,6 +1226,9 @@ ...@@ -1208,6 +1226,9 @@
<if test="exchangeRateUsd != null"> <if test="exchangeRateUsd != null">
#{exchangeRateUsd,jdbcType=DECIMAL}, #{exchangeRateUsd,jdbcType=DECIMAL},
</if> </if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
</trim> </trim>
on duplicate key update on duplicate key update
<trim suffixOverrides=","> <trim suffixOverrides=",">
...@@ -1343,6 +1364,9 @@ ...@@ -1343,6 +1364,9 @@
<if test="exchangeRateUsd != null"> <if test="exchangeRateUsd != null">
exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL}, exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL},
</if> </if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct"> <insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct">
...@@ -1363,7 +1387,7 @@ ...@@ -1363,7 +1387,7 @@
attributed_sales_thirtyday_same_sku, attributed_units_ordered_oneday_same_sku, attributed_sales_thirtyday_same_sku, attributed_units_ordered_oneday_same_sku,
attributed_units_ordered_sevenday_same_sku, attributed_units_ordered_fourteenday_same_sku, attributed_units_ordered_sevenday_same_sku, attributed_units_ordered_fourteenday_same_sku,
attributed_units_ordered_thirtyday_same_sku, account_id, company_id, bj_create_time, attributed_units_ordered_thirtyday_same_sku, account_id, company_id, bj_create_time,
bj_modify_time, report_date, report_type, exchange_rate, exchange_rate_usd) bj_modify_time, report_date, report_type, exchange_rate, exchange_rate_usd,type)
values values
(#{id,jdbcType=INTEGER}, #{campaignName,jdbcType=VARCHAR}, #{campaignId,jdbcType=VARCHAR}, (#{id,jdbcType=INTEGER}, #{campaignName,jdbcType=VARCHAR}, #{campaignId,jdbcType=VARCHAR},
#{adGroupName,jdbcType=VARCHAR}, #{adGroupId,jdbcType=VARCHAR}, #{impressions,jdbcType=INTEGER}, #{adGroupName,jdbcType=VARCHAR}, #{adGroupId,jdbcType=VARCHAR}, #{impressions,jdbcType=INTEGER},
...@@ -1385,7 +1409,7 @@ ...@@ -1385,7 +1409,7 @@
#{attributedUnitsOrderedThirtydaySameSku,jdbcType=VARCHAR}, #{accountId,jdbcType=INTEGER}, #{attributedUnitsOrderedThirtydaySameSku,jdbcType=VARCHAR}, #{accountId,jdbcType=INTEGER},
#{companyId,jdbcType=INTEGER}, #{bjCreateTime,jdbcType=TIMESTAMP}, #{bjModifyTime,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER}, #{bjCreateTime,jdbcType=TIMESTAMP}, #{bjModifyTime,jdbcType=TIMESTAMP},
#{reportDate,jdbcType=DATE}, #{reportType,jdbcType=VARCHAR}, #{exchangeRate,jdbcType=DECIMAL}, #{reportDate,jdbcType=DATE}, #{reportType,jdbcType=VARCHAR}, #{exchangeRate,jdbcType=DECIMAL},
#{exchangeRateUsd,jdbcType=DECIMAL}) #{exchangeRateUsd,jdbcType=DECIMAL},#{type,jdbcType=INTEGER})
on duplicate key update on duplicate key update
id = #{id,jdbcType=INTEGER}, id = #{id,jdbcType=INTEGER},
campaign_name = #{campaignName,jdbcType=VARCHAR}, campaign_name = #{campaignName,jdbcType=VARCHAR},
...@@ -1429,7 +1453,8 @@ ...@@ -1429,7 +1453,8 @@
report_date = #{reportDate,jdbcType=DATE}, report_date = #{reportDate,jdbcType=DATE},
report_type = #{reportType,jdbcType=VARCHAR}, report_type = #{reportType,jdbcType=VARCHAR},
exchange_rate = #{exchangeRate,jdbcType=DECIMAL}, exchange_rate = #{exchangeRate,jdbcType=DECIMAL},
exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL} exchange_rate_usd = #{exchangeRateUsd,jdbcType=DECIMAL},
type = #{type,jdbcType=INTEGER}
</insert> </insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample" <select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample"
resultMap="BaseResultMap"> resultMap="BaseResultMap">
...@@ -1474,6 +1499,7 @@ ...@@ -1474,6 +1499,7 @@
ofType="com.bailuntec.domain.dto.DcBaseSkuMappingItemDto" select="selectSkuMapping"> ofType="com.bailuntec.domain.dto.DcBaseSkuMappingItemDto" select="selectSkuMapping">
</collection> </collection>
</resultMap> </resultMap>
<select id="selectSkuMapping" resultType="com.bailuntec.domain.dto.DcBaseSkuMappingItemDto"> <select id="selectSkuMapping" resultType="com.bailuntec.domain.dto.DcBaseSkuMappingItemDto">
select dc0.*, dc1.unit_price select dc0.*, dc1.unit_price
from dc_base_sku_mapping dc0 from dc_base_sku_mapping dc0
...@@ -1482,6 +1508,7 @@ ...@@ -1482,6 +1508,7 @@
and dc0.site = #{siteEn} and dc0.site = #{siteEn}
and dc0.has_deleted = 0 and dc0.has_deleted = 0
</select> </select>
<select id="selectAmazonItem" resultMap="BaseResultMap1"> <select id="selectAmazonItem" resultMap="BaseResultMap1">
select dc0.*, dc1.site_en select dc0.*, dc1.site_en
from dc_base_finance_amazon_ad_product dc0 from dc_base_finance_amazon_ad_product dc0
......
...@@ -148,5 +148,6 @@ public interface DcBaseOmsSkuMapper { ...@@ -148,5 +148,6 @@ public interface DcBaseOmsSkuMapper {
Integer omsSkuSellerCount(@Param("lowerTime") LocalDateTime lowerTime, Integer omsSkuSellerCount(@Param("lowerTime") LocalDateTime lowerTime,
@Param("upperTime") LocalDateTime upperTime, @Param("upperTime") LocalDateTime upperTime,
@Param("bailunSku") String bailunSku, @Param("bailunSku") String bailunSku,
@Param("warehouseCode") String warehouseCode, @Param("dyas") Integer days); @Param("warehouseCode") String warehouseCode,
@Param("days") Integer days);
} }
...@@ -3711,12 +3711,19 @@ ...@@ -3711,12 +3711,19 @@
</select> </select>
<select id="omsSkuSellerCount" resultType="java.lang.Integer"> <select id="omsSkuSellerCount" resultType="java.lang.Integer">
select coalesce(sum(bailun_sku_quantity_ordered), 0) select (select coalesce(sum(bailun_sku_quantity_ordered), 0)
from dc_base_oms_sku from dc_base_oms_sku
where paid_time &gt;= #{lowerTime} where paid_time &gt;= #{lowerTime}
and paid_time &lt;= #{upperTime} and paid_time &lt;= #{upperTime}
and bailun_sku = #{bailunSku} and bailun_sku = #{bailunSku}
and warehouse_code = #{warehouseCode} and warehouse_code = #{warehouseCode}
and has_fba_s = 0
and has_delete = 0
and has_scalp = 0
and has_buyer_remark = 0
and has_platsku_remark = 0
and has_innersale = 0
) / #{days}
</select> </select>
......
table-name=dc_base_oms_sku_exception table-name=dc_base_finance_amazon_ad_product
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