1.国网工具类提交

This commit is contained in:
wr
2023-12-07 16:34:21 +08:00
parent 1490ead1ca
commit df070093c5
7 changed files with 205 additions and 39 deletions

View File

@@ -59,6 +59,7 @@ import java.util.stream.Stream;
public class SupvPushGwServiceImpl implements SupvPushGwService {
private final SupvPlanMapper supvPlanMapper;
private final ISupvPlanService iSupvPlanService;
private final SupvProblemMapper supvProblemMapper;
@@ -418,45 +419,12 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
if (count > 0) {
throw new BusinessException("请选择已上送计划");
}
List<SupvPlan> supvPlanList = new ArrayList<>();
for (String id : planIds) {
SupvPlan supvPlan = new SupvPlan();
supvPlan.setPlanId(id);
supvPlan.setDeleteFlag(null);
supvPlanList.add(supvPlan);
}
//TODO
SendParam param = new SendParam();
param.setStats(supvPlanList);
param.setProvinceId(code);
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据:" + s + "结束----");
Map<String, String> send = send(param, getUrl(6), "pqPlanDelete");
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口响应结果:" + send + "结束----");
if (send.containsKey("succeed")) {
String succeed = send.get("succeed");
if (succeed.indexOf("\\\"") != -1) {
succeed = succeed.replace("\\\"", "\"");
}
Map map = JSON.parseObject(succeed, Map.class);
String status = map.get("status").toString();
if ("000000".equals(status)) {
for (SupvPlan supvPlan : supvPlanList) {
supvPlanMapper.updateId(2, supvPlan.getPlanId());
}
String result = map.get("result").toString();
Map mapCount = JSON.parseObject(result, Map.class);
String countNum = mapCount.get("count").toString();
return "操作成功:成功数据" + countNum + "";
} else {
String errors = map.get("errors").toString();
throw new BusinessException("操作失败:" + status + "_" + errors);
}
} else {
throw new BusinessException("当前时间段国网上送请求过多,请稍后再试");
}
iSupvPlanService.update(new LambdaUpdateWrapper<SupvPlan>()
.set(SupvPlan::getDeleteFlag, 1)
.set(SupvPlan::getDeleteTime, LocalDateTime.now())
.in(SupvPlan::getPlanId, planIds)
);
return this.pushPlan(planIds);
}
@Override