Commit cae18a658eaae1de0f013d2bffad285918821013

Authored by 徐烜
2 parents d0f27f74 f1a53c28

Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang

Too many changes to show.

To preserve performance only 9 of 22 files are displayed.

src/main/java/com/bsth/common/Constants.java
@@ -20,7 +20,7 @@ public class Constants { @@ -20,7 +20,7 @@ public class Constants {
20 public static final String METRONIC_URL = "/metronic_v4.5.4/**"; 20 public static final String METRONIC_URL = "/metronic_v4.5.4/**";
21 public static final String LOGIN_FAILURE = "/user/loginFailure"; 21 public static final String LOGIN_FAILURE = "/user/loginFailure";
22 public static final String CAPTCHA = "/captcha.jpg"; 22 public static final String CAPTCHA = "/captcha.jpg";
23 - 23 +
24 /** 24 /**
25 * 线调部分子页面不做拦截,便于浏览器缓存 25 * 线调部分子页面不做拦截,便于浏览器缓存
26 */ 26 */
@@ -29,7 +29,7 @@ public class Constants { @@ -29,7 +29,7 @@ public class Constants {
29 //public static final String XD_TEMPS = "/pages/control/line/temps/**"; 29 //public static final String XD_TEMPS = "/pages/control/line/temps/**";
30 30
31 //车载网关上行接口 31 //车载网关上行接口
32 - public static final String UPSTREAM_URL = "/control/upstream"; 32 + public static final String UPSTREAM_URL = "/control/upstream/";
33 33
34 public static final String SESSION_USERNAME = "sessionUserName"; 34 public static final String SESSION_USERNAME = "sessionUserName";
35 public static final String COMPANY_AUTHORITYS = "cmyAuths"; 35 public static final String COMPANY_AUTHORITYS = "cmyAuths";
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
@@ -238,11 +238,11 @@ public class GeoCacheData { @@ -238,11 +238,11 @@ public class GeoCacheData {
238 238
239 private void loadSpeedLimit(){ 239 private void loadSpeedLimit(){
240 //加载线路限速信息 240 //加载线路限速信息
241 - String sql = "select l.LINE_CODE,i.SPEED_LIMIT from bsth_c_line_information i left join bsth_c_line l on i.line=l.id where i.speed_limit is not null"; 241 + String sql = "select l.LINE_CODE,i.SPEEDING from bsth_c_line_information i left join bsth_c_line l on i.line=l.id where i.speed_limit is not null";
242 List<Map<String, Object>> speedMap = jdbcTemplate.queryForList(sql); 242 List<Map<String, Object>> speedMap = jdbcTemplate.queryForList(sql);
243 Map<String, Double> speedTempMap = new HashMap<>(); 243 Map<String, Double> speedTempMap = new HashMap<>();
244 for (Map<String, Object> tMap : speedMap) { 244 for (Map<String, Object> tMap : speedMap) {
245 - speedTempMap.put(tMap.get("LINE_CODE").toString(), Double.parseDouble(tMap.get("SPEED_LIMIT").toString())); 245 + speedTempMap.put(tMap.get("LINE_CODE").toString(), Double.parseDouble(tMap.get("SPEEDING").toString()));
246 } 246 }
247 speedLimitMap = speedTempMap; 247 speedLimitMap = speedTempMap;
248 } 248 }
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -87,6 +87,10 @@ public class ScheduleRealInfo { @@ -87,6 +87,10 @@ public class ScheduleRealInfo {
87 private Integer bcs; 87 private Integer bcs;
88 /** 计划里程 */ 88 /** 计划里程 */
89 private Double jhlc; 89 private Double jhlc;
  90 +
  91 + /** 实际里程 */
  92 + @Transient
  93 + private String sjlc;
90 /** 班次历时 */ 94 /** 班次历时 */
91 private Integer bcsj; 95 private Integer bcsj;
92 96
@@ -447,6 +451,14 @@ public class ScheduleRealInfo { @@ -447,6 +451,14 @@ public class ScheduleRealInfo {
447 public void setJhlc(Double jhlc) { 451 public void setJhlc(Double jhlc) {
448 this.jhlc = jhlc; 452 this.jhlc = jhlc;
449 } 453 }
  454 +
  455 + public String getSjlc() {
  456 + return sjlc;
  457 + }
  458 +
  459 + public void setSjlc(String sjlc) {
  460 + this.sjlc = sjlc;
  461 + }
450 462
451 public Integer getBcsj() { 463 public Integer getBcsj() {
452 return bcsj; 464 return bcsj;
src/main/java/com/bsth/filter/BaseFilter.java
1 package com.bsth.filter; 1 package com.bsth.filter;
2 2
3 -import java.io.IOException;  
4 -  
5 -import javax.servlet.Filter;  
6 -import javax.servlet.FilterChain;  
7 -import javax.servlet.FilterConfig;  
8 -import javax.servlet.ServletException;  
9 -import javax.servlet.ServletRequest;  
10 -import javax.servlet.ServletResponse;  
11 -import javax.servlet.http.HttpServletRequest;  
12 -import javax.servlet.http.HttpServletResponse;  
13 - 3 +import com.bsth.common.Constants;
14 import org.springframework.util.AntPathMatcher; 4 import org.springframework.util.AntPathMatcher;
15 import org.springframework.util.PathMatcher; 5 import org.springframework.util.PathMatcher;
16 6
17 -import com.bsth.common.Constants; 7 +import javax.servlet.*;
  8 +import javax.servlet.http.HttpServletRequest;
  9 +import javax.servlet.http.HttpServletResponse;
  10 +import java.io.IOException;
18 11
19 public abstract class BaseFilter implements Filter { 12 public abstract class BaseFilter implements Filter {
20 13
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -82,13 +82,13 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -82,13 +82,13 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
82 + " and clZbh like %?5% order by s.fcsj") 82 + " and clZbh like %?5% order by s.fcsj")
83 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); 83 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
84 84
85 - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsjActual") 85 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj")
86 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); 86 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
87 87
88 - @Query(value="select s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsjActual") 88 + @Query(value="select s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj")
89 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line); 89 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
90 90
91 - @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsjActual") 91 + @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsj")
92 List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date); 92 List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date);
93 93
94 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs") 94 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs")
@@ -110,7 +110,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -110,7 +110,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
110 void deleteByLineCodeAndDate(String xlBm, String schDate); 110 void deleteByLineCodeAndDate(String xlBm, String schDate);
111 111
112 //去掉了 xlBm is not null 112 //去掉了 xlBm is not null
113 - @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlBm") 113 + @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.fcsj")
114 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); 114 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
115 115
116 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm") 116 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
src/main/java/com/bsth/security/WebSecurityConfig.java
@@ -22,69 +22,69 @@ import com.bsth.security.filter.LoginInterceptor; @@ -22,69 +22,69 @@ import com.bsth.security.filter.LoginInterceptor;
22 @EnableWebSecurity 22 @EnableWebSecurity
23 public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 23 public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
24 24
25 - @Autowired  
26 - UserDetailServiceImpl customUserDetailService; 25 + @Autowired
  26 + UserDetailServiceImpl customUserDetailService;
27 27
28 - @Autowired  
29 - CustomAccessDecisionManager customAccessDecisionManager; 28 + @Autowired
  29 + CustomAccessDecisionManager customAccessDecisionManager;
30 30
31 - @Autowired  
32 - SecurityMetadataSourceService securityMetadataSourceService; 31 + @Autowired
  32 + SecurityMetadataSourceService securityMetadataSourceService;
  33 +
  34 +
  35 + @Override
  36 + public void configure(WebSecurity web) throws Exception {
  37 + // 白名单
  38 + web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
  39 + Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS);
  40 + }
  41 +
  42 + @Override
  43 + protected void configure(AuthenticationManagerBuilder auth)
  44 + throws Exception {
  45 + auth.userDetailsService(customUserDetailService).passwordEncoder(
  46 + new BCryptPasswordEncoder(4));
  47 + }
  48 +
  49 + @Override
  50 + protected void configure(HttpSecurity http) throws Exception {
  51 + http.authorizeRequests().antMatchers("/").permitAll().anyRequest()
  52 + .authenticated().and()
  53 + .formLogin()
  54 + //指定登录页
  55 + .loginPage(Constants.LOGIN_PAGE)
  56 + .loginProcessingUrl(Constants.LOGIN).permitAll()
  57 + //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接
  58 + //.successHandler(loginSuccessHandler())登录成功后处理
  59 + .and().logout()
  60 + //.addLogoutHandler(logoutHandler())
  61 + //禁用CXRF
  62 + .and().csrf().disable()
  63 + //禁用匿名用户功能
  64 + .anonymous().disable();
  65 +
  66 + // 同时只保持一个回话
  67 + http.sessionManagement().maximumSessions(1)
  68 + .expiredUrl(Constants.LOGIN_PAGE + "?error=true")
  69 + .maxSessionsPreventsLogin(false)//让之前的登录过期
  70 + .sessionRegistry(sessionRegistry());
  71 +
  72 + http.addFilterBefore(new LoginInterceptor(), FilterSecurityInterceptor.class);
  73 + http.addFilter(filterSecurityInterceptor());
  74 + }
  75 +
  76 + private FilterSecurityInterceptor filterSecurityInterceptor()
  77 + throws Exception {
  78 + FilterSecurityInterceptor filterSecurityInterceptor = new FilterSecurityInterceptor();
  79 + filterSecurityInterceptor
  80 + .setAccessDecisionManager(customAccessDecisionManager);
  81 + filterSecurityInterceptor
  82 + .setSecurityMetadataSource(securityMetadataSourceService);
  83 + filterSecurityInterceptor
  84 + .setAuthenticationManager(authenticationManager());
  85 + return filterSecurityInterceptor;
  86 + }
33 87
34 -  
35 - @Override  
36 - public void configure(WebSecurity web) throws Exception {  
37 - // 白名单  
38 - web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,  
39 - Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES);  
40 - }  
41 -  
42 - @Override  
43 - protected void configure(AuthenticationManagerBuilder auth)  
44 - throws Exception {  
45 - auth.userDetailsService(customUserDetailService).passwordEncoder(  
46 - new BCryptPasswordEncoder(4));  
47 - }  
48 -  
49 - @Override  
50 - protected void configure(HttpSecurity http) throws Exception {  
51 - http.authorizeRequests().antMatchers("/").permitAll().anyRequest()  
52 - .authenticated().and()  
53 - .formLogin()  
54 - //指定登录页  
55 - .loginPage(Constants.LOGIN_PAGE)  
56 - .loginProcessingUrl(Constants.LOGIN).permitAll()  
57 - //.failureUrl(Constants.LOGIN_PAGE + "?error=true")登录失败跳转的链接  
58 - //.successHandler(loginSuccessHandler())登录成功后处理  
59 - .and().logout()  
60 - //.addLogoutHandler(logoutHandler())  
61 - //禁用CXRF  
62 - .and().csrf().disable()  
63 - //禁用匿名用户功能  
64 - .anonymous().disable();  
65 -  
66 - // 同时只保持一个回话  
67 - http.sessionManagement().maximumSessions(1)  
68 - .expiredUrl(Constants.LOGIN_PAGE + "?error=true")  
69 - .maxSessionsPreventsLogin(false)//让之前的登录过期  
70 - .sessionRegistry(sessionRegistry());  
71 -  
72 - http.addFilterBefore(new LoginInterceptor(), FilterSecurityInterceptor.class);  
73 - http.addFilter(filterSecurityInterceptor());  
74 - }  
75 -  
76 - private FilterSecurityInterceptor filterSecurityInterceptor()  
77 - throws Exception {  
78 - FilterSecurityInterceptor filterSecurityInterceptor = new FilterSecurityInterceptor();  
79 - filterSecurityInterceptor  
80 - .setAccessDecisionManager(customAccessDecisionManager);  
81 - filterSecurityInterceptor  
82 - .setSecurityMetadataSource(securityMetadataSourceService);  
83 - filterSecurityInterceptor  
84 - .setAuthenticationManager(authenticationManager());  
85 - return filterSecurityInterceptor;  
86 - }  
87 -  
88 /* @Bean 88 /* @Bean
89 public LoginSuccessHandler loginSuccessHandler(){ 89 public LoginSuccessHandler loginSuccessHandler(){
90 return new LoginSuccessHandler(); 90 return new LoginSuccessHandler();
@@ -95,15 +95,15 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -95,15 +95,15 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
95 return new CustomLogoutHandler(); 95 return new CustomLogoutHandler();
96 }*/ 96 }*/
97 97
98 - @Bean  
99 - public SessionRegistry sessionRegistry() {  
100 - SessionRegistry sessionRegistry = new SessionRegistryImpl();  
101 - return sessionRegistry;  
102 - }  
103 -  
104 - @Bean  
105 - public static ServletListenerRegistrationBean<HttpSessionEventPublisher> httpSessionEventPublisher() {  
106 - return new ServletListenerRegistrationBean<HttpSessionEventPublisher>(  
107 - new HttpSessionEventPublisher());  
108 - } 98 + @Bean
  99 + public SessionRegistry sessionRegistry() {
  100 + SessionRegistry sessionRegistry = new SessionRegistryImpl();
  101 + return sessionRegistry;
  102 + }
  103 +
  104 + @Bean
  105 + public static ServletListenerRegistrationBean<HttpSessionEventPublisher> httpSessionEventPublisher() {
  106 + return new ServletListenerRegistrationBean<HttpSessionEventPublisher>(
  107 + new HttpSessionEventPublisher());
  108 + }
109 } 109 }
src/main/java/com/bsth/security/filter/LoginInterceptor.java
1 package com.bsth.security.filter; 1 package com.bsth.security.filter;
2 2
3 -import java.io.IOException;  
4 -import java.util.HashMap;  
5 -import java.util.Map; 3 +import com.alibaba.fastjson.JSON;
  4 +import com.bsth.common.Constants;
  5 +import com.bsth.common.ResponseCode;
  6 +import com.bsth.filter.BaseFilter;
  7 +import com.bsth.util.RequestUtils;
  8 +import org.springframework.security.core.Authentication;
  9 +import org.springframework.security.core.context.SecurityContextHolder;
6 10
7 -import javax.servlet.Filter;  
8 import javax.servlet.FilterChain; 11 import javax.servlet.FilterChain;
9 -import javax.servlet.FilterConfig;  
10 import javax.servlet.ServletException; 12 import javax.servlet.ServletException;
11 import javax.servlet.ServletRequest; 13 import javax.servlet.ServletRequest;
12 import javax.servlet.ServletResponse; 14 import javax.servlet.ServletResponse;
13 import javax.servlet.http.HttpServletRequest; 15 import javax.servlet.http.HttpServletRequest;
14 import javax.servlet.http.HttpServletResponse; 16 import javax.servlet.http.HttpServletResponse;
15 -  
16 -import org.springframework.security.access.SecurityMetadataSource;  
17 -import org.springframework.security.access.intercept.AbstractSecurityInterceptor;  
18 -import org.springframework.security.core.Authentication;  
19 -import org.springframework.security.core.context.SecurityContextHolder;  
20 -  
21 -import com.alibaba.fastjson.JSON;  
22 -import com.bsth.common.Constants;  
23 -import com.bsth.common.ResponseCode;  
24 -import com.bsth.util.RequestUtils; 17 +import java.io.IOException;
  18 +import java.util.HashMap;
  19 +import java.util.Map;
25 20
26 /** 21 /**
27 * 22 *
@@ -31,7 +26,7 @@ import com.bsth.util.RequestUtils; @@ -31,7 +26,7 @@ import com.bsth.util.RequestUtils;
31 * @date 2016年3月24日 上午11:49:20 26 * @date 2016年3月24日 上午11:49:20
32 * 27 *
33 */ 28 */
34 -public class LoginInterceptor extends AbstractSecurityInterceptor implements Filter{ 29 +public class LoginInterceptor extends BaseFilter{
35 30
36 @Override 31 @Override
37 public void destroy() { 32 public void destroy() {
@@ -63,22 +58,4 @@ public class LoginInterceptor extends AbstractSecurityInterceptor implements Fil @@ -63,22 +58,4 @@ public class LoginInterceptor extends AbstractSecurityInterceptor implements Fil
63 58
64 arg2.doFilter(arg0, arg1); 59 arg2.doFilter(arg0, arg1);
65 } 60 }
66 -  
67 - @Override  
68 - public void init(FilterConfig arg0) throws ServletException {  
69 -  
70 - }  
71 -  
72 - @Override  
73 - public Class<?> getSecureObjectClass() {  
74 - // TODO Auto-generated method stub  
75 - return null;  
76 - }  
77 -  
78 - @Override  
79 - public SecurityMetadataSource obtainSecurityMetadataSource() {  
80 - // TODO Auto-generated method stub  
81 - return null;  
82 - }  
83 -  
84 } 61 }
src/main/java/com/bsth/security/util/SecurityUtils.java
1 package com.bsth.security.util; 1 package com.bsth.security.util;
2 2
3 -import javax.servlet.http.HttpServletRequest;  
4 - 3 +import com.bsth.entity.sys.Role;
  4 +import com.bsth.entity.sys.SecurityUser;
  5 +import com.bsth.entity.sys.SysUser;
5 import org.slf4j.Logger; 6 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
7 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 8 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
  9 +import org.springframework.security.core.GrantedAuthority;
  10 +import org.springframework.security.core.authority.SimpleGrantedAuthority;
8 import org.springframework.security.core.context.SecurityContext; 11 import org.springframework.security.core.context.SecurityContext;
9 import org.springframework.security.core.context.SecurityContextHolder; 12 import org.springframework.security.core.context.SecurityContextHolder;
10 13
11 -import com.bsth.entity.sys.SecurityUser;  
12 -import com.bsth.entity.sys.SysUser; 14 +import javax.servlet.http.HttpServletRequest;
  15 +import java.util.ArrayList;
  16 +import java.util.List;
  17 +import java.util.Set;
13 18
14 /** 19 /**
15 - *  
16 - * @ClassName: SecurityUtils  
17 - * @author PanZhao  
18 - * @date 2016年3月30日 上午11:28:24  
19 - * 20 + * @author PanZhao
  21 + * @ClassName: SecurityUtils
  22 + * @date 2016年3月30日 上午11:28:24
20 */ 23 */
21 public class SecurityUtils { 24 public class SecurityUtils {
22 -  
23 - static Logger logger = LoggerFactory.getLogger(SecurityUtils.class);  
24 -  
25 - /**  
26 - *  
27 - * @Title: getCurrentUser  
28 - * @Description: TODO(获取当前用户)  
29 - * @return SysUser 返回类型  
30 - * @throws  
31 - */  
32 - public static SysUser getCurrentUser(){  
33 - SysUser user = null;  
34 - try{  
35 - user = (SysUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();  
36 - }catch(Exception e){  
37 - logger.error("", e);  
38 - }  
39 - return user;  
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 - } 25 +
  26 + static Logger logger = LoggerFactory.getLogger(SecurityUtils.class);
  27 +
  28 + /**
  29 + * @return SysUser 返回类型
  30 + * @throws
  31 + * @Title: getCurrentUser
  32 + * @Description: TODO(获取当前用户)
  33 + */
  34 + public static SysUser getCurrentUser() {
  35 + SysUser user = null;
  36 + try {
  37 + user = (SysUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
  38 + } catch (Exception e) {
  39 + logger.error("", e);
  40 + }
  41 + return user;
  42 + }
  43 +
  44 + public static void login(SysUser user, HttpServletRequest request) {
  45 + SecurityUser securityUser = new SecurityUser(user);
  46 + SecurityContext sContext = SecurityContextHolder.getContext();
  47 +
  48 + List<GrantedAuthority> grantedAuths = new ArrayList<>();
  49 + Set<Role> set = user.getRoles();
  50 + for(Role r : set){
  51 + grantedAuths.add(new SimpleGrantedAuthority(r.getCodeName()));
  52 + }
  53 +
  54 + sContext.setAuthentication(new UsernamePasswordAuthenticationToken(securityUser, securityUser.getAuthorities(), grantedAuths));
  55 + request.getSession(true).setAttribute("SPRING_SECURITY_CONTEXT", sContext);
  56 + }
49 } 57 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1866,7 +1866,45 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1866,7 +1866,45 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1866 } 1866 }
1867 } 1867 }
1868 }*/ 1868 }*/
1869 - return scheduleRealInfoRepository.scheduleByDateAndLine(line, date); 1869 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  1870 + String lpName="lpName";
  1871 + String zdsj="";
  1872 + String zdsjActual="";
  1873 + String zdsj1="";
  1874 + String zdsjActual1="";
  1875 + List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1876 + for (int i = 0; i < listInfo.size(); i++) {
  1877 + ScheduleRealInfo t=listInfo.get(i);
  1878 + if(!lpName.equals(t.getLpName())){
  1879 + zdsjActual=t.getZdsjActual();
  1880 + zdsj=t.getZdsj();
  1881 + t.setZdsjActual("");
  1882 + t.setZdsj("");
  1883 + }else{
  1884 + zdsj1=t.getZdsj();
  1885 + zdsjActual1=t.getZdsjActual();
  1886 + t.setZdsjActual(zdsjActual);
  1887 + t.setZdsj(zdsj);
  1888 + zdsj=zdsj1;
  1889 + zdsjActual=zdsjActual1;
  1890 + }
  1891 + /*if(i<listInfo.size()-1){
  1892 + if(s.getLpName().equals(listInfo.get(i+1).getLpName())){
  1893 + zdsj=s.getZdsj();
  1894 + zdsjActual=s.getZdsjActual();
  1895 + }else{
  1896 + zdsj="";
  1897 + zdsjActual="";
  1898 + }
  1899 + }else{
  1900 + zdsj=s.getZdsj();
  1901 + zdsjActual=s.getZdsjActual();
  1902 + }*/
  1903 +
  1904 + lpName=t.getLpName();
  1905 + list.add(t);
  1906 + }
  1907 + return list;
1870 } 1908 }
1871 1909
1872 1910
@@ -2576,6 +2614,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2576,6 +2614,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2576 @Override 2614 @Override
2577 public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) { 2615 public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) {
2578 // TODO Auto-generated method stub 2616 // TODO Auto-generated method stub
  2617 + DecimalFormat format = new DecimalFormat("0.00");
2579 List <ScheduleRealInfo> list=null; 2618 List <ScheduleRealInfo> list=null;
2580 list= scheduleRealInfoRepository.queryListWaybill2(clZbh,date,line); 2619 list= scheduleRealInfoRepository.queryListWaybill2(clZbh,date,line);
2581 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); 2620 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
@@ -2583,6 +2622,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2583,6 +2622,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2583 ScheduleRealInfo s=list.get(i); 2622 ScheduleRealInfo s=list.get(i);
2584 if(!(s.getBcType().equals("in")||s.getBcType().equals("out"))){ 2623 if(!(s.getBcType().equals("in")||s.getBcType().equals("out"))){
2585 String remarks=""; 2624 String remarks="";
  2625 + Double sjlc=0.0;
2586 if(s.getRemarks()!=null){ 2626 if(s.getRemarks()!=null){
2587 remarks +=s.getRemarks(); 2627 remarks +=s.getRemarks();
2588 } 2628 }
@@ -2595,8 +2635,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2595,8 +2635,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2595 remarks += c.getRemarks(); 2635 remarks += c.getRemarks();
2596 } 2636 }
2597 2637
  2638 + if(!c.isDestroy()){
  2639 + sjlc += c.getMileage()==null?0:c.getMileage();
  2640 + }
  2641 +
  2642 + }
  2643 + }else{
  2644 + if(s.getStatus() != -1){
  2645 + sjlc =s.getJhlc();
2598 } 2646 }
2599 } 2647 }
  2648 + s.setSjlc(format.format(sjlc));
2600 s.setRemarks(remarks); 2649 s.setRemarks(remarks);
2601 newList.add(s); 2650 newList.add(s);
2602 } 2651 }