758162a4
张志伟
|
1
2
|
package cn.fw.valhalla.controller.api;
|
0ce04411
张志伟
|
3
|
import cn.fw.common.web.annotation.ControllerMethod;
|
758162a4
张志伟
|
4
|
import cn.fw.data.base.domain.common.Message;
|
4ee5bb9c
夏天
新增档案接口
|
5
|
import cn.fw.valhalla.common.utils.BeanUtils;
|
758162a4
张志伟
|
6
|
import cn.fw.valhalla.domain.dto.CustomerDetailDto;
|
4ee5bb9c
夏天
新增档案接口
|
7
|
import cn.fw.valhalla.domain.dto.NewCustomerDTO;
|
64777d0d
张志伟
|
8
|
import cn.fw.valhalla.domain.vo.customer.CarArchiveVO;
|
758162a4
张志伟
|
9
|
import cn.fw.valhalla.sdk.api.CustomerApiService;
|
a1ab2b6a
夏天
新增sdk接口
|
10
|
import cn.fw.valhalla.sdk.param.*;
|
1983befb
张志伟
feat(api): :spark...
|
11
|
import cn.fw.valhalla.sdk.result.*;
|
d1deb950
张志伟
|
12
13
14
15
|
import cn.fw.valhalla.service.bus.cust.ContactBizService;
import cn.fw.valhalla.service.bus.cust.CustomerBizService;
import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService;
import cn.fw.valhalla.service.bus.cust.PickUpCustomerService;
|
758162a4
张志伟
|
16
17
|
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
|
758162a4
张志伟
|
18
19
20
21
|
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
|
24867828
夏天
查询保有客档案sdk
|
22
23
|
import java.util.*;
|
758162a4
张志伟
|
24
25
|
import static cn.fw.common.businessvalidator.Validator.BV;
|
758162a4
张志伟
|
26
27
28
29
30
31
32
33
34
|
import static cn.fw.common.web.util.ResultBuilder.success;
/**
* 保有客相关
*
* @author kurisu
*/
@Slf4j
@RestController
|
7c9f5c47
张志伟
|
35
|
@RequestMapping("/api/valhalla/customer")
|
758162a4
张志伟
|
36
37
38
39
40
|
public class CustomerApiServiceImpl implements CustomerApiService {
/**
* 保有客数据服务
*/
private final CustomerBizService customerBiz;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
41
|
private final CustomerChangeBizService changeBizService;
|
56e11f52
张志伟
|
42
|
private final ContactBizService contactBizService;
|
94c87aab
张志伟
|
43
|
private final PickUpCustomerService pickUpCustomerService;
|
758162a4
张志伟
|
44
45
46
|
@Autowired
|
56e11f52
张志伟
|
47
|
CustomerApiServiceImpl(final CustomerBizService customerBiz,
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
48
|
final CustomerChangeBizService changeBizService,
|
94c87aab
张志伟
|
49
50
|
final ContactBizService contactBizService,
final PickUpCustomerService pickUpCustomerService) {
|
758162a4
张志伟
|
51
|
this.customerBiz = customerBiz;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
52
|
this.changeBizService = changeBizService;
|
56e11f52
张志伟
|
53
|
this.contactBizService = contactBizService;
|
94c87aab
张志伟
|
54
|
this.pickUpCustomerService = pickUpCustomerService;
|
758162a4
张志伟
|
55
56
57
58
|
}
@PostMapping("/save")
@Override
|
0ce04411
张志伟
|
59
|
@ControllerMethod("新增保有客档案")
|
758162a4
张志伟
|
60
|
public Message<Boolean> addCustomer(@Valid @RequestBody CustomerParams customerParams) {
|
0ce04411
张志伟
|
61
62
|
Boolean added = customerBiz.save4api(customerParams);
return success(added);
|
758162a4
张志伟
|
63
64
|
}
|
d1deb950
张志伟
|
65
66
67
68
69
70
71
72
|
@PostMapping("/update/buyDate")
@Override
@ControllerMethod("更新保有客档案购车时间")
public Message<Void> updateCustomerBuyDate(CustomerUpdateBuyDateParams updateBuyDateParams) {
customerBiz.updateCustomerBuyDate(updateBuyDateParams.getFrameNo(), updateBuyDateParams.getBuyDate(), updateBuyDateParams.getGroupId());
return success();
}
|
758162a4
张志伟
|
73
|
@Override
|
4ee5bb9c
夏天
新增档案接口
|
74
75
|
@PostMapping("/new/save")
@ControllerMethod("新增或更新售后保有客档案")
|
81a57463
夏天
新增档案接口
|
76
|
public Message<Long> saveCustomer(@Valid @RequestBody final CustomerSaveReq param) {
|
d1deb950
张志伟
|
77
|
return success(changeBizService.saveCustomer(BeanUtils.copy(param, NewCustomerDTO.class)));
|
4ee5bb9c
夏天
新增档案接口
|
78
79
80
|
}
@Override
|
758162a4
张志伟
|
81
|
@GetMapping("/query/by/id")
|
0ce04411
张志伟
|
82
|
@ControllerMethod("通过id查询保有客档案")
|
758162a4
张志伟
|
83
|
public Message<CustomerInfoDto> queryById(@RequestParam("customerId") Long customerId) {
|
0ce04411
张志伟
|
84
85
86
|
CustomerDetailDto detailDto = customerBiz.queryById(customerId);
if (Objects.isNull(detailDto)) {
return success();
|
758162a4
张志伟
|
87
|
}
|
0ce04411
张志伟
|
88
89
90
91
92
|
CustomerInfoDto dto = new CustomerInfoDto();
BeanUtils.copyProperties(detailDto, dto);
dto.setConsultantId(detailDto.getAdviserId());
dto.setConsultantName(detailDto.getAdviserName());
return success(dto);
|
758162a4
张志伟
|
93
94
95
96
|
}
@Override
@GetMapping("/query/by/mobile")
|
0ce04411
张志伟
|
97
|
@ControllerMethod("通过电话号码查询保有客档案列表")
|
758162a4
张志伟
|
98
|
public Message<List<CustomerInfoDto>> queryByMobile(@RequestParam("mobile") String mobile, Long groupId) {
|
0ce04411
张志伟
|
99
100
101
102
103
104
105
106
|
List<CustomerDetailDto> list = customerBiz.queryByMobile(mobile, groupId);
List<CustomerInfoDto> dtoList = new ArrayList<>();
for (CustomerDetailDto customer : list) {
CustomerInfoDto dto = new CustomerInfoDto();
BeanUtils.copyProperties(customer, dto);
dto.setConsultantId(customer.getAdviserId());
dto.setConsultantName(customer.getAdviserName());
dtoList.add(dto);
|
ad93e14a
张志伟
|
107
|
}
|
0ce04411
张志伟
|
108
|
return success(dtoList);
|
ad93e14a
张志伟
|
109
110
111
112
|
}
@Override
@GetMapping("/query/by/plateNo")
|
0ce04411
张志伟
|
113
|
@ControllerMethod("通过车牌号查询保有客档案列表")
|
ad93e14a
张志伟
|
114
|
public Message<CustomerInfoDto> queryByPlateNo(@RequestParam("plateNo") String plateNo, @RequestParam("groupId") Long groupId) {
|
0ce04411
张志伟
|
115
116
117
118
|
BV.isTrue(StringUtils.isNotBlank(plateNo), "车牌号不正确");
CustomerDetailDto detailDto = customerBiz.queryByPlateNo(plateNo, groupId);
if (Objects.isNull(detailDto)) {
return success();
|
758162a4
张志伟
|
119
|
}
|
0ce04411
张志伟
|
120
121
122
123
124
|
CustomerInfoDto dto = new CustomerInfoDto();
BeanUtils.copyProperties(detailDto, dto);
dto.setConsultantId(detailDto.getAdviserId());
dto.setConsultantName(detailDto.getAdviserName());
return success(dto);
|
758162a4
张志伟
|
125
126
|
}
|
ca13c864
张志伟
|
127
128
|
@Override
@GetMapping("/query/by/frameNo")
|
0ce04411
张志伟
|
129
|
@ControllerMethod("通过车架号查询保有客档案列表")
|
ca13c864
张志伟
|
130
|
public Message<CustomerInfoDto> queryByFrameNo(@RequestParam("frameNo") String frameNo, @RequestParam("groupId") Long groupId) {
|
0ce04411
张志伟
|
131
132
133
134
|
BV.isTrue(StringUtils.isNotBlank(frameNo), "车架号不正确");
CustomerDetailDto detailDto = customerBiz.queryByFrameNo(frameNo, groupId);
if (Objects.isNull(detailDto)) {
return success();
|
ca13c864
张志伟
|
135
|
}
|
0ce04411
张志伟
|
136
137
138
139
140
|
CustomerInfoDto dto = new CustomerInfoDto();
BeanUtils.copyProperties(detailDto, dto);
dto.setConsultantId(detailDto.getAdviserId());
dto.setConsultantName(detailDto.getAdviserName());
return success(dto);
|
ca13c864
张志伟
|
141
142
|
}
|
a1ab2b6a
夏天
新增sdk接口
|
143
|
@Override
|
93b833c9
夏天
新增会员认证车辆接口
|
144
145
146
147
148
149
150
151
152
153
154
155
|
@GetMapping("/query/vehicle/by/frameNo")
@ControllerMethod("通过车架号查询车辆信息,包含无档案")
public Message<CustomerInfoDto> queryVehicleByFrameNo(@RequestParam("frameNo") final String frameNo, @RequestParam("shopId") final Long shopId) {
CustomerDetailDto detailDto = customerBiz.queryVehicleByFrameNo(frameNo, shopId);
if (Objects.isNull(detailDto)) {
return success();
}
CustomerInfoDto dto = new CustomerInfoDto();
BeanUtils.copyProperties(detailDto, dto);
dto.setConsultantId(detailDto.getAdviserId());
dto.setConsultantName(detailDto.getAdviserName());
return success(dto);
|
a1ab2b6a
夏天
新增sdk接口
|
156
157
|
}
|
758162a4
张志伟
|
158
159
|
@GetMapping("/query/batch")
@Override
|
0ce04411
张志伟
|
160
|
@ControllerMethod("批量查询客户档案")
|
758162a4
张志伟
|
161
|
public Message<List<CustomerInfoDto>> queryBatch(@RequestParam("customerIds") final Long[] customerIds) {
|
0ce04411
张志伟
|
162
|
return success(customerBiz.queryBatch(customerIds));
|
758162a4
张志伟
|
163
164
165
166
|
}
@PostMapping("/change/adviser")
@Override
|
0ce04411
张志伟
|
167
|
@ControllerMethod("修改保有客专属顾问")
|
94c87aab
张志伟
|
168
|
public Message<Boolean> changeAdviser(@Valid @RequestBody final ChangeAdviserReq changeAdviserReq) {
|
0ce04411
张志伟
|
169
|
return success(changeBizService.changeAdviser(changeAdviserReq));
|
758162a4
张志伟
|
170
171
172
173
|
}
@GetMapping("/dealers")
@Override
|
0ce04411
张志伟
|
174
|
@ControllerMethod("查询会员档案所在商家")
|
758162a4
张志伟
|
175
|
public Message<List<Long>> dealers(@RequestParam("groupId") final Long groupId, @RequestParam("memberId") final Long memberId) {
|
0ce04411
张志伟
|
176
|
return success(customerBiz.getCustomerDealerId(groupId, memberId));
|
758162a4
张志伟
|
177
178
|
}
|
56e11f52
张志伟
|
179
180
|
@Override
@GetMapping("/receptioner")
|
0ce04411
张志伟
|
181
|
@ControllerMethod("查询接车送修人")
|
56e11f52
张志伟
|
182
|
public Message<CustomerContactDto> queryReceptioner(@RequestParam("customerId") final Long customerId, @RequestParam("plateNo") final String plateNo, @RequestParam("shopId") final Long shopId) {
|
0ce04411
张志伟
|
183
|
return success(contactBizService.queryReceptioner(customerId, plateNo, shopId));
|
586bfd00
张志伟
|
184
185
186
187
|
}
@Override
@GetMapping("/contactInfo")
|
0ce04411
张志伟
|
188
|
@ControllerMethod("查询联系人信息")
|
586bfd00
张志伟
|
189
|
public Message<CustomerContactDto> queryContactInfo(@RequestParam("customerId") Long customerId, @RequestParam("memberId") Long memberId) {
|
0ce04411
张志伟
|
190
|
return success(contactBizService.queryContactInfo(customerId, memberId));
|
56e11f52
张志伟
|
191
192
|
}
|
e5880775
张志伟
|
193
|
@Deprecated
|
7dcb5c8d
张志伟
🚑 新增修改车型代码SDK接口
|
194
195
|
@Override
@GetMapping("/modifySpecCode")
|
0ce04411
张志伟
|
196
|
@ControllerMethod("修改档案车型代码")
|
7dcb5c8d
张志伟
🚑 新增修改车型代码SDK接口
|
197
|
public Message<Boolean> modifySpecCode(@RequestParam("customerId") Long customerId, @RequestParam("specCode") String specCode) {
|
0ce04411
张志伟
|
198
|
return success(customerBiz.modifySpecCode(customerId, specCode));
|
7dcb5c8d
张志伟
🚑 新增修改车型代码SDK接口
|
199
200
|
}
|
fd45b634
张志伟
|
201
|
@Override
|
e5880775
张志伟
|
202
203
204
205
206
207
208
|
@PostMapping("/modify/spec_code")
@ControllerMethod("修改档案车型代码")
public Message<Boolean> updateSpecCode(@Valid @RequestBody ChangeSpecCodeReq changeSpecCodeReq) {
return success(customerBiz.fixSpecCode(changeSpecCodeReq));
}
@Override
|
fd45b634
张志伟
|
209
|
@GetMapping("/queryReceivable")
|
0ce04411
张志伟
|
210
|
@ControllerMethod("查询能否接车")
|
7c9f5c47
张志伟
|
211
|
public Message<ReceptionResultDto> queryReceivable(@RequestParam("userId") Long userId, @RequestParam("plateNo") String plateNo) {
|
0ce04411
张志伟
|
212
|
return success(customerBiz.queryReceivable(userId, plateNo));
|
fd45b634
张志伟
|
213
|
}
|
94c87aab
张志伟
|
214
215
|
@Override
|
7ad0be67
夏天
新增sdk接口
|
216
217
218
219
220
221
222
|
@GetMapping("/query/illegal/adviser")
@ControllerMethod("查询不能接车的售后接待人员")
public Message<List<Long>> queryIllegalAdviser(final Long cusId) {
return success(customerBiz.queryIllegalAdviser(cusId));
}
@Override
|
94c87aab
张志伟
|
223
|
@PostMapping("/updatePlateNo")
|
0ce04411
张志伟
|
224
|
@ControllerMethod("通过vin修改车牌号")
|
94c87aab
张志伟
|
225
|
public Message<Boolean> updatePlateNo(@Valid @RequestBody ChangePlateNoReq changePlateNoReq) {
|
0ce04411
张志伟
|
226
|
return success(pickUpCustomerService.fixPlateNo(changePlateNoReq.getFrameNo(), changePlateNoReq.getPlateNo(), changePlateNoReq.getGroupId()));
|
94c87aab
张志伟
|
227
|
}
|
64777d0d
张志伟
|
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
@Override
@GetMapping("/queryByMemberId")
@ControllerMethod("查询对应memberId的所有保有客档案")
public Message<List<CarArchiveDTO>> queryByMemberId(@RequestParam("memberId") Long memberId) {
List<CarArchiveDTO> list = new ArrayList<>();
List<CarArchiveVO> voList = customerBiz.defaultCustomer(memberId);
for (CarArchiveVO vo : voList) {
CarArchiveDTO dto = new CarArchiveDTO();
BeanUtils.copyProperties(vo, dto);
list.add(dto);
}
return success(list);
}
|
3145890c
张志伟
|
242
243
|
@Override
|
4c1e98c1
夏天
新增会员认证车辆接口
|
244
|
@GetMapping("/query/vehicle/by/memberId")
|
ede61714
夏天
新增会员认证车辆接口
|
245
246
247
248
249
250
|
@ControllerMethod("查询会员认证车辆")
public Message<List<MemberVehicleDTO>> queryVehicleByMemberId(@RequestParam("memberId") final Long memberId) {
return success(customerBiz.queryVehicleByMemberId(memberId));
}
@Override
|
3145890c
张志伟
|
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
@GetMapping("/query/by/engineNo")
@ControllerMethod("通过发动机号查询保有客档案")
public Message<CustomerInfoDto> queryByEngineNo(@RequestParam("engineNo") String engineNo, @RequestParam("groupId") Long groupId) {
BV.isTrue(StringUtils.isNotBlank(engineNo), "发动机号号不正确");
CustomerDetailDto detailDto = customerBiz.queryByEngineNo(engineNo, groupId);
if (Objects.nonNull(detailDto)) {
CustomerInfoDto dto = new CustomerInfoDto();
BeanUtils.copyProperties(detailDto, dto);
dto.setConsultantId(detailDto.getAdviserId());
dto.setConsultantName(detailDto.getAdviserName());
return success(dto);
}
return success();
}
|
1983befb
张志伟
feat(api): :spark...
|
265
|
|
1983befb
张志伟
feat(api): :spark...
|
266
|
@Override
|
2b5a0035
夏天
调整车辆认证逻辑
|
267
|
@GetMapping("/query/by/keyword")
|
1983befb
张志伟
feat(api): :spark...
|
268
269
270
271
|
@ControllerMethod("通过关键字查询档案列表")
public Message<List<BasicsCustomerDTO>> queryByKeyword(@RequestParam("keyword") String keyword, @RequestParam("groupId") Long groupId) {
return success(customerBiz.queryByKeyword(keyword, groupId));
}
|
2b5a0035
夏天
调整车辆认证逻辑
|
272
273
274
275
276
277
278
|
@Override
@GetMapping("/query/vehicle/by/vin")
@ControllerMethod("查询车辆认证信息")
public Message<MemberVehicleDTO> queryVehicle(@RequestParam("vin") final String vin) {
return success(customerBiz.queryVehicleByVin(vin));
}
|
24867828
夏天
查询保有客档案sdk
|
279
280
281
282
283
|
@Override
@PostMapping("/query/cus/cnt")
@ControllerMethod("查询保有客户数量")
public Message<List<CusCntResult>> queryCusCnt(@RequestBody final CusCntReq req) {
|
3bddceac
夏天
查询保有客档案sdk
|
284
|
return success(customerBiz.queryCusCnt(req));
|
24867828
夏天
查询保有客档案sdk
|
285
|
}
|
758162a4
张志伟
|
286
|
}
|