package com.palmnest.service.third.impl;

import com.palmnest.model.estateserve.AppUser;
import com.palmnest.model.property.TbOrganization;
import com.palmnest.model.third.vo.ScreenDataVO;
import com.palmnest.service.AppUserService;
import com.palmnest.service.org.OrganizationService;
import com.palmnest.service.third.ThirdCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author HIAPAD
 * @Description TODO
 * @Date 2019/5/22 14:33
 **/
@Service
public class ThirdCenterServiceImpl implements ThirdCenterService {

	@Autowired
	private OrganizationService organizationService;
	@Autowired
	private AppUserService      appUserService;

	@Override
	public ScreenDataVO getScreenData(String[] orgIds) {

		// 暂时部分项目
		// 获取项目覆盖数,即上线的可用的项目数量
		List<TbOrganization> orgList = organizationService.enableOrgList(1);
		// 统计项目白名单用户数量
		List<AppUser> userList = appUserService.countOrgWhiteUser(orgIds);
		// 调用商城接口,获取交易金额
		String money = "14937137.52";

		ScreenDataVO vo = new ScreenDataVO();
		vo.setUserNum(userList.size());
		vo.setOrgNum(orgList.size());
		vo.setMoney(new BigDecimal(money));
		return vo;
	}
}
