Commit edbc2ac2b8e0c4a01e2f632fb9b26bf5952807a6

Authored by 潘钊
1 parent 3f637064

update...

src/main/java/com/bsth/common/Constants.java
... ... @@ -21,6 +21,9 @@ public class Constants {
21 21 public static final String LOGIN_FAILURE = "/user/loginFailure";
22 22 public static final String CAPTCHA = "/captcha.jpg";
23 23  
  24 + //对外的营运数据接口
  25 + public static final String SERVICE_INTERFACE = "/companyService/**";
  26 +
24 27 /**
25 28 * 线调部分子页面不做拦截,便于浏览器缓存
26 29 */
... ...
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
1   -//package com.bsth.controller.realcontrol;
2   -//
3   -//import org.springframework.web.bind.annotation.RequestMapping;
4   -//import org.springframework.web.bind.annotation.RestController;
5   -//
6   -///**
7   -// * 对外的营运数据接口,主要输出当日的数据
8   -// * Created by panzhao on 2017/3/15.
9   -// */
10   -//@RestController
11   -//@RequestMapping("/companyService")
12   -//public class ServiceDataInterface {
13   -//}
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.data.schedule.DayOfSchedule;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 对外的营运数据接口,主要输出当日的数据
  16 + * Created by panzhao on 2017/3/15.
  17 + */
  18 +@RestController
  19 +@RequestMapping("/companyService")
  20 +public class ServiceDataInterface {
  21 +
  22 + private final static String SECRE_KEY = "dVPHJkWUt5FhMT7jrM2dLV7QvlHAmZFd42rs1P0usBx8A7HZki";
  23 +
  24 + @Autowired
  25 + DayOfSchedule dayOfSchedule;
  26 +
  27 + @RequestMapping("/getCurrentDayPlan")
  28 + public List<ScheduleRealInfo> getCurrentDayPlan(
  29 + @RequestParam String companyId,
  30 + @RequestParam String workId,
  31 + @RequestParam String secretKey) {
  32 +
  33 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  34 + return null;
  35 +
  36 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  37 + for (ScheduleRealInfo sch : all) {
  38 + if (sch.getGsBm() != null
  39 + && sch.getGsBm().equals(companyId)
  40 + && sch.getjGh().equals(workId)) {
  41 + rs.add(sch);
  42 + }
  43 + }
  44 + return rs;
  45 + }
  46 +
  47 + @RequestMapping("/returnCCInfo")
  48 + public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  49 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  50 + return null;
  51 +
  52 +
  53 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  54 + for (ScheduleRealInfo sch : all) {
  55 +
  56 + if (sch.getBcType().equals("out")
  57 + && sch.getGsBm() != null
  58 + && sch.getGsBm().equals(companyId)) {
  59 + rs.add(sch);
  60 + }
  61 + }
  62 + return rs;
  63 + }
  64 +
  65 + @RequestMapping("/returnJCInfo")
  66 + public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  67 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  68 + return null;
  69 +
  70 +
  71 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  72 + for (ScheduleRealInfo sch : all) {
  73 + if (sch.getBcType().equals("in")
  74 + && sch.getGsBm() != null
  75 + && sch.getGsBm().equals(companyId)) {
  76 + rs.add(sch);
  77 + }
  78 + }
  79 + return rs;
  80 + }
  81 +}
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -378,9 +378,11 @@ public class DayOfSchedule implements CommandLineRunner {
378 378 sch.setZdsj(fmtHHmm.print(fmtHHmm.parseMillis(sch.getFcsj()) + (sch.getBcsj() * 60 * 1000)));
379 379 sch.setLate(false);
380 380 }
  381 +
  382 + sch.setJhlcOrig(sch.getJhlc());
381 383 //计划里程为0,设置NULL
382   - if (sch.getJhlc() != null && sch.getJhlc() == 0)
383   - sch.setJhlc(null);
  384 + //if (sch.getJhlc() != null && sch.getJhlc() == 0)
  385 + // sch.setJhlc(null);
384 386 }
385 387 } catch (Exception e) {
386 388 logger.error("", e);
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -88,7 +88,10 @@ public class ScheduleRealInfo {
88 88 /** 计划里程 */
89 89 private Double jhlc;
90 90  
91   - /** 实际里程 */
  91 + /** 原始计划里程 (原计调的数据) */
  92 + private Double jhlcOrig;
  93 +
  94 + /** 实际里程 这个字段被废弃*/
92 95 private Double realMileage;
93 96  
94 97 /** 实际里程 */
... ... @@ -845,4 +848,12 @@ public class ScheduleRealInfo {
845 848 public void setRealMileage(Double realMileage) {
846 849 this.realMileage = realMileage;
847 850 }
  851 +
  852 + public Double getJhlcOrig() {
  853 + return jhlcOrig;
  854 + }
  855 +
  856 + public void setJhlcOrig(Double jhlcOrig) {
  857 + this.jhlcOrig = jhlcOrig;
  858 + }
848 859 }
... ...
src/main/java/com/bsth/filter/BaseFilter.java
... ... @@ -16,7 +16,7 @@ public abstract class BaseFilter implements Filter {
16 16 /**
17 17 * 白名单
18 18 */
19   - private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA,
  19 + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
20 20 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS };
21 21  
22 22 @Override
... ...
src/main/java/com/bsth/security/WebSecurityConfig.java
... ... @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
36 36 public void configure(WebSecurity web) throws Exception {
37 37 // 白名单
38 38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
39   - Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS);
  39 + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS);
40 40 }
41 41  
42 42 @Override
... ...