Commit 267ad873 authored by maoying's avatar maoying

添加画布初始化接口

parent 0966861c
package com.yeejoin.equipmanage.common.entity.vo;
import java.util.List;
import java.util.Map;
import lombok.Data;
/**
* 画布实例
*/
@Data
public class SceneContentVo {
private String layout;
private Map<String,Object> boardStyle;
private Map<String,Object> dataConfig;
private Map<String,Object> boardConfig;
private List<PointTreeVo> children;
}
......@@ -309,5 +309,12 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map<String, Object> getStationConnectStatus();
List<Map<String, Object>> getStationStatusStatistics();
/**
* 重置画布
*
* @param resourceDTO 参数
*/
void resetMorphic();
}
......@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -140,6 +141,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired
private JCSRemoteService jcsRemoteService;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private VideoMapper videoMapper;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
......@@ -2343,4 +2350,61 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getStationStatusStatistics();
}
@Override
public void resetMorphic() {
try {
QueryWrapper<SourceScene> wrapper = new QueryWrapper();
List<SourceScene> sourceScenes = sourceSceneMapper.selectList(wrapper);
if(ObjectUtils.isEmpty(sourceScenes)){
sourceScenes.forEach(sourceScene->{
ResourceDTO resourceDTO = Morphic.morphicSubjectClient.seleteOne(sourceScene.getSceneId()).getResult();
String content = resourceDTO.getContent();
SceneContentVo parse = (SceneContentVo) JSON.parse(content);
List<PointTreeVo> pointList = (List<PointTreeVo>) parse.getChildren();
if(!ObjectUtils.isEmpty(pointList)){
List<PointTreeVo> newPointList = new ArrayList<>();
String pointInScene = "";
String videoInScene = "";
for(PointTreeVo action:pointList){
if("equipment".equals(action.getKey())){
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(action.getSequenceNbr());
if(ObjectUtils.isEmpty(equipmentSpecific)){
continue;
}
action.setIotCode(equipmentSpecific.getIotCode());
action.setDisplayName(equipmentSpecific.getName());
action.setEquipSyetemId(equipmentSpecific.getSystemId());
newPointList.add(action);
pointInScene = "".equals(pointInScene) ? action.getSequenceNbr().toString()
: pointInScene + "," + action.getSequenceNbr();
}else{
Video video = videoMapper.selectById(action.getSequenceNbr());
if(ObjectUtils.isEmpty(video)){
continue;
}
action.setIotCode(video.getCode());
action.setDisplayName(video.getName());
newPointList.add(action);
videoInScene = "".equals(videoInScene) ? action.getSequenceNbr().toString()
: videoInScene + "," + action.getSequenceNbr();
}
}
parse.setChildren(newPointList);
resourceDTO.setContent(content);
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO));
sourceScene.setPointInScene(pointInScene);
sourceScene.setVideoInScene(videoInScene);
iSourceSceneService.saveOrUpdate(sourceScene);
}
});
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("保存画布失败");
}
}
}
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