Commit c18dfa92ab55833a9647e8d41929fd06e6578007
1 parent
2c896e29
修改的定时器时间
Showing
5 changed files
with
210 additions
and
32 deletions
src/main/java/com/example/demo/SaticScheduleTask.java
| @@ -48,7 +48,7 @@ public class SaticScheduleTask implements InitializingBean { | @@ -48,7 +48,7 @@ public class SaticScheduleTask implements InitializingBean { | ||
| 48 | /** | 48 | /** |
| 49 | * 定时任务 | 49 | * 定时任务 |
| 50 | */ | 50 | */ |
| 51 | - @Scheduled(cron = "0 0/6 * * * ?") | 51 | + @Scheduled(cron = "0 0/10 * * * ?") |
| 52 | private void configureTasks() throws Exception{ | 52 | private void configureTasks() throws Exception{ |
| 53 | logger.info("执行静态定时任务时间: " + LocalDateTime.now()); | 53 | logger.info("执行静态定时任务时间: " + LocalDateTime.now()); |
| 54 | WatchKey watchKey = null; | 54 | WatchKey watchKey = null; |
| @@ -63,6 +63,7 @@ public class SaticScheduleTask implements InitializingBean { | @@ -63,6 +63,7 @@ public class SaticScheduleTask implements InitializingBean { | ||
| 63 | } | 63 | } |
| 64 | watchKey.reset(); | 64 | watchKey.reset(); |
| 65 | } | 65 | } |
| 66 | + System.out.println("文件数"+files); | ||
| 66 | // "TJRLAMT" -> "00000200" 交易金额 | 67 | // "TJRLAMT" -> "00000200" 交易金额 |
| 67 | // "TJRLCDKIND" -> "01" 卡类型 | 68 | // "TJRLCDKIND" -> "01" 卡类型 |
| 68 | // "TJRLCDBAL" -> "00000000" 交易前余额 | 69 | // "TJRLCDBAL" -> "00000000" 交易前余额 |
| @@ -77,22 +78,21 @@ public class SaticScheduleTask implements InitializingBean { | @@ -77,22 +78,21 @@ public class SaticScheduleTask implements InitializingBean { | ||
| 77 | contrast.filterCardList(data,true); | 78 | contrast.filterCardList(data,true); |
| 78 | } | 79 | } |
| 79 | List<Map> allFile = Analysis.getAllFile(files); | 80 | List<Map> allFile = Analysis.getAllFile(files); |
| 81 | + System.out.println("交易数"+allFile); | ||
| 80 | contrast.filterCardList(allFile,false); | 82 | contrast.filterCardList(allFile,false); |
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | - @Scheduled(cron = "0 0/5 * * * ?") | 85 | + @Scheduled(cron = "0 0/9 * * * ?") |
| 84 | @PostConstruct | 86 | @PostConstruct |
| 85 | void getArrivalInfos() { | 87 | void getArrivalInfos() { |
| 86 | logger.info("票务数据缓存加载: " + LocalDateTime.now()); | 88 | logger.info("票务数据缓存加载: " + LocalDateTime.now()); |
| 87 | LocalDateTime now=LocalDateTime.now(); | 89 | LocalDateTime now=LocalDateTime.now(); |
| 88 | //测试 | 90 | //测试 |
| 89 | - DateTimeFormatter tdf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); | ||
| 90 | - now=LocalDateTime.parse("2021-08-01 00:00",tdf); | 91 | + /* DateTimeFormatter tdf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| 92 | + now=LocalDateTime.parse("2021-08-01 00:00",tdf);*/ | ||
| 91 | List<Map<String,List<Scheduling>>> result=contrast.getSchedulingS(now,1); | 93 | List<Map<String,List<Scheduling>>> result=contrast.getSchedulingS(now,1); |
| 92 | getSchedulingS=result.get(0); | 94 | getSchedulingS=result.get(0); |
| 93 | getSchedulingSSell=result.get(1); | 95 | getSchedulingSSell=result.get(1); |
| 94 | - System.out.println(getSchedulingS.size()); | ||
| 95 | - System.out.println(getSchedulingSSell.size()); | ||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | 98 | ||
| @@ -103,16 +103,17 @@ public class SaticScheduleTask implements InitializingBean { | @@ -103,16 +103,17 @@ public class SaticScheduleTask implements InitializingBean { | ||
| 103 | * @Author: YM | 103 | * @Author: YM |
| 104 | * @Date: 2021/10/13 | 104 | * @Date: 2021/10/13 |
| 105 | */ | 105 | */ |
| 106 | - //@Scheduled(cron = "0 30 17 * * ?") | 106 | + //@PostConstruct |
| 107 | private void filterCardListByDB() throws Exception { | 107 | private void filterCardListByDB() throws Exception { |
| 108 | DateTimeFormatter tdf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); | 108 | DateTimeFormatter tdf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| 109 | - LocalDateTime now=LocalDateTime.parse("2021-08-01 00:00",tdf); | 109 | + LocalDateTime now=LocalDateTime.parse("2021-08-07 00:00",tdf); |
| 110 | 110 | ||
| 111 | int day=1; | 111 | int day=1; |
| 112 | - contrast.getSchedulingS(now,day); | ||
| 113 | - | 112 | + List<Map<String,List<Scheduling>>> result=contrast.getSchedulingS(now,day); |
| 113 | + getSchedulingS=result.get(0); | ||
| 114 | + getSchedulingSSell=result.get(1); | ||
| 114 | Map<String,Object> map=new HashMap<>(); | 115 | Map<String,Object> map=new HashMap<>(); |
| 115 | - map.put("table","pd_control."+"ftj20210806"); | 116 | + map.put("table","pd_control."+"fhtxnjrltb_jtb_copy1"); |
| 116 | LocalDateTime startDate=now.minusDays(day); | 117 | LocalDateTime startDate=now.minusDays(day); |
| 117 | String start=startDate.format(DateTimeFormatter.ofPattern("yyyyMMdd")); | 118 | String start=startDate.format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| 118 | String end=now.format(DateTimeFormatter.ofPattern("yyyyMMdd")); | 119 | String end=now.format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
src/main/java/com/example/demo/service/Analysis.java
| @@ -34,7 +34,7 @@ public class Analysis { | @@ -34,7 +34,7 @@ public class Analysis { | ||
| 34 | public static List<Map> getAllFile(List<File> files) { | 34 | public static List<Map> getAllFile(List<File> files) { |
| 35 | List<Map> listMap = new ArrayList<>(); | 35 | List<Map> listMap = new ArrayList<>(); |
| 36 | List<String> list = new ArrayList<String>(); | 36 | List<String> list = new ArrayList<String>(); |
| 37 | - | 37 | + System.out.println("文件数"+files.size()); |
| 38 | for (File file : files) { | 38 | for (File file : files) { |
| 39 | if (!file.isDirectory()) { | 39 | if (!file.isDirectory()) { |
| 40 | String absolutePath = file.getAbsolutePath(); | 40 | String absolutePath = file.getAbsolutePath(); |
| @@ -53,24 +53,42 @@ public class Analysis { | @@ -53,24 +53,42 @@ public class Analysis { | ||
| 53 | Map<String, Object> map = new HashMap<>(); | 53 | Map<String, Object> map = new HashMap<>(); |
| 54 | Long val = Long.parseLong(text.substring(30, 40)); | 54 | Long val = Long.parseLong(text.substring(30, 40)); |
| 55 | String cardId = Long.toHexString(val).toUpperCase(); | 55 | String cardId = Long.toHexString(val).toUpperCase(); |
| 56 | - map.put("TJRLCARDNO", cardId); //交通卡号 | ||
| 57 | - map.put("TJRLCDKIND", text.substring(40, 42)); //卡类型 | ||
| 58 | - map.put("TJRLPOSID", text.substring(62, 68)); //POS机号 | 56 | + map.put("TJRLDRVCRDID", cardId); //司售卡号 DriverCardId签到卡片ID号,BCD编码,司售卡卡号 |
| 57 | + //map.put("DriverCardType", text.substring(40, 42));//DriverCardType HEX格式,签到卡的卡型,BCD编码 | ||
| 58 | + //map.put("CHECKINDATE", text.substring(42, 54));//签到时间YYYYMMDDhhmm,BCD编码 | ||
| 59 | + //map.put("CHECKOUTCOUNT", text.substring(54, 60));//签到总次数,BCD编码 | ||
| 60 | + map.put("TJRLTXFG", text.substring(60, 62));//交易类型 Txn Flag HEX格式,交易标志,其中88为正常交易,99为锁卡交易,BCD编码,定义见附录1交易类型对照表 | ||
| 61 | + String TJRLPOSID=text.substring(62, 68); | ||
| 62 | + map.put("TJRLPOSID", TJRLPOSID); //HEX格式,消费交易流水号,BCD编码 | ||
| 63 | + //map.put("CITYCODE", text.substring(68, 72)); //城市代码号,BCD编码 | ||
| 64 | + map.put("TJRLCARDNO", text.substring(72, 82));//CARDID消费卡的ID号,BCD编码 | ||
| 65 | + map.put("TJRLCDKIND", text.substring(82, 84));//Card Type HEX格式,消费卡卡型,BCD编码 | ||
| 66 | + map.put("TJRLCDBAL", text.substring(84, 92)); //交易前余额 BalBef消费卡交易前金额,BCD编码 BCD编码之前最高位1表示负数,0表示正数 | ||
| 67 | + map.put("TJRLAMT", text.substring(92, 100)); //交易金额 TxnAmount本次消费交易金额,BCD编码 | ||
| 68 | + String TJRLRDATE=text.substring(100, 108); | ||
| 59 | try { | 69 | try { |
| 60 | - map.put("TJRLRDATE", new SimpleDateFormat("yyyy-MM-dd").format(new SimpleDateFormat("yyyyMMdd").parse(text.substring(100, 108)))); //交易日期 | 70 | + map.put("TJRLRDATE",new SimpleDateFormat("yyyy-MM-dd"). |
| 71 | + format(new SimpleDateFormat("yyyyMMdd").parse(text.substring(100, 108)))); | ||
| 72 | + //交易日期 本次消费交易日期,BCD编码YYYYMMDD | ||
| 61 | } catch (ParseException e) { | 73 | } catch (ParseException e) { |
| 62 | e.printStackTrace(); | 74 | e.printStackTrace(); |
| 63 | } | 75 | } |
| 64 | - | 76 | + String TJRLRTIME=text.substring(108, 114); |
| 65 | try { | 77 | try { |
| 66 | - map.put("TJRLRTIME", new SimpleDateFormat("HH:mm:ss").format(new SimpleDateFormat("HHmmss").parse(text.substring(108, 114)))); //交易时间 | 78 | + map.put("TJRLRTIME",new SimpleDateFormat("HH:mm:ss"). |
| 79 | + format(new SimpleDateFormat("HHmmss").parse(text.substring(108, 114)))); | ||
| 80 | + //交易时间 Txn Time本次消费交易时间,BCD编码hhmmss | ||
| 67 | } catch (ParseException e) { | 81 | } catch (ParseException e) { |
| 68 | e.printStackTrace(); | 82 | e.printStackTrace(); |
| 69 | } | 83 | } |
| 70 | - map.put("TJRLCDBAL", text.substring(84, 92)); //交易前余额 | ||
| 71 | - map.put("TJRLAMT", text.substring(92, 100)); //交易金额 | ||
| 72 | - map.put("TJRLORGAMT", text.substring(120, 124)); //交易原始金额 | ||
| 73 | - map.put("TJRLTXFG", text.substring(60, 62)); //交易类型 | 84 | + //map.put("COUNT", text.substring(114, 120)); //交易计数器,BCD编码 |
| 85 | + map.put("TJRLORGAMT", text.substring(120, 124)); //交易原始金额Orignal Txn Amount | ||
| 86 | + //map.put("CARDSPEC", text.substring(124, 126)); //卡规范,BCD编码 01—建设部卡 02—交通部卡 03-交通部二维码 | ||
| 87 | + String TAC=text.substring(126, 134); | ||
| 88 | + map.put("TAC",TAC);//HEX格式,交易认证码,BCD编码 | ||
| 89 | + String TRAD_ID=TAC+TJRLPOSID+TJRLRDATE+TJRLRTIME; | ||
| 90 | + map.put("TRAD_ID",TRAD_ID); | ||
| 91 | + //pos交易数据需要加上 trad_id 用tac+pos流水+交易日期+交易时间 | ||
| 74 | listMap.add(map); | 92 | listMap.add(map); |
| 75 | } | 93 | } |
| 76 | //} | 94 | //} |
src/main/java/com/example/demo/service/Contrast.java
| @@ -205,10 +205,10 @@ public class Contrast { | @@ -205,10 +205,10 @@ public class Contrast { | ||
| 205 | for (int i = 0; i < allData.size(); i++) { | 205 | for (int i = 0; i < allData.size(); i++) { |
| 206 | Map data = allData.get(i); | 206 | Map data = allData.get(i); |
| 207 | 207 | ||
| 208 | - //通过卡号找到司机 | ||
| 209 | - String carId = data.get("TJRLCARDNO").toString().length()>8? | ||
| 210 | - data.get("TJRLCARDNO").toString().substring( data.get("TJRLCARDNO").toString().length()-8): | ||
| 211 | - data.get("TJRLCARDNO").toString();//交通卡号 | 208 | + //通过司售卡找到司机 |
| 209 | + String carId = data.get("TJRLDRVCRDID").toString().length()>8? | ||
| 210 | + data.get("TJRLDRVCRDID").toString().substring( data.get("TJRLDRVCRDID").toString().length()-8): | ||
| 211 | + data.get("TJRLDRVCRDID").toString(); | ||
| 212 | List<Map> collect = driverCardList.stream().filter(map -> map.get("cardno").equals(carId)).collect(Collectors.toList()); | 212 | List<Map> collect = driverCardList.stream().filter(map -> map.get("cardno").equals(carId)).collect(Collectors.toList()); |
| 213 | 213 | ||
| 214 | String mark=""; | 214 | String mark=""; |
| @@ -347,6 +347,165 @@ public class Contrast { | @@ -347,6 +347,165 @@ public class Contrast { | ||
| 347 | logger.warn("======匹配"+size+"条======匹配到"+b+"条=====耗时=="+(System.currentTimeMillis() - start)/1000 + "秒"); | 347 | logger.warn("======匹配"+size+"条======匹配到"+b+"条=====耗时=="+(System.currentTimeMillis() - start)/1000 + "秒"); |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | + /** | ||
| 351 | + * @Description: 根据carid 获取票务数据 | ||
| 352 | + * @Param: allData交易记录 isOld是否是残余数据(上次未匹配到的数据) | ||
| 353 | + * @return: | ||
| 354 | + * @Author: YM | ||
| 355 | + * @Date: 2021/10/13 | ||
| 356 | + */ | ||
| 357 | + public void filterCardListByDB(List<Map> allData,Boolean isOld) { | ||
| 358 | + long start = System.currentTimeMillis(); | ||
| 359 | + List<Map> driverCardList = getDriverCardList();//获取司机信息 | ||
| 360 | + Map<String,List<Scheduling>> schedulingS =saticScheduleTask.getSchedulingS; | ||
| 361 | + Map<String,List<Scheduling>> schedulingSSell =saticScheduleTask.getSchedulingSSell; | ||
| 362 | + DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | ||
| 363 | + int b=0;//用于计算匹配成功的数量 | ||
| 364 | + for (int i = 0; i < allData.size(); i++) { | ||
| 365 | + Map data = allData.get(i); | ||
| 366 | + | ||
| 367 | + //通过卡号找到司机 | ||
| 368 | + String carId = data.get("TJRLDRVCRDID").toString().length()>8? | ||
| 369 | + data.get("TJRLDRVCRDID").toString().substring( data.get("TJRLDRVCRDID").toString().length()-8): | ||
| 370 | + data.get("TJRLDRVCRDID").toString();//交通卡号 | ||
| 371 | + List<Map> collect = driverCardList.stream().filter(map -> map.get("cardno").equals(carId)).collect(Collectors.toList()); | ||
| 372 | + | ||
| 373 | + String mark=""; | ||
| 374 | + String jobCodes = ""; | ||
| 375 | + Boolean flag=false;//用来判断是否没有匹配成功 | ||
| 376 | + Long cardDate = null; | ||
| 377 | + if (!collect.isEmpty()) { | ||
| 378 | + if (null != collect.get(0).get("jobCode") && null != collect.get(0).get("personalName")) { | ||
| 379 | + String personalName = collect.get(0).get("personalName").toString();//姓名 | ||
| 380 | + String[] arr=collect.get(0).get("jobCode").toString().split("-"); | ||
| 381 | + jobCodes =arr.length==0?collect.get(0).get("jobCode").toString():arr[arr.length-1];//工号 | ||
| 382 | + String time=String.valueOf(data.get("TJRLRTIME"));//时间 | ||
| 383 | + String date=String.valueOf(data.get("TJRLRDATE"));//日期 | ||
| 384 | + | ||
| 385 | + cardDate = LocalDateTime.parse(date+" "+time,dtf).toInstant(ZoneOffset.of("+8")).toEpochMilli(); //刷卡时间(时间戳) | ||
| 386 | + | ||
| 387 | + //通过司机姓名获得进出记录 | ||
| 388 | + List<Scheduling> schedulingList1=schedulingS.get(personalName); | ||
| 389 | + //没匹配到匹配售票员 | ||
| 390 | + if(schedulingList1==null){ | ||
| 391 | + schedulingList1=schedulingSSell.get(personalName); | ||
| 392 | + } | ||
| 393 | + Scheduling scheduling = null; | ||
| 394 | + | ||
| 395 | + | ||
| 396 | + if(schedulingList1!=null){ | ||
| 397 | + Collections.sort(schedulingList1, Comparator.comparing(Scheduling::getTs).reversed()); | ||
| 398 | + for (int i1 = 0; i1 < schedulingList1.size(); i1++) { | ||
| 399 | + Scheduling s=schedulingList1.get(i1); | ||
| 400 | + if((Long.parseLong(s.getTs())-TIME2*60*1000)<=cardDate){ | ||
| 401 | + scheduling=s; | ||
| 402 | + b++; | ||
| 403 | + flag=true; | ||
| 404 | + break; | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + }else { | ||
| 408 | + mark="未查到驾驶员排班:"+personalName+" 工号:"+jobCodes; | ||
| 409 | + } | ||
| 410 | + | ||
| 411 | + if (scheduling!=null) { | ||
| 412 | + data.put("STATION_FLAG", 1); | ||
| 413 | + data.put("TJRLUNITID", scheduling.getGs_name()); | ||
| 414 | + data.put("TJRLSTATID", scheduling.getXl_name()); | ||
| 415 | + data.put("ROAD_FORM_TYPE", scheduling.getBc_type()); | ||
| 416 | + data.put("UPDOWN", scheduling.getXl_dir()); | ||
| 417 | + data.put("BUS_CODE", scheduling.getCl_zbh()); | ||
| 418 | + data.put("BUS_PLATE", scheduling.getCar_plate()); | ||
| 419 | + data.put("ROAD_CODE", scheduling.getLp_name()); | ||
| 420 | + data.put("DEPART_NAME", scheduling.getQdz_name()); | ||
| 421 | + data.put("DEPART_CODE", scheduling.getQdz_code()); | ||
| 422 | + data.put("DEPART_ACTUAL_TIME", scheduling.getFcsj_actual()); | ||
| 423 | + data.put("REACH_NAME", scheduling.getZdz_name()); | ||
| 424 | + data.put("REACH_CODE", scheduling.getZdz_code()); | ||
| 425 | + data.put("REACH_ACTUAL_TIME", scheduling.getZdsj_actual()); | ||
| 426 | + | ||
| 427 | + | ||
| 428 | + if(scheduling.getStation_name()!=null){ | ||
| 429 | + data.put("LEVELS_FLAG",1); | ||
| 430 | + data.put("LEVELS1",scheduling.getStation_route_code());//站点路由序号 | ||
| 431 | + data.put("LEVELS_NAME1",scheduling.getStation_name());//站点名 | ||
| 432 | + data.put("LEVELS1_CODE",scheduling.getStop_no());//站点编号 | ||
| 433 | + }else { | ||
| 434 | + data.put("LEVELS_FLAG",0); | ||
| 435 | + } | ||
| 436 | + } else { | ||
| 437 | + data.put("STATION_FLAG", 0); | ||
| 438 | + } | ||
| 439 | + } | ||
| 440 | + }else { | ||
| 441 | + mark="未查到驾驶员 卡号:"+carId; | ||
| 442 | + data.put("STATION_FLAG", 0); | ||
| 443 | + } | ||
| 444 | + if(mark.length()==0 && !flag){ | ||
| 445 | + mark="未匹配到班次 "+jobCodes+"刷卡时间为:"+LocalDateTime.ofEpochSecond(cardDate/1000, 0, ZoneOffset.ofHours(8)); | ||
| 446 | + } | ||
| 447 | + data.put("MARK",mark); | ||
| 448 | + | ||
| 449 | + //如果是新数据 没匹配到 去除这条记录 并放入缓存等到下次继续匹配 | ||
| 450 | + if(!isOld && !flag){ | ||
| 451 | + List<Map> m =saticScheduleTask.data; | ||
| 452 | + m.add(data); | ||
| 453 | + allData.set(i,null); | ||
| 454 | + | ||
| 455 | + } | ||
| 456 | + } | ||
| 457 | + int size=allData.size(); | ||
| 458 | +// allData.removeIf(Objects::isNull); | ||
| 459 | + //防止数据过多 分批插入 | ||
| 460 | + List<List<Map>> subList = getSubList(8000, allData); | ||
| 461 | + if(!subList.isEmpty()){ | ||
| 462 | + subList.forEach(data->{ | ||
| 463 | + if (!data.isEmpty()) { | ||
| 464 | + siteMapper1.insertResult(data); | ||
| 465 | + } | ||
| 466 | + }); | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + List<List<Map>> subList2 = getSubList(500, allData); | ||
| 470 | + if(!subList2.isEmpty()){ | ||
| 471 | + subList2.forEach(data->{ | ||
| 472 | + if (!data.isEmpty()) { | ||
| 473 | + Map<String, Object> map = new HashMap<>(); | ||
| 474 | + map.put("datatype", "passengerflow"); | ||
| 475 | + map.put("datas", data); | ||
| 476 | + | ||
| 477 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 478 | + String json = null; | ||
| 479 | + try { | ||
| 480 | + json = mapper.writeValueAsString(map); | ||
| 481 | + } catch (JsonProcessingException e) { | ||
| 482 | + e.printStackTrace(); | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + ListenableFuture<SendResult<String, String>> future = kafkaTemplate.send("PDGJ", json); | ||
| 486 | + future.addCallback(new ListenableFutureCallback<SendResult<String, String>>() { | ||
| 487 | + @Override | ||
| 488 | + public void onSuccess(SendResult<String, String> result) { | ||
| 489 | + } | ||
| 490 | + @Override | ||
| 491 | + public void onFailure(Throwable ex) { | ||
| 492 | + logger.error("kafka发送票务数据异常", ex); | ||
| 493 | + } | ||
| 494 | + }); | ||
| 495 | + } | ||
| 496 | + }); | ||
| 497 | + } | ||
| 498 | + | ||
| 499 | + | ||
| 500 | + | ||
| 501 | + //如果是上次遗留的数据不管这是是否匹配到都清空 | ||
| 502 | + if(isOld){ | ||
| 503 | + saticScheduleTask.data.clear(); | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + logger.warn("======匹配"+size+"条======匹配到"+b+"条=====耗时=="+(System.currentTimeMillis() - start)/1000 + "秒"); | ||
| 507 | + } | ||
| 508 | + | ||
| 350 | 509 | ||
| 351 | 510 | ||
| 352 | 511 | ||
| @@ -389,7 +548,7 @@ public class Contrast { | @@ -389,7 +548,7 @@ public class Contrast { | ||
| 389 | record.put("TJRLRDATE",s.split(" ")[0]); | 548 | record.put("TJRLRDATE",s.split(" ")[0]); |
| 390 | record.put("TJRLRTIME",s.split(" ")[1]); | 549 | record.put("TJRLRTIME",s.split(" ")[1]); |
| 391 | } | 550 | } |
| 392 | - filterCardList(records,false); | 551 | + filterCardListByDB(records,false); |
| 393 | } | 552 | } |
| 394 | 553 | ||
| 395 | public List<List<Map>> getSubList(int length, List<Map> list){ | 554 | public List<List<Map>> getSubList(int length, List<Map> list){ |
src/main/resources/application.properties
| @@ -45,9 +45,9 @@ logging.path=/home/demo/log | @@ -45,9 +45,9 @@ logging.path=/home/demo/log | ||
| 45 | #spring.datasource.db1.druid.test-on-borrow=true | 45 | #spring.datasource.db1.druid.test-on-borrow=true |
| 46 | #spring.datasource.db1.druid.test-while-idle=true | 46 | #spring.datasource.db1.druid.test-while-idle=true |
| 47 | # | 47 | # |
| 48 | -#spring.datasource.db2.jdbc-url=jdbc:mysql://192.168.168.240:3306/ms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC | 48 | +#spring.datasource.db2.jdbc-url=jdbc:mysql://localhost:3306/ms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC |
| 49 | #spring.datasource.db2.username=root | 49 | #spring.datasource.db2.username=root |
| 50 | -#spring.datasource.db2.password=root2jsp | 50 | +#spring.datasource.db2.password=1995627a |
| 51 | #spring.datasource.db2.driver-class-name=com.mysql.cj.jdbc.Driver | 51 | #spring.datasource.db2.driver-class-name=com.mysql.cj.jdbc.Driver |
| 52 | #spring.datasource.db2.druid.test-on-borrow=true | 52 | #spring.datasource.db2.druid.test-on-borrow=true |
| 53 | #spring.datasource.db2.druid.test-while-idle=true | 53 | #spring.datasource.db2.druid.test-while-idle=true |
src/main/resources/mapping/db1/Site-mapper1.xml
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | `TJRLTXFG`,`STATION_FLAG`,`TJRLUNITID`,`TJRLSTATID`,`ROAD_FORM_TYPE`, `UPDOWN`, `BUS_CODE`, | 13 | `TJRLTXFG`,`STATION_FLAG`,`TJRLUNITID`,`TJRLSTATID`,`ROAD_FORM_TYPE`, `UPDOWN`, `BUS_CODE`, |
| 14 | `BUS_PLATE`, `ROAD_CODE`, `DEPART_NAME`,`DEPART_CODE`, `DEPART_ACTUAL_TIME`, | 14 | `BUS_PLATE`, `ROAD_CODE`, `DEPART_NAME`,`DEPART_CODE`, `DEPART_ACTUAL_TIME`, |
| 15 | `REACH_NAME`,`REACH_CODE`,`REACH_ACTUAL_TIME`, | 15 | `REACH_NAME`,`REACH_CODE`,`REACH_ACTUAL_TIME`, |
| 16 | - `LEVELS_FLAG`,`LEVELS1`, `LEVELS_NAME1`, `LEVELS1_CODE`,`LEVELS2`, `LEVELS_NAME2`,`MARK` | 16 | + `LEVELS_FLAG`,`LEVELS1`, `LEVELS_NAME1`, `LEVELS1_CODE`,`LEVELS2`, `LEVELS_NAME2`,`MARK`,TRAD_ID |
| 17 | ) | 17 | ) |
| 18 | VALUES | 18 | VALUES |
| 19 | <foreach collection="list" item="em" index="index" separator=","> | 19 | <foreach collection="list" item="em" index="index" separator=","> |
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | #{em.BUS_CODE}, | 23 | #{em.BUS_CODE}, |
| 24 | #{em.BUS_PLATE}, #{em.ROAD_CODE}, #{em.DEPART_NAME},#{em.DEPART_CODE}, #{em.DEPART_ACTUAL_TIME}, | 24 | #{em.BUS_PLATE}, #{em.ROAD_CODE}, #{em.DEPART_NAME},#{em.DEPART_CODE}, #{em.DEPART_ACTUAL_TIME}, |
| 25 | #{em.REACH_NAME},#{em.REACH_CODE},#{em.REACH_ACTUAL_TIME}, | 25 | #{em.REACH_NAME},#{em.REACH_CODE},#{em.REACH_ACTUAL_TIME}, |
| 26 | - #{em.LEVELS_FLAG},#{em.LEVELS1}, #{em.LEVELS_NAME1}, #{em.LEVELS1_CODE},#{em.LEVELS2}, #{em.LEVELS_NAME2}, #{em.MARK} ) | 26 | + #{em.LEVELS_FLAG},#{em.LEVELS1}, #{em.LEVELS_NAME1}, #{em.LEVELS1_CODE},#{em.LEVELS2}, #{em.LEVELS_NAME2}, #{em.MARK},#{em.TRAD_ID}) |
| 27 | </foreach> | 27 | </foreach> |
| 28 | </insert> | 28 | </insert> |
| 29 | 29 | ||
| @@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
| 63 | </select> | 63 | </select> |
| 64 | 64 | ||
| 65 | <select id="getRecords" resultType="map"> | 65 | <select id="getRecords" resultType="map"> |
| 66 | - SELECT TJRLPOSID,TJRLRDATE,TJRLRTIME,TJRLCDKIND,TJRLCDBAL,TJRLAMT,TJRLTXFG,TJRLDRVCRDID as TJRLCARDNO | 66 | + SELECT * |
| 67 | from ${table} where TJRLRDATE >= '${start}' and TJRLRDATE < '${end}' | 67 | from ${table} where TJRLRDATE >= '${start}' and TJRLRDATE < '${end}' |
| 68 | </select> | 68 | </select> |
| 69 | 69 |