Commit 61c259df by 陈健智

下载报错修复

parent 65dc384b
......@@ -61,7 +61,7 @@ public class AopLogRecord {
private static final List<String> URL_PATTERNS = Arrays.asList("/getNewAll", "/getNew", "/schedule");
@AfterReturning(value = "execution(public * com..controller..admin..*Controller.*(..)) || execution(* com..controller..app..*Controller.*(..)) || execution(* com..controller..LoginController.checkBind())", returning = "ResponseResult")
private void beforeLog(JoinPoint joinPoint, ResponseResult ResponseResult) {
private void beforeLog(JoinPoint joinPoint, Object ResponseResult) {
try {
long now = System.currentTimeMillis();
// RequestContextHolder 顾名思义 持有 request 上下文的容器
......@@ -128,7 +128,7 @@ public class AopLogRecord {
}
}
private UserLogRecord userLogRecord(String projectId, UserInfo userInfo, JoinPoint joinPoint, MethodSignature methodSignature, ResponseResult responseResult) {
private UserLogRecord userLogRecord(String projectId, UserInfo userInfo, JoinPoint joinPoint, MethodSignature methodSignature, Object responseResult) {
long now = System.currentTimeMillis();
Object[] args = joinPoint.getArgs();
Method method = methodSignature.getMethod();
......@@ -193,10 +193,11 @@ public class AopLogRecord {
return new UserLogRecord(projectId, userInfo.getUserId(), userInfo.getNickname(), prefix + suffix, userInfo.getRoleId(), now, now);
}
// 获取接口返回值(value为获取返回值的具体字段)并与操作描述description拼接返回,返回值为实体
if (!method.getAnnotation(LogRecord.class).arguments() && method.getAnnotation(LogRecord.class).entity()) {
if (!method.getAnnotation(LogRecord.class).arguments() && method.getAnnotation(LogRecord.class).entity() && Objects.nonNull(responseResult)) {
List<Object> res = new ArrayList<>(value.length);
for (String v : value) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(responseResult.getData());
ResponseResult result = (ResponseResult) responseResult;
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(result.getData());
String s = String.valueOf(jsonObject.get(v));
if (Objects.nonNull(s)) {
res.add(s);
......
......@@ -77,9 +77,8 @@ public class AppUserCenterController extends BaseController {
@ApiOperation("任务中心-下载")
@ApiImplicitParam(name = "id", value = "任务id", required = true, paramType = "path", dataType = "string")
@GetMapping("/download-task/download/{id}")
public ResponseResult download(@PathVariable String id) {
public void download(@PathVariable String id) {
DownloadTask task = downloadTaskService.findTask(id);
Tools.downloadFile(task.getFileAddress(), response);
return ResponseResult.success();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment