1.添加了技术监督部分缺少字段信息

2.修改字段属性对应的值powerTotalConductedNum改为powerMonthConductedNum
This commit is contained in:
wr
2023-07-28 17:31:46 +08:00
parent 4a2522e90b
commit 3e0157e889
8 changed files with 306 additions and 138 deletions

View File

@@ -0,0 +1,17 @@
package com.njcn.process.pojo.param;
import lombok.Data;
import java.util.List;
/**
* @author wr
* @description
* @date 2023/7/28 9:47
*/
@Data
public class SendParam {
private String provinceId;
private List stats;
}

View File

@@ -25,6 +25,11 @@ public class SupvFile {
@TableId
private String uuid;
/**
* 所属网省id
*/
@TableField(exist = false)
private String provinceId;
/**
* 附件路径

View File

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -184,7 +185,6 @@ public class SupvPlan extends BaseEntity {
private Double objCapacity;
/**
* 报告出具时间
*/
@@ -200,15 +200,30 @@ public class SupvPlan extends BaseEntity {
private LocalDateTime problemOcTime;
/**
* 0.未上送 1.上送 2.取消上送
*/
private Integer isUploadHead;
/**
* 删除标识 0否1是
*/
private String deleteFlag;
/**
* 计划状态 1新建2变更 3取消
*/
private String planStatus;
/**
* 删除时间
*/
private LocalDateTime deleteTime;
/**
* 实施人id
*/
private String effectUserId;
/**
* 实施人姓名
*/
private String effectUserName;
}

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDate;
@@ -35,6 +36,13 @@ public class SupvProblem extends BaseEntity {
@TableId
private String problemId;
/**
* 所属网省id
*/
@TableField(exist = false)
private String provinceId;
/**
* 关联计划表
*/
@@ -56,6 +64,7 @@ public class SupvProblem extends BaseEntity {
/**
* 整改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate rectificationTime;
@@ -145,6 +154,7 @@ public class SupvProblem extends BaseEntity {
@ApiModelProperty(name = "attachmentNameTwo",value = "佐证材料")
private String attachmentNameTwo;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime discoveryTime;
}

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import com.njcn.db.bo.BaseEntity;
import java.io.Serializable;
import java.time.LocalDate;
@@ -201,7 +202,24 @@ public class SupvReportM {
/**
* 供电电压本月前已开展数量
*/
private Integer powerTotalConductedNum;
private Integer powerMonthConductedNum;
/**
* 供电电压本月问题数量
*/
private Integer powerMonthQuesNum;
/**
*供电电压累计问题数量
*/
private Integer powerTotalQuesNum;
/**
*供电电压本月整改问题数量
*/
private Integer powerMonthReformNum;
/**
*供电电压累计整改问题数量
*/
private Integer powerTotalReformNum;
private Integer isUploadHead;

View File

@@ -106,6 +106,13 @@
</exclusion>
</exclusions>
</dependency>
<!--阿里的csb-->
<dependency>
<groupId>com.alibaba.csb.sdk</groupId>
<artifactId>http-client</artifactId>
<version>1.1.5.11</version>
</dependency>
</dependencies>
<build>

View File

@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.csb.sdk.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.exception.BusinessException;
@@ -12,11 +14,11 @@ import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.mapper.SupvPlanMapper;
import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.mapper.SupvReportMMapper;
import com.njcn.process.pojo.param.SendParam;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvReportM;
import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.SupvPushGwService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
@@ -197,22 +199,31 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
}
//TODO 调用国网接口
// Map map = postStatsUrl(getUrl(1), null, supvPlanList);
JSONArray objects = new JSONArray(Collections.singletonList(supvPlanList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督工作计划:" + s + "结束----");
SendParam param = new SendParam();
param.setStats(supvPlanList);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
String s = JSON.toJSONString(param);
log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口数据:" + s + "结束----");
// Map<String, String> send = send(param, getUrl(1), "pqPlanCreate");
// log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口响应结果:" + send + "结束----");
// if (send.containsKey("succeed")) {
// String succeed = send.get("succeed");
// String replace = succeed.replace("\\\"", "\"");
// Map mapData = JSON.parseObject(replace, Map.class);
// String status = mapData.get("status").toString();
// if ("000000".equals(status)) {
// for (SupvPlan supvPlan : supvPlanList) {
// SupvPlan supvPlanPO = new SupvPlan();
// supvPlanPO.setPlanId(supvPlan.getPlanId());
// supvPlanPO.setIsUploadHead(1);
// supvPlanMapper.updateById(supvPlanPO);
// }
// } else {
// return false;
// }
// } else {
// return false;
// }
return true;
}
@@ -247,6 +258,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
if (mapRe.containsKey(supvProblem.getRectificationMeasure())) {
supvProblem.setRectificationMeasure(String.format("%02d", mapRe.get(supvProblem.getRectificationMeasure()).getAlgoDescribe()));
}
supvProblem.setProvinceId("13B9B47F1E483324E05338297A0A0595");
}
if (supvProblemList.size() > 100) {
@@ -255,16 +267,32 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
//TODO
// 目前一个问题对应一个措施,上送一个问题需要调用问题接口和整改措施接口
// Map map = postStatsUrl(getUrl(2), null, supvProblemList);
// Map map = postStatsUrl(getUrl(3), null, supvProblemList);
JSONArray objects = new JSONArray(Collections.singletonList(supvProblemList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督实施问题" + s + "结束----");
SendParam param = new SendParam();
param.setStats(supvProblemList);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
String s = JSON.toJSONString(param);
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据" + s + "结束----");
// Map<String, String> send = send(param, getUrl(2), "pqProblemCreate");
// Map<String, String> send2 = send(param, getUrl(3), "pqProblemUpdate");
// log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督实施问题数据接口响应结果:" + send + "结束----");
// log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督实施问题整改数据接口响应结果:" + send2 + "结束----");
// if (send.containsKey("succeed")) {
// String succeed = send.get("succeed");
// String replace = succeed.replace("\\\"", "\"");
// Map map = JSON.parseObject(replace, Map.class);
// String status = map.get("status").toString();
// if ("000000".equals(status)) {
// for (SupvProblem supvProblem : supvProblemList) {
// SupvProblem supvProblemPO = new SupvProblem();
// supvProblemPO.setProblemId(supvProblem.getProblemId());
// supvProblemPO.setIsUploadHead(1);
// supvProblemMapper.updateById(supvProblemPO);
// }
// } else {
// return false;
// }
// } else {
// return false;
// }
return true;
}
@@ -297,17 +325,32 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
throw new BusinessException("一次最多上送100条数据");
}
//TODO 调用上送接口
// Map map = postStatsUrl(getUrl(5), null, supvReportMList);
JSONArray objects = new JSONArray(Collections.singletonList(supvReportMList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督月报统计数据接口:" + s + "结束----");
SendParam param = new SendParam();
param.setStats(supvReportMList);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
String s = JSON.toJSONString(param);
log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口数据:" + s + "结束----");
// Map<String, String> send = send(param, getUrl(5), "pqMonthReportCreate");
// log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口响应结果:" + s + "结束----");
// if (send.containsKey("succeed")) {
// String succeed = send.get("succeed");
// String replace = succeed.replace("\\\"", "\"");
// Map map = JSON.parseObject(replace, Map.class);
// String status = map.get("status").toString();
// if ("000000".equals(status)) {
// for (SupvReportM supvReportM : supvReportMList) {
// SupvReportM supvReportMPO = new SupvReportM();
// supvReportMPO.setMonthReportId(supvReportM.getMonthReportId());
// supvReportMPO.setIsUploadHead(1);
// supvReportMMapper.updateById(supvReportMPO);
// }
// } else {
// return false;
// }
//
// } else {
// return false;
// }
return true;
}
@@ -325,50 +368,102 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
for (String id : planIds) {
SupvPlan supvPlan = new SupvPlan();
supvPlan.setPlanId(id);
supvPlan.setProvinceId("13B9B47F1E483324E05338297A0A0595");
supvPlanList.add(supvPlan);
}
//TODO
// Map map = postStatsUrl(getUrl(6), null, supvPlanList);
JSONArray objects = new JSONArray(Collections.singletonList(supvPlanList));
String s = objects.toString();
log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口:" + s + "结束----");
SendParam param = new SendParam();
param.setStats(supvPlanList);
param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
String s = JSON.toJSONString(param);
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据:" + s + "结束----");
// Map<String, String> send = send(param, getUrl(6), "pqPlanDelete");
// log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口响应结果:" + s + "结束----");
// if (send.containsKey("succeed")) {
// String succeed = send.get("succeed");
// String replace = succeed.replace("\\\"", "\"");
// Map map = JSON.parseObject(replace, Map.class);
// String status = map.get("status").toString();
// if ("000000".equals(status)) {
// for (SupvPlan supvPlan : supvPlanList) {
// supvPlan.setIsUploadHead(2);
// supvPlanMapper.updateById(supvPlan);
// }
// } else {
// return false;
// }
// } else {
// return false;
// }
return true;
}
/**
* 通用上送提交
* @param url
* @param token
* @param list
* @return
*/
public Map postStatsUrl(String url,String token,List<?> list){
Map body = new HashMap();
Map<String, String> mapHeader = new HashMap<>();
mapHeader.put("Content-Type", "application/json; charset=utf-8");
mapHeader.put("x-token", token);
mapHeader.put("x-date", System.currentTimeMillis() + "");
mapHeader.put("x-signature", "123");
//设置入参
Map<String, Object> mapBody = new HashMap<>();
mapBody.put("stats", list);
ResponseEntity<Map> userEntity = RestTemplateUtil.post(url, mapHeader, mapBody, Map.class, new ArrayList<>());
if (userEntity.getStatusCodeValue() == 200) {
//获取返回体
body = userEntity.getBody();
log.info(Thread.currentThread().getName() + "获取返回体 getResourceData" + body + "结束----");
public static Map<String, String> send(SendParam param, String url, String serviceName) {
Map<String, String> map = new LinkedHashMap<>();
ContentBody cb;
if (ObjectUtil.isNull(param)) {
cb = new ContentBody("");
} else {
String s = JSON.toJSONString(param);
log.info(Thread.currentThread().getName() + "1.信息:" + JSON.toJSONString(param));
log.info(Thread.currentThread().getName() + "2.信息:" + s);
cb = new ContentBody(s);
}
return body;
//ContentBody传递要求使用post方式进行调用
//如果需要传递请求参数 可以拼接到请求URL中或者设置paramsMap参数由SDK内部进行拼接
HttpParameters.Builder builder = HttpParameters.newBuilder();
builder.requestURL(url) // 设置请求的URL,可以拼接URL请求参数
.api("zongbuSync") // 设置服务名
.version("1.0.0") // 设置版本号
.method("post") // 设置调用方式, 必须为 post
.contentType("application/json; charset=UTF-8") //设置请求content-type
.accessKey("7d4cb2c0afb5468ca56e0654b1a442ef").secretKey("lW2xr6zKjbaqVDOSgQpcGrM6Rg0=");// 设置accessKey 和 设置secretKey
builder.contentBody(cb);
String token = LoginToken();
log.info(Thread.currentThread().getName() + "3.错误信息:" + token);
builder.putHeaderParamsMap("x-token", token);
builder.putHeaderParamsMap("serviceName", serviceName);
//进行调用,返回结果
try {
HttpReturn ret = HttpCaller.invokeReturn(builder.build());
String responseStr = ret.getResponseStr();//获取响应的文本串
map.put("succeed", responseStr);
} catch (HttpCallerException e) {
// error process
log.info(Thread.currentThread().getName() + "错误信息:" + e);
map.put("error", e.toString());
}
return map;
}
public static String LoginToken() {
String token = null;
String clientId = "942a9278671711eda2e10ae0b5517f6c";
String clientSecret = "3Psd2VEhsA3dVsSPHW0ll5r/03kAqlA2P4w2IiWPA8UWSadcX0we2wffjyTUYGsK";
String userUrl = "http://25.36.214.86:32234/psr-auth/oauth/accessToken?grant_type={grant_type}&client_id={client_id}&client_secret={client_secret}";
Map<String, String> map = new HashMap<>();
map.put("grant_type", "credentials");
map.put("client_id", clientId);
map.put("client_secret", clientSecret);
ResponseEntity<Map> userEntity = RestTemplateUtil.get(userUrl, Map.class, map);
if (userEntity.getStatusCodeValue() == 200) {
log.info(Thread.currentThread().getName() + "数据:" + userEntity.getBody() + "结束----");
//获取返回体
Map body = userEntity.getBody();
token = body.get("access_token").toString();
}
return token;
}
/**
* 文件上送提交
*
* @param url
* @param token
* @return
@@ -427,6 +522,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
/**
* 根据type获取上送地址
*
* @param type
* @return
*/

View File

@@ -208,7 +208,7 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
//电压
supvReportM.setPowerMonthPlanNum(dealData(childrenDeptList,processPublicDTODianYaListM));
Integer d = dealData(childrenDeptList,processPublicDTODianYaListAll);
supvReportM.setPowerTotalConductedNum(d);
supvReportM.setPowerMonthConductedNum(d);
all+=d;
}