| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.hik.Commom.CommonUtil; |
| | | import com.whyc.mapper.EnvironmentMapper; |
| | | import com.whyc.mapper.IdentifyAlarmMapper; |
| | | import com.whyc.pojo.db_fire_robot.IdentifyAlarm; |
| | | import com.whyc.pojo.db_fire_robot.IdentifyAlarmHis; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.apache.commons.beanutils.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class IdentifyAlarmService { |
| | |
| | | @Resource |
| | | private IdentifyAlarmMapper mapper; |
| | | |
| | | @Autowired |
| | | private IdentifyAlarmHisService hisService; |
| | | |
| | | public void add(IdentifyAlarm alarm) { |
| | | mapper.insert(alarm); |
| | | } |
| | | |
| | | public Response getList() { |
| | | List<IdentifyAlarm> list = mapper.selectList((Wrapper<IdentifyAlarm>) ActionUtil.objeNull); |
| | | return new Response<>().set(1, list); |
| | | } |
| | | |
| | | @Transactional |
| | | public Response confirm(int id) throws InvocationTargetException, IllegalAccessException { |
| | | IdentifyAlarm alarm = mapper.selectById(id); |
| | | //加入到告警历史表 |
| | | IdentifyAlarmHis his = new IdentifyAlarmHis(); |
| | | BeanUtils.copyProperties(his,alarm); |
| | | his.setId(null); |
| | | his.setConfirmTime(new Date()); |
| | | hisService.add(his); |
| | | //删除告警记录 |
| | | mapper.deleteById(id); |
| | | return new Response().setII(1,"确认完成"); |
| | | } |
| | | |
| | | } |