Commit 952eab026710edbc293a0817649c6cff7f99df7b

Authored by zlz
1 parent 8b6a0247

时刻模板上传修改

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