mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update
This commit is contained in:
@@ -1053,4 +1053,26 @@ public class TempController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单个会员批量绑定车牌号
|
||||
*/
|
||||
@PostMapping("/batchBindCarNumber")
|
||||
public RestApiResponse<?> batchBindCarNumber(@RequestBody CarNumberBindDTO dto) {
|
||||
logger.info("单个会员批量绑定车牌号, param:{}", JSON.toJSONString(dto));
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
tempService.batchBindCarNumber(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("单个会员批量绑定车牌号 warn", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("单个会员批量绑定车牌号 error", e);
|
||||
response = new RestApiResponse<>("00300002", "单个会员批量绑定车牌号异常");
|
||||
}
|
||||
logger.info("单个会员批量绑定车牌号, result:{}", JSON.toJSONString(response));
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -142,6 +142,9 @@ public class TempService {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
/**
|
||||
* 计算订单耗电量
|
||||
* 内蒙古站点
|
||||
@@ -1528,5 +1531,32 @@ public class TempService {
|
||||
}
|
||||
}
|
||||
|
||||
public void batchBindCarNumber(CarNumberBindDTO dto) {
|
||||
if (dto == null || dto.getCarNumberList() == null || dto.getCarNumberList().isEmpty()) {
|
||||
throw new RuntimeException("请添加要绑定的车牌号");
|
||||
}
|
||||
if (dto.getVinList() == null || dto.getVinList().isEmpty()) {
|
||||
throw new RuntimeException("请添加要绑定的vin码");
|
||||
}
|
||||
if (StringUtils.isBlank(dto.getMemberId())) {
|
||||
throw new RuntimeException("请添加要绑定的用户ID");
|
||||
}
|
||||
if (StringUtils.isBlank(dto.getPhoneNumber())) {
|
||||
throw new RuntimeException("请添加要绑定的手机号");
|
||||
}
|
||||
if (dto.getCarNumberList().size() == dto.getVinList().size()){
|
||||
throw new RuntimeException("车牌号应与车架号对应");
|
||||
}
|
||||
for (int i = 0 ; i < dto.getCarNumberList().size() ; i++) {
|
||||
BindingCarNoDTO build = BindingCarNoDTO.builder()
|
||||
.phoneNumber(dto.getPhoneNumber())
|
||||
.carNo(dto.getCarNumberList().get(i))
|
||||
.vinCode(dto.getVinList().get(i))
|
||||
.memberId(dto.getMemberId())
|
||||
.build();
|
||||
memberService.memberBindingCarNo(build);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user