Commit f0e8ad31f982f17e7b89835534808a0da411af13
Merge branch 'master' of 192.168.168.201:panzhaov5/control_service_data_Interface
Showing
3 changed files
with
25 additions
and
3 deletions
src/main/java/com/bsth/repository/ScheduleRealInfoRepository.java
| ... | ... | @@ -47,6 +47,16 @@ public interface ScheduleRealInfoRepository extends PagingAndSortingRepository<S |
| 47 | 47 | * @return |
| 48 | 48 | */ |
| 49 | 49 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 50 | + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.gsBm=?2") | |
| 51 | + List<ScheduleRealInfo> findByDateAndCompany(String schDate, String companyCode); | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 根据日期和公司编码获取班次信息 | |
| 55 | + * @param schDate | |
| 56 | + * @param companyCode | |
| 57 | + * @return | |
| 58 | + */ | |
| 59 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | |
| 50 | 60 | @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.gsBm=?2 and s.updateDate>=?3") |
| 51 | 61 | List<ScheduleRealInfo> findByDateAndCompany(String schDate, String companyCode, Date timestamp); |
| 52 | 62 | ... | ... |
src/main/java/com/bsth/server_rs/schedule/real/ScheduleRealService.java
| ... | ... | @@ -229,6 +229,18 @@ public class ScheduleRealService implements InitializingBean { |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | @GET |
| 232 | + @Path("/sch_jk_db/{company}/{rq}") | |
| 233 | + public List<ScheduleRealInfoDTO_JK> sch_jk(@PathParam("company") String company, @PathParam("rq") String rq) { | |
| 234 | + DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyyMMdd"); | |
| 235 | + DateTime dateTime = fmt.parseDateTime(rq); | |
| 236 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.findByDateAndCompany(dateTime.toString("yyyy-MM-dd"), company); | |
| 237 | + redisService.calcTime(scheduleRealInfos); | |
| 238 | + List<ScheduleRealInfoDTO_JK> result = ScheduleRealInfoDTO_JK.getMultiInstance(scheduleRealInfos); | |
| 239 | + | |
| 240 | + return result; | |
| 241 | + } | |
| 242 | + | |
| 243 | + @GET | |
| 232 | 244 | @Path("/sch_jk4modify/{company}/{rq}/{timestamp}") |
| 233 | 245 | public List<ScheduleRealInfoDTO_JK> sch_jk4modify(@PathParam("company") String company, @PathParam("rq") String rq, @PathParam("timestamp") long timestamp) { |
| 234 | 246 | DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyyMMdd"); |
| ... | ... | @@ -334,7 +346,7 @@ public class ScheduleRealService implements InitializingBean { |
| 334 | 346 | ObjectMapper mapper = new ObjectMapper(); |
| 335 | 347 | String json = mapper.writeValueAsString(data); |
| 336 | 348 | logger.info(json); |
| 337 | - ListenableFuture<SendResult<String, String>> future = kafkaTemplate.send("PDGJ_JQDD", json); | |
| 349 | + /*ListenableFuture<SendResult<String, String>> future = kafkaTemplate.send("PDGJ_JQDD", json); | |
| 338 | 350 | future.addCallback(new ListenableFutureCallback<SendResult<String, String>>() { |
| 339 | 351 | |
| 340 | 352 | @Override |
| ... | ... | @@ -346,7 +358,7 @@ public class ScheduleRealService implements InitializingBean { |
| 346 | 358 | public void onFailure(Throwable ex) { |
| 347 | 359 | logger.error("kafka发送电子路单异常", ex); |
| 348 | 360 | } |
| 349 | - }); | |
| 361 | + });*/ | |
| 350 | 362 | } |
| 351 | 363 | } catch (Exception e) { |
| 352 | 364 | logger.error("kafka发电子路单调度异常", e); | ... | ... |
src/main/resources/application-prod.properties
| ... | ... | @@ -30,7 +30,7 @@ spring.redis.password=bsth_control_001 |
| 30 | 30 | spring.redis.port=28008 |
| 31 | 31 | |
| 32 | 32 | #kafka |
| 33 | -spring.kafka.bootstrap-servers=47.102.42.244:9092 | |
| 33 | +spring.kafka.bootstrap-servers=47.106.82.232:9092 | |
| 34 | 34 | spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer |
| 35 | 35 | spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer |
| 36 | 36 | spring.kafka.producer.buffer-memory=33554432 | ... | ... |