代码提交
This commit is contained in:
12
pom.xml
12
pom.xml
@@ -164,6 +164,18 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
src/main/java/com/njcn/syncdata/mapper/DictDataMapper.java
Normal file
21
src/main/java/com/njcn/syncdata/mapper/DictDataMapper.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.syncdata.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.syncdata.pojo.po.DictData;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @since 2021-12-13
|
||||||
|
*/
|
||||||
|
public interface DictDataMapper extends BaseMapper<DictData> {
|
||||||
|
|
||||||
|
List<DictData> selectList(@Param("code") String code);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.syncdata.mapper.DictDataMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectList" resultType="com.njcn.syncdata.pojo.po.DictData">
|
||||||
|
SELECT sys_dict_data.*
|
||||||
|
FROM sys_dict_data sys_dict_data,
|
||||||
|
sys_dict_type sys_dict_type
|
||||||
|
WHERE sys_dict_data.type_id = sys_dict_type.id
|
||||||
|
-- AND sys_dict_type.code = #{code}
|
||||||
|
and sys_dict_data.state = 1
|
||||||
|
order by sort
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
65
src/main/java/com/njcn/syncdata/pojo/po/DictData.java
Normal file
65
src/main/java/com/njcn/syncdata/pojo/po/DictData.java
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package com.njcn.syncdata.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @since 2021-12-13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("sys_dict_data")
|
||||||
|
public class DictData extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典数据表Id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典类型表Id
|
||||||
|
*/
|
||||||
|
private String typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件等级:0-普通;1-中等;2-严重(默认为0)
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 与高级算法内部Id描述对应;
|
||||||
|
*/
|
||||||
|
private Integer algoDescribe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目前只用于表示电压等级数值
|
||||||
|
*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态:0-删除 1-正常
|
||||||
|
*/
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -34,5 +34,9 @@ public class PWOPTransformerPSR {
|
|||||||
* 运行状态
|
* 运行状态
|
||||||
*/
|
*/
|
||||||
private String RUN_STATUS;
|
private String RUN_STATUS;
|
||||||
|
/**
|
||||||
|
* 电压等级
|
||||||
|
*/
|
||||||
|
private String VOLTAGELEVEL_ID;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,5 @@ public class Substation {
|
|||||||
*/
|
*/
|
||||||
private String NAME;
|
private String NAME;
|
||||||
|
|
||||||
/**
|
|
||||||
* 电压等级
|
|
||||||
*/
|
|
||||||
private String VOLTAGELEVEL_ID;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.syncdata.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.syncdata.pojo.po.DictData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @since 2021-12-13
|
||||||
|
*/
|
||||||
|
public interface IDictDataService extends IService<DictData> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -36,4 +36,6 @@ public interface IPowerDistributionareaService extends IService<PowerDistributio
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map staticMethod(String token,String psrType, String fieldName,String fieldValue);
|
Map staticMethod(String token,String psrType, String fieldName,String fieldValue);
|
||||||
|
|
||||||
|
Map insertData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.syncdata.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.syncdata.mapper.DictDataMapper;
|
||||||
|
import com.njcn.syncdata.pojo.po.DictData;
|
||||||
|
import com.njcn.syncdata.service.IDictDataService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @since 2021-12-13
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements IDictDataService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
package com.njcn.syncdata.service.impl;
|
package com.njcn.syncdata.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.cloud.apigateway.sdk.utils.Client;
|
import com.cloud.apigateway.sdk.utils.Client;
|
||||||
import com.cloud.apigateway.sdk.utils.Request;
|
import com.cloud.apigateway.sdk.utils.Request;
|
||||||
|
import com.njcn.syncdata.mapper.DictDataMapper;
|
||||||
import com.njcn.syncdata.mapper.PowerDistributionareaMapper;
|
import com.njcn.syncdata.mapper.PowerDistributionareaMapper;
|
||||||
import com.njcn.syncdata.pojo.po.AdsAstXbjcptGetFctgDi;
|
import com.njcn.syncdata.pojo.po.*;
|
||||||
import com.njcn.syncdata.pojo.po.PowerDistributionarea;
|
|
||||||
import com.njcn.syncdata.service.IPowerDistributionareaService;
|
import com.njcn.syncdata.service.IPowerDistributionareaService;
|
||||||
import com.njcn.syncdata.utils.RestTemplateUtil;
|
import com.njcn.syncdata.utils.RestTemplateUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -27,10 +28,10 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.function.Function;
|
||||||
import java.util.Map;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -45,6 +46,7 @@ import java.util.Map;
|
|||||||
public class PowerDistributionareaServiceImpl extends ServiceImpl<PowerDistributionareaMapper, PowerDistributionarea> implements IPowerDistributionareaService {
|
public class PowerDistributionareaServiceImpl extends ServiceImpl<PowerDistributionareaMapper, PowerDistributionarea> implements IPowerDistributionareaService {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(PowerDistributionareaServiceImpl.class);
|
private static Logger logger = LoggerFactory.getLogger(PowerDistributionareaServiceImpl.class);
|
||||||
|
private final DictDataMapper dictDataMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String LoginToken() {
|
public String LoginToken() {
|
||||||
@@ -76,7 +78,7 @@ public class PowerDistributionareaServiceImpl extends ServiceImpl<PowerDistribut
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String adsList() {
|
public String adsList() {
|
||||||
String s=null;
|
String s = null;
|
||||||
String key = "0e3bac160fd246f181ad4fd47da6929a";
|
String key = "0e3bac160fd246f181ad4fd47da6929a";
|
||||||
String secret = "383b4b2536234d84ac909cd605762061";
|
String secret = "383b4b2536234d84ac909cd605762061";
|
||||||
String url = "http://0f92aaf3da9b4dd2ab80a337495ccf09.apigw.he-region-2.sgic.sgcc.com.cn/ast/yxywyyxt/dws/get_e_mp_fctg_zl";
|
String url = "http://0f92aaf3da9b4dd2ab80a337495ccf09.apigw.he-region-2.sgic.sgcc.com.cn/ast/yxywyyxt/dws/get_e_mp_fctg_zl";
|
||||||
@@ -124,7 +126,7 @@ public class PowerDistributionareaServiceImpl extends ServiceImpl<PowerDistribut
|
|||||||
//Print the body of the response.
|
//Print the body of the response.
|
||||||
HttpEntity resEntity = response.getEntity();
|
HttpEntity resEntity = response.getEntity();
|
||||||
if (resEntity != null) {
|
if (resEntity != null) {
|
||||||
s = EntityUtils.toString(resEntity, "UTF-8");
|
s = EntityUtils.toString(resEntity, "UTF-8");
|
||||||
logger.debug(System.getProperty("line.separator") + s);
|
logger.debug(System.getProperty("line.separator") + s);
|
||||||
// JSONObject jsonObject = JSON.parseObject(s);
|
// JSONObject jsonObject = JSON.parseObject(s);
|
||||||
// JSONArray data = jsonObject.getJSONArray("data");
|
// JSONArray data = jsonObject.getJSONArray("data");
|
||||||
@@ -147,7 +149,7 @@ public class PowerDistributionareaServiceImpl extends ServiceImpl<PowerDistribut
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map staticMethod(String token,String psrType, String fieldName,String fieldValue) {
|
public Map staticMethod(String token, String psrType, String fieldName, String fieldValue) {
|
||||||
|
|
||||||
String userUrl = "http://dwzyywzt.com/baseCenter/oauth2/accessToken";
|
String userUrl = "http://dwzyywzt.com/baseCenter/oauth2/accessToken";
|
||||||
|
|
||||||
@@ -163,15 +165,113 @@ public class PowerDistributionareaServiceImpl extends ServiceImpl<PowerDistribut
|
|||||||
Map<String, Object> mapSubset = new HashMap<>();
|
Map<String, Object> mapSubset = new HashMap<>();
|
||||||
mapSubset.put("perPage", 100);
|
mapSubset.put("perPage", 100);
|
||||||
//sql查询
|
//sql查询
|
||||||
List<Map<String, Object>> info =new ArrayList<>();
|
List<Map<String, Object>> info = new ArrayList<>();
|
||||||
Map<String, Object> mapSubsets = new HashMap<>();
|
Map<String, Object> mapSubsets = new HashMap<>();
|
||||||
mapSubsets.put("fieldName", fieldName);
|
mapSubsets.put("fieldName", fieldName);
|
||||||
mapSubsets.put("compare", "in");
|
mapSubsets.put("compare", "in");
|
||||||
mapSubsets.put("fieldValue",fieldValue);
|
mapSubsets.put("fieldValue", fieldValue);
|
||||||
info.add(mapSubsets);
|
info.add(mapSubsets);
|
||||||
mapSubset.put("filters", info);
|
mapSubset.put("filters", info);
|
||||||
map1.put("params", mapSubset);
|
map1.put("params", mapSubset);
|
||||||
ResponseEntity<Map> userEntity = RestTemplateUtil.post(userUrl, mapHeader, map1, Map.class, new ArrayList<>());
|
ResponseEntity<Map> userEntity = RestTemplateUtil.post(userUrl, mapHeader, map1, Map.class, new ArrayList<>());
|
||||||
return userEntity.getBody();
|
return userEntity.getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map insertData() {
|
||||||
|
List<DictData> devVoltage = dictDataMapper.selectList("Dev_Voltage");
|
||||||
|
/*
|
||||||
|
List<PowerDistributionarea> info = new ArrayList<>();
|
||||||
|
String s = "[{\"tg_id\":\"824843\",\"trans_pms_id\":\"73a32eea908afa989256723aa9015673a323181105\",\"id\":\"1415129064\",\"tg_name\":\"【混全】10kV722协神线东安香村南1号160公用配变\",\"tg_no\":\"0010034073\",\"pub_priv_flag\":\"01\",\"org_no\":\"134011910\",\"org_name\":\"行唐县安香供电所\",\"org_type\":\"06\",\"p_org_no\":\"1340119\",\"run_status_code\":\"01\",\"tg_cap\":160.0,\"fc_num\":2,\"fc_sum_cap\":44.8},\n" +
|
||||||
|
" {\"tg_id\":\"825000\",\"trans_pms_id\":\"bc82f8391f8afa9890505facdb0150bc820b995f08\",\"id\":\"1411391450\",\"tg_name\":\"【混全】10kV722协神线东安香社厂100公用配变\",\"tg_no\":\"0010034337\",\"pub_priv_flag\":\"01\",\"org_no\":\"134011910\",\"org_name\":\"行唐县安香供电所\",\"org_type\":\"06\",\"p_org_no\":\"1340119\",\"run_status_code\":\"01\",\"tg_cap\":100.0,\"fc_num\":2,\"fc_sum_cap\":52.0}," +
|
||||||
|
"{\"tg_id\":\"825000\",\"trans_pms_id\":\"bc82f8391f8afa9890505facdb0150bc820b995f08\",\"id\":\"1411391450\",\"tg_name\":\"【混全】10kV722协神线东安香社厂100公用配变\",\"tg_no\":\"0010034337\",\"pub_priv_flag\":\"01\",\"org_no\":\"134011910\",\"org_name\":\"行唐县安香供电所\",\"org_type\":\"06\",\"p_org_no\":\"1340119\",\"run_status_code\":\"01\",\"tg_cap\":100.0,\"fc_num\":2,\"fc_sum_cap\":52.0}," +
|
||||||
|
"{\"tg_id\":\"825001\",\"trans_pms_id\":\"c06e78c12c8afa98904fb5b289014fc06e636c1f90\",\"id\":\"1411391450\",\"tg_name\":\"【混全】10kV722协神线东安香社厂100公用配变\",\"tg_no\":\"0010034337\",\"pub_priv_flag\":\"01\",\"org_no\":\"134011910\",\"org_name\":\"行唐县安香供电所\",\"org_type\":\"06\",\"p_org_no\":\"1340119\",\"run_status_code\":\"01\",\"tg_cap\":100.0,\"fc_num\":2,\"fc_sum_cap\":52.0}]";
|
||||||
|
List<AdsAstXbjcptGetFctgDi> aas = JSONArray.parseArray(s, AdsAstXbjcptGetFctgDi.class);
|
||||||
|
//进行数据拆分查询
|
||||||
|
Set<AdsAstXbjcptGetFctgDi> aa = new HashSet<>(aas);
|
||||||
|
List<AdsAstXbjcptGetFctgDi> dome = new ArrayList<>(aa);
|
||||||
|
//设置需要进行的分片数据
|
||||||
|
Integer num = 1000;
|
||||||
|
int totalCount = dome.size();
|
||||||
|
List<List<AdsAstXbjcptGetFctgDi>> pageList = ListUtil.split(dome, num);
|
||||||
|
|
||||||
|
Integer forNum = totalCount % num == 0 ? (totalCount / num) : (totalCount / num + 1);
|
||||||
|
for (Integer i = 0; i < forNum; i++) {
|
||||||
|
List<AdsAstXbjcptGetFctgDi> temList = pageList.get(i);
|
||||||
|
List<String> trans_pms_id = temList.stream().map(AdsAstXbjcptGetFctgDi::getTrans_pms_id).distinct().collect(Collectors.toList());
|
||||||
|
// List<PWOPTransformerPSR> transformer =OssTest.staticMethod(1,PWOPTransformerPSR.class);
|
||||||
|
// List<PWFeederLinePSR> line =OssTest.staticMethod(2,PWFeederLinePSR.class);
|
||||||
|
// List<Substation> substation =OssTest.staticMethod(3,Substation.class);
|
||||||
|
|
||||||
|
Map<String, PWOPTransformerPSR> transformerMap = transformer.stream().collect(Collectors.toMap(PWOPTransformerPSR::getACCOUNT_ID, Function.identity(), (key1, kye2) -> key1));
|
||||||
|
Map<String, PWFeederLinePSR> lineMap = line.stream().collect(Collectors.toMap(PWFeederLinePSR::getID, Function.identity(), (key1, kye2) -> key1));
|
||||||
|
Map<String, Substation> substationMap = substation.stream().collect(Collectors.toMap(Substation::getID, Function.identity(), (key1, kye2) -> key1));
|
||||||
|
|
||||||
|
for (AdsAstXbjcptGetFctgDi fctgDi : temList) {
|
||||||
|
PowerDistributionarea area = new PowerDistributionarea();
|
||||||
|
area.setId(fctgDi.getTg_id());
|
||||||
|
area.setName(fctgDi.getTg_name());
|
||||||
|
//从户外变查询数据查询数据是否存在
|
||||||
|
if (transformerMap.containsKey(fctgDi.getTrans_pms_id())) {
|
||||||
|
|
||||||
|
PWOPTransformerPSR pwopTransformerPSR = transformerMap.get(fctgDi.getTrans_pms_id());
|
||||||
|
if (lineMap.containsKey(pwopTransformerPSR.getROOT_ID())) {
|
||||||
|
|
||||||
|
PWFeederLinePSR pwFeederLinePSR = lineMap.get(pwopTransformerPSR.getROOT_ID());
|
||||||
|
if (substationMap.containsKey(pwFeederLinePSR.getStart_station_id())) {
|
||||||
|
Substation sub = substationMap.get(pwFeederLinePSR.getStart_station_id());
|
||||||
|
//名称暂时不知道
|
||||||
|
area.setOrgName(deptMap.get(pwFeederLinePSR.getDEPART()));
|
||||||
|
area.setOrgId(pwFeederLinePSR.getDEPART());
|
||||||
|
area.setOperationName(deptMap.get(pwFeederLinePSR.getMAINTENANCE_TEAM()));
|
||||||
|
area.setOperationId(pwFeederLinePSR.getMAINTENANCE_TEAM());
|
||||||
|
area.setPowerrName(sub.getNAME());
|
||||||
|
area.setPowerStationId(sub.getID());
|
||||||
|
area.setLineName(pwFeederLinePSR.getName());
|
||||||
|
area.setLineId(pwFeederLinePSR.getID());
|
||||||
|
|
||||||
|
//todo 要做处理
|
||||||
|
area.setVoltageLevel(getVoltageLevel(pwopTransformerPSR.getVOLTAGELEVEL_ID(),devVoltage));
|
||||||
|
|
||||||
|
area.setPCapacity(fctgDi.getTg_cap().floatValue());
|
||||||
|
//todo 要做处理
|
||||||
|
area.setRegionalism(fctgDi.getArea_type());
|
||||||
|
area.setIfRuralPowerGrid(pwopTransformerPSR.getIS_RURAL_GRID());
|
||||||
|
//todo 要做处理
|
||||||
|
area.setNatureOfUse(pwopTransformerPSR.getUse_nature());
|
||||||
|
area.setPowerSupplyRadius(pwFeederLinePSR.getSUPPLY_RADIUS().floatValue());
|
||||||
|
area.setLineLength(pwFeederLinePSR.getLENGTH().floatValue());
|
||||||
|
//todo 要做处理
|
||||||
|
area.setState(pwopTransformerPSR.getRUN_STATUS());
|
||||||
|
area.setDistributedPhotovoltaicNum(fctgDi.getFc_num());
|
||||||
|
area.setPhotovoltaicCapacity(fctgDi.getFc_sum_cap().floatValue());
|
||||||
|
area.setIfBevAp(0);
|
||||||
|
area.setApLoadType(data.getId());
|
||||||
|
area.setIsUpToGrid(1);
|
||||||
|
area.setStatus(1);
|
||||||
|
area.setCreateBy(null);
|
||||||
|
area.setCreateTime(LocalDateTime.now());
|
||||||
|
area.setUpdateBy(null);
|
||||||
|
area.setUpdateTime(LocalDateTime.now());
|
||||||
|
info.add(area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public String getVoltageLevel(String name,List<DictData> VoltageLevel){
|
||||||
|
Map<Integer, String> voltageMap = VoltageLevel.stream().filter(x -> x.getAlgoDescribe() != null).collect(Collectors.toMap(DictData::getAlgoDescribe, DictData::getId));
|
||||||
|
if(voltageMap.containsKey(name)){
|
||||||
|
return voltageMap.get(name);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,21 @@ import cn.hutool.core.date.StopWatch;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.syncdata.mapper.DictDataMapper;
|
||||||
|
import com.njcn.syncdata.pojo.po.DictData;
|
||||||
import com.njcn.syncdata.pojo.po.RDisMpMeasurePhaseReportD;
|
import com.njcn.syncdata.pojo.po.RDisMpMeasurePhaseReportD;
|
||||||
import com.njcn.syncdata.service.IRDisMpMeasurePhaseReportDService;
|
import com.njcn.syncdata.service.IRDisMpMeasurePhaseReportDService;
|
||||||
|
import com.njcn.syncdata.utils.RestTemplateUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -25,7 +31,8 @@ public class TestMybatis extends BaseJunitTest {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRDisMpMeasurePhaseReportDService irDisMpMeasurePhaseReportDService;
|
private IRDisMpMeasurePhaseReportDService irDisMpMeasurePhaseReportDService;
|
||||||
|
@Autowired
|
||||||
|
private DictDataMapper dictDataMapper;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testManyFileds(){
|
public void testManyFileds(){
|
||||||
@@ -46,8 +53,53 @@ public class TestMybatis extends BaseJunitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void aa(){
|
||||||
|
List<DictData> VoltageLevel = dictDataMapper.selectList("Dev_Voltage");
|
||||||
|
|
||||||
|
Map<Integer, String> voltageMap = VoltageLevel.stream().filter(x -> x.getAlgoDescribe() != null).collect(Collectors.toMap(DictData::getAlgoDescribe, DictData::getId));
|
||||||
|
if(voltageMap.containsKey(22)){
|
||||||
|
voltageMap.get("22");
|
||||||
|
}
|
||||||
|
|
||||||
|
String userUrl = "http://localhost:10204/largeScreen/getPowerOrder";
|
||||||
|
|
||||||
|
|
||||||
|
Map<String,String> mapHeader=new HashMap<>();
|
||||||
|
mapHeader.put("Content-Type","application/json; charset=utf-8");
|
||||||
|
mapHeader.put("x-token","1");
|
||||||
|
mapHeader.put("x-date","1");
|
||||||
|
mapHeader.put("x-signature","123");
|
||||||
|
|
||||||
|
Map<String,String> params=new HashMap<>();
|
||||||
|
params.put("deptIndex","5699e5916a18a6381e1ac92da5bd2628");
|
||||||
|
params.put("searchBeginTime","2023-05-01");
|
||||||
|
params.put("searchEndTime","2023-05-30");
|
||||||
|
params.put("limit","10");
|
||||||
|
ResponseEntity<Map> userEntity = RestTemplateUtil.post(userUrl,mapHeader,params, Map.class,new ArrayList<>());
|
||||||
|
}
|
||||||
|
@GetMapping("/getPowerOrder")
|
||||||
|
public Map sayHi(){
|
||||||
|
String userUrl = "http://localhost:10204/largeScreen/getPowerOrder";
|
||||||
|
|
||||||
|
|
||||||
|
Map<String,String> mapHeader=new HashMap<>();
|
||||||
|
mapHeader.put("Content-Type","application/json; charset=utf-8");
|
||||||
|
mapHeader.put("x-token","1");
|
||||||
|
mapHeader.put("x-date","1");
|
||||||
|
mapHeader.put("x-signature","123");
|
||||||
|
|
||||||
|
Map<String,String> params=new HashMap<>();
|
||||||
|
params.put("deptIndex","5699e5916a18a6381e1ac92da5bd2628");
|
||||||
|
params.put("searchBeginTime","2023-05-01");
|
||||||
|
params.put("searchEndTime","2023-05-30");
|
||||||
|
params.put("limit","10");
|
||||||
|
ResponseEntity<Map> userEntity = RestTemplateUtil.post(userUrl,mapHeader,params, Map.class,new ArrayList<>());
|
||||||
|
Map<String,Object> body = userEntity.getBody();
|
||||||
|
List data = (List) body.get("data");
|
||||||
|
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user