订单详情

master
lzq 2026-02-10 10:23:45 +08:00
parent baf33cec58
commit 14604dd5f8
5 changed files with 79 additions and 6 deletions

View File

@ -57,8 +57,8 @@ public class OrderController {
* *
*/ */
@GetMapping("/detail") @GetMapping("/detail")
public R<OrderEntity> detail(@RequestParam("id") Long id) { public R<SearchOrderResult> detail(@RequestParam("id") Long id, @RequestParam(value = "orderType", required = false) String orderType) {
return R.success(orderService.detail(id)); return R.success(orderService.detail(id, orderType));
} }
/** /**

View File

@ -15,6 +15,8 @@ import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface OrderMapper extends BaseMapper<OrderEntity> { public interface OrderMapper extends BaseMapper<OrderEntity> {
IPage<SearchOrderResult> paging(IPage<SearchOrderResult> page, @Param("ew") QueryWrapper<Object> ew); IPage<SearchOrderResult> paging(IPage<SearchOrderResult> page, @Param("ew") QueryWrapper<Object> ew);
SearchOrderResult detail(@Param("id") Long id);
} }

View File

@ -5,6 +5,8 @@ import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.List;
/** /**
* @author ljw * @author ljw
*/ */
@ -13,11 +15,15 @@ import lombok.experimental.Accessors;
@ToString @ToString
@Accessors(chain = true) @Accessors(chain = true)
public class AssignmentDriverParam { public class AssignmentDriverParam {
/**
* Id
*/
private Long orderId;
/** /**
* ID * ID
*/ */
private Long orderTransId; private List<Long> orderTransId;
/** /**
* Id * Id

View File

@ -137,8 +137,45 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
this.removeBatchByIds(ids); this.removeBatchByIds(ids);
} }
public OrderEntity detail(Long id) { public SearchOrderResult detail(Long id, String orderType) {
return this.getById(id); 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) { public PageResult<SearchOrderResult> paging(PageParam pageParam, SearchOrderParam searchOrderParam) {
@ -186,7 +223,7 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
List<SearchOrderResult> results = resultPage.getRecords(); List<SearchOrderResult> results = resultPage.getRecords();
if (results.isEmpty()) return PageResult.of(resultPage); if (results.isEmpty()) return PageResult.of(resultPage);
List<Long> orderIdList = results.stream().map(SearchOrderResult::getId).toList(); 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) List<SearchOrderResult.TransRecode> transRecodes = orderTransMapper.selectList(Wrappers.lambdaQuery(OrderTransEntity.class)
.in(OrderTransEntity::getOrderId, orderIdList) .in(OrderTransEntity::getOrderId, orderIdList)
.eq("YuYue".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.DaiPaiDan) .eq("YuYue".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.DaiPaiDan)

View File

@ -35,6 +35,34 @@
) temp ) temp
INNER JOIN cst_order a ON a.id = temp.id INNER JOIN cst_order a ON a.id = temp.id
</select> </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> </mapper>