|
|
|
|
@ -1,19 +1,3 @@ |
|
|
|
|
/* |
|
|
|
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
|
|
|
* |
|
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
|
|
|
* modification, are permitted provided that the following conditions are met: |
|
|
|
|
* |
|
|
|
|
* Redistributions of source code must retain the above copyright notice, |
|
|
|
|
* this list of conditions and the following disclaimer. |
|
|
|
|
* Redistributions in binary form must reproduce the above copyright |
|
|
|
|
* notice, this list of conditions and the following disclaimer in the |
|
|
|
|
* documentation and/or other materials provided with the distribution. |
|
|
|
|
* Neither the name of the dreamlu.net developer nor the names of its |
|
|
|
|
* contributors may be used to endorse or promote products derived from |
|
|
|
|
* this software without specific prior written permission. |
|
|
|
|
* Author: Chill 庄骞 (smallchill@163.com) |
|
|
|
|
*/ |
|
|
|
|
package org.springblade.modules.capital.controller; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
@ -37,15 +21,12 @@ import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.modules.capital.dto.ApplyDTO; |
|
|
|
|
import org.springblade.modules.capital.dto.InOrderDTO; |
|
|
|
|
import org.springblade.modules.capital.entity.ApplyDetail; |
|
|
|
|
import org.springblade.modules.capital.entity.Goods; |
|
|
|
|
import org.springblade.modules.capital.entity.InOrderDetail; |
|
|
|
|
import org.springblade.modules.capital.entity.*; |
|
|
|
|
import org.springblade.modules.capital.service.IGoodsService; |
|
|
|
|
import org.springblade.modules.capital.service.IInOrderDetailService; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import org.springblade.modules.capital.entity.InOrder; |
|
|
|
|
import org.springblade.modules.capital.vo.InOrderVO; |
|
|
|
|
import org.springblade.modules.capital.excel.InOrderExcel; |
|
|
|
|
import org.springblade.modules.capital.service.IInOrderService; |
|
|
|
|
@ -83,16 +64,15 @@ public class InOrderController extends BladeController { |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "详情", notes = "传入inOrder") |
|
|
|
|
public R<InOrderDTO> detail(InOrder inOrder) { |
|
|
|
|
public R<InOrder> detail(InOrder inOrder) { |
|
|
|
|
InOrder detail = inOrderService.getById(inOrder.getId()); |
|
|
|
|
InOrderDTO inOrderDTO = BeanUtil.copy(detail, InOrderDTO.class); |
|
|
|
|
if (inOrderDTO != null) { |
|
|
|
|
inOrderDTO.setInUserName(inOrderDTO.getInUserId() != null ? UserCache.getUser(inOrderDTO.getInUserId()).getRealName() : ""); |
|
|
|
|
inOrderDTO.setApproveUserName(inOrderDTO.getApproveUserId() != null ? UserCache.getUser(inOrderDTO.getApproveUserId()).getRealName() : ""); |
|
|
|
|
inOrderDTO.setApplyUserName(inOrderDTO.getApplyUserId() != null ? UserCache.getUser(inOrderDTO.getApplyUserId()).getRealName() : ""); |
|
|
|
|
inOrderDTO.setDetails(iInOrderDetailService.list(Wrappers.lambdaQuery(InOrderDetail.class).eq(InOrderDetail::getOrderId, inOrderDTO.getId()))); |
|
|
|
|
if (detail != null) { |
|
|
|
|
detail.setInUserName(detail.getInUserId() != null ? UserCache.getUser(detail.getInUserId()).getRealName() : ""); |
|
|
|
|
detail.setApproveUserName(detail.getApproveUserId() != null ? UserCache.getUser(detail.getApproveUserId()).getRealName() : ""); |
|
|
|
|
detail.setApplyUserName(detail.getApplyUserId() != null ? UserCache.getUser(detail.getApplyUserId()).getRealName() : ""); |
|
|
|
|
detail.setDetails(iInOrderDetailService.list(Wrappers.lambdaQuery(InOrderDetail.class).eq(InOrderDetail::getOrderId, detail.getId()))); |
|
|
|
|
} |
|
|
|
|
return R.data(inOrderDTO); |
|
|
|
|
return R.data(detail); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -103,12 +83,18 @@ public class InOrderController extends BladeController { |
|
|
|
|
@ApiOperation(value = "分页", notes = "传入inOrder") |
|
|
|
|
public R<IPage<InOrder>> list(InOrderDTO inOrder, Query query) { |
|
|
|
|
LambdaQueryWrapper<InOrder> wrapper = Wrappers.lambdaQuery(InOrder.class); |
|
|
|
|
wrapper.orderByDesc(InOrder::getCreateTime); |
|
|
|
|
IPage<InOrder> pages = inOrderService.page(Condition.getPage(query), wrapper); |
|
|
|
|
List<InOrder> records = pages.getRecords(); |
|
|
|
|
for (InOrder record : records) { |
|
|
|
|
record.setInUserName(record.getInUserId() != null ? UserCache.getUser(record.getInUserId()).getRealName() : ""); |
|
|
|
|
record.setApproveUserName(record.getApproveUserId() != null ? UserCache.getUser(record.getApproveUserId()).getRealName() : ""); |
|
|
|
|
record.setApplyUserName(record.getApplyUserId() != null ? UserCache.getUser(record.getApplyUserId()).getRealName() : ""); |
|
|
|
|
if (CollectionUtil.isNotEmpty(records)) { |
|
|
|
|
List<Long> ids = records.stream().map(InOrder::getId).collect(Collectors.toList()); |
|
|
|
|
List<InOrderDetail> details = iInOrderDetailService.list(Wrappers.lambdaQuery(InOrderDetail.class).in(InOrderDetail::getOrderId, ids)); |
|
|
|
|
for (InOrder record : records) { |
|
|
|
|
record.setInUserName(record.getInUserId() != null ? UserCache.getUser(record.getInUserId()).getRealName() : ""); |
|
|
|
|
record.setApproveUserName(record.getApproveUserId() != null ? UserCache.getUser(record.getApproveUserId()).getRealName() : ""); |
|
|
|
|
record.setApplyUserName(record.getApplyUserId() != null ? UserCache.getUser(record.getApplyUserId()).getRealName() : ""); |
|
|
|
|
record.setDetails(details.stream().filter(inOrderDetail -> inOrderDetail.getOrderId().equals(record.getId())).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
|
|