Blame view

service-acct/src/main/java/com/java110/acct/integral/impl/DeductionIntegralImpl.java 1.31 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
  package com.java110.acct.integral.impl;
  
  import com.alibaba.fastjson.JSONObject;
  import com.java110.acct.integral.IDeductionIntegral;
  import com.java110.dto.integral.DeductionIntegralDto;
  import com.java110.intf.job.IMallInnerServiceSMO;
  import com.java110.utils.cache.CommonCache;
  import com.java110.utils.util.StringUtil;
  import com.java110.vo.ResultVo;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  @Service
  public class DeductionIntegralImpl implements IDeductionIntegral {
  
      @Autowired
      private IMallInnerServiceSMO mallInnerServiceSMOImpl;
  
  
      @Override
      public int deduction(String orderId) {
  
          String deductionIntegralDtoStr = CommonCache.getAndRemoveValue("integral_deduction_" + orderId);
  
          if (StringUtil.isEmpty(deductionIntegralDtoStr)) {
              return 0;
  
          }
          DeductionIntegralDto deductionIntegralDto = JSONObject.parseObject(deductionIntegralDtoStr, DeductionIntegralDto.class);
          if (deductionIntegralDto == null) {
              return 0;
          }
  
  
          ResultVo resultVo = mallInnerServiceSMOImpl.userIntegralToCommunity(deductionIntegralDto);
  
          if(resultVo.getCode() != ResultVo.CODE_OK){
              throw new IllegalArgumentException(resultVo.getMsg());
          }
  
          return 1;
      }
  }