手动结束订单;车辆报损审核
This commit is contained in:
@ -2,12 +2,15 @@ package com.ruoyi.operation.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.operation.domain.ZcCar;
|
||||
import com.ruoyi.operation.service.IZcCarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.operation.mapper.ZcCarDamageMapper;
|
||||
import com.ruoyi.operation.domain.ZcCarDamage;
|
||||
import com.ruoyi.operation.service.IZcCarDamageService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 车辆报损记录Service业务层处理
|
||||
@ -20,7 +23,8 @@ public class ZcCarDamageServiceImpl implements IZcCarDamageService
|
||||
{
|
||||
@Autowired
|
||||
private ZcCarDamageMapper zcCarDamageMapper;
|
||||
|
||||
@Autowired
|
||||
private IZcCarService zcCarService;
|
||||
/**
|
||||
* 查询车辆报损记录
|
||||
*
|
||||
@ -64,11 +68,21 @@ public class ZcCarDamageServiceImpl implements IZcCarDamageService
|
||||
* @param zcCarDamage 车辆报损记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateZcCarDamage(ZcCarDamage zcCarDamage)
|
||||
{
|
||||
zcCarDamage.setUpdateTime(DateUtils.getNowDate());
|
||||
return zcCarDamageMapper.updateZcCarDamage(zcCarDamage);
|
||||
zcCarDamage.setAuditTime(DateUtils.getNowDate());
|
||||
int flag = zcCarDamageMapper.updateZcCarDamage(zcCarDamage);
|
||||
if (flag > 0 && "1".equals(zcCarDamage.getDamageStatus().toString()) ) {
|
||||
// 车辆报损记录审核通过,车辆状态改为下架
|
||||
ZcCar zcCar = new ZcCar();
|
||||
zcCar.setId(zcCarDamage.getCarId());
|
||||
zcCar.setStatus("1");
|
||||
zcCarService.changeStatus(zcCar);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -53,6 +53,8 @@ public class ZcOrderSub extends BaseEntity
|
||||
@Excel(name = "支付ID")
|
||||
private String paymentId;
|
||||
|
||||
private String refundId;
|
||||
|
||||
/** 实际支付时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "实际支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ -155,7 +157,15 @@ public class ZcOrderSub extends BaseEntity
|
||||
this.paidAt = paidAt;
|
||||
}
|
||||
|
||||
public Date getPaidAt()
|
||||
public String getRefundId() {
|
||||
return refundId;
|
||||
}
|
||||
|
||||
public void setRefundId(String refundId) {
|
||||
this.refundId = refundId;
|
||||
}
|
||||
|
||||
public Date getPaidAt()
|
||||
{
|
||||
return paidAt;
|
||||
}
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
package com.ruoyi.orders.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 退款请求数据传输对象
|
||||
*/
|
||||
public class RefundRequest {
|
||||
private Long companyId; // 公司ID
|
||||
private String outTradeNo; // 商户订单号
|
||||
private String outRefundNo; // 商户退款单号
|
||||
private BigDecimal totalFee; // 订单金额(分)
|
||||
private BigDecimal refundFee; // 退款金额(分)
|
||||
private String refundDesc; // 退款原因
|
||||
|
||||
// 构造函数
|
||||
public RefundRequest() {}
|
||||
|
||||
// getter和setter方法
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public String getOutRefundNo() {
|
||||
return outRefundNo;
|
||||
}
|
||||
|
||||
public void setOutRefundNo(String outRefundNo) {
|
||||
this.outRefundNo = outRefundNo;
|
||||
}
|
||||
|
||||
public BigDecimal getRefundFee() {
|
||||
return refundFee;
|
||||
}
|
||||
|
||||
public void setRefundFee(BigDecimal refundFee) {
|
||||
this.refundFee = refundFee;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalFee() {
|
||||
return totalFee;
|
||||
}
|
||||
|
||||
public void setTotalFee(BigDecimal totalFee) {
|
||||
this.totalFee = totalFee;
|
||||
}
|
||||
|
||||
public String getRefundDesc() {
|
||||
return refundDesc;
|
||||
}
|
||||
|
||||
public void setRefundDesc(String refundDesc) {
|
||||
this.refundDesc = refundDesc;
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ public interface ZcOrderSubMapper
|
||||
*/
|
||||
public ZcOrderSub selectZcOrderSubBySuborderId(Long suborderId);
|
||||
|
||||
public ZcOrderSub selectZcOrderSub(ZcOrderSub zcOrderSub);
|
||||
/**
|
||||
* 查询租车子订单列表
|
||||
*
|
||||
|
||||
@ -19,6 +19,13 @@ public interface IZcOrderSubService
|
||||
*/
|
||||
public ZcOrderSub selectZcOrderSubBySuborderId(Long suborderId);
|
||||
|
||||
/**
|
||||
* 查询租车订单
|
||||
*
|
||||
* @param zcOrderSub
|
||||
* @return 租车子订单
|
||||
*/
|
||||
public ZcOrderSub selectZcOrderSub(ZcOrderSub zcOrderSub);
|
||||
/**
|
||||
* 查询租车子订单列表
|
||||
*
|
||||
|
||||
@ -1,16 +1,34 @@
|
||||
package com.ruoyi.orders.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
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.dto.RefundRequest;
|
||||
import com.ruoyi.orders.service.IZcOrderSubService;
|
||||
import com.ruoyi.orders.util.OrderStatusEnum;
|
||||
import com.ruoyi.orders.util.OrderUtil;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.orders.domain.ZcOrderSub;
|
||||
@ -28,11 +46,20 @@ import com.ruoyi.common.core.text.Convert;
|
||||
@Service
|
||||
public class ZcOrderMainServiceImpl implements IZcOrderMainService
|
||||
{
|
||||
@Autowired
|
||||
private ZcOrderMainMapper zcOrderMainMapper;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZcOrderMainServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ZcOrderMainMapper zcOrderMainMapper;
|
||||
@Autowired
|
||||
private IZcOrderSubService zcOrderSubService;
|
||||
@Autowired
|
||||
private IZcCarService zcCarService;
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Value(value = "${pay.refundUrl}")
|
||||
private String refundUrl;
|
||||
|
||||
/**
|
||||
* 查询租车订单
|
||||
*
|
||||
@ -125,31 +152,178 @@ public class ZcOrderMainServiceImpl implements IZcOrderMainService
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateManualEndOrder(Long orderId) {
|
||||
ZcOrderMain queryOrder = zcOrderMainMapper.selectZcOrderMainByOrderId(orderId);
|
||||
//订单手动结束逻辑待完善
|
||||
//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(),queryOrder.getEndRentTime());
|
||||
if(overdueDays > 0) {
|
||||
zcOrderMain.setOverdueDays(overdueDays);
|
||||
zcOrderMain.setOverdueAmount(zcOrderMain.getOverdueFee().multiply(new BigDecimal(zcOrderMain.getOverdueDays())));
|
||||
// 1. 参数校验
|
||||
if (orderId == null) {
|
||||
logger.warn("订单ID不能为空");
|
||||
return 0;
|
||||
}
|
||||
zcOrderMain.setEndOrderTime(DateUtils.getNowDate());
|
||||
int flag = zcOrderMainMapper.updateZcOrderMain(zcOrderMain);
|
||||
if(flag > 0){
|
||||
//3释放车辆状态
|
||||
|
||||
// 2. 查询原订单信息
|
||||
ZcOrderMain queryOrder = zcOrderMainMapper.selectZcOrderMainByOrderId(orderId);
|
||||
if (queryOrder == null) {
|
||||
logger.warn("未找到订单ID为 {} 的订单", orderId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
// 3. 先处理押金退款
|
||||
boolean refundSuccess = processDepositRefund(orderId, queryOrder);
|
||||
if (!refundSuccess) {
|
||||
logger.error("退款处理失败,订单ID: {}", orderId);
|
||||
throw new RuntimeException("退款处理失败");
|
||||
}
|
||||
|
||||
// 4. 退款成功后,更新订单状态
|
||||
ZcOrderMain zcOrderMain = new ZcOrderMain();
|
||||
zcOrderMain.setOrderId(orderId);
|
||||
zcOrderMain.setOrderStatus(OrderStatusEnum.MANUAL_END.getCode());
|
||||
zcOrderMain.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
|
||||
zcOrderMain.setUpdateTime(DateUtils.getNowDate());
|
||||
zcOrderMain.setEndOrderTime(DateUtils.getNowDate());
|
||||
|
||||
// 5. 计算逾期费用
|
||||
long overdueDays = DateUtils.daysBetween(queryOrder.getEndRentTime(), DateUtils.getNowDate());
|
||||
if (overdueDays > 0) {
|
||||
zcOrderMain.setOverdueDays(overdueDays);
|
||||
zcOrderMain.setOverdueAmount(queryOrder.getOverdueFee().multiply(new BigDecimal(overdueDays)));
|
||||
} else {
|
||||
zcOrderMain.setOverdueDays(0L);
|
||||
zcOrderMain.setOverdueAmount(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
// 6. 更新订单状态
|
||||
int flag = zcOrderMainMapper.updateZcOrderMain(zcOrderMain);
|
||||
if (flag <= 0) {
|
||||
logger.error("更新订单状态失败,订单ID: {}", orderId);
|
||||
throw new RuntimeException("更新订单状态失败");
|
||||
}
|
||||
|
||||
// 7. 释放车辆状态
|
||||
ZcCar zcCar = new ZcCar();
|
||||
zcCar.setId(zcOrderMain.getVehicleId());
|
||||
zcCar.setId(queryOrder.getVehicleId());
|
||||
zcCar.setStatus(CarStatusEnum.CAR_STATUS_0.getCode());
|
||||
zcCarService.updateZcCar(zcCar);
|
||||
|
||||
logger.info("手动结束订单处理完成,订单ID: {}", orderId);
|
||||
return flag;
|
||||
} catch (Exception e) {
|
||||
logger.error("手动结束订单处理异常,订单ID: " + orderId, e);
|
||||
throw new RuntimeException("手动结束订单处理失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理押金退款
|
||||
* @param orderId 订单ID
|
||||
* @param queryOrder 原订单信息
|
||||
* @return 退款是否成功
|
||||
*/
|
||||
private boolean processDepositRefund(Long orderId, ZcOrderMain queryOrder) {
|
||||
// 查询押金子订单
|
||||
ZcOrderSub depositSub = new ZcOrderSub();
|
||||
depositSub.setOrderId(orderId);
|
||||
depositSub.setSuborderType(OrderUtil.DEPOSIT);
|
||||
ZcOrderSub querySub = zcOrderSubService.selectZcOrderSub(depositSub);
|
||||
|
||||
if (querySub != null) {
|
||||
// 创建退款子订单
|
||||
String suborderNo = OrderUtil.generateSubOrderNo(OrderUtil.FD_PREFIX);
|
||||
|
||||
ZcOrderSub refundSub = new ZcOrderSub();
|
||||
refundSub.setOrderId(orderId);
|
||||
refundSub.setSuborderNo(suborderNo);
|
||||
refundSub.setSuborderType(OrderUtil.FD_DEPOSIT);
|
||||
// 计算实际退款金额(押金减去逾期费用)
|
||||
BigDecimal overdueAmount = BigDecimal.ZERO;
|
||||
long overdueDays = DateUtils.daysBetween(queryOrder.getEndRentTime(), DateUtils.getNowDate());
|
||||
if (overdueDays > 0) {
|
||||
overdueAmount = queryOrder.getOverdueFee().multiply(new BigDecimal(overdueDays));
|
||||
}
|
||||
BigDecimal refundAmount = querySub.getAmount().subtract(overdueAmount);
|
||||
if (refundAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
refundAmount = BigDecimal.ZERO;
|
||||
}
|
||||
refundSub.setAmount(refundAmount);
|
||||
refundSub.setPaymentMethod(querySub.getPaymentMethod());
|
||||
refundSub.setCreatedAt(DateUtils.getNowDate());
|
||||
refundSub.setPaymentId(querySub.getPaymentId());
|
||||
refundSub.setRefundId(suborderNo);
|
||||
refundSub.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
// 调用退款接口并检查结果
|
||||
boolean bool = callRefundApi(querySub, suborderNo, refundAmount, queryOrder.getOperatorId());
|
||||
if(bool) {
|
||||
// 创建退款成功子订单
|
||||
zcOrderSubService.insertZcOrderSub(refundSub);
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
return true; // 如果没有押金子订单,认为退款成功
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用退款接口
|
||||
* @param querySub 原始押金子订单
|
||||
* @param refundNo 退款单号
|
||||
* @param refundAmount 退款金额
|
||||
* @param operatorId 运营商ID
|
||||
* @return 退款是否成功
|
||||
*/
|
||||
private boolean callRefundApi(ZcOrderSub querySub, String refundNo, BigDecimal refundAmount, Long operatorId) {
|
||||
try {
|
||||
// 准备退款请求参数
|
||||
RefundRequest refundRequest = new RefundRequest();
|
||||
refundRequest.setCompanyId(operatorId);// 运营商id
|
||||
refundRequest.setOutTradeNo(querySub.getPaymentId()); // 子订单押金payment_id
|
||||
refundRequest.setOutRefundNo(refundNo);// 退款子订单编号
|
||||
refundRequest.setRefundDesc("手动结束订单退款");// 退款描述
|
||||
refundRequest.setTotalFee(new BigDecimal(0));
|
||||
refundRequest.setRefundFee(refundAmount); // 退款金额
|
||||
|
||||
// 发送HTTP请求调用退款接口
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
HttpEntity<RefundRequest> requestEntity = new HttpEntity<>(refundRequest, headers);
|
||||
|
||||
// 打印请求参数便于调试
|
||||
String jsonParams = objectMapper.writeValueAsString(refundRequest);
|
||||
logger.info("退款请求参数: {}", jsonParams);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> response = restTemplate.postForEntity(refundUrl, requestEntity, String.class);
|
||||
|
||||
// 处理退款接口响应
|
||||
if (response.getStatusCode() == HttpStatus.OK) {
|
||||
// 解析响应内容,检查return_code是否为SUCCESS
|
||||
String responseBody = response.getBody();
|
||||
if (responseBody != null) {
|
||||
try {
|
||||
// 使用ObjectMapper解析JSON响应
|
||||
Map<String, Object> responseMap = objectMapper.readValue(responseBody, Map.class);
|
||||
Object returnCode = responseMap.get("return_code");
|
||||
if ("SUCCESS".equals(returnCode)) {
|
||||
logger.info("退款成功,退款单号: {}", refundNo);
|
||||
return true;
|
||||
} else {
|
||||
logger.error("退款失败,退款单号: {},响应: {}", refundNo, responseBody);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception jsonEx) {
|
||||
logger.error("解析退款接口响应异常,退款单号: {},响应: {}", refundNo, responseBody, jsonEx);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
logger.error("退款接口返回空响应,退款单号: {}", refundNo);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
logger.error("退款失败,退款单号: {},响应: {}", refundNo, response.getBody());
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("调用退款接口异常,退款单号: " + refundNo, e);
|
||||
return false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -33,6 +33,11 @@ public class ZcOrderSubServiceImpl implements IZcOrderSubService
|
||||
return zcOrderSubMapper.selectZcOrderSubBySuborderId(suborderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZcOrderSub selectZcOrderSub(ZcOrderSub zcOrderSub) {
|
||||
return zcOrderSubMapper.selectZcOrderSub(zcOrderSub);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租车子订单列表
|
||||
*
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.ruoyi.orders.util;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
|
||||
public class OrderUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 子订单类型suborderType
|
||||
*/
|
||||
public static final String RENTCAR= "RENTCAR"; //租车
|
||||
public static final String RENTBATTEY= "RENTBATTEY"; //租电
|
||||
public static final String DEPOSIT= "DEPOSIT"; //押金
|
||||
public static final String FD_DEPOSIT= "FD_DEPOSIT"; //退押金
|
||||
|
||||
/** 押金订单号前缀 */
|
||||
public static final String YJ_PREFIX = "YJ";
|
||||
public static final String ZD_PREFIX = "ZD";
|
||||
public static final String ZC_PREFIX = "ZC";
|
||||
public static final String YQ_PREFIX = "YQ";
|
||||
public static final String ZF_PREFIX = "ZF";
|
||||
/** 退款订单号前缀 */
|
||||
public static final String FD_PREFIX = "FD";
|
||||
|
||||
/** 生成子订单号用于支付
|
||||
* @return 唯一订单号字符串
|
||||
*/
|
||||
public static String generateSubOrderNo(String prefix) {
|
||||
// 使用时间戳+UUID后缀确保唯一性
|
||||
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
String uuidSuffix = UUID.randomUUID().toString().replace("-", "").substring(0, 6).toUpperCase();
|
||||
return prefix + timestamp + uuidSuffix; // sub代表子订单号
|
||||
}
|
||||
|
||||
}
|
||||
@ -83,3 +83,5 @@ renren:
|
||||
expire: 604800
|
||||
header: token
|
||||
|
||||
pay:
|
||||
refundUrl: http://115.190.8.52:8019/api/payment/refund
|
||||
@ -54,7 +54,6 @@
|
||||
<if test="damageType != null and damageType != ''"> and a.damage_type = #{damageType}</if>
|
||||
<if test="damageReason != null and damageReason != ''"> and a.damage_reason = #{damageReason}</if>
|
||||
<if test="submitterName != null and submitterName != ''"> and a.submitter_name like concat('%', #{submitterName}, '%')</if>
|
||||
<if test="submitTime != null "> and a.submit_time = #{submitTime}</if>
|
||||
<if test="damageStatus != null "> and a.damage_status = #{damageStatus}</if>
|
||||
<if test="auditorName != null and auditorName != ''"> and a.auditor_name like concat('%', #{auditorName}, '%')</if>
|
||||
<if test="auditTime != null "> and a.audit_time = #{auditTime}</if>
|
||||
@ -64,7 +63,13 @@
|
||||
<if test="extend2 != null and extend2 != ''"> and a.extend2 = #{extend2}</if>
|
||||
<if test="extend3 != null and extend3 != ''"> and a.extend3 = #{extend3}</if>
|
||||
<if test="operatorId != null "> and c.operator_id = #{operatorId}</if>
|
||||
<if test="storeName != null "> and c.store_name = #{storeName}</if>
|
||||
<if test="storeName != null and storeName != ''"> and c.store_name = #{storeName}</if>
|
||||
<if test="params.beginSubmitTime != null and params.beginSubmitTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(a.submit_time,'%y%m%d') >= date_format(#{beginSubmitTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endSubmitTime != null and params.endSubmitTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(a.submit_time,'%y%m%d') <= date_format(#{endSubmitTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="params.beginFirstOrderTime != null and params.beginFirstOrderTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(a.first_order_time,'%y%m%d') >= date_format(#{params.beginFirstOrderTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.enstoreNamedFirstOrderTime != null and params.endFirstOrderTime != ''"><!-- 结束时间检索 -->
|
||||
<if test="params.endFirstOrderTime != null and params.endFirstOrderTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(a.first_order_time,'%y%m%d') <= date_format(#{params.endFirstOrderTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
|
||||
@ -55,7 +55,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectZcOrderSubVo"/>
|
||||
where suborder_id = #{suborderId}
|
||||
</select>
|
||||
|
||||
<select id="selectZcOrderSub" parameterType="ZcOrderSub" resultMap="ZcOrderSubResult" >
|
||||
<include refid="selectZcOrderSubVo"/>
|
||||
WHERE order_id = #{orderId} and suborder_type = #{suborderType}
|
||||
</select>
|
||||
|
||||
<insert id="insertZcOrderSub" parameterType="ZcOrderSub" useGeneratedKeys="true" keyProperty="suborderId">
|
||||
insert into zc_order_sub
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
@ -43,6 +43,12 @@
|
||||
<label>审核人:</label>
|
||||
<input type="text" name="auditorName"/>
|
||||
</li>
|
||||
<li class="select-time">
|
||||
<label>报损时间: </label>
|
||||
<input type="text" class="time-input" id="beginSubmitTime" placeholder="开始时间" name="params[beginSubmitTime]"/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endSubmitTime" placeholder="结束时间" name="params[endSubmitTime]"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
@ -167,8 +173,10 @@
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>审核</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
if (row.damageStatus == '0'){
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>报损审核</a> ');
|
||||
}
|
||||
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
|
||||
@ -8,70 +8,85 @@
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-carDamage-edit" th:object="${zcCarDamage}">
|
||||
<input name="id" th:field="*{id}" type="hidden">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">报损类型:</label>
|
||||
<input name="id" th:field="*{carId}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">车架号:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="damageType" class="form-control m-b" th:with="type=${@dict.getType('key_car_damage_type')}" required>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{damageType}"></option>
|
||||
</select>
|
||||
<div class="form-control-static" th:text="*{zcCar.vin}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">车辆品牌:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-control-static" th:text="*{zcCar.brandName}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">车辆型号:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-control-static" th:text="*{zcCar.modelName}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">所属运营商:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-control-static" th:text="*{zcCar.operatorName}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">所属门店:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-control-static" th:text="*{zcCar.storeName}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">报损类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-control-static" th:text="${@dict.getLabel('key_car_damage_type', zcCarDamage.damageType)}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">报损原因:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="damageReason" class="form-control">[[*{damageReason}]]</textarea>
|
||||
<div class="form-control-static" th:text="*{damageReason}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">报损提交人:</label>
|
||||
<label class="col-sm-3 control-label">报损提交人:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="submitterName" th:field="*{submitterName}" class="form-control" type="text" required>
|
||||
<div class="form-control-static" th:text="*{submitterName}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">报损提交时间:</label>
|
||||
<label class="col-sm-3 control-label">报损提交时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="submitTime" th:value="${#dates.format(zcCarDamage.submitTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
<div class="form-control-static" th:text="${#dates.format(zcCarDamage.submitTime, 'yyyy-MM-dd HH:mm:ss')}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">报损状态:</label>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">审核状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('key_car_damage_status')}">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('key_car_damage_status2')}" required>
|
||||
<input type="radio" th:id="${'damageStatus_' + dict.dictCode}" name="damageStatus" th:value="${dict.dictValue}" th:field="*{damageStatus}" required>
|
||||
<label th:for="${'damageStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">审核人姓名:</label>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">审核人姓名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="auditorName" th:field="*{auditorName}" class="form-control" type="text">
|
||||
<input name="auditorName" th:field="*{auditorName}" class="form-control" type="text" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">审核时间:</label>
|
||||
<label class="col-sm-3 control-label is-required">审核意见:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="auditTime" th:value="${#dates.format(zcCarDamage.auditTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">审核意见:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="auditComment" class="form-control">[[*{auditComment}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="remark" th:field="*{remark}" class="form-control" type="text">
|
||||
<textarea name="auditComment" class="form-control" required>[[*{auditComment}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -176,6 +176,7 @@
|
||||
var suborderTypeDatas = [[${@dict.getType('key_order_suborder_type')}]];
|
||||
var paymentMethodDatas = [[${@dict.getType('key_order_payment_method')}]];
|
||||
var imgTypeDatas = [[${@dict.getType('key_order_img_type')}]];
|
||||
var payStatusDatas = [[${@dict.getType('key_order_pay_status')}]];
|
||||
$("#form-order-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
@ -262,7 +263,10 @@
|
||||
{
|
||||
field: 'payStatus',
|
||||
align: 'center',
|
||||
title: '支付状态'
|
||||
title: '支付状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(payStatusDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'paidAt',
|
||||
@ -329,7 +333,7 @@
|
||||
|
||||
function manualEndOrder(){
|
||||
var orderId = $("#orderId").val();
|
||||
$.modal.confirm("确认手动结束该订单", function() {
|
||||
$.modal.confirm("确认手动结束该订单<br/><span style='color: red'>请确认车辆是否己归还,如未归还需要进行车辆丢失报损。<br/>结束此订单不再计算租车费用,己支付租金不做退款。</span>", function() {
|
||||
$.operate.post(prefix + "/manualEndOrder", { "orderId": orderId}, function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgSuccess("操作成功");
|
||||
|
||||
Reference in New Issue
Block a user