Blame view

fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/mkt/MktRpcService.java 1.83 KB
29d5d4a0   张志伟   feature(*): 对接oop...
1
2
3
4
5
  package cn.fw.valhalla.rpc.mkt;
  
  import cn.fw.data.base.domain.common.Message;
  import cn.fw.mkt.sdk.ActivityApi;
  import cn.fw.mkt.sdk.param.AfterSaleArchivesDto;
de033769   张志伟   feature(*): 添加缓存
6
  import cn.fw.valhalla.common.constant.RedisKey;
29d5d4a0   张志伟   feature(*): 对接oop...
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
  import cn.fw.valhalla.rpc.mkt.dto.QualificationDTO;
  import lombok.RequiredArgsConstructor;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.beans.BeanUtils;
  import org.springframework.cache.annotation.Cacheable;
  import org.springframework.stereotype.Service;
  
  import static cn.fw.common.businessvalidator.Validator.BV;
  
  /**
   * 市场活动rpc
   *
   * @author : kurisu
   * @version : 1.0
   * @className : MktRpcService
   * @description : 市场活动rpc
   * @date : 2023-03-25 17:05
   */
  @Slf4j
  @Service
  @RequiredArgsConstructor
  public class MktRpcService {
      private final ActivityApi activityApi;
  
      /**
       * 查询活动资格
       *
       * @param dto
       * @return
       */
b71ca18a   张志伟   feature(*): 优化查询线...
37
      @Cacheable(cacheNames = RedisKey.MKT_QUA, key = "#dto.getArchiveId()+':'+#dto.getActivityNo()", unless = "#Boolean.TRUE.equals(result) != true ")
29d5d4a0   张志伟   feature(*): 对接oop...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
      public Boolean queryQualifications(final QualificationDTO dto) {
          if (dto == null) {
              return Boolean.FALSE;
          }
          try {
              AfterSaleArchivesDto archivesDto = new AfterSaleArchivesDto();
              BeanUtils.copyProperties(dto, archivesDto);
              final Message<Boolean> msg = activityApi.afterSaleSignUpJudge(archivesDto);
              log.info("activityApi.queryQualifications: msg.code={}, msg.result={}, msg.data={}", msg.getCode(), msg.getResult(), msg.getData());
              boolean success = msg.isSuccess();
              BV.isTrue(success, () -> String.format("调用活动系统失败:%s", msg.getResult()));
              return Boolean.TRUE.equals(msg.getData());
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  }