package com.prolog.rdc.tms.service.basicConfigure.impl;

import cn.hutool.core.date.DateUtil;
import com.prolog.common.util.ToolKits;
import com.prolog.framework.core.exception.ParameterException;
import com.prolog.framework.core.pojo.Page;
import com.prolog.framework.core.restriction.Criteria;
import com.prolog.framework.core.restriction.Restriction;
import com.prolog.framework.core.restriction.Restrictions;
import com.prolog.framework.dao.util.PageUtils;
import com.prolog.product.core.framework.entity.UserEntity;
import com.prolog.product.core.framework.util.PlgFxUsrUtils;
import com.prolog.rdc.tms.constant.BussinessConstant;
import com.prolog.rdc.tms.dao.mapper.SysAlertConfigurationMapper;
import com.prolog.rdc.tms.dao.mapper.SysAlertUsersMapper;
import com.prolog.rdc.tms.model.dto.basicConfigure.SysAlertConfigurationQueryDTO;
import com.prolog.rdc.tms.model.dto.basicConfigure.SysAlertUsersQueryDTO;
import com.prolog.rdc.tms.model.entity.SysAlertConfigurationModel;
import com.prolog.rdc.tms.model.entity.SysAlertUsersModel;
import com.prolog.rdc.tms.model.vo.basicConfigure.*;
import com.prolog.rdc.tms.service.SysCodeengineService;
import com.prolog.rdc.tms.service.SysRefdatadService;
import com.prolog.rdc.tms.service.basicConfigure.SysAlertConfigurationService;
import com.prolog.rdc.tms.util.PublicMethods;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import java.util.*;

/**
 * 
 *
 * 基础配置-预警配置实现层
 *
 * @className :SysAlertConfigurationServiceImpl
 * @author :fanzw
 * @creationTime :2022/01/18
 * @description :
 *
 * @modifier :fanzw
 * @modifyTime :2022/01/18
 * @reviseRemarks:
 *
 * @version :1.0.0
 *
 */
@Service
public class SysAlertConfigurationServiceImpl implements SysAlertConfigurationService {

	@Autowired
	private SysAlertConfigurationMapper sysAlertConfigurationMapper;

	@Autowired
	private SysAlertUsersMapper sysAlertUsersMapper;

	@Autowired
	private SysRefdatadService sysRefdatadService;

	@Autowired
	private SysCodeengineService sysCodeengineService;

	/**
	 * 预警配置列表查询
	 */
	@Override
	public Page<SysAlertConfigurationQueryDTO> listAlertConfigurationData(SysAlertConfigurationQueryVO sysAlertConfigurationQueryVO) {
		ToolKits.isParamNull(sysAlertConfigurationQueryVO, "预警配置查询请求不为空");
		ToolKits.isParamNull(sysAlertConfigurationQueryVO.getPageNum(), "页码不为空");
		ToolKits.isParamNull(sysAlertConfigurationQueryVO.getPageSize(), "页码数量不为空");

		UserEntity user = PlgFxUsrUtils.getUserEntity();
		ToolKits.isParamNull(user, "当前人员没有操作权限");

		// 预警状态
		List<Map<String, Object>> restMessage2 = sysRefdatadService.getDropDownById(BussinessConstant.EARLY_WARNING_STATUS, null, null, null);

		// 分页
		PageUtils.startPage(sysAlertConfigurationQueryVO.getPageNum(), sysAlertConfigurationQueryVO.getPageSize());

		// 查询预警配置
		List<SysAlertConfigurationQueryDTO> sysAlertConfigurationQueryDTOs = sysAlertConfigurationMapper.listAlertConfigurationSql(sysAlertConfigurationQueryVO, user.getEnterpriseId());
		for (SysAlertConfigurationQueryDTO sysAlertConfigurationQueryDTO : sysAlertConfigurationQueryDTOs) {
			sysAlertConfigurationQueryDTO.setStatusName(PublicMethods.change(restMessage2, String.valueOf(sysAlertConfigurationQueryDTO.getStatus())));
		}

		return PageUtils.getPage(sysAlertConfigurationQueryDTOs);
	}

	/**
	 * 预警配置查询
	 *
	 * @param sysAlertConfigurationQueryVO
	 * @return
	 */
	public List<SysAlertConfigurationQueryDTO> alertConfigurationQuery(SysAlertConfigurationQueryVO sysAlertConfigurationQueryVO){
		ToolKits.isParamNull(sysAlertConfigurationQueryVO, "预警配置查询请求不为空");

		UserEntity user = PlgFxUsrUtils.getUserEntity();
		ToolKits.isParamNull(user, "当前人员没有操作权限");

		// 预警状态
		List<Map<String, Object>> restMessage2 = sysRefdatadService.getDropDownById(BussinessConstant.EARLY_WARNING_STATUS, null, null, null);


		// 查询预警配置
		List<SysAlertConfigurationQueryDTO> sysAlertConfigurationQueryDTOs = sysAlertConfigurationMapper.queryAlertConfigurations(sysAlertConfigurationQueryVO, user.getEnterpriseId());
		for (SysAlertConfigurationQueryDTO sysAlertConfigurationQueryDTO : sysAlertConfigurationQueryDTOs) {
			sysAlertConfigurationQueryDTO.setStatusName(PublicMethods.change(restMessage2, String.valueOf(sysAlertConfigurationQueryDTO.getStatus())));
		}
		return sysAlertConfigurationQueryDTOs;
	}
	/**
	 * 预警配置用户查询
	 */
	@Override
	public List<SysAlertUsersQueryDTO> listAlertUsersData(SysAlertUsersQueryVO sysAlertUsersQueryVO) {
		ToolKits.isParamNull(sysAlertUsersQueryVO, "预警配置用户查询请求不为空");
		ToolKits.isParamNull(sysAlertUsersQueryVO.getEarlyWarningId(), "预警ID不为空");

		// 响应对象集合
		List<SysAlertUsersQueryDTO> sysAlertUsersQueryDTOs = new ArrayList<SysAlertUsersQueryDTO>();

		// 查询
		Criteria criteria = Criteria.forClass(SysAlertUsersModel.class);
		Restriction r1 = Restrictions.eq("earlyWarningId", sysAlertUsersQueryVO.getEarlyWarningId());
		Restriction r2 = Restrictions.eq("status", BussinessConstant.ALERT_USERS_STATUS_QY);
		criteria.setRestriction(Restrictions.and(r1, r2));
		List<SysAlertUsersModel> sysAlertUsersModels = sysAlertUsersMapper.findByCriteria(criteria);
		for (SysAlertUsersModel sysAlertUsersModel : sysAlertUsersModels) {
			SysAlertUsersQueryDTO sysAlertUsersQueryDTO = new SysAlertUsersQueryDTO();
			BeanUtils.copyProperties(sysAlertUsersModel, sysAlertUsersQueryDTO);

			sysAlertUsersQueryDTOs.add(sysAlertUsersQueryDTO);
		}

		return sysAlertUsersQueryDTOs;
	}

	/**
	 * 预警配置保存
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void saveAlertConfigurationData(SysAlertConfigurationSaveVO sysAlertConfigurationSaveVO) {
		ToolKits.isParamNull(sysAlertConfigurationSaveVO, "预警配置保存请求不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getEarlyWarningName(), "预警名称不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getEarlyWarningTypeCode(), "预警类型编码不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getEarlyWarningTypeName(), "预警类型名称不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getCustomerNames(), "预警配置客户不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getCustomerIds(), "客户ID不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getCustomerCodes(), "客户编码不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getStartTimeOffset(), "开始时间偏差数不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getStartTimeOffsetUnit(), "开始时间偏差单位不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getEndTimeOffset(), "结束时间偏差数不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getEndTimeOffsetUnit(), "结束时间偏差单位不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getPushMethodCode(), "推送方式ID不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getPushMethodName(), "推送方式名称不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getIntervalNumber(), "间隔数不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getIntervalNumberUnit(), "间隔单位不为空");
		ToolKits.isParamNull(sysAlertConfigurationSaveVO.getDescribe(), "预警描述不为空");

		UserEntity plgFxUser = PlgFxUsrUtils.getUserEntity();
		ToolKits.isParamNull(plgFxUser, "当前人员没有操作权限");

		// 当前时间
		Date date = DateUtil.date();

		// 判断预警名称是否重复
		Criteria criteria1 = Criteria.forClass(SysAlertConfigurationModel.class);
		Restriction r11 = Restrictions.eq("earlyWarningName", sysAlertConfigurationSaveVO.getEarlyWarningName());
		Restriction r12 = Restrictions.eq("status", BussinessConstant.EARLY_WARNING_STATUS_YX);
		criteria1.setRestriction(Restrictions.and(r11, r12));
		long count1 = sysAlertConfigurationMapper.findCountByCriteria(criteria1);
		Assert.isTrue(count1 == 0, "预警【" + sysAlertConfigurationSaveVO.getEarlyWarningName() + "】已经存在");

		// 预警配置客户
		// 判断客户的预警类型是否重复
		for (String customerName:sysAlertConfigurationSaveVO.getCustomerNames().split(",")) {
			Criteria criteria2 = Criteria.forClass(SysAlertConfigurationModel.class);
			Restriction r21 = Restrictions.like(SysAlertConfigurationModel::getCustomerNames, "%" + customerName + "%");
			Restriction r22 = Restrictions.eq("earlyWarningTypeCode", sysAlertConfigurationSaveVO.getEarlyWarningTypeCode());
			Restriction r23 = Restrictions.eq("status", BussinessConstant.EARLY_WARNING_STATUS_YX);
			criteria2.setRestriction(Restrictions.and(r21, r22, r23));
			long count2 = sysAlertConfigurationMapper.findCountByCriteria(criteria2);
			Assert.isTrue(count2 == 0, "客户【" + customerName + "】的【" + sysAlertConfigurationSaveVO.getEarlyWarningTypeName() + "】预警类型已经存在");
		}
		// 预警ID
		String earlyWarningId = sysCodeengineService.getCodeNumberByCode(BussinessConstant.EARLY_WARNING_ID, "L");
		ToolKits.isParamNull(earlyWarningId, "预警ID生成失败");

		// 预警配置对象
		SysAlertConfigurationModel sysAlertConfigurationModel = new SysAlertConfigurationModel();
		BeanUtils.copyProperties(sysAlertConfigurationSaveVO, sysAlertConfigurationModel);
		sysAlertConfigurationModel.setEarlyWarningId(earlyWarningId);
		sysAlertConfigurationModel.setCustomerIds(sysAlertConfigurationSaveVO.getCustomerIds());
		sysAlertConfigurationModel.setCustomerCodes(sysAlertConfigurationSaveVO.getCustomerCodes());
		sysAlertConfigurationModel.setCustomerNames(sysAlertConfigurationSaveVO.getCustomerNames());
		sysAlertConfigurationModel.setStatus(BussinessConstant.EARLY_WARNING_STATUS_YX);
		sysAlertConfigurationModel.setEnterpriseId(plgFxUser.getEnterpriseId());
		sysAlertConfigurationModel.setEnterprisename(plgFxUser.getEnterpriseName());
		sysAlertConfigurationModel.setCreateperson(plgFxUser.getNickname());
		sysAlertConfigurationModel.setCreatetime(date);
		sysAlertConfigurationModel.setUpdateperson(plgFxUser.getNickname());
		sysAlertConfigurationModel.setUpdatetime(date);
		sysAlertConfigurationMapper.save(sysAlertConfigurationModel);

		// 预警配置通知用户
		List<SysAlertConfigurationUserSaveVO> sysAlertConfigurationUserSaveVOs = sysAlertConfigurationSaveVO.getUsers();
		for (SysAlertConfigurationUserSaveVO sysAlertConfigurationUserSaveVO : sysAlertConfigurationUserSaveVOs) {
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getUserid(), "用户ID不为空");
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getUsername(), "用户名称不为空");
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getUserAccount(), "用户账号不为空");
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getPhone(), "用户手机号不为空");
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getDepartmentId(), "部门ID不为空");
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getDepartmentName(), "部门名称不为空");
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getUserTypeCode(), "用户类型编码不为空");
			ToolKits.isParamNull(sysAlertConfigurationUserSaveVO.getUserTypeName(), "用户类型名称不为空");

			// 预警通知用户对象
			SysAlertUsersModel sysAlertUsersModel = new SysAlertUsersModel();
			BeanUtils.copyProperties(sysAlertConfigurationUserSaveVO, sysAlertUsersModel);
			sysAlertUsersModel.setLineid(ToolKits.getUUID());
			sysAlertUsersModel.setEarlyWarningId(earlyWarningId);
			sysAlertUsersModel.setStatus(BussinessConstant.ALERT_USERS_STATUS_QY);
			sysAlertUsersModel.setCreateperson(plgFxUser.getNickname());
			sysAlertUsersModel.setCreatetime(date);
			sysAlertUsersMapper.save(sysAlertUsersModel);
		}
	}

	/**
	 * 预警配置修改
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void updateAlertConfigurationData(SysAlertConfigurationUpdateVO sysAlertConfigurationUpdateVO) {
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO, "预警配置修改请求不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getEarlyWarningId(), "预警ID不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getStartTimeOffset(), "开始时间偏差数不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getStartTimeOffsetUnit(), "开始时间偏差单位不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getEndTimeOffset(), "结束时间偏差数不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getEndTimeOffsetUnit(), "结束时间偏差单位不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getPushMethodCode(), "推送方式ID不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getPushMethodName(), "推送方式名称不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getIntervalNumber(), "间隔数不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getIntervalNumberUnit(), "间隔单位不为空");
		ToolKits.isParamNull(sysAlertConfigurationUpdateVO.getDescribe(), "预警描述不为空");

		UserEntity user = PlgFxUsrUtils.getUserEntity();
		ToolKits.isParamNull(user, "当前人员没有操作权限");

		// 当前时间
		Date date = DateUtil.date();

		// 根据ID查询预警配置对象
		SysAlertConfigurationModel sysAlertConfigurationModel = sysAlertConfigurationMapper.findById(sysAlertConfigurationUpdateVO.getEarlyWarningId(), SysAlertConfigurationModel.class);
		if (ToolKits.isNotEmpty(sysAlertConfigurationModel)) {
			sysAlertConfigurationModel.setStartTimeOffset(sysAlertConfigurationUpdateVO.getStartTimeOffset());
			sysAlertConfigurationModel.setStartTimeOffsetUnit(sysAlertConfigurationUpdateVO.getStartTimeOffsetUnit());
			sysAlertConfigurationModel.setEndTimeOffset(sysAlertConfigurationUpdateVO.getEndTimeOffset());
			sysAlertConfigurationModel.setEndTimeOffsetUnit(sysAlertConfigurationUpdateVO.getEndTimeOffsetUnit());
			sysAlertConfigurationModel.setPushMethodCode(sysAlertConfigurationUpdateVO.getPushMethodCode());
			sysAlertConfigurationModel.setPushMethodName(sysAlertConfigurationUpdateVO.getPushMethodName());
			sysAlertConfigurationModel.setIntervalNumber(sysAlertConfigurationUpdateVO.getIntervalNumber());
			sysAlertConfigurationModel.setIntervalNumberUnit(sysAlertConfigurationUpdateVO.getIntervalNumberUnit());
			sysAlertConfigurationModel.setDescribe(sysAlertConfigurationUpdateVO.getDescribe());
			sysAlertConfigurationModel.setUpdateperson(user.getNickname());
			sysAlertConfigurationModel.setUpdatetime(date);
			sysAlertConfigurationMapper.update(sysAlertConfigurationModel);

			// 新增预警配置通知用户
			List<SysAlertConfigurationUserUpdateVO> sysAlertConfigurationUserUpdateVOs = sysAlertConfigurationUpdateVO.getUsers();
			for (SysAlertConfigurationUserUpdateVO sysAlertConfigurationUserUpdateVO : sysAlertConfigurationUserUpdateVOs) {
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getUserid(), "用户ID不为空");
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getUsername(), "用户名称不为空");
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getUserAccount(), "用户账号不为空");
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getPhone(), "用户手机号不为空");
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getDepartmentId(), "部门ID不为空");
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getDepartmentName(), "部门名称不为空");
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getUserTypeCode(), "用户类型编码不为空");
				ToolKits.isParamNull(sysAlertConfigurationUserUpdateVO.getUserTypeName(), "用户类型名称不为空");

				// 判断新增用户是否已存在
				Criteria criteria = Criteria.forClass(SysAlertUsersModel.class);
				Restriction r1 = Restrictions.eq("earlyWarningId", sysAlertConfigurationUpdateVO.getEarlyWarningId());
				Restriction r2 = Restrictions.eq("userid", sysAlertConfigurationUserUpdateVO.getUserid());
				Restriction r3 = Restrictions.eq("status", BussinessConstant.ALERT_USERS_STATUS_QY);
				criteria.setRestriction(Restrictions.and(r1, r2, r3));
				long count = sysAlertUsersMapper.findCountByCriteria(criteria);
				Assert.isTrue(count == 0, "用户【" + sysAlertConfigurationUserUpdateVO.getUsername() + "】已经存在");

				// 预警通知用户对象
				SysAlertUsersModel sysAlertUsersModel = new SysAlertUsersModel();
				BeanUtils.copyProperties(sysAlertConfigurationUserUpdateVO, sysAlertUsersModel);
				sysAlertUsersModel.setLineid(ToolKits.getUUID());
				sysAlertUsersModel.setEarlyWarningId(sysAlertConfigurationUpdateVO.getEarlyWarningId());
				sysAlertUsersModel.setStatus(BussinessConstant.ALERT_USERS_STATUS_QY);
				sysAlertUsersModel.setCreateperson(user.getNickname());
				sysAlertUsersModel.setCreatetime(date);
				sysAlertUsersMapper.save(sysAlertUsersModel);
			}
		} else {
			throw new ParameterException("预警ID【" + sysAlertConfigurationUpdateVO.getEarlyWarningId() + "】不存在");
		}
	}

	/**
	 * 预警配置删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void deleteAlertConfigurationData(List<SysAlertConfigurationDeleteVO> sysAlertConfigurationDeleteVOs) {
		ToolKits.isParamNull(sysAlertConfigurationDeleteVOs, "预警配置删除请求不为空");

		UserEntity user = PlgFxUsrUtils.getUserEntity();
		ToolKits.isParamNull(user, "当前人员没有操作权限");

		// 当前时间
		Date date = DateUtil.date();

		for (SysAlertConfigurationDeleteVO sysAlertConfigurationDeleteVO : sysAlertConfigurationDeleteVOs) {
			ToolKits.isParamNull(sysAlertConfigurationDeleteVO.getEarlyWarningId(), "预警ID不为空");

			// 根据ID查询预警配置对象
			SysAlertConfigurationModel sysAlertConfigurationModel = sysAlertConfigurationMapper.findById(sysAlertConfigurationDeleteVO.getEarlyWarningId(), SysAlertConfigurationModel.class);
			if (ToolKits.isNotEmpty(sysAlertConfigurationModel)) {
				// 预警配置改为失效状态
				sysAlertConfigurationModel.setStatus(BussinessConstant.EARLY_WARNING_STATUS_WX);
				sysAlertConfigurationModel.setUpdateperson(user.getNickname());
				sysAlertConfigurationModel.setUpdatetime(date);
				sysAlertConfigurationMapper.update(sysAlertConfigurationModel);

				// 预警配置用户的停用状态
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("status", BussinessConstant.ALERT_USERS_STATUS_TY);
				map.put("updateperson", user.getNickname());
				map.put("updatetime", date);

				// 将预警配置用户改为停用状态
				Criteria criteria = Criteria.forClass(SysAlertUsersModel.class);
				Restriction r1 = Restrictions.eq("earlyWarningId", sysAlertConfigurationDeleteVO.getEarlyWarningId());
				Restriction r2 = Restrictions.eq("status", BussinessConstant.ALERT_USERS_STATUS_QY);
				criteria.setRestriction(Restrictions.and(r1, r2));
				sysAlertUsersMapper.updateMapByCriteria(map, criteria);
			} else {
				throw new ParameterException("预警ID【" + sysAlertConfigurationDeleteVO.getEarlyWarningId() + "】不存在");
			}
		}
	}

	/**
	 * 预警配置用户删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void deleteAlertUsersData(List<SysAlertUsersDeleteVO> sysAlertUsersDeleteVOs) {
		ToolKits.isParamNull(sysAlertUsersDeleteVOs, "预警配置用户删除请求不为空");

		UserEntity user = PlgFxUsrUtils.getUserEntity();
		ToolKits.isParamNull(user, "当前人员没有操作权限");

		// 当前时间
		Date date = DateUtil.date();

		for (SysAlertUsersDeleteVO sysAlertUsersDeleteVO : sysAlertUsersDeleteVOs) {
			ToolKits.isParamNull(sysAlertUsersDeleteVO.getLineid(), "数据ID不为空");

			// 根据ID查询预警配置用户对象
			SysAlertUsersModel sysAlertUsersModel = sysAlertUsersMapper.findById(sysAlertUsersDeleteVO.getLineid(), SysAlertUsersModel.class);
			if (ToolKits.isNotEmpty(sysAlertUsersModel)) {
				// 预警配置用户改为停用状态
				sysAlertUsersModel.setStatus(BussinessConstant.ALERT_USERS_STATUS_TY);
				sysAlertUsersModel.setUpdateperson(user.getNickname());
				sysAlertUsersModel.setUpdatetime(date);
				sysAlertUsersMapper.update(sysAlertUsersModel);
			} else {
				throw new ParameterException("预警ID【" + sysAlertUsersDeleteVO.getLineid() + "】不存在");
			}
		}
	}

}
