Commit 7b7df13d authored by 王亮's avatar 王亮

format Localdatetime

parent 29022760
......@@ -2,14 +2,12 @@ package cn.quantgroup.xyqb.aspect.logcaller;
import cn.quantgroup.xyqb.util.IpUtil;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Stopwatch;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
......@@ -28,10 +26,6 @@ import java.util.concurrent.TimeUnit;
@Component
@Order(value = Ordered.HIGHEST_PRECEDENCE)
public class LogCallHttpAspect {
@Autowired
private ObjectMapper objectMapper;
@Pointcut(value = "execution(public * cn.quantgroup.xyqb.controller..*.*(..)) "
+ "&& !execution(* cn.quantgroup.xyqb.controller.ExceptionHandlingController.*(..))"
+ "&& !execution(* cn.quantgroup.xyqb.controller.middleoffice.login.ILoginModule.*(..))") // 服务层包路径导致错误,暂时不动,在合适的时候应该挪走
......@@ -55,7 +49,7 @@ public class LogCallHttpAspect {
throw e;
} finally {
long elapsed = stopwatch.stop().elapsed(TimeUnit.MILLISECONDS);
String resultStr = result == null ? "" : objectMapper.writeValueAsString(result);
String resultStr = result == null ? "" : JSON.toJSONString(result);
resultStr = resultStr.length() < 500 ? resultStr : resultStr.substring(0, 500);
log.info("[httpRequestLog],url:[{}],duration:[{}],[耗时区间]{},remoteIP:[{}],args:[{}],exception:[{}],result:[{}]",
request.getRequestURL(), elapsed, slowlyTag(elapsed), remoteIP, JSON.toJSONString(args), hasException, resultStr);
......
......@@ -10,7 +10,6 @@ import cn.quantgroup.xyqb.entity.ModifyPhoneNo;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.service.user.IModifyPhoneNoService;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.validation.annotation.Validated;
......@@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
/**
* 用户手机号修改相关api
......@@ -81,14 +79,9 @@ public class ModifyPhoneNoController implements IBaseController {
@GetMapping
public JsonResult<?> list(@Valid ModifyPhoneNoQueryReq modifyPhoneNoQueryReq) {
Page<ModifyPhoneNo> list = modifyPhoneNoService.list(modifyPhoneNoQueryReq);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
String s;
try {
Page<ModifyPhoneNoResp> result = list.map(ModifyPhoneNoResp::from);
s = objectMapper.writeValueAsString(result);
Object o = objectMapper.readValue(s, Object.class);
return JsonResult.buildSuccessResultGeneric(o);
return JsonResult.buildSuccessResultGeneric(result);
} catch (Exception ignored) {
}
return JsonResult.buildErrorStateResult("数据错误",null);
......
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