SubCardNoPushJob.java
4.54 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.zteits.pay.job.vipcardpush;
import org.apache.commons.collections4.CollectionUtils;
import com.clouds.common.utils.ResultUtils;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zteits.clouds.api.apibase.bean.BizResult;
import com.zteits.clouds.api.apibase.constants.BasicEnum;
import com.zteits.clouds.api.dto.bill.closecarpark.dto.SubCardPushDTO;
import com.zteits.clouds.api.dto.bill.closecarpark.param.QueryNoPushSubCardRequest;
import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO;
import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest;
import com.zteits.clouds.api.service.bill.closecarpark.SubCardInfoManageListQueryService;
import com.zteits.clouds.api.service.park.ParkingLotQueryService;
import com.zteits.pay.job.vipcardpush.route.VipCardPushRoute;
import com.zteits.pay.job.vipcardpush.service.VipCardPushService;
import com.zteits.pay.job.vipcardpush.vo.SubCardPushVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 子母车(一卡多车)同步到第三方道闸
* 复用月卡下发定时任务模式,将 push_state=0 的记录下发给各道闸厂商
*
* @author wangbiao
* @date 2026-07-21
*/
@Component
public class SubCardNoPushJob {
private static final Logger logger = LoggerFactory.getLogger(SubCardNoPushJob.class);
@Autowired
private SubCardInfoManageListQueryService subCardInfoManageListQueryService;
@Autowired
private VipCardPushRoute vipCardPushRoute;
@Autowired
private ParkingLotQueryService parkingLotQueryService;
@XxlJob(value = "SubCardNoPushJob")
public ReturnT<String> execute(String... arg0) throws Exception {
int updateCount = 0;
this.logger("---begin查询未推送子母车卡信息");
QueryNoPushSubCardRequest request = new QueryNoPushSubCardRequest();
request.setSysCode("1001");
BizResult<List<SubCardPushDTO>> rsList = subCardInfoManageListQueryService.queryNoPushSubCardInfo(request);
this.logger("本次未推送子母车条数=" +
(CollectionUtils.isNotEmpty(rsList.getData()) ? rsList.getData().size() : 0));
if (rsList.isSuccess() && rsList.getData() != null) {
int index = 1;
for (SubCardPushDTO cardInfo : rsList.getData()) {
if (cardInfo == null || cardInfo.getPlNo() == null) {
continue;
}
QueryParkLotInfoByPkNoRequest parkReq = new QueryParkLotInfoByPkNoRequest();
parkReq.setPklNo(cardInfo.getPlNo());
parkReq.setSysCode(BasicEnum.SYS_CODE.getValue());
BizResult<ParkingLotDTO> parkResult =
parkingLotQueryService.QueryParkingLotByPkNo(parkReq);
if (!ResultUtils.isSuccess(parkResult) || parkResult.getData() == null) {
continue;
}
ParkingLotDTO parkingLotDTO = parkResult.getData();
if (parkingLotDTO.getSourceType() != null && parkingLotDTO.getSourceType().equals(1)) {
continue;
}
this.logger("begin推送第" + (index++) + "条子母车到道闸, plNo="
+ cardInfo.getPlNo() + ", sourceType=" + parkingLotDTO.getSourceType());
VipCardPushService route = vipCardPushRoute.getRoute(parkingLotDTO.getSourceType());
if (route == null) {
this.logger("子母车同步路由失败,sourceType:"
+ parkingLotDTO.getSourceType());
continue;
}
SubCardPushVO subCardVO = new SubCardPushVO();
BeanUtils.copyProperties(cardInfo, subCardVO);
subCardVO.setParkingLotDTO(parkingLotDTO);
try {
updateCount = route.pushSubCard(subCardVO);
} catch (Exception e) {
this.logger(cardInfo.getCardNo() + ":子母车同步失败:" + e.getMessage());
}
}
} else {
this.logger("---本次没有要推送的子母车卡信息..");
updateCount = 1;
}
return updateCount > 0 ? ReturnT.SUCCESS : ReturnT.FAIL;
}
private void logger(String msg) {
XxlJobHelper.log(msg);
logger.info(msg);
}
}