Commit 94c87aab62533131a3840454d789a8527b0d1f01

Authored by 张志伟
1 parent ee39ce19

:sparkles: 🔲新车上户修改车牌号

fw-valhalla-sdk/pom.xml
... ... @@ -10,7 +10,7 @@
10 10 <relativePath>../pom.xml</relativePath>
11 11 </parent>
12 12 <artifactId>fw-valhalla-sdk</artifactId>
13   - <version>1.1.1</version>
  13 + <version>1.1.3</version>
14 14 <packaging>jar</packaging>
15 15 <name>fw-valhalla-sdk</name>
16 16  
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/CustomerApiService.java
... ... @@ -2,6 +2,7 @@ package cn.fw.valhalla.sdk.api;
2 2  
3 3 import cn.fw.data.base.domain.common.Message;
4 4 import cn.fw.valhalla.sdk.param.ChangeAdviserReq;
  5 +import cn.fw.valhalla.sdk.param.ChangePlateNoReq;
5 6 import cn.fw.valhalla.sdk.param.CustomerParams;
6 7 import cn.fw.valhalla.sdk.result.CustomerContactDto;
7 8 import cn.fw.valhalla.sdk.result.CustomerInfoDto;
... ... @@ -88,7 +89,7 @@ public interface CustomerApiService {
88 89 * @return 是否变更成功
89 90 */
90 91 @PostMapping("/change/adviser")
91   - Message<Boolean> changeAdviser(@RequestBody ChangeAdviserReq changeAdviserReq);
  92 + Message<Boolean> changeAdviser(@Valid @RequestBody ChangeAdviserReq changeAdviserReq);
92 93  
93 94 /**
94 95 * 会员关联商家(专属商家和进站的商家)
... ... @@ -140,4 +141,12 @@ public interface CustomerApiService {
140 141 */
141 142 @GetMapping("/queryReceivable")
142 143 Message<ReceptionResultDto> queryReceivable(@RequestParam("userId") Long userId, @RequestParam("plateNo") String plateNo);
  144 +
  145 + /**
  146 + * 修改车牌号
  147 + * @param changePlateNoReq
  148 + * @return
  149 + */
  150 + @PostMapping("/updatePlateNo")
  151 + Message<Boolean> updatePlateNo(@Valid @RequestBody ChangePlateNoReq changePlateNoReq);
143 152 }
... ...
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/ChangePlateNoReq.java 0 → 100644
  1 +package cn.fw.valhalla.sdk.param;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Data;
  5 +import lombok.NoArgsConstructor;
  6 +import lombok.ToString;
  7 +
  8 +import javax.validation.constraints.NotBlank;
  9 +import javax.validation.constraints.NotNull;
  10 +
  11 +/**
  12 + * 修改车牌号
  13 + * @author kurisu
  14 + */
  15 +@Data
  16 +@AllArgsConstructor
  17 +@NoArgsConstructor
  18 +@ToString
  19 +public class ChangePlateNoReq {
  20 + /**
  21 + * 车架号
  22 + */
  23 + @NotBlank(message = "车架号不能为空")
  24 + private String frameNo;
  25 + /**
  26 + * 车牌号
  27 + */
  28 + @NotBlank(message = "车牌号不能为空")
  29 + private String plateNo;
  30 + /**
  31 + * 集团id
  32 + */
  33 + @NotNull(message = "集团id不能为空")
  34 + private Long groupId;
  35 +}
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/CustomerApiServiceImpl.java
... ... @@ -4,6 +4,7 @@ import cn.fw.data.base.domain.common.Message;
4 4 import cn.fw.valhalla.domain.dto.CustomerDetailDto;
5 5 import cn.fw.valhalla.sdk.api.CustomerApiService;
6 6 import cn.fw.valhalla.sdk.param.ChangeAdviserReq;
  7 +import cn.fw.valhalla.sdk.param.ChangePlateNoReq;
7 8 import cn.fw.valhalla.sdk.param.CustomerParams;
8 9 import cn.fw.valhalla.sdk.result.CustomerContactDto;
9 10 import cn.fw.valhalla.sdk.result.CustomerInfoDto;
... ... @@ -11,6 +12,7 @@ import cn.fw.valhalla.sdk.result.ReceptionResultDto;
11 12 import cn.fw.valhalla.service.bus.cust.ContactBizService;
12 13 import cn.fw.valhalla.service.bus.cust.CustomerBizService;
13 14 import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService;
  15 +import cn.fw.valhalla.service.bus.cust.PickUpCustomerService;
14 16 import lombok.extern.slf4j.Slf4j;
15 17 import org.apache.commons.lang.StringUtils;
16 18 import org.springframework.beans.BeanUtils;
... ... @@ -42,15 +44,18 @@ public class CustomerApiServiceImpl implements CustomerApiService {
42 44 private final CustomerBizService customerBiz;
43 45 private final CustomerChangeBizService changeBizService;
44 46 private final ContactBizService contactBizService;
  47 + private final PickUpCustomerService pickUpCustomerService;
45 48  
46 49  
47 50 @Autowired
48 51 CustomerApiServiceImpl(final CustomerBizService customerBiz,
49 52 final CustomerChangeBizService changeBizService,
50   - final ContactBizService contactBizService) {
  53 + final ContactBizService contactBizService,
  54 + final PickUpCustomerService pickUpCustomerService) {
51 55 this.customerBiz = customerBiz;
52 56 this.changeBizService = changeBizService;
53 57 this.contactBizService = contactBizService;
  58 + this.pickUpCustomerService = pickUpCustomerService;
54 59 }
55 60  
56 61 @PostMapping("/save")
... ... @@ -174,7 +179,7 @@ public class CustomerApiServiceImpl implements CustomerApiService {
174 179  
175 180 @PostMapping("/change/adviser")
176 181 @Override
177   - public Message<Boolean> changeAdviser(@RequestBody final ChangeAdviserReq changeAdviserReq) {
  182 + public Message<Boolean> changeAdviser(@Valid @RequestBody final ChangeAdviserReq changeAdviserReq) {
178 183 final String msg = "修改保有客专属顾问[changeAdviser]";
179 184 log.info("{}: param:{}", msg, changeAdviserReq);
180 185 try {
... ... @@ -255,4 +260,18 @@ public class CustomerApiServiceImpl implements CustomerApiService {
255 260 return failureWithMessage("查询联系人信息失败");
256 261 }
257 262 }
  263 +
  264 + @Override
  265 + @PostMapping("/updatePlateNo")
  266 + public Message<Boolean> updatePlateNo(@Valid @RequestBody ChangePlateNoReq changePlateNoReq) {
  267 + final String msg = "通过vin修改车牌号[updatePlateNo]";
  268 + log.info("{}: param:[{}]", msg, changePlateNoReq);
  269 + try {
  270 + return success(pickUpCustomerService.fixPlateNo(changePlateNoReq.getFrameNo(), changePlateNoReq.getPlateNo(), changePlateNoReq.getGroupId()),
  271 + data -> log.info("{}:data[{}]", msg, data));
  272 + } catch (Exception ex) {
  273 + handleException(ex, e -> log.error("{}失败: param:[{}]", msg, changePlateNoReq, e));
  274 + return failureWithMessage("通过vin修改车牌号失败");
  275 + }
  276 + }
258 277 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java
... ... @@ -74,6 +74,22 @@ public class PickUpCustomerService extends AbstractCustomerService {
74 74 }
75 75  
76 76 /**
  77 + * 修改车牌号
  78 + *
  79 + * @param frameNo
  80 + * @param plateNo
  81 + * @param groupId
  82 + * @return
  83 + */
  84 + @Transactional(rollbackFor = Exception.class)
  85 + public Boolean fixPlateNo(String frameNo, String plateNo, Long groupId) {
  86 + Customer customer = customerService.queryByFrameNo(frameNo, groupId);
  87 + BV.notNull(customer, () -> "车架号有误");
  88 + customer.setPlateNo(plateNo);
  89 + return customerService.updateById(customer);
  90 + }
  91 +
  92 + /**
77 93 * 根据vin查询档案
78 94 *
79 95 * @param currentUser
... ...
... ... @@ -114,7 +114,7 @@
114 114 <dependency>
115 115 <groupId>cn.fw</groupId>
116 116 <artifactId>fw-valhalla-sdk</artifactId>
117   - <version>1.1.1</version>
  117 + <version>1.1.3</version>
118 118 </dependency>
119 119 <dependency>
120 120 <groupId>cn.fw</groupId>
... ...