Compare commits

..

No commits in common. "e3a0c8ef2b9eac58220a25f80b91a23016be0643" and "ed61a1bf83f1f34d7c7ce452bde27034d819fb48" have entirely different histories.

3 changed files with 7 additions and 27 deletions

View File

@ -1,30 +1,24 @@
package me.zhengjie.modules.front.rest; package me.zhengjie.modules.front.rest;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.annotation.Log; import me.zhengjie.annotation.Log;
import me.zhengjie.config.properties.FileProperties;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.front.domain.dto.LoginVo; import me.zhengjie.modules.front.domain.dto.LoginVo;
import me.zhengjie.modules.front.domain.dto.MyDeviceCriteria; import me.zhengjie.modules.front.domain.dto.MyDeviceCriteria;
import me.zhengjie.modules.security.service.dto.JwtUserDto; import me.zhengjie.modules.security.service.dto.JwtUserDto;
import me.zhengjie.modules.system.domain.BusDevice; import me.zhengjie.modules.system.domain.BusDevice;
import me.zhengjie.modules.system.domain.BusUser; import me.zhengjie.modules.system.domain.BusUser;
import me.zhengjie.modules.system.domain.dto.BusDeviceQueryCriteria;
import me.zhengjie.modules.system.service.BusDeviceService; import me.zhengjie.modules.system.service.BusDeviceService;
import me.zhengjie.modules.system.service.BusUserService; import me.zhengjie.modules.system.service.BusUserService;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageResult; import me.zhengjie.utils.PageResult;
import me.zhengjie.utils.SecurityUtils; import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
@Slf4j @Slf4j
@ -35,7 +29,6 @@ public class BusUserController {
@Autowired private BusUserService busUserService; @Autowired private BusUserService busUserService;
@Autowired private BusDeviceService busDeviceService; @Autowired private BusDeviceService busDeviceService;
@Autowired private FileProperties fileProperties;
@Log("我的设备") @Log("我的设备")
@GetMapping(value = "myDevice") @GetMapping(value = "myDevice")
@ -74,22 +67,6 @@ public class BusUserController {
return new ResponseEntity<>("修改成功", HttpStatus.OK); return new ResponseEntity<>("修改成功", HttpStatus.OK);
} }
@Log("上传图片")
@ApiOperation("上传图片")
@PostMapping(value = "/pictures")
public ResponseEntity<String> uploadPicture(@RequestParam MultipartFile file) {
// 判断文件是否为图片
String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){
throw new BadRequestException("只能上传图片");
}
String type = FileUtil.getFileType(suffix);
File uploadFile = FileUtil.upload(file, fileProperties.getPath().getPath() + type + File.separator);
if(ObjectUtil.isNull(uploadFile)){
throw new BadRequestException("上传失败");
}
return new ResponseEntity<>(file.getName(), HttpStatus.OK);
}
} }

View File

@ -94,6 +94,10 @@ public class SpringSecurityConfig {
"/**/*.js", "/**/*.js",
"/webSocket/**" "/webSocket/**"
).permitAll() ).permitAll()
// 视频播放
// .antMatchers(
// "/api/front/flv/**",
// "/api/front/m3u8/**").permitAll()
// swagger 文档 // swagger 文档
.antMatchers("/swagger-ui.html").permitAll() .antMatchers("/swagger-ui.html").permitAll()
.antMatchers("/swagger-resources/**").permitAll() .antMatchers("/swagger-resources/**").permitAll()

View File

@ -84,10 +84,9 @@ public class TokenFilter extends GenericFilterBean {
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀 // 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), ""); return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token{}", bearerToken);
} }
// +else {
// + log.debug("非法Token{}", bearerToken);
// +}
return null; return null;
} }
} }