订单详情
parent
baf33cec58
commit
14604dd5f8
|
|
@ -57,8 +57,8 @@ public class OrderController {
|
|||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public R<OrderEntity> detail(@RequestParam("id") Long id) {
|
||||
return R.success(orderService.detail(id));
|
||||
public R<SearchOrderResult> detail(@RequestParam("id") Long id, @RequestParam(value = "orderType", required = false) String orderType) {
|
||||
return R.success(orderService.detail(id, orderType));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import org.apache.ibatis.annotations.Param;
|
|||
@Mapper
|
||||
public interface OrderMapper extends BaseMapper<OrderEntity> {
|
||||
IPage<SearchOrderResult> paging(IPage<SearchOrderResult> page, @Param("ew") QueryWrapper<Object> ew);
|
||||
|
||||
SearchOrderResult detail(@Param("id") Long id);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import lombok.Setter;
|
|||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ljw
|
||||
*/
|
||||
|
|
@ -13,11 +15,15 @@ import lombok.experimental.Accessors;
|
|||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class AssignmentDriverParam {
|
||||
/**
|
||||
* 订单Id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 订单运输ID
|
||||
*/
|
||||
private Long orderTransId;
|
||||
private List<Long> orderTransId;
|
||||
|
||||
/**
|
||||
* 司机Id
|
||||
|
|
|
|||
|
|
@ -137,8 +137,45 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
public OrderEntity detail(Long id) {
|
||||
return this.getById(id);
|
||||
public SearchOrderResult detail(Long id, String orderType) {
|
||||
SearchOrderResult detail = baseMapper.detail(id);
|
||||
if (detail == null) return null;
|
||||
Long orderId = detail.getId();
|
||||
Long projectId = detail.getProjectId();
|
||||
List<SearchOrderResult.TransRecode> transRecodeList = orderTransMapper.selectList(Wrappers.lambdaQuery(OrderTransEntity.class)
|
||||
.eq(OrderTransEntity::getOrderId, orderId)
|
||||
.eq("YuYue".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.DaiPaiDan)
|
||||
.in("ShiShi".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.YiJieDan, TransStatus.YunShuZhong, TransStatus.YiJinChang, TransStatus.YiChuChang)
|
||||
.eq("LiShi".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.YiWanCheng)
|
||||
.eq("QuXiao".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.YiQuXiao)
|
||||
)
|
||||
.stream()
|
||||
.map(it -> BeanUtil.copyProperties(it, SearchOrderResult.TransRecode.class))
|
||||
.toList();
|
||||
|
||||
OrderCargoPlaceEntity cargoPlaceEntity = orderCargoPlaceService.getOne(Wrappers.lambdaQuery(OrderCargoPlaceEntity.class).eq(OrderCargoPlaceEntity::getOrderId, orderId));
|
||||
SearchOrderResult.CargoPlace cargoPlace = BeanUtil.copyProperties(cargoPlaceEntity, SearchOrderResult.CargoPlace.class);
|
||||
|
||||
SearchOrderResult.ProjectInfo projectInfo = null;
|
||||
if (projectId != null) {
|
||||
ProjectEntity projectEntity = projectService.getById(projectId);
|
||||
projectInfo = BeanUtil.copyProperties(projectEntity, SearchOrderResult.ProjectInfo.class);
|
||||
}
|
||||
|
||||
List<SearchOrderResult.PaymentRecord> paymentRecordResultList = orderPaymentRecordService.listPaymentRecord(Wrappers.query().eq("a.order_id", orderId))
|
||||
.stream()
|
||||
.map(it -> BeanUtil.copyProperties(it, SearchOrderResult.PaymentRecord.class))
|
||||
.toList();
|
||||
Map<Long, List<SearchOrderResult.PaymentRecord>> transId_paymentRecord_map = GroupUtil.k_a(paymentRecordResultList, SearchOrderResult.PaymentRecord::getTransId);
|
||||
|
||||
for (SearchOrderResult.TransRecode transRecode : transRecodeList) {
|
||||
Long transRecodeId = transRecode.getId();
|
||||
transRecode.setPaymentRecord(transId_paymentRecord_map.get(transRecodeId));
|
||||
}
|
||||
detail.setTransRecodes(transRecodeList);
|
||||
detail.setCargoPlace(cargoPlace);
|
||||
detail.setProjectInfo(projectInfo);
|
||||
return detail;
|
||||
}
|
||||
|
||||
public PageResult<SearchOrderResult> paging(PageParam pageParam, SearchOrderParam searchOrderParam) {
|
||||
|
|
@ -186,7 +223,7 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
|
|||
List<SearchOrderResult> results = resultPage.getRecords();
|
||||
if (results.isEmpty()) return PageResult.of(resultPage);
|
||||
List<Long> orderIdList = results.stream().map(SearchOrderResult::getId).toList();
|
||||
List<Long> projectIdList = results.stream().map(SearchOrderResult::getProjectId).toList();
|
||||
List<Long> projectIdList = results.stream().map(SearchOrderResult::getProjectId).filter(Objects::nonNull).toList();
|
||||
List<SearchOrderResult.TransRecode> transRecodes = orderTransMapper.selectList(Wrappers.lambdaQuery(OrderTransEntity.class)
|
||||
.in(OrderTransEntity::getOrderId, orderIdList)
|
||||
.eq("YuYue".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.DaiPaiDan)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,34 @@
|
|||
) temp
|
||||
INNER JOIN cst_order a ON a.id = temp.id
|
||||
</select>
|
||||
<select id="detail" resultType="com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult">
|
||||
SELECT id,
|
||||
sn,
|
||||
project_id,
|
||||
user_id,
|
||||
customer_id,
|
||||
contacts,
|
||||
phone,
|
||||
order_time,
|
||||
order_category,
|
||||
order_status,
|
||||
finish_time,
|
||||
trans_org_id,
|
||||
trans_customer_id,
|
||||
assignment_trans_time,
|
||||
station_id,
|
||||
station_name,
|
||||
trans_distance,
|
||||
estimated_quantity,
|
||||
estimated_train_num,
|
||||
goods_id,
|
||||
goods_name,
|
||||
unit,
|
||||
customer_memo,
|
||||
create_time
|
||||
FROM cst_order
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue