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 @TableId
private String uuid; 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.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -184,7 +185,6 @@ public class SupvPlan extends BaseEntity {
private Double objCapacity; private Double objCapacity;
/** /**
* 报告出具时间 * 报告出具时间
*/ */
@@ -200,15 +200,30 @@ public class SupvPlan extends BaseEntity {
private LocalDateTime problemOcTime; private LocalDateTime problemOcTime;
/** /**
* 0.未上送 1.上送 2.取消上送 * 0.未上送 1.上送 2.取消上送
*/ */
private Integer isUploadHead; 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.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
@@ -35,6 +36,13 @@ public class SupvProblem extends BaseEntity {
@TableId @TableId
private String problemId; 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) @TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDate rectificationTime; private LocalDate rectificationTime;
@@ -145,6 +154,7 @@ public class SupvProblem extends BaseEntity {
@ApiModelProperty(name = "attachmentNameTwo",value = "佐证材料") @ApiModelProperty(name = "attachmentNameTwo",value = "佐证材料")
private String attachmentNameTwo; 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.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId; import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; 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; private Integer isUploadHead;

View File

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

View File

@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.csb.sdk.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.exception.BusinessException; 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.SupvPlanMapper;
import com.njcn.process.mapper.SupvProblemMapper; import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.mapper.SupvReportMMapper; 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.SupvFile;
import com.njcn.process.pojo.po.SupvPlan; import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.po.SupvProblem; import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvReportM; import com.njcn.process.pojo.po.SupvReportM;
import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.SupvPushGwService; import com.njcn.process.service.SupvPushGwService;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
@@ -197,22 +199,31 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
} }
SendParam param = new SendParam();
param.setStats(supvPlanList);
//TODO 调用国网接口 param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
// Map map = postStatsUrl(getUrl(1), null, supvPlanList); String s = JSON.toJSONString(param);
JSONArray objects = new JSONArray(Collections.singletonList(supvPlanList)); log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口数据:" + s + "结束----");
String s = objects.toString(); // Map<String, String> send = send(param, getUrl(1), "pqPlanCreate");
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督工作计划:" + s + "结束----"); // 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) { // for (SupvPlan supvPlan : supvPlanList) {
// SupvPlan supvPlanPO = new SupvPlan(); // SupvPlan supvPlanPO = new SupvPlan();
// supvPlanPO.setPlanId(supvPlan.getPlanId()); // supvPlanPO.setPlanId(supvPlan.getPlanId());
// supvPlanPO.setIsUploadHead(1); // supvPlanPO.setIsUploadHead(1);
// supvPlanMapper.updateById(supvPlanPO); // supvPlanMapper.updateById(supvPlanPO);
// } // }
// } else {
// return false;
// }
// } else {
// return false;
// }
return true; return true;
} }
@@ -247,6 +258,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
if (mapRe.containsKey(supvProblem.getRectificationMeasure())) { if (mapRe.containsKey(supvProblem.getRectificationMeasure())) {
supvProblem.setRectificationMeasure(String.format("%02d", mapRe.get(supvProblem.getRectificationMeasure()).getAlgoDescribe())); supvProblem.setRectificationMeasure(String.format("%02d", mapRe.get(supvProblem.getRectificationMeasure()).getAlgoDescribe()));
} }
supvProblem.setProvinceId("13B9B47F1E483324E05338297A0A0595");
} }
if (supvProblemList.size() > 100) { if (supvProblemList.size() > 100) {
@@ -255,16 +267,32 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
//TODO //TODO
// 目前一个问题对应一个措施,上送一个问题需要调用问题接口和整改措施接口 // 目前一个问题对应一个措施,上送一个问题需要调用问题接口和整改措施接口
// Map map = postStatsUrl(getUrl(2), null, supvProblemList); SendParam param = new SendParam();
// Map map = postStatsUrl(getUrl(3), null, supvProblemList); param.setStats(supvProblemList);
JSONArray objects = new JSONArray(Collections.singletonList(supvProblemList)); param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
String s = objects.toString(); String s = JSON.toJSONString(param);
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督实施问题" + s + "结束----"); 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) { // for (SupvProblem supvProblem : supvProblemList) {
// SupvProblem supvProblemPO = new SupvProblem(); // SupvProblem supvProblemPO = new SupvProblem();
// supvProblemPO.setProblemId(supvProblem.getProblemId()); // supvProblemPO.setProblemId(supvProblem.getProblemId());
// supvProblemPO.setIsUploadHead(1); // supvProblemPO.setIsUploadHead(1);
// supvProblemMapper.updateById(supvProblemPO); // supvProblemMapper.updateById(supvProblemPO);
// }
// } else {
// return false;
// }
// } else {
// return false;
// } // }
return true; return true;
} }
@@ -297,17 +325,32 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
throw new BusinessException("一次最多上送100条数据"); throw new BusinessException("一次最多上送100条数据");
} }
//TODO 调用上送接口 //TODO 调用上送接口
// Map map = postStatsUrl(getUrl(5), null, supvReportMList); SendParam param = new SendParam();
JSONArray objects = new JSONArray(Collections.singletonList(supvReportMList)); param.setStats(supvReportMList);
String s = objects.toString(); param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
log.info(Thread.currentThread().getName() + "获取返回体 推送技术监督月报统计数据接口:" + s + "结束----"); 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) { // for (SupvReportM supvReportM : supvReportMList) {
// SupvReportM supvReportMPO = new SupvReportM(); // SupvReportM supvReportMPO = new SupvReportM();
// supvReportMPO.setMonthReportId(supvReportM.getMonthReportId()); // supvReportMPO.setMonthReportId(supvReportM.getMonthReportId());
// supvReportMPO.setIsUploadHead(1); // supvReportMPO.setIsUploadHead(1);
// supvReportMMapper.updateById(supvReportMPO); // supvReportMMapper.updateById(supvReportMPO);
// } // }
// } else {
// return false;
// }
//
// } else {
// return false;
// }
return true; return true;
} }
@@ -325,50 +368,102 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
for (String id : planIds) { for (String id : planIds) {
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
supvPlan.setPlanId(id); supvPlan.setPlanId(id);
supvPlan.setProvinceId("13B9B47F1E483324E05338297A0A0595");
supvPlanList.add(supvPlan); supvPlanList.add(supvPlan);
} }
//TODO //TODO
// Map map = postStatsUrl(getUrl(6), null, supvPlanList); SendParam param = new SendParam();
JSONArray objects = new JSONArray(Collections.singletonList(supvPlanList)); param.setStats(supvPlanList);
String s = objects.toString(); param.setProvinceId("13B9B47F1E483324E05338297A0A0595");
log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口:" + s + "结束----"); 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) { // for (SupvPlan supvPlan : supvPlanList) {
// supvPlan.setIsUploadHead(2); // supvPlan.setIsUploadHead(2);
// supvPlanMapper.updateById(supvPlan); // supvPlanMapper.updateById(supvPlan);
// }
// } else {
// return false;
// }
// } else {
// return false;
// } // }
return true; return true;
} }
/** public static Map<String, String> send(SendParam param, String url, String serviceName) {
* 通用上送提交 Map<String, String> map = new LinkedHashMap<>();
* @param url ContentBody cb;
* @param token if (ObjectUtil.isNull(param)) {
* @param list cb = new ContentBody("");
* @return } else {
*/ String s = JSON.toJSONString(param);
public Map postStatsUrl(String url,String token,List<?> list){ log.info(Thread.currentThread().getName() + "1.信息:" + JSON.toJSONString(param));
Map body = new HashMap(); log.info(Thread.currentThread().getName() + "2.信息:" + s);
Map<String, String> mapHeader = new HashMap<>(); cb = new ContentBody(s);
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 + "结束----");
} }
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 url
* @param token * @param token
* @return * @return
@@ -427,6 +522,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
/** /**
* 根据type获取上送地址 * 根据type获取上送地址
*
* @param type * @param type
* @return * @return
*/ */

View File

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