This commit is contained in:
2024-10-30 18:45:29 +08:00
parent 66530aa5aa
commit b659dd055f
5 changed files with 28 additions and 8 deletions

View File

@@ -47,7 +47,7 @@ public class LogUtil {
public static void logExceptionStackInfo(String exceptionName, Exception exception) { public static void logExceptionStackInfo(String exceptionName, Exception exception) {
//若开启了debug模式则输出所有的栈堆信息 //若开启了debug模式则输出所有的栈堆信息
njcnPatchDebug(log, ExceptionUtil.getAllExceptionStackInfo(exception)); njcnPatchDebug(log, ExceptionUtil.getAllExceptionStackInfo(exception));
log.error("{}{},目标文件:{}",exceptionName, exception.toString(), ExceptionUtil.getExceptionServerStackInfo(exception)); log.error("{}{},目标文件:{}",exceptionName, exception, ExceptionUtil.getExceptionServerStackInfo(exception));
} }
} }

View File

@@ -1,13 +1,9 @@
package com.njcn.web.config; package com.njcn.web.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.njcn.web.filter.XssFilter; import com.njcn.web.filter.XssFilter;
import com.njcn.web.filter.XssRequestWrapper;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
/** /**
* @author hongawen * @author hongawen

View File

@@ -51,7 +51,7 @@ public class SupvPlanRel {
private String isDelete; private String isDelete;
@JsonSerialize(using = TimestampAsLongSerializer.class) @JsonSerialize(using = TimestampAsLongSerializer.class)
private LocalDateTime deleteTime; private Timestamp deleteTime;
} }

View File

@@ -1,15 +1,24 @@
package com.njcn.process.utils; package com.njcn.process.utils;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.sql.Timestamp; import java.sql.Timestamp;
@Component @Component
public class TimestampAsLongSerializer extends JsonSerializer<Timestamp> { public class TimestampAsLongSerializer extends StdSerializer<Timestamp> {
protected TimestampAsLongSerializer(Class<Timestamp> t) {
super(t);
}
public TimestampAsLongSerializer() {
this(null);
}
@Override @Override
public void serialize(Timestamp value, JsonGenerator gen, SerializerProvider serializers) throws IOException { public void serialize(Timestamp value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (value != null) { if (value != null) {

View File

@@ -13,6 +13,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.mapper.SupvPlanMapper; import com.njcn.process.mapper.SupvPlanMapper;
@@ -186,6 +188,19 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
if(supvPlan.getSupvType().equals("05")){ if(supvPlan.getSupvType().equals("05")){
//电容器组需要上送对象 //电容器组需要上送对象
List<SupvPlanRel> supvPlanRelList = supvPlanRelMapper.selectList(new LambdaQueryWrapper<SupvPlanRel>().eq(SupvPlanRel::getPlanId,supvPlan.getPlanId())); List<SupvPlanRel> supvPlanRelList = supvPlanRelMapper.selectList(new LambdaQueryWrapper<SupvPlanRel>().eq(SupvPlanRel::getPlanId,supvPlan.getPlanId()));
if(CollUtil.isNotEmpty(supvPlanRelList)){
System.out.println("njcnnjcnnjcn");
ObjectMapper objectMapper = new ObjectMapper();
supvPlanRelList.forEach(item -> {
String jsonString = null;
try {
jsonString = objectMapper.writeValueAsString(item);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
System.out.println(jsonString);
});
}
supvPlan.setPlanRel(supvPlanRelList); supvPlan.setPlanRel(supvPlanRelList);
} }