Blame view

service-acct/src/main/java/com/java110/acct/integral/impl/GiftIntegralImpl.java 2.86 KB
88e030b7   王彪总   init project
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  package com.java110.acct.integral.impl;
  
  import com.java110.acct.integral.IGiftIntegral;
  import com.java110.core.factory.GenerateCodeFactory;
  import com.java110.dto.fee.FeeAttrDto;
  import com.java110.dto.integral.GiftIntegralDto;
  import com.java110.dto.user.UserDto;
  import com.java110.intf.acct.IIntegralGiftDetailV1InnerServiceSMO;
  import com.java110.intf.job.IMallInnerServiceSMO;
  import com.java110.intf.user.IUserV1InnerServiceSMO;
  import com.java110.po.integral.IntegralGiftDetailPo;
  import com.java110.utils.cache.MappingCache;
  import com.java110.utils.util.ListUtil;
  import com.java110.utils.util.StringUtil;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  import java.util.List;
  
  @Service
  public class GiftIntegralImpl implements IGiftIntegral {
  
      private static final String MALL_DOMAIN = "MALL";
  
      @Autowired
      private IIntegralGiftDetailV1InnerServiceSMO integralGiftDetailV1InnerServiceSMOImpl;
  
  
  
      @Autowired
      private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
  
      @Autowired
      private IMallInnerServiceSMO mallInnerServiceSMOImpl;
  
      @Override
      public void gift(GiftIntegralDto giftIntegralDto) {
          String mallSwitch = MappingCache.getValue(MALL_DOMAIN, "MALL_SWITCH");
  
          if (!"ON".equals(mallSwitch)) {
              return ;
          }
  
          //todo 没有用户就不送了
          if(StringUtil.isEmpty(giftIntegralDto.getUserId())){
              return ;
          }
  
          UserDto userDto = new UserDto();
          userDto.setUserId(giftIntegralDto.getUserId());
          List<UserDto> userDtos= userV1InnerServiceSMOImpl.queryUsers(userDto);
          if(ListUtil.isNull(userDtos)){
              return ;
          }
  
          //调用商城送用户积分 通过手机号赠
          giftIntegralDto.setLink(userDtos.get(0).getTel());
          giftIntegralDto.setRemark("物业缴费赠送积分");
  
          mallInnerServiceSMOImpl.sendUserIntegral(giftIntegralDto);
  
  
          //先加明细
          IntegralGiftDetailPo integralGiftDetailPo = new IntegralGiftDetailPo();
          integralGiftDetailPo.setCommunityId(giftIntegralDto.getCommunityId());
          integralGiftDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId("11"));
          integralGiftDetailPo.setConfigId(giftIntegralDto.getConfigId());
          integralGiftDetailPo.setConfigName(giftIntegralDto.getConfigName());
          integralGiftDetailPo.setRuleId(giftIntegralDto.getRuleId());
          integralGiftDetailPo.setRuleName(giftIntegralDto.getRuleName());
          integralGiftDetailPo.setQuantity(giftIntegralDto.getIntegral()+"");
          integralGiftDetailPo.setCreateUserId(giftIntegralDto.getUserId());
          integralGiftDetailPo.setUserName(userDtos.get(0).getName());
          integralGiftDetailPo.setTel(userDtos.get(0).getTel());
          integralGiftDetailV1InnerServiceSMOImpl.saveIntegralGiftDetail(integralGiftDetailPo);
      }
  }