package com.bonus.bracelet.service.impl;

import com.bonus.bracelet.mapper.DeviceLyRecordMapper;
import com.bonus.bracelet.mapper.EquipmentReqMapper;
import com.bonus.bracelet.service.IDeviceLyRecordService;
import com.bonus.bracelet.service.IEquipmentReqService;
import com.bonus.common.core.constant.BusinessConstants;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.entity.bracelet.BraceletParamsDto;
import com.bonus.common.entity.bracelet.vo.EquipmentReqDataVo;
import com.bonus.common.entity.bracelet.vo.EquipmentReqVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import javax.annotation.Resource;
import java.util.*;

/**
 * @className:DeviceLyRecordServiceImpl
 * @description:设备领用记录-serviceImpl
 */
@Slf4j
@Service(value = "IDeviceLyRecordService")
public class DeviceLyRecordServiceImpl implements IDeviceLyRecordService {

    @Resource(name = "DeviceLyRecordMapper")
    private DeviceLyRecordMapper mapper;

    @Override
    public List<EquipmentReqVo> getEquipmentReqLists(EquipmentReqVo dto) {
        List<EquipmentReqVo> list = new ArrayList<>();
        try {
            list = mapper.getEquipmentReqLists(dto);
            for (EquipmentReqVo vo : list) {
                vo.setLeaderPhone(Sm4Utils.decode(vo.getLeaderPhone()));
            }
        } catch (Exception e) {
            log.error(e.toString(), e);
        }
        return list;
    }
}
