package com.bonus.hn.bearing.capacity.backstage.real.service;

import com.bonus.hn.bearing.capacity.backstage.real.dao.RealDataDao;
import com.bonus.hn.bearing.capacity.backstage.real.entity.SmzBean;
import com.bonus.hn.bearing.capacity.backstage.real.entity.SmzPersonnelRosterBean;
import com.bonus.hn.bearing.capacity.backstage.utils.Aes;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**
 * @author bonus
 */
@Service("RealDataService")
public class RealDataServiceImpl implements RealDataService {

    @Resource
    private RealDataDao dao;

    @Override
    public List<SmzPersonnelRosterBean> getPersonRosterList(SmzPersonnelRosterBean o) {
        List<SmzPersonnelRosterBean>  list= dao.getPersonRosterList(o);
       for (SmzPersonnelRosterBean bean : list) {
           if(StringUtils.isNotBlank(bean.getIdCard())){
                bean.setIdCard(Aes.aesEncrypt(bean.getIdCard()));
           }
       }
       return list;
    }

    @Override
    public List<SmzBean> getPersonAttendanceList(SmzBean o) {
         List<SmzBean> list= dao.getPersonAttendanceList(o);
            for (SmzBean bean : list) {
                if(StringUtils.isNotBlank(bean.getIdCard())){
                    bean.setIdCard(Aes.aesEncrypt(bean.getIdCard()));
                }
            }
        return list;
    }
}
