Commit 6072e183 by huluobin

auto-turnover更新

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