Commit d4dbb07497a49811b541631d2321a36d679e0b15
1 parent
5acbd6d6
去掉老系统接口代理...
Showing
13 changed files
with
38 additions
and
451 deletions
src/main/java/com/bsth/StartCommand.java
| @@ -3,7 +3,6 @@ package com.bsth; | @@ -3,7 +3,6 @@ package com.bsth; | ||
| 3 | 3 | ||
| 4 | import com.bsth.server_rs.schedule.real.thread.SchInOutDataRefreshThread; | 4 | import com.bsth.server_rs.schedule.real.thread.SchInOutDataRefreshThread; |
| 5 | import com.bsth.server_rs.thread.RfidCardInfoPersistenceThread; | 5 | import com.bsth.server_rs.thread.RfidCardInfoPersistenceThread; |
| 6 | -import com.bsth.service.Line2SystemService; | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.boot.CommandLineRunner; | 7 | import org.springframework.boot.CommandLineRunner; |
| 9 | import org.springframework.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| @@ -20,8 +19,6 @@ import java.util.concurrent.TimeUnit; | @@ -20,8 +19,6 @@ import java.util.concurrent.TimeUnit; | ||
| 20 | @Component | 19 | @Component |
| 21 | public class StartCommand implements CommandLineRunner{ | 20 | public class StartCommand implements CommandLineRunner{ |
| 22 | 21 | ||
| 23 | - @Autowired | ||
| 24 | - Line2SystemService line2SystemService; | ||
| 25 | 22 | ||
| 26 | @Autowired | 23 | @Autowired |
| 27 | RfidCardInfoPersistenceThread rfidCardInfoPersistenceThread; | 24 | RfidCardInfoPersistenceThread rfidCardInfoPersistenceThread; |
| @@ -33,9 +30,6 @@ public class StartCommand implements CommandLineRunner{ | @@ -33,9 +30,6 @@ public class StartCommand implements CommandLineRunner{ | ||
| 33 | public void run(String... arg0){ | 30 | public void run(String... arg0){ |
| 34 | 31 | ||
| 35 | try { | 32 | try { |
| 36 | - //将增量的线路load到对照清单 | ||
| 37 | - line2SystemService.loadByLineInfo(); | ||
| 38 | - | ||
| 39 | ScheduledExecutorService sexec = Application.mainServices; | 33 | ScheduledExecutorService sexec = Application.mainServices; |
| 40 | //定时将人车卡数据入库 | 34 | //定时将人车卡数据入库 |
| 41 | sexec.scheduleWithFixedDelay(rfidCardInfoPersistenceThread, 120, 60 * 10, TimeUnit.SECONDS); | 35 | sexec.scheduleWithFixedDelay(rfidCardInfoPersistenceThread, 120, 60 * 10, TimeUnit.SECONDS); |
src/main/java/com/bsth/controller/Line2SystemController.java deleted
100644 → 0
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Line2System; | ||
| 4 | -import com.bsth.service.Line2SystemService; | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | -import org.springframework.web.bind.annotation.RestController; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * Created by panzhao on 2017/3/14. | ||
| 12 | - */ | ||
| 13 | -@RestController | ||
| 14 | -@RequestMapping("/line2System") | ||
| 15 | -public class Line2SystemController { | ||
| 16 | - | ||
| 17 | - @Autowired | ||
| 18 | - Line2SystemService line2SystemService; | ||
| 19 | - | ||
| 20 | - @RequestMapping(value = "/update", method = RequestMethod.POST) | ||
| 21 | - public Line2System update(Line2System line2System){ | ||
| 22 | - return line2SystemService.update(line2System); | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - @RequestMapping("/all") | ||
| 26 | - public Iterable<Line2System> findAll(){ | ||
| 27 | - return line2SystemService.findAll(); | ||
| 28 | - } | ||
| 29 | -} |
src/main/java/com/bsth/entity/Line2System.java deleted
100644 → 0
| 1 | -package com.bsth.entity; | ||
| 2 | - | ||
| 3 | -import javax.persistence.Entity; | ||
| 4 | -import javax.persistence.Id; | ||
| 5 | -import javax.persistence.Table; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * 线路映射到某个系统(新老系统并行时需要这个对照) | ||
| 9 | - * Created by panzhao on 2017/3/14. | ||
| 10 | - */ | ||
| 11 | -@Entity | ||
| 12 | -@Table(name = "interface_line_system_mapp") | ||
| 13 | -public class Line2System { | ||
| 14 | - | ||
| 15 | - @Id | ||
| 16 | - private String lineCode; | ||
| 17 | - | ||
| 18 | - private String lineName; | ||
| 19 | - | ||
| 20 | - /** | ||
| 21 | - * 是否从新系统接入数据 | ||
| 22 | - */ | ||
| 23 | - private boolean isNew; | ||
| 24 | - | ||
| 25 | - public String getLineCode() { | ||
| 26 | - return lineCode; | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - public void setLineCode(String lineCode) { | ||
| 30 | - this.lineCode = lineCode; | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - public boolean isNew() { | ||
| 34 | - return isNew; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - public void setNew(boolean aNew) { | ||
| 38 | - isNew = aNew; | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - public String getLineName() { | ||
| 42 | - return lineName; | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - public void setLineName(String lineName) { | ||
| 46 | - this.lineName = lineName; | ||
| 47 | - } | ||
| 48 | -} |
src/main/java/com/bsth/redis/ScheduleRedisService.java
| @@ -7,7 +7,6 @@ import com.bsth.redis.util.RedisUtils; | @@ -7,7 +7,6 @@ import com.bsth.redis.util.RedisUtils; | ||
| 7 | import com.bsth.repository.ScheduleRealInfoRepository; | 7 | import com.bsth.repository.ScheduleRealInfoRepository; |
| 8 | import com.bsth.server_rs.base_info.line.Line; | 8 | import com.bsth.server_rs.base_info.line.Line; |
| 9 | import com.bsth.server_rs.base_info.line.buffer.LineBufferData; | 9 | import com.bsth.server_rs.base_info.line.buffer.LineBufferData; |
| 10 | -import com.bsth.server_ws.WebServiceProxy; | ||
| 11 | import com.bsth.util.ConfigUtil; | 10 | import com.bsth.util.ConfigUtil; |
| 12 | import com.bsth.util.ConvertUtil; | 11 | import com.bsth.util.ConvertUtil; |
| 13 | import com.google.common.collect.ArrayListMultimap; | 12 | import com.google.common.collect.ArrayListMultimap; |
| @@ -48,9 +47,6 @@ public class ScheduleRedisService implements CommandLineRunner { | @@ -48,9 +47,6 @@ public class ScheduleRedisService implements CommandLineRunner { | ||
| 48 | private RedisTemplate redisTemplate; | 47 | private RedisTemplate redisTemplate; |
| 49 | 48 | ||
| 50 | @Autowired | 49 | @Autowired |
| 51 | - WebServiceProxy webServiceProxy; | ||
| 52 | - | ||
| 53 | - @Autowired | ||
| 54 | RedisUtils redisUtils; | 50 | RedisUtils redisUtils; |
| 55 | 51 | ||
| 56 | static Logger logger = LoggerFactory.getLogger(ScheduleRedisService.class); | 52 | static Logger logger = LoggerFactory.getLogger(ScheduleRedisService.class); |
| @@ -143,7 +139,7 @@ public class ScheduleRedisService implements CommandLineRunner { | @@ -143,7 +139,7 @@ public class ScheduleRedisService implements CommandLineRunner { | ||
| 143 | * @param rq | 139 | * @param rq |
| 144 | * @param companyId | 140 | * @param companyId |
| 145 | * @return | 141 | * @return |
| 146 | - */ | 142 | + |
| 147 | public ArrayListMultimap<String, ScheduleRealInfo> findByDateAndGroupByNbbm_bingxing(String rq, String companyId) { | 143 | public ArrayListMultimap<String, ScheduleRealInfo> findByDateAndGroupByNbbm_bingxing(String rq, String companyId) { |
| 148 | List<String> lineArray = webServiceProxy.findLinesByCompany_new(companyId); | 144 | List<String> lineArray = webServiceProxy.findLinesByCompany_new(companyId); |
| 149 | ArrayListMultimap<String, ScheduleRealInfo> rs = ArrayListMultimap.create(); | 145 | ArrayListMultimap<String, ScheduleRealInfo> rs = ArrayListMultimap.create(); |
| @@ -159,7 +155,7 @@ public class ScheduleRedisService implements CommandLineRunner { | @@ -159,7 +155,7 @@ public class ScheduleRedisService implements CommandLineRunner { | ||
| 159 | } | 155 | } |
| 160 | } | 156 | } |
| 161 | return rs; | 157 | return rs; |
| 162 | - } | 158 | + }*/ |
| 163 | 159 | ||
| 164 | /** | 160 | /** |
| 165 | * 返回指定日期,公司的实际排班,并按线路_车辆分组 | 161 | * 返回指定日期,公司的实际排班,并按线路_车辆分组 |
| @@ -169,7 +165,7 @@ public class ScheduleRedisService implements CommandLineRunner { | @@ -169,7 +165,7 @@ public class ScheduleRedisService implements CommandLineRunner { | ||
| 169 | * @return | 165 | * @return |
| 170 | */ | 166 | */ |
| 171 | public ArrayListMultimap<String, ScheduleRealInfo> findByDateAndGroupByNbbm(String rq, String companyId) { | 167 | public ArrayListMultimap<String, ScheduleRealInfo> findByDateAndGroupByNbbm(String rq, String companyId) { |
| 172 | - List<String> lineArray = webServiceProxy.findLinesByCompany(companyId); | 168 | + List<String> lineArray = LineBufferData.findCodesByCompany(companyId); |
| 173 | ArrayListMultimap<String, ScheduleRealInfo> rs = ArrayListMultimap.create(); | 169 | ArrayListMultimap<String, ScheduleRealInfo> rs = ArrayListMultimap.create(); |
| 174 | 170 | ||
| 175 | rq = rq.replaceAll("-", ""); | 171 | rq = rq.replaceAll("-", ""); |
| @@ -194,7 +190,7 @@ public class ScheduleRedisService implements CommandLineRunner { | @@ -194,7 +190,7 @@ public class ScheduleRedisService implements CommandLineRunner { | ||
| 194 | */ | 190 | */ |
| 195 | public ArrayListMultimap<String, ScheduleRealInfo> findByDateAndGroupByLine(String rq, String companyId) { | 191 | public ArrayListMultimap<String, ScheduleRealInfo> findByDateAndGroupByLine(String rq, String companyId) { |
| 196 | 192 | ||
| 197 | - List<String> lineArray = webServiceProxy.findLinesByCompany(companyId); | 193 | + List<String> lineArray = LineBufferData.findCodesByCompany(companyId); |
| 198 | ArrayListMultimap<String, ScheduleRealInfo> rs = ArrayListMultimap.create(); | 194 | ArrayListMultimap<String, ScheduleRealInfo> rs = ArrayListMultimap.create(); |
| 199 | 195 | ||
| 200 | rq = rq.replaceAll("-", ""); | 196 | rq = rq.replaceAll("-", ""); |
src/main/java/com/bsth/repository/Line2SystemRepository.java deleted
100644 → 0
| 1 | -package com.bsth.repository; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Line2System; | ||
| 4 | -import org.springframework.data.jpa.repository.Query; | ||
| 5 | -import org.springframework.data.repository.PagingAndSortingRepository; | ||
| 6 | -import org.springframework.stereotype.Repository; | ||
| 7 | - | ||
| 8 | -import java.util.List; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * Created by panzhao on 2017/3/14. | ||
| 12 | - */ | ||
| 13 | -@Repository | ||
| 14 | -public interface Line2SystemRepository extends PagingAndSortingRepository<Line2System, String> { | ||
| 15 | - | ||
| 16 | - @Query(value = "select line_code, name as line_name, 0 as is_new from bsth_c_line where line_code not in(select line_code from interface_line_system_mapp)", nativeQuery = true) | ||
| 17 | - List<Line2System> loadByLineInfo(); | ||
| 18 | -} |
src/main/java/com/bsth/server_rs/base_info/line/buffer/LineBufferData.java
| @@ -8,6 +8,7 @@ import org.springframework.boot.CommandLineRunner; | @@ -8,6 +8,7 @@ import org.springframework.boot.CommandLineRunner; | ||
| 8 | import org.springframework.core.annotation.Order; | 8 | import org.springframework.core.annotation.Order; |
| 9 | import org.springframework.stereotype.Component; | 9 | import org.springframework.stereotype.Component; |
| 10 | 10 | ||
| 11 | +import java.util.ArrayList; | ||
| 11 | import java.util.HashMap; | 12 | import java.util.HashMap; |
| 12 | import java.util.List; | 13 | import java.util.List; |
| 13 | import java.util.Map; | 14 | import java.util.Map; |
| @@ -58,4 +59,13 @@ public class LineBufferData implements CommandLineRunner { | @@ -58,4 +59,13 @@ public class LineBufferData implements CommandLineRunner { | ||
| 58 | public void run(String... strings) throws Exception { | 59 | public void run(String... strings) throws Exception { |
| 59 | Application.mainServices.scheduleWithFixedDelay(lineRefreshThread, 10, 60 * 60, TimeUnit.SECONDS); | 60 | Application.mainServices.scheduleWithFixedDelay(lineRefreshThread, 10, 60 * 60, TimeUnit.SECONDS); |
| 60 | } | 61 | } |
| 62 | + | ||
| 63 | + public static List<String> findCodesByCompany(String company) { | ||
| 64 | + List<Line> list = companyListMap.get(company); | ||
| 65 | + List<String> codes = new ArrayList<>(list.size()); | ||
| 66 | + | ||
| 67 | + for(Line line : list) | ||
| 68 | + codes.add(line.getLineCode()); | ||
| 69 | + return codes; | ||
| 70 | + } | ||
| 61 | } | 71 | } |
src/main/java/com/bsth/server_ws/WebServiceProxy.java deleted
100644 → 0
| 1 | -package com.bsth.server_ws; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.alibaba.fastjson.JSONArray; | ||
| 5 | -import com.bsth.Application; | ||
| 6 | -import com.bsth.entity.Line2System; | ||
| 7 | -import com.bsth.old_sys_wsclient.nh_ld.ClsLDInfo; | ||
| 8 | -import com.bsth.repository.Line2SystemRepository; | ||
| 9 | -import com.bsth.server_ws.waybill.entity.NH_waybill; | ||
| 10 | -import com.bsth.service.Line2SystemService; | ||
| 11 | -import com.bsth.util.ConvertUtil; | ||
| 12 | -import com.google.common.collect.ArrayListMultimap; | ||
| 13 | -import org.apache.commons.lang3.StringUtils; | ||
| 14 | -import org.slf4j.Logger; | ||
| 15 | -import org.slf4j.LoggerFactory; | ||
| 16 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 17 | -import org.springframework.boot.CommandLineRunner; | ||
| 18 | -import org.springframework.core.annotation.Order; | ||
| 19 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 20 | -import org.springframework.stereotype.Component; | ||
| 21 | - | ||
| 22 | -import java.util.*; | ||
| 23 | -import java.util.concurrent.TimeUnit; | ||
| 24 | - | ||
| 25 | -/** | ||
| 26 | - * Created by panzhao on 2017/3/15. | ||
| 27 | - */ | ||
| 28 | -@Component | ||
| 29 | -@Order(3) | ||
| 30 | -public class WebServiceProxy implements CommandLineRunner { | ||
| 31 | - | ||
| 32 | - @Autowired | ||
| 33 | - JdbcTemplate jdbcTemplate; | ||
| 34 | - | ||
| 35 | - @Autowired | ||
| 36 | - FixedRefreshThread fixedRefreshThread; | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * 人员线路配置 | ||
| 40 | - */ | ||
| 41 | - private static Map<String, String> per_lineMap; | ||
| 42 | - | ||
| 43 | - /** | ||
| 44 | - * 线路所属公司映射 | ||
| 45 | - */ | ||
| 46 | - private static ArrayListMultimap<String, String> company_linesMap; | ||
| 47 | - | ||
| 48 | - /** | ||
| 49 | - * 从老系统获取数据的线路 | ||
| 50 | - */ | ||
| 51 | - private static Map<String, Integer> oldSysLines; | ||
| 52 | - | ||
| 53 | - @Autowired | ||
| 54 | - Line2SystemRepository line2SystemRepository; | ||
| 55 | - | ||
| 56 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - /** | ||
| 60 | - * 判断是否从新系统获取数据(根据工号) | ||
| 61 | - * @param companyId 公司编码 | ||
| 62 | - * @param workNO 员工号 | ||
| 63 | - * @return | ||
| 64 | - */ | ||
| 65 | - public static boolean personIsNew(String companyId, String workNO){ | ||
| 66 | - String lineCode = per_lineMap.get(companyId + "-" + workNO); | ||
| 67 | - | ||
| 68 | - if(StringUtils.isEmpty(lineCode)) | ||
| 69 | - return false; | ||
| 70 | - | ||
| 71 | - if(oldSysLines.containsKey(lineCode)) | ||
| 72 | - return false; | ||
| 73 | - | ||
| 74 | - return true; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - /** | ||
| 78 | - * 获取指定公司下的线路清单 | ||
| 79 | - * @param companyId | ||
| 80 | - * @return | ||
| 81 | - */ | ||
| 82 | - public static List<String> findLinesByCompany(String companyId){ | ||
| 83 | - return company_linesMap.get(companyId); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - /** | ||
| 87 | - * 获取指定公司下 从新系统走的线路清单 | ||
| 88 | - * @param companyId | ||
| 89 | - * @return | ||
| 90 | - */ | ||
| 91 | - public static List<String> findLinesByCompany_new(String companyId){ | ||
| 92 | - List<String> array = company_linesMap.get(companyId), rs = new ArrayList<>(); | ||
| 93 | - for(String lineCode : array){ | ||
| 94 | - if(!oldSysLines.containsKey(lineCode)) | ||
| 95 | - rs.add(lineCode); | ||
| 96 | - } | ||
| 97 | - return rs; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - /** | ||
| 101 | - * 是否全部从新系统获取数据 | ||
| 102 | - * @param companyId | ||
| 103 | - * @return | ||
| 104 | - */ | ||
| 105 | - public static boolean isAllNew(String companyId){ | ||
| 106 | - if(oldSysLines == null || oldSysLines.size() == 0) | ||
| 107 | - return true; | ||
| 108 | - | ||
| 109 | - List<String> lines = company_linesMap.get(companyId); | ||
| 110 | - List<String> unions = new ConvertUtil().calcUnion(lines, oldSysLines.keySet()); | ||
| 111 | - if(unions.size() == 0) | ||
| 112 | - return true; | ||
| 113 | - return false; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - /** | ||
| 117 | - * 合并新老系统的进出场数据 | ||
| 118 | - * @param newData | ||
| 119 | - * @param oldData | ||
| 120 | - * @param companyId | ||
| 121 | - * @return | ||
| 122 | - */ | ||
| 123 | - public static String[] mergerJccData(String[] newData, String[] oldData, String companyId){ | ||
| 124 | - if(oldSysLines == null || oldSysLines.size() == 0 || oldData == null) | ||
| 125 | - return newData; | ||
| 126 | - | ||
| 127 | - List<String> rs = new ArrayList<>(); | ||
| 128 | - | ||
| 129 | - List<String> lines = company_linesMap.get(companyId); | ||
| 130 | - //补集,要从新系统出来的数据 | ||
| 131 | - List<String> comps = new ConvertUtil().calcComplement(lines, oldSysLines.keySet()); | ||
| 132 | - String lineCode; | ||
| 133 | - for(int i = 0; i < newData.length; i ++){ | ||
| 134 | - lineCode = newData[i].split(",")[1]; | ||
| 135 | - if(comps.contains(lineCode)) | ||
| 136 | - rs.add(newData[i]); | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - //从老系统出来的数据 | ||
| 140 | - for(int i = 0; i < oldData.length; i ++){ | ||
| 141 | - lineCode = oldData[i].split(",")[1]; | ||
| 142 | - if(!comps.contains(lineCode)) | ||
| 143 | - rs.add(oldData[i]); | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - return rs.toArray(new String[rs.size()]); | ||
| 147 | - } | ||
| 148 | - | ||
| 149 | - | ||
| 150 | - @Override | ||
| 151 | - public void run(String... strings) throws Exception { | ||
| 152 | - Application.mainServices.scheduleWithFixedDelay(fixedRefreshThread, 5, 60 * 30, TimeUnit.SECONDS); | ||
| 153 | - } | ||
| 154 | - | ||
| 155 | - /** | ||
| 156 | - * 合并新老系统的路单数据 | ||
| 157 | - * @param value | ||
| 158 | - * @param oldArray | ||
| 159 | - * @param companyId | ||
| 160 | - * @return | ||
| 161 | - */ | ||
| 162 | - public static NH_waybill[] mergerData(NH_waybill[] newArray, ClsLDInfo[] oldArray, String companyId) { | ||
| 163 | - if(oldSysLines == null || oldSysLines.size() == 0) | ||
| 164 | - return newArray; | ||
| 165 | - | ||
| 166 | - JSONArray jsonArray = new JSONArray(); | ||
| 167 | - List<String> lines = company_linesMap.get(companyId); | ||
| 168 | - //补集,要从新系统出来的数据 | ||
| 169 | - List<String> comps = new ConvertUtil().calcComplement(lines, oldSysLines.keySet()); | ||
| 170 | - String lineCode; | ||
| 171 | - for(int i = 0; i < newArray.length; i ++){ | ||
| 172 | - lineCode = newArray[i].getM_strXLBM(); | ||
| 173 | - if(comps.contains(lineCode)) | ||
| 174 | - jsonArray.add(JSON.toJSON(newArray[i])); | ||
| 175 | - } | ||
| 176 | - | ||
| 177 | - //从老系统出来的数据 | ||
| 178 | - for(int i = 0; i < oldArray.length; i ++){ | ||
| 179 | - lineCode = oldArray[i].getM_strXLBM(); | ||
| 180 | - if(!comps.contains(lineCode)) | ||
| 181 | - jsonArray.add(JSON.toJSON(oldArray[i])); | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - //将jsonArray 转换成 NH_waybill[] | ||
| 185 | - NH_waybill[] rs = new NH_waybill[jsonArray.size()]; | ||
| 186 | - List<NH_waybill> list = JSONArray.parseArray(jsonArray.toJSONString(), NH_waybill.class); | ||
| 187 | - rs = list.toArray(rs); | ||
| 188 | - return rs; | ||
| 189 | - } | ||
| 190 | - | ||
| 191 | - @Component | ||
| 192 | - public class FixedRefreshThread extends Thread{ | ||
| 193 | - | ||
| 194 | - @Autowired | ||
| 195 | - WebServiceProxy webServiceProxy; | ||
| 196 | - | ||
| 197 | - @Override | ||
| 198 | - public void run() { | ||
| 199 | - webServiceProxy.refreshData(); | ||
| 200 | - } | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - @Autowired | ||
| 204 | - Line2SystemService line2SystemService; | ||
| 205 | - | ||
| 206 | - public void refreshData() { | ||
| 207 | - line2SystemService.loadByLineInfo(); | ||
| 208 | - List<Map<String, Object>> list = jdbcTemplate.queryForList("select p.JOB_CODE,L.LINE_CODE from bsth_c_s_ecinfo c left join bsth_c_personnel p on c.jsy=p.id left join bsth_c_line L on c.xl=L.id where c.is_cancel=0 "); | ||
| 209 | - Map<String, String> plMap = new HashMap<>(); | ||
| 210 | - for (Map<String, Object> map : list) { | ||
| 211 | - try { | ||
| 212 | - plMap.put(map.get("JOB_CODE").toString(), map.get("LINE_CODE").toString()); | ||
| 213 | - } catch (NullPointerException e) { | ||
| 214 | - logger.error("", e); | ||
| 215 | - } | ||
| 216 | - } | ||
| 217 | - per_lineMap = plMap; | ||
| 218 | - | ||
| 219 | - list = jdbcTemplate.queryForList("select LINE_CODE,COMPANY from bsth_c_line"); | ||
| 220 | - ArrayListMultimap<String, String> multimap = ArrayListMultimap.create(); | ||
| 221 | - for (Map<String, Object> map : list) { | ||
| 222 | - try { | ||
| 223 | - multimap.put(map.get("COMPANY").toString(), map.get("LINE_CODE").toString()); | ||
| 224 | - } catch (NullPointerException e) { | ||
| 225 | - logger.error("", e); | ||
| 226 | - } | ||
| 227 | - } | ||
| 228 | - company_linesMap = multimap; | ||
| 229 | - | ||
| 230 | - Iterator<Line2System> iterator = line2SystemRepository.findAll().iterator(); | ||
| 231 | - Map<String, Integer> oldSysLinesMap = new HashMap<>(); | ||
| 232 | - Line2System line2Sys; | ||
| 233 | - while(iterator.hasNext()){ | ||
| 234 | - line2Sys = iterator.next(); | ||
| 235 | - if(!line2Sys.isNew()) | ||
| 236 | - oldSysLinesMap.put(line2Sys.getLineCode(), 1); | ||
| 237 | - } | ||
| 238 | - oldSysLines = oldSysLinesMap; | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - public void update(Line2System line2System){ | ||
| 242 | - if(line2System.isNew()) | ||
| 243 | - oldSysLines.remove(line2System.getLineCode()); | ||
| 244 | - else | ||
| 245 | - oldSysLines.put(line2System.getLineCode(), 1); | ||
| 246 | - } | ||
| 247 | -} |
src/main/java/com/bsth/server_ws/attendance/AttendanceServiceSoap.java
| @@ -4,7 +4,7 @@ import com.bsth.entity.SchedulePlanInfo; | @@ -4,7 +4,7 @@ import com.bsth.entity.SchedulePlanInfo; | ||
| 4 | import com.bsth.entity.ScheduleRealInfo; | 4 | import com.bsth.entity.ScheduleRealInfo; |
| 5 | import com.bsth.redis.PlanScheduleRedisService; | 5 | import com.bsth.redis.PlanScheduleRedisService; |
| 6 | import com.bsth.redis.ScheduleRedisService; | 6 | import com.bsth.redis.ScheduleRedisService; |
| 7 | -import com.bsth.server_ws.WebServiceProxy; | 7 | +import com.bsth.server_rs.base_info.line.buffer.LineBufferData; |
| 8 | import com.bsth.server_ws.attendance.entity.Jsy_attendance; | 8 | import com.bsth.server_ws.attendance.entity.Jsy_attendance; |
| 9 | import com.bsth.server_ws.util.WSDataConver; | 9 | import com.bsth.server_ws.util.WSDataConver; |
| 10 | import com.bsth.service.DDYAuthorityService; | 10 | import com.bsth.service.DDYAuthorityService; |
| @@ -50,10 +50,8 @@ public class AttendanceServiceSoap implements AttendanceService, ApplicationCont | @@ -50,10 +50,8 @@ public class AttendanceServiceSoap implements AttendanceService, ApplicationCont | ||
| 50 | return false; | 50 | return false; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | - //该调度员分管的线路 | ||
| 54 | - //List<String> lineArray = ddyAuthorityService.findLinesByDDY(ddy_id); | ||
| 55 | //按公司编码获取线路 | 53 | //按公司编码获取线路 |
| 56 | - List<String> lineArray = WebServiceProxy.findLinesByCompany(company); | 54 | + List<String> lineArray = LineBufferData.findCodesByCompany(company); |
| 57 | //计划排班 | 55 | //计划排班 |
| 58 | List<SchedulePlanInfo> plans = planScheduleRedisService.findByMultiLine(lineArray, rq); | 56 | List<SchedulePlanInfo> plans = planScheduleRedisService.findByMultiLine(lineArray, rq); |
| 59 | //实际排班 | 57 | //实际排班 |
src/main/java/com/bsth/server_ws/park_station/CompanyServiceSoap.java
| 1 | package com.bsth.server_ws.park_station; | 1 | package com.bsth.server_ws.park_station; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.ScheduleRealInfo; | 3 | import com.bsth.entity.ScheduleRealInfo; |
| 4 | -import com.bsth.old_sys_wsclient.OldWSClient; | ||
| 5 | -import com.bsth.server_ws.WebServiceProxy; | ||
| 6 | import com.bsth.server_ws.util.Constants; | 4 | import com.bsth.server_ws.util.Constants; |
| 7 | import com.bsth.server_ws.util.ControlHttpUtils; | 5 | import com.bsth.server_ws.util.ControlHttpUtils; |
| 8 | import com.bsth.server_ws.util.WSDataConver; | 6 | import com.bsth.server_ws.util.WSDataConver; |
| @@ -50,11 +48,12 @@ public class CompanyServiceSoap implements CompanyService { | @@ -50,11 +48,12 @@ public class CompanyServiceSoap implements CompanyService { | ||
| 50 | } | 48 | } |
| 51 | result.value = WSDataConver.to_returnJCCInfo(list); | 49 | result.value = WSDataConver.to_returnJCCInfo(list); |
| 52 | 50 | ||
| 53 | - if(!WebServiceProxy.isAllNew(companyId)){ | 51 | + //不再代理老接口数据 |
| 52 | + /*if(!WebServiceProxy.isAllNew(companyId)){ | ||
| 54 | String[] oldArray = OldWSClient.returnCCInfo(companyId, rq); | 53 | String[] oldArray = OldWSClient.returnCCInfo(companyId, rq); |
| 55 | //合并新老系统的数据 | 54 | //合并新老系统的数据 |
| 56 | result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId); | 55 | result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId); |
| 57 | - } | 56 | + }*/ |
| 58 | return true; | 57 | return true; |
| 59 | } | 58 | } |
| 60 | 59 | ||
| @@ -76,11 +75,12 @@ public class CompanyServiceSoap implements CompanyService { | @@ -76,11 +75,12 @@ public class CompanyServiceSoap implements CompanyService { | ||
| 76 | } | 75 | } |
| 77 | result.value = WSDataConver.to_returnJCCInfo(list); | 76 | result.value = WSDataConver.to_returnJCCInfo(list); |
| 78 | 77 | ||
| 79 | - if(!WebServiceProxy.isAllNew(companyId)){ | 78 | + //不再代理老接口数据 |
| 79 | + /*if(!WebServiceProxy.isAllNew(companyId)){ | ||
| 80 | String[] oldArray = OldWSClient.returnJCInfo(companyId, rq); | 80 | String[] oldArray = OldWSClient.returnJCInfo(companyId, rq); |
| 81 | //合并新老系统的数据 | 81 | //合并新老系统的数据 |
| 82 | result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId); | 82 | result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId); |
| 83 | - } | 83 | + }*/ |
| 84 | 84 | ||
| 85 | return true; | 85 | return true; |
| 86 | } | 86 | } |
| @@ -90,23 +90,16 @@ public class CompanyServiceSoap implements CompanyService { | @@ -90,23 +90,16 @@ public class CompanyServiceSoap implements CompanyService { | ||
| 90 | public boolean getCurrentDayPlan(String ip, String userName, String password, String workId, String company, Holder<String[]> result, Holder<String> fError) { | 90 | public boolean getCurrentDayPlan(String ip, String userName, String password, String workId, String company, Holder<String[]> result, Holder<String> fError) { |
| 91 | try{ | 91 | try{ |
| 92 | logger.info("getCurrentDayPlan workId: " + workId); | 92 | logger.info("getCurrentDayPlan workId: " + workId); |
| 93 | - if(WebServiceProxy.personIsNew(company, workId)){ | ||
| 94 | - | ||
| 95 | - List<ScheduleRealInfo> list = null; | ||
| 96 | - try{ | ||
| 97 | - //从调度系统获取数据 | ||
| 98 | - list = ControlHttpUtils.getCurrentDayPlan(company, workId); | ||
| 99 | - logger.info("从调度系统获取到数据 size: " + list.size()); | ||
| 100 | - }catch (Exception e){ | ||
| 101 | - //访问调度系统异常,尝试从数据库获取 | ||
| 102 | - logger.error("", e); | ||
| 103 | - } | ||
| 104 | - result.value = WSDataConver.to_getCurrentDayPlan(list); | ||
| 105 | - } | ||
| 106 | - else{ | ||
| 107 | - result.value = OldWSClient.getCurrentDayPlan(workId, company); | ||
| 108 | - logger.info("从老系统获取size: " + result.value.length); | 93 | + List<ScheduleRealInfo> list = null; |
| 94 | + try{ | ||
| 95 | + //从调度系统获取数据 | ||
| 96 | + list = ControlHttpUtils.getCurrentDayPlan(company, workId); | ||
| 97 | + logger.info("从调度系统获取到数据 size: " + list.size()); | ||
| 98 | + }catch (Exception e){ | ||
| 99 | + //访问调度系统异常,尝试从数据库获取 | ||
| 100 | + logger.error("", e); | ||
| 109 | } | 101 | } |
| 102 | + result.value = WSDataConver.to_getCurrentDayPlan(list); | ||
| 110 | }catch(Exception e){ | 103 | }catch(Exception e){ |
| 111 | fError.value = e.getMessage(); | 104 | fError.value = e.getMessage(); |
| 112 | logger.error("", e); | 105 | logger.error("", e); |
src/main/java/com/bsth/server_ws/waybill/LD_ServiceSoap.java
| @@ -3,17 +3,14 @@ package com.bsth.server_ws.waybill; | @@ -3,17 +3,14 @@ package com.bsth.server_ws.waybill; | ||
| 3 | import com.bsth.entity.DutyEmployee; | 3 | import com.bsth.entity.DutyEmployee; |
| 4 | import com.bsth.entity.OilInfo; | 4 | import com.bsth.entity.OilInfo; |
| 5 | import com.bsth.entity.ScheduleRealInfo; | 5 | import com.bsth.entity.ScheduleRealInfo; |
| 6 | -import com.bsth.old_sys_wsclient.OldWSClient; | ||
| 7 | -import com.bsth.old_sys_wsclient.nh_ld.ClsLDInfo; | ||
| 8 | import com.bsth.redis.OilRedisService; | 6 | import com.bsth.redis.OilRedisService; |
| 9 | import com.bsth.redis.ScheduleRedisService; | 7 | import com.bsth.redis.ScheduleRedisService; |
| 10 | import com.bsth.repository.DutyEmployeeRepository; | 8 | import com.bsth.repository.DutyEmployeeRepository; |
| 11 | -import com.bsth.service.UserService; | ||
| 12 | -import com.bsth.server_ws.WebServiceProxy; | ||
| 13 | import com.bsth.server_ws.util.WSDataConver; | 9 | import com.bsth.server_ws.util.WSDataConver; |
| 14 | import com.bsth.server_ws.waybill.entity.NH_waybill; | 10 | import com.bsth.server_ws.waybill.entity.NH_waybill; |
| 15 | import com.bsth.server_ws.waybill.entity.SN_lossMileage; | 11 | import com.bsth.server_ws.waybill.entity.SN_lossMileage; |
| 16 | import com.bsth.server_ws.waybill.entity.SN_waybill; | 12 | import com.bsth.server_ws.waybill.entity.SN_waybill; |
| 13 | +import com.bsth.service.UserService; | ||
| 17 | import com.google.common.collect.ArrayListMultimap; | 14 | import com.google.common.collect.ArrayListMultimap; |
| 18 | import org.joda.time.format.DateTimeFormat; | 15 | import org.joda.time.format.DateTimeFormat; |
| 19 | import org.joda.time.format.DateTimeFormatter; | 16 | import org.joda.time.format.DateTimeFormatter; |
| @@ -64,7 +61,7 @@ public class LD_ServiceSoap implements LD_Service, ApplicationContextAware { | @@ -64,7 +61,7 @@ public class LD_ServiceSoap implements LD_Service, ApplicationContextAware { | ||
| 64 | String prveRq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1)); | 61 | String prveRq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1)); |
| 65 | 62 | ||
| 66 | //实际排班 | 63 | //实际排班 |
| 67 | - ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm_bingxing(prveRq, companyId); | 64 | + ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(prveRq, companyId); |
| 68 | //油耗信息 | 65 | //油耗信息 |
| 69 | Map<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq); | 66 | Map<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq); |
| 70 | //当班调派 | 67 | //当班调派 |
| @@ -74,11 +71,12 @@ public class LD_ServiceSoap implements LD_Service, ApplicationContextAware { | @@ -74,11 +71,12 @@ public class LD_ServiceSoap implements LD_Service, ApplicationContextAware { | ||
| 74 | NH_waybill[] array = WSDataConver.to_waybill_NH(listMap, oilInfoMap, des); | 71 | NH_waybill[] array = WSDataConver.to_waybill_NH(listMap, oilInfoMap, des); |
| 75 | result.value = array; | 72 | result.value = array; |
| 76 | 73 | ||
| 77 | - if(companyId.equals("26") && !WebServiceProxy.isAllNew(companyId)){ | 74 | + //不再代理老接口数据 |
| 75 | + /*if(companyId.equals("26") && !WebServiceProxy.isAllNew(companyId)){ | ||
| 78 | ClsLDInfo[] oldArray = OldWSClient.getNH_LD(companyId, rq); | 76 | ClsLDInfo[] oldArray = OldWSClient.getNH_LD(companyId, rq); |
| 79 | //合并新老系统的数据 | 77 | //合并新老系统的数据 |
| 80 | result.value = WebServiceProxy.mergerData(result.value, oldArray, companyId); | 78 | result.value = WebServiceProxy.mergerData(result.value, oldArray, companyId); |
| 81 | - } | 79 | + }*/ |
| 82 | } catch (Exception e) { | 80 | } catch (Exception e) { |
| 83 | logger.error("", e); | 81 | logger.error("", e); |
| 84 | fError.value = "服务器出现异常!"; | 82 | fError.value = "服务器出现异常!"; |
src/main/java/com/bsth/service/Line2SystemService.java deleted
100644 → 0
| 1 | -package com.bsth.service; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Line2System; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * Created by panzhao on 2017/3/14. | ||
| 7 | - */ | ||
| 8 | -public interface Line2SystemService { | ||
| 9 | - | ||
| 10 | - Line2System update(Line2System line2Sys); | ||
| 11 | - | ||
| 12 | - Iterable<Line2System> findAll(); | ||
| 13 | - | ||
| 14 | - /** | ||
| 15 | - * 从线路表加载增量的线路 | ||
| 16 | - */ | ||
| 17 | - void loadByLineInfo(); | ||
| 18 | -} |
src/main/java/com/bsth/service/impl/Line2SystemServiceImpl.java deleted
100644 → 0
| 1 | -package com.bsth.service.impl; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Line2System; | ||
| 4 | -import com.bsth.repository.Line2SystemRepository; | ||
| 5 | -import com.bsth.service.Line2SystemService; | ||
| 6 | -import com.bsth.server_ws.WebServiceProxy; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.stereotype.Service; | ||
| 9 | - | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * Created by panzhao on 2017/3/14. | ||
| 14 | - */ | ||
| 15 | -@Service | ||
| 16 | -public class Line2SystemServiceImpl implements Line2SystemService { | ||
| 17 | - | ||
| 18 | - @Autowired | ||
| 19 | - Line2SystemRepository line2SystemRepository; | ||
| 20 | - | ||
| 21 | - @Autowired | ||
| 22 | - WebServiceProxy webServiceProxy; | ||
| 23 | - | ||
| 24 | - @Override | ||
| 25 | - public Line2System update(Line2System line2Sys) { | ||
| 26 | - Line2System line2System = line2SystemRepository.save(line2Sys); | ||
| 27 | - webServiceProxy.update(line2System); | ||
| 28 | - return line2System; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - @Override | ||
| 32 | - public Iterable<Line2System> findAll() { | ||
| 33 | - return line2SystemRepository.findAll(); | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - @Override | ||
| 37 | - public void loadByLineInfo() { | ||
| 38 | - List<Line2System> list = line2SystemRepository.loadByLineInfo(); | ||
| 39 | - if(list != null && list.size() > 0) | ||
| 40 | - line2SystemRepository.save(list); | ||
| 41 | - } | ||
| 42 | -} |
src/main/resources/static/index.html
| @@ -147,7 +147,7 @@ | @@ -147,7 +147,7 @@ | ||
| 147 | //线路清单 | 147 | //线路清单 |
| 148 | !function () { | 148 | !function () { |
| 149 | var f = arguments.callee; | 149 | var f = arguments.callee; |
| 150 | - $.get('/line2System/all', function (list) { | 150 | +/* $.get('/line2System/all', function (list) { |
| 151 | list.sort(function (a, b) { | 151 | list.sort(function (a, b) { |
| 152 | return b.new - a.new; | 152 | return b.new - a.new; |
| 153 | }); | 153 | }); |
| @@ -171,7 +171,7 @@ | @@ -171,7 +171,7 @@ | ||
| 171 | $tr.attr('class', rs.new ? 'warning' : ''); | 171 | $tr.attr('class', rs.new ? 'warning' : ''); |
| 172 | }); | 172 | }); |
| 173 | }); | 173 | }); |
| 174 | - }); | 174 | + });*/ |
| 175 | }(); | 175 | }(); |
| 176 | 176 | ||
| 177 | </script> | 177 | </script> |