更新代码

This commit is contained in:
xiao-fajia 2024-09-23 12:53:32 +08:00
parent 72e1635082
commit dcf545c3d4
14 changed files with 645 additions and 1 deletions

View File

@ -0,0 +1,91 @@
package cn.iocoder.yudao.module.app.booking.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 维修预约表(DlRepairBooking)表API控制层
*
* @author 小李
* @date 11:04 2024/9/23
**/
@RestController
@RequestMapping("/api/repair/booking")
public class BookingAPI {
/**
* 服务对象
*/
@Resource
private DlRepairBookingService dlRepairBookingService;
/**
* 维修预约表 新增修改
*
* @author 小李
* @date 10:21 2024/9/23
* @param repairBookingRespVO 预约对象
**/
@PostMapping("/update")
@Operation(summary = "维修预约表 新增、修改")
public CommonResult<?> updateBooking(@RequestBody DlRepairBookingRespVO repairBookingRespVO) {
dlRepairBookingService.updateBooking(repairBookingRespVO);
return CommonResult.ok();
}
/**
* 维修预约表 删除
*
* @author 小李
* @date 10:26 2024/9/23
* @param id 预约记录id
**/
@DeleteMapping("/delete")
@Operation(summary = "维修预约表 删除")
public CommonResult<?> deleteBooking(@RequestParam("id") String id) {
dlRepairBookingService.deleteBooking(id);
return CommonResult.ok();
}
/**
* 维修预约表 分页
*
* @author 小李
* @date 10:31 2024/9/23
* @param repairBookingReqVO 请求对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/page")
@Operation(summary = "维修预约表 分页")
public CommonResult<?> getBookingPage(DlRepairBookingReqVO repairBookingReqVO,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
Page<DlRepairBooking> page = new Page<>(pageNo, pageSize);
return success(dlRepairBookingService.getBookingPage(repairBookingReqVO, page));
}
/**
* 维修预约表 查询单个
*
* @author 小李
* @date 10:38 2024/9/23
* @param id 预约记录id
**/
@GetMapping("/get")
@Operation(summary = "维修预约表 查询单个")
public CommonResult<?> getBookingById(@RequestParam("id") String id){
return success(dlRepairBookingService.getBookingById(id));
}
}

View File

@ -0,0 +1,75 @@
package cn.iocoder.yudao.module.app.tickets.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.DlRepairTicketsReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 维修工单表(DlRepairTickets)表控制层
* @author 小李
* @date 18:21 2024/9/13
**/
@RestController
@RequestMapping("/api/repair/tickets")
public class TicketsAPI {
/**
* 服务对象
*/
@Resource
private DlRepairTicketsService dlRepairTicketsService;
/**
* 维修工单表 评价
*
* @author 小李
* @date 10:54 2024/9/23
* @param repairTicketsRespVO 对象
**/
@PostMapping("/appraise")
@Operation(summary = "维修工单表 评价")
public CommonResult<?> setAppraise(@RequestBody DlRepairTicketsRespVO repairTicketsRespVO){
dlRepairTicketsService.setAppraise(repairTicketsRespVO);
return CommonResult.ok();
}
/**
* 维修工单表 按用户的id查
*
* @author 小李
* @date 11:37 2024/9/23
* @param repairTicketsReqVO 查询对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/page")
@Operation(summary = "维修工单表 按用户的id查")
public CommonResult<?> getTicketsPageById(DlRepairTicketsReqVO repairTicketsReqVO,
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
return success(dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page));
}
/**
* 维修工单表 查看一个工单的详细信息
*
* @author 小李
* @date 11:44 2024/9/23
* @param id 工单ID
**/
@GetMapping("/get")
@Operation(summary = "维修工单表 查看一个工单的详细信息")
public CommonResult<?> getTicketsById(@RequestParam(value = "id") String id){
return success(dlRepairTicketsService.getTicketsById(id));
}
}

View File

@ -0,0 +1,91 @@
package cn.iocoder.yudao.module.booking.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 维修预约表(DlRepairBooking)表控制层
*
* @author 小李
* @date 10:19 2024/9/23
**/
@RestController
@RequestMapping("/repair/booking")
public class DlRepairBookingController {
/**
* 服务对象
*/
@Resource
private DlRepairBookingService dlRepairBookingService;
/**
* 维修预约表 新增修改
*
* @author 小李
* @date 10:21 2024/9/23
* @param repairBookingRespVO 预约对象
**/
@PostMapping("/update")
@Operation(summary = "维修预约表 新增、修改")
public CommonResult<?> updateBooking(@RequestBody DlRepairBookingRespVO repairBookingRespVO) {
dlRepairBookingService.updateBooking(repairBookingRespVO);
return CommonResult.ok();
}
/**
* 维修预约表 删除
*
* @author 小李
* @date 10:26 2024/9/23
* @param id 预约记录id
**/
@DeleteMapping("/delete")
@Operation(summary = "维修预约表 删除")
public CommonResult<?> deleteBooking(@RequestParam("id") String id) {
dlRepairBookingService.deleteBooking(id);
return CommonResult.ok();
}
/**
* 维修预约表 分页
*
* @author 小李
* @date 10:31 2024/9/23
* @param repairBookingReqVO 请求对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/page")
@Operation(summary = "维修预约表 分页")
public CommonResult<?> getBookingPage(DlRepairBookingReqVO repairBookingReqVO,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
Page<DlRepairBooking> page = new Page<>(pageNo, pageSize);
return success(dlRepairBookingService.getBookingPage(repairBookingReqVO, page));
}
/**
* 维修预约表 查询单个
*
* @author 小李
* @date 10:38 2024/9/23
* @param id 预约记录id
**/
@GetMapping("/get")
@Operation(summary = "维修预约表 查询单个")
public CommonResult<?> getBookingById(@RequestParam("id") String id){
return success(dlRepairBookingService.getBookingById(id));
}
}

View File

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.booking.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 维修预约表
*
* @author 小李
* @date 10:13 2024/9/23
**/
@TableName(value = "dl_repair_booking")
@Data
@EqualsAndHashCode(callSuper = true)
public class DlRepairBooking extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
* 用户ID(system_users的id)
*/
private Long userId;
/**
* 用户姓名
*/
private String userName;
/**
* 用户手机号
*/
private String userMobile;
/**
* 项目ID(查PC服务分类的一级项目的ID)
*/
private String projectId;
/**
* 车辆信息(base_car_main的id)
*/
private String carId;
/**
* 车牌号
*/
private String carNo;
/** 工单ID */
private String ticketsId;
/**
* 预约时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date bookingTime;
/**
* 门店ID(base_company表的ID)
*/
private String corpId;
/**
* 部门ID
*/
private Long deptId;
/** 预约记录状态 */
private String bookingStatus;
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.booking.mapper;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;
/**
* 针对表dl_repair_booking(维修预约表)的数据库操作Mapper
*
* @author 小李
* @date 10:16 2024/9/23
**/
@Mapper
public interface DlRepairBookingMapper extends BaseMapper<DlRepairBooking> {
/**
* 维修预约表 分页
*
* @author 小李
* @date 10:31 2024/9/23
* @param repairBookingReqVO 请求对象
**/
IPage<DlRepairBooking> getBookingPage(@Param("map") DlRepairBookingReqVO repairBookingReqVO, Page<DlRepairBooking> page);
}

View File

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.booking.service;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 针对表dl_repair_booking(维修预约表)的数据库操作Service
*
* @author 小李
* @date 10:18 2024/9/23
**/
public interface DlRepairBookingService extends IService<DlRepairBooking> {
/**
* 维修预约表 新增修改
*
* @author 小李
* @date 10:21 2024/9/23
* @param repairBookingRespVO 预约对象
**/
void updateBooking(DlRepairBookingRespVO repairBookingRespVO);
/**
* 维修预约表 删除
*
* @author 小李
* @date 10:26 2024/9/23
* @param id 预约记录id
**/
void deleteBooking(String id);
/**
* 维修预约表 分页
*
* @author 小李
* @date 10:31 2024/9/23
* @param repairBookingReqVO 请求对象
**/
IPage<DlRepairBooking> getBookingPage(DlRepairBookingReqVO repairBookingReqVO, Page<DlRepairBooking> page);
/**
* 维修预约表 查询单个
*
* @author 小李
* @date 10:38 2024/9/23
* @param id id
**/
DlRepairBooking getBookingById(String id);
}

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.booking.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.mapper.DlRepairBookingMapper;
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/**
* 针对表dl_repair_booking(维修预约表)的数据库操作Service实现
*
* @author 小李
* @date 10:19 2024/9/23
**/
@Service
public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMapper, DlRepairBooking>
implements DlRepairBookingService {
/**
* 维修预约表 新增修改
*
* @author 小李
* @date 10:21 2024/9/23
* @param repairBookingRespVO 预约对象
**/
@Override
public void updateBooking(DlRepairBookingRespVO repairBookingRespVO){
baseMapper.insertOrUpdate(repairBookingRespVO);
}
/**
* 维修预约表 删除
*
* @author 小李
* @date 10:26 2024/9/23
* @param id 预约记录id
**/
@Override
public void deleteBooking(String id){
baseMapper.deleteById(id);
}
/**
* 维修预约表 分页
*
* @author 小李
* @date 10:31 2024/9/23
* @param repairBookingReqVO 请求对象
**/
@Override
public IPage<DlRepairBooking> getBookingPage(DlRepairBookingReqVO repairBookingReqVO, Page<DlRepairBooking> page){
return baseMapper.getBookingPage(repairBookingReqVO, page);
}
/**
* 维修预约表 查询单个
*
* @author 小李
* @date 10:38 2024/9/23
* @param id id
**/
@Override
public DlRepairBooking getBookingById(String id){
return baseMapper.selectById(id);
}
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.booking.vo;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 维修预约表 请求VO
*
* @author 小李
* @date 10:15 2024/9/23
**/
@Data
public class DlRepairBookingReqVO extends DlRepairBooking {
/** 时间区间 */
@Schema(pattern = "时间区间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] searchTimeArray;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.booking.vo;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import lombok.Data;
/**
* 维修预约表 响应VO
*
* @author 小李
* @date 10:15 2024/9/23
**/
@Data
public class DlRepairBookingRespVO extends DlRepairBooking {
}

View File

@ -175,4 +175,13 @@ public class DlRepairTickets extends TenantBaseDO {
/** 工单进行状态 */
private String ticketsWorkStatus;
/** 评价 */
private String appraise;
/** 是否已评价 */
private String isAppraise;
/** 评分 */
private Integer appraiseScope;
}

View File

@ -59,4 +59,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @param repairTicketsRespVO 工单
**/
void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO);
/**
* 维修工单表 评价
*
* @author 小李
* @date 10:54 2024/9/23
* @param repairTicketsRespVO 对象
**/
void setAppraise(DlRepairTicketsRespVO repairTicketsRespVO);
}

View File

@ -182,6 +182,27 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
public void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO){
baseMapper.updateById(repairTicketsRespVO);
}
/**
* 维修工单表 评价
*
* @author 小李
* @date 10:54 2024/9/23
* @param repairTicketsRespVO 对象
**/
@Override
public void setAppraise(DlRepairTicketsRespVO repairTicketsRespVO){
// 如果用户什么评价也没输入给个默认评价
if (ObjectUtil.isEmpty(repairTicketsRespVO.getAppraise())){
repairTicketsRespVO.setIsAppraise("未输入评价内容");
}
// 如果用户没选择评分给个默认评分理论讲前端直接给以防万一
if (ObjectUtil.isEmpty(repairTicketsRespVO.getAppraiseScope())){
repairTicketsRespVO.setAppraiseScope(5);
}
repairTicketsRespVO.setIsAppraise("1");
baseMapper.updateById(repairTicketsRespVO);
}
}

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.booking.mapper.DlRepairBookingMapper">
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.booking.entity.DlRepairBooking">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="userMobile" column="user_mobile" jdbcType="VARCHAR"/>
<result property="projectId" column="project_id" jdbcType="VARCHAR"/>
<result property="carId" column="car_id" jdbcType="VARCHAR"/>
<result property="carNo" column="car_no" jdbcType="VARCHAR"/>
<result property="ticketsId" column="tickets_id" jdbcType="VARCHAR"/>
<result property="bookingStatus" column="booking_status" jdbcType="VARCHAR"/>
<result property="bookingTime" column="booking_time" jdbcType="TIMESTAMP"/>
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_SQL">
select id,
user_id,
user_name,
user_mobile,
project_id,
car_id,
car_no,
booking_time,
corp_id,
dept_id,
tickets_id,
booking_status
from dl_repair_booking drb
where drb.deleted = '0'
</sql>
<select id="getBookingPage" resultMap="BaseResultMap">
<include refid="Base_SQL" />
<if test="map.userId != null and map.userId != ''">
and drb.user_id = #{map.userId}
</if>
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
and (drb.booking_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
</if>
<if test="map.carNo != null and map.carNo != ''">
and drp.car_no = #{map.carNo}
</if>
order by drp_create_time desc
</select>
</mapper>

View File

@ -42,6 +42,8 @@
<result property="profit" column="profit" />
<result property="partStatus" column="part_status" />
<result property="ticketsWorkStatus" column="tickets_work_status" />
<result property="appraise" column="appraise" />
<result property="appraiseScope" column="appraise_scope" />
</resultMap>
<sql id="Base_SQL">
@ -81,7 +83,9 @@
cost,
profit,
part_status,
tickets_work_status
tickets_work_status,
appraise,
appraise_scope
from dl_repair_tickets drt
where drt.deleted = '0'
</sql>
@ -116,6 +120,15 @@
<if test="map.corpId != null and map.corpId != ''">
and drt.corp_id = #{map.corpId}
</if>
<if test="map.userId != null and map.userId != ''">
and drt.user_id = #{map.userId}
</if>
<if test="map.isAppraise != null and map.isAppraise != ''">
and drt.is_appraise = #{map.isAppraise}
</if>
<if test="map.ticketsWorkStatus != null and map.ticketsWorkStatus != ''">
and drt.tickets_work_status = #{map.ticketsWorkStatus}
</if>
order by drt.create_time desc
</select>
</mapper>