相关代码接口调整
This commit is contained in:
parent
9b6485db8d
commit
130a85e2c9
@ -21,5 +21,10 @@
|
|||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>2.2.19</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@ -35,9 +35,10 @@ public class MongoConstant {
|
|||||||
*/
|
*/
|
||||||
public static final String EQ = "and";
|
public static final String EQ = "and";
|
||||||
public static final String IN = "in";
|
public static final String IN = "in";
|
||||||
public static final String NOT_IN = "not_in";
|
public static final String NOT_IN = "not-in";
|
||||||
public static final String GT = "gt";
|
public static final String GT = "gt";
|
||||||
public static final String GE = "ge";
|
public static final String GE = "ge";
|
||||||
|
public static final String GT_GE = "ge-ge";
|
||||||
public static final String LT = "lt";
|
public static final String LT = "lt";
|
||||||
public static final String LE = "le";
|
public static final String LE = "le";
|
||||||
public static final String REGEX = "regex";
|
public static final String REGEX = "regex";
|
||||||
|
|||||||
@ -192,6 +192,11 @@ public class MongoDBService {
|
|||||||
case MongoConstant.GE:
|
case MongoConstant.GE:
|
||||||
query.addCriteria(Criteria.where(keyAndQueryType[1]).gte(params.get(key)));
|
query.addCriteria(Criteria.where(keyAndQueryType[1]).gte(params.get(key)));
|
||||||
break;
|
break;
|
||||||
|
case MongoConstant.GT_GE:
|
||||||
|
String begin = String.valueOf(params.get(key)).split(MongoConstant.SEPARATION)[0];
|
||||||
|
String end = String.valueOf(params.get(key)).split(MongoConstant.SEPARATION)[1];
|
||||||
|
query.addCriteria(Criteria.where(keyAndQueryType[1]).gte(begin).lte(end));
|
||||||
|
break;
|
||||||
case MongoConstant.LT:
|
case MongoConstant.LT:
|
||||||
query.addCriteria(Criteria.where(keyAndQueryType[1]).lt(params.get(key)));
|
query.addCriteria(Criteria.where(keyAndQueryType[1]).lt(params.get(key)));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1,11 +1,18 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDcRequest;
|
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDcRequest;
|
||||||
|
import com.evotech.hd.cloud.mqtt.message.dto.older.BatData;
|
||||||
|
import com.evotech.hd.cloud.mqtt.message.dto.older.state.HdChargingData;
|
||||||
import com.evotech.hd.cloud.service.BatteryStationDcService;
|
import com.evotech.hd.cloud.service.BatteryStationDcService;
|
||||||
|
import com.evotech.hd.common.constant.MongoConstant;
|
||||||
import com.evotech.hd.common.core.Dto.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryTrace;
|
import com.evotech.hd.common.core.entity.cloud.BatteryTrace;
|
||||||
|
import com.evotech.hd.common.core.utils.Collections;
|
||||||
|
import com.evotech.hd.common.dtos.BatDataDto;
|
||||||
|
import com.evotech.hd.common.service.MongoDBService;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -13,13 +20,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Tag(name = "换电站电池")
|
@Tag(name = "换电站电池")
|
||||||
@ApiSupport(order = 12)
|
@ApiSupport(order = 12)
|
||||||
@ -30,6 +36,9 @@ public class BatteryStationDcController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BatteryStationDcService batteryStationDcService;
|
private BatteryStationDcService batteryStationDcService;
|
||||||
|
@Resource
|
||||||
|
MongoDBService mongoDBService;
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "增加")
|
@Operation(summary = "增加")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ -83,4 +92,45 @@ public class BatteryStationDcController {
|
|||||||
return batteryStationDcService.deleteTrace(id);
|
return batteryStationDcService.deleteTrace(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "电池动态图")
|
||||||
|
@PostMapping("/dynamic/detail")
|
||||||
|
@ApiOperationSupport(order = 8)
|
||||||
|
public Result<Map<String,List>> dynamicDetail(@RequestBody BatDataDto batDataDto) {
|
||||||
|
List<com.evotech.hd.common.documnet.BatData> batDataList = mongoDBService.find(MongoConstant.BATTERY_BOX_DATA_BASE, batDataDto.getBatCode(),
|
||||||
|
com.evotech.hd.common.documnet.BatData.class,
|
||||||
|
Collections.asMap(
|
||||||
|
MongoConstant.GT_GE+ MongoConstant.SEPARATION+"id",String.valueOf(batDataDto.getBeginTime().getTime())+MongoConstant.SEPARATION+String.valueOf(batDataDto.getEndTime().getTime()),
|
||||||
|
MongoConstant.SORT+ MongoConstant.SEPARATION+MongoConstant.SORT_DESC, "id"
|
||||||
|
));
|
||||||
|
List<BatData> resultBatDataList = Collections.emptyList();
|
||||||
|
if(Collections.isNotEmpty(batDataList)){
|
||||||
|
batDataList.stream().forEach(data->{
|
||||||
|
if(StringUtils.isNotEmpty(data.getValue())){
|
||||||
|
BatData batData = JSONUtil.toBean(data.getValue(), BatData.class);
|
||||||
|
batData.setId(data.getId());
|
||||||
|
resultBatDataList.add(batData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
List<com.evotech.hd.common.documnet.ChargingData> chargingDataList = mongoDBService.find(MongoConstant.BATTERY_DATA_BASE, batDataDto.getBatCode(),
|
||||||
|
com.evotech.hd.common.documnet.ChargingData.class,
|
||||||
|
Collections.asMap(
|
||||||
|
MongoConstant.GT_GE+ MongoConstant.SEPARATION+"id",String.valueOf(batDataDto.getBeginTime().getTime())+MongoConstant.SEPARATION+String.valueOf(batDataDto.getEndTime().getTime()),
|
||||||
|
MongoConstant.SORT+ MongoConstant.SEPARATION+MongoConstant.SORT_DESC, "id"
|
||||||
|
));
|
||||||
|
List<HdChargingData> resultChargingDataList = Collections.emptyList();
|
||||||
|
if(Collections.isNotEmpty(batDataList)){
|
||||||
|
chargingDataList.stream().forEach(data->{
|
||||||
|
if(StringUtils.isNotEmpty(data.getValue())){
|
||||||
|
HdChargingData chargingData = JSONUtil.toBean(data.getValue(), HdChargingData.class);
|
||||||
|
chargingData.setId(data.getId());
|
||||||
|
resultChargingDataList.add(chargingData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return new Result().success(Collections.asMap("batData", resultBatDataList, "chargingData", resultChargingDataList));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public class AlarmController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "推送通知")
|
@Operation(summary = "推送通知")
|
||||||
@PostMapping("/send/{path}")
|
@PostMapping("/send/{path}")
|
||||||
|
|
||||||
public Result<String> deleteDetail(@RequestBody AlarmTemplate param,@PathVariable("path")String path) {
|
public Result<String> deleteDetail(@RequestBody AlarmTemplate param,@PathVariable("path")String path) {
|
||||||
AlarmTemplate alarmTemplate = alarmTemplateService.getOne(new LambdaQueryWrapper<AlarmTemplate>().eq(AlarmTemplate::getPath, path), false);
|
AlarmTemplate alarmTemplate = alarmTemplateService.getOne(new LambdaQueryWrapper<AlarmTemplate>().eq(AlarmTemplate::getPath, path), false);
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.evotech.hd.cloud.mqtt.message.dto.older.state;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ import java.util.Date;
|
|||||||
* @date 2023-12-03
|
* @date 2023-12-03
|
||||||
*/
|
*/
|
||||||
@Schema(name = "电池箱实时信息", hidden = true)
|
@Schema(name = "电池箱实时信息", hidden = true)
|
||||||
|
@Data
|
||||||
public class HdChargingData {
|
public class HdChargingData {
|
||||||
|
|
||||||
@Schema(name = "主键")
|
@Schema(name = "主键")
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class MqttMessageHandleService {
|
|||||||
}
|
}
|
||||||
// 2. keepalive不加密,单独处理
|
// 2. keepalive不加密,单独处理
|
||||||
if (MqttMessageTypeEnum.KEEPALIVE.getType().equals(topic.getMessageType())) {
|
if (MqttMessageTypeEnum.KEEPALIVE.getType().equals(topic.getMessageType())) {
|
||||||
keepaliveMessageService.keepAlive(topic, message);
|
keepaliveMessageService.keepAlive(topic, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 3. 其他 AES加密
|
// 3. 其他 AES加密
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class StrategyFactory implements InitializingBean, ApplicationContextAwar
|
|||||||
MessageMqtt messageMqtt = new MessageMqtt();
|
MessageMqtt messageMqtt = new MessageMqtt();
|
||||||
messageMqtt.setStationCode(json.getString("stationCode"));
|
messageMqtt.setStationCode(json.getString("stationCode"));
|
||||||
messageMqtt.setDirection("M2S");
|
messageMqtt.setDirection("M2S");
|
||||||
messageMqtt.setType("状态信息类");
|
messageMqtt.setType("WEB站控推送");
|
||||||
messageMqtt.setMessageFunction(json.getString("method"));
|
messageMqtt.setMessageFunction(json.getString("method"));
|
||||||
messageMqtt.setTopic(json.getString("class"));
|
messageMqtt.setTopic(json.getString("class"));
|
||||||
messageMqtt.setContent(json.toJSONString());
|
messageMqtt.setContent(json.toJSONString());
|
||||||
|
|||||||
@ -57,6 +57,6 @@ public class AlarmProcessor implements StationMessageStrategyExchangeProcessor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return Result.getInstance().build(Boolean.class).success(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class OrderSwapProcessor implements StationMessageStrategyExchangeProcess
|
|||||||
return Result.getInstance().build(Boolean.class).success(true);
|
return Result.getInstance().build(Boolean.class).success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();;
|
e.printStackTrace();;
|
||||||
return Result.getInstance().build(Boolean.class).error(e.getMessage(), null);
|
return Result.getInstance().build(Boolean.class).error(e.getMessage(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,6 +124,21 @@ public class OrderSwapProcessor implements StationMessageStrategyExchangeProcess
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return Result.getInstance().build(JSONObject.class).error(e.getMessage(), null);
|
return Result.getInstance().build(JSONObject.class).error(e.getMessage(), null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 关闭订单信息
|
||||||
|
* @param json
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Result closeOrderStatus(JSONObject json){
|
||||||
|
try {
|
||||||
|
Order order = orderService.getById(json.getInteger("pkId"));
|
||||||
|
order.setStatus(json.getInteger("status"));
|
||||||
|
return Result.getInstance().build(Boolean.class).success(orderService.updateById(order));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return Result.getInstance().build(Boolean.class).error(e.getMessage(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class HomeDataOrderSwapTask {
|
|||||||
Date d = new Date();
|
Date d = new Date();
|
||||||
List<Order> list = orderDao.selectList(new QueryWrapper<Order>()
|
List<Order> list = orderDao.selectList(new QueryWrapper<Order>()
|
||||||
.or(i -> i.and(j -> j.ge("order_time", DateUtil.beginOfDay(d)).le("order_time", DateUtil.endOfDay(d)))
|
.or(i -> i.and(j -> j.ge("order_time", DateUtil.beginOfDay(d)).le("order_time", DateUtil.endOfDay(d)))
|
||||||
.or(j -> j.ge("uptime", DateUtil.beginOfDay(d)).le("uptime", DateUtil.endOfDay(d)))));
|
.or(j -> j.ge("ctime", DateUtil.beginOfDay(d)).le("ctime", DateUtil.endOfDay(d)))));
|
||||||
List<String> dayStringList = list.stream().map(i -> DateUtil.format(i.getOrderTime(), DatePattern.PURE_DATE_PATTERN)).distinct().toList();
|
List<String> dayStringList = list.stream().map(i -> DateUtil.format(i.getOrderTime(), DatePattern.PURE_DATE_PATTERN)).distinct().toList();
|
||||||
for (int i = 0; i < dayStringList.size(); i++) {
|
for (int i = 0; i < dayStringList.size(); i++) {
|
||||||
String dayString = dayStringList.get(i);
|
String dayString = dayStringList.get(i);
|
||||||
|
|||||||
@ -54,6 +54,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||||||
return dateTimeNow(YYYY_MM_DD);
|
return dateTimeNow(YYYY_MM_DD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long getDateTime()
|
||||||
|
{
|
||||||
|
return System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Long getDateTime(Date date)
|
||||||
|
{
|
||||||
|
return date.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
public static final String getTime()
|
public static final String getTime()
|
||||||
{
|
{
|
||||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class GZHAccessTokenService {
|
|||||||
if (StringUtils.hasText(jo.getStr("errcode"))) {
|
if (StringUtils.hasText(jo.getStr("errcode"))) {
|
||||||
throw new RuntimeException(res);
|
throw new RuntimeException(res);
|
||||||
}
|
}
|
||||||
redisUtil.set(accessTokenPrefix + gzhProperties.getAppid(), jo.getStr("access_token"), 7200L);
|
redisUtil.set(accessTokenPrefix + gzhProperties.getAppid(), jo.getStr("access_token"), 7000L);
|
||||||
return jo.getStr("access_token");
|
return jo.getStr("access_token");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user