订单详情等相关,手动还车结束订单
This commit is contained in:
@ -44,8 +44,8 @@ public class ZcRentCarRule extends BaseEntity
|
||||
@Excel(name = "押金价格(元)")
|
||||
private BigDecimal depositPrice;
|
||||
|
||||
/** 逾期金额(元) */
|
||||
@Excel(name = "逾期金额(元)")
|
||||
/** 逾期价格(元) */
|
||||
@Excel(name = "逾期价格(元)")
|
||||
private BigDecimal overdueFee;
|
||||
|
||||
/** 逾期计费类型 */
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.operation.util;
|
||||
|
||||
public enum CarStatusEnum {
|
||||
|
||||
CAR_STATUS_0("0", "正常"),
|
||||
CAR_STATUS_1("1", "下架"),
|
||||
CAR_STATUS_9("9", "租赁中");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
CarStatusEnum(String code, String info) {
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
@ -117,6 +117,8 @@ public class ZcOrderMainController extends BaseController
|
||||
{
|
||||
ZcOrderMain zcOrderMain = zcOrderMainService.selectZcOrderMainByOrderId(orderId);
|
||||
mmap.put("zcOrderMain", zcOrderMain);
|
||||
ZcOrderMain zcOrderMainImg = zcOrderMainService.selectZcOrderMainImgByOrderId(orderId);
|
||||
mmap.put("zcOrderMainImg", zcOrderMainImg);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
@ -150,13 +152,7 @@ public class ZcOrderMainController extends BaseController
|
||||
@ResponseBody
|
||||
public AjaxResult manualEndOrder(Long orderId)
|
||||
{
|
||||
ZcOrderMain zcOrderMain =new ZcOrderMain();
|
||||
zcOrderMain.setOrderId(orderId);
|
||||
zcOrderMain.setOrderStatus(OrderStatusEnum.MANUAL_END.getCode());
|
||||
zcOrderMain.setUpdateBy(getLoginName());
|
||||
zcOrderMain.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
return toAjax(zcOrderMainService.updateManualEndOrder(zcOrderMain));
|
||||
return toAjax(zcOrderMainService.updateManualEndOrder(orderId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
package com.ruoyi.orders.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 订单租车车辆图片信息对象 zc_order_car_img
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
public class ZcOrderCarImg extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
private Long id;
|
||||
|
||||
/** 订单ID(外键) */
|
||||
@Excel(name = "订单ID", readConverterExp = "外=键")
|
||||
private Long orderId;
|
||||
|
||||
/** 订单编号 */
|
||||
@Excel(name = "订单编号")
|
||||
private String orderNo;
|
||||
|
||||
/** 图片类型:RENT租车,RETURN还车 */
|
||||
@Excel(name = "图片类型:RENT租车,RETURN还车")
|
||||
private String imgType;
|
||||
|
||||
/** 图片地址 */
|
||||
@Excel(name = "图片地址")
|
||||
private String imgUrl;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setOrderId(Long orderId)
|
||||
{
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public Long getOrderId()
|
||||
{
|
||||
return orderId;
|
||||
}
|
||||
public void setOrderNo(String orderNo)
|
||||
{
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public String getOrderNo()
|
||||
{
|
||||
return orderNo;
|
||||
}
|
||||
public void setImgType(String imgType)
|
||||
{
|
||||
this.imgType = imgType;
|
||||
}
|
||||
|
||||
public String getImgType()
|
||||
{
|
||||
return imgType;
|
||||
}
|
||||
public void setImgUrl(String imgUrl)
|
||||
{
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public String getImgUrl()
|
||||
{
|
||||
return imgUrl;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("orderId", getOrderId())
|
||||
.append("orderNo", getOrderNo())
|
||||
.append("imgType", getImgType())
|
||||
.append("imgUrl", getImgUrl())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -86,8 +86,8 @@ public class ZcOrderMain extends BaseEntity
|
||||
@Excel(name = "押金价格(元)")
|
||||
private BigDecimal depositPrice;
|
||||
|
||||
/** 逾期金额(元) */
|
||||
@Excel(name = "逾期金额(元)")
|
||||
/** 逾期价格(元) */
|
||||
@Excel(name = "逾期价格(元)")
|
||||
private BigDecimal overdueFee;
|
||||
|
||||
@Excel(name = "逾期计费类型")
|
||||
@ -158,6 +158,8 @@ public class ZcOrderMain extends BaseEntity
|
||||
@Excel(name = "订单结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endOrderTime;
|
||||
|
||||
/** 订单逾期金额 */
|
||||
private BigDecimal overdueAmount;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
@ -165,6 +167,9 @@ public class ZcOrderMain extends BaseEntity
|
||||
/** 租车子订单信息 */
|
||||
private List<ZcOrderSub> zcOrderSubList;
|
||||
|
||||
/** 订单租车车辆图片信息信息 */
|
||||
private List<ZcOrderCarImg> zcOrderCarImgList;
|
||||
|
||||
public void setOrderId(Long orderId)
|
||||
{
|
||||
this.orderId = orderId;
|
||||
@ -480,6 +485,14 @@ public class ZcOrderMain extends BaseEntity
|
||||
this.endOrderTime = endOrderTime;
|
||||
}
|
||||
|
||||
public BigDecimal getOverdueAmount() {
|
||||
return overdueAmount;
|
||||
}
|
||||
|
||||
public void setOverdueAmount(BigDecimal overdueAmount) {
|
||||
this.overdueAmount = overdueAmount;
|
||||
}
|
||||
|
||||
public String getOverdueType() {
|
||||
return overdueType;
|
||||
}
|
||||
@ -504,6 +517,14 @@ public class ZcOrderMain extends BaseEntity
|
||||
this.damageDesc = damageDesc;
|
||||
}
|
||||
|
||||
public List<ZcOrderCarImg> getZcOrderCarImgList() {
|
||||
return zcOrderCarImgList;
|
||||
}
|
||||
|
||||
public void setZcOrderCarImgList(List<ZcOrderCarImg> zcOrderCarImgList) {
|
||||
this.zcOrderCarImgList = zcOrderCarImgList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
|
||||
@ -19,6 +19,13 @@ public interface ZcOrderMainMapper
|
||||
* @return 租车订单
|
||||
*/
|
||||
public ZcOrderMain selectZcOrderMainByOrderId(Long orderId);
|
||||
/**
|
||||
* 查询租车订单图片
|
||||
*
|
||||
* @param orderId 租车订单主键
|
||||
* @return 租车订单
|
||||
*/
|
||||
public ZcOrderMain selectZcOrderMainImgByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 查询租车订单列表
|
||||
|
||||
@ -19,6 +19,8 @@ public interface IZcOrderMainService
|
||||
*/
|
||||
public ZcOrderMain selectZcOrderMainByOrderId(Long orderId);
|
||||
|
||||
public ZcOrderMain selectZcOrderMainImgByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 查询租车订单列表
|
||||
*
|
||||
@ -59,6 +61,6 @@ public interface IZcOrderMainService
|
||||
*/
|
||||
public int deleteZcOrderMainByOrderId(Long orderId);
|
||||
|
||||
public int updateManualEndOrder(ZcOrderMain zcOrderMain);
|
||||
public int updateManualEndOrder(Long orderId);
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
package com.ruoyi.orders.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.operation.domain.ZcCar;
|
||||
import com.ruoyi.operation.service.IZcCarService;
|
||||
import com.ruoyi.operation.util.CarStatusEnum;
|
||||
import com.ruoyi.orders.util.OrderStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
@ -25,6 +31,8 @@ public class ZcOrderMainServiceImpl implements IZcOrderMainService
|
||||
@Autowired
|
||||
private ZcOrderMainMapper zcOrderMainMapper;
|
||||
|
||||
@Autowired
|
||||
private IZcCarService zcCarService;
|
||||
/**
|
||||
* 查询租车订单
|
||||
*
|
||||
@ -37,6 +45,12 @@ public class ZcOrderMainServiceImpl implements IZcOrderMainService
|
||||
return zcOrderMainMapper.selectZcOrderMainByOrderId(orderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZcOrderMain selectZcOrderMainImgByOrderId(Long orderId)
|
||||
{
|
||||
return zcOrderMainMapper.selectZcOrderMainImgByOrderId(orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租车订单列表
|
||||
*
|
||||
@ -110,9 +124,31 @@ public class ZcOrderMainServiceImpl implements IZcOrderMainService
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateManualEndOrder(ZcOrderMain zcOrderMain) {
|
||||
public int updateManualEndOrder(Long orderId) {
|
||||
//订单手动结束逻辑待完善
|
||||
return zcOrderMainMapper.updateZcOrderMain(zcOrderMain);
|
||||
//1、修改订单状态,2计算逾期费用(如果有逾期),3、释放车辆状态
|
||||
//1、修改订单状态
|
||||
ZcOrderMain zcOrderMain =new ZcOrderMain();
|
||||
zcOrderMain.setOrderId(orderId);
|
||||
zcOrderMain.setOrderStatus(OrderStatusEnum.MANUAL_END.getCode());
|
||||
zcOrderMain.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
|
||||
zcOrderMain.setUpdateTime(DateUtils.getNowDate());
|
||||
// 2计算逾期费用
|
||||
long overdueDays = DateUtils.daysBetween(DateUtils.getNowDate(),zcOrderMain.getEndRentTime());
|
||||
if(overdueDays > 0) {
|
||||
zcOrderMain.setOverdueDays(overdueDays);
|
||||
zcOrderMain.setOverdueAmount(zcOrderMain.getOverdueFee().multiply(new BigDecimal(zcOrderMain.getOverdueDays())));
|
||||
}
|
||||
zcOrderMain.setEndOrderTime(DateUtils.getNowDate());
|
||||
int flag = zcOrderMainMapper.updateZcOrderMain(zcOrderMain);
|
||||
if(flag > 0){
|
||||
//3释放车辆状态
|
||||
ZcCar zcCar = new ZcCar();
|
||||
zcCar.setId(zcOrderMain.getVehicleId());
|
||||
zcCar.setStatus(CarStatusEnum.CAR_STATUS_0.getCode());
|
||||
zcCarService.updateZcCar(zcCar);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user