CustomerWxController.java
4.01 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
package cn.fw.valhalla.controller.wx;
import cn.fw.common.web.annotation.ControllerMethod;
import cn.fw.common.web.auth.PassportAuthBean;
import cn.fw.common.web.auth.annotation.CurrentUser;
import cn.fw.data.base.domain.common.Message;
import cn.fw.security.auth.client.annotation.Authorization;
import cn.fw.security.auth.client.enums.AuthType;
import cn.fw.valhalla.domain.dto.CorrelationDto;
import cn.fw.valhalla.domain.dto.NewCustomerDTO;
import cn.fw.valhalla.domain.vo.customer.CarArchiveVO;
import cn.fw.valhalla.domain.vo.customer.CustomerChangeInfoVO;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import static cn.fw.common.web.util.ResultBuilder.success;
/**
* @author : kurisu
* @className : CustomerWxController
* @description : 档案微信端控制器
* @date: 2020-08-13 15:00
*/
@Slf4j
@Validated
@RestController
@Authorization(AuthType.WECHAT)
@RequestMapping("/wx/customer")
public class CustomerWxController {
private final CustomerBizService customerBizService;
private final CustomerChangeBizService changeBizService;
private final ContactBizService contactBizService;
@Autowired
public CustomerWxController(final CustomerBizService customerBizService,
final CustomerChangeBizService changeBizService,
final ContactBizService contactBizService) {
this.customerBizService = customerBizService;
this.changeBizService = changeBizService;
this.contactBizService = contactBizService;
}
/**
* C端-查询是否关联保有客档案
*
* @param user 当前登录用户
* @param customerId 保有客档案id
* @return 操作结果
*/
@GetMapping("/exist/correlation")
@ControllerMethod("查询是否关联保有客档案")
public Message<Boolean> existCorrelation(@CurrentUser PassportAuthBean user, @NotNull(message = "档案ID不能为空") Long customerId) {
return success(contactBizService.existCorrelation(user.getUserId(), customerId));
}
/**
* C端wx-档案关联送修人
*
* @param user 当前登录用户
* @param correlationDto 联系人信息
* @return 操作结果
*/
@PostMapping("/correlation")
@ControllerMethod("关联送修人")
public Message<Boolean> correlation(@CurrentUser PassportAuthBean user,
@Validated @RequestBody CorrelationDto correlationDto) {
return success(contactBizService.correlation(user, correlationDto));
}
/**
* C端wx-档案查询
*
* @param cusId
* @return
* @Deprecated 将在下版本移除此接口 2022-03-15
*/
@GetMapping("/info")
@ControllerMethod("保有客档案查询")
public Message<CustomerChangeInfoVO> info(@NotNull(message = "档案id不能为空") Long cusId) {
return success(changeBizService.mpGetById(cusId));
}
/**
* 查询所有档案
*
* @param user
* @return
*/
@GetMapping("/car/list")
@ControllerMethod("查询所有档案")
public Message<List<CarArchiveVO>> carList(@CurrentUser PassportAuthBean user) {
return success(customerBizService.defaultCustomer(user.getUserId()));
}
/**
* 新增变更档案
*
* @param user
* @param dto
* @return
*/
@PostMapping("/new/save")
@ControllerMethod("新增档案信息")
public Message<Void> saveCustomer(@CurrentUser PassportAuthBean user, @Validated @RequestBody final NewCustomerDTO dto) {
dto.setMemberId(user.getUserId());
changeBizService.saveCustomer(dto);
return success();
}
}