作者 王勇

所有代码,进行格式化

@@ -15,9 +15,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur @@ -15,9 +15,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
15 public class SecurityConfig extends WebSecurityConfigurerAdapter { 15 public class SecurityConfig extends WebSecurityConfigurerAdapter {
16 @Override 16 @Override
17 protected void configure(HttpSecurity http) throws Exception { 17 protected void configure(HttpSecurity http) throws Exception {
18 - //首页所有人可以访问,功能页只有对应的权限才能访问,本地测试使用  
19 -// http.authorizeRequests()  
20 -// .antMatchers("/").permitAll();  
21 http.csrf().disable(); 18 http.csrf().disable();
22 } 19 }
23 } 20 }
@@ -55,6 +55,7 @@ public class SwaggerConfig { @@ -55,6 +55,7 @@ public class SwaggerConfig {
55 55
56 /** 56 /**
57 * 配置swagger信息==apiInfo 57 * 配置swagger信息==apiInfo
  58 + *
58 * @return 59 * @return
59 */ 60 */
60 private ApiInfo apiInfo() { 61 private ApiInfo apiInfo() {
@@ -37,10 +37,10 @@ public class CompanyInfoController { @@ -37,10 +37,10 @@ public class CompanyInfoController {
37 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { 37 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
38 ResultJson<PageInfo> result = new ResultJson<>(); 38 ResultJson<PageInfo> result = new ResultJson<>();
39 CompanyInfo companyInfo = new CompanyInfo(); 39 CompanyInfo companyInfo = new CompanyInfo();
40 - if("".equals(companyName)){ 40 + if ("".equals(companyName)) {
41 companyInfo.setCompanyName(companyName); 41 companyInfo.setCompanyName(companyName);
42 } 42 }
43 - if("".equals(companyMobile)){ 43 + if ("".equals(companyMobile)) {
44 companyInfo.setCompanyMobile(companyMobile); 44 companyInfo.setCompanyMobile(companyMobile);
45 } 45 }
46 PageInfo pageInfo = companyInfoService.selectCompanyInfoList(companyInfo, pageNum, pageSize); 46 PageInfo pageInfo = companyInfoService.selectCompanyInfoList(companyInfo, pageNum, pageSize);
@@ -151,6 +151,7 @@ public class DispatchNoteController { @@ -151,6 +151,7 @@ public class DispatchNoteController {
151 } 151 }
152 return result; 152 return result;
153 } 153 }
  154 +
154 @InitBinder 155 @InitBinder
155 public void initBinder(WebDataBinder binder) { 156 public void initBinder(WebDataBinder binder) {
156 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 157 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -24,9 +24,9 @@ public class GetUserController { @@ -24,9 +24,9 @@ public class GetUserController {
24 private GetUserFegin getUserFegin; 24 private GetUserFegin getUserFegin;
25 25
26 @GetMapping("/user/getUser") 26 @GetMapping("/user/getUser")
27 - public ResultJson<PageInfo> getUser(@RequestParam(value = "userName", required = false) String userName, HttpServletRequest request){ 27 + public ResultJson<PageInfo> getUser(@RequestParam(value = "userName", required = false) String userName, HttpServletRequest request) {
28 String token = request.getHeader("Authorization"); 28 String token = request.getHeader("Authorization");
29 - System.out.println(userName+"的token是"+token);  
30 - return getUserFegin.list(userName,token); 29 + System.out.println(userName + "的token是" + token);
  30 + return getUserFegin.list(userName, token);
31 } 31 }
32 } 32 }
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
13 * Description: 13 * Description:
14 * 时间:2020/5/8 16:06 14 * 时间:2020/5/8 16:06
15 */ 15 */
16 -@FeignClient(value = "cloud-user-center",fallback = GetUserFeginHystrix.class) 16 +@FeignClient(value = "cloud-user-center", fallback = GetUserFeginHystrix.class)
17 @Service 17 @Service
18 public interface GetUserFegin { 18 public interface GetUserFegin {
19 /** 19 /**
@@ -13,10 +13,10 @@ import org.springframework.web.client.RestTemplate; @@ -13,10 +13,10 @@ import org.springframework.web.client.RestTemplate;
13 * 时间:2020/5/8 19:06 13 * 时间:2020/5/8 19:06
14 */ 14 */
15 @Service 15 @Service
16 -public class GetUserFeginHystrix implements GetUserFegin{ 16 +public class GetUserFeginHystrix implements GetUserFegin {
17 17
18 @Override 18 @Override
19 - public ResultJson<PageInfo> list(String userName,String token) { 19 + public ResultJson<PageInfo> list(String userName, String token) {
20 System.out.println("与 CLOUD-USER-CENTER 服务断开连接"); 20 System.out.println("与 CLOUD-USER-CENTER 服务断开连接");
21 // throw new RuntimeException(); 21 // throw new RuntimeException();
22 return null; 22 return null;
@@ -18,6 +18,7 @@ public interface VehicleInfoMapper { @@ -18,6 +18,7 @@ public interface VehicleInfoMapper {
18 18
19 /** 19 /**
20 * 调度车辆方法 20 * 调度车辆方法
  21 + *
21 * @param record 22 * @param record
22 * @return 23 * @return
23 */ 24 */
@@ -34,6 +34,7 @@ public class ResultJson<T> implements Serializable { @@ -34,6 +34,7 @@ public class ResultJson<T> implements Serializable {
34 * JWT令牌 34 * JWT令牌
35 */ 35 */
36 private String jwtToken; 36 private String jwtToken;
  37 +
37 /** 38 /**
38 * 无参,构造方法 39 * 无参,构造方法
39 */ 40 */
@@ -47,6 +48,7 @@ public class ResultJson<T> implements Serializable { @@ -47,6 +48,7 @@ public class ResultJson<T> implements Serializable {
47 public ResultJson(String code) { 48 public ResultJson(String code) {
48 this.code = code; 49 this.code = code;
49 } 50 }
  51 +
50 public ResultJson(T data) { 52 public ResultJson(T data) {
51 this.data = data; 53 this.data = data;
52 } 54 }
@@ -36,11 +36,11 @@ public class CompanyInfoServiceImpl implements CompanyInfoService { @@ -36,11 +36,11 @@ public class CompanyInfoServiceImpl implements CompanyInfoService {
36 */ 36 */
37 @Override 37 @Override
38 public PageInfo selectCompanyInfoList(CompanyInfo companyInfo, Integer pageNum, Integer pageSize) { 38 public PageInfo selectCompanyInfoList(CompanyInfo companyInfo, Integer pageNum, Integer pageSize) {
39 - /* 获取,公司信息列表 */  
40 - List<CompanyInfo> companyInfoList = companyInfoMapper.selectCompanyInfoList(companyInfo);  
41 /* 使用 PageHelper 分页插件 */ 39 /* 使用 PageHelper 分页插件 */
42 PageHelper.startPage(pageNum, pageSize); 40 PageHelper.startPage(pageNum, pageSize);
43 - PageInfo<VehicleInfo> pageInfo = new PageInfo(companyInfoList); 41 + /* 获取,公司信息列表 */
  42 + List<CompanyInfo> companyInfoList = companyInfoMapper.selectCompanyInfoList(companyInfo);
  43 + PageInfo<CompanyInfo> pageInfo = new PageInfo(companyInfoList);
44 return pageInfo; 44 return pageInfo;
45 } 45 }
46 46
@@ -26,11 +26,10 @@ public class DispatchNoteServiceImpl implements DispatchNoteService { @@ -26,11 +26,10 @@ public class DispatchNoteServiceImpl implements DispatchNoteService {
26 private DispatchNoteMapper dispatchNoteMapper; 26 private DispatchNoteMapper dispatchNoteMapper;
27 27
28 @Override 28 @Override
29 - public PageInfo selectDispatchNoteList(DispatchNote dispatchNote, Integer pageNum, Integer pageSize) {  
30 - List<DispatchNote> dispatchNoteList = dispatchNoteMapper.selectVehicleInfoList(dispatchNote);  
31 - //使用pagehelper 29 + public PageInfo<DispatchNote> selectDispatchNoteList(DispatchNote dispatchNote, Integer pageNum, Integer pageSize) {
32 PageHelper.startPage(pageNum, pageSize); 30 PageHelper.startPage(pageNum, pageSize);
33 - PageInfo<VehicleInfo> pageInfo = new PageInfo(dispatchNoteList); 31 + List<DispatchNote> dispatchNoteList = dispatchNoteMapper.selectVehicleInfoList(dispatchNote);
  32 + PageInfo<DispatchNote> pageInfo = new PageInfo<>(dispatchNoteList);
34 return pageInfo; 33 return pageInfo;
35 } 34 }
36 35
@@ -29,10 +29,10 @@ public class DriverInfoServiceImpl implements DriverInfoService { @@ -29,10 +29,10 @@ public class DriverInfoServiceImpl implements DriverInfoService {
29 * 分页查询,驾驶员信息列表 29 * 分页查询,驾驶员信息列表
30 */ 30 */
31 @Override 31 @Override
32 - public PageInfo selectDriverInfoList(DriverInfo driverInfo, Integer pageNum, Integer pageSize) {  
33 - List<DriverInfo> driverInfoList = driverInfoMapper.selectDriverInfoList(driverInfo); 32 + public PageInfo<DriverInfo> selectDriverInfoList(DriverInfo driverInfo, Integer pageNum, Integer pageSize) {
34 PageHelper.startPage(pageNum, pageSize); 33 PageHelper.startPage(pageNum, pageSize);
35 - PageInfo<VehicleInfo> pageInfo = new PageInfo(driverInfoList); 34 + List<DriverInfo> driverInfoList = driverInfoMapper.selectDriverInfoList(driverInfo);
  35 + PageInfo<DriverInfo> pageInfo = new PageInfo<>(driverInfoList);
36 return pageInfo; 36 return pageInfo;
37 } 37 }
38 38
@@ -53,9 +53,9 @@ public class VehicleInfoServiceImpl implements VehicleInfoService { @@ -53,9 +53,9 @@ public class VehicleInfoServiceImpl implements VehicleInfoService {
53 */ 53 */
54 @Override 54 @Override
55 public PageInfo selectVehicleInfoList(VehicleInfo vehicleInfo, Integer pageNum, Integer pageSize) { 55 public PageInfo selectVehicleInfoList(VehicleInfo vehicleInfo, Integer pageNum, Integer pageSize) {
56 - List<VehicleInfo> vehicleInfoList = vehicleInfoMapper.selectVehicleInfoList(vehicleInfo);  
57 // 使用 PageHelper 分页插件 56 // 使用 PageHelper 分页插件
58 PageHelper.startPage(pageNum, pageSize); 57 PageHelper.startPage(pageNum, pageSize);
  58 + List<VehicleInfo> vehicleInfoList = vehicleInfoMapper.selectVehicleInfoList(vehicleInfo);
59 PageInfo<VehicleInfo> pageInfo = new PageInfo(vehicleInfoList); 59 PageInfo<VehicleInfo> pageInfo = new PageInfo(vehicleInfoList);
60 return pageInfo; 60 return pageInfo;
61 } 61 }
@@ -18,19 +18,20 @@ public class DateTimeUtils { @@ -18,19 +18,20 @@ public class DateTimeUtils {
18 18
19 /** 19 /**
20 * 获取年月日,date类型 20 * 获取年月日,date类型
  21 + *
21 * @param s 22 * @param s
22 * @return 23 * @return
23 */ 24 */
24 - public static Date getDate(String s){ 25 + public static Date getDate(String s) {
25 Date time = null; 26 Date time = null;
26 - if(s == null){ 27 + if (s == null) {
27 return time; 28 return time;
28 } 29 }
29 try { 30 try {
30 - if (s.length()>0){ 31 + if (s.length() > 0) {
31 time = simpleDateFormat.parse(s); 32 time = simpleDateFormat.parse(s);
32 } 33 }
33 - }catch (Exception e){ 34 + } catch (Exception e) {
34 e.printStackTrace(); 35 e.printStackTrace();
35 } 36 }
36 return time; 37 return time;
@@ -38,28 +39,30 @@ public class DateTimeUtils { @@ -38,28 +39,30 @@ public class DateTimeUtils {
38 39
39 /** 40 /**
40 * 获取年月日,String类型 41 * 获取年月日,String类型
  42 + *
41 * @param date 43 * @param date
42 * @return 44 * @return
43 */ 45 */
44 - public static String getDateString(Date date){ 46 + public static String getDateString(Date date) {
45 return simpleDateFormat.format(date); 47 return simpleDateFormat.format(date);
46 } 48 }
47 49
48 /** 50 /**
49 * 获取当前年月日时分秒,String类型 51 * 获取当前年月日时分秒,String类型
  52 + *
50 * @param date 53 * @param date
51 * @return 54 * @return
52 */ 55 */
53 - public static String getDateTimeString(Date date){ 56 + public static String getDateTimeString(Date date) {
54 return simpleDateTimeFormat.format(date); 57 return simpleDateTimeFormat.format(date);
55 } 58 }
56 59
57 - public static List getSeverDay(){ 60 + public static List getSeverDay() {
58 List<Date> dates = new ArrayList<>(); 61 List<Date> dates = new ArrayList<>();
59 Date date = new Date(); 62 Date date = new Date();
60 dates.add(date); 63 dates.add(date);
61 - for (int i=1;i<7;i++) {  
62 - long time = date.getTime() - i*24 * 3600 * 1000L; 64 + for (int i = 1; i < 7; i++) {
  65 + long time = date.getTime() - i * 24 * 3600 * 1000L;
63 Date preTime = new Date(time); 66 Date preTime = new Date(time);
64 dates.add(preTime); 67 dates.add(preTime);
65 } 68 }
@@ -8,7 +8,7 @@ import java.util.UUID; @@ -8,7 +8,7 @@ import java.util.UUID;
8 * 时间:2020/4/24 17:44 8 * 时间:2020/4/24 17:44
9 */ 9 */
10 public class GetUUID { 10 public class GetUUID {
11 - public static String getuuid(){ 11 + public static String getuuid() {
12 return UUID.randomUUID().toString().replaceAll("-", ""); 12 return UUID.randomUUID().toString().replaceAll("-", "");
13 } 13 }
14 } 14 }
@@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
4 <resultMap id="BaseResultMap" type="com.sunyo.wlpt.dispatch.domain.DispatchBusiness"> 4 <resultMap id="BaseResultMap" type="com.sunyo.wlpt.dispatch.domain.DispatchBusiness">
5 <!--@mbg.generated--> 5 <!--@mbg.generated-->
6 <!--@Table dispatch_business--> 6 <!--@Table dispatch_business-->
7 - <id column="id" jdbcType="VARCHAR" property="id" />  
8 - <result column="dispatch_type" jdbcType="VARCHAR" property="dispatchType" /> 7 + <id column="id" jdbcType="VARCHAR" property="id"/>
  8 + <result column="dispatch_type" jdbcType="VARCHAR" property="dispatchType"/>
9 </resultMap> 9 </resultMap>
10 <sql id="Base_Column_List"> 10 <sql id="Base_Column_List">
11 <!--@mbg.generated--> 11 <!--@mbg.generated-->
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> 14 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
15 <!--@mbg.generated--> 15 <!--@mbg.generated-->
16 select 16 select
17 - <include refid="Base_Column_List" /> 17 + <include refid="Base_Column_List"/>
18 from dispatch_business 18 from dispatch_business
19 where id = #{id,jdbcType=VARCHAR} 19 where id = #{id,jdbcType=VARCHAR}
20 </select> 20 </select>