|
@@ -11,4 +11,58 @@ import org.springframework.stereotype.Service;
|
|
|
**/
|
|
|
@Service
|
|
|
public class AlarmRecordServiceImpl {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ AlarmClient alarmClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询报警记录
|
|
|
+ * @param queryAlarmRecordDTO 入参
|
|
|
+ * @return 报警记录列表
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public DmpResult<List<AlarmRecordItem>> query(QueryAlarmRecordDTO queryAlarmRecordDTO) throws Exception {
|
|
|
+ QueryDTO<QueryAlarmRecordDTO> queryDTO = new QueryDTO<>();
|
|
|
+ queryDTO.setCriteria(queryAlarmRecordDTO);
|
|
|
+ JSONObject jsonObject = Obj2JSONObject.convert(queryDTO);
|
|
|
+ DmpResult<JSONArray> result = alarmClient.queryAlarmRecord(queryAlarmRecordDTO.fetchParams(), jsonObject);
|
|
|
+ return DmpResultUtil.multiConvert(result, AlarmRecordItem.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建报警记录
|
|
|
+ * @param addAlarmRecordDTO 入参
|
|
|
+ * @return 报警记录id
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public DmpResult<DmpUpsertVO> create(AddAlarmRecordDTO addAlarmRecordDTO) throws Exception{
|
|
|
+ JSONObject jsonObject = Obj2JSONObject.convert(addAlarmRecordDTO);
|
|
|
+ DmpResult<JSONObject> alarmRecord = alarmClient.createAlarmRecord(addAlarmRecordDTO.fetchParams(), jsonObject);
|
|
|
+ return DmpResultUtil.singleConvert(alarmRecord, DmpUpsertVO.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新报警记录
|
|
|
+ * @param updateAlarmRecordDTO 入参
|
|
|
+ * @return 报警记录id
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public DmpResult<DmpUpsertVO> update(UpdateAlarmRecordDTO updateAlarmRecordDTO) throws Exception{
|
|
|
+ JSONObject jsonObject = Obj2JSONObject.convert(updateAlarmRecordDTO);
|
|
|
+ DmpResult<JSONObject> alarmRecord = alarmClient.updateAlarmRecord(updateAlarmRecordDTO.fetchParams(), jsonObject);
|
|
|
+ return DmpResultUtil.singleConvert(alarmRecord, DmpUpsertVO.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量更新报警记录
|
|
|
+ * @param batchUpdateAlarmRecordDTO 入参
|
|
|
+ * @return 报警记录ids
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public DmpResult<DmpBatchUpsertVO> batchUpdate(BatchUpdateAlarmRecordDTO batchUpdateAlarmRecordDTO) throws Exception {
|
|
|
+ JSONObject jsonObject = Obj2JSONObject.convert(batchUpdateAlarmRecordDTO);
|
|
|
+ DmpResult<JSONObject> result = alarmClient.batchUpdateAlarmRecord(batchUpdateAlarmRecordDTO.fetchParams(), jsonObject);
|
|
|
+ return DmpResultUtil.singleConvert(result, DmpBatchUpsertVO.class);
|
|
|
+ }
|
|
|
+
|
|
|
}
|