预约车功能开发
This commit is contained in:
parent
4a3009366d
commit
3069840dd5
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.bonus.material.book.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.material.book.domain.BookCarDetailDto;
|
||||||
|
import com.bonus.material.book.domain.BookCarInfoDto;
|
||||||
|
import com.bonus.material.book.service.BookCarService;
|
||||||
|
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/11/22 - 16:36
|
||||||
|
*/
|
||||||
|
@Api(value = "预约车", tags = {"预约车"})
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bookCar")
|
||||||
|
public class BookCarController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BookCarService bookCarService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加预约车
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "添加预约车")
|
||||||
|
@PostMapping("/addBookCar")
|
||||||
|
public AjaxResult addBookCar(@RequestBody BookCarInfoDto bookCarInfoDto) {
|
||||||
|
Integer i = bookCarService.addBookCar(bookCarInfoDto);
|
||||||
|
if (i > 0) {
|
||||||
|
return AjaxResult.success("添加成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("添加失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预约车订单详情
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询预约车订单详情")
|
||||||
|
@GetMapping("/getBookCarDetails")
|
||||||
|
public TableDataInfo getBookCarDetails(BookCarInfoDto devInfo) {
|
||||||
|
startPage();
|
||||||
|
List<BookCarDetailDto> list = bookCarService.getBookCarDetails(devInfo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改租期
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改租期")
|
||||||
|
@PostMapping("/updaterentDay")
|
||||||
|
public AjaxResult updaterentDay(@RequestBody BookCarDetailDto bookCarDetailDto) {
|
||||||
|
Integer i = bookCarService.updaterentDay(bookCarDetailDto);
|
||||||
|
if (i > 0) {
|
||||||
|
return AjaxResult.success("修改成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("修改失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.bonus.material.book.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/11/22 - 16:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BookCarDetailDto {
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "预约id")
|
||||||
|
private Integer bookId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备id")
|
||||||
|
private Integer typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁类型")
|
||||||
|
private Integer leaseType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁单价(日租金)")
|
||||||
|
private BigDecimal leasePrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租期")
|
||||||
|
private String rentDay;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "天数")
|
||||||
|
private Integer days;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数量")
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总金额")
|
||||||
|
private BigDecimal costs;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String creater;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型编号")
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格型号")
|
||||||
|
private String modelCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.bonus.material.book.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/11/22 - 16:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BookCarInfoDto {
|
||||||
|
//
|
||||||
|
@ApiModelProperty(value = "订单id")
|
||||||
|
private Integer bookId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String bookCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单日期")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date orderTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单金额")
|
||||||
|
private BigDecimal cost;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "供应商id")
|
||||||
|
private Integer supplier;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单状态 (0:未下单 1:已下单 2:待发货 3:已发货)")
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "下单用户id")
|
||||||
|
private Integer orderUser;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "下单用户手机号")
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "下单企业")
|
||||||
|
private String orderCompany;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String creater;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "修改人")
|
||||||
|
private String updater;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "修改日期")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private List<BookCarDetailDto> detailList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bonus.material.book.mapper;
|
||||||
|
|
||||||
|
import com.bonus.material.book.domain.BookCarDetailDto;
|
||||||
|
import com.bonus.material.book.domain.BookCarInfoDto;
|
||||||
|
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/11/22 - 17:01
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BookCarMapper {
|
||||||
|
Integer addBookCarInfo(BookCarInfoDto bookCarInfoDto);
|
||||||
|
Integer addBookCarDetail(BookCarDetailDto bookCarDetailDto);
|
||||||
|
|
||||||
|
List<BookCarDetailDto> getBookCarDetails(BookCarInfoDto devInfo);
|
||||||
|
|
||||||
|
Integer updaterentDay(BookCarDetailDto bookCarDetailDto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.bonus.material.book.service;
|
||||||
|
|
||||||
|
import com.bonus.material.book.domain.BookCarDetailDto;
|
||||||
|
import com.bonus.material.book.domain.BookCarInfoDto;
|
||||||
|
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/11/22 - 16:53
|
||||||
|
*/
|
||||||
|
public interface BookCarService {
|
||||||
|
Integer addBookCar(BookCarInfoDto bookCarInfoDto);
|
||||||
|
|
||||||
|
List<BookCarDetailDto> getBookCarDetails(BookCarInfoDto devInfo);
|
||||||
|
|
||||||
|
Integer updaterentDay(BookCarDetailDto bookCarDetailDto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.bonus.material.book.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.material.book.domain.BookCarDetailDto;
|
||||||
|
import com.bonus.material.book.domain.BookCarInfoDto;
|
||||||
|
import com.bonus.material.book.mapper.BookCarMapper;
|
||||||
|
import com.bonus.material.book.service.BookCarService;
|
||||||
|
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/11/22 - 16:53
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BookCarServiceImpl implements BookCarService {
|
||||||
|
@Resource
|
||||||
|
private BookCarMapper bookCarMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public Integer addBookCar(BookCarInfoDto bookCarInfoDto) {
|
||||||
|
Long userid = SecurityUtils.getLoginUser().getUserid();
|
||||||
|
bookCarInfoDto.setCreater(userid.toString());
|
||||||
|
Integer i = bookCarMapper.addBookCarInfo(bookCarInfoDto);
|
||||||
|
if (i > 0) {
|
||||||
|
List<BookCarDetailDto> detailList = bookCarInfoDto.getDetailList();
|
||||||
|
for (BookCarDetailDto bookCarDetailDto : detailList) {
|
||||||
|
bookCarDetailDto.setCreater(userid.toString());
|
||||||
|
bookCarMapper.addBookCarDetail(bookCarDetailDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BookCarDetailDto> getBookCarDetails(BookCarInfoDto bookCarInfoDto) {
|
||||||
|
return bookCarMapper.getBookCarDetails(bookCarInfoDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updaterentDay(BookCarDetailDto bookCarDetailDto) {
|
||||||
|
return bookCarMapper.updaterentDay(bookCarDetailDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?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="com.bonus.material.book.mapper.BookCarMapper">
|
||||||
|
|
||||||
|
<insert id="addBookCarInfo">
|
||||||
|
insert into book_car_info(book_code, order_time, cost, supplier, order_status, order_user, phone_number, order_company, creater, create_time)
|
||||||
|
values(#{bookCode},#{orderTime},#{cost},#{supplier},#{orderStatus},#{orderUser},#{phoneNumber},#{orderCompany},#{creater},now())
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="addBookCarDetail">
|
||||||
|
insert into book_car_detail(book_id, type_id, lease_type, lease_price, rent_day, days, num, costs, creater, create_time)
|
||||||
|
values(#{bookId},#{typeId},#{leaseType},#{leasePrice},#{rentDay},#{days},#{num},#{costs},#{creater},now())
|
||||||
|
</insert>
|
||||||
|
<update id="updaterentDay">
|
||||||
|
update book_car_detail set rent_day = #{rentDay} where id = #{id}
|
||||||
|
</update>
|
||||||
|
<select id="getBookCarDetails" resultType="com.bonus.material.book.domain.BookCarDetailDto">
|
||||||
|
SELECT
|
||||||
|
bcd.*,
|
||||||
|
mt.type_code,
|
||||||
|
mt.model_code,
|
||||||
|
mt.type_name
|
||||||
|
FROM
|
||||||
|
book_car_detail bcd
|
||||||
|
LEFT JOIN ma_type mt ON bcd.type_id = mt.type_id
|
||||||
|
WHERE
|
||||||
|
bcd.type_id = #{bookId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue