admin
2019-08-16 9c976c6874f02ab1532c18c6078fd20352011c46
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeRecordServiceImpl.java
@@ -1,19 +1,16 @@
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 org.yeshi.utils.JsonUtil;
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;
import com.yeshi.fanli.vo.user.UserInfoExtraVO;
@Service
public class IntegralExchangeRecordServiceImpl implements IntegralExchangeRecordService {
@@ -31,24 +28,22 @@
         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;
         // 今日兑换情况
         long exchange = integralExchangeRecordMapper.countRecordByUid(integralExchange.getId(), uid);
         
         progress = progress.replace("{已兑换}", exchange + "").replace("{上限数}", integralExchange.getUpperLimit() + "");
         integralExchange.setProgress(progress);
      }
      return listValid;
   }
   @Override
   public long countRecordByUid(long exchangeid, Long uid){
      return integralExchangeRecordMapper.countRecordByUid(exchangeid, uid);
   }
}