master
parent
68ca14ecf9
commit
f02e93e8df
|
|
@ -44,7 +44,7 @@ public class AccessDeniedExceptionHandler implements AccessDeniedHandler {
|
|||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
} else {
|
||||
log.error("暂无权限: {}", request.getRequestURI(), accessDeniedException);
|
||||
r = R.failed(ExceptionMsg.CLI_ERR_MSG, accessDeniedException.getMessage());
|
||||
r = R.failed(ExceptionMsg.CLI_ERR_MSG, "暂无权限");
|
||||
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
}
|
||||
ServletUtil.write(response, Jackson.toJsonStr(r), Mime.u8Val(Mime.JSON));
|
||||
|
|
|
|||
|
|
@ -38,6 +38,15 @@ public class OrderPagingResult {
|
|||
* 订单 Id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 对方站点 Id; 短驳单有值
|
||||
*/
|
||||
private Long targetStationId;
|
||||
|
||||
/**
|
||||
* 对方订单 Id; 短驳单有值
|
||||
*/
|
||||
private Long targetOrderId;
|
||||
/**
|
||||
* 准运证编号
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ public class OrderCarInOutService extends ServiceImpl<OrderCarInOutMapper, Order
|
|||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public long truckComing(TruckComingOrderParam truckComingOrderParam, OrderCategory orderCategory) {
|
||||
Integer weight = truckComingOrderParam.getWeight();
|
||||
Assert.isTrue(weight != null && weight > 0, () -> Exceptions.clierr("磅重错误"));
|
||||
Integer roughWeight = null;
|
||||
Integer tareWeight = null;
|
||||
if (orderCategory == OrderCategory.DuanBoChu) {
|
||||
|
|
@ -94,24 +96,27 @@ public class OrderCarInOutService extends ServiceImpl<OrderCarInOutMapper, Order
|
|||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer truckOut(Long carInOutId, TruckLeavingOrderParam truckLeavingOrderParam, OrderCategory orderCategory, Long truckId) {
|
||||
Integer weight = truckLeavingOrderParam.getWeight();
|
||||
Assert.isTrue(weight != null && weight > 0, () -> Exceptions.clierr("磅重错误"));
|
||||
|
||||
OrderCarInOutEntity orderCarInOutEntity = this.getById(carInOutId);
|
||||
Integer roughWeight = null;
|
||||
Integer tareWeight = null;
|
||||
Integer settleWeight = null;
|
||||
Integer roughWeight__ = orderCarInOutEntity.getRoughWeight();
|
||||
if (roughWeight__ == null) {
|
||||
/*Integer roughWeight__ = orderCarInOutEntity.getRoughWeight();
|
||||
if (roughWeight__ == null) {
|
||||
BizTruckEntity bizTruckEntity = bizTruckService.getById(truckId);
|
||||
Integer truckTareWeight = bizTruckEntity.getTareWeight();
|
||||
Assert.notNull(truckTareWeight, () -> Exceptions.exception("{} 车辆暂无皮重", bizTruckEntity.getLicensePlate()));
|
||||
orderCarInOutEntity.setRoughWeight(truckTareWeight);
|
||||
roughWeight__ = truckTareWeight;
|
||||
}
|
||||
} */
|
||||
if (orderCategory == OrderCategory.DuanBoChu) {
|
||||
roughWeight = truckLeavingOrderParam.getWeight();
|
||||
settleWeight = roughWeight - roughWeight__;
|
||||
roughWeight = weight;
|
||||
settleWeight = roughWeight - orderCarInOutEntity.getTareWeight();
|
||||
} else {
|
||||
tareWeight = truckLeavingOrderParam.getWeight();
|
||||
settleWeight = roughWeight__ - tareWeight;
|
||||
tareWeight = weight;
|
||||
settleWeight = orderCarInOutEntity.getRoughWeight() - tareWeight;
|
||||
}
|
||||
Integer roughWeight_ = roughWeight;
|
||||
Integer tareWeight_ = tareWeight;
|
||||
|
|
|
|||
|
|
@ -137,8 +137,10 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
|
||||
Long orderGoodsId = orderGoodsService.add(goodsId, null);
|
||||
|
||||
orderSn = orderSn == null ? SnUtil.next() : orderSn;
|
||||
OrderCategory orderCategory = addOrderInfoParam.getOrderCategory();
|
||||
OrderInfoEntity orderInfoEntity = BeanUtil.copyProperties(addOrderInfoParam, OrderInfoEntity.class)
|
||||
.setSn(orderSn == null ? SnUtil.next() : orderSn)
|
||||
.setSn(orderCategory == OrderCategory.DuanBoChu ? orderSn + "-1" : orderSn)
|
||||
.setCargoPlaceId(cargoPlaceId)
|
||||
.setUserId(userId)
|
||||
.setOrderStatus(orderStatus)
|
||||
|
|
@ -151,13 +153,14 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
settleForTransCompany(this.getById(orderInfoEntity.getId()), entity);
|
||||
|
||||
Long orderId = orderInfoEntity.getId();
|
||||
OrderCategory orderCategory = addOrderInfoParam.getOrderCategory();
|
||||
if (orderCategory == OrderCategory.DuanBoChu) {
|
||||
Long stationId = addOrderInfoParam.getStationId();
|
||||
Long targetStationId = addOrderInfoParam.getTargetStationId();
|
||||
this.add(addOrderInfoParam.setOrderCategory(OrderCategory.DuanBoRu)
|
||||
.setTargetOrderId(orderId)
|
||||
.setTargetStationId(addOrderInfoParam.getStationId())
|
||||
.setStationId(addOrderInfoParam.getTargetStationId()),
|
||||
null);
|
||||
.setTargetStationId(stationId)
|
||||
.setStationId(targetStationId),
|
||||
orderSn + "-2");
|
||||
|
||||
} else if (orderCategory == OrderCategory.DuanBoRu) {
|
||||
this.updateById(new OrderInfoEntity().setId(addOrderInfoParam.getTargetOrderId())
|
||||
|
|
@ -273,12 +276,14 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
BizObj bizObj = userDetail.getBizObj();
|
||||
if (BizObj.isTrans(bizObj)) {
|
||||
ew
|
||||
.in("a.order_category", OrderCategory.PuTong, OrderCategory.DuanBoChu)
|
||||
.in("a.order_status", OrderStatus.DaiPaiDan, OrderStatus.DaiJieDan)
|
||||
.eq("g.user_id", userId);
|
||||
return;
|
||||
}
|
||||
if (BizObj.isDriver(bizObj)) {
|
||||
ew
|
||||
.in("a.order_category", OrderCategory.PuTong, OrderCategory.DuanBoChu)
|
||||
.eq("a.order_status", OrderStatus.DaiJieDan)
|
||||
.eq("f.user_id", userId);
|
||||
return;
|
||||
|
|
@ -499,6 +504,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
.like(StrUtil.isNotBlank(licensePlate), "e.license_plate", licensePlate)
|
||||
.ge(startTime != null, "e.create_time", startTime)
|
||||
.le(endTime != null, "e.create_time", endTime)
|
||||
.in("a.order_category", OrderCategory.PuTong, OrderCategory.DuanBoChu)
|
||||
;
|
||||
|
||||
if (auditStatus != null) {
|
||||
|
|
@ -619,6 +625,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
certificateSn = SnUtil.next(CERTIFICATE_SN_CODE);
|
||||
checkStatus = CheckStatus.WeiKanLiao;
|
||||
}
|
||||
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(detail.getId())
|
||||
.setAuditStatus(auditStatus)
|
||||
|
|
@ -631,6 +638,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
.setCheckStatus(checkStatus)
|
||||
.setAuditMemo(auditOrderParam.getAuditMemo())
|
||||
);
|
||||
OrderCategory orderCategory = detail.getOrderCategory();
|
||||
if (orderCategory == OrderCategory.DuanBoRu) return;
|
||||
// auditStatus为市待审核状态通知市,通过状态通知司机
|
||||
try {
|
||||
TemplateMessageParam param = new TemplateMessageParam();
|
||||
|
|
@ -719,6 +728,15 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
}
|
||||
baseMapper.busyDriver(driverId, Boolean.TRUE);
|
||||
|
||||
OrderCategory orderCategory = orderInfo.getOrderCategory();
|
||||
if (orderCategory == OrderCategory.DuanBoChu) {
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(orderInfo.getTargetOrderId())
|
||||
.setDriverId(driverId)
|
||||
.setAssignmentDriverTime(LocalDateTime.now())
|
||||
.setOrderStatus(OrderStatus.DaiJieDan));
|
||||
}
|
||||
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(orderInfo.getId())
|
||||
.setDriverId(driverId)
|
||||
|
|
@ -1136,12 +1154,16 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
|
||||
OrderCategory orderCategory = orderInfoEntity.getOrderCategory();
|
||||
long carInOutId = orderCarInOutService.truckComing(truckComingOrderParam, orderCategory);
|
||||
|
||||
CheckStatus checkStatus = null;
|
||||
if (orderInfoEntity.getOrderCategory() == OrderCategory.DuanBoChu) {
|
||||
checkStatus = CheckStatus.YiKanLiao;
|
||||
}
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setAutoOrder(3 ^ i)
|
||||
.setId(orderInfoEntity.getId())
|
||||
.setCarInOutId(carInOutId)
|
||||
.setOrderStatus(OrderStatus.YiJinChang)
|
||||
.setCheckStatus(checkStatus)
|
||||
);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
|
|
@ -1167,7 +1189,8 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean truckLeaving(TruckLeavingOrderParam truckLeavingOrderParam, int i) {
|
||||
OrderInfoEntity orderInfoEntity = this.getById(truckLeavingOrderParam.getOrderId());
|
||||
Long orderId = truckLeavingOrderParam.getOrderId();
|
||||
OrderInfoEntity orderInfoEntity = this.getById(orderId);
|
||||
Long truckId = orderInfoEntity.getTruckId();
|
||||
try {
|
||||
Assert.notNull(orderInfoEntity, () -> Exceptions.clierr("订单不存在"));
|
||||
|
|
@ -1185,11 +1208,9 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
if (MoneyWay.OUT.getVal().equals(entity.getMoneyWay())) {
|
||||
// 计算费用,出厂付费可能需要称重,需要更新付费项
|
||||
updateOrderItems(orderInfoEntity.getId(), orderInfoEntity.getTransCompanyId(), settleWeight, Boolean.FALSE);
|
||||
orderInfoEntity = this.getById(truckLeavingOrderParam.getOrderId());
|
||||
orderInfoEntity = this.getById(orderId);
|
||||
}
|
||||
|
||||
baseMapper.busyDriver(orderInfoEntity.getDriverId(), Boolean.FALSE);
|
||||
baseMapper.busyTruck(orderInfoEntity.getTruckId(), Boolean.FALSE);
|
||||
PaymentStatus paymentStatus = orderInfoEntity.getPaymentStatus();
|
||||
|
||||
OrderStatus newOrderStatus = paymentStatus == PaymentStatus.WeiZhiFu ? OrderStatus.YiChuChang : OrderStatus.YiWanCheng;
|
||||
|
|
@ -1198,6 +1219,41 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
.setId(orderInfoEntity.getId())
|
||||
.setOrderStatus(newOrderStatus)
|
||||
);
|
||||
|
||||
if (orderInfoEntity.getOrderCategory() == OrderCategory.DuanBoChu) {
|
||||
Long targetOrderId = orderInfoEntity.getTargetOrderId();
|
||||
|
||||
this.updateById(new OrderInfoEntity()
|
||||
.setId(targetOrderId)
|
||||
// 接单
|
||||
.setDriverConfirmTime(orderInfoEntity.getDriverConfirmTime())
|
||||
.setTruckId(truckId)
|
||||
|
||||
// 审核
|
||||
.setAuditStatus(orderInfoEntity.getAuditStatus())
|
||||
.setQuAuditUserId(orderInfoEntity.getQuAuditUserId())
|
||||
.setShiAuditUserId(orderInfoEntity.getShiAuditUserId())
|
||||
.setQuAuditPicture(orderInfoEntity.getQuAuditPicture())
|
||||
.setShiAuditPicture(orderInfoEntity.getShiAuditPicture())
|
||||
.setCertificateSn(orderInfoEntity.getCertificateSn())
|
||||
.setAuditTime(orderInfoEntity.getAuditTime())
|
||||
.setCheckStatus(CheckStatus.WeiKanLiao)
|
||||
.setAuditMemo(orderInfoEntity.getAuditMemo())
|
||||
// 开始清运
|
||||
.setCargoPhoto(orderInfoEntity.getCargoPhoto())
|
||||
.setOrderStatus(OrderStatus.QingYunZhong)
|
||||
.setTransTime(orderInfoEntity.getTransTime())
|
||||
);
|
||||
if (MoneyWay.IN.getVal().equals(entity.getMoneyWay())) {
|
||||
// 入场付费无称重,不需要更新付费项
|
||||
// 处理公司支付
|
||||
handleCompanyPay(this.getById(targetOrderId), Boolean.TRUE, new BigDecimal("0"), Boolean.FALSE);
|
||||
}
|
||||
} else {
|
||||
baseMapper.busyDriver(orderInfoEntity.getDriverId(), Boolean.FALSE);
|
||||
baseMapper.busyTruck(orderInfoEntity.getTruckId(), Boolean.FALSE);
|
||||
}
|
||||
|
||||
// 计算本单净重(或结算重量),作为结算时的数量依据
|
||||
|
||||
OrderInfoEntity orderInfoEntity_ = orderInfoEntity;
|
||||
|
|
@ -1225,10 +1281,12 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
}
|
||||
|
||||
} finally {
|
||||
// 关闭 GPS
|
||||
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
|
||||
String gpsId = truckInfo.getGps();
|
||||
stopTrack(gpsId);
|
||||
if (orderInfoEntity.getOrderCategory() != OrderCategory.DuanBoChu) {
|
||||
// 关闭 GPS
|
||||
BizTruckEntity truckInfo = baseMapper.getTruckInfo(truckId);
|
||||
String gpsId = truckInfo.getGps();
|
||||
stopTrack(gpsId);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1617,7 +1675,7 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
|||
orderSn = SnUtil.next();
|
||||
}
|
||||
for (int i = 0; i < truckCount; i++) {
|
||||
add(addOrderInfoParam, orderSn == null ? null : orderSn + "-" + (i + 1));
|
||||
add(addOrderInfoParam, orderSn == null ? null : (orderSn + "-" + (i + 1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.njzscloud.supervisory.biz.constant.BizObj;
|
|||
import com.njzscloud.supervisory.biz.pojo.entity.BizAuditConfigEntity;
|
||||
import com.njzscloud.supervisory.biz.service.BizAuditConfigService;
|
||||
import com.njzscloud.supervisory.order.contant.CheckStatus;
|
||||
import com.njzscloud.supervisory.order.contant.OrderCategory;
|
||||
import com.njzscloud.supervisory.order.contant.OrderStatus;
|
||||
import com.njzscloud.supervisory.order.pojo.result.OrderPagingResult;
|
||||
import com.njzscloud.supervisory.station.pojo.entity.StationManageEntity;
|
||||
|
|
@ -102,8 +103,9 @@ public class StationLetterServiceImpl implements StationLetterService {
|
|||
sjAudit.setAuditName("司机待接单");
|
||||
if (BizObj.isDriver(bizObj)) {
|
||||
QueryWrapper<OrderPagingResult> queryWrapper = Wrappers.query();
|
||||
queryWrapper.eq("a.order_status", OrderStatus.DaiJieDan);
|
||||
queryWrapper.eq("f.user_id", userId);
|
||||
queryWrapper.eq("a.order_status", OrderStatus.DaiJieDan)
|
||||
.in("a.order_category", OrderCategory.DuanBoRu, OrderCategory.PuTong)
|
||||
.eq("f.user_id", userId);
|
||||
int sjOrderCount = stationLetterMapper.selectPendingOrderCount(queryWrapper);
|
||||
sjAudit.setCount(sjOrderCount);
|
||||
} else {
|
||||
|
|
@ -117,8 +119,9 @@ public class StationLetterServiceImpl implements StationLetterService {
|
|||
transAudit.setAuditName("清运公司待派单");
|
||||
if (BizObj.isTrans(bizObj)) {
|
||||
QueryWrapper<OrderPagingResult> queryWrapper = Wrappers.query();
|
||||
queryWrapper.in("a.order_status", OrderStatus.DaiPaiDan, OrderStatus.DaiJieDan);
|
||||
queryWrapper.eq("g.user_id", userId);
|
||||
queryWrapper.in("a.order_status", OrderStatus.DaiPaiDan, OrderStatus.DaiJieDan)
|
||||
.in("a.order_category", OrderCategory.DuanBoRu, OrderCategory.PuTong)
|
||||
.eq("g.user_id", userId);
|
||||
int transOrderCount = stationLetterMapper.selectPendingOrderCount(queryWrapper);
|
||||
transAudit.setCount(transOrderCount);
|
||||
} else {
|
||||
|
|
@ -179,7 +182,8 @@ public class StationLetterServiceImpl implements StationLetterService {
|
|||
}
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<OrderPagingResult> queryWrapper = buildOrderQueryWrapper(auditAreaInfo);
|
||||
QueryWrapper<OrderPagingResult> queryWrapper = buildOrderQueryWrapper(auditAreaInfo)
|
||||
.in("a.order_category", OrderCategory.DuanBoRu, OrderCategory.PuTong);
|
||||
int orderCount = stationLetterMapper.selectPendingOrderCount(queryWrapper);
|
||||
orderAudit.setCount(orderCount);
|
||||
|
||||
|
|
@ -197,22 +201,22 @@ public class StationLetterServiceImpl implements StationLetterService {
|
|||
private AuditAreaInfo getAuditAreaInfoByRoles(Set<String> roles) {
|
||||
// 获取区级审核区域
|
||||
List<String> areaList = bizAuditConfigService.list(Wrappers.<BizAuditConfigEntity>lambdaQuery()
|
||||
.in(BizAuditConfigEntity::getAreaRole, roles)).stream()
|
||||
.in(BizAuditConfigEntity::getAreaRole, roles)).stream()
|
||||
.map(BizAuditConfigEntity::getArea)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取市级审核区域
|
||||
List<String> cityList = bizAuditConfigService.list(Wrappers.<BizAuditConfigEntity>lambdaQuery()
|
||||
.in(BizAuditConfigEntity::getCityRole, roles)).stream()
|
||||
.in(BizAuditConfigEntity::getCityRole, roles)).stream()
|
||||
.map(BizAuditConfigEntity::getArea)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取无角色限制的区域
|
||||
List<String> cityAreaList = bizAuditConfigService.list(Wrappers.<BizAuditConfigEntity>lambdaQuery()
|
||||
.isNull(BizAuditConfigEntity::getAreaRole)
|
||||
.isNull(BizAuditConfigEntity::getCityRole)).stream()
|
||||
.isNull(BizAuditConfigEntity::getAreaRole)
|
||||
.isNull(BizAuditConfigEntity::getCityRole)).stream()
|
||||
.map(BizAuditConfigEntity::getArea)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
<sql id="base_select">
|
||||
SELECT a.id,
|
||||
a.target_order_id,
|
||||
a.target_station_id,
|
||||
g.settlement_way,
|
||||
CASE g.settlement_way
|
||||
WHEN 'month' THEN '月结'
|
||||
|
|
|
|||
Loading…
Reference in New Issue