InvoiceCustInfoServiceImpl.java
9.74 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
package com.zteits.pay.biz.invoice;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zteits.clouds.api.apibase.bean.BizResult;
import com.zteits.clouds.api.apibase.constants.AppErrorEnum;
import com.zteits.clouds.api.apibase.constants.ErrorType;
import com.zteits.clouds.api.apibase.exception.AppException;
import com.zteits.clouds.api.apibase.exception.BizException;
import com.zteits.clouds.api.dto.pay.TdCCustInvoiceinfoDTO;
import com.zteits.clouds.api.dto.pay.TdCCustMailingAddressDTO;
import com.zteits.clouds.api.dto.pay.param.*;
import com.zteits.clouds.api.service.order.backorder.oper.BackParkOrderOperService;
import com.zteits.clouds.api.service.order.backorder.query.BackOrderQueryService;
import com.zteits.clouds.api.service.order.parkorder.oper.RNTParkOrderOperService;
import com.zteits.clouds.api.service.order.parkorder.query.PubParkOrderQueryService;
import com.zteits.clouds.api.service.order.payorder.query.PayOrderQueryService;
import com.zteits.clouds.api.service.order.rechargeorder.oper.RechargeOrderOperService;
import com.zteits.clouds.api.service.order.rechargeorder.query.RechargeOrderQueryService;
import com.zteits.clouds.api.service.order.vipcardorder.oper.VipCardOrderOperService;
import com.zteits.clouds.api.service.order.vipcardorder.query.VipCardOrderQueryService;
import com.zteits.clouds.api.service.pay.AppOrgService;
import com.zteits.clouds.api.service.pay.invoice.InvoiceCustInfoService;
import com.zteits.pay.configuration.mail.MailService;
import com.zteits.pay.dao.*;
import com.zteits.pay.domain.TdCCustInvoiceinfo;
import com.zteits.pay.domain.TdCCustInvoiceinfoExample;
import com.zteits.pay.domain.TdCCustMailingAddress;
import com.zteits.pay.domain.TdCCustMailingAddressExample;
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;
/**
* Copyright: Copyright (c) 2019 ZTE-ITS
*
* @Description:
* @ProjectName: zteits-clouds
* @Package: com.zteits.pay.biz.invoice
* @ClassName: InvoiceCustInfoServiceImpl
* Modification History:
* Date Author Version Description
* ---------------------------------------------------------*
* 2022/7/11 wb v1.0.0 创建
*/
@Component
public class InvoiceCustInfoServiceImpl implements InvoiceCustInfoService {
private static final Logger logger = LoggerFactory.getLogger(InvoiceCustInfoServiceImpl.class);
@Autowired
private TdCCustInvoiceinfoDao custInvoiceinfoDao;
@Autowired
private TdCCustMailingAddressDao custMailingAddressDao;
/**
* 新增一条客户发票抬头信息
*/
@Override
public BizResult<Long> insertCustomerInvoiceInfo(TdCCustInvoiceinfoRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
/**检查当前用户绑定抬头是否超过五个*/
Long count = custInvoiceinfoDao.checkBindInfoNum(requestObject);
logger.info("checkBindInfoNum:当前用户已绑定了"+count+"个抬头信息。");
if (count >=5 ) {
throw new AppException(AppErrorEnum.APP_INFOOUTLIMIT_ERROR);
}
TdCCustInvoiceinfo record = new TdCCustInvoiceinfo();
BeanUtils.copyProperties(requestObject, record);
logger.info("insertCustomerInvoiceInfo TdCCustInvoiceinfo--->: {} ", JSONObject.toJSON(record));
Long resultId = custInvoiceinfoDao.insertCustomerInvoiceInfo(record);
if(requestObject.getReturnId() !=null && requestObject.getReturnId()){
resultId = record.getId();
}
return new BizResult <Long> (resultId);
}
/**
* 新增一条客户邮寄地址信息
*/
@Override
public BizResult <Long> insertCustomerMailingAddressInfo(TdCCustMailingAddressRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
TdCCustMailingAddress record = new TdCCustMailingAddress();
BeanUtils.copyProperties(requestObject, record);
return new BizResult <Long> (custMailingAddressDao.insertCustomerMailingAddressInfo(record));
}
/**
* 删除一条客户发票抬头信息
*/
@Override
public BizResult <Boolean> deleteCustomerInvoiceInfoByID(DeleteCustInvoiceinfoRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
logger.info("deleteCustomerInvoiceInfoByID->id={}", requestObject.getId().toString());
return new BizResult <Boolean> (custInvoiceinfoDao.deleteCustomerInvoiceInfoByID(requestObject.getId()));
}
/**
* 删除一条客户邮寄地址信息
*/
@Override
public BizResult <Boolean> deleteCustomerMailingAddressInfoByID(DeleteCustMailingAddressRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
return new BizResult<Boolean> (custMailingAddressDao.deleteCustomerMailingAddressByID(requestObject.getId()));
}
/**
* 更新一条客户发票抬头信息
*/
@Override
public BizResult <Boolean> updateCustomerInvoiceInfo(TdCCustInvoiceinfoRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
TdCCustInvoiceinfo record = new TdCCustInvoiceinfo();
BeanUtils.copyProperties(requestObject, record);
return new BizResult <Boolean> (custInvoiceinfoDao.updateByPrimaryKeySelective(record));
}
/**
* 更新一条客户邮寄地址信息
*/
@Override
public BizResult<Boolean> updateCustomerMailingAddressInfo(TdCCustMailingAddressRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
TdCCustMailingAddress record = new TdCCustMailingAddress();
BeanUtils.copyProperties(requestObject, record);
return new BizResult<Boolean> (custMailingAddressDao.updateByPrimaryKeySelective(record));
}
/**
* 查询一条客户发票抬头信息
*/
@Override
public BizResult <TdCCustInvoiceinfoDTO> queryCustomerInvoiceInfoById(QueryCustInvoiceinfoRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
TdCCustInvoiceinfo tdCCustInvoiceinfo = custInvoiceinfoDao.queryCustomerInvoiceInfoById(requestObject.getId());
TdCCustInvoiceinfoDTO tdCCustInvoiceinfoDTO = new TdCCustInvoiceinfoDTO();
if (null != tdCCustInvoiceinfo) {
BeanUtils.copyProperties(tdCCustInvoiceinfo, tdCCustInvoiceinfoDTO);
}
return new BizResult <TdCCustInvoiceinfoDTO> (tdCCustInvoiceinfoDTO);
}
/**
* 查询客户所有发票抬头信息
*/
@Override
public BizResult<List<TdCCustInvoiceinfoDTO>> queryCustInvoiceInfoList(
QueryCustInvoiceInfoListRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
TdCCustInvoiceinfoExample example = new TdCCustInvoiceinfoExample();
example.createCriteria().andCustIdEqualTo(requestObject.getCustId());
List <TdCCustInvoiceinfo> tdCCustInvoiceinfoList = custInvoiceinfoDao.queryCustInvoiceInfoList(example);
List <TdCCustInvoiceinfoDTO> tdCCustInvoiceinfoDTOList = null;
if (null != tdCCustInvoiceinfoList) {
tdCCustInvoiceinfoDTOList = JSON.parseArray(JSON.toJSONString(tdCCustInvoiceinfoList, false), TdCCustInvoiceinfoDTO.class);
}
return new BizResult <List<TdCCustInvoiceinfoDTO>> (tdCCustInvoiceinfoDTOList);
}
/**
* 查询一条客户邮寄地址信息
*/
@Override
public BizResult <TdCCustMailingAddressDTO> queryCustomerMailingAddressInfoById(
QueryCustMailingAddressRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
TdCCustMailingAddressDTO tdCCustMailingAddressDTO = new TdCCustMailingAddressDTO();
TdCCustMailingAddress tdCCustMailingAddress = custMailingAddressDao.queryCustomerMailingAddressById(requestObject.getId());
if (null != tdCCustMailingAddress) {
BeanUtils.copyProperties(tdCCustMailingAddress, tdCCustMailingAddressDTO);
}
return new BizResult <TdCCustMailingAddressDTO> (tdCCustMailingAddressDTO);
}
/**
* 查询客户所有邮寄地址信息
*/
@Override
public BizResult<List<TdCCustMailingAddressDTO>> queryCustMailingAddressInfoList(
QueryCustMailingAddressInfoListRequest requestObject) {
if (null == requestObject) {
throw new BizException(ErrorType.PARAMM_NULL, "请求对象为空");
}
TdCCustMailingAddressExample example = new TdCCustMailingAddressExample();
example.createCriteria().andCustIdEqualTo(requestObject.getCustId());
List<TdCCustMailingAddress> tdCCustMailingAddressList = custMailingAddressDao.queryCustMailingAddressInfoList(example);
List<TdCCustMailingAddressDTO> tdCCustMailingAddressDTOList = null;
if (null != tdCCustMailingAddressList) {
tdCCustMailingAddressDTOList = JSON.parseArray(JSON.toJSONString(tdCCustMailingAddressList, false), TdCCustMailingAddressDTO.class);
}
return new BizResult <List<TdCCustMailingAddressDTO>> (tdCCustMailingAddressDTOList);
}
}