解决维修开单新增客户、车辆信息ID不回填
This commit is contained in:
parent
c939fbe59b
commit
c4d996a265
@ -437,13 +437,28 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
userDTO.setUsername(customerAndCarVO.getUserInfo().getPhoneNumber());
|
||||
userDTO.setPassword("123456");
|
||||
adminUserApi.createUser(userDTO);
|
||||
// 如果新增了数据,id没有回填
|
||||
if (ObjectUtil.isEmpty(userDTO.getId())){
|
||||
AdminUserRespDTO byMobile = adminUserApi.getUserByMobile(userDTO.getMobile());
|
||||
userDTO.setId(byMobile.getId());
|
||||
}
|
||||
customerAndCarVO.getUserInfo().setUserId(userDTO.getId());
|
||||
}
|
||||
}
|
||||
// 客户信息
|
||||
if (ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo())) {
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())) {
|
||||
// 新增之前判断一下电话号码是否重复
|
||||
List<CustomerMain> list = customerService.list(new LambdaQueryWrapper<CustomerMain>().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber()));
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
throw exception0(500, "电话号码重复");
|
||||
}
|
||||
customerService.save(customerAndCarVO.getUserInfo());
|
||||
// 如果新增了数据,id没有回填
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())){
|
||||
CustomerMain byPhoneNumber = customerService.getOne(new LambdaQueryWrapper<CustomerMain>().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber()));
|
||||
customerAndCarVO.getUserInfo().setId(byPhoneNumber.getId());
|
||||
}
|
||||
} else {
|
||||
customerService.updateById(customerAndCarVO.getUserInfo());
|
||||
}
|
||||
@ -452,7 +467,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())) {
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())) {
|
||||
customerAndCarVO.getCarInfo().setUserId(customerAndCarVO.getUserInfo().getUserId());
|
||||
// 新增之前判断一下车牌重复没
|
||||
List<CarMain> list = carMainService.list(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber()));
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
throw exception0(500, "车牌重复");
|
||||
}
|
||||
carMainService.createCarMain(customerAndCarVO.getCarInfo());
|
||||
// 如果新增了数据,id没有回填
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())){
|
||||
CarMain byLicenseNumber = carMainService.getOne(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber()));
|
||||
customerAndCarVO.getCarInfo().setId(byLicenseNumber.getId());
|
||||
}
|
||||
} else {
|
||||
carMainService.updateCarMain(customerAndCarVO.getCarInfo());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user