TdCAcctSourceDaoImpl.java
6.72 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
/**
*
*/
package com.zteits.pay.dao.impl;
import java.math.BigDecimal;
import java.util.List;
import com.clouds.common.utils.DateUtil;
import com.zteits.clouds.api.apibase.constants.ErrorType;
import com.zteits.clouds.api.apibase.exception.BizException;
import com.zteits.clouds.api.dto.pay.AcctRechargeStatisticDTO;
import com.zteits.clouds.api.dto.pay.QueryRechargeByPhoneNumOrCustIdDTO;
import com.zteits.clouds.api.dto.pay.param.QueryRechargeByPhoneNumOrCustIdReq;
import com.zteits.pay.domain.TdCAcctPerson;
import com.zteits.pay.domain.TdCAcctSourceExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zteits.clouds.api.dto.pay.AcctSourceQueryRechargeDetailDTO;
import com.zteits.clouds.api.dto.pay.AcctSourceQueryRechargeStaticDTO;
import com.zteits.clouds.api.dto.pay.param.AcctPayoutForPageRequest;
import com.zteits.clouds.api.dto.pay.param.QueryAcctSourceStaticRequest;
import com.zteits.pay.dao.TdCAcctSourceDao;
import com.zteits.pay.domain.TdCAcctSource;
import com.zteits.pay.mapper.TdCAcctSourceMapper;
import com.zteits.pay.mapper.smapper.TdCAcctSourceSMapper;
import org.springframework.util.CollectionUtils;
/**
* @author hxz
*
*/
@Component
public class TdCAcctSourceDaoImpl implements TdCAcctSourceDao {
@Autowired
private TdCAcctSourceSMapper tdCAcctSourceSMapper;
@Autowired
private TdCAcctSourceMapper tdCAcctSourceMapper;
@Override
public Integer insertAcctSource(TdCAcctSource tdCAcctSource) {
return tdCAcctSourceMapper.insertSelective(tdCAcctSource);
}
/*
@Override
public Boolean updateAcctSource(AcctSourceDo acctSourceDo) {
try {
int updateResult = tdCAcctSourceSMapper.updateAcctSource(acctSourceDo);
if (updateResult > 0) {
return true;
}
return false;
} catch (Exception e) {
return false;
}
}
*/
@Override
public List<TdCAcctSource> getAcctSource(TdCAcctSource tdCAcctSource) {
return tdCAcctSourceSMapper.getAcctSource(tdCAcctSource);
}
@Override
public Boolean deleteAcctSource(TdCAcctSource tdCAcctSource) {
try {
int deleteResult = tdCAcctSourceSMapper.deleteAcctSource(tdCAcctSource);
if (deleteResult > 0) {
return true;
}
return false;
} catch (Exception e) {
return false;
}
}
@Override
public Long queryShareBerthActFee(TdCAcctSource tdCAcctSource) {
return tdCAcctSourceSMapper.queryShareBerthActFee(tdCAcctSource);
}
@Override
public PageInfo<AcctSourceQueryRechargeStaticDTO> queryCustRechargeFeeStatic(QueryAcctSourceStaticRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<AcctSourceQueryRechargeStaticDTO> list = tdCAcctSourceSMapper.queryCustRechargeFeeStatic(request);
return new PageInfo<>(list);
}
@Override
public PageInfo<AcctSourceQueryRechargeDetailDTO> queryCustRechargeFeeStaticMsg(QueryAcctSourceStaticRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<AcctSourceQueryRechargeDetailDTO> list = tdCAcctSourceSMapper.queryCustRechargeFeeStaticMsg(request);
return new PageInfo<>(list);
}
@Override
public PageInfo<TdCAcctSource> queryAcctRechargeForPage(AcctPayoutForPageRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<TdCAcctSource> list = tdCAcctSourceSMapper.queryAcctRechargeForPage(request);
return new PageInfo<>(list);
}
@Override
public AcctRechargeStatisticDTO statisticAcctRecharge(AcctPayoutForPageRequest request) {
return tdCAcctSourceSMapper.statisticAcctRecharge(request);
}
/**
* 针对赠送金额,包含代金券插入收入流水
* @param rechargeFee
* @param acctPersonDTO
*/
@Override
public void insertAcctSourceForPresent(Long rechargeFee, TdCAcctPerson acctPersonDTO, Integer presentDetailType, String outNo) {
TdCAcctSource acctSourceRequest =new TdCAcctSource();
// 账户id
acctSourceRequest.setAcctId(acctPersonDTO.getAcctId());
// 个人客户id
acctSourceRequest.setCustId(acctPersonDTO.getCustId());
// 充值类型 -99 -赠送金额
acctSourceRequest.setRechargeType(-99);
//赠送来源
acctSourceRequest.setPresentSourceDetailType(presentDetailType);
// 充值金额
acctSourceRequest.setRechargeFee(BigDecimal.valueOf(rechargeFee));
// 充值后余额
acctSourceRequest.setRechargeBalance(acctPersonDTO.getAcctBalance());
// 充值人id
acctSourceRequest.setRechargeId(acctPersonDTO.getAcctId());
// 充值人姓名
acctSourceRequest.setRechargeName(acctPersonDTO.getAcctName());
// 充值时间
acctSourceRequest.setRechargeTime(DateUtil.getSysDate());
// 保存赠送的唯一标识,用于判断是否重复赠送
acctSourceRequest.setRltPayorderId(outNo);
// 账户更新状态 ??? 默认为 1
acctSourceRequest.setAcctUptState(1);
// 数据状态:1有效,0无效
acctSourceRequest.setDataState(1);
acctSourceRequest.setAcctType(acctPersonDTO.getAcctType());
// 创建时间
acctSourceRequest.setCreateEmpid(acctPersonDTO.getCustId());
acctSourceRequest.setCreateDate(DateUtil.getSysDate());
acctSourceRequest.setOrgId(acctPersonDTO.getOrgId());
Integer flg = this.insertAcctSource(acctSourceRequest);
if(flg<=0){
throw new BizException(ErrorType.APP_ERROR,"保存个人收入流水失败",false);
}
}
@Override
public long countByExample(TdCAcctSourceExample example) {
return tdCAcctSourceMapper.countByExample(example);
}
/**
* 通过支付单id查询充值记录
* @param rltPayorderId
* @return
*/
@Override
public TdCAcctSource queryTdCAcctSourceByRltPayorderId(String rltPayorderId) {
TdCAcctSource acctSource = new TdCAcctSource();
TdCAcctSourceExample example = new TdCAcctSourceExample();
example.createCriteria().andDataStateEqualTo(1)
.andRltPayorderIdEqualTo(rltPayorderId);
List<TdCAcctSource> list = tdCAcctSourceMapper.selectByExample(example);
if(!CollectionUtils.isEmpty(list)){
acctSource =list.get(0);
}
return acctSource;
}
/**
* 通过手机号、cust_id 查询用户充值明细记录
* @Auther: wangfs
* @param
* @return
*/
@Override
public PageInfo<QueryRechargeByPhoneNumOrCustIdDTO> queryCustRechargeByPhoneNumOrCustId(QueryRechargeByPhoneNumOrCustIdReq request) {
//1.设置分页
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<QueryRechargeByPhoneNumOrCustIdDTO> list = tdCAcctSourceSMapper.queryCustRechargeByPhoneNumOrCustId(request);
return new PageInfo<>(list);
}
}