任务时间修改

This commit is contained in:
尹吉欢
2018-03-01 15:26:22 +08:00
parent 1415ac4bbd
commit 35acacc71d
2 changed files with 5 additions and 11 deletions
@@ -57,11 +57,10 @@ public class DistrictInfoJob implements SimpleJob{
@Override @Override
public void execute(ShardingContext shardingContext) { public void execute(ShardingContext shardingContext) {
System.out.println("start :"+new Date()); logger.info("开始进行小区数据汇总任务");
final FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, openApiUrl); final FshApiRemoteService fshApiRemoteService = RestApiCallUtils.getRestClient(FshApiRemoteService.class, openApiUrl);
//params.put("type", 4);
DBCollection collection = seaweedMongoTemplate.getCollection("seaweed"); DBCollection collection = seaweedMongoTemplate.getCollection("seaweed");
DBCursor cursor = collection.find(new BasicDBObject("cat", "district").append("status", 0).append("city", "上海"), DBCursor cursor = collection.find(new BasicDBObject("cat", "district").append("status", 0),
new BasicDBObject("city", 1).append("region", 1).append("name", 1)).addOption(Bytes.QUERYOPTION_NOTIMEOUT); new BasicDBObject("city", 1).append("region", 1).append("name", 1)).addOption(Bytes.QUERYOPTION_NOTIMEOUT);
final Semaphore semaphore = new Semaphore(5); final Semaphore semaphore = new Semaphore(5);
while (cursor.hasNext()) { while (cursor.hasNext()) {
@@ -75,7 +74,6 @@ public class DistrictInfoJob implements SimpleJob{
@Override @Override
public void run() { public void run() {
try { try {
System.out.println("counting...");
String city = String.valueOf(data.get("city")); String city = String.valueOf(data.get("city"));
String region = String.valueOf(data.get("region")); String region = String.valueOf(data.get("region"));
String name = String.valueOf(data.get("name")); String name = String.valueOf(data.get("name"));
@@ -140,12 +138,8 @@ public class DistrictInfoJob implements SimpleJob{
} }
} }
}); });
// if(count>=10) {
// break;
// }
} }
System.out.println("end :"+new Date()); logger.info("结束小区数据汇总任务");
} }
@@ -93,9 +93,9 @@
</job:simple> </job:simple>
<!-- 有房小区详情信息汇总 --> <!-- 有房小区详情信息汇总 每周一0点10分执行-->
<job:simple id="districtInfoJob" class="com.fangjia.job.youfang.job.DistrictInfoJob" registry-center-ref="regCenter" <job:simple id="districtInfoJob" class="com.fangjia.job.youfang.job.DistrictInfoJob" registry-center-ref="regCenter"
sharding-total-count="1" cron="30 09 17 * * ?" sharding-item-parameters="" sharding-total-count="1" cron="0 10 0 ? * 2" sharding-item-parameters=""
failover="true" description="【有房】 有房小区详情信息汇总" failover="true" description="【有房】 有房小区详情信息汇总"
overwrite="true" event-trace-rdb-data-source="elasticJobLog" job-exception-handler="com.fangjia.job.youfang.handler.CustomJobExceptionHandler"> overwrite="true" event-trace-rdb-data-source="elasticJobLog" job-exception-handler="com.fangjia.job.youfang.handler.CustomJobExceptionHandler">