|
|
@@ -804,7 +804,19 @@ public class HardwareApiServiceImpl implements HardwareApiService {
|
|
|
public Boolean updateSwitchList(UpdateSwitchParam dto) {
|
|
|
Assert.isFalse(dto.getList().isEmpty(), "点位开关数据不可为空!");
|
|
|
Date date = new Date();
|
|
|
- dto.getList().forEach(o -> o.setSwitchLastUpdateTime(date));
|
|
|
+ List<String> collect = dto.getList().stream().map(UpdateSwitchStatusDTO::getPointSerialNumber).collect(Collectors.toList());
|
|
|
+ Assert.isFalse(collect.isEmpty(), "请提供硬件序列号!");
|
|
|
+ List<IsIsolationPoint> list = iIsIsolationPointService.list(Wrappers.<IsIsolationPoint>lambdaQuery()
|
|
|
+ .in(IsIsolationPoint::getPointSerialNumber, collect));
|
|
|
+ for (UpdateSwitchStatusDTO updateSwitchStatusDTO : dto.getList()) {
|
|
|
+ Assert.notBlank(updateSwitchStatusDTO.getPointSerialNumber(), "存在序列号为空的数据!");
|
|
|
+ updateSwitchStatusDTO.setSwitchLastUpdateTime(date);
|
|
|
+ for (IsIsolationPoint isIsolationPoint : list) {
|
|
|
+ if (updateSwitchStatusDTO.getPointSerialNumber().equals(isIsolationPoint.getPointSerialNumber())) {
|
|
|
+ updateSwitchStatusDTO.setPointNfc(isIsolationPoint.getPointNfc());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
redisCache.setCacheList(SYS_ATTR + "sys.points.switch.last", dto.getList());
|
|
|
redisCache.expire(SYS_ATTR + "sys.points.switch.last", 60, TimeUnit.SECONDS);
|
|
|
redisCache.deleteObject(SYS_ATTR + "sys.points.switch.records");
|