TVipAreaCardCustInfoDaoImpl.java
13.3 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
package com.zteits.bill.dao.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaoleilu.hutool.date.DateUtil;
import com.zteits.bill.dao.TVipAreaCardCustInfoDao;
import com.zteits.bill.domain.TVipAreaCardCustInfo;
import com.zteits.bill.domain.TVipAreaCardCustInfoExample;
import com.zteits.bill.domain.TVipNoPushCardCustInfoDO;
import com.zteits.bill.mapper.TVipAreaCardCustInfoMapper;
import com.zteits.bill.mapper.smapper.TVipAreaCardCustInfoSMapper;
import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
import com.zteits.clouds.api.dto.bill.dto.TVipAreaCardCustInfoDTO;
import com.zteits.clouds.api.dto.bill.param.DeleteAreaCardByCustCardNoReq;
import com.zteits.clouds.api.dto.bill.param.TVipAreaCardCustInfoQueryRequest;
import com.zteits.clouds.api.dto.bill.param.TVipAreaCardCustInfoRequest;
import com.zteits.clouds.api.dto.bill.param.ValidVipAreaCardCustInfoRequest;
import com.zteits.clouds.api.dto.bill.vipcard.param.QueryIsBuyVipCardCustReq;
import com.zteits.clouds.api.dto.bill.vipcard.param.QueryVipCardOrderDetailTotalReq;
import com.zteits.clouds.api.dto.bill.vipcard.param.VipAreaCardExpireRequest;
import com.zteits.clouds.api.dto.bill.vipcard.param.VipCardInfoReq;
import com.zteits.clouds.api.dto.order.vipcardorder.dto.OrderVipAreacardDetailTotalDTO;
import com.zteits.clouds.api.dto.order.vipcardorder.dto.ParkVipAreaCardNumDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Component
public class TVipAreaCardCustInfoDaoImpl implements TVipAreaCardCustInfoDao {
@Autowired
private TVipAreaCardCustInfoMapper tVipAreaCardCustInfoMapper;
@Autowired
private TVipAreaCardCustInfoSMapper tVipAreaCardCustInfoSMapper;
@Override
public int saveTVipAreaCardCustInfo(TVipAreaCardCustInfo tVipAreaCardCustInfo) {
if(tVipAreaCardCustInfo.getCreateDate()==null){
tVipAreaCardCustInfo.setCreateDate(new Date());
}
return tVipAreaCardCustInfoMapper.insertSelective(tVipAreaCardCustInfo);
}
@Override
public int updateByExampleSelective(TVipAreaCardCustInfo record, TVipAreaCardCustInfoExample example) {
return tVipAreaCardCustInfoMapper.updateByExampleSelective(record,example);
}
@Override
public int updateByPrimaryKeySelective(TVipAreaCardCustInfo record) {
return tVipAreaCardCustInfoMapper.updateByPrimaryKeySelective(record);
}
@Override
public List<TVipAreaCardCustInfo> selectByExample(TVipAreaCardCustInfoExample example) {
return tVipAreaCardCustInfoMapper.selectByExample(example);
}
@Override
public TVipAreaCardCustInfo queryByPrimaryKey(Long id) {
return tVipAreaCardCustInfoMapper.selectByPrimaryKey(id);
}
/**
* 根据个人卡编码
* @Auther: wangfs
* @param
* @return
*/
@Override
public TVipAreaCardCustInfo queryByPersonCardNO(String personCardNo) {
TVipAreaCardCustInfo tVipAreaCardCustInfo = new TVipAreaCardCustInfo();
TVipAreaCardCustInfoExample example = new TVipAreaCardCustInfoExample();
example.createCriteria().andCustCardNoEqualTo(personCardNo);
List<TVipAreaCardCustInfo> list = tVipAreaCardCustInfoMapper.selectByExample(example);
if(!CollectionUtils.isEmpty(list)){
tVipAreaCardCustInfo = list.get(0);
}
return tVipAreaCardCustInfo;
}
@Override
public List<TVipAreaCardCustInfo> queryTVipAreaCardCustInfo(TVipAreaCardCustInfoRequest request) {
TVipAreaCardCustInfo tVipAreaCardCustInfo = new TVipAreaCardCustInfo();
TVipAreaCardCustInfoExample example = new TVipAreaCardCustInfoExample();
TVipAreaCardCustInfoExample.Criteria sql = example.createCriteria();
sql.andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
if(CollectionUtils.isNotEmpty(request.getCustCardNos())){
sql.andCustCardNoIn(request.getCustCardNos());
}
if(StringUtils.isNotEmpty(request.getCustCardNo())){
sql.andCustCardNoEqualTo(request.getCustCardNo());
}
if(StringUtils.isNotEmpty(request.getCardNo())){
sql.andCardNoEqualTo(request.getCardNo());
}
if(StringUtils.isNotEmpty(request.getCarNumber())){
sql.andCardNoEqualTo(request.getCarNumber());
}
example.setOrderByClause("exp_date desc");
List<TVipAreaCardCustInfo> list = tVipAreaCardCustInfoMapper.selectByExample(example);
return list;
}
@Override
public int batchDeleteTVipAreaCardCustInfoByPrimaryKey(List<Long> ids, String opId, String opName) {
TVipAreaCardCustInfo record = new TVipAreaCardCustInfo();
record.setModifyEmpid(opId);
record.setModifyName(opName);
record.setModifyDate(new Date());
record.setDataState(DataStatusEnum.DATA_STATUS_NO_VALID.value());
TVipAreaCardCustInfoExample example = new TVipAreaCardCustInfoExample();
example.createCriteria().andIdIn(ids);
return tVipAreaCardCustInfoMapper.updateByExampleSelective(record,example);
}
@Override
public PageInfo<TVipAreaCardCustInfoDTO> queryTVipAreaCardCustInfoForPage(TVipAreaCardCustInfoQueryRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<TVipAreaCardCustInfoDTO> list = tVipAreaCardCustInfoSMapper.queryTVipAreaCardCustInfoForPage(request);
if (CollectionUtils.isNotEmpty(list)) {
return new PageInfo<TVipAreaCardCustInfoDTO>(list);
}
return new PageInfo<TVipAreaCardCustInfoDTO>(new ArrayList<TVipAreaCardCustInfoDTO>());
}
@Override
public List<TVipAreaCardCustInfoDTO> queryVipAreaCardInfoByCarNumbers(TVipAreaCardCustInfoQueryRequest request) {
return tVipAreaCardCustInfoSMapper.queryVipAreaCardInfoByCarNumbers(request);
}
@Override
public List<TVipAreaCardCustInfoDTO> queryVipAreaCardInfoByCarNumbersForApp(TVipAreaCardCustInfoQueryRequest request) {
return tVipAreaCardCustInfoSMapper.queryVipAreaCardInfoByCarNumbersForApp(request);
}
/**
* 根据个人卡编码更新个人卡状态
*
* @param personCardNo
* @return
*/
@Override
public Boolean updateByPersonCardNo(String personCardNo) {
TVipAreaCardCustInfo record = new TVipAreaCardCustInfo();
record.setDataState(DataStatusEnum.DATA_STATUS_VALID.value());
record.setRemark("购买订单已经下单成功,返回回调通知");
record.setModifyDate(new Date());
TVipAreaCardCustInfoExample example = new TVipAreaCardCustInfoExample();
example.createCriteria().andCustCardNoEqualTo(personCardNo);
int i = tVipAreaCardCustInfoMapper.updateByExampleSelective(record, example);
return i >0;
}
/**
* 查询未推送给第三发的会员卡
* @param currentDate yyyy-MM-dd HH:mm:ss
* @return
*/
@Override
public List<TVipNoPushCardCustInfoDO> queryNoPustVipCardCustInfo(String currentDate, Long id) {
return tVipAreaCardCustInfoSMapper.queryNoPustVipCardCustInfo(currentDate,id);
}
/**
* 查询推送和未推送给第三发的会员卡
* @param currentDate yyyy-MM-dd HH:mm:ss
* @return
*/
@Override
public List<TVipNoPushCardCustInfoDO> queryPustVipCardCustInfo(String currentDate,Long id) {
return tVipAreaCardCustInfoSMapper.queryPustVipCardCustInfo(currentDate,id);
}
/**
* 查询用户是否购买区域卡
* @param request
* @return
*/
@Override
public Boolean queryIsBuyVipCardCust(QueryIsBuyVipCardCustReq request) {
Integer integer = tVipAreaCardCustInfoSMapper.queryIsBuyVipCardCust(request);
return integer>0;
}
@Override
public List<OrderVipAreacardDetailTotalDTO> queryVipAreaCardStatisticTotal(QueryVipCardOrderDetailTotalReq request) {
return tVipAreaCardCustInfoSMapper.queryVipAreaCardStatisticTotal(request);
}
@Override
public ParkVipAreaCardNumDTO queryParkVipAreaCardNumByPlNo(String plNo,Long orgId) {
return tVipAreaCardCustInfoSMapper.queryParkVipAreaCardNumByPlNo(plNo,orgId);
}
@Override
public List<TVipAreaCardCustInfo> queryExpireVipCardCustInfo(VipAreaCardExpireRequest vipPushRequest) {
return tVipAreaCardCustInfoSMapper.queryExpireVipCardCustInfo(vipPushRequest);
}
/***********************************************时域卡************************************/
@Override
public PageInfo<TVipAreaCardCustInfoDTO> queryTVipTimeCardCustInfoForPage(TVipAreaCardCustInfoQueryRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<TVipAreaCardCustInfoDTO> list = tVipAreaCardCustInfoSMapper.queryTVipTimeCardCustInfoForPage(request);
if (CollectionUtils.isNotEmpty(list)) {
return new PageInfo<TVipAreaCardCustInfoDTO>(list);
}
return new PageInfo<TVipAreaCardCustInfoDTO>(new ArrayList<TVipAreaCardCustInfoDTO>());
}
@Override
public List<TVipAreaCardCustInfoDTO> queryVipTimeCardInfoByCarNumbers(TVipAreaCardCustInfoQueryRequest request) {
return tVipAreaCardCustInfoSMapper.queryVipTimeCardInfoByCarNumbers(request);
}
@Override
public List<TVipAreaCardCustInfoDTO> queryVipTimeCardInfoByCarNumbersForApp(TVipAreaCardCustInfoQueryRequest request) {
return tVipAreaCardCustInfoSMapper.queryVipTimeCardInfoByCarNumbersForApp(request);
}
/**
* 查询用户是否购买时域卡
* @param request
* @return
*/
@Override
public Boolean queryIsBuyTimeVipCardCust(QueryIsBuyVipCardCustReq request) {
Integer integer = tVipAreaCardCustInfoSMapper.queryIsBuyTimeVipCardCust(request);
return integer>0;
}
@Override
public List<OrderVipAreacardDetailTotalDTO> queryVipTimeCardStatisticTotal(QueryVipCardOrderDetailTotalReq request) {
return tVipAreaCardCustInfoSMapper.queryVipTimeCardStatisticTotal(request);
}
@Override
public List<TVipAreaCardCustInfo> queryExpireTimeVipCardCustInfo(VipAreaCardExpireRequest vipPushRequest) {
return tVipAreaCardCustInfoSMapper.queryExpireTimeVipCardCustInfo(vipPushRequest);
}
@Override
public TVipAreaCardCustInfo queryTimeCardBuyTimesByCarNumber(ValidVipAreaCardCustInfoRequest request) {
return tVipAreaCardCustInfoSMapper.queryTimeCardBuyTimesByCarNumber(request);
}
@Override
public int updateAreaCardInvalid(DeleteAreaCardByCustCardNoReq request) {
TVipAreaCardCustInfo record = new TVipAreaCardCustInfo();
//将失效日期置为昨天
Date yesterday = DateUtil.yesterday();
yesterday = DateUtil.endOfDay(yesterday);
record.setExpDate(yesterday);
record.setModifyDate(null != request.getModifyDate() ? request.getModifyDate() : new Date());
record.setModifyEmpid(request.getModifyEmpid());
record.setModifyName(request.getModifyName());
TVipAreaCardCustInfoExample example = new TVipAreaCardCustInfoExample();
example.createCriteria().andCustCardNoEqualTo(request.getCustCardNo());
return tVipAreaCardCustInfoMapper.updateByExampleSelective(record, example);
}
/**
* 根据到期时间查询区域卡
* @param
* @return
* @Author: wangfs
* @Date: 2020/4/8 18:24
*
*/
@Override
public List<TVipAreaCardCustInfo> queryVipCardCustInfoByExpDate(VipAreaCardExpireRequest vipPushRequest) {
Date beginTime = DateUtil.beginOfDay(vipPushRequest.getNowDate());
Date endTime = DateUtil.endOfDay(vipPushRequest.getNowDate());
List<TVipAreaCardCustInfo> tVipAreaCardCustInfos = tVipAreaCardCustInfoMapper.queryVipCardCustInfoByExpDate(beginTime,endTime);
return tVipAreaCardCustInfos;
}
@Override
public List<TVipAreaCardCustInfo> queryTVipAreaCardCustInfoListByAreaCardType(TVipAreaCardCustInfoRequest request) {
List<TVipAreaCardCustInfo> tVipAreaCardCustInfos = tVipAreaCardCustInfoSMapper.queryTVipAreaCardCustInfoListByAreaCardType(request);
return tVipAreaCardCustInfos;
}
/**
* 根据停车场编号与车牌号码查询当前有效的会员车信息
* @param request
* @author: zegnqc
* @return
*/
@Override
public TVipAreaCardCustInfo queryCardCustInfoByParkcodeAndCarnumber(VipCardInfoReq request) {
return tVipAreaCardCustInfoMapper.queryCardCustInfoByParkcodeAndCarnumber(request);
}
/**
* 据停车场编号与车牌号码查询该车所有有效的会员卡记录,包括已过期数据
*
* @Author: zegnqc
*/
@Override
public List<TVipAreaCardCustInfo> queryAllAreaVipCardByParkcodeAndCarnumber(VipCardInfoReq request) {
return tVipAreaCardCustInfoMapper.queryAllAreaVipCardByParkcodeAndCarnumber(request);
}
@Override
public List<TVipAreaCardCustInfo> queryAllActiveInfo(TVipAreaCardCustInfoRequest request) {
List<TVipAreaCardCustInfo> tVipAreaCardCustInfos = tVipAreaCardCustInfoSMapper.queryAllActiveInfo(request);
return tVipAreaCardCustInfos;
}
}