package com.yeshi.fanli.service.impl.integral;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Service;
|
|
import com.yeshi.fanli.dao.mybatis.integral.IntegralExchangeRecordMapper;
|
import com.yeshi.fanli.entity.integral.IntegralExchange;
|
import com.yeshi.fanli.service.inter.integral.IntegralExchangeRecordService;
|
import com.yeshi.fanli.service.inter.integral.IntegralExchangeService;
|
import com.yeshi.fanli.util.StringUtil;
|
|
@Service
|
public class IntegralExchangeRecordServiceImpl implements IntegralExchangeRecordService {
|
|
@Resource
|
private IntegralExchangeRecordMapper integralExchangeRecordMapper;
|
|
@Resource
|
private IntegralExchangeService integralExchangeService;
|
|
@Override
|
public List<IntegralExchange> listExchange(long start, int count, Long uid){
|
List<IntegralExchange> listValid = integralExchangeService.listValidCache(start, count);
|
if (listValid == null || listValid.size() == 0) {
|
return listValid;
|
}
|
|
List<Long> listId = new ArrayList<Long>();
|
for(IntegralExchange integralExchange: listValid) {
|
listId.add(integralExchange.getId());
|
}
|
|
List<Long> listRecord = integralExchangeRecordMapper.listRecordByExchangeIds(listId);
|
for(IntegralExchange integralExchange: listValid) {
|
String progress = integralExchange.getProgress();
|
if (StringUtil.isNullOrEmpty(progress))
|
continue;
|
|
int exchange = 0;
|
if (listRecord != null && listRecord.size() >0 && listRecord.contains(integralExchange.getId()))
|
exchange = 1;
|
|
progress = progress.replace("{已兑换}", exchange + "").replace("{上限数}", integralExchange.getUpperLimit() + "");
|
integralExchange.setProgress(progress);
|
}
|
return listValid;
|
}
|
}
|