1.国网数据上送

This commit is contained in:
2024-10-30 18:11:11 +08:00
parent 541d2ab3fe
commit 66530aa5aa
7 changed files with 144 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ public class GwSendUtil {
builder.contentBody(cb);
String token = LoginToken();
System.out.println("获取token------->"+token);
builder.putHeaderParamsMap("x-token", token);
builder.putHeaderParamsMap("serviceName", sendEnum.getServiceName());
//进行调用,返回结果

View File

@@ -6,6 +6,7 @@ import com.njcn.db.bo.BaseEntity;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import lombok.Data;
@@ -221,4 +222,13 @@ public class SupvPlan extends BaseEntity {
*/
private String effectUserName;
/**
* 计划来源
*/
private String dataSource = "01";
@TableField(exist = false)
private List<SupvPlanRel> planRel;
}

View File

@@ -0,0 +1,57 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import com.njcn.process.utils.TimestampAsLongSerializer;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
*
* </p>
*
* @author cdf
* @since 2024-10-30
*/
@Data
@TableName("supv_plan_rel")
public class SupvPlanRel {
private static final long serialVersionUID = 1L;
private String objId;
private String planId;
/**
* 关联对象类型
*/
private String relObjType;
private String relObjId;
private String relObjName;
@JsonSerialize(using = TimestampAsLongSerializer.class)
private Timestamp createTime;
@JsonSerialize(using = TimestampAsLongSerializer.class)
private Timestamp updateTime;
private String isDelete;
@JsonSerialize(using = TimestampAsLongSerializer.class)
private LocalDateTime deleteTime;
}

View File

@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity;
import com.njcn.process.pojo.po.SupvPlanRel;
import lombok.Getter;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author wr
@@ -191,6 +193,13 @@ public class PlanVO extends BaseEntity {
private LocalDateTime problemOcTime;
/**
* 0.未上送 1.上送 2.取消上送
*/
@@ -217,6 +226,25 @@ public class PlanVO extends BaseEntity {
*/
private String effectUserName;
/**
* 计划来源
*/
private String dataSource = "01";
@TableField(exist = false)
private List<SupvPlanRel> planRel;
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}
public void setPlanRel(List<SupvPlanRel> planRel) {
this.planRel = planRel;
}
public void setPlanId(String planId) {
if (StrUtil.isNotBlank(planId)) {
this.planId = planId;

View File

@@ -0,0 +1,21 @@
package com.njcn.process.utils;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.sql.Timestamp;
@Component
public class TimestampAsLongSerializer extends JsonSerializer<Timestamp> {
@Override
public void serialize(Timestamp value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (value != null) {
gen.writeNumber(value.getTime());
} else {
gen.writeNull();
}
}
}

View File

@@ -0,0 +1,17 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.po.SupvPlanRel;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2024-10-30
*/
public interface SupvPlanRelMapper extends BaseMapper<SupvPlanRel> {
}

View File

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.mapper.SupvPlanMapper;
import com.njcn.process.mapper.SupvPlanRelMapper;
import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.mapper.SupvReportMMapper;
import com.njcn.process.pojo.param.SendParam;
@@ -81,6 +82,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
private final ISupvAlarmBackService supvAlarmBackService;
private final SupvProblemServiceImpl supvProblemService;
private final SupvPlanRelMapper supvPlanRelMapper;
@Value("${gw.url}")
@@ -180,6 +182,14 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
supvPlan.setSupvType(String.format("%02d", mapType.get(supvPlan.getSupvType()).getAlgoDescribe()));
}
if(supvPlan.getSupvType().equals("05")){
//电容器组需要上送对象
List<SupvPlanRel> supvPlanRelList = supvPlanRelMapper.selectList(new LambdaQueryWrapper<SupvPlanRel>().eq(SupvPlanRel::getPlanId,supvPlan.getPlanId()));
supvPlan.setPlanRel(supvPlanRelList);
}
//监督类型编码
if (mapSupvState.containsKey(supvPlan.getSupvStage())) {
supvPlan.setSupvStage(String.format("%02d", mapSupvState.get(supvPlan.getSupvStage()).getAlgoDescribe()));