Compare commits
7 Commits
paris
...
88f964943a
| Author | SHA1 | Date | |
|---|---|---|---|
| 88f964943a | |||
| 855967d083 | |||
| 066ed82476 | |||
| 530f4396f7 | |||
| 584ad2e6e4 | |||
| 8e3aac4cea | |||
| f98a57c510 |
@ -31,6 +31,8 @@ public class AnnualOverviewResp {
|
|||||||
@ApiModelProperty(value = "年总充")
|
@ApiModelProperty(value = "年总充")
|
||||||
BigDecimal yearCharge;
|
BigDecimal yearCharge;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "今日收益")
|
||||||
|
BigDecimal todayProfit;
|
||||||
|
|
||||||
@ApiModelProperty(value = "昨日收益")
|
@ApiModelProperty(value = "昨日收益")
|
||||||
BigDecimal yestProfit;
|
BigDecimal yestProfit;
|
||||||
|
|||||||
@ -282,6 +282,7 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
annualOverviewResp.setYestProfit(overviewProfit.getYestProfit()==null?null:overviewProfit.getYestProfit().multiply(new BigDecimal("10000")));
|
annualOverviewResp.setYestProfit(overviewProfit.getYestProfit()==null?null:overviewProfit.getYestProfit().multiply(new BigDecimal("10000")));
|
||||||
annualOverviewResp.setYearProfit(overviewProfit.getYearProfit()==null?null:overviewProfit.getYearProfit().multiply(new BigDecimal("10000")));
|
annualOverviewResp.setYearProfit(overviewProfit.getYearProfit()==null?null:overviewProfit.getYearProfit().multiply(new BigDecimal("10000")));
|
||||||
annualOverviewResp.setTotalProfit(overviewProfit.getTotalProfit()==null?null:overviewProfit.getTotalProfit().multiply(new BigDecimal("10000")));
|
annualOverviewResp.setTotalProfit(overviewProfit.getTotalProfit()==null?null:overviewProfit.getTotalProfit().multiply(new BigDecimal("10000")));
|
||||||
|
annualOverviewResp.setTodayProfit(overviewProfit.getTodayProfit()==null?null:overviewProfit.getTodayProfit().multiply(new BigDecimal("10000")));
|
||||||
//时间当年
|
//时间当年
|
||||||
DateTime begin = DateUtil.beginOfYear(new Date());
|
DateTime begin = DateUtil.beginOfYear(new Date());
|
||||||
String beginString = DateUtil.format(begin, CommonConstant.DATE_YMD);
|
String beginString = DateUtil.format(begin, CommonConstant.DATE_YMD);
|
||||||
@ -1532,7 +1533,7 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
if(beginDate == null){
|
if(beginDate == null){
|
||||||
return annualOverviewResp;
|
return annualOverviewResp;
|
||||||
}
|
}
|
||||||
Date date = DateUtil.yesterday();
|
Date date = DateUtil.date();
|
||||||
Date startDate = DateUtil.beginOfYear(beginDate);
|
Date startDate = DateUtil.beginOfYear(beginDate);
|
||||||
Date endDate = DateUtil.endOfDay(date);
|
Date endDate = DateUtil.endOfDay(date);
|
||||||
String begin = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
String begin = DateUtil.format(startDate, CommonConstant.DATE_YMD);
|
||||||
@ -1546,6 +1547,7 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
profitList.add(dayProfitType);
|
profitList.add(dayProfitType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//计算总收益
|
||||||
Map<String, List<DayProfitType>> dayMap = profitList.stream().collect(Collectors.groupingBy(DayProfitType::getDay));
|
Map<String, List<DayProfitType>> dayMap = profitList.stream().collect(Collectors.groupingBy(DayProfitType::getDay));
|
||||||
List<AnnualChartValue> yearProfitCurve = new ArrayList<>();
|
List<AnnualChartValue> yearProfitCurve = new ArrayList<>();
|
||||||
getAnnualOverviewResp(yearProfitCurve, dateTimes, CommonConstant.DATE_Y, dayMap);
|
getAnnualOverviewResp(yearProfitCurve, dateTimes, CommonConstant.DATE_Y, dayMap);
|
||||||
@ -1554,6 +1556,7 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
yearProfit = yearProfit.add(chartValue.getProfit());
|
yearProfit = yearProfit.add(chartValue.getProfit());
|
||||||
}
|
}
|
||||||
annualOverviewResp.setTotalProfit(yearProfit);
|
annualOverviewResp.setTotalProfit(yearProfit);
|
||||||
|
//计算年收益
|
||||||
startDate = DateUtil.beginOfYear(date);
|
startDate = DateUtil.beginOfYear(date);
|
||||||
List<DateTime> nowDateTime = DateUtil.rangeToList(startDate, endDate, DateField.MONTH);
|
List<DateTime> nowDateTime = DateUtil.rangeToList(startDate, endDate, DateField.MONTH);
|
||||||
List<AnnualChartValue> monthProfitCurve = new ArrayList<>();
|
List<AnnualChartValue> monthProfitCurve = new ArrayList<>();
|
||||||
@ -1563,6 +1566,18 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
monthProfit = monthProfit.add(chartValue.getProfit());
|
monthProfit = monthProfit.add(chartValue.getProfit());
|
||||||
}
|
}
|
||||||
annualOverviewResp.setYearProfit(monthProfit);
|
annualOverviewResp.setYearProfit(monthProfit);
|
||||||
|
// 计算今日收益
|
||||||
|
List<DateTime> todayDateTime = DateUtil.rangeToList(endDate, endDate, DateField.DAY_OF_MONTH);
|
||||||
|
List<AnnualChartValue> todayProfitCurve = new ArrayList<>();
|
||||||
|
getAnnualOverviewResp(todayProfitCurve, todayDateTime, CommonConstant.DATE_YMD, dayMap);
|
||||||
|
BigDecimal todayProfit = BigDecimal.ZERO;
|
||||||
|
for (AnnualChartValue chartValue : todayProfitCurve) {
|
||||||
|
todayProfit = todayProfit.add(chartValue.getProfit());
|
||||||
|
}
|
||||||
|
annualOverviewResp.setTodayProfit(todayProfit);
|
||||||
|
// 计算昨日收益
|
||||||
|
date = DateUtil.yesterday();
|
||||||
|
endDate = DateUtil.endOfDay(date);
|
||||||
List<DateTime> dayDateTime = DateUtil.rangeToList(endDate, endDate, DateField.DAY_OF_MONTH);
|
List<DateTime> dayDateTime = DateUtil.rangeToList(endDate, endDate, DateField.DAY_OF_MONTH);
|
||||||
List<AnnualChartValue> dayProfitCurve = new ArrayList<>();
|
List<AnnualChartValue> dayProfitCurve = new ArrayList<>();
|
||||||
getAnnualOverviewResp(dayProfitCurve, dayDateTime, CommonConstant.DATE_YMD, dayMap);
|
getAnnualOverviewResp(dayProfitCurve, dayDateTime, CommonConstant.DATE_YMD, dayMap);
|
||||||
@ -1606,12 +1621,13 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal result = dischargeProfit.subtract(chargeProfit).divide(new BigDecimal("10000"));
|
BigDecimal result = dischargeProfit.subtract(chargeProfit).divide(new BigDecimal("10000"));
|
||||||
if (result.doubleValue() > 0.0) {
|
// if (result.doubleValue() > 0.0) {
|
||||||
annualChartValue.setProfit(result);
|
// annualChartValue.setProfit(result);
|
||||||
} else {
|
// } else {
|
||||||
log.info("{},大屏计算收益,放电收益小于充电收益",day);
|
// log.info("{},大屏计算收益,放电收益小于充电收益",day);
|
||||||
annualChartValue.setProfit(BigDecimal.ZERO);
|
// annualChartValue.setProfit(BigDecimal.ZERO);
|
||||||
}
|
// }
|
||||||
|
annualChartValue.setProfit(result);
|
||||||
annualChartValue.setTime(day);
|
annualChartValue.setTime(day);
|
||||||
curveResult.add(annualChartValue);
|
curveResult.add(annualChartValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,6 +146,16 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20231013</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,79 @@
|
|||||||
|
package com.ho.common.tools.util;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import okhttp3.*;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class TranslateUtils {
|
||||||
|
|
||||||
|
public static final String API_KEY = "hNDgbvTzhQymYvVvcAhCWEkh";
|
||||||
|
public static final String SECRET_KEY = "tkgqkVDEJi8xBSrToNPdJdV2CYFNZM31";
|
||||||
|
|
||||||
|
public static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().readTimeout(300, TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
|
|
||||||
|
// 静态翻译方法:输入待翻译文本,返回目标语言文本
|
||||||
|
public static String translate(String text) throws IOException {
|
||||||
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
|
// 动态构建请求体(支持任意文本)
|
||||||
|
String jsonBody = String.format("{\"from\":\"zh\",\"to\":\"en\",\"q\":\"%s\"}", text);
|
||||||
|
RequestBody body = RequestBody.create(mediaType, jsonBody);
|
||||||
|
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url("https://aip.baidubce.com/rpc/2.0/mt/texttrans/v1?access_token=" + getAccessToken())
|
||||||
|
.post(body)
|
||||||
|
.addHeader("Content-Type", "application/json")
|
||||||
|
.addHeader("Accept", "application/json")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
|
||||||
|
String responseBody = response.body().string();
|
||||||
|
// 解析JSON获取dst值
|
||||||
|
return parseDstFromResponse(responseBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析JSON响应并提取dst
|
||||||
|
private static String parseDstFromResponse(String jsonResponse) {
|
||||||
|
JSONObject root = new JSONObject(jsonResponse);
|
||||||
|
JSONObject result = root.getJSONObject("result");
|
||||||
|
JSONArray transResult = result.getJSONArray("trans_result");
|
||||||
|
// 获取第一条翻译结果的dst字段
|
||||||
|
return transResult.getJSONObject(0).getString("dst");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 示例调用
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
String translated = translate("PCS环境过温降额[恢复]");
|
||||||
|
System.out.println("翻译结果: " + translated); // 输出: active power
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从用户的AK,SK生成鉴权签名(Access Token)
|
||||||
|
*
|
||||||
|
* @return 鉴权签名(Access Token)
|
||||||
|
* @throws IOException IO异常
|
||||||
|
*/
|
||||||
|
static String getAccessToken() throws IOException {
|
||||||
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||||
|
RequestBody body = RequestBody.create(mediaType, "grant_type=client_credentials&client_id=" + API_KEY
|
||||||
|
+ "&client_secret=" + SECRET_KEY);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url("https://aip.baidubce.com/oauth/2.0/token")
|
||||||
|
.method("POST", body)
|
||||||
|
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
.build();
|
||||||
|
Response response = HTTP_CLIENT.newCall(request).execute();
|
||||||
|
return new JSONObject(response.body().string()).getString("access_token");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -128,7 +128,10 @@ public class MqttConfigUtil {
|
|||||||
"+/device/cd6cb4a64b42bda5",
|
"+/device/cd6cb4a64b42bda5",
|
||||||
"+/device/436de647bbf01b22",
|
"+/device/436de647bbf01b22",
|
||||||
"+/device/e9eee97d793756fa",
|
"+/device/e9eee97d793756fa",
|
||||||
"+/device/8c062827b5c1548b"
|
"+/device/8c062827b5c1548b",
|
||||||
|
"+/device/d143856d757625e1",
|
||||||
|
"+/device/3522ab4e7faf28b8",
|
||||||
|
"1/device/+"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import com.ho.common.tools.util.PageResult;
|
|||||||
import com.ho.filecenter.entity.MediaFile;
|
import com.ho.filecenter.entity.MediaFile;
|
||||||
import com.ho.filecenter.service.AnotherFileService;
|
import com.ho.filecenter.service.AnotherFileService;
|
||||||
import com.ho.filecenter.service.FileService;
|
import com.ho.filecenter.service.FileService;
|
||||||
|
import com.ho.filecenter.service.MqttTopicService;
|
||||||
import com.ho.filecenter.util.MqttConfigUtil;
|
import com.ho.filecenter.util.MqttConfigUtil;
|
||||||
import com.ho.filecenter.vo.mqtt.*;
|
import com.ho.filecenter.vo.mqtt.*;
|
||||||
import com.ho.filecenter.vo.resp.*;
|
import com.ho.filecenter.vo.resp.*;
|
||||||
@ -58,6 +59,9 @@ public class FileController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
AnotherFileService anotherFileService;
|
AnotherFileService anotherFileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttTopicService mqttTopicService;
|
||||||
@PostMapping("filePage")
|
@PostMapping("filePage")
|
||||||
@ApiOperation(value = "分页查询文件")
|
@ApiOperation(value = "分页查询文件")
|
||||||
public DataResult<PageResult<MediaFile>> filePage(@RequestBody FilePageVO vo, HttpServletRequest request) {
|
public DataResult<PageResult<MediaFile>> filePage(@RequestBody FilePageVO vo, HttpServletRequest request) {
|
||||||
@ -158,7 +162,7 @@ public class FileController {
|
|||||||
return DataResult.success(fileAttributeResp);
|
return DataResult.success(fileAttributeResp);
|
||||||
}
|
}
|
||||||
String serialNo = vo.getSerialNo();
|
String serialNo = vo.getSerialNo();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileAttributeResp = fileService.getFileAttribute(vo);
|
fileAttributeResp = fileService.getFileAttribute(vo);
|
||||||
}else{
|
}else{
|
||||||
@ -180,7 +184,7 @@ public class FileController {
|
|||||||
return DataResult.success(fileDeleteResp);
|
return DataResult.success(fileDeleteResp);
|
||||||
}
|
}
|
||||||
String serialNo = fileDeleteReqVO.getSerialNo();
|
String serialNo = fileDeleteReqVO.getSerialNo();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
|
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
|
||||||
}else{
|
}else{
|
||||||
@ -210,7 +214,7 @@ public class FileController {
|
|||||||
resp.setMsg(CommonConstant.Heartbeat.MSG + serialNo + CommonConstant.Heartbeat.SUCCESS);
|
resp.setMsg(CommonConstant.Heartbeat.MSG + serialNo + CommonConstant.Heartbeat.SUCCESS);
|
||||||
resp.setHeartbeatStatus(CommonConstant.ONE);
|
resp.setHeartbeatStatus(CommonConstant.ONE);
|
||||||
log.info("文件上传(向边端上传)开始上传");
|
log.info("文件上传(向边端上传)开始上传");
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
fileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||||
}else{
|
}else{
|
||||||
@ -240,7 +244,7 @@ public class FileController {
|
|||||||
log.info("文件下载(从边端下载到云端)开始下载");
|
log.info("文件下载(从边端下载到云端)开始下载");
|
||||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||||
String serialNo = fileForDeviceReqVO.getSerialNo();
|
String serialNo = fileForDeviceReqVO.getSerialNo();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import com.ho.common.tools.util.PageResult;
|
|||||||
import com.ho.filecenter.feignclient.BusinessFeignClient;
|
import com.ho.filecenter.feignclient.BusinessFeignClient;
|
||||||
import com.ho.filecenter.feignclient.UserFeignClient;
|
import com.ho.filecenter.feignclient.UserFeignClient;
|
||||||
import com.ho.filecenter.service.AnotherOrderSendService;
|
import com.ho.filecenter.service.AnotherOrderSendService;
|
||||||
|
import com.ho.filecenter.service.MqttTopicService;
|
||||||
import com.ho.filecenter.service.OrderSendService;
|
import com.ho.filecenter.service.OrderSendService;
|
||||||
import com.ho.filecenter.util.MqttConfigUtil;
|
import com.ho.filecenter.util.MqttConfigUtil;
|
||||||
import com.ho.filecenter.vo.mqtt.*;
|
import com.ho.filecenter.vo.mqtt.*;
|
||||||
@ -65,6 +66,9 @@ public class OrderSendController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AnotherOrderSendService anotherOrderSendService;
|
AnotherOrderSendService anotherOrderSendService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttTopicService mqttTopicService;
|
||||||
|
|
||||||
public static final Long TIME_LIMIT = 90L;
|
public static final Long TIME_LIMIT = 90L;
|
||||||
|
|
||||||
@PostMapping("orderIssued")
|
@PostMapping("orderIssued")
|
||||||
@ -163,8 +167,8 @@ public class OrderSendController {
|
|||||||
return DataResult.success(heartbeatResp);
|
return DataResult.success(heartbeatResp);
|
||||||
}
|
}
|
||||||
log.info("指令下发正常开始下发");
|
log.info("指令下发正常开始下发");
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
if(snList.contains(sn)){
|
if(snList.stream().anyMatch(s -> s.contains(sn))){
|
||||||
orderSendService.orderIssued(vo);
|
orderSendService.orderIssued(vo);
|
||||||
}else{
|
}else{
|
||||||
anotherOrderSendService.orderIssued(vo);
|
anotherOrderSendService.orderIssued(vo);
|
||||||
@ -333,9 +337,9 @@ public class OrderSendController {
|
|||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo) {
|
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo) {
|
||||||
String sn = vo.getSn();
|
String sn = vo.getSn();
|
||||||
List<String> snList = MqttConfigUtil.getSnList();
|
List<String> snList = mqttTopicService.getSnList();
|
||||||
HeartbeatResp heartbeatResp = null;
|
HeartbeatResp heartbeatResp = null;
|
||||||
if(snList.contains(sn)){
|
if(snList.stream().anyMatch(s -> s.contains(sn))){
|
||||||
heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
|
heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
|
||||||
}else{
|
}else{
|
||||||
heartbeatResp = anotherOrderSendService.sendPlanPowerOrder(vo);
|
heartbeatResp = anotherOrderSendService.sendPlanPowerOrder(vo);
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.ho.filecenter.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
public interface MqttTopicMapper {
|
||||||
|
List<String> getSnList();
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.ho.filecenter.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
public interface MqttTopicService {
|
||||||
|
|
||||||
|
List<String> getSnList();
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.ho.filecenter.service.impl;
|
||||||
|
|
||||||
|
import com.ho.filecenter.mapper.MqttTopicMapper;
|
||||||
|
import com.ho.filecenter.service.MqttTopicService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kerwin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class MqttTopicServiceImpl implements MqttTopicService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MqttTopicMapper mqttTopicMapper;
|
||||||
|
@Override
|
||||||
|
public List<String> getSnList() {
|
||||||
|
return mqttTopicMapper.getSnList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -133,8 +133,10 @@ public class MqttConfigUtil {
|
|||||||
"+/device/cd6cb4a64b42bda5",
|
"+/device/cd6cb4a64b42bda5",
|
||||||
"+/device/436de647bbf01b22",
|
"+/device/436de647bbf01b22",
|
||||||
"+/device/e9eee97d793756fa",
|
"+/device/e9eee97d793756fa",
|
||||||
"+/device/8c062827b5c1548b"
|
"+/device/8c062827b5c1548b",
|
||||||
|
"+/device/d143856d757625e1",
|
||||||
|
"+/device/3522ab4e7faf28b8",
|
||||||
|
"1/device/+"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -180,13 +182,4 @@ public class MqttConfigUtil {
|
|||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取SN配置合集
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getSnList(){
|
|
||||||
List<String> strings = Arrays.asList(commonTopic);
|
|
||||||
return strings;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
file-center/src/main/resources/mapper/MqttTopicMapper.xml
Normal file
10
file-center/src/main/resources/mapper/MqttTopicMapper.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?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.ho.filecenter.mapper.MqttTopicMapper">
|
||||||
|
|
||||||
|
<select id="getSnList" resultType="java.lang.String">
|
||||||
|
select topic from mqtt_topic
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user