Commit 6072e183 by huluobin

auto-turnover更新

sync-cost 测试 bug fix
parent 694d7e27
......@@ -44,6 +44,7 @@ public class SyncCostFirstJob extends PointJob {
.get()
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
// .addHeader("Connection", "keep-alive")
.build();
Response response = null;
String result;
......@@ -100,7 +101,7 @@ public class SyncCostFirstJob extends PointJob {
} catch (Exception e) {
throw new RuntimeException("BeanUtils.copyProperties失败, ChannelId是" + costFirstData.getChannelId());
}
if(StringUtils.isNotBlank(dcBaseCostFirst.getBailunSku()) && StringUtils.isNotBlank(dcBaseCostFirst.getChannelOrderId()) && StringUtils.isNotBlank(dcBaseCostFirst.getBoxId()) && StringUtils.isNotBlank(dcBaseCostFirst.getTransferOrderId()) && StringUtils.isNotBlank(dcBaseCostFirst.getWarehouseCode())) {
if (StringUtils.isNotBlank(dcBaseCostFirst.getBailunSku()) && StringUtils.isNotBlank(dcBaseCostFirst.getChannelOrderId()) && StringUtils.isNotBlank(dcBaseCostFirst.getBoxId()) && StringUtils.isNotBlank(dcBaseCostFirst.getTransferOrderId()) && StringUtils.isNotBlank(dcBaseCostFirst.getWarehouseCode())) {
int i = baseCostFirstMapper.updateByExampleSelective(dcBaseCostFirst, DcBaseCostFirstExample.newAndCreateCriteria().andBailunSkuEqualTo(dcBaseCostFirst.getBailunSku()).andChannelOrderIdEqualTo(dcBaseCostFirst.getChannelOrderId()).andBoxIdEqualTo(dcBaseCostFirst.getBoxId()).andTransferOrderIdEqualTo(dcBaseCostFirst.getTransferOrderId()).andWarehouseCodeEqualTo(dcBaseCostFirst.getWarehouseCode()).example());
if (i == 0) {
baseCostFirstMapper.upsertSelective(dcBaseCostFirst);
......@@ -110,7 +111,7 @@ public class SyncCostFirstJob extends PointJob {
}
}
} catch (RuntimeException e) {
throw new RuntimeException("MYBATIS操作DB更新插入数据失败",e);
throw new RuntimeException("MYBATIS操作DB更新插入数据失败", e);
} finally {
SessionUtil.closeSession();
}
......
......@@ -10,8 +10,8 @@ public class SyncCostFirstTest {
public void test() {
SyncCostFirstJob syncCostFirstJob = new SyncCostFirstJob();
JobPointLog jobPointLog = new JobPointLog("base-sync-cost-first", 1, 1, 1, 1,
LocalDateTime.of(2020,6,12,16,3,22),
LocalDateTime.of(2020,6,12,16,3,22));
LocalDateTime.of(2020,8,11,0,3,22),
LocalDateTime.of(2020,8,12,16,3,22));
syncCostFirstJob.executeJob(null, jobPointLog);
}
}
......@@ -1393,7 +1393,7 @@
WHERE gmt_create >= #{v1})
OR (bailun_sku_warehouse_code IN (SELECT CONCAT(bailun_sku, warehouse_code)
FROM dc_base_oms_sku
WHERE gmt_create > = #{v2}
WHERE gmt_create >= #{v2}
AND bailun_sku_quantity_ordered > bailun_sku_quantity_picked))
)
and t1.id % #{shardingContext.shardingTotalCount} = #{shardingContext.shardingItem}
......
......@@ -28,12 +28,12 @@ public class Application {
public static void main(String[] args) {
log.info("starting app...");
//
new JobScheduler(createRegistryCenter(),
createJobConfigurationNormal(),
createJobEventConfiguration(),
new AutoTurnoverJobListener()).init();
//
new JobScheduler(createRegistryCenter(),
createJobConfigurationIncrement(),
createJobEventConfiguration(),
......@@ -54,7 +54,7 @@ public class Application {
return regCenter;
}
//
private static LiteJobConfiguration createJobConfigurationNormal() {
JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(
propertiesUtil.getPropertyAsString("JOB_NAME"),
......@@ -79,8 +79,8 @@ public class Application {
private static LiteJobConfiguration createJobConfigurationTest() {
JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(
propertiesUtil.getPropertyAsString("JOB_NAME_INCREMENT"),
"0 46 19 * * ?",
"XXXX",
"0 25 17 * * ?",
propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT_INCREMENT"))
.jobParameter("INCREMENT")
.build();
......
......@@ -92,6 +92,7 @@ public class AutoTurnoverJob extends PointJob {
LocalDateTime v1 = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusHours(3);
LocalDateTime v2 = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).minusDays(7);
dcBaseStockList = baseStockMapperFor.increment(shardingContext, v1, v2, (page - 1) * jobPointLog.getPageSize(), jobPointLog.getPageSize());
break;
default:
dcBaseStockList = baseStockMapperFor.listWarehouseStockById(shardingContext, shardingContext.getJobParameter(), (page - 1) * jobPointLog.getPageSize(), jobPointLog.getPageSize());
}
......
#EVENT_RDB_STORAGE_DRIVER=com.mysql.jdbc.Driver
#EVENT_RDB_STORAGE_URL=jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
EVENT_RDB_STORAGE_URL=jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/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
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_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
#ZOOKEEPER_SERVER=172.31.255.120:2181
NAME_SPACE=data-center
JOB_NAME=show-auto-turnover
......@@ -15,10 +15,6 @@ JOB_CRON=0 0 3 * * ?
SHARDING_TOTAL_COUNT=8
JOB_NAME_PARAM=show-auto-turnover-param
JOB_CRON_PARAM=0 0 14 * * ?
SHARDING_TOTAL_COUNT_PARAM=8
JOB_NAME_INCREMENT=show-auto-turnover-param
JOB_NAME_INCREMENT=show-auto-turnover-increment
JOB_CRON_INCREMENT=0 0 14 * * ?
SHARDING_TOTAL_COUNT_INCREMENT=8
......@@ -98,7 +98,7 @@ public class AutoTurnoverTest {
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
HashMap<Integer, String> map = new HashMap<>();
map.put(1,"");
ShardingContext shardingContext = new ShardingContext(new ShardingContexts("","",8,"NORMAL", map), 5);
ShardingContext shardingContext = new ShardingContext(new ShardingContexts("","",1,"INCREMENT", map), 0);
JobPointLog jobPointLog = new JobPointLog("", 1, 400, 1, 1, LocalDateTime.now().minusSeconds(1), LocalDateTime.now());
autoTurnoverJob.executeJob(shardingContext, jobPointLog);
}
......
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