Commit 8fe52778 by huluobin

update

parent b6e7af01
......@@ -107,8 +107,8 @@ public class EbayFinanceAdSyncJobTest {
public void testThreadPool2() {
EbayFinanceAdSyncJob ebayFinanceAdSyncJob = new EbayFinanceAdSyncJob();
LocalDateTime start = LocalDateTime.of(2020, 12, 14, 0, 0);
LocalDateTime end = LocalDateTime.of(2020, 12, 14, 0, 0);
LocalDateTime start = LocalDateTime.of(2020, 12, 17, 0, 0);
LocalDateTime end = LocalDateTime.of(2020, 12, 20, 0, 0);
List<LocalDateTime> localDateTimeList = Stream.iterate(start,
localDateTime -> localDateTime.plusDays(1))
......
......@@ -32,6 +32,7 @@ public class Application {
new JobScheduler(createRegistryCenter(), createJobConfiguration1()).init();
new JobScheduler(createRegistryCenter(), createJobConfiguration2()).init();
new JobScheduler(createRegistryCenter(), createJobConfiguration4()).init();
new JobScheduler(createRegistryCenter(), createJobConfigurationX()).init();
}
private static CoordinatorRegistryCenter createRegistryCenter() {
......@@ -61,6 +62,13 @@ public class Application {
return simpleJobRootConfig;
}
private static LiteJobConfiguration createJobConfigurationX() {
JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(propertiesUtil.getPropertyAsString("JOB_MAPPING_NAME-X"), propertiesUtil.getPropertyAsString("JOB_MAPPING_CRON"), propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT")).build();
SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, SkuMappingSyncJob.class.getCanonicalName());
LiteJobConfiguration simpleJobRootConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).build();
return simpleJobRootConfig;
}
private static LiteJobConfiguration createJobConfiguration4() {
JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(propertiesUtil.getPropertyAsString("JOB_CATEGORY_NAME"), propertiesUtil.getPropertyAsString("JOB_CATEGORY_CRON"), propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT")).build();
SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, BailunCategoryJob.class.getCanonicalName());
......
......@@ -65,6 +65,9 @@ public class SkuMappingSyncJob extends PointJob {
skuMappingInfoList.forEach(dcBaseSkuMapping -> {
dcBaseSkuMapping.setGmtModified(LocalDateTime.now());
DcBaseSkuMappingMapper dcBaseSkuMappingMapper = SessionUtil.getSession().getMapper(DcBaseSkuMappingMapper.class);
String shortSiteEn = dcBaseSkuMappingMapper.selectShortSiteEn(dcBaseSkuMapping.getSite());
dcBaseSkuMapping.setSite(shortSiteEn);
dcBaseSkuMappingMapper.upsertSelective(dcBaseSkuMapping);
});
if (jobPointLog.getPageIndex().equals(0) && skuMappingResponse.getTotalPage() != null) {
......@@ -77,6 +80,7 @@ public class SkuMappingSyncJob extends PointJob {
jobPointLog.setPageIndex(jobPointLog.getPageIndex() - 1);
} while (jobPointLog.getPageIndex() > 0);
jobPointLog.setPageIndex(0);
jobPointLog.setStartTime(jobPointLog.getEndTime());
jobPointLog.setEndTime(jobPointLog.getStartTime().plusDays(jobPointLog.getIntervalTime().longValue()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : jobPointLog.getStartTime().plusDays(jobPointLog.getIntervalTime().longValue()));
......
......@@ -21,6 +21,10 @@ JOB_SIMPLE_CATEGORY_CRON=0 0 23 * * ? *
JOB_MAPPING_NAME=base-sync-sku-mapping
JOB_MAPPING_CRON=0/10 * * * * ? *
JOB_MAPPING_NAME-X=base-sync-sku-mapping-x
JOB_CATEGORY_NAME=base-sync-category
JOB_CATEGORY_CRON=0 12 * * * ? *
SHARDING_TOTAL_COUNT=1
https://bbs.sgamer.com/thread-14124960-1-1.html
......@@ -3740,6 +3740,7 @@
and has_buyer_remark = 0
and has_platsku_remark = 0
and has_innersale = 0
and bailun_order_status !='Canceled'
and !(paid_time &gt;= '2020-11-23 00:00:00' and paid_time &lt;= '2020-12-06 00:00:00' and
platform_type = 'FBA')
and platform_order_type != '手工单'
......
......@@ -121,4 +121,6 @@ public interface DcBaseSkuMappingMapper {
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcBaseSkuMapping record);
String selectShortSiteEn(String site);
}
......@@ -6,30 +6,30 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="unicode_id" jdbcType="INTEGER" property="unicodeId" />
<result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku" />
<result column="platform_sku" jdbcType="VARCHAR" property="platformSku" />
<result column="platform" jdbcType="VARCHAR" property="platform" />
<result column="platform_id" jdbcType="INTEGER" property="platformId" />
<result column="site" jdbcType="VARCHAR" property="site" />
<result column="account" jdbcType="VARCHAR" property="account" />
<result column="login_account" jdbcType="VARCHAR" property="loginAccount" />
<result column="sale_name" jdbcType="VARCHAR" property="saleName" />
<result column="site_id" jdbcType="INTEGER" property="siteId" />
<result column="account_id" jdbcType="INTEGER" property="accountId" />
<result column="product_id" jdbcType="INTEGER" property="productId" />
<result column="sku_id" jdbcType="INTEGER" property="skuId" />
<result column="count" jdbcType="INTEGER" property="count" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="item_id" jdbcType="VARCHAR" property="itemId" />
<result column="creation_time" jdbcType="TIMESTAMP" property="creationTime" />
<result column="last_modification_time" jdbcType="TIMESTAMP" property="lastModificationTime" />
<result column="create_user_name" jdbcType="VARCHAR" property="createUserName" />
<result column="has_deleted" jdbcType="BIT" property="hasDeleted" />
<result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="unicode_id" jdbcType="INTEGER" property="unicodeId"/>
<result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku"/>
<result column="platform_sku" jdbcType="VARCHAR" property="platformSku"/>
<result column="platform" jdbcType="VARCHAR" property="platform"/>
<result column="platform_id" jdbcType="INTEGER" property="platformId"/>
<result column="site" jdbcType="VARCHAR" property="site"/>
<result column="account" jdbcType="VARCHAR" property="account"/>
<result column="login_account" jdbcType="VARCHAR" property="loginAccount"/>
<result column="sale_name" jdbcType="VARCHAR" property="saleName"/>
<result column="site_id" jdbcType="INTEGER" property="siteId"/>
<result column="account_id" jdbcType="INTEGER" property="accountId"/>
<result column="product_id" jdbcType="INTEGER" property="productId"/>
<result column="sku_id" jdbcType="INTEGER" property="skuId"/>
<result column="count" jdbcType="INTEGER" property="count"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="item_id" jdbcType="VARCHAR" property="itemId"/>
<result column="creation_time" jdbcType="TIMESTAMP" property="creationTime"/>
<result column="last_modification_time" jdbcType="TIMESTAMP" property="lastModificationTime"/>
<result column="create_user_name" jdbcType="VARCHAR" property="createUserName"/>
<result column="has_deleted" jdbcType="BIT" property="hasDeleted"/>
<result column="company_id" jdbcType="INTEGER" property="companyId"/>
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -53,7 +53,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -86,7 +87,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -106,7 +108,8 @@
sale_name, site_id, account_id, product_id, sku_id, count, title, item_id, creation_time,
last_modification_time, create_user_name, has_deleted, company_id, gmt_create, gmt_modified
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuMappingExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuMappingExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -115,10 +118,10 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from dc_base_sku_mapping
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
......@@ -138,7 +141,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from dc_base_sku_mapping
where id = #{id,jdbcType=INTEGER}
</select>
......@@ -157,7 +160,7 @@
-->
delete from dc_base_sku_mapping
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.bailuntec.domain.entity.DcBaseSkuMapping">
......@@ -339,14 +342,15 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuMappingExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuMappingExample"
resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from dc_base_sku_mapping
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
......@@ -430,7 +434,7 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
......@@ -464,7 +468,7 @@
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcBaseSkuMapping">
......@@ -856,21 +860,34 @@
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
</insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuMappingExample" resultMap="BaseResultMap">
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseSkuMappingExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from dc_base_sku_mapping
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectShortSiteEn" resultType="java.lang.String">
SELECT t2.site_en
from (select site_en, site_cn from dc_base_company_account n group by site_en order by site_cn) t1
LEFT JOIN (select *
from (select site_en, site_cn
from dc_base_company_account
order by site_en) t
group by site_cn) t2 on t1.site_cn = t2.site_cn
where t1.site_en = #{site}
</select>
</mapper>
......@@ -682,7 +682,6 @@ public class AutoTurnoverJob extends PointJob {
}
if (hasMonitorFluctuation) {
// if (realInventory > forecastSalesList.get(0).add(totalSafeInventory).doubleValue()) {
DcAutoForecastFluctuation dcAutoForecastFluctuationActual = null;
BigDecimal forecastPurchaseAdvise = forecastPurchaseAdvisedList.get(0);
......@@ -783,9 +782,7 @@ public class AutoTurnoverJob extends PointJob {
if (i < 14) {
avgForecastFourteendaySales = avgForecastFourteendaySales.add(forecastSalesList.get(i));
}
if (i < turnoverDays) {
avgForecastTurnoverDaySales = avgForecastTurnoverDaySales.add(forecastSalesList.get(i));
}
//如果初始采购建议 <= 0, 那就也不用备货., stockUpDays - 1的原因是我们已经算了一天的预测销量了.
if (i < stockUpDays - 1 && forecastPurchaseAdvisedList.get(0).compareTo(BigDecimal.ZERO) == 1) {
stockUpSales = stockUpSales.add(forecastSalesList.get(i + 1 + turnoverDays));
......@@ -1386,8 +1383,8 @@ public class AutoTurnoverJob extends PointJob {
int interval = Period.between(recordTime, localDate).getDays();
int index = Math.max(interval, 0);
forecastInboundRelationList.set(index, dcBaseTransExpectarrivaltimes.stream().map(dcBaseTransExpectarrivaltime -> Constant.TRANSFER_SIGN + dcBaseTransExpectarrivaltime.getTransferOrderId() + "_" + dcBaseTransExpectarrivaltime.getCount()).collect(Collectors.joining("*")));
forecastTransferInboundList.set(index, dcBaseTransExpectarrivaltimes.stream().mapToInt(DcBaseTransExpectarrivaltime::getCount).sum());
forecastInboundRelationList.set(index, forecastInboundRelationList.get(index) + dcBaseTransExpectarrivaltimes.stream().map(dcBaseTransExpectarrivaltime -> Constant.TRANSFER_SIGN + dcBaseTransExpectarrivaltime.getTransferOrderId() + "_" + dcBaseTransExpectarrivaltime.getCount()).collect(Collectors.joining("*")));
forecastTransferInboundList.set(index, forecastTransferInboundList.get(index) + dcBaseTransExpectarrivaltimes.stream().mapToInt(DcBaseTransExpectarrivaltime::getCount).sum());
forecastInboundList.set(index, forecastPurchaseInboundList.get(index) + forecastTransferInboundList.get(index));
});
......@@ -1881,10 +1878,15 @@ public class AutoTurnoverJob extends PointJob {
int x = Math.max(fbaTransferIndex - n, 0);
BigDecimal multiSales = BigDecimal.valueOf(Math.min(1, Math.max(1 - n * 0.3, 0) + x * 0.1));
if (x >= 1 && salesDetailItemList.get(j) != null && salesDetailItemList.get(j).getSalesDayConfig() != null) {
if (x >= 1) {
forecastSalesList.set(j, forecastSalesItem.multiply(multiSales));
}
if (salesDetailItemList.get(j) != null && salesDetailItemList.get(j).getSalesDayConfig() != null) {
forecastSalesList.set(j, salesDetailItemList.get(j).getSalesDayConfig());
}
}
} finally {
SessionUtil.closeSession();
}
......@@ -1999,6 +2001,7 @@ public class AutoTurnoverJob extends PointJob {
totalSales = totalSales.add(forecastSalesList.get(j));
}
return inventoryAvailableDays;
}
......
......@@ -242,7 +242,6 @@ public class AutoTurnoverTest {
//949406801 GZBLWH
@Test
public void testXX() {
DcBaseStockMapper dcBaseStockMapper = SessionUtil.getSession().getMapper(DcBaseStockMapper.class);
SalesDayConfigMapper salesDayConfigMapper = SessionUtil.getSession().getMapper(SalesDayConfigMapper.class);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
......@@ -269,7 +268,7 @@ public class AutoTurnoverTest {
public void testXX2() {
DcBaseStock dcBaseStock = SessionUtil.getSession().getMapper(DcBaseStockMapper.class)
.selectOneByExample(DcBaseStockExample.newAndCreateCriteria()
.andBailunSkuEqualTo("947077901")
.andBailunSkuEqualTo("949282602")
.andWarehouseCodeEqualTo("GZBLWH")
.example());
......
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