diff --git a/fw-valhalla-sdk/pom.xml b/fw-valhalla-sdk/pom.xml index 4efa15e..52bec6a 100644 --- a/fw-valhalla-sdk/pom.xml +++ b/fw-valhalla-sdk/pom.xml @@ -10,7 +10,7 @@ ../pom.xml fw-valhalla-sdk - 1.1.1 + 1.1.3 jar fw-valhalla-sdk diff --git a/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/CustomerApiService.java b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/CustomerApiService.java index 3449b7c..1565a63 100644 --- a/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/CustomerApiService.java +++ b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/api/CustomerApiService.java @@ -2,6 +2,7 @@ package cn.fw.valhalla.sdk.api; import cn.fw.data.base.domain.common.Message; import cn.fw.valhalla.sdk.param.ChangeAdviserReq; +import cn.fw.valhalla.sdk.param.ChangePlateNoReq; import cn.fw.valhalla.sdk.param.CustomerParams; import cn.fw.valhalla.sdk.result.CustomerContactDto; import cn.fw.valhalla.sdk.result.CustomerInfoDto; @@ -88,7 +89,7 @@ public interface CustomerApiService { * @return 是否变更成功 */ @PostMapping("/change/adviser") - Message changeAdviser(@RequestBody ChangeAdviserReq changeAdviserReq); + Message changeAdviser(@Valid @RequestBody ChangeAdviserReq changeAdviserReq); /** * 会员关联商家(专属商家和进站的商家) @@ -140,4 +141,12 @@ public interface CustomerApiService { */ @GetMapping("/queryReceivable") Message queryReceivable(@RequestParam("userId") Long userId, @RequestParam("plateNo") String plateNo); + + /** + * 修改车牌号 + * @param changePlateNoReq + * @return + */ + @PostMapping("/updatePlateNo") + Message updatePlateNo(@Valid @RequestBody ChangePlateNoReq changePlateNoReq); } diff --git a/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/ChangePlateNoReq.java b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/ChangePlateNoReq.java new file mode 100644 index 0000000..70ef60c --- /dev/null +++ b/fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/param/ChangePlateNoReq.java @@ -0,0 +1,35 @@ +package cn.fw.valhalla.sdk.param; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 修改车牌号 + * @author kurisu + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class ChangePlateNoReq { + /** + * 车架号 + */ + @NotBlank(message = "车架号不能为空") + private String frameNo; + /** + * 车牌号 + */ + @NotBlank(message = "车牌号不能为空") + private String plateNo; + /** + * 集团id + */ + @NotNull(message = "集团id不能为空") + private Long groupId; +} diff --git a/fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/CustomerApiServiceImpl.java b/fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/CustomerApiServiceImpl.java index efd26af..a864606 100644 --- a/fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/api/CustomerApiServiceImpl.java +++ b/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; import cn.fw.valhalla.domain.dto.CustomerDetailDto; import cn.fw.valhalla.sdk.api.CustomerApiService; import cn.fw.valhalla.sdk.param.ChangeAdviserReq; +import cn.fw.valhalla.sdk.param.ChangePlateNoReq; import cn.fw.valhalla.sdk.param.CustomerParams; import cn.fw.valhalla.sdk.result.CustomerContactDto; import cn.fw.valhalla.sdk.result.CustomerInfoDto; @@ -11,6 +12,7 @@ import cn.fw.valhalla.sdk.result.ReceptionResultDto; 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; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; @@ -42,15 +44,18 @@ public class CustomerApiServiceImpl implements CustomerApiService { private final CustomerBizService customerBiz; private final CustomerChangeBizService changeBizService; private final ContactBizService contactBizService; + private final PickUpCustomerService pickUpCustomerService; @Autowired CustomerApiServiceImpl(final CustomerBizService customerBiz, final CustomerChangeBizService changeBizService, - final ContactBizService contactBizService) { + final ContactBizService contactBizService, + final PickUpCustomerService pickUpCustomerService) { this.customerBiz = customerBiz; this.changeBizService = changeBizService; this.contactBizService = contactBizService; + this.pickUpCustomerService = pickUpCustomerService; } @PostMapping("/save") @@ -174,7 +179,7 @@ public class CustomerApiServiceImpl implements CustomerApiService { @PostMapping("/change/adviser") @Override - public Message changeAdviser(@RequestBody final ChangeAdviserReq changeAdviserReq) { + public Message changeAdviser(@Valid @RequestBody final ChangeAdviserReq changeAdviserReq) { final String msg = "修改保有客专属顾问[changeAdviser]"; log.info("{}: param:{}", msg, changeAdviserReq); try { @@ -255,4 +260,18 @@ public class CustomerApiServiceImpl implements CustomerApiService { return failureWithMessage("查询联系人信息失败"); } } + + @Override + @PostMapping("/updatePlateNo") + public Message updatePlateNo(@Valid @RequestBody ChangePlateNoReq changePlateNoReq) { + final String msg = "通过vin修改车牌号[updatePlateNo]"; + log.info("{}: param:[{}]", msg, changePlateNoReq); + try { + return success(pickUpCustomerService.fixPlateNo(changePlateNoReq.getFrameNo(), changePlateNoReq.getPlateNo(), changePlateNoReq.getGroupId()), + data -> log.info("{}:data[{}]", msg, data)); + } catch (Exception ex) { + handleException(ex, e -> log.error("{}失败: param:[{}]", msg, changePlateNoReq, e)); + return failureWithMessage("通过vin修改车牌号失败"); + } + } } diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java index 05abaed..7a85c29 100644 --- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java +++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java @@ -74,6 +74,22 @@ public class PickUpCustomerService extends AbstractCustomerService { } /** + * 修改车牌号 + * + * @param frameNo + * @param plateNo + * @param groupId + * @return + */ + @Transactional(rollbackFor = Exception.class) + public Boolean fixPlateNo(String frameNo, String plateNo, Long groupId) { + Customer customer = customerService.queryByFrameNo(frameNo, groupId); + BV.notNull(customer, () -> "车架号有误"); + customer.setPlateNo(plateNo); + return customerService.updateById(customer); + } + + /** * 根据vin查询档案 * * @param currentUser diff --git a/pom.xml b/pom.xml index 2db3f89..a5f111b 100644 --- a/pom.xml +++ b/pom.xml @@ -114,7 +114,7 @@ cn.fw fw-valhalla-sdk - 1.1.1 + 1.1.3 cn.fw