Merge branch 'master' of https://git.njzscloud.com/lzq/njzscloud
commit
b96003d454
|
|
@ -96,4 +96,8 @@ public class SearchTruckResult {
|
||||||
*/
|
*/
|
||||||
private Boolean disabled;
|
private Boolean disabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gps编码
|
||||||
|
*/
|
||||||
|
private String gps;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,14 @@ public class OrderInfoController {
|
||||||
Assert.isTrue(orderCategory == OrderCategory.PuTong
|
Assert.isTrue(orderCategory == OrderCategory.PuTong
|
||||||
|| orderCategory == OrderCategory.DuanBoChu
|
|| orderCategory == OrderCategory.DuanBoChu
|
||||||
, "订单类型必须是普通订单、短驳出");
|
, "订单类型必须是普通订单、短驳出");
|
||||||
orderInfoService.add(addOrderInfoParam);
|
Integer truckCount = addOrderInfoParam.getTruckCount();
|
||||||
|
Assert.isTrue(truckCount != null && truckCount > 0 && truckCount <= 10, "车辆数量必须大于0小于等于10");
|
||||||
|
Integer estimatedQuantity = addOrderInfoParam.getEstimatedQuantity();
|
||||||
|
if (estimatedQuantity != null && estimatedQuantity > 0) {
|
||||||
|
addOrderInfoParam.setEstimatedQuantity(estimatedQuantity / truckCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
orderInfoService.batchAdd(addOrderInfoParam);
|
||||||
return R.success();
|
return R.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,10 @@ public class OrderInfoEntity {
|
||||||
* 开始清运时间
|
* 开始清运时间
|
||||||
*/
|
*/
|
||||||
private LocalDateTime transTime;
|
private LocalDateTime transTime;
|
||||||
|
private LocalDateTime checkTime;
|
||||||
|
private LocalDateTime assignmentTransTime;
|
||||||
|
private LocalDateTime assignmentDriverTime;
|
||||||
|
private LocalDateTime driverConfirmTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下单人 Id; sys_user.id
|
* 下单人 Id; sys_user.id
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class AddOrderInfoParam implements Constrained {
|
||||||
/**
|
/**
|
||||||
* 预估量
|
* 预估量
|
||||||
*/
|
*/
|
||||||
private String estimatedQuantity;
|
private Integer estimatedQuantity;
|
||||||
/**
|
/**
|
||||||
* 站点 Id
|
* 站点 Id
|
||||||
*/
|
*/
|
||||||
|
|
@ -76,6 +76,7 @@ public class AddOrderInfoParam implements Constrained {
|
||||||
* 订单类型; 字典代码:order_category
|
* 订单类型; 字典代码:order_category
|
||||||
*/
|
*/
|
||||||
private OrderCategory orderCategory;
|
private OrderCategory orderCategory;
|
||||||
|
private Integer truckCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 付款方资金账户 Id
|
* 付款方资金账户 Id
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,10 @@ public class OrderPagingResult {
|
||||||
*/
|
*/
|
||||||
private String sn;
|
private String sn;
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
private LocalDateTime checkTime;
|
||||||
|
private LocalDateTime assignmentTransTime;
|
||||||
|
private LocalDateTime assignmentDriverTime;
|
||||||
|
private LocalDateTime driverConfirmTime;
|
||||||
/**
|
/**
|
||||||
* 站点 Id
|
* 站点 Id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ public class OrderCarInOutService extends ServiceImpl<OrderCarInOutMapper, Order
|
||||||
if (roughWeight__ == null) {
|
if (roughWeight__ == null) {
|
||||||
BizTruckEntity bizTruckEntity = bizTruckService.getById(truckId);
|
BizTruckEntity bizTruckEntity = bizTruckService.getById(truckId);
|
||||||
Integer truckTareWeight = bizTruckEntity.getTareWeight();
|
Integer truckTareWeight = bizTruckEntity.getTareWeight();
|
||||||
Assert.notNull(truckTareWeight, () -> Exceptions.exception("车辆未配置皮重"));
|
Assert.notNull(truckTareWeight, () -> Exceptions.exception("{} 车辆暂无皮重", bizTruckEntity.getLicensePlate()));
|
||||||
orderCarInOutEntity.setRoughWeight(truckTareWeight);
|
orderCarInOutEntity.setRoughWeight(truckTareWeight);
|
||||||
roughWeight__ = truckTareWeight;
|
roughWeight__ = truckTareWeight;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,10 @@ import com.njzscloud.supervisory.sys.stationletter.constant.WarnCategory;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
import org.springframework.transaction.TransactionStatus;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
@ -56,7 +59,8 @@ import java.time.LocalDateTime;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.njzscloud.supervisory.constant.Constant.CERTIFICATE_SN_CODE;
|
import static com.njzscloud.supervisory.constant.Constant.CERTIFICATE_SN_CODE;
|
||||||
|
|
@ -80,6 +84,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
private final BizWarnService bizWarnService;
|
private final BizWarnService bizWarnService;
|
||||||
private final AppProperties appProperties;
|
private final AppProperties appProperties;
|
||||||
private final StationManageService stationManageService;
|
private final StationManageService stationManageService;
|
||||||
|
private final PlatformTransactionManager transactionManager;
|
||||||
|
private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 100, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100), new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
|
|
||||||
private static void stopTuqiangTrack(String gpsId) {
|
private static void stopTuqiangTrack(String gpsId) {
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
|
|
@ -99,7 +105,6 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void add(AddOrderInfoParam addOrderInfoParam) {
|
public void add(AddOrderInfoParam addOrderInfoParam) {
|
||||||
AddOrderCargoPlaceParam cargoPlace = addOrderInfoParam.getCargoPlace();
|
AddOrderCargoPlaceParam cargoPlace = addOrderInfoParam.getCargoPlace();
|
||||||
long cargoPlaceId = orderCargoPlaceService.add(cargoPlace);
|
long cargoPlaceId = orderCargoPlaceService.add(cargoPlace);
|
||||||
|
|
@ -118,7 +123,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
.setCargoPlaceId(cargoPlaceId)
|
.setCargoPlaceId(cargoPlaceId)
|
||||||
.setUserId(userId)
|
.setUserId(userId)
|
||||||
.setOrderStatus(orderStatus)
|
.setOrderStatus(orderStatus)
|
||||||
.setGoodsId(orderGoodsId);
|
.setGoodsId(orderGoodsId)
|
||||||
|
.setAssignmentTransTime(transCompanyId == null ? null : LocalDateTime.now());
|
||||||
this.save(orderInfoEntity);
|
this.save(orderInfoEntity);
|
||||||
|
|
||||||
if (transCompanyId != null) {
|
if (transCompanyId != null) {
|
||||||
|
|
@ -177,44 +183,43 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
LocalDateTime startTime = orderPagingSearchParam.getStartTime();
|
LocalDateTime startTime = orderPagingSearchParam.getStartTime();
|
||||||
LocalDateTime endTime = orderPagingSearchParam.getEndTime();
|
LocalDateTime endTime = orderPagingSearchParam.getEndTime();
|
||||||
Page<OrderPagingResult> page = pageParam.toPage();
|
Page<OrderPagingResult> page = pageParam.toPage();
|
||||||
page.addOrder(OrderItem.desc("a.create_time"));
|
|
||||||
QueryWrapper<OrderPagingResult> ew = Wrappers.<OrderPagingResult>query()
|
QueryWrapper<OrderPagingResult> ew = Wrappers.<OrderPagingResult>query()
|
||||||
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
|
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
|
||||||
.like(StrUtil.isNotBlank(licensePlate), "a.license_plate", licensePlate)
|
.like(StrUtil.isNotBlank(licensePlate), "e.license_plate", licensePlate)
|
||||||
.like(StrUtil.isNotBlank(nickname), "h.nickname", nickname)
|
.like(StrUtil.isNotBlank(nickname), "a.contacts", nickname)
|
||||||
.like(StrUtil.isNotBlank(phone), "h.phone", phone)
|
.like(StrUtil.isNotBlank(phone), "a.phone", phone)
|
||||||
.ge(startTime != null, "a.create_time", startTime)
|
.ge(startTime != null, "a.create_time", startTime)
|
||||||
.le(endTime != null, "a.create_time", endTime);
|
.le(endTime != null, "a.create_time", endTime);
|
||||||
OrderViewType type = orderPagingSearchParam.getType();
|
OrderViewType type = orderPagingSearchParam.getType();
|
||||||
Assert.notNull(type, () -> Exceptions.clierr("订单类型不能为空"));
|
Assert.notNull(type, () -> Exceptions.clierr("订单类型不能为空"));
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DaiPaiDan:
|
case DaiPaiDan:
|
||||||
dispatchEW(orderPagingSearchParam, ew);
|
dispatchEW(orderPagingSearchParam, page, ew);
|
||||||
break;
|
break;
|
||||||
case YuYue:
|
case YuYue:
|
||||||
bookingEW(orderPagingSearchParam, ew);
|
bookingEW(orderPagingSearchParam, page, ew);
|
||||||
break;
|
break;
|
||||||
case LiShi:
|
case LiShi:
|
||||||
historyEW(orderPagingSearchParam, ew);
|
historyEW(orderPagingSearchParam, page, ew);
|
||||||
break;
|
break;
|
||||||
case QuXiao:
|
case QuXiao:
|
||||||
cancelEW(orderPagingSearchParam, ew);
|
cancelEW(orderPagingSearchParam, page, ew);
|
||||||
break;
|
break;
|
||||||
case ShouGong:
|
case ShouGong:
|
||||||
autoEW(orderPagingSearchParam, ew);
|
autoEW(orderPagingSearchParam, page, ew);
|
||||||
break;
|
break;
|
||||||
case ShiShi:
|
case ShiShi:
|
||||||
realtimeEW(orderPagingSearchParam, ew);
|
realtimeEW(orderPagingSearchParam, page, ew);
|
||||||
break;
|
break;
|
||||||
case KanLiao:
|
case KanLiao:
|
||||||
checkEW(orderPagingSearchParam, ew);
|
checkEW(orderPagingSearchParam, page, ew);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
page.addOrder(OrderItem.desc("a.create_time"), OrderItem.desc("a.id"));
|
||||||
return PageResult.of(baseMapper.paging(page, ew));
|
return PageResult.of(baseMapper.paging(page, ew));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dispatchEW(OrderPagingSearchParam orderPagingSearchParam, QueryWrapper<OrderPagingResult> ew) {
|
private void dispatchEW(OrderPagingSearchParam orderPagingSearchParam, Page<OrderPagingResult> page, QueryWrapper<OrderPagingResult> ew) {
|
||||||
MyResult userDetail = SecurityUtil.loginUser();
|
MyResult userDetail = SecurityUtil.loginUser();
|
||||||
Long userId = SecurityUtil.currentUserId();
|
Long userId = SecurityUtil.currentUserId();
|
||||||
BizObj bizObj = userDetail.getBizObj();
|
BizObj bizObj = userDetail.getBizObj();
|
||||||
|
|
@ -243,10 +248,11 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bookingEW(OrderPagingSearchParam orderPagingSearchParam, QueryWrapper<OrderPagingResult> ew) {
|
private void bookingEW(OrderPagingSearchParam orderPagingSearchParam, Page<OrderPagingResult> page, QueryWrapper<OrderPagingResult> ew) {
|
||||||
MyResult userDetail = SecurityUtil.loginUser();
|
MyResult userDetail = SecurityUtil.loginUser();
|
||||||
Long userId = SecurityUtil.currentUserId();
|
Long userId = SecurityUtil.currentUserId();
|
||||||
BizObj bizObj = userDetail.getBizObj();
|
BizObj bizObj = userDetail.getBizObj();
|
||||||
|
page.addOrder(OrderItem.desc("a.assignment_trans_time"), OrderItem.desc("a.assignment_driver_time"));
|
||||||
|
|
||||||
if (BizObj.isWaste(bizObj)) {
|
if (BizObj.isWaste(bizObj)) {
|
||||||
ew
|
ew
|
||||||
|
|
@ -268,10 +274,11 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void realtimeEW(OrderPagingSearchParam orderPagingSearchParam, QueryWrapper<OrderPagingResult> ew) {
|
private void realtimeEW(OrderPagingSearchParam orderPagingSearchParam, Page<OrderPagingResult> page, QueryWrapper<OrderPagingResult> ew) {
|
||||||
MyResult userDetail = SecurityUtil.loginUser();
|
MyResult userDetail = SecurityUtil.loginUser();
|
||||||
Long userId = SecurityUtil.currentUserId();
|
Long userId = SecurityUtil.currentUserId();
|
||||||
BizObj bizObj = userDetail.getBizObj();
|
BizObj bizObj = userDetail.getBizObj();
|
||||||
|
page.addOrder(OrderItem.desc("a.driver_confirm_time"));
|
||||||
|
|
||||||
if (BizObj.isWaste(bizObj)) {
|
if (BizObj.isWaste(bizObj)) {
|
||||||
ew
|
ew
|
||||||
|
|
@ -307,11 +314,13 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void historyEW(OrderPagingSearchParam orderPagingSearchParam, QueryWrapper<OrderPagingResult> ew) {
|
private void historyEW(OrderPagingSearchParam orderPagingSearchParam, Page<OrderPagingResult> page, QueryWrapper<OrderPagingResult> ew) {
|
||||||
MyResult userDetail = SecurityUtil.loginUser();
|
MyResult userDetail = SecurityUtil.loginUser();
|
||||||
Long userId = SecurityUtil.currentUserId();
|
Long userId = SecurityUtil.currentUserId();
|
||||||
BizObj bizObj = userDetail.getBizObj();
|
BizObj bizObj = userDetail.getBizObj();
|
||||||
|
|
||||||
|
page.addOrder(OrderItem.desc("d.out_time"));
|
||||||
|
|
||||||
if (BizObj.isWaste(bizObj)) {
|
if (BizObj.isWaste(bizObj)) {
|
||||||
ew
|
ew
|
||||||
.eq("a.order_status", OrderStatus.YiWanCheng)
|
.eq("a.order_status", OrderStatus.YiWanCheng)
|
||||||
|
|
@ -347,7 +356,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelEW(OrderPagingSearchParam orderPagingSearchParam, QueryWrapper<OrderPagingResult> ew) {
|
private void cancelEW(OrderPagingSearchParam orderPagingSearchParam, Page<OrderPagingResult> page, QueryWrapper<OrderPagingResult> ew) {
|
||||||
MyResult userDetail = SecurityUtil.loginUser();
|
MyResult userDetail = SecurityUtil.loginUser();
|
||||||
Long userId = SecurityUtil.currentUserId();
|
Long userId = SecurityUtil.currentUserId();
|
||||||
BizObj bizObj = userDetail.getBizObj();
|
BizObj bizObj = userDetail.getBizObj();
|
||||||
|
|
@ -372,7 +381,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void autoEW(OrderPagingSearchParam orderPagingSearchParam, QueryWrapper<OrderPagingResult> ew) {
|
private void autoEW(OrderPagingSearchParam orderPagingSearchParam, Page<OrderPagingResult> page, QueryWrapper<OrderPagingResult> ew) {
|
||||||
UserDetail userDetail = SecurityUtil.loginUser();
|
UserDetail userDetail = SecurityUtil.loginUser();
|
||||||
Set<String> roles = userDetail.getRoles();
|
Set<String> roles = userDetail.getRoles();
|
||||||
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
if (SecurityUtil.isAdmin() || roles.contains(Constant.ROLE_STATION_MANAGE)) {
|
||||||
|
|
@ -386,7 +395,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkEW(OrderPagingSearchParam orderPagingSearchParam, QueryWrapper<OrderPagingResult> ew) {
|
private void checkEW(OrderPagingSearchParam orderPagingSearchParam, Page<OrderPagingResult> page, QueryWrapper<OrderPagingResult> ew) {
|
||||||
MyResult userDetail = SecurityUtil.loginUser();
|
MyResult userDetail = SecurityUtil.loginUser();
|
||||||
BizObj bizObj = userDetail.getBizObj();
|
BizObj bizObj = userDetail.getBizObj();
|
||||||
if (BizObj.isSiBang(bizObj)) {
|
if (BizObj.isSiBang(bizObj)) {
|
||||||
|
|
@ -557,9 +566,12 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
this.updateById(new OrderInfoEntity()
|
this.updateById(new OrderInfoEntity()
|
||||||
.setId(orderId)
|
.setId(orderId)
|
||||||
.setCheckPhoto(checkGoodsParam.getCheckPhoto())
|
.setCheckPhoto(checkGoodsParam.getCheckPhoto())
|
||||||
|
.setCheckTime(LocalDateTime.now())
|
||||||
.setCheckStatus(CheckStatus.YiKanLiao)
|
.setCheckStatus(CheckStatus.YiKanLiao)
|
||||||
.setCheckerId(SecurityUtil.currentUserId())
|
.setCheckerId(SecurityUtil.currentUserId())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
truckLeaving(new TruckLeavingOrderParam().setOrderId(orderId), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -584,6 +596,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
this.updateById(new OrderInfoEntity()
|
this.updateById(new OrderInfoEntity()
|
||||||
.setId(orderInfo.getId())
|
.setId(orderInfo.getId())
|
||||||
.setDriverId(driverId)
|
.setDriverId(driverId)
|
||||||
|
.setAssignmentDriverTime(LocalDateTime.now())
|
||||||
.setOrderStatus(OrderStatus.DaiJieDan)
|
.setOrderStatus(OrderStatus.DaiJieDan)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -598,6 +611,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
this.updateById(new OrderInfoEntity()
|
this.updateById(new OrderInfoEntity()
|
||||||
.setId(orderInfoId)
|
.setId(orderInfoId)
|
||||||
.setTransCompanyId(transCompanyId)
|
.setTransCompanyId(transCompanyId)
|
||||||
|
.setAssignmentTransTime(LocalDateTime.now())
|
||||||
.setOrderStatus(OrderStatus.DaiPaiDan)
|
.setOrderStatus(OrderStatus.DaiPaiDan)
|
||||||
);
|
);
|
||||||
OrderInfoEntity orderInfoEntity = this.getById(orderInfoId);
|
OrderInfoEntity orderInfoEntity = this.getById(orderInfoId);
|
||||||
|
|
@ -632,6 +646,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
}
|
}
|
||||||
this.updateById(new OrderInfoEntity()
|
this.updateById(new OrderInfoEntity()
|
||||||
.setId(orderInfo.getId())
|
.setId(orderInfo.getId())
|
||||||
|
.setDriverConfirmTime(LocalDateTime.now())
|
||||||
.setAuditStatus(auditStatus)
|
.setAuditStatus(auditStatus)
|
||||||
.setTruckId(truckId)
|
.setTruckId(truckId)
|
||||||
.setOrderStatus(OrderStatus.YiJieDan)
|
.setOrderStatus(OrderStatus.YiJieDan)
|
||||||
|
|
@ -736,6 +751,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
Assert.isTrue(orderStatus == OrderStatus.YiYuYue
|
Assert.isTrue(orderStatus == OrderStatus.YiYuYue
|
||||||
|| orderStatus == OrderStatus.DaiPaiDan
|
|| orderStatus == OrderStatus.DaiPaiDan
|
||||||
|| orderStatus == OrderStatus.DaiJieDan, () -> Exceptions.clierr("当前订单状态,无法取消"));
|
|| orderStatus == OrderStatus.DaiJieDan, () -> Exceptions.clierr("当前订单状态,无法取消"));
|
||||||
|
AuditStatus auditStatus = orderInfo.getAuditStatus();
|
||||||
|
Assert.isFalse(auditStatus == AuditStatus.TongGuo || auditStatus == AuditStatus.BoHui, () -> Exceptions.clierr("当前订单状态,无法取消"));
|
||||||
this.updateById(new OrderInfoEntity()
|
this.updateById(new OrderInfoEntity()
|
||||||
.setId(orderInfo.getId())
|
.setId(orderInfo.getId())
|
||||||
.setOrderStatus(OrderStatus.YiQuXiao)
|
.setOrderStatus(OrderStatus.YiQuXiao)
|
||||||
|
|
@ -1080,4 +1097,60 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||||
OrderPagingResult orderDetail = detail(orderId);
|
OrderPagingResult orderDetail = detail(orderId);
|
||||||
return BeanUtil.copyProperties(orderDetail, TrainBillResult.class);
|
return BeanUtil.copyProperties(orderDetail, TrainBillResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void batchAdd(AddOrderInfoParam addOrderInfoParam) {
|
||||||
|
Integer truckCount = addOrderInfoParam.getTruckCount();
|
||||||
|
CountDownLatch latch = new CountDownLatch(truckCount);
|
||||||
|
AtomicBoolean hasError = new AtomicBoolean(false);
|
||||||
|
List<TransactionStatus> transactionStatuses = new CopyOnWriteArrayList<>();
|
||||||
|
for (int i = 0; i < truckCount; i++) {
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
// 每个线程创建独立事务
|
||||||
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||||
|
TransactionStatus status = transactionManager.getTransaction(def);
|
||||||
|
try {
|
||||||
|
// 执行具体的插入操作
|
||||||
|
add(addOrderInfoParam);
|
||||||
|
// 暂存事务状态
|
||||||
|
transactionStatuses.add(status);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 标记错误状态
|
||||||
|
hasError.set(true);
|
||||||
|
// 记录错误但不立即回滚,等待统一处理
|
||||||
|
transactionStatuses.add(status);
|
||||||
|
throw Exceptions.error(e, "新增订单失败");
|
||||||
|
}
|
||||||
|
}, threadPoolExecutor).whenComplete((v, e) -> {
|
||||||
|
latch.countDown();
|
||||||
|
if (e != null) {
|
||||||
|
log.error("新增订单失败", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
latch.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
hasError.set(true);
|
||||||
|
log.warn("任务中断", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据执行结果统一处理事务
|
||||||
|
if (hasError.get()) {
|
||||||
|
// 有错误,全部回滚
|
||||||
|
for (TransactionStatus status : transactionStatuses) {
|
||||||
|
if (!status.isCompleted()) {
|
||||||
|
transactionManager.rollback(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw Exceptions.exception("批量创建订单失败");
|
||||||
|
} else {
|
||||||
|
// 全部成功,统一提交
|
||||||
|
for (TransactionStatus status : transactionStatuses) {
|
||||||
|
if (!status.isCompleted()) {
|
||||||
|
transactionManager.commit(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,10 @@
|
||||||
m.contacts station_contacts,
|
m.contacts station_contacts,
|
||||||
m.phone station_phone,
|
m.phone station_phone,
|
||||||
a.contacts,
|
a.contacts,
|
||||||
|
a.check_time,
|
||||||
|
a.assignment_trans_time,
|
||||||
|
a.assignment_driver_time,
|
||||||
|
a.driver_confirm_time,
|
||||||
a.phone,
|
a.phone,
|
||||||
a.expect_time,
|
a.expect_time,
|
||||||
a.estimated_quantity,
|
a.estimated_quantity,
|
||||||
|
|
@ -132,8 +136,8 @@
|
||||||
e.qualification_date truck_qualification_date,
|
e.qualification_date truck_qualification_date,
|
||||||
f.licence_start_time driver_licence_start_time,
|
f.licence_start_time driver_licence_start_time,
|
||||||
f.licence_end_time driver_licence_end_time,
|
f.licence_end_time driver_licence_end_time,
|
||||||
j.license_start_time trans_license_start_time,
|
j.license_start_time,
|
||||||
j.license_end_time trans_license_start_time,
|
j.license_end_time,
|
||||||
g.idcard trans_idcard,
|
g.idcard trans_idcard,
|
||||||
g.idcard_start_time trans_idcard_start_time,
|
g.idcard_start_time trans_idcard_start_time,
|
||||||
g.idcard_end_time trans_idcard_end_time
|
g.idcard_end_time trans_idcard_end_time
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue