Commit 6b0d474a91223a3fac7caf5d80ffb49c1c7c6154

Authored by 张志伟
2 parents af4ecce0 ecbb43bc

Merge remote-tracking branch 'origin/dev'

fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/wx/CustomerWxController.java
1 1 package cn.fw.valhalla.controller.wx;
2 2  
  3 +import cn.fw.common.web.annotation.ControllerMethod;
3 4 import cn.fw.common.web.auth.PassportAuthBean;
4 5 import cn.fw.common.web.auth.annotation.CurrentUser;
5 6 import cn.fw.data.base.domain.common.Message;
... ... @@ -12,7 +13,6 @@ import cn.fw.valhalla.domain.vo.customer.CustomerChangeInfoVO;
12 13 import cn.fw.valhalla.service.bus.cust.ContactBizService;
13 14 import cn.fw.valhalla.service.bus.cust.CustomerBizService;
14 15 import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService;
15   -import com.alibaba.fastjson.JSONObject;
16 16 import lombok.extern.slf4j.Slf4j;
17 17 import org.springframework.beans.factory.annotation.Autowired;
18 18 import org.springframework.validation.annotation.Validated;
... ... @@ -22,10 +22,7 @@ import javax.validation.constraints.NotBlank;
22 22 import javax.validation.constraints.NotNull;
23 23 import java.util.List;
24 24  
25   -import static cn.fw.common.web.util.ExceptionHandler.handleException;
26   -import static cn.fw.common.web.util.ResultBuilder.failureWithMessage;
27 25 import static cn.fw.common.web.util.ResultBuilder.success;
28   -import static cn.fw.valhalla.common.constant.MessageStr.SAVE_FAILURE;
29 26  
30 27 /**
31 28 * @author : kurisu
... ... @@ -60,16 +57,9 @@ public class CustomerWxController {
60 57 * @return 操作结果
61 58 */
62 59 @GetMapping("/exist/correlation")
  60 + @ControllerMethod("查询是否关联保有客档案")
63 61 public Message<Boolean> existCorrelation(@CurrentUser PassportAuthBean user, @NotNull(message = "档案ID不能为空") Long customerId) {
64   - final String msg = "C端-查询是否关联保有客档案[existCorrelation]";
65   - log.info("{},param:[{}]", msg, customerId);
66   - try {
67   - return success(contactBizService.existCorrelation(user.getUserId(), customerId),
68   - data -> log.info("{} param[{},{}] data[{}]", msg, user, customerId, data));
69   - } catch (Exception ex) {
70   - handleException(ex, e -> log.error("{}失败:", msg, e));
71   - return failureWithMessage("查询是否关联保有客档案失败");
72   - }
  62 + return success(contactBizService.existCorrelation(user.getUserId(), customerId));
73 63 }
74 64  
75 65 /**
... ... @@ -80,16 +70,10 @@ public class CustomerWxController {
80 70 * @return 操作结果
81 71 */
82 72 @PostMapping("/correlation")
  73 + @ControllerMethod("关联送修人")
83 74 public Message<Boolean> correlation(@CurrentUser PassportAuthBean user,
84 75 @Validated @RequestBody CorrelationDto correlationDto) {
85   - final String msg = "C端wx-关联送修人[correlation]";
86   - log.info("{},param:[{}]", msg, JSONObject.toJSONString(correlationDto));
87   - try {
88   - return success(contactBizService.correlation(user, correlationDto));
89   - } catch (Exception ex) {
90   - handleException(ex, e -> log.error("{}失败:", msg, e));
91   - return failureWithMessage("关联送修人失败");
92   - }
  76 + return success(contactBizService.correlation(user, correlationDto));
93 77 }
94 78  
95 79 /**
... ... @@ -99,15 +83,9 @@ public class CustomerWxController {
99 83 * @return
100 84 */
101 85 @GetMapping("/info")
  86 + @ControllerMethod("保有客档案查询")
102 87 public Message<CustomerChangeInfoVO> info(@NotNull(message = "档案id不能为空") Long cusId) {
103   - final String msg = "C端wx-保有客档案查询[/info]";
104   - log.info("{},param:[{}]", msg, cusId);
105   - try {
106   - return success(changeBizService.mpGetById(cusId));
107   - } catch (Exception ex) {
108   - handleException(ex, e -> log.error("{}失败:", msg, e));
109   - return failureWithMessage("保有客档案信息获取失败");
110   - }
  88 + return success(changeBizService.mpGetById(cusId));
111 89 }
112 90  
113 91 /**
... ... @@ -118,16 +96,10 @@ public class CustomerWxController {
118 96 * @return
119 97 */
120 98 @GetMapping("/change/info")
  99 + @ControllerMethod("保有客档案变更基本信息回显")
121 100 public Message<CustomerChangeInfoVO> changeInfo(@CurrentUser PassportAuthBean user,
122 101 @NotBlank(message = "口令不能为空") String key) {
123   - final String msg = "C端wx-保有客档案变更基本信息回显[/change/info]";
124   - log.info("{},param:[{}]", msg, key);
125   - try {
126   - return success(changeBizService.getInfo(user, key));
127   - } catch (Exception ex) {
128   - handleException(ex, e -> log.error("{}失败:", msg, e));
129   - return failureWithMessage("保有客档案变更基本信息获取失败");
130   - }
  102 + return success(changeBizService.getInfo(user, key));
131 103 }
132 104  
133 105 /**
... ... @@ -136,15 +108,9 @@ public class CustomerWxController {
136 108 * @param dto 档案信息
137 109 */
138 110 @PostMapping("/save")
  111 + @ControllerMethod("修改档案信息")
139 112 public Message<Long> updateOrCreate(@CurrentUser PassportAuthBean user, @Validated @RequestBody final CustomerChangeDto dto) {
140   - final String msg = "修改档案信息[save]";
141   - log.info("{}: param[{}]", msg, dto);
142   - try {
143   - return success(changeBizService.updateOrSave(user, dto));
144   - } catch (Exception ex) {
145   - handleException(ex, e -> log.error("{}失败:param[{}]", msg, dto, e));
146   - return failureWithMessage(SAVE_FAILURE);
147   - }
  113 + return success(changeBizService.updateOrSave(user, dto));
148 114 }
149 115  
150 116 /**
... ... @@ -154,15 +120,8 @@ public class CustomerWxController {
154 120 * @return
155 121 */
156 122 @GetMapping("/car/list")
  123 + @ControllerMethod("查询所有档案")
157 124 public Message<List<CarArchiveVO>> carList(@CurrentUser PassportAuthBean user) {
158   - final String msg = "C端wx-查询所有档案[/car/default]";
159   - log.info("{}", msg);
160   - try {
161   - return success(customerBizService.defaultCustomer(user.getUserId()),
162   - data -> log.info("{}: data.size[{}]", msg, data.size()));
163   - } catch (Exception ex) {
164   - handleException(ex, e -> log.error("{}失败:", msg, e));
165   - return failureWithMessage("查询所有档案失败");
166   - }
  125 + return success(customerBizService.defaultCustomer(user.getUserId()));
167 126 }
168 127 }
... ...