iscs v2
This commit is contained in:
parent
9f53eb27df
commit
232b44cf06
Binary file not shown.
@ -9,7 +9,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@EnableCaching
|
||||
@MapperScan(basePackages = {"club.joylink.rtss.dao"})
|
||||
@MapperScan(basePackages = {"club.joylink.rtss.dao","club.joylink.rtss.iscs.dao"})
|
||||
//@EnableRetry
|
||||
public class RtssApplication {
|
||||
|
||||
|
@ -33,6 +33,10 @@ public class CommonResponseBody implements ResponseBodyAdvice {
|
||||
@Override
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
|
||||
Class selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
|
||||
if(body instanceof byte[]){
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
return body;
|
||||
}
|
||||
if(body instanceof CommonJsonResponse) {
|
||||
return body;
|
||||
}
|
||||
|
@ -1,13 +1,96 @@
|
||||
package club.joylink.rtss.iscs.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.iscs.entity.IscsModelData;
|
||||
import club.joylink.rtss.iscs.services.IscsModelDataService;
|
||||
import club.joylink.rtss.iscs.vo.IscsModelDataBasicInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* iscs 模型数据处理接口
|
||||
* <p>
|
||||
* [
|
||||
* "Plan-设备运行图: Plan/DeviceRunning",<br>
|
||||
* "Plan-站厅布局图: Plan/HallLayout",<br>
|
||||
* "Plan-站台布局图: Plan/PlatformLayout",<br>
|
||||
* "Plan-出入口布局图: Plan/EntranceLayout",<br>
|
||||
* "PSCADA-一次图: PSCADA/OneTimeGraph",<br>
|
||||
* "PSCADA-自动化系统图: PSCADA/AutoSysGraph",<br>
|
||||
* "PSCADA-定值召唤: PSCADA/SettingCall",<br>
|
||||
* "PSCADA-实时SOE: PSCADA/RealTimeSOE",<br>
|
||||
* "PSCADA-历史SOE: PSCADA/HistoricalSOE",<br>
|
||||
* "PSCADA-光字屏: PSCADA/Screen",<br>
|
||||
* "BAS-大系统: BAS/BigSys",<br>
|
||||
* "BAS-小系统: BAS/SmallSys",<br>
|
||||
* "BAS-隧道通风系统: BAS/TunnelVentilationSys",<br>
|
||||
* "BAS-水系统: BAS/WaterSys",<br>
|
||||
* "BAS-给排水: BAS/DrainageSys",<br>
|
||||
* "BAS-电扶梯: BAS/Escalator",<br>
|
||||
* "BAS-照明系统: BAS/LightingSys",<br>
|
||||
* "BAS-传感器: BAS/Sensor",<br>
|
||||
* "BAS-导向标识/广告: BAS/WayfindingNAds",<br>
|
||||
* "BAS-人防门: BAS/CivilDefense",<br>
|
||||
* "BAS-BAS系统图: BAS/BASSys",<br>
|
||||
* "BAS-模式控制: BAS/ModeControl",<br>
|
||||
* "BAS-时间表: BAS/TimeTable",<br>
|
||||
* "FAS-设备分区图: FAS/DevicePartition",<br>
|
||||
* "FAS-火灾报警平面图: FAS/FireAlarmLayout",<br>
|
||||
* "FAS-FAS气灭系统图: FAS/GaseousFireSuppressionSys",<br>
|
||||
* "TFDS-感温光纤状态监视图: TFDS/TFDSState",<br>
|
||||
* "AFC-自动售检票系统监视图: AFC/AFCState",<br>
|
||||
* "CCTV-监控布局图: CCTV/MonitorLayout",<br>
|
||||
* "CCTV-CCTV设备布局图: CCTV/CCTVEquipLayout",<br>
|
||||
* "PIS-PIS监控: PIS/PIS",<br>
|
||||
* "PSD-屏蔽门系统图: PSD/PSDSys",<br>
|
||||
* "ACS-门禁总览图: ACS/ACSOverview",<br>
|
||||
* "ACS-门禁监视布局图-站厅: ACS/ACSLayoutHall",<br>
|
||||
* "ACS-门禁监视布局图-站台: ACS/ACSLayoutStation",<br>
|
||||
* "FG-防淹门状态监视图: FG/FGState",<br>
|
||||
* "PA-PA监控: PA/PA",<br>
|
||||
* "NMS-网络状态监视图: NMS/NMS"<br>
|
||||
* ]
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/iscs/model/data")
|
||||
@RequestMapping("/api/v2/iscs")
|
||||
public class IscsModelDataController {
|
||||
@Autowired
|
||||
private IscsModelDataService modelDataService;
|
||||
|
||||
/**
|
||||
* 初始化模型数据
|
||||
*
|
||||
* @param data 模型proto数据DataModelMap
|
||||
*/
|
||||
@PostMapping("/{system}/{view}/{place}/init")
|
||||
public IscsModelDataBasicInfo storeModelData(@PathVariable("system") String system, @PathVariable("view") String view, @PathVariable("place") String place, @RequestBody byte[] data) {
|
||||
log.debug("==>>初始化模型数据 system = {} view = {} place = {}", system, view, place);
|
||||
final IscsModelData param = new IscsModelData();
|
||||
param.setSystem(system);
|
||||
param.setView(view);
|
||||
param.setPlace(place);
|
||||
param.setData(data);
|
||||
return modelDataService.storeModelData(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模型数据
|
||||
*
|
||||
* @return 模型proto数据DataModelMap
|
||||
*/
|
||||
@GetMapping("/{system}/{view}/{place}")
|
||||
@ResponseBody
|
||||
public byte[] findModelData(@PathVariable("system") String system, @PathVariable("view") String view, @PathVariable("place") String place) {
|
||||
log.debug("==>>获取模型数据 system = {} view = {} place = {}", system, view, place);
|
||||
final IscsModelDataBasicInfo param = new IscsModelDataBasicInfo();
|
||||
param.setSystem(system);
|
||||
param.setView(view);
|
||||
param.setPlace(place);
|
||||
final IscsModelData rt = modelDataService.findModelData(param);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != rt && null != rt.getData(), "模型数据不存在");
|
||||
return rt.getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,64 @@
|
||||
package club.joylink.rtss.iscs.services;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.iscs.dao.IscsModelDataDAO;
|
||||
import club.joylink.rtss.iscs.entity.IscsModelData;
|
||||
import club.joylink.rtss.iscs.entity.IscsModelDataExample;
|
||||
import club.joylink.rtss.iscs.vo.IscsModelDataBasicInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class IscsModelDataService {
|
||||
@Autowired
|
||||
private IscsModelDataDAO modelDataDao;
|
||||
|
||||
/**
|
||||
* 存储模型数据
|
||||
*/
|
||||
@Transactional(readOnly = false, rollbackFor = Exception.class)
|
||||
public IscsModelDataBasicInfo storeModelData(final IscsModelData md) {
|
||||
//参数校验
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != md.getSystem() && null != md.getView() && null != md.getPlace(),"参数校验失败");
|
||||
//
|
||||
IscsModelData has = findBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace());
|
||||
if (null != has) {//更新
|
||||
md.setId(has.getId());
|
||||
modelDataDao.updateByPrimaryKeySelective(md);
|
||||
} else {//新增
|
||||
modelDataDao.insertSelective(md);
|
||||
has = findBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace());
|
||||
}
|
||||
//
|
||||
IscsModelDataBasicInfo rt = new IscsModelDataBasicInfo();
|
||||
rt.setId(has.getId());
|
||||
rt.setSystem(has.getSystem());
|
||||
rt.setView(has.getView());
|
||||
rt.setPlace(has.getPlace());
|
||||
return rt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据完整基本模型信息获取模型数据
|
||||
*/
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public IscsModelData findModelData(final IscsModelDataBasicInfo md) {
|
||||
//参数校验
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != md.getSystem() && null != md.getView() && null != md.getPlace(),"参数校验失败");
|
||||
//
|
||||
return findBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据基本信息查询模型(不包括大字段信息)
|
||||
*/
|
||||
private IscsModelData findBySystemViewAndPlace(String system, String view, String place) {
|
||||
IscsModelDataExample example = new IscsModelDataExample();
|
||||
example.createCriteria().andSystemEqualTo(system).andViewEqualTo(view).andPlaceEqualTo(place);
|
||||
List<IscsModelData> list = modelDataDao.selectByExample(example);
|
||||
return null != list && list.size() > 0 ? list.get(0) : null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package club.joylink.rtss.iscs.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IscsModelDataBasicInfo {
|
||||
/**
|
||||
* 模型数据记录id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* iscs一级系统(如FAS、PIS、AFC等)
|
||||
*/
|
||||
private String system;
|
||||
/**
|
||||
* iscs二级视图
|
||||
*/
|
||||
private String view;
|
||||
/**
|
||||
* 场所(车站、变电所、停车场等)
|
||||
*/
|
||||
private String place;
|
||||
}
|
Loading…
Reference in New Issue
Block a user