Commit 85bee802cf431c4014553d4a329bd02ddfb7895b

Authored by 潘钊
2 parents d5fd0b77 0bca86d7

Merge branch 'minhang' into qingpu

# Conflicts:
#	src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
#	src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
#	src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
#	src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list_report.html
#	src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js
Showing 53 changed files with 2125 additions and 479 deletions
... ... @@ -180,6 +180,11 @@
180 180 <version>1.4.7</version>
181 181 </dependency>
182 182  
  183 + <dependency>
  184 + <groupId>com.github.axet</groupId>
  185 + <artifactId>kaptcha</artifactId>
  186 + <version>0.0.9</version>
  187 + </dependency>
183 188 </dependencies>
184 189  
185 190 <dependencyManagement>
... ...
src/main/java/com/bsth/common/Constants.java
... ... @@ -13,12 +13,13 @@ public class Constants {
13 13 /**
14 14 * 不需要拦截的资源
15 15 */
16   - public static final String LOGIN = "/login";
  16 + public static final String LOGIN = "/user/login/**";
17 17 public static final String LOGIN_PAGE = "/login.html";
18 18 public static final String ASSETS_URL = "/assets/**";
19 19 public static final String FAVICON_URL = "/favicon.ico";
20 20 public static final String METRONIC_URL = "/metronic_v4.5.4/**";
21 21 public static final String LOGIN_FAILURE = "/user/loginFailure";
  22 + public static final String CAPTCHA = "/captcha.jpg";
22 23  
23 24 /**
24 25 * 线调部分子页面不做拦截,便于浏览器缓存
... ...
src/main/java/com/bsth/controller/directive/DirectiveController.java
... ... @@ -62,7 +62,7 @@ public class DirectiveController {
62 62 * @param @param lineId 新线路编码
63 63 * @throws
64 64 */
65   - @RequestMapping(value = "/lineChnage", method = RequestMethod.POST)
  65 + @RequestMapping(value = "/lineChnage", method = RequestMethod.GET)
66 66 public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){
67 67 SysUser user = SecurityUtils.getCurrentUser();
68 68 return directiveService.lineChange(nbbm, lineId, user.getUserName());
... ...
src/main/java/com/bsth/controller/forecast/SampleController.java
1 1 package com.bsth.controller.forecast;
2 2  
  3 +import java.io.UnsupportedEncodingException;
  4 +import java.net.URLDecoder;
  5 +
3 6 import org.springframework.beans.factory.annotation.Autowired;
4 7 import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
5 9 import org.springframework.web.bind.annotation.RestController;
6 10  
  11 +import com.alibaba.fastjson.JSON;
  12 +import com.alibaba.fastjson.JSONObject;
7 13 import com.bsth.controller.BaseController;
  14 +import com.bsth.controller.forecast.dto.CreateSampleParam;
8 15 import com.bsth.entity.forecast.Sample;
9 16 import com.bsth.service.forecast.SampleService;
10 17  
... ... @@ -16,7 +23,15 @@ public class SampleController extends BaseController&lt;Sample, Long&gt;{
16 23 SampleService sampleService;
17 24  
18 25 @RequestMapping("/create/gps")
19   - public int createDataByGps(String lineCode, Integer updown){
20   - return sampleService.createDataByGps(lineCode, updown);
  26 + public int createDataByGps(@RequestParam String data){
  27 +
  28 + try {
  29 + data = URLDecoder.decode(data, "utf-8");
  30 + CreateSampleParam param = JSONObject.toJavaObject(JSON.parseObject(data), CreateSampleParam.class);
  31 + System.out.println(param);
  32 + } catch (UnsupportedEncodingException e) {
  33 + e.printStackTrace();
  34 + }
  35 + return 0;
21 36 }
22 37 }
... ...
src/main/java/com/bsth/controller/forecast/dto/CreateSampleParam.java 0 → 100644
  1 +package com.bsth.controller.forecast.dto;
  2 +
  3 +import java.util.Set;
  4 +
  5 +public class CreateSampleParam {
  6 +
  7 + private String lineCode;
  8 +
  9 + private String startDate;
  10 +
  11 + private String endDate;
  12 +
  13 + private Integer updown;
  14 +
  15 + private Set<TimeRange> timeRange;
  16 +
  17 + public static class TimeRange{
  18 + private String s;
  19 + private String e;
  20 + private String tag;
  21 + public String getS() {
  22 + return s;
  23 + }
  24 + public void setS(String s) {
  25 + this.s = s;
  26 + }
  27 + public String getE() {
  28 + return e;
  29 + }
  30 + public void setE(String e) {
  31 + this.e = e;
  32 + }
  33 + public String getTag() {
  34 + return tag;
  35 + }
  36 + public void setTag(String tag) {
  37 + this.tag = tag;
  38 + }
  39 + }
  40 +
  41 + public String getLineCode() {
  42 + return lineCode;
  43 + }
  44 +
  45 + public void setLineCode(String lineCode) {
  46 + this.lineCode = lineCode;
  47 + }
  48 +
  49 + public String getStartDate() {
  50 + return startDate;
  51 + }
  52 +
  53 + public void setStartDate(String startDate) {
  54 + this.startDate = startDate;
  55 + }
  56 +
  57 + public String getEndDate() {
  58 + return endDate;
  59 + }
  60 +
  61 + public void setEndDate(String endDate) {
  62 + this.endDate = endDate;
  63 + }
  64 +
  65 + public Integer getUpdown() {
  66 + return updown;
  67 + }
  68 +
  69 + public void setUpdown(Integer updown) {
  70 + this.updown = updown;
  71 + }
  72 +
  73 + public Set<TimeRange> getTimeRange() {
  74 + return timeRange;
  75 + }
  76 +
  77 + public void setTimeRange(Set<TimeRange> timeRange) {
  78 + this.timeRange = timeRange;
  79 + }
  80 +}
... ...
src/main/java/com/bsth/controller/schedule/CarConfigInfoController.java
... ... @@ -51,4 +51,9 @@ public class CarConfigInfoController extends BaseController&lt;CarConfigInfo, Long&gt;
51 51 public List<Map<String, Object>> findCarConfigCars() {
52 52 return carConfigInfoRepository.findCarConfigCars();
53 53 }
  54 +
  55 + @RequestMapping(value = "/cars2", method = RequestMethod.GET)
  56 + public List<Map<String, Object>> findCarsFromConfig() {
  57 + return carConfigInfoRepository.findCarsFromConfig();
  58 + }
54 59 }
... ...
src/main/java/com/bsth/controller/schedule/EmployeeConfigInfoController.java
... ... @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
8 8 import org.springframework.boot.context.properties.EnableConfigurationProperties;
9 9 import org.springframework.web.bind.annotation.*;
10 10  
  11 +import java.util.List;
11 12 import java.util.Map;
12 13  
13 14 /**
... ... @@ -45,4 +46,14 @@ public class EmployeeConfigInfoController extends BaseController&lt;EmployeeConfigI
45 46 public Map<String, Object> save(@RequestBody EmployeeConfigInfo t){
46 47 return baseService.save(t);
47 48 }
  49 +
  50 + @RequestMapping(value = "/jsy", method = RequestMethod.GET)
  51 + public List<Map<String, Object>> findJsyFromConfig() {
  52 + return employeeConfigInfoRepository.findJsyFromConfig();
  53 + }
  54 +
  55 + @RequestMapping(value = "/spy", method = RequestMethod.GET)
  56 + public List<Map<String, Object>> findSpyFromConfig() {
  57 + return employeeConfigInfoRepository.findSpyFromConfig();
  58 + }
48 59 }
... ...
src/main/java/com/bsth/controller/schedule/SchedulePlanController.java
... ... @@ -4,10 +4,11 @@ import com.bsth.controller.BaseController;
4 4 import com.bsth.entity.schedule.SchedulePlan;
5 5 import com.bsth.service.schedule.SchedulePlanService;
6 6 import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.web.bind.annotation.*;
  7 +import org.springframework.web.bind.annotation.RequestBody;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestMethod;
  10 +import org.springframework.web.bind.annotation.RestController;
8 11  
9   -import java.util.Date;
10   -import java.util.List;
11 12 import java.util.Map;
12 13  
13 14 /**
... ... @@ -34,21 +35,18 @@ public class SchedulePlanController extends BaseController&lt;SchedulePlan, Long&gt; {
34 35 return baseService.save(t);
35 36 }
36 37  
37   - // TODO:
38   -// @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET)
39   -// public List<Map<String, Object>> findGroupInfo(
40   -// Integer xlid, Date scheduleDate) {
41   -//
42   -// }
43   -
44   - @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET)
45   - public List<Map<String, Object>> findGroupInfo(
46   - @PathVariable(value = "xlid") Integer xlid,
47   - @PathVariable(value = "date") Date scheduleDate) {
48   - return schedulePlanService.findGroupInfo(xlid, scheduleDate);
  38 + /**
  39 + * 获取明天的一歌排班计划。
  40 + * @return
  41 + * @throws Exception
  42 + */
  43 + @RequestMapping(value = "/tommorw", method = RequestMethod.GET)
  44 + public SchedulePlan getTommorwPlan() throws Exception {
  45 + try {
  46 + return schedulePlanService.findSchedulePlanTommorw();
  47 + } catch (Exception exp) {
  48 + throw new Exception(exp.getCause());
  49 + }
49 50 }
50 51  
51   -// public int updateGroupInfo
52   -
53   -
54 52 }
... ...
src/main/java/com/bsth/controller/schedule/SchedulePlanInfoController.java
1 1 package com.bsth.controller.schedule;
2 2  
  3 +import com.bsth.common.ResponseCode;
3 4 import com.bsth.controller.BaseController;
4 5 import com.bsth.entity.schedule.SchedulePlanInfo;
5   -import org.springframework.web.bind.annotation.RequestMapping;
6   -import org.springframework.web.bind.annotation.RestController;
  6 +import com.bsth.service.schedule.SchedulePlanInfoService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.*;
  9 +
  10 +import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
7 14  
8 15 /**
9 16 * Created by xu on 16/6/16.
... ... @@ -11,5 +18,30 @@ import org.springframework.web.bind.annotation.RestController;
11 18 @RestController
12 19 @RequestMapping("spic")
13 20 public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> {
  21 + @Autowired
  22 + private SchedulePlanInfoService schedulePlanInfoService;
  23 +
  24 + @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET)
  25 + public List<SchedulePlanInfoService.GroupInfo> findGroupInfo(
  26 + @PathVariable(value = "xlid") Integer xlid,
  27 + @PathVariable(value = "date") Date scheduleDate) {
  28 + return schedulePlanInfoService.findGroupInfo(xlid, scheduleDate);
  29 + }
  30 +
  31 + @RequestMapping(value = "/groupinfos/update", method = RequestMethod.POST)
  32 + public Map<String, Object> updateGroupInfo(@RequestBody SchedulePlanInfoService.GroupInfoUpdate groupInfoUpdate) {
  33 + Map<String, Object> resultMap = new HashMap<>();
  34 + try {
  35 + schedulePlanInfoService.updateGroupInfo(groupInfoUpdate);
  36 +
  37 + resultMap.put("status", ResponseCode.SUCCESS);
  38 + resultMap.put("msg", "更新成功");
  39 + } catch (Exception exp) {
  40 + exp.printStackTrace();
  41 + resultMap.put("status", ResponseCode.ERROR);
  42 + resultMap.put("msg", exp.getLocalizedMessage());
  43 + }
14 44  
  45 + return resultMap;
  46 + }
15 47 }
... ...
src/main/java/com/bsth/controller/sys/KaptchaController.java 0 → 100644
  1 +package com.bsth.controller.sys;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import javax.servlet.ServletException;
  6 +import javax.servlet.http.HttpServletRequest;
  7 +import javax.servlet.http.HttpServletResponse;
  8 +
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import com.google.code.kaptcha.servlet.KaptchaExtend;
  14 +
  15 +@RestController
  16 +public class KaptchaController extends KaptchaExtend{
  17 +
  18 + @RequestMapping(value = "/captcha.jpg", method = RequestMethod.GET)
  19 + public void captcha(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  20 + super.captcha(req, resp);
  21 + }
  22 +}
... ...
src/main/java/com/bsth/controller/sys/UserController.java
1 1 package com.bsth.controller.sys;
2 2  
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
3 6 import javax.servlet.http.HttpServletRequest;
4 7 import javax.servlet.http.HttpSession;
5 8  
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.apache.commons.net.util.Base64;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
6 13 import org.springframework.beans.factory.annotation.Autowired;
7 14 import org.springframework.security.authentication.BadCredentialsException;
8 15 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
9 16 import org.springframework.security.web.authentication.session.SessionAuthenticationException;
10 17 import org.springframework.web.bind.annotation.RequestMapping;
  18 +import org.springframework.web.bind.annotation.RequestMethod;
11 19 import org.springframework.web.bind.annotation.RequestParam;
12 20 import org.springframework.web.bind.annotation.RestController;
13 21  
  22 +import com.bsth.common.Constants;
  23 +import com.bsth.common.ResponseCode;
14 24 import com.bsth.controller.BaseController;
15 25 import com.bsth.entity.sys.SysUser;
16 26 import com.bsth.security.util.SecurityUtils;
... ... @@ -18,75 +28,158 @@ import com.bsth.service.sys.SysUserService;
18 28  
19 29 @RestController
20 30 @RequestMapping("user")
21   -public class UserController extends BaseController<SysUser, Integer>{
22   -
  31 +public class UserController extends BaseController<SysUser, Integer> {
  32 +
  33 + Logger logger = LoggerFactory.getLogger(this.getClass());
  34 +
23 35 @Autowired
24 36 SysUserService sysUserService;
25 37  
  38 + //需要验证码的账号
  39 + public static Map<String, Integer> captchaMap = new HashMap<>();
  40 +
  41 + @RequestMapping(value = "/login", method = RequestMethod.POST)
  42 + public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName,
  43 + @RequestParam String password) {
  44 + Map<String, Object> rs = new HashMap<>();
  45 + rs.put("status", ResponseCode.ERROR);
  46 + try {
  47 + HttpSession session = request.getSession();
  48 + rs.put("captcha", session.getAttribute("captcha"));
  49 +
  50 + if(captchaMap.get(userName) != null && captchaMap.get(userName) >= 3){
  51 + //校验验证码
  52 + String verCode = (String) session
  53 + .getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
  54 + String captcha = request.getParameter("captcha");
  55 +
  56 + if(StringUtils.isBlank(captcha)){
  57 + rs.put("msg", "请输入验证码");
  58 + return rs;
  59 + }
  60 +
  61 + if(!verCode.equals(captcha)){
  62 + rs.put("msg", "验证码有误,请刷新后重新输入");
  63 + return rs;
  64 + }
  65 + }
  66 +
  67 + SysUser user = sysUserService.findByUserName(userName);
  68 + if (null == user) {
  69 + rs.put("msg", "不存在的用户");
  70 + return rs;
  71 + }
  72 +
  73 + if (!user.isEnabled()) {
  74 + rs.put("msg", "该用户已被锁定,请联系管理员");
  75 + return rs;
  76 + }
  77 +
  78 + // 校验密码
  79 + password = fourDecodeBase64(password);
  80 + boolean matchStatus = new BCryptPasswordEncoder(4).matches(password, user.getPassword());
  81 + if (!matchStatus) {
  82 + rs.put("msg", "密码有误");
  83 +
  84 + Integer captchSize = captchaMap.get(userName);
  85 + if(null == captchSize)
  86 + captchSize = 0;
  87 +
  88 + captchSize ++;
  89 + captchaMap.put(userName, captchSize);
  90 + return rs;
  91 + }
  92 +
  93 + // 登录
  94 + SecurityUtils.login(user, request);
  95 + //session里写入用户名,webSocket连接时标识身份用
  96 + session.setAttribute(Constants.SESSION_USERNAME, user.getUserName());
  97 +
  98 + captchaMap.remove(userName);
  99 + rs.put("status", ResponseCode.SUCCESS);
  100 + } catch (Exception e) {
  101 + logger.error("", e);
  102 + rs.put("msg", "服务器出现异常,请联系管理员");
  103 + }
  104 + return rs;
  105 + }
  106 +
  107 + @RequestMapping(value = "/login/captchaStatus")
  108 + public int captchaStatus(String userName){
  109 + Integer size = captchaMap.get(userName);
  110 + return size == null?0:size;
  111 + }
  112 +
  113 + private String fourDecodeBase64(String t) {
  114 + return new String(Base64.decodeBase64(Base64.decodeBase64(Base64.decodeBase64(Base64.decodeBase64(t)))));
  115 + }
  116 +
26 117 /**
27 118 *
28   - * @Title: loginFailure
29   - * @Description: TODO(查询登录失败的详细信息)
30   - * @param @param request
31   - * @return String 返回类型
32   - * @throws
  119 + * @Title: loginFailure @Description: TODO(查询登录失败的详细信息) @param @param
  120 + * request @return String 返回类型 @throws
33 121 */
34 122 @RequestMapping("/loginFailure")
35   - public String loginFailure(HttpServletRequest request){
  123 + public String loginFailure(HttpServletRequest request) {
36 124 String msg = "";
37 125 HttpSession session = request.getSession();
38   -
  126 +
39 127 Object obj = session.getAttribute("SPRING_SECURITY_LAST_EXCEPTION");
40   -
41   - if(obj instanceof BadCredentialsException)
  128 +
  129 + if (obj instanceof BadCredentialsException)
42 130 msg = "登录失败,用户名或密码错误.";
43   - else if(obj instanceof SessionAuthenticationException)
  131 + else if (obj instanceof SessionAuthenticationException)
44 132 msg = "登录失败,当前策略不允许重复登录.";
45 133 session.removeAttribute("SPRING_SECURITY_LAST_EXCEPTION");
46 134 return msg;
47 135 }
48   -
  136 +
49 137 @RequestMapping("/currentUser")
50   - public SysUser currentUser(){
  138 + public SysUser currentUser() {
51 139 return SecurityUtils.getCurrentUser();
52 140 }
53   -
  141 +
54 142 /**
55 143 * @Title changeEnabled
56   - * @Description: TODO(改变用户状态)
57   - * @param id 用户ID
58   - * @param enabled 状态
  144 + * @Description: TODO(改变用户状态)
  145 + * @param id
  146 + * 用户ID
  147 + * @param enabled
  148 + * 状态
59 149 * @return
60 150 */
61 151 @RequestMapping("/changeEnabled")
62   - public int changeEnabled(@RequestParam int id,@RequestParam int enabled){
63   - return sysUserService.changeEnabled(id,enabled);
  152 + public int changeEnabled(@RequestParam int id, @RequestParam int enabled) {
  153 + return sysUserService.changeEnabled(id, enabled);
64 154 }
65   -
  155 +
66 156 /**
67 157 * @Title changePWD
68   - * @Description: TODO(修改密码)
69   - * @param oldPWD 原始密码
70   - * @param newwPWD 新密码
71   - * @param cnewPWD 确认新密码
  158 + * @Description: TODO(修改密码)
  159 + * @param oldPWD
  160 + * 原始密码
  161 + * @param newwPWD
  162 + * 新密码
  163 + * @param cnewPWD
  164 + * 确认新密码
72 165 * @return
73 166 */
74 167 @RequestMapping("/changePWD")
75   - public String changePWD(@RequestParam String oldPWD,@RequestParam String newPWD,@RequestParam String cnewPWD){
  168 + public String changePWD(@RequestParam String oldPWD, @RequestParam String newPWD, @RequestParam String cnewPWD) {
76 169 SysUser sysUser = SecurityUtils.getCurrentUser();
77 170 String msg = "";
78   - if(new BCryptPasswordEncoder(4).matches(oldPWD, sysUser.getPassword())){
79   - if(oldPWD.equals(newPWD)){
  171 + if (new BCryptPasswordEncoder(4).matches(oldPWD, sysUser.getPassword())) {
  172 + if (oldPWD.equals(newPWD)) {
80 173 msg = "新密码不能跟原始密码一样!";
81   - }else{
82   - if(newPWD.equals(cnewPWD)){
83   - sysUserService.changePWD(sysUser.getId(),newPWD);
  174 + } else {
  175 + if (newPWD.equals(cnewPWD)) {
  176 + sysUserService.changePWD(sysUser.getId(), newPWD);
84 177 msg = "修改成功!";
85   - }else{
86   - msg= "新密码两次输入不一致!";
  178 + } else {
  179 + msg = "新密码两次输入不一致!";
87 180 }
88 181 }
89   - }else{
  182 + } else {
90 183 msg = "原始密码错误!";
91 184 }
92 185 return msg;
... ...
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
... ... @@ -50,7 +50,7 @@ public class ArrivalData_GPS implements CommandLineRunner{
50 50  
51 51 @Override
52 52 public void run(String... arg0) throws Exception {
53   - Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 15, TimeUnit.SECONDS);
  53 + Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 30, 12, TimeUnit.SECONDS);
54 54 }
55 55  
56 56 @Component
... ...
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
... ... @@ -9,6 +9,7 @@ import java.util.Map;
9 9 import java.util.NavigableSet;
10 10 import java.util.concurrent.TimeUnit;
11 11  
  12 +import org.apache.commons.lang3.StringUtils;
12 13 import org.apache.http.HttpEntity;
13 14 import org.apache.http.client.methods.CloseableHttpResponse;
14 15 import org.apache.http.client.methods.HttpGet;
... ... @@ -146,9 +147,14 @@ public class GpsRealData implements CommandLineRunner{
146 147 if (jsonObj != null)
147 148 list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class);
148 149  
  150 + String nbbm;
149 151 //附加车辆内部编码
150 152 for(GpsEntity gps : list){
151   - gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId()));
  153 + nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
  154 + if(StringUtils.isBlank(nbbm))
  155 + continue;
  156 +
  157 + gps.setNbbm(nbbm);
152 158 gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo()));
153 159 add(gps);
154 160 }
... ...
src/main/java/com/bsth/filter/AccessLogFilter.java
... ... @@ -38,7 +38,7 @@ public class AccessLogFilter extends BaseFilter {
38 38 HttpServletResponse response, FilterChain chain)
39 39 throws IOException, ServletException {
40 40  
41   - String username = /*SecurityUtils.getCurrentUser().getName()*/"test"; //等集成shiro之后再取
  41 + String username = SecurityUtils.getCurrentUser().getName();
42 42 String jsessionId = request.getRequestedSessionId();
43 43 String ip = IpUtils.getIpAddr(request);
44 44 String userAgent = request.getHeader("User-Agent");
... ...
src/main/java/com/bsth/filter/BaseFilter.java
... ... @@ -23,7 +23,7 @@ public abstract class BaseFilter implements Filter {
23 23 /**
24 24 * 白名单
25 25 */
26   - private String[] whiteListURLs = { Constants.LOGIN_PAGE,
  26 + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA,
27 27 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_TEMPS };
28 28  
29 29 @Override
... ...
src/main/java/com/bsth/filter/XssFilter.java 0 → 100644
  1 +package com.bsth.filter;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import javax.servlet.FilterChain;
  6 +import javax.servlet.ServletException;
  7 +import javax.servlet.http.HttpServletRequest;
  8 +import javax.servlet.http.HttpServletResponse;
  9 +
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +@Component
  13 +public class XssFilter extends BaseFilter{
  14 +
  15 + @Override
  16 + public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
  17 + throws IOException, ServletException {
  18 +
  19 + chain.doFilter(new XssHttpServletRequestWrapper((HttpServletRequest) request), response);
  20 + }
  21 +}
... ...
src/main/java/com/bsth/filter/XssHttpServletRequestWrapper.java 0 → 100644
  1 +package com.bsth.filter;
  2 +
  3 +import javax.servlet.http.HttpServletRequest;
  4 +import javax.servlet.http.HttpServletRequestWrapper;
  5 +
  6 +import org.apache.commons.lang3.StringEscapeUtils;
  7 +
  8 +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
  9 + public XssHttpServletRequestWrapper(HttpServletRequest request) {
  10 + super(request);
  11 + }
  12 +
  13 + @Override
  14 + public String getHeader(String name) {
  15 + return StringEscapeUtils.escapeHtml4(super.getHeader(name));
  16 + }
  17 +
  18 + @Override
  19 + public String getQueryString() {
  20 + return StringEscapeUtils.escapeHtml4(super.getQueryString());
  21 + }
  22 +
  23 + @Override
  24 + public String getParameter(String name) {
  25 + return StringEscapeUtils.escapeHtml4(super.getParameter(name));
  26 + }
  27 +
  28 + @Override
  29 + public String[] getParameterValues(String name) {
  30 + String[] values = super.getParameterValues(name);
  31 + if (values != null) {
  32 + int length = values.length;
  33 + String[] escapseValues = new String[length];
  34 + for (int i = 0; i < length; i++) {
  35 + escapseValues[i] = StringEscapeUtils.escapeHtml4(values[i]);
  36 + }
  37 + return escapseValues;
  38 + }
  39 + return super.getParameterValues(name);
  40 + }
  41 +}
... ...
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
... ... @@ -42,4 +42,7 @@ public interface CarConfigInfoRepository extends BaseRepository&lt;CarConfigInfo, L
42 42  
43 43 @Query("select new map(cc.cl.insideCode as nbbm, cc.id as id) from CarConfigInfo cc")
44 44 List<Map<String, Object>> findCarConfigCars();
  45 +
  46 + @Query("select new map(cc.cl.id as id, cc.cl.insideCode as insideCode) from CarConfigInfo cc")
  47 + List<Map<String, Object>> findCarsFromConfig();
45 48 }
46 49 \ No newline at end of file
... ...
src/main/java/com/bsth/repository/schedule/EmployeeConfigInfoRepository.java
... ... @@ -5,6 +5,7 @@ import com.bsth.entity.schedule.EmployeeConfigInfo;
5 5 import com.bsth.repository.BaseRepository;
6 6  
7 7 import java.util.List;
  8 +import java.util.Map;
8 9  
9 10 import org.springframework.data.domain.Page;
10 11 import org.springframework.data.domain.Pageable;
... ... @@ -34,4 +35,18 @@ public interface EmployeeConfigInfoRepository extends BaseRepository&lt;EmployeeCon
34 35 @EntityGraph(value = "employeeConfigInfo_jsy_spy_xl", type = EntityGraph.EntityGraphType.FETCH)
35 36 @Query("select cc from EmployeeConfigInfo cc where cc.id=?1")
36 37 EmployeeConfigInfo findOneExtend(Long aLong);
  38 +
  39 + @Query("select new map(" +
  40 + "ec.jsy.id as jsyId, " +
  41 + "ec.jsy.jobCode as jsyGh, " +
  42 + "ec.jsy.personnelName as jsyName) " +
  43 + "from EmployeeConfigInfo ec ")
  44 + List<Map<String, Object>> findJsyFromConfig();
  45 +
  46 + @Query("select new map(" +
  47 + "ec.spy.id as spyId, " +
  48 + "ec.spy.jobCode as spyGh, " +
  49 + "ec.spy.personnelName as spyName) " +
  50 + "from EmployeeConfigInfo ec ")
  51 + List<Map<String, Object>> findSpyFromConfig();
37 52 }
... ...
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
... ... @@ -9,7 +9,9 @@ import java.util.List;
9 9 import org.springframework.data.domain.Page;
10 10 import org.springframework.data.domain.Pageable;
11 11 import org.springframework.data.jpa.domain.Specification;
  12 +import org.springframework.data.jpa.repository.Modifying;
12 13 import org.springframework.data.jpa.repository.Query;
  14 +import org.springframework.data.repository.query.Param;
13 15 import org.springframework.stereotype.Repository;
14 16  
15 17 /**
... ... @@ -23,4 +25,97 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
23 25  
24 26 Long deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(Integer xlid, Date startDate, Date endDate);
25 27  
  28 +
  29 + @Query(value = " select " +
  30 + "xl as xlId, " +
  31 + "xl_name as xlName, " +
  32 + "schedule_date as scheduleDate, " +
  33 + "lp_name as lpName, " +
  34 + "cl as clId, " +
  35 + "cl_zbh as clZbh, " +
  36 + "group_concat(distinct fcsj) ccsj, " +
  37 + "group_concat(distinct j) jsyId, " +
  38 + "group_concat(distinct j_gh) jsyGh, " +
  39 + "group_concat(distinct j_name) jsyName, " +
  40 + "group_concat(distinct s) spyId, " +
  41 + "group_concat(distinct s_gh) spyGh, " +
  42 + "group_concat(distinct s_name) spyName, " +
  43 + "max(create_date) as createDate " +
  44 + "from bsth_c_s_sp_info " +
  45 + "where bc_type = 'out' and " +
  46 + "xl = ?1 and " +
  47 + "schedule_date = ?2 " +
  48 + "group by xl_name, schedule_date, lp_name " +
  49 + "order by xl_name, schedule_date, lp ", nativeQuery = true)
  50 + List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate);
  51 +
  52 + @Modifying
  53 + @Query(value = "update " +
  54 + "SchedulePlanInfo scpinfo " +
  55 + "set scpinfo.cl = :p1, scpinfo.clZbh = :p2 " +
  56 + "where scpinfo.xl = :p3 and " +
  57 + "scpinfo.scheduleDate = :p4 and " +
  58 + "scpinfo.lpName = :p5 ")
  59 + int updateGroupInfo_type_1(
  60 + @Param("p1") Integer clid,
  61 + @Param("p2") String clZbh,
  62 + @Param("p3") Integer xlid,
  63 + @Param("p4") Date scheduleDate,
  64 + @Param("p5") String lpName);
  65 +
  66 + @Modifying
  67 + @Query(value = "update " +
  68 + "SchedulePlanInfo scpinfo " +
  69 + "set scpinfo.fcsj = :p1 " +
  70 + "where scpinfo.xl = :p2 and " +
  71 + "scpinfo.scheduleDate = :p3 and " +
  72 + "scpinfo.lpName = :p4 and " +
  73 + "scpinfo.fcsj = :p5 and " +
  74 + "scpinfo.bcType = :p6 ")
  75 + int updateGroupInfo_type_2_4(
  76 + @Param("p1") String fcsj,
  77 + @Param("p2") Integer xlid,
  78 + @Param("p3") Date scheduleDate,
  79 + @Param("p4") String lpName,
  80 + @Param("p5") String fcsj_src,
  81 + @Param("p6") String bcType);
  82 +
  83 + @Modifying
  84 + @Query(value = "update " +
  85 + "SchedulePlanInfo scpinfo " +
  86 + "set scpinfo.j = :p1, " +
  87 + "scpinfo.jGh = :p2, " +
  88 + "scpinfo.jName = :p3 " +
  89 + "where scpinfo.xl = :p4 and " +
  90 + "scpinfo.scheduleDate = :p5 and " +
  91 + "scpinfo.lpName = :p6 and " +
  92 + "scpinfo.j = :p7 ")
  93 + int updateGroupInfo_type_3_5_jsy(
  94 + @Param("p1") Integer jsyId,
  95 + @Param("p2") String jsyGh,
  96 + @Param("p3") String jsyName,
  97 + @Param("p4") Integer xlId,
  98 + @Param("p5") Date scheduleDate,
  99 + @Param("p6") String lpName,
  100 + @Param("p7") Integer jsyId_src);
  101 +
  102 + @Modifying
  103 + @Query(value = "update " +
  104 + "SchedulePlanInfo scpinfo " +
  105 + "set scpinfo.s = :p1, " +
  106 + "scpinfo.sGh = :p2, " +
  107 + "scpinfo.sName = :p3 " +
  108 + "where scpinfo.xl = :p4 and " +
  109 + "scpinfo.scheduleDate = :p5 and " +
  110 + "scpinfo.lpName = :p6 and " +
  111 + "scpinfo.s = :p7 ")
  112 + int updateGroupInfo_type_3_5_spy(
  113 + @Param("p1") Integer spyId,
  114 + @Param("p2") String spyGh,
  115 + @Param("p3") String spyName,
  116 + @Param("p4") Integer xlId,
  117 + @Param("p5") Date scheduleDate,
  118 + @Param("p6") String lpName,
  119 + @Param("p7") Integer spyId_src);
  120 +
26 121 }
... ...
src/main/java/com/bsth/repository/schedule/SchedulePlanRepository.java
... ... @@ -6,15 +6,8 @@ import org.springframework.data.domain.Page;
6 6 import org.springframework.data.domain.Pageable;
7 7 import org.springframework.data.jpa.domain.Specification;
8 8 import org.springframework.data.jpa.repository.EntityGraph;
9   -import org.springframework.data.jpa.repository.Query;
10   -import org.springframework.data.repository.query.Param;
11 9 import org.springframework.stereotype.Repository;
12 10  
13   -import javax.persistence.SqlResultSetMapping;
14   -import java.util.Date;
15   -import java.util.List;
16   -import java.util.Map;
17   -
18 11 /**
19 12 * Created by xu on 16/6/16.
20 13 */
... ... @@ -24,37 +17,4 @@ public interface SchedulePlanRepository extends BaseRepository&lt;SchedulePlan, Lon
24 17 @Override
25 18 Page<SchedulePlan> findAll(Specification<SchedulePlan> spec, Pageable pageable);
26 19  
27   - @Query(value = " select " +
28   - "xl_name as xlName, " +
29   - "schedule_date as scheduleDate, " +
30   - "lp_name as lpName, " +
31   - "cl_zbh as clZbh, " +
32   - "group_concat(distinct fcsj) ccsj, " +
33   - "group_concat(distinct j_gh) jsyGh, " +
34   - "group_concat(distinct j_name) jsyName, " +
35   - "group_concat(distinct s_gh) spyGh, " +
36   - "group_concat(distinct s_name) spyName, " +
37   - "max(create_date) as createDate " +
38   - "from bsth_c_s_sp_info " +
39   - "where bc_type = 'out' and " +
40   - "xl = ?1 and " +
41   - "schedule_date = ?2 " +
42   - "group by xl_name, schedule_date, lp_name " +
43   - "order by xl_name, schedule_date, lp ", nativeQuery = true)
44   - List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate);
45   -
46   - @Query(value = "update " +
47   - "bsth_c_s_sp_info " +
48   - "set cl = :p1, cl_zbh = :p2 " +
49   - "where xl = :p3 and " +
50   - "schedule_date = :p4 and " +
51   - "lp_name = :p5 ",
52   - nativeQuery = true)
53   - int updateGroupInfo_clinfo(
54   - @Param("p1") Integer clid,
55   - @Param("p2") String clZbh,
56   - @Param("p3") Integer xlid,
57   - @Param("p4") Date scheduleDate,
58   - @Param("p5") String lpName);
59   -
60 20 }
... ...
src/main/java/com/bsth/security/WebSecurityConfig.java
... ... @@ -14,13 +14,11 @@ import org.springframework.security.core.session.SessionRegistryImpl;
14 14 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
15 15 import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
16 16 import org.springframework.security.web.authentication.logout.LogoutHandler;
17   -import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
18 17 import org.springframework.security.web.session.HttpSessionEventPublisher;
19 18  
20 19 import com.bsth.common.Constants;
21 20 import com.bsth.security.filter.LoginInterceptor;
22 21 import com.bsth.security.handler.CustomLogoutHandler;
23   -import com.bsth.security.handler.LoginSuccessHandler;
24 22  
25 23 @Configuration
26 24 @EnableWebSecurity
... ... @@ -39,7 +37,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
39 37 @Override
40 38 public void configure(WebSecurity web) throws Exception {
41 39 // 白名单
42   - web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.ASSETS_URL, Constants.FAVICON_URL,
  40 + web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
43 41 Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_TEMPS);
44 42 }
45 43  
... ... @@ -58,11 +56,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
58 56 //指定登录页
59 57 .loginPage(Constants.LOGIN_PAGE)
60 58 .loginProcessingUrl(Constants.LOGIN).permitAll()
61   - //登录失败跳转的链接
62   - .failureUrl(Constants.LOGIN_PAGE + "?error=true")
63   - //登录成功后处理
64   - .successHandler(loginSuccessHandler())
65   - //登出
  59 + //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接
  60 + //.successHandler(loginSuccessHandler())登录成功后处理
66 61 .and().logout()
67 62 .addLogoutHandler(logoutHandler())
68 63 //禁用CXRF
... ... @@ -92,10 +87,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
92 87 return filterSecurityInterceptor;
93 88 }
94 89  
95   - @Bean
  90 +/* @Bean
96 91 public LoginSuccessHandler loginSuccessHandler(){
97 92 return new LoginSuccessHandler();
98   - }
  93 + }*/
99 94  
100 95 @Bean
101 96 public LogoutHandler logoutHandler(){
... ...
src/main/java/com/bsth/security/handler/LoginSuccessHandler.java
1   -package com.bsth.security.handler;
2   -
3   -import java.io.IOException;
4   -import java.util.Date;
5   -
6   -import javax.servlet.ServletException;
7   -import javax.servlet.http.HttpServletRequest;
8   -import javax.servlet.http.HttpServletResponse;
9   -
10   -import org.springframework.security.core.Authentication;
11   -import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
12   -
13   -import com.bsth.common.Constants;
14   -import com.bsth.entity.sys.SessionLog;
15   -import com.bsth.entity.sys.SysUser;
16   -import com.bsth.util.IpUtils;
17   -
18   -public class LoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler{
19   -
20   - @Override
21   - public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
22   - Authentication authentication) throws ServletException, IOException {
23   -
24   - SysUser user = (SysUser) authentication.getPrincipal();
25   -
26   - //日志
27   - SessionLog sLog = new SessionLog();
28   - sLog.setLoginDate(new Date());
29   - sLog.setUser(user);
30   - sLog.setIp(IpUtils.getIpAddr(request));
31   -
32   - //session里写入用户名
33   - request.getSession().setAttribute(Constants.SESSION_USERNAME, user.getUserName());
34   - super.onAuthenticationSuccess(request, response, authentication);
35   - }
36   -
37   -}
  1 +//package com.bsth.security.handler;
  2 +//
  3 +//import java.io.IOException;
  4 +//import java.util.Date;
  5 +//
  6 +//import javax.servlet.ServletException;
  7 +//import javax.servlet.http.HttpServletRequest;
  8 +//import javax.servlet.http.HttpServletResponse;
  9 +//
  10 +//import org.springframework.security.core.Authentication;
  11 +//import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
  12 +//
  13 +//import com.bsth.common.Constants;
  14 +//import com.bsth.entity.sys.SessionLog;
  15 +//import com.bsth.entity.sys.SysUser;
  16 +//import com.bsth.util.IpUtils;
  17 +//
  18 +//public class LoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler{
  19 +//
  20 +// @Override
  21 +// public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
  22 +// Authentication authentication) throws ServletException, IOException {
  23 +//
  24 +// SysUser user = (SysUser) authentication.getPrincipal();
  25 +//
  26 +// //日志
  27 +// SessionLog sLog = new SessionLog();
  28 +// sLog.setLoginDate(new Date());
  29 +// sLog.setUser(user);
  30 +// sLog.setIp(IpUtils.getIpAddr(request));
  31 +//
  32 +// //session里写入用户名
  33 +// request.getSession().setAttribute(Constants.SESSION_USERNAME, user.getUserName());
  34 +// super.onAuthenticationSuccess(request, response, authentication);
  35 +// }
  36 +//
  37 +//}
... ...
src/main/java/com/bsth/security/util/SecurityUtils.java
1 1 package com.bsth.security.util;
2 2  
  3 +import javax.servlet.http.HttpServletRequest;
  4 +
3 5 import org.slf4j.Logger;
4 6 import org.slf4j.LoggerFactory;
  7 +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
  8 +import org.springframework.security.core.context.SecurityContext;
5 9 import org.springframework.security.core.context.SecurityContextHolder;
6 10  
  11 +import com.bsth.entity.sys.SecurityUser;
7 12 import com.bsth.entity.sys.SysUser;
8 13  
9 14 /**
... ... @@ -33,4 +38,12 @@ public class SecurityUtils {
33 38 }
34 39 return user;
35 40 }
  41 +
  42 + public static void login(SysUser user, HttpServletRequest request){
  43 + SecurityUser securityUser = new SecurityUser(user);
  44 + SecurityContext sContext = SecurityContextHolder.getContext();
  45 + sContext.setAuthentication(
  46 + new UsernamePasswordAuthenticationToken(securityUser, securityUser.getAuthorities()));
  47 + request.getSession(true).setAttribute("SPRING_SECURITY_CONTEXT", sContext);
  48 + }
36 49 }
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
... ... @@ -579,12 +579,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
579 579 File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName);
580 580  
581 581 /*File[] sources = new File[] {textFile};*/
582   - File[] sources = new File[] {textFile};
  582 + //File[] sources = new File[] {textFile};
583 583  
584 584 File target = new File(odlGzFileName);
585 585  
586 586 // 将txt文件打包
587   - File targetFile = packTarGZUtils.pack(sources, target);
  587 + File targetFile = PackTarGZUtils.compress(textFile, target);
588 588  
589 589 /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/
590 590  
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
... ... @@ -2,9 +2,387 @@ package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4 4 import com.bsth.service.BaseService;
  5 +import org.joda.time.DateTime;
  6 +
  7 +import java.util.Date;
  8 +import java.util.List;
5 9  
6 10 /**
7 11 * Created by xu on 16/6/16.
8 12 */
9 13 public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, Long> {
  14 + /**
  15 + * 查找分组排班信息。
  16 + * @param xlid 线路Id
  17 + * @param scheduleDate 排班日期
  18 + * @return
  19 + */
  20 + List<GroupInfo> findGroupInfo(Integer xlid, Date scheduleDate);
  21 +
  22 + /**
  23 + * 更新分组信息。
  24 + * type=1,替换车辆
  25 + * type=2,修改出场班次1时间(首班车时间)
  26 + * type=3,替换分组人员(驾驶员1和售票员1)
  27 + * type=4,如果分班,修改出场班次2时间(分班后的第一个出场班次时间)
  28 + * type=5,如果分班,修改分组人员(驾驶员2和售票员2)
  29 + * @param groupInfoUpdate 分组更新信息,包含类型,更新前的信息,更新后的信息
  30 + * @return
  31 + */
  32 + int updateGroupInfo(GroupInfoUpdate groupInfoUpdate);
  33 +
  34 + /**
  35 + * 分组更新信息。
  36 + */
  37 + static class GroupInfoUpdate {
  38 + /** 类型 */
  39 + private int type;
  40 + /** 原始分组值 */
  41 + private GroupInfo src;
  42 + /** 更新分组值 */
  43 + private GroupInfo update;
  44 +
  45 + public int getType() {
  46 + return type;
  47 + }
  48 +
  49 + public void setType(int type) {
  50 + this.type = type;
  51 + }
  52 +
  53 + public GroupInfo getSrc() {
  54 + return src;
  55 + }
  56 +
  57 + public void setSrc(GroupInfo src) {
  58 + this.src = src;
  59 + }
  60 +
  61 + public GroupInfo getUpdate() {
  62 + return update;
  63 + }
  64 +
  65 + public void setUpdate(GroupInfo update) {
  66 + this.update = update;
  67 + }
  68 + }
  69 +
  70 + /**
  71 + * 分组信息。
  72 + */
  73 + static class GroupInfo {
  74 + /** 线路Id */
  75 + private Integer xlId;
  76 + /** 线路名称 */
  77 + private String xlName;
  78 + /** 排班时间 */
  79 + private Date scheduleDate;
  80 + /** 路牌名字 */
  81 + private String lpName;
  82 + /** 车辆Id */
  83 + private Integer clId;
  84 + /** 车辆自编号 */
  85 + private String clZbh;
  86 + /** 出场班次1时间 */
  87 + private String ccsj1;
  88 + /** 出场班次2时间 */
  89 + private String ccsj2;
  90 +
  91 + /** 驾驶员1id */
  92 + private Integer jsy1Id;
  93 + /** 驾驶员1工号 */
  94 + private String jsy1Gh;
  95 + /** 驾驶员1姓名 */
  96 + private String jsy1Name;
  97 + /** 驾驶员1id */
  98 + private Integer jsy2Id;
  99 + /** 驾驶员1工号 */
  100 + private String jsy2Gh;
  101 + /** 驾驶员1姓名 */
  102 + private String jsy2Name;
  103 +
  104 + /** 售票员1id */
  105 + private Integer spy1Id;
  106 + /** 售票员1工号 */
  107 + private String spy1Gh;
  108 + /** 售票员1姓名 */
  109 + private String spy1Name;
  110 + /** 售票员1id */
  111 + private Integer spy2Id;
  112 + /** 售票员1工号 */
  113 + private String spy2Gh;
  114 + /** 售票员1姓名 */
  115 + private String spy2Name;
  116 +
  117 + /** 创建时间 */
  118 + private Date createDate;
  119 +
  120 + public GroupInfo() {}
  121 +
  122 + public GroupInfo(Object[] datas) {
  123 + // 线路Id
  124 + this.xlId = Integer.valueOf(String.valueOf(datas[0]));
  125 + // 线路名称
  126 + this.xlName = String.valueOf(datas[1]);
  127 + // 排班时间
  128 + this.scheduleDate = new DateTime(datas[2]).toDate();
  129 + // 路牌名字
  130 + this.lpName = String.valueOf(datas[3]);
  131 + // 车辆id
  132 + this.clId = Integer.valueOf(String.valueOf(datas[4]));
  133 + // 车辆自编号
  134 + this.clZbh = String.valueOf(datas[5]);
  135 + // 出场时间,如果有多个,需要分开
  136 + Object ccsj = datas[6];
  137 + if (ccsj != null) {
  138 + String[] ccsj_array = ((String) ccsj).split(",");
  139 + if (ccsj_array.length > 1) {
  140 + this.ccsj1 = String.valueOf(ccsj_array[0]);
  141 + this.ccsj2 = String.valueOf(ccsj_array[1]);
  142 + } else {
  143 + this.ccsj1 = String.valueOf(ccsj_array[0]);
  144 + }
  145 + }
  146 + // 驾驶员id,如果有多个,需要分开
  147 + Object jsyId = datas[7];
  148 + if (jsyId != null) {
  149 + String[] jsyId_array = ((String) jsyId).split(",");
  150 + if (jsyId_array.length > 1) {
  151 + this.jsy1Id = Integer.valueOf(String.valueOf(jsyId_array[0]));
  152 + this.jsy2Id = Integer.valueOf(String.valueOf(jsyId_array[1]));
  153 + } else {
  154 + this.jsy1Id = Integer.valueOf(String.valueOf(jsyId_array[0]));
  155 + }
  156 + }
  157 + // 驾驶员工号,如果有多个,需要分开
  158 + Object jsyGh = datas[8];
  159 + if (jsyGh != null) {
  160 + String[] jsyGh_array = ((String) jsyGh).split(",");
  161 + if (jsyGh_array.length > 1) {
  162 + this.jsy1Gh = String.valueOf(jsyGh_array[0]);
  163 + this.jsy2Gh = String.valueOf(jsyGh_array[1]);
  164 + } else {
  165 + this.jsy1Gh = String.valueOf(jsyGh_array[0]);
  166 + }
  167 + }
  168 + // 驾驶员名字,如果有多个,需要分开
  169 + Object jsyName = datas[9];
  170 + if (jsyName != null) {
  171 + String[] jsyName_array = ((String) jsyName).split(",");
  172 + if (jsyName_array.length > 1) {
  173 + this.jsy1Name = String.valueOf(jsyName_array[0]);
  174 + this.jsy2Name = String.valueOf(jsyName_array[1]);
  175 + } else {
  176 + this.jsy1Name = String.valueOf(jsyName_array[0]);
  177 + }
  178 + }
  179 +
  180 + // 售票员id,如果有多个,需要分开
  181 + Object spyId = datas[10];
  182 + if (spyId != null) {
  183 + String[] spyId_array = ((String) spyId).split(",");
  184 + if (spyId_array.length > 1) {
  185 + this.spy1Id = Integer.valueOf(String.valueOf(spyId_array[0]));
  186 + this.spy2Id = Integer.valueOf(String.valueOf(spyId_array[1]));
  187 + } else {
  188 + this.spy1Id = Integer.valueOf(String.valueOf(spyId_array[0]));
  189 + }
  190 + }
  191 +
  192 + // 售票员工号,如果有多个,需要分开
  193 + Object spyGh = datas[11];
  194 + if (spyGh != null) {
  195 + String[] spyGh_array = ((String) spyGh).split(",");
  196 + if (spyGh_array.length > 1) {
  197 + this.spy1Gh = String.valueOf(spyGh_array[0]);
  198 + this.spy2Gh = String.valueOf(spyGh_array[1]);
  199 + } else {
  200 + this.spy1Gh = String.valueOf(spyGh_array[0]);
  201 + }
  202 + }
  203 + // 售票员名字,如果有多个,需要分开
  204 + Object spyName = datas[12];
  205 + if (spyName != null) {
  206 + String[] spyName_array = ((String) spyName).split(",");
  207 + if (spyName_array.length > 1) {
  208 + this.spy1Name = String.valueOf(spyName_array[0]);
  209 + this.spy2Name = String.valueOf(spyName_array[1]);
  210 + } else {
  211 + this.spy1Name = String.valueOf(spyName_array[0]);
  212 + }
  213 + }
  214 + // 创建时间
  215 + this.createDate = new DateTime(datas[13]).toDate();
  216 +
  217 + // TODO:可能还有其他字段
  218 + }
  219 +
  220 + public String getXlName() {
  221 + return xlName;
  222 + }
  223 +
  224 + public void setXlName(String xlName) {
  225 + this.xlName = xlName;
  226 + }
  227 +
  228 + public Date getScheduleDate() {
  229 + return scheduleDate;
  230 + }
  231 +
  232 + public void setScheduleDate(Date scheduleDate) {
  233 + this.scheduleDate = scheduleDate;
  234 + }
  235 +
  236 + public String getLpName() {
  237 + return lpName;
  238 + }
  239 +
  240 + public void setLpName(String lpName) {
  241 + this.lpName = lpName;
  242 + }
  243 +
  244 + public Integer getClId() {
  245 + return clId;
  246 + }
  247 +
  248 + public void setClId(Integer clId) {
  249 + this.clId = clId;
  250 + }
  251 +
  252 + public String getClZbh() {
  253 + return clZbh;
  254 + }
  255 +
  256 + public void setClZbh(String clZbh) {
  257 + this.clZbh = clZbh;
  258 + }
  259 +
  260 + public String getCcsj1() {
  261 + return ccsj1;
  262 + }
  263 +
  264 + public void setCcsj1(String ccsj1) {
  265 + this.ccsj1 = ccsj1;
  266 + }
  267 +
  268 + public String getCcsj2() {
  269 + return ccsj2;
  270 + }
  271 +
  272 + public void setCcsj2(String ccsj2) {
  273 + this.ccsj2 = ccsj2;
  274 + }
  275 +
  276 + public Integer getJsy1Id() {
  277 + return jsy1Id;
  278 + }
  279 +
  280 + public void setJsy1Id(Integer jsy1Id) {
  281 + this.jsy1Id = jsy1Id;
  282 + }
  283 +
  284 + public String getJsy1Gh() {
  285 + return jsy1Gh;
  286 + }
  287 +
  288 + public void setJsy1Gh(String jsy1Gh) {
  289 + this.jsy1Gh = jsy1Gh;
  290 + }
  291 +
  292 + public String getJsy1Name() {
  293 + return jsy1Name;
  294 + }
  295 +
  296 + public void setJsy1Name(String jsy1Name) {
  297 + this.jsy1Name = jsy1Name;
  298 + }
  299 +
  300 + public Integer getJsy2Id() {
  301 + return jsy2Id;
  302 + }
  303 +
  304 + public void setJsy2Id(Integer jsy2Id) {
  305 + this.jsy2Id = jsy2Id;
  306 + }
  307 +
  308 + public String getJsy2Gh() {
  309 + return jsy2Gh;
  310 + }
  311 +
  312 + public void setJsy2Gh(String jsy2Gh) {
  313 + this.jsy2Gh = jsy2Gh;
  314 + }
  315 +
  316 + public String getJsy2Name() {
  317 + return jsy2Name;
  318 + }
  319 +
  320 + public void setJsy2Name(String jsy2Name) {
  321 + this.jsy2Name = jsy2Name;
  322 + }
  323 +
  324 + public Integer getSpy1Id() {
  325 + return spy1Id;
  326 + }
  327 +
  328 + public void setSpy1Id(Integer spy1Id) {
  329 + this.spy1Id = spy1Id;
  330 + }
  331 +
  332 + public String getSpy1Gh() {
  333 + return spy1Gh;
  334 + }
  335 +
  336 + public void setSpy1Gh(String spy1Gh) {
  337 + this.spy1Gh = spy1Gh;
  338 + }
  339 +
  340 + public String getSpy1Name() {
  341 + return spy1Name;
  342 + }
  343 +
  344 + public void setSpy1Name(String spy1Name) {
  345 + this.spy1Name = spy1Name;
  346 + }
  347 +
  348 + public Integer getSpy2Id() {
  349 + return spy2Id;
  350 + }
  351 +
  352 + public void setSpy2Id(Integer spy2Id) {
  353 + this.spy2Id = spy2Id;
  354 + }
  355 +
  356 + public String getSpy2Gh() {
  357 + return spy2Gh;
  358 + }
  359 +
  360 + public void setSpy2Gh(String spy2Gh) {
  361 + this.spy2Gh = spy2Gh;
  362 + }
  363 +
  364 + public String getSpy2Name() {
  365 + return spy2Name;
  366 + }
  367 +
  368 + public void setSpy2Name(String spy2Name) {
  369 + this.spy2Name = spy2Name;
  370 + }
  371 +
  372 + public Date getCreateDate() {
  373 + return createDate;
  374 + }
  375 +
  376 + public void setCreateDate(Date createDate) {
  377 + this.createDate = createDate;
  378 + }
  379 +
  380 + public Integer getXlId() {
  381 + return xlId;
  382 + }
  383 +
  384 + public void setXlId(Integer xlId) {
  385 + this.xlId = xlId;
  386 + }
  387 + }
10 388 }
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanInfoServiceImpl.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +import com.bsth.repository.schedule.SchedulePlanInfoRepository;
4 5 import com.bsth.service.impl.BaseServiceImpl;
  6 +import org.springframework.beans.factory.annotation.Autowired;
5 7 import org.springframework.stereotype.Service;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import java.util.ArrayList;
  11 +import java.util.Date;
  12 +import java.util.List;
6 13  
7 14 /**
8 15 * Created by xu on 16/6/16.
9 16 */
10 17 @Service
11 18 public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInfo, Long> implements SchedulePlanInfoService {
  19 + @Autowired
  20 + private SchedulePlanInfoRepository schedulePlanInfoRepository;
  21 +
  22 + @Override
  23 + public List<GroupInfo> findGroupInfo(Integer xlid, Date scheduleDate) {
  24 + List<Object[]> groupInfos = schedulePlanInfoRepository.findGroupInfo(xlid, scheduleDate);
  25 + List<GroupInfo> groupInfoList = new ArrayList<>();
  26 + for (Object[] groupInfo : groupInfos) {
  27 + groupInfoList.add(new GroupInfo(groupInfo));
  28 + }
  29 + return groupInfoList;
  30 + }
  31 +
  32 + @Override
  33 + @Transactional
  34 + public int updateGroupInfo(GroupInfoUpdate groupInfoUpdate) {
  35 + int type = groupInfoUpdate.getType();
  36 + int result;
  37 + if (type == 1) {
  38 + // 换车
  39 + if (groupInfoUpdate.getUpdate().getClId() != groupInfoUpdate.getSrc().getClId()) {
  40 + result = this.schedulePlanInfoRepository.updateGroupInfo_type_1(
  41 + groupInfoUpdate.getUpdate().getClId(),
  42 + groupInfoUpdate.getUpdate().getClZbh(),
  43 + groupInfoUpdate.getSrc().getXlId(),
  44 + groupInfoUpdate.getSrc().getScheduleDate(),
  45 + groupInfoUpdate.getSrc().getLpName()
  46 + );
  47 + }
  48 +
  49 + } else if (type == 2) {
  50 + // 更改出场班次1的时间
  51 + if (!groupInfoUpdate.getUpdate().getCcsj1().equals(groupInfoUpdate.getSrc().getCcsj1())) {
  52 + result = this.schedulePlanInfoRepository.updateGroupInfo_type_2_4(
  53 + groupInfoUpdate.getUpdate().getCcsj1(),
  54 + groupInfoUpdate.getSrc().getXlId(),
  55 + groupInfoUpdate.getUpdate().getScheduleDate(),
  56 + groupInfoUpdate.getSrc().getLpName(),
  57 + groupInfoUpdate.getSrc().getCcsj1(),
  58 + "out"
  59 + );
  60 + }
  61 +
  62 + } else if (type == 3) {
  63 + // 更改驾驶员1
  64 + if (groupInfoUpdate.getUpdate().getJsy1Id() != groupInfoUpdate.getSrc().getJsy1Id()) {
  65 + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_jsy(
  66 + groupInfoUpdate.getUpdate().getJsy1Id(),
  67 + groupInfoUpdate.getUpdate().getJsy1Gh(),
  68 + groupInfoUpdate.getUpdate().getJsy1Name(),
  69 + groupInfoUpdate.getSrc().getXlId(),
  70 + groupInfoUpdate.getSrc().getScheduleDate(),
  71 + groupInfoUpdate.getSrc().getLpName(),
  72 + groupInfoUpdate.getSrc().getJsy1Id()
  73 + );
  74 + }
  75 + // 更改售票员1
  76 + if (groupInfoUpdate.getUpdate().getSpy1Id() != groupInfoUpdate.getSrc().getSpy1Id()) {
  77 + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_spy(
  78 + groupInfoUpdate.getUpdate().getSpy1Id(),
  79 + groupInfoUpdate.getUpdate().getSpy1Gh(),
  80 + groupInfoUpdate.getUpdate().getSpy1Name(),
  81 + groupInfoUpdate.getSrc().getXlId(),
  82 + groupInfoUpdate.getSrc().getScheduleDate(),
  83 + groupInfoUpdate.getSrc().getLpName(),
  84 + groupInfoUpdate.getSrc().getSpy1Id()
  85 + );
  86 + }
  87 +
  88 + } else if (type == 4) {
  89 + // 更改出场班次2的时间
  90 + if (!groupInfoUpdate.getUpdate().getCcsj2().equals(groupInfoUpdate.getSrc().getCcsj2())) {
  91 + result = this.schedulePlanInfoRepository.updateGroupInfo_type_2_4(
  92 + groupInfoUpdate.getUpdate().getCcsj2(),
  93 + groupInfoUpdate.getSrc().getXlId(),
  94 + groupInfoUpdate.getUpdate().getScheduleDate(),
  95 + groupInfoUpdate.getSrc().getLpName(),
  96 + groupInfoUpdate.getSrc().getCcsj2(),
  97 + "out"
  98 + );
  99 + }
  100 +
  101 + } else if (type == 5) {
  102 + // 更改驾驶员2
  103 + if (groupInfoUpdate.getUpdate().getJsy2Id() != groupInfoUpdate.getSrc().getJsy2Id()) {
  104 + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_jsy(
  105 + groupInfoUpdate.getUpdate().getJsy2Id(),
  106 + groupInfoUpdate.getUpdate().getJsy2Gh(),
  107 + groupInfoUpdate.getUpdate().getJsy2Name(),
  108 + groupInfoUpdate.getSrc().getXlId(),
  109 + groupInfoUpdate.getSrc().getScheduleDate(),
  110 + groupInfoUpdate.getSrc().getLpName(),
  111 + groupInfoUpdate.getSrc().getJsy2Id()
  112 + );
  113 + }
  114 + // 更改售票员2
  115 + if (groupInfoUpdate.getUpdate().getSpy2Id() != groupInfoUpdate.getSrc().getSpy2Id()) {
  116 + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_spy(
  117 + groupInfoUpdate.getUpdate().getSpy2Id(),
  118 + groupInfoUpdate.getUpdate().getSpy2Gh(),
  119 + groupInfoUpdate.getUpdate().getSpy2Name(),
  120 + groupInfoUpdate.getSrc().getXlId(),
  121 + groupInfoUpdate.getSrc().getScheduleDate(),
  122 + groupInfoUpdate.getSrc().getLpName(),
  123 + groupInfoUpdate.getSrc().getSpy2Id()
  124 + );
  125 + }
  126 +
  127 + } else {
  128 + throw new RuntimeException("未知的更新类型,type=" + type);
  129 + }
  130 +
  131 + return 0;
  132 + }
12 133 }
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
... ... @@ -3,31 +3,13 @@ package com.bsth.service.schedule;
3 3 import com.bsth.entity.schedule.SchedulePlan;
4 4 import com.bsth.service.BaseService;
5 5  
6   -import java.util.Date;
7   -import java.util.List;
8   -import java.util.Map;
9   -
10 6 /**
11 7 * Created by xu on 16/6/16.
12 8 */
13 9 public interface SchedulePlanService extends BaseService<SchedulePlan, Long> {
14   -
15   - /**
16   - * 查找分组排班信息。
17   - * @param xlid 线路Id
18   - * @param scheduleDate 排班日期
19   - * @return
20   - */
21   - List<Map<String, Object>> findGroupInfo(Integer xlid, Date scheduleDate);
22   -
23 10 /**
24   - * 更新分组排班信息。
25   - * @param clid 车辆id
26   - * @param clZbh 车辆自编号
27   - * @param xlid 线路id
28   - * @param scheduleDate 排班日期
29   - * @param lpName 路牌名字
  11 + * 获取有明日排班的计划。
30 12 * @return
31 13 */
32   - int updateGroupInfo_clinfo(Integer clid, String clZbh, Integer xlid, Date scheduleDate, String lpName);
  14 + SchedulePlan findSchedulePlanTommorw();
33 15 }
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java
... ... @@ -12,6 +12,7 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
12 12 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
13 13 import com.bsth.service.schedule.rules.strategy.IStrategy;
14 14 import com.google.common.collect.Multimap;
  15 +import org.joda.time.DateTime;
15 16 import org.kie.api.KieBase;
16 17 import org.kie.api.runtime.KieSession;
17 18 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -122,90 +123,16 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt;
122 123 }
123 124  
124 125 @Override
125   - public List<Map<String, Object>> findGroupInfo(Integer xlid, Date scheduleDate) {
126   - List<Object[]> groupInfos = schedulePlanRepository.findGroupInfo(xlid, scheduleDate);
127   - List<Map<String, Object>> ret = new ArrayList<>();
128   - for (Object[] datas : groupInfos) {
129   - // TODO:貌似springdata没有优雅的方式把List<Object[]>转换成List<Map<String, Object>>方法,
130   - // TODO:可能jpa有相关标注,以后找到,此方法就作废
131   -
132   - Map<String, Object> map = new HashMap<>();
133   -
134   - // 线路名称
135   - map.put("xlName", datas[0]);
136   - // 排班时间
137   - map.put("scheduleDate", datas[1]);
138   - // 路牌名字
139   - map.put("lpName", datas[2]);
140   - // 车辆自编号
141   - map.put("clZbh", datas[3]);
142   - // 出场时间,如果有多个,需要分开
143   - Object ccsj = datas[4];
144   - if (ccsj != null) {
145   - String[] ccsj_array = ((String) ccsj).split(",");
146   - if (ccsj_array.length > 1) {
147   - map.put("ccsj1", ccsj_array[0]);
148   - map.put("ccsj2", ccsj_array[1]);
149   - } else {
150   - map.put("ccsj1", ccsj_array[0]);
151   - }
152   - }
153   - // 驾驶员工号,如果有多个,需要分开
154   - Object jsyGh = datas[5];
155   - if (jsyGh != null) {
156   - String[] jsyGh_array = ((String) jsyGh).split(",");
157   - if (jsyGh_array.length > 1) {
158   - map.put("jsy1Gh", jsyGh_array[0]);
159   - map.put("jsy2Gh", jsyGh_array[1]);
160   - } else {
161   - map.put("jsy1Gh", jsyGh_array[0]);
162   - }
163   - }
164   - // 驾驶员名字,如果有多个,需要分开
165   - Object jsyName = datas[6];
166   - if (jsyName != null) {
167   - String[] jsyName_array = ((String) jsyName).split(",");
168   - if (jsyName_array.length > 1) {
169   - map.put("jsy1Name", jsyName_array[0]);
170   - map.put("jsy2Name", jsyName_array[1]);
171   - } else {
172   - map.put("jsy1Name", jsyName_array[0]);
173   - }
174   - }
175   - // 售票员工号,如果有多个,需要分开
176   - Object spyGh = datas[7];
177   - if (spyGh != null) {
178   - String[] spyGh_array = ((String) spyGh).split(",");
179   - if (spyGh_array.length > 1) {
180   - map.put("spy1Gh", spyGh_array[0]);
181   - map.put("spy2Gh", spyGh_array[1]);
182   - } else {
183   - map.put("spy1Gh", spyGh_array[0]);
184   - }
185   - }
186   - // 售票员名字,如果有多个,需要分开
187   - Object spyName = datas[8];
188   - if (spyName != null) {
189   - String[] spyName_array = ((String) spyName).split(",");
190   - if (spyName_array.length > 1) {
191   - map.put("spy1Name", spyName_array[0]);
192   - map.put("spy2Name", spyName_array[1]);
193   - } else {
194   - map.put("spy1Name", spyName_array[0]);
195   - }
196   - }
197   - // 创建时间
198   - map.put("createDate", datas[9]);
199   -
200   - // TODO:可能还有其他字段
201   -
202   - ret.add(map);
  126 + public SchedulePlan findSchedulePlanTommorw() {
  127 + DateTime today = new DateTime(new Date());
  128 + DateTime tommorw = new DateTime(today.getYear(), today.getMonthOfYear(), today.getDayOfMonth(), 0, 0).plusDays(1);
  129 + Map<String, Object> param = new HashMap<>();
  130 + param.put("scheduleFromTime_le", tommorw);
  131 + param.put("scheduleToTime_ge", tommorw);
  132 + Iterator<SchedulePlan> schedulePlanIterator = this.list(param).iterator();
  133 + if (schedulePlanIterator.hasNext()) {
  134 + return schedulePlanIterator.next();
203 135 }
204   - return ret;
205   - }
206   -
207   - @Override
208   - public int updateGroupInfo_clinfo(Integer clid, String clZbh, Integer xlid, Date scheduleDate, String lpName) {
209   - return schedulePlanRepository.updateGroupInfo_clinfo(clid, clZbh, xlid, scheduleDate, lpName);
  136 + return null;
210 137 }
211 138 }
... ...
src/main/java/com/bsth/service/sys/impl/ModuleServiceImpl.java
1 1 package com.bsth.service.sys.impl;
2 2  
3 3 import java.util.ArrayList;
4   -import java.util.Collections;
5   -import java.util.Comparator;
6 4 import java.util.HashMap;
7 5 import java.util.HashSet;
8 6 import java.util.List;
... ... @@ -82,6 +80,7 @@ public class ModuleServiceImpl extends BaseServiceImpl&lt;Module, Integer&gt; implemen
82 80 searchParentNode(m, map, pSet);
83 81 }
84 82 results.addAll(pSet);
  83 +
85 84 return results;
86 85 }
87 86  
... ...
src/main/java/com/bsth/util/FTPClientUtils.java
... ... @@ -66,12 +66,10 @@ public class FTPClientUtils {
66 66 }
67 67  
68 68 ftp.changeWorkingDirectory(path);
69   -
  69 + ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
70 70 ftp.enterLocalPassiveMode();
71   -
72 71 success = ftp.storeFile(new String(filename.getBytes("gbk"),"gbk"), input);
73 72 /*success = ftp.storeFile(filename, input); */
74   -
75 73 input.close();
76 74  
77 75 ftp.logout();
... ... @@ -322,6 +320,7 @@ public class FTPClientUtils {
322 320  
323 321 }
324 322  
  323 + out.flush();
325 324 ftp.logout();
326 325  
327 326 } catch (IOException e){
... ...
src/main/java/com/bsth/util/PackTarGZUtils.java
... ... @@ -95,9 +95,9 @@ public class PackTarGZUtils {
95 95 * @throws
96 96 *
97 97 */
98   - public static File compress(File source) {
  98 + public static File compress(File source, File target) {
99 99  
100   - File target = new File(source.getName() + ".gz");
  100 + //File target = new File(source.getName() + ".gz");
101 101  
102 102 FileInputStream in = null;
103 103  
... ... @@ -117,6 +117,9 @@ public class PackTarGZUtils {
117 117  
118 118 out.write(array, 0, number);
119 119 }
  120 +
  121 + out.finish();
  122 + out.flush();
120 123 } catch (FileNotFoundException e) {
121 124  
122 125 e.printStackTrace();
... ... @@ -164,4 +167,9 @@ public class PackTarGZUtils {
164 167 return target;
165 168  
166 169 }
  170 +
  171 + public static void main(String[] args) {
  172 + File f = compress(new File("C:\\Users\\panzhao\\Desktop\\111\\1025.txt"), new File("C:\\Users\\panzhao\\Desktop\\111\\333\\1025.txt.gz"));
  173 +
  174 + }
167 175 }
... ...
src/main/resources/application-dev.properties
... ... @@ -26,6 +26,6 @@ spring.datasource.validation-query=select 1
26 26 ##
27 27 #222.66.0.204:5555
28 28 ##\u5B9E\u65F6gps
29   -http.gps.real.url= http://192.168.168.201:9090/transport_server/rtgps/
  29 +http.gps.real.url= http://192.168.168.192:8080/transport_server/rtgps/
30 30 ##\u6D88\u606F\u4E0B\u53D1
31   -http.send.directive = http://192.168.168.201:9090/transport_server/message/
32 31 \ No newline at end of file
  32 +http.send.directive = http://192.168.168.192:8080/transport_server/message/
33 33 \ No newline at end of file
... ...
src/main/resources/application.properties
1 1 spring.profiles: dev,prod
2   -spring.profiles.active: prod
  2 +spring.profiles.active: dev
3 3  
4 4 spring.view.suffix=.html
5 5 server.session-timeout=-1
... ...
src/main/resources/ftp.properties
1   -ftp.url=222.66.0.205
  1 +ftp.url=116.236.238.212
2 2 ftp.port=21
3 3 ftp.username=transport
4 4 ftp.password=transport123
... ...
src/main/resources/static/assets/img/bg_9b9dcb65ff.png 0 → 100644

17.4 KB

src/main/resources/static/assets/img/dialog-gray-bg_42c40b3eb6.png 0 → 100644

1.54 KB

src/main/resources/static/assets/js/common.js
... ... @@ -5,7 +5,7 @@
5 5 * success 删除成功之后的回调
6 6 */
7 7 function removeConfirm(text, url, success) {
8   - layer.confirm(text, {
  8 + layer.confirm(html_encode(text), {
9 9 btn : [ '确定删除', '取消' ],
10 10 icon : 3,
11 11 skin : 'layui-layer-cfm-delete'
... ... @@ -19,6 +19,19 @@ function removeConfirm(text, url, success) {
19 19 });
20 20 }
21 21  
  22 +function html_encode(str) {
  23 + var s = "";
  24 + if (str.length == 0) return "";
  25 +
  26 + s = str.replace(/&/g, "&gt;");
  27 + s = s.replace(/</g, "&lt;");
  28 + s = s.replace(/>/g, "&gt;");
  29 + s = s.replace(/ /g, "&nbsp;");
  30 + s = s.replace(/\'/g, "&#39;");
  31 + s = s.replace(/\"/g, "&quot;");
  32 + return s;
  33 +}
  34 +
22 35  
23 36 function successHandle(json, handle){
24 37 var status = json.status;
... ...
src/main/resources/static/assets/plugins/jquery.base64.min.js 0 → 100644
  1 +"use strict";jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_VERSION="1.0";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw"Cannot decode base64"}return idx}function _decode(s){var pads=0,i,b10,imax=s.length,x=[];s=String(s);if(imax===0){return s}if(imax%4!==0){throw"Cannot decode base64"}if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2}imax-=4}for(i=0;i<imax;i+=4){b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6)|_getbyte64(s,i+3);x.push(String.fromCharCode(b10>>16,(b10>>8)&255,b10&255))}switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);x.push(String.fromCharCode(b10>>16,(b10>>8)&255));break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);x.push(String.fromCharCode(b10>>16));break}return x.join("")}function _getbyte(s,i){var x=s.charCodeAt(i);if(x>255){throw"INVALID_CHARACTER_ERR: DOM Exception 5"}return x}function _encode(s){if(arguments.length!==1){throw"SyntaxError: exactly one argument required"}s=String(s);var i,b10,x=[],imax=s.length-s.length%3;if(s.length===0){return s}for(i=0;i<imax;i+=3){b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8)|_getbyte(s,i+2);x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&63));x.push(_ALPHA.charAt((b10>>6)&63));x.push(_ALPHA.charAt(b10&63))}switch(s.length-imax){case 1:b10=_getbyte(s,i)<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_PADCHAR+_PADCHAR);break;case 2:b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_ALPHA.charAt((b10>>6)&63)+_PADCHAR);break}return x.join("")}return{decode:_decode,encode:_encode,VERSION:_VERSION}}(jQuery));
0 2 \ No newline at end of file
... ...
src/main/resources/static/index.html
... ... @@ -308,28 +308,6 @@ tr.row-active td {
308 308  
309 309 <script src="/assets/js/common.js"></script>
310 310 <script src="/assets/js/dictionary.js"></script>
311   -<!-- d3 -->
312   -<script src="/assets/js/d3.min.js" data-exclude=1></script>
313   -<!-- webSocket JS -->
314   -<script src="/assets/js/sockjs.min.js"></script>
315   -
316   -<!-- TODO:angularJS相关库 -->
317   -
318   -<!-- angularJS相关库 -->
319   -<!-- 这个是基于angularjs 1.4.10修改的版本,主要是修改了history控制部分,用于兼容route和pjax的同时操作history的冲突 -->
320   -<script src="/assets/js/angular.js" data-autocephaly=1></script>
321   -<script src="/assets/bower_components/angular-resource/angular-resource.min.js" data-exclude=1></script>
322   -<script src="/assets/bower_components/angular-sanitize/angular-sanitize.min.js" data-exclude=1></script>
323   -<script src="/assets/bower_components/angular-touch/angular-touch.min.js" data-exclude=1></script>
324   -<script src="/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js" data-exclude=1></script>
325   -<script src="/assets/bower_components/oclazyload/dist/ocLazyLoad.min.js" data-exclude=1></script>
326   -<script src="/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js" data-exclude=1></script>
327   -<!-- schedule计划调度AngularJS模块主JS -->
328   -<script src="/pages/scheduleApp/module/common/main.js" data-exclude=1></script>
329   -<script src="/pages/scheduleApp/module/common/prj-common-globalservice.js" data-exclude=1></script>
330   -<script src="/pages/scheduleApp/module/common/prj-common-filter.js" data-exclude=1></script>
331   -<script src="/pages/scheduleApp/module/common/prj-common-directive.js" data-exclude=1></script>
332   -<script src="/pages/scheduleApp/module/common/prj-common-ui-route-state.js" data-exclude=1></script>
333 311  
334 312 <script data-exclude=1>
335 313 //初始打开的片段地址
... ... @@ -457,6 +435,28 @@ $(function(){
457 435 }
458 436  
459 437 </script>
  438 +<!-- d3 -->
  439 +<script src="/assets/js/d3.min.js" data-exclude=1></script>
  440 +<!-- webSocket JS -->
  441 +<script src="/assets/js/sockjs.min.js"></script>
  442 +
  443 +<!-- TODO:angularJS相关库 -->
  444 +
  445 +<!-- angularJS相关库 -->
  446 +<!-- 这个是基于angularjs 1.4.10修改的版本,主要是修改了history控制部分,用于兼容route和pjax的同时操作history的冲突 -->
  447 +<script src="/assets/js/angular.js" data-autocephaly=1></script>
  448 +<script src="/assets/bower_components/angular-resource/angular-resource.min.js" data-exclude=1></script>
  449 +<script src="/assets/bower_components/angular-sanitize/angular-sanitize.min.js" data-exclude=1></script>
  450 +<script src="/assets/bower_components/angular-touch/angular-touch.min.js" data-exclude=1></script>
  451 +<script src="/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js" data-exclude=1></script>
  452 +<script src="/assets/bower_components/oclazyload/dist/ocLazyLoad.min.js" data-exclude=1></script>
  453 +<script src="/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js" data-exclude=1></script>
  454 +<!-- schedule计划调度AngularJS模块主JS -->
  455 +<script src="/pages/scheduleApp/module/common/main.js" data-exclude=1></script>
  456 +<script src="/pages/scheduleApp/module/common/prj-common-globalservice.js" data-exclude=1></script>
  457 +<script src="/pages/scheduleApp/module/common/prj-common-filter.js" data-exclude=1></script>
  458 +<script src="/pages/scheduleApp/module/common/prj-common-directive.js" data-exclude=1></script>
  459 +<script src="/pages/scheduleApp/module/common/prj-common-ui-route-state.js" data-exclude=1></script>
460 460  
461 461 <!-- 地图相关 -->
462 462 <!-- 百度 -->
... ...
src/main/resources/static/login.html
... ... @@ -3,152 +3,352 @@
3 3 <head>
4 4 <meta charset="utf-8" />
5 5 <title>登录</title>
6   -<meta name=”renderer” content=”webkit”>
7   -<meta http-equiv=”X-UA-Compatible” content=”IE=Edge,chrome=1″>
8   -<meta content="width=device-width, initial-scale=1" name="viewport" />
9   -<meta content="" name="description" />
10   -<meta content="" name="author" />
11   -<!-- BEGIN GLOBAL MANDATORY STYLES -->
12 6 <link
13   - href="metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css"
  7 + href="/metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css"
14 8 rel="stylesheet" type="text/css" />
15   -<link href="metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css"
  9 +<!-- Bootstrap style -->
  10 +<link href="/metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css"
16 11 rel="stylesheet" type="text/css" />
17   -<link href="metronic_v4.5.4/css/components.css" rel="stylesheet"
18   - type="text/css" />
19   -<link href="metronic_v4.5.4/css/plugins.css" rel="stylesheet"
20   - type="text/css" />
21 12  
  13 +<!-- METRONIC style -->
  14 +<link href="/metronic_v4.5.4/css/components.css" rel="stylesheet"
  15 + type="text/css" />
  16 +
22 17 <style type="text/css">
23   -/* Cubic Bezier Transition */
24   -/***
25   -Login page
26   -***/
27   -/* bg color */
28   -.login {
29   - width: 100%;
30   - height: 100%;
31   - background-image: url(./assets/img/login_bgbg.png);
32   - background-size: 100%
33   -}
34   -
35   -.loginCenter {
36   - background-image: url(./assets/img/login_bgcenter.png);
37   - background-repeat: no-repeat;
38   - background-size: 100%;
  18 +body>.wrapper {
  19 + background-image: url(/assets/img/bg_9b9dcb65ff.png);
  20 + background-size: 100px;
  21 + background-repeat: repeat;
  22 + min-height: 800px;
  23 + min-width: 630px;
  24 + position: absolute;
  25 + top: 0;
  26 + bottom: 0;
  27 + left: 0;
  28 + right: 0;
  29 +}
  30 +
  31 +#loginPanel.dialog-shadow {
  32 + width: 450px;
  33 + /* height: 400px; */
  34 + border: 1px solid #dadada;
  35 + border-radius: 10px !important;
  36 + position: absolute;
  37 + box-shadow: 0 9px 30px -6px rgba(0, 0, 0, .2), 0 18px 20px -10px
  38 + rgba(0, 0, 0, .04), 0 18px 20px -10px rgba(0, 0, 0, .04), 0 10px 20px
  39 + -10px rgba(0, 0, 0, .04);
  40 + background: url(/assets/img/dialog-gray-bg_42c40b3eb6.png) #fff bottom
  41 + repeat-x;
  42 + top: 50%;
  43 + left: 50%;
  44 + margin-left: -225px;
  45 + margin-top: -300px;
  46 + text-align: center;
  47 + color: #333;
  48 + opacity: .5;
  49 +
  50 + padding-bottom: 56px;
  51 +
  52 + animation: to_center 1s forwards;
  53 + animation-delay: .2s;
  54 +
  55 + transition: all .3s ease;
  56 +}
  57 +
  58 +@keyframes to_center
  59 +{
  60 + 0% {margin-top: -300px;opacity: .5;}
  61 + 100% {margin-top: -270px;opacity: 1;}
  62 +}
  63 +
  64 +
  65 +h3 {
  66 + font-size: 25px;
  67 + font-weight: 600;
  68 + color: #4a4a4a
  69 +}
  70 +
  71 +.input-icon input {
  72 + height: 48px;
  73 + border-radius: 5px !important;
  74 + transition: all .5s ease;
  75 +}
  76 +
  77 +.input-icon input:FOCUS {
  78 + border-color: #c2cad8;
  79 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12) !important;
  80 +}
  81 +
  82 +.input-icon>i {
  83 + margin-top: 16px;
  84 +}
  85 +
  86 +#loginPanel #loginBtn.btn{
  87 + border-radius: 6px !important;
  88 + width: 378px;
  89 + height: 48px;
  90 + font-size: 20px;
  91 + font-family: 微软雅黑;
  92 + transition: all .3s ease;
39 93  
40   - width: 768px;
41   - height: 283.2px;
42   - margin: auto;
43   - position: absolute;
44   - top: 0;
45   - left: 0;
46   - bottom: 0;
47   - right: 0;
  94 + background: #5f7ed7;
  95 + background: linear-gradient(#6f97e5,#527ed9);
  96 + box-shadow: inset 0 1px 2px #7ea1e8 !important;
  97 + color: #fff;
  98 + text-shadow: #4f70b3 0 -1px 0;
  99 + border: none;
  100 +}
  101 +
  102 +#loginPanel #loginBtn.btn:HOVER {
  103 + box-shadow: inset 0 1px 1px #7696de,inset 0 0 2px #627dca,inset 0 -2px 3px #5a77c7,inset 0 0 100px rgba(48,77,147,.4) !important;
  104 +}
  105 +
  106 +
  107 +#loginPanel.show_msg{
  108 + top: calc(50% - 10px);
  109 +}
  110 +
  111 +#loginPanel .alert{
  112 + display: none;
  113 + padding: 12px;
  114 + margin-top: 21px;
  115 + border-radius: 0 0 10px 10px !important;
  116 + font-size: 13px;
48 117  
  118 + position: absolute;
  119 + width: 100%;
  120 + border-bottom: 1px solid #dadada;
49 121 }
50 122  
51   -.loginInputDiv {
52   - top: 48%;
53   -/* width: 80%;
54   - position: absolute;
55   - vertical-align: middle;
56   - text-align: center; */
57   -}
58   -
59   -/* .loginInput {
60   - height: 35px;
61   - padding: 6px 12px;
62   - background-color: #fff;
63   - border: 1px solid #c2cad8;
64   - border-radius: 2px !important;
65   - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
66   - box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
67   - -webkit-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
68   - -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
69   - transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
70   -} */
71   -
72   -.buttonLogin {
  123 +#loginPanel .alert.login-success{
  124 + color: #27a4b0;
  125 + background: #abe7ed;
  126 + border-color: #abe7ed;
  127 +}
  128 +
  129 +#loginPanel .alert i{
  130 + font-size: 16px;
  131 + vertical-align: middle;
  132 + margin: 0 5px 3px;
  133 +}
  134 +
  135 +#loginPanel.show_msg .alert{
  136 + display: block;
  137 +}
  138 +
  139 +#captchaWrap{
  140 + display: none;
  141 + text-align: left;
  142 + border-top: 1px solid #f3f2f2;
  143 +}
  144 +
  145 +img.captcha-img{
73 146 cursor: pointer;
74 147 }
75 148  
76   -.login-form{
77   - position: relative;
  149 +.login-footer{
  150 + position: fixed;
78 151 width: 100%;
79   - height: 100%;
  152 + bottom: 35px;
80 153 text-align: center;
  154 + color: #a6a6a6;
  155 +}
  156 +
  157 +h3.logo-text{
  158 + font-family: 华文楷体,华文细黑;
  159 + font-size: 28px;
81 160 }
82 161 </style>
83 162 </head>
84 163  
85   -<body class="login">
86   - <div class="loginCenter">
87   - <form class="login-form" action="/login" method="post">
88   - <div class="col-md-12 loginInputDiv">
  164 +<body>
  165 + <div class="wrapper ng-scope">
  166 + <div id="loginPanel" class="dialog dialog-shadow">
  167 + <br>
  168 + <h3 class="logo-text">青浦公交调度系统 </h3>
  169 + <hr>
  170 + <form style="padding: 0px 35px;">
  171 + <div class="form-group" style="margin-bottom: 0">
  172 + <label></label>
  173 + <div class="input-icon">
  174 + <i class="fa fa-user font-gray"></i> <input type="text" name="userName"
  175 + class="form-control" placeholder="输入用户名" autofocus="autofocus" autocomplete="off">
  176 + </div>
  177 + </div>
89 178  
90   - <div class="input-icon right" style="display: inline-block;">
91   - <i class="fa fa-user"></i>
92   - <input type="text" class="form-control " placeholder="用户名" name="username" value=""> </div>
93   -
  179 + <div class="form-group">
  180 + <label></label>
  181 + <div class="input-icon">
  182 + <i class="fa fa-key font-gray"></i> <input type="password" name="password"
  183 + class="form-control" placeholder="输入密码" >
  184 + </div>
  185 + </div>
94 186  
95   - <div class="input-icon right" style="display: inline-block;">
96   - <i class="fa fa-key"></i>
97   - <input type="password" class="form-control " placeholder="密码" name="password" value="" > </div>
98   - &nbsp;&nbsp;
99   - <button type="submit" class="btn blue buttonLogin" style="border-radius: 5px !important;
100   - font-family: 微软雅黑;">登&nbsp;录</button>
101   -
102   - </div>
103   - </form>
  187 + <div class="form-group" id="captchaWrap">
  188 + <label></label>
  189 + <div class="input-icon">
  190 + <input type="text" name="captcha" style="width: 153px !important;"
  191 + class="form-control input-inline input-medium" placeholder="输入验证码" >
  192 +
  193 + <span class="help-inline"> <img alt="验证码" class="captcha-img" title="点击刷新验证码"> </span>
  194 + </div>
  195 + </div>
  196 + </form>
  197 + <br><br>
  198 + <div class="form-actions" >
  199 + <button type="button" class="btn blue-steel" id="loginBtn" disabled="disabled">登录</button>
  200 + </div>
  201 +
  202 + <div class="alert alert-danger"></div>
  203 + </div>
  204 +
  205 + <div class="login-footer"> © 2016 上海巴士拓华科技发展有限公司 Some Rights Reserved </div>
104 206 </div>
105   - <script src="metronic_v4.5.4/plugins/jquery.min.js"
106   - type="text/javascript"></script>
107   - <script src="metronic_v4.5.4/plugins/bootstrap/js/bootstrap.min.js"
108   - type="text/javascript"></script>
109   - <script src="metronic_v4.5.4/scripts/app.min.js" type="text/javascript"></script>
110   -
111   - <script src="assets/plugins/purl.js"></script>
112   -
113   - <script type="text/javascript">
114   - $(function() {
115   - $('input[name=username]').focus();
116   - /* setCenterCss(); */
117   - if ($.url().param('error')) {
118   - //去session里查一下失败信息
119   - $.get('/user/loginFailure', function(msg) {
120   - if (msg && msg != '')
121   - alert(msg);
122   - location.href = '/login.html';
123   - });
  207 +
  208 +<!-- jQuery -->
  209 +<script src="/metronic_v4.5.4/plugins/jquery.min.js" ></script>
  210 +<script src="/assets/plugins/jquery.base64.min.js" ></script>
  211 +
  212 +<script>
  213 +!function(){
  214 + var form = $('#loginPanel form')
  215 + ,nameInput = $('input[name=userName]', form)
  216 + ,pwdInput = $('input[name=password]', form)
  217 + ,msgAlert = $('#loginPanel .alert-danger');
  218 +
  219 + $('input', form).on('keyup', checkBtnStatus);
  220 +
  221 + function checkBtnStatus(){
  222 + var es = $('input:visible', form);
  223 + for(var i = 0, e; e = es[i++];){
  224 + if($.trim($(e).val()) == ''){
  225 + $('#loginBtn').attr('disabled', 'disabled');
  226 + $('#loginPanel').removeClass('show_msg');
  227 + return;
124 228 }
125   - /* $(window).resize(setCenterCss); */
126   - // 设置登录界面样式,让登陆框始终居中
127   - /* function setCenterCss() {
128   - $(".loginCenter").css({
129   - width : $(window).width() * 0.4,
130   - height : $(window).height() * 0.2,
131   - });
132   - $(".loginCenter").css({
133   - left : ($(window).width() - $(".loginCenter") .outerWidth()) / 2,
134   - top : ($(window).height() - $(".loginCenter") .outerHeight()) / 2
135   - });
136   - } */
137   - // 设置两个输入框的高度和左边图片高度一致,宽度为父DIV loginInputDiv减 去三个按钮的宽带度/2*0。8
138   - /* $(".loginInput").css({
139   - height : $("#img_user").height(),
140   - width : ($(".loginInputDiv").width()- $("#img_user").width() * 2 -
141   - $(".buttonLogin").width()) / 2 * 0.8
142   - }); */
143   - // 设置中间登陆框DIV左右居中
144   - /* $(".loginInputDiv").css({
145   - left : ($(".loginCenter").outerWidth() - $(".loginInputDiv").outerWidth()) / 2,
146   - }); */
147   - $(".buttonLogin").bind("click", function() {
148   - $(".login-form").submit();
149   - });
  229 + }
  230 + $('#loginBtn').removeAttr('disabled');
  231 + }
  232 +
  233 + nameInput.on('blur', checkStatus);
  234 + //keyup 事件做延迟
  235 + var uNameKeyup;
  236 + nameInput.on('keyup', function(){
  237 + if(uNameKeyup)
  238 + return;
  239 + uNameKeyup = true;
  240 + setTimeout(function(){
  241 + checkStatus();
  242 + uNameKeyup = false;
  243 + }, 200);
  244 + });
  245 +
  246 + //密码框回车事件
  247 + pwdInput.on('keyup', function(e){
  248 + if (e.keyCode == 13)
  249 + $('#loginBtn').click();
  250 + });
  251 + //验证码框回车事件
  252 + $('input[name=captcha]').on('keyup', function(e){
  253 + if (e.keyCode == 13)
  254 + $('#loginBtn').click();
  255 + });
  256 +
  257 + $('#loginBtn').on('click', function(){
  258 + if(lock || $(this).attr('disabled')) return;
  259 + var userName = nameInput.val()
  260 + ,pwd = fourBase64(pwdInput.val());
  261 +
  262 + login(userName, pwd);
  263 + });
  264 +
  265 + var lock;
  266 + function login(userName, pwd){
  267 + lock = true;
  268 + $('#loginBtn').attr('disabled', 'disabled');
  269 + var params = {
  270 + userName: userName,
  271 + password: pwd,
  272 + captcha: $('input[name=captcha]').val()
  273 + };
  274 + $.post('/user/login', params
  275 + ,function(rs){
  276 +
  277 + $('#loginPanel').addClass('show_msg');
  278 + if(error(rs)){
  279 + lock = false;
  280 + $('#loginBtn').removeAttr('disabled');
  281 +
  282 + msgAlert.html('<i class="fa fa-times-circle"> </i> 登录失败,' + rs.msg);
  283 +
  284 + _captcha.refresh();
  285 + checkStatus();
  286 + }
  287 + else{
  288 + msgAlert.html('<i class="fa fa-check"> </i> 登录成功!');
  289 + msgAlert.addClass('login-success');
  290 + window.location.href = '/';
  291 + }
  292 + });
  293 + }
  294 +
  295 + function checkStatus(){
  296 + var t = nameInput.val();
  297 + if(!t){
  298 + hide();
  299 + return;
  300 + }
  301 +
  302 + $.get('/user/login/captchaStatus', {userName: t}, function(rs){
  303 + if(rs >= 3)
  304 + _captcha.show();
  305 + else
  306 + hide();
150 307 });
151   - </script>
  308 +
  309 + function hide(){
  310 + if(!$("#captchaWrap").is(":hidden")){
  311 + _captcha.hide();
  312 + //隐藏提示消息
  313 + msgAlert.html('');
  314 + $('#loginPanel').removeClass('show_msg');
  315 + }
  316 + }
  317 + }
  318 +
  319 +
  320 + var _captcha = {
  321 + show: function(){
  322 + if($("#captchaWrap").is(":hidden")){
  323 + $('#captchaWrap').fadeIn(500);
  324 + _captcha.refresh();
  325 + checkBtnStatus();
  326 + }
  327 + },
  328 + refresh: function(){
  329 + if($("#captchaWrap").is(":hidden"))
  330 + return;
  331 + $('#captchaWrap img.captcha-img').attr('src', '/captcha.jpg?t=' + Math.random());
  332 + },
  333 + hide: function(){
  334 + $('#captchaWrap').hide();
  335 + $('input[name=captcha]').val('');
  336 + }
  337 + };
  338 +
  339 + $('#captchaWrap img.captcha-img').on('click', function(){
  340 + $(this).attr('src', '/captcha.jpg?t=' + Math.random());
  341 + });
  342 +
  343 + function fourBase64(t){
  344 + var ed = $.base64.encode;
  345 + return ed(ed(ed(ed(t))));
  346 + }
  347 +
  348 + function error(rs){
  349 + return rs.status == 'ERROR' || rs.status == 500;
  350 + }
  351 +}();
  352 +</script>
152 353 </body>
153   -
154 354 </html>
155 355 \ No newline at end of file
... ...
src/main/resources/static/pages/control/line/index.html
... ... @@ -228,8 +228,8 @@ function countDown(name){
228 228  
229 229 <script>
230 230 var updateLog = {
231   - text: '<div class="updete_log"><p>1、...</p></div>'
232   - ,title: '2016年8月28号更新日志'
  231 + text: '<div class="updete_log"><p>1、过滤掉未加入调度配置的GPS信号。</p></div>'
  232 + ,title: '2016年9月13号更新日志'
233 233 }
234 234  
235 235 var lineCodes = '' //全部线路编码字符串,由data.js初始化
... ...
src/main/resources/static/pages/control/line/js/home.js
... ... @@ -85,18 +85,18 @@ var _home = (function() {
85 85 $('menu.menu').show();
86 86 }, 400);
87 87  
88   - /*setTimeout(function() {
  88 + setTimeout(function() {
89 89 // 提示文本
90   - var promptFlag = storage.getItem('promptFlag_0828');
  90 + var promptFlag = storage.getItem('promptFlag_0913');
91 91 if (!promptFlag) {
92 92 layer.alert(updateLog.text, {
93 93 title: updateLog.title,
94 94 area: ['410px', '250px'],
95 95 shift : 5
96 96 });
97   - storage.setItem('promptFlag_0828', 1);
  97 + storage.setItem('promptFlag_0913', 1);
98 98 }
99   - }, 1500);*/
  99 + }, 1500);
100 100 }
101 101 }
102 102  
... ...
src/main/resources/static/pages/control/lineConfig/config.html
... ... @@ -273,7 +273,7 @@ butto.line-config-btn:active{
273 273 }
274 274  
275 275 function defaultConfig(lineCode, name){
276   - layer.confirm('没有找到['+name+']的配置信息,系统将生成默认配置?', {
  276 + layer.confirm('没有找到['+html_encode(name)+']的配置信息,系统将生成默认配置?', {
277 277 btn : [ '我同意' ],
278 278 icon : 3,
279 279 shift: 5,
... ...
src/main/resources/static/pages/forecast/sample/css/main.css
... ... @@ -225,24 +225,90 @@ rect.f_rect{
225 225  
226 226  
227 227 #forecastSamplePanel .tab-content::-webkit-scrollbar,
228   -#forecastSamplePanel #trafficChart::-webkit-scrollbar {
  228 +#forecastSamplePanel #trafficChart::-webkit-scrollbar,
  229 +#sptItems::-webkit-scrollbar{
229 230 width: 15px;
230 231 height: 16px;
231 232 }
232 233 #forecastSamplePanel .tab-content::-webkit-scrollbar-track,
233 234 #forecastSamplePanel .tab-content::-webkit-scrollbar-thumb,
234 235 #forecastSamplePanel #trafficChart::-webkit-scrollbar-track,
235   -#forecastSamplePanel #trafficChart::-webkit-scrollbar-thumb {
  236 +#forecastSamplePanel #trafficChart::-webkit-scrollbar-thumb,
  237 +#sptItems::-webkit-scrollbar-track,
  238 +#sptItems::-webkit-scrollbar-thumb {
236 239 border-radius: 999px;
237 240 border: 5px solid transparent;
238 241 }
239 242 #forecastSamplePanel .tab-content::-webkit-scrollbar-thumb,
240   -#forecastSamplePanel #trafficChart::-webkit-scrollbar-thumb {
  243 +#forecastSamplePanel #trafficChart::-webkit-scrollbar-thumb,
  244 +#sptItems::-webkit-scrollbar-thumb {
241 245 min-height: 20px;
242 246 background-clip: content-box;
243 247 box-shadow: 0 0 0 5px rgba(0,0,0,.2) inset;
244 248 }
245 249 #forecastSamplePanel .tab-content::-webkit-scrollbar-corner,
246   -#forecastSamplePanel #trafficChart::-webkit-scrollbar-corner {
  250 +#forecastSamplePanel #trafficChart::-webkit-scrollbar-corner,
  251 +#sptItems::-webkit-scrollbar-corner {
247 252 background: transparent;
  253 +}
  254 +
  255 +#forecastPopForm.form-horizontal .form-group{
  256 + margin: 15px 7px 0;
  257 +}
  258 +
  259 +#forecastPopForm.form-horizontal{
  260 + margin: 15px;
  261 +}
  262 +
  263 +#forecastPopForm.form-horizontal h6{
  264 + border-bottom: 1px solid #eeeeee;padding: 8px 0 10px;color: gray;
  265 +}
  266 +
  267 +.forecast-spt-item{
  268 + margin: 8px 0;
  269 + padding: 8px 0;
  270 + /* border-bottom: 1px solid #c2cad8; */
  271 + position: relative;
  272 +}
  273 +
  274 +.forecast-spt-item>div{
  275 + padding: 0 0 0 15px;
  276 +}
  277 +
  278 +.forecast-spt-item>div.e-date{
  279 + padding: 0 15px 0 0;
  280 +}
  281 +
  282 +#forecastPopForm .form-actions{
  283 + border-top: 1px solid #eeeeee;
  284 + margin-top: 12px;
  285 + padding-top: 13px;
  286 + text-align: center;
  287 +}
  288 +
  289 +.forecast-item-close{
  290 + position: absolute;
  291 + z-index: 9;
  292 + left: 15px;
  293 + top: 13px;
  294 + width: 10px;
  295 + height: 10px;
  296 + background: #fff;
  297 + padding: 0 5px !important;
  298 + font-size: 18px;
  299 + cursor: pointer;
  300 + font-weight: 600;
  301 + color: #ea8d8d;
  302 +}
  303 +
  304 +.forecast-item-close:HOVER {
  305 + color: red;
  306 +}
  307 +
  308 +#sptItems{
  309 + height: 304px;
  310 + overflow-y: auto;
  311 + overflow-x: hidden;
  312 + padding-right: 15px;
  313 + margin: 15px 0px;
248 314 }
249 315 \ No newline at end of file
... ...
src/main/resources/static/pages/forecast/sample/main.html
... ... @@ -56,6 +56,74 @@
56 56 {{/each}}
57 57 </script>
58 58  
  59 +<script id="forecast_gps_create_temp" type="text/html">
  60 +<form class="form-horizontal" role="form" id="forecastPopForm">
  61 + <div class="form-body">
  62 + <div class="form-group">
  63 + <label class="col-md-3 control-label">线路</label>
  64 + <div class="col-md-9">
  65 + <input type="hidden" name="lineCode" value="{{line.code}}">
  66 + <input type="text" class="form-control" value="{{line.name}}" style="width: 180px;" readonly>
  67 + </div>
  68 + </div>
  69 + <div class="form-group">
  70 + <label class="col-md-3 control-label">走向</label>
  71 + <div class="col-md-9">
  72 + <input type="hidden" name="updown" value={{updown}}>
  73 + <input type="text" class="form-control" value='{{updown == 0?"上行":"下行"}}' style="width: 180px;" readonly>
  74 + </div>
  75 + </div>
  76 +
  77 + <h6><i class="fa fa-question-circle"></i> 使用哪些天的GPS数据</h6>
  78 + <div class="form-group">
  79 + <label class="col-md-3 control-label">起始日期</label>
  80 + <div class="col-md-9">
  81 + <input type="date" class="form-control" style="width: 180px;" name="startDate" value="{{sdate}}" required>
  82 + </div>
  83 + </div>
  84 + <div class="form-group">
  85 + <label class="col-md-3 control-label">截止日期</label>
  86 + <div class="col-md-9">
  87 + <input type="date" class="form-control" style="width: 180px;" name="endDate" value="{{cdate}}" required>
  88 + </div>
  89 + </div>
  90 +
  91 +
  92 + <h6><i class="fa fa-question-circle"></i> 你想怎么划分时区</h6>
  93 + <div class="form-group" id="sptItems">
  94 + {{each drs as dr i }}
  95 + <div class="forecast-spt-item row">
  96 + <div class="forecast-item-close"><i class="fa fa-times-circle" ></i></div>
  97 + <div class="col-md-offset-1 col-md-4">
  98 + <input type="text" class="form-control" name="dr_name[]" placeholder="时区名称" value="{{dr.name}}" required>
  99 + </div>
  100 + <div class="col-md-3 s-date">
  101 + <input type="time" class="form-control" name="dr_stime[]" placeholder="开始时间" value="{{dr.s}}" required>
  102 + </div>
  103 + <div class="col-md-1" style="padding-top: 10px;">至</div>
  104 + <div class="col-md-3 e-date">
  105 + <input type="time" class="form-control" name="dr_etime[]" placeholder="结束时间" value="{{dr.e}}" required>
  106 + </div>
  107 + </div>
  108 + {{/each}}
  109 + </div>
  110 +
  111 + <div class="footer">
  112 + <a href="javascript:;" style="text-indent: 28px;" class="add-item"><i class="fa fa-plus"></i> 添加项</a>
  113 + </div>
  114 +
  115 + <div class="form-actions">
  116 + <div class="row">
  117 + <div class="col-md-12" style="">
  118 + <button type="submit" class="btn green">开始生成数据</button>
  119 + <button type="button" class="btn default layui-layer-close">取消</button>
  120 + </div>
  121 + </div>
  122 + </div>
  123 + </div>
  124 +</form>
  125 +</script>
  126 +
59 127 <script src="/pages/forecast/sample/js/svg.js"></script>
60 128 <script>
61 129 !function(){
... ... @@ -74,12 +142,6 @@
74 142 opacity : .8
75 143 });
76 144  
77   -/* //路由
78   - $('.left_station_route .tab-content').slimscroll({
79   - height : 'calc(100% - 46px)',
80   - opacity : .8
81   - }); */
82   -
83 145 //上下行切换事件
84 146 $('.left_station_route .tabbable-line ul li').on('click', function(){setTimeout(drawSvg, 300);});
85 147  
... ... @@ -144,6 +206,10 @@
144 206 return $('.line_config_tree li.selected').data('code');
145 207 }
146 208  
  209 + function getLineName(){
  210 + return $.trim($('.line_config_tree li.selected').text());
  211 + }
  212 +
147 213 function drawSvg(){
148 214 //绘制svg
149 215 var rts = [], updown = getUpdown();
... ... @@ -160,15 +226,87 @@
160 226  
161 227  
162 228 $('#gpsCreateDataLink').on('click', function(){
163   - var lineName = $('.line_config_tree ul li.selected button').text();
164   - var updownText = $('.left_station_route ul li.active a').text();
  229 + var drs = [{name: '早低谷', s: '00:00', e: '07:00'},{name: '早高峰', s: '07:01', e: '09:00'},{name: '平峰', s: '09:01', e: '16:00'},{name: '晚高峰', s: '16:01', e: '20:00'},{name: '晚低谷', s: '20:01', e: '23:59'}];
  230 + var line = {code: getLineCode(), name: getLineName()};
165 231  
166   - layer.confirm('使用GPS轨迹生成【'+lineName+' -'+updownText+'】站点间耗时数据? 该操作将会清除原有数据。', {
167   - btn: ['我确定','算了吧'],
168   - icon: 3
169   - }, function(){
170   -
  232 + var cdate = moment().format('YYYY-MM-DD')
  233 + ,sdate = moment().subtract(14, 'days').format('YYYY-MM-DD');
  234 + layer.open({
  235 + type: 1,
  236 + area: '580px',
  237 + // maxmin: true,
  238 + content: template('forecast_gps_create_temp', {updown: getUpdown(), line: line, drs: drs, cdate: cdate, sdate: sdate}),
  239 + shift: 5,
  240 + title: '根据历史轨迹生成数据',
  241 + success: function(layero){
  242 + var f = $('#forecastPopForm');
  243 +
  244 + f.on('click', '.forecast-item-close' , function(){
  245 + $(this).parent('.forecast-spt-item').remove();
  246 + });
  247 + $('.add-item', f).on('click', function(){
  248 + var item = '<div class="forecast-spt-item row"><div class="forecast-item-close"><i class="fa fa-times-circle" ></i></div><div class="col-md-offset-1 col-md-4"><input type="text" class="form-control" name="dr_name[]" placeholder="时区名称" required></div><div class="col-md-3 s-date"><input type="time" class="form-control" name="dr_stime[]" placeholder="开始时间" required> </div><div class="col-md-1" style="padding-top: 10px;">至</div><div class="col-md-3 e-date"><input type="time" class="form-control" name="dr_etime[]" placeholder="结束时间" required></div></div>';
  249 + $('#sptItems').append(item);
  250 + $('#sptItems').scrollTop( $('#sptItems')[0].scrollHeight );
  251 + });
  252 +
  253 + f.on('submit', function(){
  254 + try{
  255 + if(customFormValidate(f)){
  256 + var param = f.serializeJSON()
  257 + ,timeRange = []
  258 + ,size = param.dr_name.length;
  259 + for(var i = 0; i < size; i ++)
  260 + timeRange.push({tag: param.dr_name[i], s: param.dr_stime[i], e: param.dr_etime[i]});
  261 +
  262 + delete param.dr_name;
  263 + delete param.dr_stime;
  264 + delete param.dr_etime;
  265 + param.timeRange = timeRange;
  266 +
  267 + $.post('/sample/create/gps', {data: encodeURI(JSON.stringify(param))}, function(rs){
  268 + console.log(rs);
  269 + });
  270 + }
  271 + }catch (e){
  272 + console.log(e);
  273 + }
  274 +
  275 + return false;
  276 + });
  277 + }
171 278 });
172 279 });
  280 +
  281 +
  282 + /**
  283 + * 自定义表单校验
  284 + */
  285 + function customFormValidate(f){
  286 + var rs = true;
  287 + //所有可见的项
  288 + var es = $('input,select', f);
  289 +
  290 + for(var i = 0, e; e = es[i++];){
  291 + if($(e).attr('required') && ( $(e).val() == null || $(e).val() == '')){
  292 + if($(e).hasClass('select2-hidden-accessible'))
  293 + $(e).next().find('.select2-selection').addClass('custom-val-error');
  294 + else
  295 + $(e).addClass('custom-val-error');
  296 + rs = false;
  297 + }
  298 + else{
  299 + if($(e).hasClass('select2-hidden-accessible'))
  300 + $(e).next().find('.select2-selection').removeClass('custom-val-error');
  301 + else
  302 + $(e).removeClass('custom-val-error');
  303 + }
  304 + }
  305 +
  306 + if(!rs){
  307 + layer.alert('数据完整性校验失败,请检查输入项', {icon: 2, title: '操作失败', shift: 5});
  308 + }
  309 + return rs;
  310 + }
173 311 }();
174 312 </script>
175 313 \ No newline at end of file
... ...
src/main/resources/static/pages/forecast/sample/modal.html
... ... @@ -39,7 +39,7 @@
39 39 </div>
40 40 </div>
41 41 <div class="form-group">
42   - <label class="col-md-3 control-label">时段:</label>
  42 + <label class="col-md-3 control-label">时段:</label>
43 43 <div class="col-md-4" style="padding-right: 0;">
44 44 <input type="time" class="form-control" name="sDate" value="{{obj.d.sDate}}" required>
45 45 </div>
... ... @@ -86,7 +86,7 @@
86 86 </div>
87 87 </div>
88 88 <div class="form-group">
89   - <label class="col-md-3 control-label">标签:</label>
  89 + <label class="col-md-3 control-label">时区:</label>
90 90 <div class="col-md-9">
91 91 <select class="form-control" name="tag" style="width:100%;" multiple required>
92 92 <option value="早高峰">早高峰</option>
... ... @@ -96,7 +96,7 @@
96 96 </div>
97 97 </div>
98 98 <div class="form-group">
99   - <label class="col-md-3 control-label">时段:</label>
  99 + <label class="col-md-3 control-label">时段:</label>
100 100 <div class="col-md-4" style="padding-right: 0;">
101 101 <input type="time" class="form-control" name="sDate" required>
102 102 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -478,6 +478,37 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
478 478 isArray: true
479 479 }
480 480 }
  481 + ),
  482 + cci3: $resource(
  483 + '/cci/cars2',
  484 + {},
  485 + {
  486 + list: {
  487 + method: 'GET',
  488 + isArray: true
  489 + }
  490 + }
  491 +
  492 + ),
  493 + eci: $resource(
  494 + '/eci/jsy',
  495 + {},
  496 + {
  497 + list: {
  498 + method: 'GET',
  499 + isArray: true
  500 + }
  501 + }
  502 + ),
  503 + eci2: $resource(
  504 + '/eci/spy',
  505 + {},
  506 + {
  507 + list: {
  508 + method: 'GET',
  509 + isArray: true
  510 + }
  511 + }
481 512 )
482 513 }
483 514 }]);
... ... @@ -671,6 +702,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect2&quot;, [
671 702 * icname(必须):内部与之对应的字段名,如:icname=code
672 703 * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
673 704 * icname2(可选):内部与之对应的字段名2,如:icname2=name
  705 + * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
  706 + * icname3(可选):内部与之对应的字段名3,如:icname2=name
674 707 * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
675 708 * required(可选):是否要用required验证
676 709 * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
... ... @@ -714,6 +747,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
714 747 var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
715 748 var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
716 749 var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
  750 + var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
  751 + var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
  752 +
717 753 var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
718 754 var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
719 755 var $required_attr = tAttrs["required"]; // 是否需要required验证
... ... @@ -769,6 +805,13 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
769 805 scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
770 806 }
771 807 }
  808 + if ($dcname3_attr && $icname3_attr) {
  809 + if ($mlp_attr) {
  810 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
  811 + } else {
  812 + scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
  813 + }
  814 + }
772 815 };
773 816  
774 817 // 删除选中事件处理函数
... ... @@ -787,6 +830,13 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
787 830 scope[ctrlAs].model[$dcname2_attr] = undefined;
788 831 }
789 832 }
  833 + if ($dcname3_attr) {
  834 + if ($mlp_attr) {
  835 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
  836 + } else {
  837 + scope[ctrlAs].model[$dcname3_attr] = undefined;
  838 + }
  839 + }
790 840 };
791 841  
792 842 /**
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -390,13 +390,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
390 390 }
391 391 }
392 392 ),
393   - groupinfo : $resource(
394   - '/spc/groupinfos/:xlid/:sdate',
  393 + tommorw: $resource(
  394 + '/spc/tommorw',
395 395 {},
396 396 {
397 397 list: {
398   - method: 'GET',
399   - isArray: true
  398 + method: 'GET'
400 399 }
401 400 }
402 401 )
... ... @@ -423,6 +422,25 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanInfoManageService_g&#39;, [&#39;$reso
423 422 method: 'POST'
424 423 }
425 424 }
  425 + ),
  426 + groupinfo : $resource(
  427 + '/spic/groupinfos/:xlid/:sdate',
  428 + {},
  429 + {
  430 + list: {
  431 + method: 'GET',
  432 + isArray: true
  433 + }
  434 + }
  435 + ),
  436 + updateGroupInfo : $resource(
  437 + '/spic/groupinfos/update',
  438 + {},
  439 + {
  440 + update: {
  441 + method: 'POST'
  442 + }
  443 + }
426 444 )
427 445 };
428 446 }]);
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
... ... @@ -765,7 +765,8 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
765 765 })
766 766  
767 767 .state("schedulePlanReportManage_edit", {
768   - url: '/schedulePlanReportManage_edit/:xlid/:sdate/:lp',
  768 + url: '/schedulePlanReportManage_edit',
  769 + params: {type: 0, groupInfo: null},
769 770 views: {
770 771 "": {
771 772 templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/edit_report.html'
... ... @@ -819,5 +820,4 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
819 820 // TODO:
820 821  
821 822 ;
822   -
823 823 }]);
824 824 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/edit_report.html
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>调度值勤日报</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">运营计划管理</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="schedulePlanReportManage">调度值勤日报</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">修改</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="SchedulePlanReportManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i>
  29 +
  30 + <span ng-if="ctrl.type == 1" class="caption-subject font-red-sunglo bold uppercase">换车,改变指定路牌的配置车辆,可以是其他线路的车辆(套跑)</span>
  31 + <span ng-if="ctrl.type == 2" class="caption-subject font-red-sunglo bold uppercase">更改出场班次时间,改变指定路牌的第一个首发班次时间(第一个出场班次)</span>
  32 + <span ng-if="ctrl.type == 3" class="caption-subject font-red-sunglo bold uppercase">更改人员配置,更改驾驶员、售票员</span>
  33 + <span ng-if="ctrl.type == 4" class="caption-subject font-red-sunglo bold uppercase">当前是分班,更改出场便次时间,改变指定路牌的分班后的第一个首发班次时间</span>
  34 + <span ng-if="ctrl.type == 5" class="caption-subject font-red-sunglo bold uppercase">当前是分班,更改分班后的人员配置,更改驾驶员、售票员</span>
  35 + </div>
  36 + </div>
  37 +
  38 + <div class="portlet-body form">
  39 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  40 + <!--<div class="alert alert-danger display-hide">-->
  41 + <!--<button class="close" data-close="alert"></button>-->
  42 + <!--您的输入有误,请检查下面的输入项-->
  43 + <!--</div>-->
  44 +
  45 +
  46 + <!-- 其他信息放置在这里 -->
  47 + <div class="form-body">
  48 + <div class="form-group">
  49 + <label class="col-md-2 control-label">线路:</label>
  50 + <div class="col-md-3">
  51 + <input type="text" class="form-control" name="xlName" ng-model="ctrl.groupInfo.xlName" readonly/>
  52 + </div>
  53 + </div>
  54 + <div class="form-group">
  55 + <label class="col-md-2 control-label">日期:</label>
  56 + <div class="col-md-3">
  57 + <input type="text" class="form-control" name="scheduleDate" uib-datepicker-popup="yyyy年MM月dd日" ng-model="ctrl.groupInfo.scheduleDate" readonly/>
  58 + </div>
  59 + </div>
  60 + <div class="form-group">
  61 + <label class="col-md-2 control-label">路牌:</label>
  62 + <div class="col-md-3">
  63 + <input type="text" class="form-control" name="lpName" ng-model="ctrl.groupInfo.lpName" readonly/>
  64 + </div>
  65 + </div>
  66 +
  67 + <!-- 修改车辆 -->
  68 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 1">
  69 + <label class="col-md-2 control-label">车辆配置-修改前*:</label>
  70 + <div class="col-md-3">
  71 + <input type="text" class="form-control" name="cl_before" ng-model="ctrl.groupInfo_src.clZbh" readonly/>
  72 + </div>
  73 + </div>
  74 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 1">
  75 + <label class="col-md-2 control-label">车辆配置-修改后*:</label>
  76 + <div class="col-md-3">
  77 + <sa-Select3 model="ctrl.groupInfo"
  78 + name="cl_after"
  79 + placeholder="请输拼音..."
  80 + dcvalue="{{ctrl.groupInfo.clId}}"
  81 + dcname="clId"
  82 + icname="id"
  83 + dcname2="clZbh"
  84 + icname2="insideCode"
  85 + icnames="insideCode"
  86 + datatype="cci3"
  87 + required >
  88 + </sa-Select3>
  89 + </div>
  90 + <!-- 隐藏块,显示验证信息 -->
  91 + <div class="alert alert-danger well-sm" ng-show="myForm.cl_after.$error.required">
  92 + 车辆必须选择
  93 + </div>
  94 + </div>
  95 +
  96 + <!-- 修改出场班次时间1 -->
  97 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 2">
  98 + <label class="col-md-2 control-label">出场时间-修改前*:</label>
  99 + <div class="col-md-3">
  100 + <input type="text" class="form-control" name="ccsj_before" ng-model="ctrl.groupInfo_src.ccsj1" readonly/>
  101 + </div>
  102 + </div>
  103 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 2">
  104 + <label class="col-md-2 control-label">出场时间-修改后*;</label>
  105 + <div class="col-md-3">
  106 + <input type="text" class="form-control" name="ccsj_after" ng-model="ctrl.groupInfo.ccsj1" ng-pattern="ctrl.time_regex"/>
  107 + </div>
  108 + <!-- 隐藏块,显示验证信息 -->
  109 + <div class="alert alert-danger well-sm" ng-show="myForm.ccsj_after.$error.pattern">
  110 + 时间格式错误,应该是格式hh:mm,如:06:39
  111 + </div>
  112 + </div>
  113 +
  114 + <!-- 修改第一组人员配置 -->
  115 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 3">
  116 + <label class="col-md-2 control-label">驾驶员-修改前*:</label>
  117 + <div class="col-md-3">
  118 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.jsy1Name + '(' + ctrl.groupInfo_src.jsy1Gh + ')'" readonly/>
  119 + </div>
  120 + </div>
  121 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 3">
  122 + <label class="col-md-2 control-label">驾驶员-修改后*:</label>
  123 + <div class="col-md-3">
  124 + <sa-Select3 model="ctrl.groupInfo"
  125 + name="jsy"
  126 + placeholder="请输拼音..."
  127 + dcvalue="{{ctrl.groupInfo.jsy1Id}}"
  128 + dcname="jsy1Id"
  129 + icname="jsyId"
  130 + dcname2="jsy1Gh"
  131 + icname2="jsyGh"
  132 + dcname3="jsy1Name"
  133 + icname3="jsyName"
  134 + icnames="jsyName"
  135 + datatype="eci"
  136 + mlp="true"
  137 + required >
  138 + </sa-Select3>
  139 + </div>
  140 + <!-- 隐藏块,显示验证信息 -->
  141 + <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
  142 + 驾驶员必须选择
  143 + </div>
  144 + </div>
  145 + <div class="form-group" ng-if="ctrl.type == 3">
  146 + <label class="col-md-2 control-label">售票员-修改前:</label>
  147 + <div class="col-md-3">
  148 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.spy1Name + '(' + ctrl.groupInfo_src.spy1Gh + ')'" readonly/>
  149 + </div>
  150 + </div>
  151 + <div class="form-group" ng-if="ctrl.type == 3">
  152 + <label class="col-md-2 control-label">售票员-修改后:</label>
  153 + <div class="col-md-3">
  154 + <sa-Select3 model="ctrl.groupInfo"
  155 + name="spy"
  156 + placeholder="请输拼音..."
  157 + dcvalue="{{ctrl.groupInfo.spy1Id}}"
  158 + dcname="spy1Id"
  159 + icname="spyId"
  160 + dcname2="spy1Gh"
  161 + icname2="spyGh"
  162 + dcname3="spy1Name"
  163 + icname3="spyName"
  164 + icnames="spyName"
  165 + datatype="eci2"
  166 + mlp="true">
  167 + </sa-Select3>
  168 + </div>
  169 + </div>
  170 +
  171 + <!-- 修改出场班次时间2 -->
  172 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 4">
  173 + <label class="col-md-2 control-label">出场时间-修改前*:</label>
  174 + <div class="col-md-3">
  175 + <input type="text" class="form-control" name="ccsj_before" ng-model="ctrl.groupInfo_src.ccsj2" readonly/>
  176 + </div>
  177 + </div>
  178 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 4">
  179 + <label class="col-md-2 control-label">出场时间-修改后*;</label>
  180 + <div class="col-md-3">
  181 + <input type="text" class="form-control" name="ccsj_after" ng-model="ctrl.groupInfo.ccsj2" ng-pattern="ctrl.time_regex"/>
  182 + </div>
  183 + <!-- 隐藏块,显示验证信息 -->
  184 + <div class="alert alert-danger well-sm" ng-show="myForm.ccsj_after.$error.pattern">
  185 + 时间格式错误,应该是格式hh:mm,如:06:39
  186 + </div>
  187 + </div>
  188 +
  189 + <!-- 修改第二组人员配置 -->
  190 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 5">
  191 + <label class="col-md-2 control-label">驾驶员-修改前*:</label>
  192 + <div class="col-md-3">
  193 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.jsy2Name + '(' + ctrl.groupInfo_src.jsy2Gh + ')'" readonly/>
  194 + </div>
  195 + </div>
  196 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 5">
  197 + <label class="col-md-2 control-label">驾驶员-修改后*:</label>
  198 + <div class="col-md-3">
  199 + <sa-Select3 model="ctrl.groupInfo"
  200 + name="jsy"
  201 + placeholder="请输拼音..."
  202 + dcvalue="{{ctrl.groupInfo.jsy2Id}}"
  203 + dcname="jsy2Id"
  204 + icname="jsyId"
  205 + dcname2="jsy2Gh"
  206 + icname2="jsyGh"
  207 + dcname3="jsy2Name"
  208 + icname3="jsyName"
  209 + icnames="jsyName"
  210 + datatype="eci"
  211 + mlp="true"
  212 + required >
  213 + </sa-Select3>
  214 + </div>
  215 + <!-- 隐藏块,显示验证信息 -->
  216 + <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
  217 + 驾驶员必须选择
  218 + </div>
  219 + </div>
  220 + <div class="form-group" ng-if="ctrl.type == 5">
  221 + <label class="col-md-2 control-label">售票员-修改前:</label>
  222 + <div class="col-md-3">
  223 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.spy2Name + '(' + ctrl.groupInfo_src.spy2Gh + ')'" readonly/>
  224 + </div>
  225 + </div>
  226 + <div class="form-group" ng-if="ctrl.type == 5">
  227 + <label class="col-md-2 control-label">售票员-修改后:</label>
  228 + <div class="col-md-3">
  229 + <sa-Select3 model="ctrl.groupInfo"
  230 + name="spy"
  231 + placeholder="请输拼音..."
  232 + dcvalue="{{ctrl.groupInfo.spy2Id}}"
  233 + dcname="spy2Id"
  234 + icname="spyId"
  235 + dcname2="spy2Gh"
  236 + icname2="spyGh"
  237 + dcname3="spy2Name"
  238 + icname3="spyName"
  239 + icnames="spyName"
  240 + datatype="eci2"
  241 + mlp="true">
  242 + </sa-Select3>
  243 + </div>
  244 + </div>
  245 +
  246 +
  247 + <!-- 其他form-group -->
  248 +
  249 + </div>
  250 +
  251 + <div class="form-actions">
  252 + <div class="row">
  253 + <div class="col-md-offset-3 col-md-4">
  254 + <button type="submit" class="btn green"
  255 + ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  256 + <a type="button" class="btn default" ui-sref="schedulePlanReportManage" ><i class="fa fa-times"></i> 取消</a>
  257 + </div>
  258 + </div>
  259 + </div>
  260 +
  261 + </form>
  262 +
  263 + </div>
  264 +
  265 +
  266 +</div>
0 267 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list_report.html
... ... @@ -79,57 +79,57 @@
79 79 <span ng-bind="info.lpName"></span>
80 80 </td>
81 81 <td>
82   - <a class="btn btn-success" ng-click="ctrl.goEditForm()">
  82 + <a class="btn btn-primary" ng-click="ctrl.goEditForm(1, info)">
83 83 <span ng-bind="info.clZbh"></span>
84 84 </a>
85 85 </td>
86 86 <td>
87   - <a class="btn btn-success" ng-show="info.ccsj1">
  87 + <a class="btn btn-info" ng-show="info.ccsj1" ng-click="ctrl.goEditForm(2, info)">
88 88 <span ng-bind="info.ccsj1"></span>
89 89 </a>
90 90 </td>
91 91 <td>
92   - <a class="btn btn-success" ng-show="info.jsy1Gh">
  92 + <a class="btn btn-success" ng-show="info.jsy1Gh" ng-click="ctrl.goEditForm(3, info)">
93 93 <span ng-bind="info.jsy1Gh"></span>
94 94 </a>
95 95 </td>
96 96 <td>
97   - <a class="btn btn-success" ng-show="info.jsy1Name">
  97 + <a class="btn btn-success" ng-show="info.jsy1Name" ng-click="ctrl.goEditForm(3, info)">
98 98 <span ng-bind="info.jsy1Name"></span>
99 99 </a>
100 100 </td>
101 101 <td>
102   - <a class="btn btn-success" ng-show="info.spy1Gh">
  102 + <a class="btn btn-info" ng-show="info.spy1Gh" ng-click="ctrl.goEditForm(3, info)">
103 103 <span ng-bind="info.spy1Gh"></span>
104 104 </a>
105 105 </td>
106 106 <td>
107   - <a class="btn btn-success" ng-show="info.spy1Name">
  107 + <a class="btn btn-info" ng-show="info.spy1Name" ng-click="ctrl.goEditForm(3, info)">
108 108 <span ng-bind="info.spy1Name"></span>
109 109 </a>
110 110 </td>
111 111 <td>
112   - <a class="btn btn-success" ng-show="info.ccsj2">
  112 + <a class="btn btn-success" ng-show="info.ccsj2" ng-click="ctrl.goEditForm(4, info)">
113 113 <span ng-bind="info.ccsj2"></span>
114 114 </a>
115 115 </td>
116 116 <td>
117   - <a class="btn btn-success" ng-show="info.jsy2Gh">
  117 + <a class="btn btn-info" ng-show="info.jsy2Gh" ng-click="ctrl.goEditForm(5, info)">
118 118 <span ng-bind="info.jsy2Gh"></span>
119 119 </a>
120 120 </td>
121 121 <td>
122   - <a class="btn btn-success" ng-show="info.jsy2Name">
  122 + <a class="btn btn-info" ng-show="info.jsy2Name" ng-click="ctrl.goEditForm(5, info)">
123 123 <span ng-bind="info.jsy2Name"></span>
124 124 </a>
125 125 </td>
126 126 <td>
127   - <a class="btn btn-success" ng-show="info.spy2Gh">
  127 + <a class="btn btn-info" ng-show="info.spy2Gh" ng-click="ctrl.goEditForm(5, info)">
128 128 <span ng-bind="info.spy2Gh"></span>
129 129 </a>
130 130 </td>
131 131 <td>
132   - <a class="btn btn-success" ng-show="info.spy2Name">
  132 + <a class="btn btn-info" ng-show="info.spy2Name" ng-click="ctrl.goEditForm(5, info)">
133 133 <span ng-bind="info.spy2Name"></span>
134 134 </a>
135 135 </td>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js
1 1 // 调度值勤日报管理 service controller 等写在一起
2 2 // TODO:使用的global服务需要修正
3   -angular.module('ScheduleApp').factory('SchedulePlanReportManageService', ['SchedulePlanManageService_g', function(service) {
  3 +angular.module('ScheduleApp').factory('SchedulePlanReportManageService', [
  4 + 'SchedulePlanInfoManageService_g', 'SchedulePlanManageService_g',
  5 + function(service, service2) {
4 6 /** 当前的查询条件信息 */
5 7 var currentSearchCondition = {};
6 8  
... ... @@ -56,6 +58,17 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanReportManageService&#39;, [&#39;Sched
56 58 */
57 59 saveDetail: function(obj) {
58 60 return service.save(obj).$promise;
  61 + },
  62 + /**
  63 + * 更新分组信息。
  64 + * @param obj
  65 + * @returns {*|Function|promise|n}
  66 + */
  67 + updateDetail: function(obj) {
  68 + return service.updateGroupInfo.update(obj).$promise;
  69 + },
  70 + tommorwPlan: function() {
  71 + return service2.tommorw.list().$promise;
59 72 }
60 73 };
61 74  
... ... @@ -88,16 +101,6 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;SchedulePlanReportManageListCtrl&#39;, [
88 101 self.scheduleDateOpen = true;
89 102 };
90 103  
91   - // 初始创建的时候,获取一次列表数据
92   - schedulePlanReportManageService.getPage().then(
93   - function(result) {
94   - self.pageInfo.infos = result;
95   - },
96   - function(result) {
97   - alert("出错啦!");
98   - }
99   - );
100   -
101 104 // 翻页的时候调用
102 105 self.pageChanaged = function() {
103 106 schedulePlanReportManageService.getPage().then(
... ... @@ -133,21 +136,87 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;SchedulePlanReportManageListCtrl&#39;, [
133 136 true
134 137 );
135 138  
136   - // 切换到修改页面
137   - self.goEditForm = function() {
138   - //$state.go("schedulePlanReportManage_edit");
139   - }
  139 + /**
  140 + * ui-route中param不定义在template-url后,定义在params参数对象中
  141 + * 参数说明,type=更新方式,groupInfo=分组排班信息
  142 + * @param type 1=替换车辆,2=修改出场班次1,3=替换分组人员(驾驶员1和售票员1)
  143 + // 有分班的话,4=修改出场班次2,5=修改分组人员(驾驶员2和售票员2)
  144 + * @param groupInfo 列表单条数据,表示每条线路,每天,每个路牌谁跑的
  145 + */
  146 + self.goEditForm = function(type, groupInfo) {
  147 + $state.go("schedulePlanReportManage_edit", {
  148 + type: type,
  149 + groupInfo: groupInfo
  150 + });
  151 + };
  152 +
  153 +
  154 + // 初始创建的时候,获取一次列表数据
  155 + schedulePlanReportManageService.tommorwPlan().then(
  156 + function(result) {
  157 + self.searchCondition().xlid = result.xl.id;
  158 + var dd = new Date();
  159 + dd.setHours(0);
  160 + dd.setMinutes(0);
  161 + dd.setSeconds(0);
  162 + dd.setMilliseconds(0);
  163 + dd.setTime(dd.getTime() + 24 * 3600 * 1000);
  164 + self.searchCondition().sdate = dd;
  165 + self.pageChanaged();
  166 + },
  167 + function(result) {
  168 + self.pageChanaged();
  169 + }
  170 + );
140 171  
141 172 }
142 173 ]);
143 174  
144   -angular.module('ScheduleApp').controller('SchedulePlanReportManageFormCtrl', ['SchedulePlanReportManageService', '$stateParams', '$state', function(schedulePlanReportManageService, $stateParams, $state) {
145   - // TODO:
146   -}]);
147   -
148   -angular.module('ScheduleApp').controller('SchedulePlanReportManageDetailCtrl', ['SchedulePlanReportManageService', '$stateParams', function(schedulePlanReportManageService, $stateParams) {
149   - // TODO:
150   -}]);
  175 +angular.module('ScheduleApp').controller('SchedulePlanReportManageFormCtrl', [
  176 + 'SchedulePlanReportManageService',
  177 + '$stateParams',
  178 + '$state',
  179 + function(schedulePlanReportManageService, $stateParams, $state) {
  180 + var self = this;
151 181  
  182 + // 传过来的值
  183 + var type_src = $stateParams.type;
  184 + var groupInfo_src = $stateParams.groupInfo;
  185 +
  186 + // 时间正则表达式(格式hh:mm,如:06:39)
  187 + self.time_regex = /^(([0-1]\d)|(2[0-4])):[0-5]\d$/;
  188 +
  189 + // 欲修改的groupInfo值
  190 + self.groupInfo_src = groupInfo_src;
  191 + self.groupInfo = {};
  192 + self.type = type_src;
  193 + angular.copy(groupInfo_src, self.groupInfo);
  194 +
  195 + // 提交方法
  196 + self.submit = function() {
  197 + var param = {
  198 + type: self.type,
  199 + src: self.groupInfo_src,
  200 + update: self.groupInfo
  201 + };
  202 + schedulePlanReportManageService.updateDetail(param).then(
  203 + function(result) {
  204 + if (result.status == 'SUCCESS') {
  205 + alert("保存成功!");
  206 + $state.go("schedulePlanReportManage");
  207 + } else {
  208 + alert("保存异常!");
  209 + }
  210 + },
  211 + function(result) {
  212 + alert("出错啦!");
  213 + }
  214 + );
  215 + }
152 216  
  217 + }
  218 +]);
153 219  
  220 +angular.module('ScheduleApp').controller('SchedulePlanReportManageDetailCtrl', ['SchedulePlanReportManageService', '$stateParams', function(schedulePlanReportManageService, $stateParams) {
  221 + // TODO:
  222 +}]);
154 223 \ No newline at end of file
... ...