mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
Merge branch 'dev' of https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web into dev
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -11,6 +12,7 @@ import java.util.List;
|
||||
* @date 2023/3/4 11:39
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class BindingCarNoDTO {
|
||||
private String id;
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CarNumberBindDTO {
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 车牌号列表
|
||||
*/
|
||||
private List<String> carNumberList;
|
||||
|
||||
/**
|
||||
* vin列表
|
||||
*/
|
||||
private List<String> vinList;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user