| | |
| | | import com.fgkj.mapper.impl.Dev_paramMapper; |
| | | import com.fgkj.mapper.impl.Process_surveyMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.TransactionDefinition; |
| | | import org.springframework.transaction.TransactionStatus; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | @Service |
| | | public class Dev_paramService { |
| | | |
| | | private ServiceModel model; |
| | | ServiceModel model = new ServiceModel(); |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private Dev_paramMapper mapper; |
| | | @Autowired |
| | | @Resource |
| | | private Process_surveyMapper surveyMapper; |
| | | |
| | | //给设备添加参数 |
| | |
| | | return model; |
| | | } |
| | | //查询所有设备的所有的告警参数 |
| | | public ServiceModel update(Object obj){ |
| | | Boolean bl=mapper.update(obj); |
| | | if(bl){ |
| | | public ServiceModel update(Dev_param obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl = true; |
| | | try { |
| | | bl = mapper.update(obj) > 0; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | model.setCode(0); |
| | | model.setMsg("修改失败!"); |
| | | return model; |
| | | } |
| | | if (bl) { |
| | | //告警参数修改成功后重启服务 |
| | | int alarm_id=((Dev_param) obj).getAlm_id(); |
| | | Process_survey process=new Process_survey(); |
| | | int alarm_id = ((Dev_param) obj).getAlm_id(); |
| | | Process_survey process = new Process_survey(); |
| | | //将电池告警的服务设为重启 |
| | | process.setProcessName(ProcessServerDao.BMS_FBSDEV_ALARM_BATT); |
| | | Boolean b=surveyMapper.update(process); |
| | | Boolean b = surveyMapper.update(process); |
| | | model.setCode(1); |
| | | model.setMsg("修改成功!"); |
| | | }else{ |
| | | } else { |
| | | model.setCode(0); |
| | | model.setMsg("修改失败!"); |
| | | } |
| | |
| | | } |
| | | //查询所有设备的所有的告警参数 |
| | | public ServiceModel searchAll(){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.searchAll(); |
| | | if(list!=null && list.size()>0){ |
| | | model.setCode(1); |
| | |
| | | return model; |
| | | } |
| | | //根据设备id和告警类型查设备告警参数 |
| | | public ServiceModel serchByCondition(Object obj){ |
| | | public ServiceModel serchByCondition(Dev_param obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchByCondition(obj); |
| | | if(list!=null && list.size()>0){ |
| | | model.setCode(1); |
| | |
| | | } |
| | | //查询所有存在设备告警参数的机房 |
| | | public ServiceModel serchAllDevId(){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchAllDevId(); |
| | | if(list!=null && list.size()>0){ |
| | | model.setCode(1); |
| | |
| | | return model; |
| | | } |
| | | //根据设备id查询设备对应的告警参数种类 |
| | | public ServiceModel serchByInfo(Object obj){ |
| | | public ServiceModel serchByInfo(Dev_param obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchByInfo(obj); |
| | | if(list!=null && list.size()>0){ |
| | | model.setCode(1); |
| | |
| | | } |
| | | |
| | | //根据设备id查询设备所有的参数 |
| | | public ServiceModel serchParamById(Object obj){ |
| | | public ServiceModel serchParamById(Dev_param obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchParamById(obj); |
| | | if(list!=null && list.size()>0){ |
| | | model.setCode(1); |