Blame view

parking-module-pay/src/main/java/com/zteits/pay/biz/thirdpush/GatePushServiceImpl.java 2.56 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
  package com.zteits.pay.biz.thirdpush;
  
  import com.alibaba.fastjson.JSONObject;
  import com.clouds.common.cache.park.ParkingLotCacheUtil;
  import com.zteits.clouds.api.apibase.bean.BizResult;
  import com.zteits.clouds.api.apibase.constants.ErrorType;
  import com.zteits.clouds.api.apibase.exception.BizException;
  import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO;
  import com.zteits.clouds.api.dto.park.param.FreeBerthsChangeMsgRequest;
  import com.zteits.clouds.api.service.pay.thirdpush.GatePushService;
  import com.zteits.pay.biz.AccountRechargeServiceImpl;
  import com.zteits.pay.job.vipcardpush.route.VipCardPushRoute;
  import com.zteits.pay.job.vipcardpush.service.VipCardPushService;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  /**
   * Copyright: Copyright (c) 2020
   *
   * @Description:
   * @version: v1.0.0
   * @author: xiejianpeng
   * @date: 2020/11/11 21
   * Modification History:
   * Date             Author          Version            Description
   * ---------------------------------------------------------*
   * 2020/11/11      xiejianpeng         v1.0.0               创建
   */
  @Service("com.zteits.pay.biz.thirdpush.GatePushServiceImpl")
  public class GatePushServiceImpl implements GatePushService {
      private static final Logger logger = LoggerFactory.getLogger(AccountRechargeServiceImpl.class);
  
      @Autowired
      private VipCardPushRoute vipCardPushRoute;
  
      @Override
      public BizResult<Boolean> pushGateServiceForFreeBerthMsg(FreeBerthsChangeMsgRequest freeBerthsChangeMsgRequest) {
          ParkingLotDTO parkingLotDTO =  ParkingLotCacheUtil.getParkLotByPlNo(freeBerthsChangeMsgRequest.getPlNo());
          if (parkingLotDTO == null) {
              throw new BizException(ErrorType.OBJECT_NOT_EXISTS,"车场不存在");
          }
         logger.info("空闲车位修改:plno:{}", freeBerthsChangeMsgRequest.getPlNo());
  
          VipCardPushService route = vipCardPushRoute.getRoute(parkingLotDTO.getSourceType());
          if (route == null) {
              logger.info("空闲车位修改同步路由服务失败,未找到sourceType:" + parkingLotDTO.getSourceType() + "对应的服务");
              throw new BizException(ErrorType.APP_ERROR,"空闲车位修改同步路由服务失败");
          }
          try {
              route.modifyFreeBerthsNum(freeBerthsChangeMsgRequest.getPlNo(),freeBerthsChangeMsgRequest.getFreeBerth());
          } catch (Exception e) {
              logger.error("空闲车位下发道闸异常",e);
          }
          return new BizResult<>(true);
      }
  }