🐛 运次级接单与拒单补上更新痕迹,与单票路径一致
单票接单/拒单走 updateById,写前会把 update_time 刷成提交时刻、 update_user 填成当前用户(无登录态不填);运次级原来用 wrapper 一次写完, 这两列保持旧值,同一动作的两条路径在库里留下不同痕迹。 现显式补上同样两列,时刻取与接单/拒单时刻同一个 Date。
This commit is contained in:
+19
-1
@@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.jackson.JsonUtil;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
@@ -651,7 +652,11 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
List<TripVO.TripWaybillVO> children = tripChildren(tripId);
|
||||
assertTripAcceptable(children);
|
||||
List<Long> pendingIds = writeCandidateIds(children, "当前运单状态不允许接单");
|
||||
// 更新痕迹与单票接单一致:单票走 updateById,写前会把 update_time 刷成提交时刻、
|
||||
// 把 update_user 填成当前用户(无登录态则不填);这里一次写完,显式补上同样两列,
|
||||
// 时刻取与接单时刻同一个 now,操作人取同一个登录用户
|
||||
Date now = new Date();
|
||||
Long operatorId = currentOperatorId();
|
||||
return waybillService.update(Wrappers.<Waybill>lambdaUpdate()
|
||||
.set(Waybill::getDriverAcceptStatus, WaybillProcessSupport.ACCEPT_ACCEPTED)
|
||||
.set(Waybill::getDriverAcceptTime, now)
|
||||
@@ -659,6 +664,8 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
.set(Waybill::getDriverRejectTime, null)
|
||||
.set(Waybill::getDriverRejectReason, null)
|
||||
.set(Waybill::getBusinessStatus, STATUS_RUNNING)
|
||||
.set(Waybill::getUpdateTime, now)
|
||||
.set(operatorId != null, Waybill::getUpdateUser, operatorId)
|
||||
.in(Waybill::getId, pendingIds));
|
||||
}
|
||||
|
||||
@@ -673,8 +680,9 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
throw new ServiceException("拒绝原因不能超过200字");
|
||||
}
|
||||
List<Long> pendingIds = writeCandidateIds(children, "当前运单状态不允许拒绝接单");
|
||||
// 整单拒绝落在每张未终态子运单上,一次一条语句写完,拒单时刻与更新痕迹全趟车一致
|
||||
Date now = new Date();
|
||||
// 整单拒绝落在每张未终态子运单上,一次一条语句写完,接单时刻与拒单时刻全趟车一致
|
||||
Long operatorId = currentOperatorId();
|
||||
return waybillService.update(Wrappers.<Waybill>lambdaUpdate()
|
||||
.set(Waybill::getDriverAcceptStatus, WaybillProcessSupport.ACCEPT_REJECTED)
|
||||
.set(Waybill::getDriverAcceptTime, null)
|
||||
@@ -682,9 +690,19 @@ public class DriverWaybillServiceImpl implements IDriverWaybillService {
|
||||
.set(Waybill::getDriverRejectTime, now)
|
||||
.set(Waybill::getDriverRejectReason, rejectReason)
|
||||
.set(Waybill::getBusinessStatus, STATUS_PENDING)
|
||||
.set(Waybill::getUpdateTime, now)
|
||||
.set(operatorId != null, Waybill::getUpdateUser, operatorId)
|
||||
.in(Waybill::getId, pendingIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登录用户主键:与框架写入时填充更新人的口径一致——没有登录态就不填
|
||||
*/
|
||||
private Long currentOperatorId() {
|
||||
BladeUser operator = AuthUtil.getUser();
|
||||
return operator == null ? null : operator.getUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 运次 → 子运单集合:配载的运次走运次读服务解析(配载单主键命中后按配载单号取子运单),
|
||||
* 未配载的就是那张运单本身。收口与列表一致——别人的运次在这里已经被挡住。
|
||||
|
||||
Reference in New Issue
Block a user