|
|
@ -56,8 +56,8 @@ import static me.zhengjie.modules.uploadnew.consts.SysConstNew.*;
|
|
|
|
//import org.springframework.util.StringUtils;
|
|
|
|
//import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @website https://el-admin.vip
|
|
|
|
|
|
|
|
* @author weizhongxi
|
|
|
|
* @author weizhongxi
|
|
|
|
|
|
|
|
* @website https://el-admin.vip
|
|
|
|
* @date 2021-04-14
|
|
|
|
* @date 2021-04-14
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
@ -135,16 +135,18 @@ public class TbUploadFileNewController {
|
|
|
|
// 记录日志
|
|
|
|
// 记录日志
|
|
|
|
log.info("TbUploadFileNewController:fileUpload | taskName=" + taskName + "===== isEcryptionNew=" + isEcryptionNew);
|
|
|
|
log.info("TbUploadFileNewController:fileUpload | taskName=" + taskName + "===== isEcryptionNew=" + isEcryptionNew);
|
|
|
|
// 校验上传是否有文件
|
|
|
|
// 校验上传是否有文件
|
|
|
|
if (file== null ){
|
|
|
|
if (null == file) {
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.NO_FILE_INPUT), HttpStatus.OK);
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.NO_FILE_INPUT), HttpStatus.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Integer isEcryption = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int isEcryption = 1;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
isEcryption = Integer.parseInt(isEcryptionNew);
|
|
|
|
isEcryption = Integer.parseInt(isEcryptionNew);
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
log.error("TbUploadFileNewController|fileUpload 转换异常!!!!");
|
|
|
|
log.error("TbUploadFileNewController|fileUpload 转换异常!!!!");
|
|
|
|
throw new BadRequestException("转换异常!!!");
|
|
|
|
throw new BadRequestException("转换异常!!!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String name = file.getOriginalFilename();
|
|
|
|
String name = file.getOriginalFilename();
|
|
|
|
String keyName = "";
|
|
|
|
String keyName = "";
|
|
|
|
String token = "";
|
|
|
|
String token = "";
|
|
|
@ -154,13 +156,12 @@ public class TbUploadFileNewController {
|
|
|
|
for (Cookie cookie : cookies) {
|
|
|
|
for (Cookie cookie : cookies) {
|
|
|
|
//获取cookie的名字
|
|
|
|
//获取cookie的名字
|
|
|
|
token = cookie.getValue();
|
|
|
|
token = cookie.getValue();
|
|
|
|
log.info("TbUploadFileNewController:fileUpload | token="+token);
|
|
|
|
log.info("TbUploadFileNewController:fileUpload | token: {} ", token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RedisParentDao redisParentDao = new RedisParentDao();
|
|
|
|
RedisParentDao redisParentDao = new RedisParentDao();
|
|
|
|
redisParentDao.setRedisTemplate(redisTemplate);
|
|
|
|
redisParentDao.setRedisTemplate(redisTemplate);
|
|
|
|
keyName = token+TOKEN_NAME+name;
|
|
|
|
String keyValue = redisParentDao.getValue(token + TOKEN_NAME + name);
|
|
|
|
String keyValue = redisParentDao.getValue(keyName);
|
|
|
|
|
|
|
|
//防止用户多次提交
|
|
|
|
//防止用户多次提交
|
|
|
|
if (keyValue != null) {
|
|
|
|
if (keyValue != null) {
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.TASK_STAETING), HttpStatus.OK);
|
|
|
|
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.TASK_STAETING), HttpStatus.OK);
|
|
|
@ -202,6 +203,7 @@ public class TbUploadFileNewController {
|
|
|
|
redisParentDao.remove(keyName);
|
|
|
|
redisParentDao.remove(keyName);
|
|
|
|
return new ResponseEntity<>(CommonResponse.createBySuccess(ResponseCode.SUCCESS), HttpStatus.OK);
|
|
|
|
return new ResponseEntity<>(CommonResponse.createBySuccess(ResponseCode.SUCCESS), HttpStatus.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Log("上传并加密任务")
|
|
|
|
@Log("上传并加密任务")
|
|
|
|
@ApiOperation("上传并加密任务")
|
|
|
|
@ApiOperation("上传并加密任务")
|
|
|
|
@AnonymousAccess
|
|
|
|
@AnonymousAccess
|
|
|
|