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

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

View File

@@ -1,15 +1,24 @@
package com.njcn.process.utils;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.sql.Timestamp;
@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
public void serialize(Timestamp value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (value != null) {

View File

@@ -13,6 +13,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.oss.utils.FileStorageUtil;
import com.njcn.process.mapper.SupvPlanMapper;
@@ -186,6 +188,19 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
if(supvPlan.getSupvType().equals("05")){
//电容器组需要上送对象
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);
}