维修工单-客户、车辆信息新增、修改
This commit is contained in:
parent
44d56da26a
commit
aa35f53cf7
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
||||
import cn.iocoder.yudao.module.label.service.BusiLabelService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -200,4 +201,17 @@ public class CarMainController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车牌查单条记录
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:26 2024/10/8
|
||||
* @param carMain 根据车牌查单条记录
|
||||
**/
|
||||
@PostMapping("/getByLicenseNumber")
|
||||
@Operation(summary = "根据车牌查单条记录")
|
||||
public CommonResult<?> getByLicenseNumber(@RequestBody CarMain carMain) {
|
||||
CarMain one = carMainService.getOne(new LambdaQueryWrapper<CarMain>().eq(CarMain::getLicenseNumber, carMain.getLicenseNumber()));
|
||||
return success(one);
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
||||
import cn.iocoder.yudao.module.label.service.BusiLabelService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -179,5 +180,21 @@ public class CustomerMainController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据姓名和电话查询单条记录
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:19 2024/10/8
|
||||
* @param customerMain 查询对象
|
||||
**/
|
||||
@PostMapping("/getByNameAndMobile")
|
||||
@Operation(summary = "根据姓名和电话查询单条记录")
|
||||
public CommonResult<?> getByNameAndMobile(@Valid @RequestBody CustomerMain customerMain) {
|
||||
CustomerMain one = customerMainService.getOne(new LambdaQueryWrapper<CustomerMain>().and(item -> {
|
||||
item.eq(CustomerMain::getCusName, customerMain.getCusName())
|
||||
.eq(CustomerMain::getPhoneNumber, customerMain.getPhoneNumber());
|
||||
}));
|
||||
return success(one);
|
||||
}
|
||||
|
||||
}
|
@ -199,8 +199,8 @@ public class CompanyStaffController {
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获取当前登录用户部门下所有员工信息")
|
||||
// @PreAuthorize("@ss.hasPermission('company:staff:query')")
|
||||
public CommonResult<List<CompanyStaff>> getStaffList() {
|
||||
return success(staffService.getStaffList());
|
||||
public CommonResult<List<CompanyStaff>> getStaffList(@RequestParam(value = "query", defaultValue = "", required = false) String query) {
|
||||
return success(staffService.getStaffList(query));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ public interface CompanyStaffService extends IService<CompanyStaff> {
|
||||
* @author 小李
|
||||
* @date 15:54 2024/8/8
|
||||
**/
|
||||
List<CompanyStaff> getStaffList();
|
||||
List<CompanyStaff> getStaffList(String query);
|
||||
|
||||
/**
|
||||
* 重置员工登录密码
|
||||
|
@ -399,8 +399,15 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
||||
* @date 15:54 2024/8/8
|
||||
**/
|
||||
@Override
|
||||
public List<CompanyStaff> getStaffList() {
|
||||
return baseMapper.selectList(new QueryWrapper<>());
|
||||
public List<CompanyStaff> getStaffList(String query) {
|
||||
if (ObjectUtil.isNotEmpty(query)){
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<CompanyStaff>()
|
||||
.like(CompanyStaff::getName,query)
|
||||
.or()
|
||||
.like(CompanyStaff::getTel, query)
|
||||
);
|
||||
}
|
||||
return baseMapper.selectList(new QueryWrapper<>()).stream().limit(20).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@ package cn.iocoder.yudao.module.tickets.controller.admin;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -100,5 +101,19 @@ public class DlRepairTicketsController {
|
||||
dlRepairTicketsService.setTicketsPaid(repairTicketsRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户信息和车辆信息 新增、修改
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:25 2024/10/8
|
||||
* @param customerAndCarVO 用户信息和车辆信息
|
||||
**/
|
||||
@PostMapping("/updateUserAndCar")
|
||||
@Operation(summary = "客户信息和车辆信息 新增、修改")
|
||||
public CommonResult<?> updateCustomerAndCar(@RequestBody CustomerAndCarVO customerAndCarVO){
|
||||
dlRepairTicketsService.updateCustomerAndCar(customerAndCarVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.tickets.service;
|
||||
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -59,4 +60,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param repairTicketsRespVO 工单
|
||||
**/
|
||||
void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO);
|
||||
|
||||
/**
|
||||
* 客户信息和车辆信息 新增、修改
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:25 2024/10/8
|
||||
* @param customerAndCarVO 用户信息和车辆信息
|
||||
**/
|
||||
void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO);
|
||||
}
|
||||
|
@ -7,6 +7,9 @@ import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
|
||||
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
|
||||
import cn.iocoder.yudao.module.custom.service.CarMainService;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerCarService;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
@ -21,11 +24,15 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||
import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
|
||||
@ -40,6 +47,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -85,6 +93,22 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@Lazy
|
||||
private DlRepairBookingService bookingService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private CustomerMainService customerService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private CarMainService carMainService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private CustomerCarService customerCarService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
/**
|
||||
* 维修工单表 新增
|
||||
*
|
||||
@ -243,6 +267,64 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO) {
|
||||
baseMapper.updateById(repairTicketsRespVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户信息和车辆信息 新增、修改
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:25 2024/10/8
|
||||
* @param customerAndCarVO 用户信息和车辆信息
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO){
|
||||
// 新增用户信息,如果不存在
|
||||
if (ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo().getPhoneNumber()) && ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo().getCusName())){
|
||||
AdminUserRespDTO userByMobile = adminUserApi.getUserByMobile(customerAndCarVO.getUserInfo().getPhoneNumber());
|
||||
if (ObjectUtil.isEmpty(userByMobile)){
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setMobile(customerAndCarVO.getUserInfo().getPhoneNumber());
|
||||
userDTO.setNickname(customerAndCarVO.getUserInfo().getCusName());
|
||||
userDTO.setUsername(customerAndCarVO.getUserInfo().getPhoneNumber());
|
||||
userDTO.setPassword("123456");
|
||||
adminUserApi.createUser(userDTO);
|
||||
customerAndCarVO.getUserInfo().setUserId(userDTO.getId());
|
||||
}
|
||||
}
|
||||
// 客户信息
|
||||
if (ObjectUtil.isNotEmpty(customerAndCarVO.getUserInfo())){
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())){
|
||||
customerService.save(customerAndCarVO.getUserInfo());
|
||||
}else {
|
||||
customerService.updateById(customerAndCarVO.getUserInfo());
|
||||
}
|
||||
}
|
||||
// 新增车辆信息
|
||||
if (ObjectUtil.isNotEmpty(customerAndCarVO.getCarInfo())){
|
||||
if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())){
|
||||
carMainService.createCarMain(customerAndCarVO.getCarInfo());
|
||||
}else {
|
||||
carMainService.updateCarMain(customerAndCarVO.getCarInfo());
|
||||
}
|
||||
}
|
||||
// 新增客户车辆信息关联
|
||||
String userId = customerAndCarVO.getUserInfo().getId();
|
||||
String carId = customerAndCarVO.getCarInfo().getId();
|
||||
if (ObjectUtil.isNotEmpty(userId) && ObjectUtil.isNotEmpty(carId)){
|
||||
// 先查询有没有记录
|
||||
CustomerCar one = customerCarService.getOne(new LambdaQueryWrapper<CustomerCar>().and(item -> {
|
||||
item.eq(CustomerCar::getCusId, userId)
|
||||
.eq(CustomerCar::getCarId, carId);
|
||||
}));
|
||||
// 没有就新增
|
||||
if (ObjectUtil.isEmpty(one)){
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setCusId(userId);
|
||||
customerCar.setCarId(carId);
|
||||
customerCarService.saveOrUpdate(customerCar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.tickets.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用于新增、修改客户信息和车辆信息
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:22 2024/10/8
|
||||
**/
|
||||
@Data
|
||||
public class CustomerAndCarVO extends TenantBaseDO {
|
||||
|
||||
/** 用户信息 */
|
||||
private CustomerMain userInfo;
|
||||
|
||||
/** 车辆信息 */
|
||||
private CarMainReqVO carInfo;
|
||||
}
|
@ -46,7 +46,7 @@ spring:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://122.51.230.86:3306/lanan_platform?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
url: jdbc:mysql://122.51.230.86:3306/lanan_platform_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
@ -54,8 +54,8 @@ spring:
|
||||
# url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
|
||||
username: lanan
|
||||
password: 123456
|
||||
username: lanan_dev
|
||||
password: lighting@2024
|
||||
# username: sa # SQL Server 连接的示例
|
||||
# password: Yudao@2024 # SQL Server 连接的示例
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
|
Loading…
Reference in New Issue
Block a user