订单详情,指派司机修改
parent
14604dd5f8
commit
ff88dc70b8
|
|
@ -13,10 +13,9 @@ import lombok.Setter;
|
|||
public class DriverQueryParam {
|
||||
|
||||
/**
|
||||
* 是否删除; 0-->未删除、1-->已删除
|
||||
* 作为查询条件时,默认按未删除(0)处理
|
||||
* 是否忙碌
|
||||
*/
|
||||
private Boolean deleted;
|
||||
private Boolean busy;
|
||||
|
||||
/**
|
||||
* 司机姓名(模糊查询)
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, DriverEntity> i
|
|||
String driverName = queryParam.getDriverName();
|
||||
QueryWrapper<DriverEntity> ew = Wrappers.<DriverEntity>query()
|
||||
.eq("cd.deleted", Boolean.FALSE)
|
||||
.eq(queryParam.getBusy() != null, "cd.busy", queryParam.getBusy())
|
||||
.like(StrUtil.isNotBlank(driverName), "cd.driver_name", driverName);
|
||||
|
||||
return PageResult.of(baseMapper.paging(pageParam.toPage(), ew));
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.njzscloud.common.mp.support.PageParam;
|
|||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderEntity;
|
||||
import com.njzscloud.dispose.cst.order.pojo.param.*;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult;
|
||||
import com.njzscloud.dispose.cst.order.service.OrderService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -53,6 +54,14 @@ public class OrderController {
|
|||
return R.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情(小程序)
|
||||
*/
|
||||
@GetMapping("/miniDetail")
|
||||
public R<OrderResult> miniDetail(@RequestParam("id") Long id) {
|
||||
return R.success(orderService.miniDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class OrderTransController {
|
|||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public R<OrderTransEntity> detail(@RequestParam("id") Long id) {
|
||||
public R<OrderTransResult> detail(@RequestParam("id") Long id) {
|
||||
return R.success(orderTransService.detail(id));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderEntity;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderPaymentRecordResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收/销订单
|
||||
* @author ljw
|
||||
|
|
@ -17,6 +21,11 @@ public interface OrderMapper extends BaseMapper<OrderEntity> {
|
|||
IPage<SearchOrderResult> paging(IPage<SearchOrderResult> page, @Param("ew") QueryWrapper<Object> ew);
|
||||
|
||||
SearchOrderResult detail(@Param("id") Long id);
|
||||
|
||||
OrderResult miniDetail(@Param("id") Long id);
|
||||
|
||||
List<OrderPaymentRecordResult> getPaymentRecordByOrderId(@Param("orderId") Long orderId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.TransResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运输信息
|
||||
*
|
||||
|
|
@ -28,4 +31,6 @@ public interface OrderTransMapper extends BaseMapper<OrderTransEntity> {
|
|||
*/
|
||||
OrderTransResult getByLicensePlate(@Param("licensePlate") String licensePlate);
|
||||
|
||||
List<TransResult> getTransResultByOrderId(@Param("orderId") Long orderId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njzscloud.dispose.cst.customer.constant.SettlementWay;
|
||||
import com.njzscloud.dispose.cst.order.constant.PaymentStatus;
|
||||
import com.njzscloud.dispose.finance.constant.Payer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
|
@ -47,11 +46,6 @@ public class OrderPaymentRecordEntity {
|
|||
*/
|
||||
private Long transId;
|
||||
|
||||
/**
|
||||
* 付费方;字典代码:payer,PingTai-->平台、ChanFei-->产废方、YunShu-->运输方、XiaoNa-->消纳方、CaiGou-->采购方
|
||||
*/
|
||||
private Payer payer;
|
||||
|
||||
/**
|
||||
* 量
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ import java.util.List;
|
|||
@Accessors(chain = true)
|
||||
public class AssignmentDriverParam {
|
||||
/**
|
||||
* 订单Id
|
||||
* 订单Id 如果订单ID不为空,则把所有子订单给当前司机,orderId与orderTransId只能有一个有值
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 订单运输ID
|
||||
* 运输信息ID 不为空,则把指定的运输信息分配给司机,orderId与orderTransId只能有一个有值
|
||||
*/
|
||||
private List<Long> orderTransId;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.njzscloud.dispose.cst.order.pojo.param;
|
||||
|
||||
import com.njzscloud.dispose.cst.order.constant.PaymentStatus;
|
||||
import com.njzscloud.dispose.finance.constant.Payer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
|
@ -33,11 +32,6 @@ public class SearchOrderPaymentRecordParam {
|
|||
*/
|
||||
private Long transId;
|
||||
|
||||
/**
|
||||
* 付费方
|
||||
*/
|
||||
private Payer payer;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.njzscloud.dispose.cst.order.pojo.result;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 付费记录
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class OrderPaymentRecordResult {
|
||||
|
||||
/**
|
||||
* 付费项名称
|
||||
*/
|
||||
private String expenseItemName;
|
||||
|
||||
/**
|
||||
* 结算金额;单位:元
|
||||
*/
|
||||
private BigDecimal totalSettleMoney;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.njzscloud.dispose.cst.order.pojo.result;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运输信息
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Data
|
||||
public class OrderResult {
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 订单创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 产品图片
|
||||
*/
|
||||
private String picture;
|
||||
|
||||
/**
|
||||
* 预估量
|
||||
*/
|
||||
private Integer estimatedQuantity;
|
||||
|
||||
/**
|
||||
* 订单付费项统计
|
||||
*/
|
||||
private List<OrderPaymentRecordResult> orderPaymentRecordList;
|
||||
|
||||
/**
|
||||
* 合计金额
|
||||
*/
|
||||
private BigDecimal settleMoney;
|
||||
|
||||
/**
|
||||
* 产废组织名称
|
||||
*/
|
||||
private String cfOrgName;
|
||||
|
||||
/**
|
||||
* 产废联系人姓名
|
||||
*/
|
||||
private String contacts;
|
||||
|
||||
/**
|
||||
* 产废联系方式
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 产废地址
|
||||
*/
|
||||
private String cfAddress;
|
||||
|
||||
/**
|
||||
* 清运组织名称
|
||||
*/
|
||||
private String transOrgName;
|
||||
|
||||
/**
|
||||
* 清运联系人姓名
|
||||
*/
|
||||
private String transContacts;
|
||||
|
||||
/**
|
||||
* 清运联系方式
|
||||
*/
|
||||
private String transPhone;
|
||||
|
||||
/**
|
||||
* 清运公司地址
|
||||
*/
|
||||
private String transAddress;
|
||||
|
||||
/**
|
||||
* 总毛重;单位:千克
|
||||
*/
|
||||
private Integer totalRoughWeight;
|
||||
|
||||
/**
|
||||
* 总皮重;单位:千克
|
||||
*/
|
||||
private Integer totalTareWeight;
|
||||
|
||||
/**
|
||||
* 总净重;单位:千克
|
||||
*/
|
||||
private Integer totalSettleWeight;
|
||||
|
||||
/**
|
||||
* 运输信息
|
||||
*/
|
||||
private List<TransResult> transResultList;
|
||||
|
||||
/**
|
||||
* 站点名称
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 站点联系人姓名
|
||||
*/
|
||||
private String stationContacts;
|
||||
|
||||
/**
|
||||
* 站点联系方式
|
||||
*/
|
||||
private String stationPhone;
|
||||
|
||||
/**
|
||||
* 站点地址
|
||||
*/
|
||||
private String stationAddress;
|
||||
|
||||
}
|
||||
|
|
@ -228,6 +228,11 @@ public class OrderTransResult {
|
|||
*/
|
||||
private String goodsName;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String picture;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
package com.njzscloud.dispose.cst.order.pojo.result;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 运输信息
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Data
|
||||
public class TransResult {
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String truckLicensePlate;
|
||||
|
||||
/**
|
||||
* 司机姓名
|
||||
*/
|
||||
private String driverName;
|
||||
|
||||
/**
|
||||
* 司机手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 开始运输时间
|
||||
*/
|
||||
private LocalDateTime transTime;
|
||||
|
||||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
private LocalDateTime inTime;
|
||||
|
||||
/**
|
||||
* 出场时间
|
||||
*/
|
||||
private LocalDateTime outTime;
|
||||
|
||||
/**
|
||||
* 毛重;单位:千克
|
||||
*/
|
||||
private Integer roughWeight;
|
||||
|
||||
/**
|
||||
* 皮重;单位:千克
|
||||
*/
|
||||
private Integer tareWeight;
|
||||
|
||||
/**
|
||||
* 净重;单位:千克
|
||||
*/
|
||||
private Integer settleWeight;
|
||||
|
||||
}
|
||||
|
|
@ -65,7 +65,6 @@ public class OrderPaymentRecordService extends ServiceImpl<OrderPaymentRecordMap
|
|||
.eq(param.getOrderId() != null, OrderPaymentRecordEntity::getOrderId, param.getOrderId())
|
||||
.eq(param.getExpenseItemId() != null, OrderPaymentRecordEntity::getExpenseItemId, param.getExpenseItemId())
|
||||
.eq(param.getTransId() != null, OrderPaymentRecordEntity::getTransId, param.getTransId())
|
||||
.eq(param.getPayer() != null, OrderPaymentRecordEntity::getPayer, param.getPayer())
|
||||
.eq(param.getPaymentStatus() != null, OrderPaymentRecordEntity::getPaymentStatus, param.getPaymentStatus())));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ import com.njzscloud.dispose.cst.order.mapper.OrderMapper;
|
|||
import com.njzscloud.dispose.cst.order.mapper.OrderTransMapper;
|
||||
import com.njzscloud.dispose.cst.order.pojo.entity.*;
|
||||
import com.njzscloud.dispose.cst.order.pojo.param.*;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.*;
|
||||
import com.njzscloud.dispose.cst.project.pojo.entity.ProjectEntity;
|
||||
import com.njzscloud.dispose.cst.project.service.ProjectService;
|
||||
import com.njzscloud.dispose.cst.station.mapper.StationMapper;
|
||||
|
|
@ -111,9 +110,10 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
|
||||
// 运输信息
|
||||
int transNum = orderEntity.getEstimatedTrainNum();
|
||||
OrderTransEntity transEntity = new OrderTransEntity();
|
||||
transEntity.setOrderId(orderEntity.getId());
|
||||
OrderTransEntity transEntity;
|
||||
for (int i = 1; i <= transNum; i++) {
|
||||
transEntity = new OrderTransEntity();
|
||||
transEntity.setOrderId(orderEntity.getId());
|
||||
transEntity.setTrainNum(i);
|
||||
transEntity.setTransStatus(transOrgId == null ? null : TransStatus.DaiPaiDan);
|
||||
transEntity.setTransTime(transOrgId == null ? null : LocalDateTime.now());
|
||||
|
|
@ -137,6 +137,43 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
public OrderResult miniDetail(Long id) {
|
||||
OrderResult result = baseMapper.miniDetail(id);
|
||||
// 1.通过订单ID查询付费记录
|
||||
List<OrderPaymentRecordResult> recordResults = baseMapper.getPaymentRecordByOrderId(id);
|
||||
result.setOrderPaymentRecordList(recordResults);
|
||||
// 合计金额 = 付费记录中 totalSettleMoney 的和
|
||||
BigDecimal totalSettleMoney = recordResults.stream()
|
||||
.map(OrderPaymentRecordResult::getTotalSettleMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
result.setSettleMoney(totalSettleMoney);
|
||||
|
||||
// 2.通过订单ID查询运输信息
|
||||
List<TransResult> transResults = orderTransMapper.getTransResultByOrderId(id);
|
||||
result.setTransResultList(transResults);
|
||||
// 总毛重 = 运输信息中毛重的和
|
||||
Integer totalRoughWeight = transResults.stream()
|
||||
.map(TransResult::getRoughWeight)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(0, Integer::sum);
|
||||
result.setTotalRoughWeight(totalRoughWeight);
|
||||
// 总皮重 = 运输信息中皮重的和
|
||||
Integer totalTareWeight = transResults.stream()
|
||||
.map(TransResult::getTareWeight)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(0, Integer::sum);
|
||||
result.setTotalTareWeight(totalTareWeight);
|
||||
// 总净重 = 运输信息中净重的和
|
||||
Integer totalSettleWeight = transResults.stream()
|
||||
.map(TransResult::getSettleWeight)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(0, Integer::sum);
|
||||
result.setTotalSettleWeight(totalSettleWeight);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public SearchOrderResult detail(Long id, String orderType) {
|
||||
SearchOrderResult detail = baseMapper.detail(id);
|
||||
if (detail == null) return null;
|
||||
|
|
@ -314,17 +351,40 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void assignmentDriver(AssignmentDriverParam driverParam) {
|
||||
Assert.notNull(driverParam, () -> Exceptions.clierr("请填写参数"));
|
||||
Assert.notNull(driverParam.getOrderTransId(), () -> Exceptions.clierr("订单运输ID不可为空"));
|
||||
Assert.notNull(driverParam.getDriverId(), () -> Exceptions.clierr("司机Id不可为空"));
|
||||
|
||||
OrderTransResult result = orderTransMapper.getById(driverParam.getOrderTransId());
|
||||
Assert.notNull(result, () -> Exceptions.clierr("订单不存在"));
|
||||
Assert.isNull(result.getDriverId(), () -> Exceptions.clierr("当前订单已分配司机,无需重复分配"));
|
||||
Assert.isTrue(TransStatus.DaiPaiDan.equals(result.getTransStatus()), () -> Exceptions.clierr("当前订单状态,无法分配司机"));
|
||||
// orderId 与 orderTransId 只能有一个有值
|
||||
Long orderId = driverParam.getOrderId();
|
||||
List<Long> orderTransIdList = driverParam.getOrderTransId();
|
||||
boolean hasOrderId = orderId != null;
|
||||
boolean hasOrderTransIds = orderTransIdList != null && !orderTransIdList.isEmpty();
|
||||
Assert.isTrue(hasOrderId ^ hasOrderTransIds, () -> Exceptions.clierr("orderId与orderTransId只能有一个有值"));
|
||||
|
||||
// 获取订单的所有运输记录
|
||||
// 根据参数获取运输信息列表
|
||||
List<OrderTransEntity> transEntityList;
|
||||
if (hasOrderId) {
|
||||
// 如果orderId不为空,查询该订单下所有待派单的运输信息
|
||||
transEntityList = orderTransMapper.selectList(Wrappers.<OrderTransEntity>lambdaQuery()
|
||||
.eq(OrderTransEntity::getOrderId, orderId)
|
||||
.eq(OrderTransEntity::getTransStatus, TransStatus.DaiPaiDan));
|
||||
Assert.notEmpty(transEntityList, () -> Exceptions.clierr("该订单下没有待派单的运输信息"));
|
||||
} else {
|
||||
// 如果orderTransId不为空,查询指定的运输信息
|
||||
transEntityList = orderTransMapper.selectList(Wrappers.<OrderTransEntity>lambdaQuery()
|
||||
.in(OrderTransEntity::getId, orderTransIdList)
|
||||
.eq(OrderTransEntity::getTransStatus, TransStatus.DaiPaiDan));
|
||||
Assert.notEmpty(transEntityList, () -> Exceptions.clierr("没有找到待派单的运输信息"));
|
||||
}
|
||||
|
||||
// 校验司机信息
|
||||
DriverEntity driver = driverMapper.selectById(driverParam.getDriverId());
|
||||
Assert.notNull(driver, () -> Exceptions.clierr("司机不存在"));
|
||||
|
||||
// 遍历每个运输信息进行校验和更新
|
||||
for (OrderTransEntity transEntity : transEntityList) {
|
||||
// 获取当前运输信息的所有付费记录
|
||||
List<OrderPaymentRecordEntity> recordList = orderPaymentRecordService.list(Wrappers.<OrderPaymentRecordEntity>lambdaQuery()
|
||||
.eq(OrderPaymentRecordEntity::getTransId, result.getId()));
|
||||
.eq(OrderPaymentRecordEntity::getTransId, transEntity.getId()));
|
||||
for (OrderPaymentRecordEntity record : recordList) {
|
||||
if (SettlementWay.YuE.equals(record.getSettlementWay())) {
|
||||
MoneyAccountResult accountResult = moneyAccountMapper.detail(record.getPayerMoneyAccountId());
|
||||
|
|
@ -337,20 +397,18 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
}
|
||||
}
|
||||
|
||||
DriverEntity driver = driverMapper.selectById(driverParam.getDriverId());
|
||||
Assert.notNull(driver, () -> Exceptions.clierr("司机不存在"));
|
||||
|
||||
// 更新运输信息表 cst_trans_order 的运输状态等信息
|
||||
OrderTransEntity transEntity = new OrderTransEntity();
|
||||
transEntity.setId(driverParam.getOrderTransId());
|
||||
transEntity.setTransStatus(TransStatus.DaiJieDan);
|
||||
transEntity.setAssignmentDriverTime(LocalDateTime.now());
|
||||
transEntity.setDriverId(driverParam.getDriverId());
|
||||
transEntity.setDriverCustomerId(driver.getCustomerId());
|
||||
transEntity.setDriverUserId(driver.getUserId());
|
||||
orderTransMapper.updateById(transEntity);
|
||||
OrderTransEntity updateTrans = new OrderTransEntity();
|
||||
updateTrans.setId(transEntity.getId());
|
||||
updateTrans.setTransStatus(TransStatus.DaiJieDan);
|
||||
updateTrans.setAssignmentDriverTime(LocalDateTime.now());
|
||||
updateTrans.setDriverId(driverParam.getDriverId());
|
||||
updateTrans.setDriverCustomerId(driver.getCustomerId());
|
||||
updateTrans.setDriverUserId(driver.getUserId());
|
||||
orderTransMapper.updateById(updateTrans);
|
||||
}
|
||||
|
||||
// 更新司机状态
|
||||
// 更新司机状态(批量更新只需要一次)
|
||||
DriverEntity driverEntity = new DriverEntity();
|
||||
driverEntity.setId(driverParam.getDriverId());
|
||||
driverEntity.setBusy(Boolean.TRUE);
|
||||
|
|
|
|||
|
|
@ -50,16 +50,15 @@ public class OrderTransService extends ServiceImpl<OrderTransMapper, OrderTransE
|
|||
this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
public OrderTransEntity detail(Long id) {
|
||||
return this.getById(id);
|
||||
public OrderTransResult detail(Long id) {
|
||||
return baseMapper.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询,返回联表结果
|
||||
*/
|
||||
public PageResult<OrderTransResult> paging(PageParam pageParam, OrderTransQueryParam param) {
|
||||
QueryWrapper<OrderTransResult> ew = Wrappers.<OrderTransResult>query()
|
||||
.eq("cot.deleted", Boolean.FALSE);
|
||||
QueryWrapper<OrderTransResult> ew = Wrappers.query();
|
||||
if (param != null) {
|
||||
ew.ge(param.getOrderTimeStart() != null, "co.order_time", param.getOrderTimeStart())
|
||||
.le(param.getOrderTimeEnd() != null, "co.order_time", param.getOrderTimeEnd())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.njzscloud.dispose.goods.pojo.result;
|
||||
|
||||
import com.njzscloud.common.core.ienum.DictItem;
|
||||
import com.njzscloud.common.core.ienum.DictKey;
|
||||
import com.njzscloud.dispose.finance.constant.Unit;
|
||||
import com.njzscloud.dispose.finance.pojo.result.SearchExpenseItemResult;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
|
@ -54,8 +53,7 @@ public class SearchGoodsResult {
|
|||
/**
|
||||
* 计量单位;字典代码:unit
|
||||
*/
|
||||
@DictKey("unit")
|
||||
private DictItem unit;
|
||||
private Unit unit;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
|
|
|
|||
|
|
@ -63,6 +63,51 @@
|
|||
FROM cst_order
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="miniDetail" resultType="com.njzscloud.dispose.cst.order.pojo.result.OrderResult">
|
||||
SELECT
|
||||
co.id,
|
||||
co.sn,
|
||||
co.create_time,
|
||||
gg.goods_name,
|
||||
gg.picture,
|
||||
co.estimated_quantity,
|
||||
cfco.org_name AS cf_org_name,
|
||||
co.contacts,
|
||||
co.phone,
|
||||
CONCAT(cocp.province_name,cocp.city_name,cocp.area_name,cocp.town_name,cocp.address) AS cf_address,
|
||||
tco.org_name AS trans_org_name,
|
||||
tcc.customer_name AS trans_contacts,
|
||||
tcc.phone AS trans_phone,
|
||||
CONCAT(tco.province_name,tco.city_name,tco.area_name,tco.town_name,tco.address) AS trans_address,
|
||||
co.station_name,
|
||||
scc.customer_name AS station_contacts,
|
||||
scc.phone AS station_phone,
|
||||
CONCAT(cs.province_name,cs.city_name,cs.area_name,cs.town_name,cs.address) AS station_address
|
||||
FROM
|
||||
cst_order co
|
||||
LEFT JOIN gds_goods gg ON gg.id = co.goods_id
|
||||
LEFT JOIN cst_customer cfcc ON cfcc.id = co.customer_id
|
||||
LEFT JOIN cst_org cfco ON cfco.id = cfcc.org_id
|
||||
LEFT JOIN cst_order_cargo_place cocp ON cocp.order_id = co.id
|
||||
LEFT JOIN cst_customer tcc ON tcc.id = co.trans_customer_id
|
||||
LEFT JOIN cst_org tco ON tco.id = co.trans_org_id
|
||||
LEFT JOIN cst_station cs ON cs.id = co.station_id
|
||||
LEFT JOIN cst_customer scc ON scc.org_id = cs.org_id and scc.manager = 1 and scc.deleted = 0
|
||||
WHERE co.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getPaymentRecordByOrderId" resultType="com.njzscloud.dispose.cst.order.pojo.result.OrderPaymentRecordResult">
|
||||
SELECT
|
||||
coei.expense_item_name,
|
||||
SUM(copr.settle_money) AS total_settle_money
|
||||
FROM
|
||||
cst_order_payment_record copr
|
||||
LEFT JOIN cst_order_expense_items coei ON coei.id = copr.expense_item_id
|
||||
WHERE copr.order_id = #{orderId}
|
||||
GROUP BY coei.origin_expense_items_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<result column="goods_sn" property="goodsSn"/>
|
||||
<result column="estimated_quantity" property="estimatedQuantity"/>
|
||||
<result column="unit" property="unit"/>
|
||||
<result column="picture" property="picture"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
|
|
@ -97,6 +98,7 @@
|
|||
co.unit,
|
||||
gg.goods_category_id,
|
||||
gg.sn AS goods_sn,
|
||||
gg.picture,
|
||||
ggc.category_name AS goods_category_name
|
||||
</sql>
|
||||
|
||||
|
|
@ -131,8 +133,25 @@
|
|||
LEFT JOIN gds_goods_category ggc on ggc.id = gg.goods_category_id
|
||||
WHERE cot.truck_license_plate = #{licensePlate}
|
||||
AND cot.trans_status IN ('YunShuZhong', 'YiJinChang')
|
||||
AND cot.deleted = 0
|
||||
ORDER BY cot.create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getTransResultByOrderId" resultType="com.njzscloud.dispose.cst.order.pojo.result.TransResult">
|
||||
SELECT
|
||||
cot.truck_license_plate,
|
||||
cd.driver_name,
|
||||
cd.phone,
|
||||
cot.trans_time,
|
||||
cot.in_time,
|
||||
cot.out_time,
|
||||
cot.rough_weight,
|
||||
cot.tare_weight,
|
||||
cot.settle_weight
|
||||
FROM
|
||||
cst_order_trans cot
|
||||
LEFT JOIN cst_driver cd ON cd.id = cot.driver_id
|
||||
WHERE cot.order_id = #{orderId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue