no message
This commit is contained in:
parent
08c7cb32a9
commit
fa7ff1971f
|
|
@ -1523,4 +1523,43 @@ public class OrderDetailController extends BaseController {
|
||||||
public AjaxResult statistics() {
|
public AjaxResult statistics() {
|
||||||
return AjaxResult.success(orderDetailService.orderStatisticsReturn());
|
return AjaxResult.success(orderDetailService.orderStatisticsReturn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 延期到货接口
|
||||||
|
* 如果是待确认状态则变为服务中,其他状态不变
|
||||||
|
* 将confirm_start_time增加3天
|
||||||
|
* 延期次数最多2次
|
||||||
|
*/
|
||||||
|
@PostMapping("/app/delay")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult delayOrder(@RequestBody OrderDetail orderDetail) {
|
||||||
|
logger.info("延期到货,orderDetailId={}", orderDetail.getId());
|
||||||
|
try {
|
||||||
|
return toAjax(orderDetailService.delayOrder(orderDetail.getId()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||||
|
return AjaxResult.error("延期失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子订单退回接口
|
||||||
|
* 如果订单为服务类型(orderType=0)则退回到服务中状态
|
||||||
|
* 如果订单为商品类型(orderType=1)则退回到待排期状态
|
||||||
|
*/
|
||||||
|
@PostMapping("/app/return")
|
||||||
|
@ResponseBody
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult returnOrder(@RequestBody OrderDetail orderDetail) {
|
||||||
|
logger.info("子订单退回,orderDetailId={}", orderDetail.getId());
|
||||||
|
try {
|
||||||
|
return toAjax(orderDetailService.returnOrder(orderDetail.getId()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||||
|
return AjaxResult.error("退回失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,4 +225,9 @@ public class OrderDetail extends BaseEntity {
|
||||||
|
|
||||||
private String isCall;
|
private String isCall;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 延期次数,最大2次
|
||||||
|
*/
|
||||||
|
private Integer delayCount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,4 +203,25 @@ public interface OrderDetailService {
|
||||||
|
|
||||||
// 订单详情数据统计返回 根据时间统计当前日期天
|
// 订单详情数据统计返回 根据时间统计当前日期天
|
||||||
OrderDetailStatisticsDTO orderStatisticsDisposeByNow();
|
OrderDetailStatisticsDTO orderStatisticsDisposeByNow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 延期到货
|
||||||
|
* 如果是待确认状态则变为服务中,其他状态不变
|
||||||
|
* 将confirm_start_time增加3天
|
||||||
|
* 延期次数最多2次
|
||||||
|
*
|
||||||
|
* @param orderDetailId 子订单ID
|
||||||
|
* @return 成功条数
|
||||||
|
*/
|
||||||
|
int delayOrder(Long orderDetailId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子订单退回
|
||||||
|
* 如果订单为服务类型(orderType=0)则退回到服务中状态
|
||||||
|
* 如果订单为商品类型(orderType=1)则退回到待排期状态
|
||||||
|
*
|
||||||
|
* @param orderDetailId 子订单ID
|
||||||
|
* @return 成功条数
|
||||||
|
*/
|
||||||
|
int returnOrder(Long orderDetailId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -499,7 +499,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
throw new BaseException("FinancialDetail is null!!!");
|
throw new BaseException("FinancialDetail is null!!!");
|
||||||
}
|
}
|
||||||
if (financialDetail.getPayStatus() != 1) {
|
if (financialDetail.getPayStatus() != 1) {
|
||||||
throw new BaseException("订单不是“已支付”状态");
|
throw new BaseException("订单不是已支付状态");
|
||||||
}
|
}
|
||||||
final Long deptId = orderMaster.getDeptId();
|
final Long deptId = orderMaster.getDeptId();
|
||||||
Long financialMasterId = financialDetail.getFinancialMasterId();
|
Long financialMasterId = financialDetail.getFinancialMasterId();
|
||||||
|
|
@ -1433,4 +1433,86 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
}
|
}
|
||||||
return statisticsDTOByNow;
|
return statisticsDTOByNow;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int delayOrder(Long orderDetailId) {
|
||||||
|
// 查询订单信息
|
||||||
|
OrderDetail orderDetail = orderDetailMapper.selectById(orderDetailId);
|
||||||
|
if (orderDetail == null) {
|
||||||
|
throw new BaseException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查延期次数
|
||||||
|
Integer delayCount = orderDetail.getDelayCount();
|
||||||
|
if (delayCount == null) {
|
||||||
|
delayCount = 0;
|
||||||
|
}
|
||||||
|
if (delayCount >= 2) {
|
||||||
|
throw new BaseException("延期次数已达上限,最多只能延期2次");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查订单状态是否允许延期
|
||||||
|
if (orderDetail.getOrderStatus() == null) {
|
||||||
|
throw new BaseException("订单状态异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新延期次数
|
||||||
|
orderDetail.setDelayCount(delayCount + 1);
|
||||||
|
|
||||||
|
// 处理confirm_start_time,增加3天
|
||||||
|
Date confirmStartTime = orderDetail.getConfirmStartTime();
|
||||||
|
if (confirmStartTime == null) {
|
||||||
|
confirmStartTime = new Date();
|
||||||
|
}
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(confirmStartTime);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, 3);
|
||||||
|
orderDetail.setConfirmStartTime(calendar.getTime());
|
||||||
|
|
||||||
|
// 如果是待确认状态,则变为服务中
|
||||||
|
if (OrderStatus.FINISH_CHECK.code()==orderDetail.getOrderStatus()) {
|
||||||
|
orderDetail.setOrderStatus(OrderStatus.SERVER.code());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新订单
|
||||||
|
return orderDetailMapper.updateOrderDetail(orderDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int returnOrder(Long orderDetailId) {
|
||||||
|
// 查询订单信息
|
||||||
|
OrderDetail orderDetail = orderDetailMapper.selectById(orderDetailId);
|
||||||
|
if (orderDetail == null) {
|
||||||
|
throw new BaseException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查订单状态是否允许退回
|
||||||
|
if (orderDetail.getOrderStatus() == null) {
|
||||||
|
throw new BaseException("订单状态异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据订单类型决定退回状态
|
||||||
|
Integer orderType = orderDetail.getOrderType();
|
||||||
|
if (orderType == null) {
|
||||||
|
throw new BaseException("订单类型异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据订单类型设置退回状态
|
||||||
|
if (orderType == 0) {
|
||||||
|
// 服务订单:退回到服务中状态
|
||||||
|
orderDetail.setOrderStatus(OrderStatus.SERVER.code());
|
||||||
|
} else if (orderType == 1) {
|
||||||
|
// 商品订单:退回到待排期状态
|
||||||
|
orderDetail.setOrderStatus(OrderStatus.PLAIN.code());
|
||||||
|
} else {
|
||||||
|
throw new BaseException("不支持的订单类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除超时状态
|
||||||
|
orderDetail.setTimeout(0);
|
||||||
|
|
||||||
|
// 更新订单
|
||||||
|
return orderDetailMapper.updateOrderDetail(orderDetail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
<result property="timeout" column="timeout_"/>
|
<result property="timeout" column="timeout_"/>
|
||||||
<result property="afterTimeout" column="after_timeout"/>
|
<result property="afterTimeout" column="after_timeout"/>
|
||||||
<result property="timeoutFineTimes" column="timeout_fine_times"/>
|
<result property="timeoutFineTimes" column="timeout_fine_times"/>
|
||||||
|
<result property="delayCount" column="delay_count"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectOrderDetail">
|
<sql id="selectOrderDetail">
|
||||||
|
|
@ -68,7 +69,8 @@
|
||||||
confirm_start_time,
|
confirm_start_time,
|
||||||
timeout_,
|
timeout_,
|
||||||
timeout_fine_times,
|
timeout_fine_times,
|
||||||
after_timeout
|
after_timeout,
|
||||||
|
delay_count
|
||||||
FROM order_detail
|
FROM order_detail
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
@ -103,7 +105,8 @@
|
||||||
od.draw_cash_status,
|
od.draw_cash_status,
|
||||||
od.timeout_,
|
od.timeout_,
|
||||||
od.timeout_fine_times,
|
od.timeout_fine_times,
|
||||||
od.after_timeout
|
od.after_timeout,
|
||||||
|
od.delay_count
|
||||||
FROM order_detail od
|
FROM order_detail od
|
||||||
LEFT JOIN order_master om ON om.id = od.order_master_id
|
LEFT JOIN order_master om ON om.id = od.order_master_id
|
||||||
LEFT JOIN customer_address ca ON ca.customer_address_id = om.address_id
|
LEFT JOIN customer_address ca ON ca.customer_address_id = om.address_id
|
||||||
|
|
@ -369,6 +372,7 @@
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
<if test="ledgerAccountStatus != null">ledger_account_status = #{ledgerAccountStatus},</if>
|
<if test="ledgerAccountStatus != null">ledger_account_status = #{ledgerAccountStatus},</if>
|
||||||
<if test="timeout != null">timeout_ = #{timeout},</if>
|
<if test="timeout != null">timeout_ = #{timeout},</if>
|
||||||
|
<if test="delayCount != null">delay_count = #{delayCount},</if>
|
||||||
update_time = SYSDATE()
|
update_time = SYSDATE()
|
||||||
</set>
|
</set>
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
|
|
@ -427,6 +431,7 @@
|
||||||
<if test="handoverImages != null">handover_images,</if>
|
<if test="handoverImages != null">handover_images,</if>
|
||||||
<if test="handoverRemark != null">handover_remark,</if>
|
<if test="handoverRemark != null">handover_remark,</if>
|
||||||
<if test="confirmStartTime != null">confirm_start_time,</if>
|
<if test="confirmStartTime != null">confirm_start_time,</if>
|
||||||
|
<if test="delayCount != null">delay_count,</if>
|
||||||
<if test="expectTimeStart != null">expect_time_start,</if>
|
<if test="expectTimeStart != null">expect_time_start,</if>
|
||||||
<if test="expectTimeEnd != null">expect_time_end,</if>
|
<if test="expectTimeEnd != null">expect_time_end,</if>
|
||||||
<if test="workBeginTime != null">work_begin_time,</if>
|
<if test="workBeginTime != null">work_begin_time,</if>
|
||||||
|
|
@ -446,6 +451,7 @@
|
||||||
<if test="handoverImages != null">#{handoverImages},</if>
|
<if test="handoverImages != null">#{handoverImages},</if>
|
||||||
<if test="handoverRemark != null">#{handoverRemark},</if>
|
<if test="handoverRemark != null">#{handoverRemark},</if>
|
||||||
<if test="confirmStartTime != null">#{confirmStartTime},</if>
|
<if test="confirmStartTime != null">#{confirmStartTime},</if>
|
||||||
|
<if test="delayCount != null">#{delayCount},</if>
|
||||||
<if test="expectTimeStart != null">#{expectTimeStart},</if>
|
<if test="expectTimeStart != null">#{expectTimeStart},</if>
|
||||||
<if test="expectTimeEnd != null">#{expectTimeEnd},</if>
|
<if test="expectTimeEnd != null">#{expectTimeEnd},</if>
|
||||||
<if test="workBeginTime != null">#{workBeginTime},</if>
|
<if test="workBeginTime != null">#{workBeginTime},</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue