package com.skr.mdm.api.index.service.impl;

import com.skr.mdm.api.index.service.SecurityPostureService;
import com.skr.mdm.dao.*;
import com.skr.mdm.dto.LoginAdminDTO;
import com.skr.mdm.result.ResponseResult;
import com.skr.mdm.bean.qo.LargeScreenMessageQO;
import com.skr.mdm.bean.qo.controller.LargeScreenQO;
import com.skr.mdm.bean.vo.index.SecurityPostureVO;
import com.skr.mdm.bean.vo.index.ViolationStatVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * @ProjectName: mdm_new
 * @Package: com.skr.mdm.largeScreenManagement.service.serviceImpl
 * @ClassName: SecurityPostureServiceImpl
 * @Author: Tty
 * @Description: 实现
 * @Date: 2020/9/14 18:04
 * @Version: 1.0
 */
@Service
public class SecurityPostureServiceImpl implements SecurityPostureService {


	@Autowired
	private AuCompanyStatisticsDao auCompanyStatisticsDao;
	@Autowired
	private AppInstallDao appInstallDao;

	@Override
	public ResponseResult getViolatorMessage(String startTime, String endTime, LoginAdminDTO admin) {
		SecurityPostureVO securityPosture = new SecurityPostureVO();
		Integer companyId = admin.getCompanyId();
		LargeScreenQO largeScreenQO = LargeScreenQO.builder()
				.companyId(companyId)
				.endTime(endTime)
				.startTime(startTime)
				.build();
		//  每天设备在线数
		ArrayList<LargeScreenMessageQO> largeScreenMessageQOList = auCompanyStatisticsDao.selectList(largeScreenQO);
		securityPosture.setDeviceOnLineList(largeScreenMessageQOList);
		//  应用安装(下载数量)
		ArrayList<LargeScreenMessageQO> appInstallList = appInstallDao.selectTop5ByBo(largeScreenQO);
		securityPosture.setAppInstallList(appInstallList);
		return ResponseResult.success(securityPosture);
	}

}