feat: 1:地图仪表盘 2:获取设备消息
This commit is contained in:
+11
-1
@@ -10,6 +10,7 @@ import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.model.SysUser;
|
||||
import com.central.log.annotation.AuditLog;
|
||||
import com.central.order.constants.OrderStatusConstants;
|
||||
import com.central.order.enums.CommonStatus;
|
||||
import com.central.order.enums.OrderStatus;
|
||||
import com.central.order.feign.DeviceCenterService;
|
||||
@@ -386,7 +387,16 @@ public class OrderController {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("price",appendPriceStr(qrCode.getPrice()));
|
||||
Integer count = orderService.getOrderRankingByOrderIdAndDevice(order.getId(), qrCode.getDeviceSn());
|
||||
map.put("count", count == 1 ? -1 : count-1 );
|
||||
if(count==1){
|
||||
//需要判断订单状态,如果是排队中则返回-1
|
||||
if(OrderStatus.PAID.getId().equals(order.getOrderStatus())){
|
||||
map.put("count",-1);
|
||||
}else{
|
||||
map.put("count",-2);
|
||||
}
|
||||
}else{
|
||||
map.put("count",count-1);
|
||||
}
|
||||
map.put("time",Math.multiplyExact((count-1),DEVICE_EXEC_TIME));
|
||||
return Result.succeed(map,"获取成功");
|
||||
}
|
||||
|
||||
+17
@@ -175,4 +175,21 @@ public class TourismController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据景区ID获取设备SN列表
|
||||
* 通过景区下的非测试二维码查询绑定的设备SN(去重)
|
||||
*/
|
||||
@Operation(summary = "根据景区ID获取设备SN列表")
|
||||
@GetMapping("/{tourismId}/device-sns")
|
||||
public Result<List<String>> getDeviceSnsByTourismId(@PathVariable("tourismId") Long tourismId) {
|
||||
try {
|
||||
log.info("根据景区ID获取设备SN列表,景区ID: {}", tourismId);
|
||||
List<String> deviceSns = tourismService.getDeviceSnsByTourismId(tourismId);
|
||||
return Result.succeed(deviceSns, "获取设备SN列表成功");
|
||||
} catch (Exception e) {
|
||||
log.error("获取设备SN列表失败,景区ID: {}", tourismId, e);
|
||||
return Result.failed("获取设备SN列表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -87,5 +87,13 @@ public interface ITourismService extends ISuperService<Tourism> {
|
||||
Map<Long, Tourism> getTourismsByIds(java.util.Set<Long> ids);
|
||||
|
||||
List<QrCode> getQrcodesByTourismId(Long id) ;
|
||||
|
||||
/**
|
||||
* 根据景区ID获取设备SN列表(去重)
|
||||
* 通过景区下的非测试二维码查询绑定的设备SN
|
||||
* @param tourismId 景区ID
|
||||
* @return 去重后的设备SN列表
|
||||
*/
|
||||
List<String> getDeviceSnsByTourismId(Long tourismId);
|
||||
}
|
||||
|
||||
|
||||
+23
@@ -242,4 +242,27 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
|
||||
return qrCodeMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDeviceSnsByTourismId(Long tourismId) {
|
||||
log.info("根据景区ID获取设备SN列表,景区ID: {}", tourismId);
|
||||
|
||||
// 查询景区下的非测试二维码
|
||||
List<QrCode> qrCodes = getQrcodesByTourismId(tourismId);
|
||||
|
||||
if (qrCodes == null || qrCodes.isEmpty()) {
|
||||
log.info("景区ID {} 下没有非测试二维码", tourismId);
|
||||
return List.of();
|
||||
}
|
||||
|
||||
// 提取设备SN并去重(过滤掉null和空字符串)
|
||||
List<String> deviceSns = qrCodes.stream()
|
||||
.map(QrCode::getDeviceSn)
|
||||
.filter(sn -> sn != null && !sn.trim().isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("景区ID {} 下的设备SN数量: {}", tourismId, deviceSns.size());
|
||||
return deviceSns;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user