Blame view

parking-module-pay/src/main/java/com/zteits/pay/dao/impl/TdCCouponRuleParkDaoImpl.java 2.23 KB
55f68655   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  package com.zteits.pay.dao.impl;
  
  import org.apache.commons.collections4.CollectionUtils;
  import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
  import com.zteits.clouds.api.dto.pay.param.QueryCouponRuleParkByCardNoRequest;
  import com.zteits.pay.dao.TdCCouponRuleParkDao;
  import com.zteits.pay.domain.TdCCouponRulePark;
  import com.zteits.pay.domain.TdCCouponRuleParkExample;
  import com.zteits.pay.mapper.TdCCouponRuleParkMapper;
  import com.zteits.pay.mapper.smapper.TdCCouponRuleParkSMapper;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Map;
  import java.util.Optional;
  import java.util.stream.Collectors;
  
  /**
   * Copyright: Copyright (c) 2017  zteits
   *
   * @Description:
   * @version: v1.0.0
   * @author: langlw
   * @date: 2017/12/28 09
   * Modification History:
   * Date             Author          Version            Description
   * ---------------------------------------------------------*
   * 2017/12/28      langlw         v1.0.0               创建
   */
  @Component
  public class TdCCouponRuleParkDaoImpl implements TdCCouponRuleParkDao{
  
      @Autowired
      private TdCCouponRuleParkSMapper tdCCouponRuleParkSMapper;
      @Autowired
      private TdCCouponRuleParkMapper tdCCouponRuleParkMapper;
  
      @Override
      public Map<String, List<TdCCouponRulePark>> queryCouponRuleParkByCardNo(QueryCouponRuleParkByCardNoRequest request) {
          List<TdCCouponRulePark> list = tdCCouponRuleParkSMapper.queryCouponRuleParkByCardNo(request);
          return Optional.ofNullable(list).orElse(new ArrayList<>())
                  .stream().collect(Collectors.groupingBy(TdCCouponRulePark::getCardNo));
      }
  
  	@Override
  	public List<String> queryPlNosByCardNo(String cardNo) {
  		List<String> plNos = new ArrayList<>();
  		TdCCouponRuleParkExample example = new TdCCouponRuleParkExample();
  		example.createCriteria().andCardNoEqualTo(cardNo).andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
  		List<TdCCouponRulePark> list= tdCCouponRuleParkMapper.selectByExample(example);
  		if(CollectionUtils.isNotEmpty(list)){
  			for (TdCCouponRulePark tdCCouponRulePark : list) {
  				plNos.add(tdCCouponRulePark.getPlNo());
  			}
  		}
  		return plNos;
  	}
  
  }