Commit c303ac6d authored by 张帅's avatar 张帅

kgd添加接口服务更新

parent 3b09a3e3
...@@ -48,7 +48,14 @@ ...@@ -48,7 +48,14 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-security</artifactId>
<version>${amos.version}</version>
</dependency>
<!-- j2cache 二级缓存 --> <!-- j2cache 二级缓存 -->
<dependency> <dependency>
<groupId>net.oschina.j2cache</groupId> <groupId>net.oschina.j2cache</groupId>
......
...@@ -42,6 +42,8 @@ public class ClientHandler<path> implements Runnable { ...@@ -42,6 +42,8 @@ public class ClientHandler<path> implements Runnable {
@Override @Override
public void run() { public void run() {
try { try {
// 获取输入流和输出流 // 获取输入流和输出流
InputStream ips = socket.getInputStream(); InputStream ips = socket.getInputStream();
// ips中,不是单纯的文件流,还有一些其他字段,所以要将单纯文件的部分过滤出来 // ips中,不是单纯的文件流,还有一些其他字段,所以要将单纯文件的部分过滤出来
...@@ -64,18 +66,26 @@ public class ClientHandler<path> implements Runnable { ...@@ -64,18 +66,26 @@ public class ClientHandler<path> implements Runnable {
private String upload2Maas(InputStream inputStream, String hostAndPort, String filename) throws IOException { private String upload2Maas(InputStream inputStream, String hostAndPort, String filename) throws IOException {
Properties properties = new Properties();
FileInputStream input = new FileInputStream("amos-boot-system-kgd\\src\\main\\resources\\application-dev.properties");
properties.load(input);
String keyValue = properties.getProperty("keyValue");
System.out.println(keyValue);
AmosRequestContext robotAuthentication = SpringContextHelper.getBean(AmosRequestContext.class); AmosRequestContext robotAuthentication = SpringContextHelper.getBean(AmosRequestContext.class);
if (Objects.nonNull(robotAuthentication)) { if (Objects.nonNull(robotAuthentication)) {
// String token = robotAuthentication.getToken(); String token = robotAuthentication.getToken();
// String product = robotAuthentication.getProduct(); String product = robotAuthentication.getProduct();
// String appKey = robotAuthentication.getAppKey(); String appKey = robotAuthentication.getAppKey();
String token = "1121d8d2-915f-453e-8e20-1558566cefbb"; // 如果token、失效,就去浏览器复制最新的token、 /* String token = "ae8d0003-128c-424f-9730-dc9923c395b1"; // 如果token、失效,就去浏览器复制最新的token、
String product = "AMOS_STUDIO_WEB"; String product = "AMOS_STUDIO_WEB";
String appKey = "AMOS_STUDIO"; String appKey = "AMOS_STUDIO";*/
//1, 上传到maas //1, 上传到maas
String uploadUrl = "http://" + hostAndPort + "/maas/dsm/excel/upload"; String uploadUrl = "http://" + hostAndPort + "/maas/maas/desktop/excel/upload";
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
Resource resource = new InputStreamResource(inputStream) { Resource resource = new InputStreamResource(inputStream) {
@Override @Override
...@@ -95,7 +105,8 @@ public class ClientHandler<path> implements Runnable { ...@@ -95,7 +105,8 @@ public class ClientHandler<path> implements Runnable {
ResponseEntity<String> responseEntity = restTemplate.exchange(uploadUrl, HttpMethod.POST, requestEntity, String.class); ResponseEntity<String> responseEntity = restTemplate.exchange(uploadUrl, HttpMethod.POST, requestEntity, String.class);
String body = responseEntity.getBody(); String body = responseEntity.getBody();
JSONObject jsonObject = JSONObject.parseObject(body); JSONObject jsonObject = JSONObject.parseObject(body);
String result = jsonObject.getString("result"); // String result = jsonObject.getString("result");
String result = jsonObject.getJSONObject("result").getString("key");
String path = jsonObject.getString("path"); String path = jsonObject.getString("path");
if (jsonObject.getString("status").equals("200")) { if (jsonObject.getString("status").equals("200")) {
log.info("路径:" + path + "/" + result); log.info("路径:" + path + "/" + result);
...@@ -108,7 +119,7 @@ public class ClientHandler<path> implements Runnable { ...@@ -108,7 +119,7 @@ public class ClientHandler<path> implements Runnable {
Map<String, String> params2 = new HashMap<>(); Map<String, String> params2 = new HashMap<>();
params2.put("connType", "excel"); params2.put("connType", "excel");
params2.put("detail", "{\"location\":{\"type\":\"excel\",\"path\":\"" + result + "\"}}"); params2.put("detail", "{\"location\":{\"type\":\"excel\",\"path\":\"" + result + "\"}}");
params2.put("subjectid", "534de50c-bb8c-4450-87a0-557aac745a94"); params2.put("subjectid", keyValue);
HttpEntity<Map<String, String>> requestEntity2 = new HttpEntity<>(params2, getHeader(token, product, appKey, hostAndPort, false)); HttpEntity<Map<String, String>> requestEntity2 = new HttpEntity<>(params2, getHeader(token, product, appKey, hostAndPort, false));
ResponseEntity<String> response2 = restTemplate.exchange(connsUrl, HttpMethod.POST, requestEntity2, String.class); ResponseEntity<String> response2 = restTemplate.exchange(connsUrl, HttpMethod.POST, requestEntity2, String.class);
String body2 = response2.getBody(); String body2 = response2.getBody();
...@@ -142,7 +153,7 @@ public class ClientHandler<path> implements Runnable { ...@@ -142,7 +153,7 @@ public class ClientHandler<path> implements Runnable {
String tablesUrl = "http://" + hostAndPort + "/maas/maas/desktop/tables"; String tablesUrl = "http://" + hostAndPort + "/maas/maas/desktop/tables";
Map<String, String> params3 = new HashMap<>(); Map<String, String> params3 = new HashMap<>();
params3.put("name", filename); params3.put("name", filename);
params3.put("pid", "534de50c-bb8c-4450-87a0-557aac745a94"); params3.put("pid", keyValue);
params3.put("connId", connId); params3.put("connId", connId);
// params3.add("config", sheetArray.get(0).toString()); // params3.add("config", sheetArray.get(0).toString());
params3.put("config", "{\"columnNameLineNumber\":1,\"skipEmptyLines\":true,\"skipEmptyColumns\":false,\"columnFormatter\":{\"zztest\":{\"name\":\"zztest\",\"alias\":\"zztest\",\"type\":\"VARCHAR\"},\"zz\":{\"name\":\"zz\",\"alias\":\"zz\",\"type\":\"VARCHAR\"}},\"sheet\":\"Sheet1\"}"); params3.put("config", "{\"columnNameLineNumber\":1,\"skipEmptyLines\":true,\"skipEmptyColumns\":false,\"columnFormatter\":{\"zztest\":{\"name\":\"zztest\",\"alias\":\"zztest\",\"type\":\"VARCHAR\"},\"zz\":{\"name\":\"zz\",\"alias\":\"zz\",\"type\":\"VARCHAR\"}},\"sheet\":\"Sheet1\"}");
...@@ -153,32 +164,31 @@ public class ClientHandler<path> implements Runnable { ...@@ -153,32 +164,31 @@ public class ClientHandler<path> implements Runnable {
String result2 = jsonObject3.getString("result"); String result2 = jsonObject3.getString("result");
String path2 = jsonObject3.getString("path"); String path2 = jsonObject3.getString("path");
//datasource(name:excel+时间戳)
// //datasource(name:excel+时间戳) // 获取当前时间的时间戳
// // 获取当前时间的时间戳 long timestamp = System.currentTimeMillis();
// long timestamp = System.currentTimeMillis(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String timestampStr = sdf.format(new Date(timestamp));
// String timestampStr = sdf.format(new Date(timestamp)); String datasourceUrl = "http://" + hostAndPort + "/maas/dsm/datasources";
// String datasourceUrl = "http://" + hostAndPort + "/maas/dsm/datasources"; JSONObject all = new JSONObject();
// JSONObject all = new JSONObject(); JSONObject oneJson = new JSONObject();
// JSONObject oneJson = new JSONObject(); all.put("filepath",result);
// all.put("filepath",result); for (int i = 0; i < sheetArray.size(); i++) {
// for (int i = 0; i < sheetArray.size(); i++) { oneJson.put(sheets[i],sheetArray.get(i));
// oneJson.put(sheets[i],sheetArray.get(i)); }
// } all.put("config",oneJson);
// all.put("config",oneJson);
Map<String, String> datasourceParams = new HashMap<>();
// Map<String, String> datasourceParams = new HashMap<>(); datasourceParams.put("detail", all.toString());
// datasourceParams.put("detail", all.toString()); datasourceParams.put("groupid", "72684d79-5d28-4086-9f21-5b091b6675db");
// datasourceParams.put("groupid", "72684d79-5d28-4086-9f21-5b091b6675db"); datasourceParams.put("subtype", "excel");
// datasourceParams.put("subtype", "excel"); datasourceParams.put("name", "excel"+timestampStr);
// datasourceParams.put("name", "excel"+timestampStr); datasourceParams.put("type", "File");
// datasourceParams.put("type", "File"); HttpEntity<Map<String, String>> datasourceRequestEntity = new HttpEntity<>(datasourceParams, getHeader(token,product,appKey,hostAndPort,false));
// HttpEntity<Map<String, String>> datasourceRequestEntity = new HttpEntity<>(datasourceParams, getHeader(token,product,appKey,hostAndPort,false)); ResponseEntity<String> datasourceResponseEntity = restTemplate.exchange(datasourceUrl, HttpMethod.POST, datasourceRequestEntity, String.class);
// ResponseEntity<String> datasourceResponseEntity = restTemplate.exchange(datasourceUrl, HttpMethod.POST, datasourceRequestEntity, String.class); String datasourceResponseEntityBody = datasourceResponseEntity.getBody();
// String datasourceResponseEntityBody = datasourceResponseEntity.getBody(); log.info("datasourceResponseEntityBody:" + datasourceResponseEntityBody);
// log.info("datasourceResponseEntityBody:" + datasourceResponseEntityBody); return path + "/" + result;
// return path + "/" + result;
} }
return null; return null;
} }
......
package com.yeejoin.amos.kgd.config;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class ConfigName {
private Properties properties = new Properties();
public ConfigName(String path) {
try {
InputStream inputStream = new FileInputStream(path);
}catch (IOException e){
e.printStackTrace();
}
}
public String getProperty(String key) {
return properties.getProperty(key);
}
public static void main(String[] args) {
String path = "D:\\KGD_7.31\\amos-boot-biz\\amos-boot-system-kgd\\src\\main\\resources\\application-dev.properties";
ConfigName configName = new ConfigName(path);
String data = configName.getProperty("kgd.data.keyValue");
System.out.println(data);
}
}
package com.yeejoin.amos.kgd.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.kgd.model.AnalysisResult;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Lizhou
* @description 针对表【analysis_result】的数据库操作Mapper
* @createDate 2024-07-31 17:07:12
* @Entity com.atguigu.pojo.AnalysisResult
*/
public interface AnalysisResultMapper extends BaseMapper<AnalysisResult> {
Integer queryHighFrequencyNumber(@Param("deviceId") String deviceId);
List<AnalysisResult> queryHighFrequencyData(@Param("deviceId") String deviceId,
@Param("highFrequencyNumber") Integer highFrequencyNumber);
List<AnalysisResult> queryHighFrequencyAnalysisData(@Param("deviceId") String deviceId,
@Param("highFrequencyNumber") Integer highFrequencyNumber);
List<String> queryVarName(@Param("deviceId") String deviceId);
AnalysisResult queryAnalysisData(@Param("deviceId") String deviceId,
@Param("varName") String varName);
AnalysisResult queryAnalysisResultRate(@Param("deviceId") String deviceId,
@Param("varName") String varName);
List<AnalysisResult> querySwitchDataByDeviceId(@Param("deviceId") String deviceId,
@Param("switchNumber") Integer switchNumber);
Integer querySwitchTypeNumber(@Param("deviceId") String deviceId);
List<AnalysisResult> queryPredictionResult(@Param("deviceId") String deviceId,
@Param("varName") String varName,
@Param("predictiveNumber") Integer predictiveNumber);
Integer queryTemperatureTypeNumber(@Param("deviceId") String deviceId,
@Param("varName") String varName);
List<AnalysisResult> queryTemperature(@Param("deviceId") String deviceId,
@Param("temperatureNumber") Integer temperatureNumber);
}
package com.yeejoin.amos.kgd.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @TableName analysis_result
*/
@TableName(value ="analysis_result")
@Data
public class AnalysisResult implements Serializable {
private Integer id;
private String samplingtime;
private String deviceId;
private String varType;
private String varName;
private String data;
private String analysisData;
private String analysisResult;
private String analysisResultRate;
private String predictResult;
private String groupName;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yeejoin.amos.kgd.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.kgd.model.AnalysisResult;
/**
* @author Lizhou
* @description 针对表【analysis_result】的数据库操作Service
* @createDate 2024-07-31 17:07:12
*/
public interface AnalysisResultService extends IService<AnalysisResult> {
}
<?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.yeejoin.amos.kgd.mapper.AnalysisResultMapper">
<resultMap id="BaseResultMap" type="com.yeejoin.amos.kgd.mapper.AnalysisResultMapper">
<id property="id" column="ID" jdbcType="INTEGER"/>
<result property="samplingtime" column="SamplingTime" jdbcType="VARCHAR"/>
<result property="deviceId" column="DEVICE_ID" jdbcType="VARCHAR"/>
<result property="varType" column="VAR_TYPE" jdbcType="VARCHAR"/>
<result property="varName" column="VAR_NAME" jdbcType="VARCHAR"/>
<result property="data" column="DATA" jdbcType="VARCHAR"/>
<result property="analysisData" column="ANALYSIS_DATA" jdbcType="VARCHAR"/>
<result property="analysisResult" column="ANALYSIS_RESULT" jdbcType="VARCHAR"/>
<result property="analysisResultRate" column="ANALYSIS_RESULT_RATE" jdbcType="VARCHAR"/>
<result property="predictResult" column="PREDICT_RESULT" jdbcType="VARCHAR"/>
<result property="groupName" column="GROUP_NAME" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,SamplingTime,DEVICE_ID,
VAR_TYPE,VAR_NAME,DATA,
ANALYSIS_DATA,ANALYSIS_RESULT,ANALYSIS_RESULT_RATE,
PREDICT_RESULT,GROUP_NAME
</sql>
<select id="queryHighFrequencyNumber" resultType="java.lang.Integer">
select COUNT(DISTINCT VAR_NAME)
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频'
</select>
<select id="queryHighFrequencyData" resultType="com.yeejoin.amos.kgd.model.AnalysisResult">
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频'
order by SamplingTime desc
limit #{highFrequencyNumber}
</select>
<select id="queryHighFrequencyAnalysisData" resultType="com.yeejoin.amos.kgd.model.AnalysisResult">
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频'
order by SamplingTime desc
limit #{highFrequencyNumber}
</select>
<select id="queryAnalysisResultRate" resultType="com.yeejoin.amos.kgd.model.AnalysisResult">
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' and VAR_NAME=#{varName}
order by SamplingTime desc
limit 1
</select>
<select id="querySwitchDataByDeviceId" resultType="com.yeejoin.amos.kgd.model.AnalysisResult" >
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='开关量'
order by SamplingTime desc
limit #{switchNumber};
</select>
<select id="querySwitchTypeNumber" resultType="java.lang.Integer">
select COUNT(DISTINCT VAR_NAME)
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='开关量'
</select>
<select id="queryVarName" resultType="java.lang.String">
select VAR_NAME from analysis_result where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' group by VAR_NAME order by VAR_NAME;
</select>
<select id="queryPredictionResult" resultType="com.yeejoin.amos.kgd.model.AnalysisResult">
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' and VAR_NAME=#{varName}
order by SamplingTime desc
limit #{predictiveNumber}
</select>
<select id="queryAnalysisData" resultType="com.yeejoin.amos.kgd.model.AnalysisResult">
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='高频' and VAR_NAME=#{varName}
order by SamplingTime desc
limit 1
</select>
<select id="queryTemperatureTypeNumber" resultType="java.lang.Integer">
select COUNT(DISTINCT VAR_NAME)
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='低频'
</select>
<select id="queryTemperature" resultType="com.yeejoin.amos.kgd.model.AnalysisResult">
select *
from analysis_result
where DEVICE_ID=#{deviceId} and VAR_TYPE='低频'
order by SamplingTime desc
limit #{temperatureNumber}
</select>
</mapper>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>visual-feign-morphic</artifactId> <artifactId>visual-feign-morphic</artifactId>
<version>1.6.3-SNAPSHOT</version> <version>1.8.5-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.typroject</groupId> <groupId>org.typroject</groupId>
......
...@@ -78,6 +78,12 @@ ...@@ -78,6 +78,12 @@
<artifactId>xmlworker</artifactId> <artifactId>xmlworker</artifactId>
<version>5.5.9</version> <version>5.5.9</version>
</dependency> </dependency>
</dependencies> <dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project> </project>
...@@ -146,7 +146,7 @@ public class RemoteSecurityService { ...@@ -146,7 +146,7 @@ public class RemoteSecurityService {
List<AgencyUserModel> agencyUserModel=null; List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds,null); feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds,null,null);
agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult(); agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult();
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
<dependency> <dependency>
<groupId>e-iceblue</groupId> <groupId>e-iceblue</groupId>
<artifactId>spire.doc</artifactId> <artifactId>spire.doc</artifactId>
<version>5.1.9</version> <!-- <version>5.1.9</version>-->
<version>5.4.10</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
......
package com.yeejoin.amos.kgd.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.kgd.service.AnalysisResultService;
import com.yeejoin.amos.kgd.service.impl.AnalysisResultServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@Api(tags = "数据Api")
@RequestMapping(value = "/data/select")
public class AnalysisResultController {
@Autowired
AnalysisResultServiceImpl analysisResultService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID查询数据,幅值与时间")
@RequestMapping(value = "/select", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectByDeviceId(@RequestParam String deviceId){
JSONObject jsonData = analysisResultService.getDataByDeviceId(deviceId);
return ResponseHelper.buildResponse(jsonData);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID查询,幅值与频率")
@RequestMapping(value = "/analysisAllData", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectAnalysisDataByDeviceId(@RequestParam String deviceId){
JSONObject jsonData = analysisResultService.getAnalysisDataByDeviceId(deviceId);
return ResponseHelper.buildResponse(jsonData);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备id、高频,查var_name的所有类别,下拉栏的")
@RequestMapping(value = "/varName", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectVarNameByDeviceId(@RequestParam String deviceId){
JSONArray jsonArray = analysisResultService.getVarNameByDeviceId(deviceId);
return ResponseHelper.buildResponse(jsonArray);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID和低频,查温度,data")
@RequestMapping(value = "/temperature", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectTemperatureByDeviceId(String deviceId){
JSONObject jsonData = analysisResultService.getTemperatureByDeviceId(deviceId);
return ResponseHelper.buildResponse(jsonData);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID和varName查幅值与时间,data")
@RequestMapping(value = "/analysisData", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectAnalysisDataByDeviceIdAndStatus(@RequestParam String deviceId, @RequestParam String varName){
JSONObject jsonData = analysisResultService.getAnalysisDataByDeviceIdAndVarName(deviceId, varName);
return ResponseHelper.buildResponse(jsonData);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID和状态查故障率")
@RequestMapping(value = "/faultRate", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectFaultRateByDeviceIdAndStatus(@RequestParam String deviceId, @RequestParam String varName){
JSONObject jsonData = analysisResultService.getFaultRateByDeviceIdAndStatus(deviceId, varName);
return ResponseHelper.buildResponse(jsonData);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID和状态查故障类型占比")
@RequestMapping(value = "/faultTypeProportion", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectFaultTypeProportionByDeviceIdAndStatus(@RequestParam String deviceId, @RequestParam String varName){
JSONArray jsonArray = analysisResultService.getFaultTypeProportionByDeviceIdAndStatus(deviceId, varName);
return ResponseHelper.buildResponse(jsonArray);
}
@Value("${kgd.data.switchNumber}")
private int switchNumber;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID查询开关量信息")
@RequestMapping(value = "/switchData", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectSwitchDataByDeviceId(@RequestParam String deviceId){
System.out.println(switchNumber);
JSONObject jsonData = analysisResultService.getSwitchDataByDeviceId(deviceId, switchNumber);
return ResponseHelper.buildResponse(jsonData);
}
@Value("${kgd.data.predictiveNumber}")
private int predictiveNumber;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据设备ID和varName查询最近n条预测结果")
@RequestMapping(value = "/predictiveTrend", method = RequestMethod.GET)
@ResponseBody
public ResponseModel selectPredictionResultByDeviceId(@RequestParam String deviceId,
@RequestParam String vaName){
JSONObject jsonData = analysisResultService.getPredictionResultByDeviceId(deviceId, vaName, predictiveNumber);
return ResponseHelper.buildResponse(jsonData);
}
}
...@@ -48,7 +48,7 @@ public class RuleDangerService { ...@@ -48,7 +48,7 @@ public class RuleDangerService {
latentDangerRo.setTerminal(RuleConstant.APP); latentDangerRo.setTerminal(RuleConstant.APP);
List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult(); List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult();
if (result.size() > 0) { if (result.size() > 0) {
List<AgencyUserModel> userModels = Privilege.agencyUserClient.queryByRoleId(String.valueOf(result.get(0).getSequenceNbr()), null).getResult(); List<AgencyUserModel> userModels = Privilege.agencyUserClient.queryByRoleId(String.valueOf(result.get(0).getSequenceNbr()), null, null).getResult();
//只发送给本部门的人员 //只发送给本部门的人员
Long pointId = latentDanger.getBizInfo().getLong("pointId"); Long pointId = latentDanger.getBizInfo().getLong("pointId");
......
...@@ -171,7 +171,7 @@ public class AsyncTask { ...@@ -171,7 +171,7 @@ public class AsyncTask {
try { try {
List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult(); List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult();
if (result.size() > 0) { if (result.size() > 0) {
List<AgencyUserModel> userModels = Privilege.agencyUserClient.queryByRoleId(String.valueOf(result.get(0).getSequenceNbr()), null).getResult(); List<AgencyUserModel> userModels = Privilege.agencyUserClient.queryByRoleId(String.valueOf(result.get(0).getSequenceNbr()), null, null).getResult();
List<String> userIds = userModels.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList()); List<String> userIds = userModels.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
model.setRecivers(userIds); model.setRecivers(userIds);
} }
......
...@@ -220,7 +220,7 @@ public class RemoteSecurityService { ...@@ -220,7 +220,7 @@ public class RemoteSecurityService {
List<AgencyUserModel> agencyUserModel = null; List<AgencyUserModel> agencyUserModel = null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null); feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null, null);
agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult(); agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult();
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
......
...@@ -221,7 +221,7 @@ public class RemoteSecurityService { ...@@ -221,7 +221,7 @@ public class RemoteSecurityService {
List<AgencyUserModel> agencyUserModel = null; List<AgencyUserModel> agencyUserModel = null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null); feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null, null);
agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult(); agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult();
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
......
...@@ -223,7 +223,7 @@ public class RemoteSecurityService { ...@@ -223,7 +223,7 @@ public class RemoteSecurityService {
List<AgencyUserModel> agencyUserModel = null; List<AgencyUserModel> agencyUserModel = null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null); feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null, null);
agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult(); agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult();
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
......
...@@ -122,7 +122,7 @@ public class RulePlanService { ...@@ -122,7 +122,7 @@ public class RulePlanService {
Privilege.roleClient.queryRoleList(supervisionPersonChargerRole, null).getResult(); Privilege.roleClient.queryRoleList(supervisionPersonChargerRole, null).getResult();
if (!ValidationUtil.isEmpty(roleList)) { if (!ValidationUtil.isEmpty(roleList)) {
List<AgencyUserModel> agencyUserModelList = Privilege.agencyUserClient.queryByRoleId( List<AgencyUserModel> agencyUserModelList = Privilege.agencyUserClient.queryByRoleId(
String.valueOf(roleList.get(0).getSequenceNbr()), null).getResult(); String.valueOf(roleList.get(0).getSequenceNbr()), null, null).getResult();
if (!ValidationUtil.isEmpty(agencyUserModelList)) { if (!ValidationUtil.isEmpty(agencyUserModelList)) {
List<String> finalUserIds = userIds; List<String> finalUserIds = userIds;
agencyUserModelList.forEach(userModel -> { agencyUserModelList.forEach(userModel -> {
......
...@@ -226,7 +226,7 @@ public class RemoteSecurityService { ...@@ -226,7 +226,7 @@ public class RemoteSecurityService {
List<AgencyUserModel> agencyUserModel = null; List<AgencyUserModel> agencyUserModel = null;
FeignClientResult feignClientResult; FeignClientResult feignClientResult;
try { try {
feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null); feignClientResult = Privilege.agencyUserClient.queryByRoleId(RoleIds, null, null);
agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult(); agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult();
} catch (InnerInvokException e) { } catch (InnerInvokException e) {
......
...@@ -382,7 +382,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -382,7 +382,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Override @Override
public List<DutySeatDto> getSeatInfos() { public List<DutySeatDto> getSeatInfos() {
// 获取人员信息 // 获取人员信息
FeignClientResult<List<AgencyUserModel>> userListResult = Privilege.agencyUserClient.list(null); FeignClientResult<List<AgencyUserModel>> userListResult = Privilege.agencyUserClient.list(null, null);
List<AgencyUserModel> userList = userListResult.getResult(); List<AgencyUserModel> userList = userListResult.getResult();
List<DutySeatDto> dutyList = new ArrayList<>(); List<DutySeatDto> dutyList = new ArrayList<>();
userList.stream().forEach(u -> { userList.stream().forEach(u -> {
......
...@@ -34,7 +34,8 @@ import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils; ...@@ -34,7 +34,8 @@ import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
@MapperScan({"org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*", @MapperScan({"org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.*.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper", "com.yeejoin.amos.boot.module.*.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper",
"com.yeejoin.amos.avic.face.orm.dao*"}) "com.yeejoin.amos.avic.face.orm.dao*",
"com.yeejoin.amos.kgd.*"})
@ComponentScan(basePackages = {"org.typroject", "com.yeejoin"}) @ComponentScan(basePackages = {"org.typroject", "com.yeejoin"})
public class AmoKGDApplication { public class AmoKGDApplication {
private static final Logger logger = LoggerFactory.getLogger(AmoKGDApplication.class); private static final Logger logger = LoggerFactory.getLogger(AmoKGDApplication.class);
...@@ -50,5 +51,4 @@ public class AmoKGDApplication { ...@@ -50,5 +51,4 @@ public class AmoKGDApplication {
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------"); + path + "/doc.html\n" + "----------------------------------------------------------");
} }
} }
...@@ -12,6 +12,11 @@ spring.redis.port=6379 ...@@ -12,6 +12,11 @@ spring.redis.port=6379
spring.redis.password=yeejoin@2020 spring.redis.password=yeejoin@2020
# mybaits-plus
mybatis-plus.mapper-locations=classpath:/mapper/*.xml
spring.cache.type=GENERIC spring.cache.type=GENERIC
j2cache.open-spring-cache=true j2cache.open-spring-cache=true
j2cache.cache-clean-mode=passive j2cache.cache-clean-mode=passive
...@@ -67,4 +72,9 @@ knife4j.basic.password=a1234560 ...@@ -67,4 +72,9 @@ knife4j.basic.password=a1234560
management.security.enabled=true management.security.enabled=true
spring.security.user.name=admin spring.security.user.name=admin
spring.security.user.password=a1234560 spring.security.user.password=
\ No newline at end of file
kgd.data.switchNumber=10
kgd.data.predictiveNumber=10
keyValue=f348f867-0279-45ef-9162-3f1115e6fea8
spring.application.name=AMOS-BIZ-KGD-API spring.application.name=AMOS-BIZ-KGD-API
server.servlet.context-path=/kgd server.servlet.context-path=/kgd
server.port=33002 server.port=33003
server.uri-encoding=UTF-8 server.uri-encoding=UTF-8
spring.profiles.active=dev spring.profiles.active=dev
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
<springboot.version>2.3.11.RELEASE</springboot.version> <springboot.version>2.3.11.RELEASE</springboot.version>
<springcloud.version>Hoxton.SR8</springcloud.version> <springcloud.version>Hoxton.SR8</springcloud.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<tyboot-version>1.1.20</tyboot-version> <tyboot-version>1.1.24-SNAPSHOT</tyboot-version>
<amos.version>1.6.6-SNAPSHOT</amos.version> <amos.version>1.8.5</amos.version>
<itext.version>7.1.1</itext.version> <itext.version>7.1.1</itext.version>
</properties> </properties>
...@@ -286,6 +286,7 @@ ...@@ -286,6 +286,7 @@
<name>e-iceblue</name> <name>e-iceblue</name>
<url>https://repo.e-iceblue.com/nexus/content/groups/public/</url> <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository> </repository>
</repositories> </repositories>
<modules> <modules>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment