Commit 952eab026710edbc293a0817649c6cff7f99df7b
1 parent
8b6a0247
时刻模板上传修改
Showing
1 changed file
with
20 additions
and
2 deletions
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -8,9 +8,13 @@ import com.bsth.entity.schedule.SchedulePlanInfo; |
| 8 | 8 | import com.bsth.entity.schedule.TTInfo; |
| 9 | 9 | import com.bsth.entity.schedule.TTInfoDetail; |
| 10 | 10 | import com.bsth.entity.search.CustomerSpecs; |
| 11 | +import com.bsth.entity.sys.SysUser; | |
| 12 | +import com.bsth.entity.traffic.SKBUploadLogger; | |
| 11 | 13 | import com.bsth.repository.*; |
| 12 | 14 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 13 | 15 | import com.bsth.repository.schedule.*; |
| 16 | +import com.bsth.repository.traffic.SKBUploadLoggerRepository; | |
| 17 | +import com.bsth.security.util.SecurityUtils; | |
| 14 | 18 | import com.bsth.service.TrafficManageService; |
| 15 | 19 | import com.bsth.util.TimeUtils; |
| 16 | 20 | import com.bsth.util.db.DBUtils_MS; |
| ... | ... | @@ -101,6 +105,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 101 | 105 | @Autowired |
| 102 | 106 | private ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 103 | 107 | |
| 108 | + // 时刻表上传记录repository | |
| 109 | + @Autowired | |
| 110 | + private SKBUploadLoggerRepository skbUploadLoggerRepository; | |
| 111 | + | |
| 104 | 112 | |
| 105 | 113 | // 运管处接口 |
| 106 | 114 | private InternalPortType portType = null;//new Internal().getInternalHttpSoap11Endpoint(); |
| ... | ... | @@ -763,11 +771,12 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 763 | 771 | String[] idArray = ids.split(","); |
| 764 | 772 | StringBuffer sBufferA; |
| 765 | 773 | StringBuffer sBufferB; |
| 774 | + // 上传的时刻表集合 | |
| 775 | + List<TTInfo> ttinfoList = new ArrayList<>(); | |
| 766 | 776 | TTInfo ttInfo; |
| 767 | 777 | TTInfoDetail ttInfoDetail; |
| 768 | 778 | Iterator<TTInfoDetail> ttInfoDetailIterator; |
| 769 | 779 | HashMap<String,Object> param = new HashMap<String, Object>(); |
| 770 | - String lineCode ; | |
| 771 | 780 | sBuffer.append("<SKBs>"); |
| 772 | 781 | HashMap<String,String> paramMap; |
| 773 | 782 | HashMap<String,String> otherMap = new HashMap<String, String>(); |
| ... | ... | @@ -775,6 +784,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 775 | 784 | ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); |
| 776 | 785 | if(ttInfo == null) |
| 777 | 786 | continue; |
| 787 | + ttinfoList.add(ttInfo); // 保存时刻表 | |
| 778 | 788 | param.put("ttinfo.id_eq", ttInfo.getId()); |
| 779 | 789 | ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), |
| 780 | 790 | new Sort(Direction.ASC, "xlDir")).iterator(); |
| ... | ... | @@ -802,7 +812,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 802 | 812 | sBufferA.append("<JHYYLC>").append(ttInfoDetail.getJhlc()).append("</JHYYLC>"); |
| 803 | 813 | sBuffer.append(sBufferA).append(sBufferB); |
| 804 | 814 | } |
| 805 | - lineCode = ttInfoDetail.getXl().getLineCode(); | |
| 806 | 815 | // 如果发车时间格式错误,忽略此条 |
| 807 | 816 | if(changeTimeFormat(ttInfoDetail) == null){ |
| 808 | 817 | continue; |
| ... | ... | @@ -831,6 +840,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 831 | 840 | sBuffer.append("</SKBs>"); |
| 832 | 841 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ |
| 833 | 842 | result = "success"; |
| 843 | + SKBUploadLogger skbUploadLogger ; | |
| 844 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 845 | + // 保存时刻表上传记录 | |
| 846 | + for(TTInfo ttInfo1 : ttinfoList){ | |
| 847 | + skbUploadLogger = new SKBUploadLogger(); | |
| 848 | + skbUploadLogger.setTtInfo(ttInfo1); | |
| 849 | + skbUploadLogger.setUser(user); | |
| 850 | + skbUploadLoggerRepository.save(skbUploadLogger); | |
| 851 | + } | |
| 834 | 852 | } |
| 835 | 853 | } catch (Exception e) { |
| 836 | 854 | logger.error("setSKB:", e); | ... | ... |