/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称: 大恒泰山系统
 * 创建日期:2022/8/24
 */
package org.springblade.modules.business.warning.wrapper;

import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.business.warning.entity.OriginalWarningInfoEntity;
import org.springblade.modules.business.warning.vo.OriginalWarningInfoVO;

import java.util.Objects;

/***
 * Date:2022/8/24
 * Title:文件所属模块（必须填写）
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
public class OriginalWarningWrapper extends BaseEntityWrapper<OriginalWarningInfoEntity, OriginalWarningInfoVO> {
	public static OriginalWarningWrapper build() {
		return new OriginalWarningWrapper();
	}

	@Override
	public OriginalWarningInfoVO entityVO(OriginalWarningInfoEntity entity) {
		OriginalWarningInfoVO originalWarningInfoVO = Objects.requireNonNull(BeanUtil.copy(entity, OriginalWarningInfoVO.class));
		/**
		 * 预警状态，(-1审核未通过，0未审核，1待内部预警，2待外部预警，3待响应启动，4待响应反馈，5已启动响应)
		 */
		if (originalWarningInfoVO.getWarnStatus() == -1) {
			originalWarningInfoVO.setWarnStatusText("审核未通过");
		} else if (originalWarningInfoVO.getWarnStatus() == 0) {
			originalWarningInfoVO.setWarnStatusText("未审核");
		} else if (originalWarningInfoVO.getWarnStatus() == 1) {
			originalWarningInfoVO.setWarnStatusText("待内部预警");
		} else if (originalWarningInfoVO.getWarnStatus() == 2) {
			originalWarningInfoVO.setWarnStatusText("待外部预警");
		} else if (originalWarningInfoVO.getWarnStatus() == 3) {
			originalWarningInfoVO.setWarnStatusText("待响应启动");
		} else if (originalWarningInfoVO.getWarnStatus() == 4) {
			originalWarningInfoVO.setWarnStatusText("待响应反馈");
		} else if (originalWarningInfoVO.getWarnStatus() == 5) {
			originalWarningInfoVO.setWarnStatusText("已启动响应");
		}
		/**
		 * 审核状态(1关闭,2通过)
		 */
		if (originalWarningInfoVO.getReviewStatus().equals("1")) {
			originalWarningInfoVO.setReviewStatusText("关闭");
		} else {
			originalWarningInfoVO.setReviewStatusText("通过");
		}
		/**
		 * 站类(1雨量站2河道水情站3水库水情站,4政区.5人工)
		 */
		if (originalWarningInfoVO.getType().equals("1")) {
			originalWarningInfoVO.setTypeText("雨量站");
		} else if (originalWarningInfoVO.getType().equals("2")) {
			originalWarningInfoVO.setTypeText("河道水情站");
		} else if (originalWarningInfoVO.getType().equals("3")) {
			originalWarningInfoVO.setTypeText("水库水情站");
		} else if (originalWarningInfoVO.getType().equals("4")) {
			originalWarningInfoVO.setTypeText("政区");
		} else if (originalWarningInfoVO.getType().equals("5")) {
			originalWarningInfoVO.setTypeText("人工");
		}
		/**
		 * 雨量站预警频率（1,2,3,4,5,6）对应(30分钟，1小时,3小时,6小时,12小时,24小时)
		 */

		if (originalWarningInfoVO.getRainWarnRate() == 1) {
			originalWarningInfoVO.setRainWarnRateText("30分钟");
		} else if (originalWarningInfoVO.getRainWarnRate() == 2) {
			originalWarningInfoVO.setRainWarnRateText("1小时");
		} else if (originalWarningInfoVO.getRainWarnRate() == 3) {
			originalWarningInfoVO.setRainWarnRateText("3小时");
		} else if (originalWarningInfoVO.getRainWarnRate() == 4) {
			originalWarningInfoVO.setRainWarnRateText("6小时");
		} else if (originalWarningInfoVO.getRainWarnRate() == 5) {
			originalWarningInfoVO.setRainWarnRateText("12小时");
		} else if (originalWarningInfoVO.getRainWarnRate() == 6) {
			originalWarningInfoVO.setRainWarnRateText("24小时");
		}
		return originalWarningInfoVO;
	}
}
