作者 王勇

所有代码,进行格式化

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