Commit d1b96a52b25b98be7ca83043c9425a3d1cd07c3f
1 parent
a74426ec
道闸修改
Showing
1 changed file
with
27 additions
and
17 deletions
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| @@ -41,6 +41,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; | @@ -41,6 +41,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 41 | import org.springframework.jdbc.core.JdbcTemplate; | 41 | import org.springframework.jdbc.core.JdbcTemplate; |
| 42 | import org.springframework.jdbc.core.RowMapper; | 42 | import org.springframework.jdbc.core.RowMapper; |
| 43 | import org.springframework.stereotype.Service; | 43 | import org.springframework.stereotype.Service; |
| 44 | +import org.springframework.transaction.annotation.Transactional; | ||
| 44 | import org.springframework.web.bind.annotation.RequestParam; | 45 | import org.springframework.web.bind.annotation.RequestParam; |
| 45 | 46 | ||
| 46 | import java.sql.ResultSet; | 47 | import java.sql.ResultSet; |
| @@ -589,6 +590,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -589,6 +590,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 589 | return rs; | 590 | return rs; |
| 590 | } | 591 | } |
| 591 | 592 | ||
| 593 | + @Transactional | ||
| 592 | @Override | 594 | @Override |
| 593 | public Map<String,Object> stationSigno(Map<String, Object> map) { | 595 | public Map<String,Object> stationSigno(Map<String, Object> map) { |
| 594 | Map<String, Object> rs = new HashMap<>(); | 596 | Map<String, Object> rs = new HashMap<>(); |
| @@ -596,6 +598,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -596,6 +598,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 596 | 598 | ||
| 597 | String fPlateCode = map.get("fPlateCode")==null?"":map.get("fPlateCode").toString(); | 599 | String fPlateCode = map.get("fPlateCode")==null?"":map.get("fPlateCode").toString(); |
| 598 | String fBusID = map.get("fBusID")==null?"":map.get("fBusID").toString(); | 600 | String fBusID = map.get("fBusID")==null?"":map.get("fBusID").toString(); |
| 601 | + String fInParkName = map.get("fInParkName")==null?"":map.get("fInParkName").toString().trim(); | ||
| 599 | Long fOutTime = map.get("fOutTime")==null?0:(Long.parseLong(map.get("fOutTime").toString())*1000); | 602 | Long fOutTime = map.get("fOutTime")==null?0:(Long.parseLong(map.get("fOutTime").toString())*1000); |
| 600 | int fIsOut = map.get("fIsOut")==null?0:Integer.parseInt(map.get("fIsOut").toString()); | 603 | int fIsOut = map.get("fIsOut")==null?0:Integer.parseInt(map.get("fIsOut").toString()); |
| 601 | Long fInTime = map.get("fInTime")==null?0:(Long.parseLong(map.get("fInTime").toString())*1000); | 604 | Long fInTime = map.get("fInTime")==null?0:(Long.parseLong(map.get("fInTime").toString())*1000); |
| @@ -659,11 +662,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -659,11 +662,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 659 | ScheduleRealInfo isr = list.get(i); | 662 | ScheduleRealInfo isr = list.get(i); |
| 660 | if (list.get(i).isDestroy()) | 663 | if (list.get(i).isDestroy()) |
| 661 | continue; | 664 | continue; |
| 662 | - if(fIsOut == 2 && (Math.abs(isr.getDfsjT()-fOutTime)<bcwcTime || (isr.getFcsjActualTime() != null && Math.abs(isr.getFcsjActualTime()-fOutTime)<bcwcTime))){ | 665 | + if(fIsOut == 2 && (isr.getQdzName().trim().indexOf(fInParkName) != -1) && (Math.abs(isr.getDfsjT()-fOutTime)<bcwcTime || (isr.getFcsjActualTime() != null && Math.abs(isr.getFcsjActualTime()-fOutTime)<bcwcTime))){ |
| 663 | bcwcTime = Math.abs(isr.getDfsjT()-fOutTime); | 666 | bcwcTime = Math.abs(isr.getDfsjT()-fOutTime); |
| 664 | sr = isr; | 667 | sr = isr; |
| 665 | } | 668 | } |
| 666 | - if(fIsOut == 1 && (Math.abs(isr.getZdsjT()-fInTime)<bcwcTime || (isr.getZdsjActualTime() != null && Math.abs(isr.getZdsjActualTime()-fOutTime)<bcwcTime))){ | 669 | + if(fIsOut == 1 && (isr.getZdzName().trim().indexOf(fInParkName) != -1) && (Math.abs(isr.getZdsjT()-fInTime)<bcwcTime || (isr.getZdsjActualTime() != null && Math.abs(isr.getZdsjActualTime()-fOutTime)<bcwcTime))){ |
| 667 | bcwcTime = Math.abs(isr.getZdsjT()-fInTime); | 670 | bcwcTime = Math.abs(isr.getZdsjT()-fInTime); |
| 668 | sr = isr; | 671 | sr = isr; |
| 669 | } | 672 | } |
| @@ -682,11 +685,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -682,11 +685,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 682 | ScheduleRealInfo isr = list.get(i); | 685 | ScheduleRealInfo isr = list.get(i); |
| 683 | if (list.get(i).isDestroy()) | 686 | if (list.get(i).isDestroy()) |
| 684 | continue; | 687 | continue; |
| 685 | - if(fIsOut == 2 && (Math.abs(isr.getDfsjT()-fOutTime)<bcwcTime || (isr.getFcsjActualTime() != null && Math.abs(isr.getFcsjActualTime()-fOutTime)<bcwcTime))){ | 688 | + if(fIsOut == 2 && (isr.getQdzName().trim().indexOf(fInParkName) != -1) && (Math.abs(isr.getDfsjT()-fOutTime)<bcwcTime || (isr.getFcsjActualTime() != null && Math.abs(isr.getFcsjActualTime()-fOutTime)<bcwcTime))){ |
| 686 | bcwcTime = Math.abs(isr.getDfsjT()-fOutTime); | 689 | bcwcTime = Math.abs(isr.getDfsjT()-fOutTime); |
| 687 | sr = isr; | 690 | sr = isr; |
| 688 | } | 691 | } |
| 689 | - if(fIsOut == 1 && (Math.abs(isr.getZdsjT()-fInTime)<bcwcTime || (isr.getZdsjActualTime() != null && Math.abs(isr.getZdsjActualTime()-fOutTime)<bcwcTime))){ | 692 | + if(fIsOut == 1 && (isr.getZdzName().trim().indexOf(fInParkName) != -1) && (Math.abs(isr.getZdsjT()-fInTime)<bcwcTime || (isr.getZdsjActualTime() != null && Math.abs(isr.getZdsjActualTime()-fOutTime)<bcwcTime))){ |
| 690 | bcwcTime = Math.abs(isr.getZdsjT()-fInTime); | 693 | bcwcTime = Math.abs(isr.getZdsjT()-fInTime); |
| 691 | sr = isr; | 694 | sr = isr; |
| 692 | } | 695 | } |
| @@ -714,19 +717,26 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -714,19 +717,26 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 714 | * 到达时间接近那个班次的进场/出场判定为这个班次 | 717 | * 到达时间接近那个班次的进场/出场判定为这个班次 |
| 715 | */ | 718 | */ |
| 716 | if (fIsOut == 1 && fInTime != 0) { | 719 | if (fIsOut == 1 && fInTime != 0) { |
| 717 | - if(prevSr == null || (Math.abs((sr.getZdsjT()- fInTime)) < Math.abs((prevSr.getZdsjT()- fInTime)))){ | 720 | + /*if(prevSr == null || (Math.abs((sr.getZdsjT()- fInTime)) < Math.abs((prevSr.getZdsjT()- fInTime)))){ |
| 718 | isMatch = true; | 721 | isMatch = true; |
| 719 | matchSr = sr; | 722 | matchSr = sr; |
| 720 | } else {//if(Math.abs((prevSr.getDfsjT())- fInTime) < 120) | 723 | } else {//if(Math.abs((prevSr.getDfsjT())- fInTime) < 120) |
| 721 | isMatch = true; | 724 | isMatch = true; |
| 722 | matchSr = prevSr; | 725 | matchSr = prevSr; |
| 726 | + }*/ | ||
| 727 | + if(prevSr == null && (sr.getZdzName().trim().indexOf(fInParkName) != -1) && (Math.abs((sr.getZdsjT()- fInTime)) < Math.abs((prevSr.getZdsjT()- fInTime)))){ | ||
| 728 | + isMatch = true; | ||
| 729 | + matchSr = sr; | ||
| 730 | + } else if(prevSr.getZdzName().trim().indexOf(fInParkName) != -1){//if(Math.abs((prevSr.getDfsjT())- fInTime) < 120) | ||
| 731 | + isMatch = true; | ||
| 732 | + matchSr = prevSr; | ||
| 723 | } | 733 | } |
| 724 | inTimeStr = fmtHHmm.print(fInTime); | 734 | inTimeStr = fmtHHmm.print(fInTime); |
| 725 | } else if (fIsOut == 2 && fOutTime != 0) { | 735 | } else if (fIsOut == 2 && fOutTime != 0) { |
| 726 | - if(nextSr == null || (Math.abs((sr.getDfsjT()- fOutTime)) < Math.abs((nextSr.getDfsjT()- fOutTime)))){ | 736 | + if(nextSr == null && (sr.getQdzName().trim().indexOf(fInParkName) != -1) && (Math.abs((sr.getDfsjT()- fOutTime)) < Math.abs((nextSr.getDfsjT()- fOutTime)))){ |
| 727 | isMatch = true; | 737 | isMatch = true; |
| 728 | matchSr = sr; | 738 | matchSr = sr; |
| 729 | - } else{ // if(Math.abs((nextSr.getDfsjT())- fInTime) < 120) | 739 | + } else if(nextSr.getQdzName().trim().indexOf(fInParkName) != -1){ // if(Math.abs((nextSr.getDfsjT())- fInTime) < 120) |
| 730 | isMatch = true; | 740 | isMatch = true; |
| 731 | matchSr = nextSr; | 741 | matchSr = nextSr; |
| 732 | } | 742 | } |
| @@ -765,14 +775,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -765,14 +775,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 765 | tag = tagList.get(0); | 775 | tag = tagList.get(0); |
| 766 | tag.setfBusIdIn(fBusID); | 776 | tag.setfBusIdIn(fBusID); |
| 767 | if(fIsOut==1){ | 777 | if(fIsOut==1){ |
| 768 | - sql = "UPDATE bsth_c_s_sp_info_real_tag set `in` = ? ,in_time=?,in_time_str=?,f_bus_id_in=? WHERE real_id=?"; | ||
| 769 | - jdbcTemplate.update(sql,1,fInTime,inTimeStr,fBusID,real_id); | 778 | + sql = "UPDATE bsth_c_s_sp_info_real_tag set `in` = ? ,in_time=?,in_time_str=?,f_bus_id_in=?,out_name=? WHERE real_id=?"; |
| 779 | + jdbcTemplate.update(sql,1,fInTime,inTimeStr,fBusID,fInParkName,real_id); | ||
| 770 | tag.setIn(1); | 780 | tag.setIn(1); |
| 771 | tag.setfBusIdIn(fInTime.toString()); | 781 | tag.setfBusIdIn(fInTime.toString()); |
| 772 | tag.setInTimeStr(inTimeStr); | 782 | tag.setInTimeStr(inTimeStr); |
| 773 | } else if(fIsOut==2){ | 783 | } else if(fIsOut==2){ |
| 774 | - sql = "UPDATE bsth_c_s_sp_info_real_tag set `out` =?,out_time=?,out_time_str=?,f_bus_id_out=? WHERE real_id=?"; | ||
| 775 | - jdbcTemplate.update(sql,1,fOutTime,outTimeStr,fBusID,real_id); | 784 | + sql = "UPDATE bsth_c_s_sp_info_real_tag set `out` =?,out_time=?,out_time_str=?,f_bus_id_out=?,in_name=? WHERE real_id=?"; |
| 785 | + jdbcTemplate.update(sql,1,fOutTime,outTimeStr,fBusID,fInParkName,real_id); | ||
| 776 | tag.setOut(1); | 786 | tag.setOut(1); |
| 777 | tag.setOutTime(fOutTime); | 787 | tag.setOutTime(fOutTime); |
| 778 | tag.setOutTimeStr(outTimeStr); | 788 | tag.setOutTimeStr(outTimeStr); |
| @@ -785,14 +795,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -785,14 +795,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 785 | tag.setXlBm(lineCode); | 795 | tag.setXlBm(lineCode); |
| 786 | tag.setScheduleDateStr(dateStr); | 796 | tag.setScheduleDateStr(dateStr); |
| 787 | if(fIsOut==1){ | 797 | if(fIsOut==1){ |
| 788 | - sql = "INSERT INTO bsth_c_s_sp_info_real_tag (real_id,`in`,in_time,in_time_str,cl_zbh,car_plate,f_bus_id_in,xl_bm,schedule_date_str)VALUES (?,?,?,?,?,?,?,?,?)"; | ||
| 789 | - jdbcTemplate.update(sql,real_id,1,fInTime,inTimeStr,matchSr.getClZbh(),fPlateCode,fBusID,lineCode,dateStr); | 798 | + sql = "INSERT INTO bsth_c_s_sp_info_real_tag (real_id,`in`,in_time,in_time_str,cl_zbh,car_plate,f_bus_id_in,xl_bm,schedule_date_str,qdz_name,zdz_name,in_name)VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"; |
| 799 | + jdbcTemplate.update(sql,real_id,1,fInTime,inTimeStr,matchSr.getClZbh(),fPlateCode,fBusID,lineCode,dateStr,matchSr.getQdzName(),matchSr.getZdzName(),fInParkName); | ||
| 790 | tag.setIn(1); | 800 | tag.setIn(1); |
| 791 | tag.setfBusIdIn(fInTime.toString()); | 801 | tag.setfBusIdIn(fInTime.toString()); |
| 792 | tag.setInTimeStr(inTimeStr); | 802 | tag.setInTimeStr(inTimeStr); |
| 793 | } else if(fIsOut==2){ | 803 | } else if(fIsOut==2){ |
| 794 | - sql = "INSERT INTO bsth_c_s_sp_info_real_tag (real_id,`out`,out_time,out_time_str,cl_zbh,car_plate,f_bus_id_out,xl_bm,schedule_date_str)VALUES (?,?,?,?,?,?,?,?,?)"; | ||
| 795 | - jdbcTemplate.update(sql,real_id,1,fOutTime,outTimeStr,matchSr.getClZbh(),fPlateCode,fBusID,lineCode,dateStr); | 804 | + sql = "INSERT INTO bsth_c_s_sp_info_real_tag (real_id,`out`,out_time,out_time_str,cl_zbh,car_plate,f_bus_id_out,xl_bm,schedule_date_str,qdz_name,zdz_name,out_name)VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"; |
| 805 | + jdbcTemplate.update(sql,real_id,1,fOutTime,outTimeStr,matchSr.getClZbh(),fPlateCode,fBusID,lineCode,dateStr,matchSr.getQdzName(),matchSr.getZdzName(),fInParkName); | ||
| 796 | tag.setOut(1); | 806 | tag.setOut(1); |
| 797 | tag.setOutTime(fOutTime); | 807 | tag.setOutTime(fOutTime); |
| 798 | tag.setOutTimeStr(outTimeStr); | 808 | tag.setOutTimeStr(outTimeStr); |
| @@ -831,8 +841,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -831,8 +841,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 831 | }); | 841 | }); |
| 832 | 842 | ||
| 833 | if (tagNextList.size() < 1) { | 843 | if (tagNextList.size() < 1) { |
| 834 | - sql = "INSERT INTO bsth_c_s_sp_info_real_tag (real_id,sd_tag,sd_time,cl_zbh,car_plate,f_bus_id_sd,xl_bm,schedule_date_str)VALUES (?,?,?,?,?,?,?,?)"; | ||
| 835 | - jdbcTemplate.update(sql,nextId,1,inTimeStr,matchSr.getClZbh(),fPlateCode,fBusID,lineCode,dateStr); | 844 | + sql = "INSERT INTO bsth_c_s_sp_info_real_tag (real_id,sd_tag,sd_time,cl_zbh,car_plate,f_bus_id_sd,xl_bm,schedule_date_str,qdz_name,zdz_name)VALUES (?,?,?,?,?,?,?,?,?,?)"; |
| 845 | + jdbcTemplate.update(sql,nextId,1,inTimeStr,matchSr.getClZbh(),fPlateCode,fBusID,lineCode,dateStr,mNextSr.getQdzName(),mNextSr.getZdzName()); | ||
| 836 | tagNext.setClZbh(matchSr.getClZbh()); | 846 | tagNext.setClZbh(matchSr.getClZbh()); |
| 837 | tagNext.setCarPlate(fPlateCode); | 847 | tagNext.setCarPlate(fPlateCode); |
| 838 | tagNext.setXlBm(lineCode); | 848 | tagNext.setXlBm(lineCode); |