|
|
@@ -41,9 +41,8 @@ import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
-import org.springblade.core.tool.utils.StringUtil;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.deliver.goods.entity.Delivery;
|
|
|
-import org.springblade.deliver.goods.entity.DeliveryItems;
|
|
|
import org.springblade.deliver.goods.feign.IDeliveryClient;
|
|
|
import org.springblade.finance.feign.IFinanceClient;
|
|
|
import org.springblade.finance.vojo.Acc;
|
|
|
@@ -90,7 +89,6 @@ public class OrderController extends BladeController {
|
|
|
private final IFinanceClient iFinanceClient;
|
|
|
private final IDeliveryClient deliveryClient;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 详情
|
|
|
*/
|
|
|
@@ -166,31 +164,57 @@ public class OrderController extends BladeController {
|
|
|
}
|
|
|
lambdaQueryWrapper.orderByDesc(Order::getId);
|
|
|
IPage<Order> page = orderService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
+
|
|
|
+ String corpIds = "";//客户拼接ids
|
|
|
+ String belongToCorpIds = "";//销售公司ids
|
|
|
+ String productionPlantIds = "";//生产工厂ids
|
|
|
+ String createUserIds = "";//创建人id拼接
|
|
|
+
|
|
|
+ for (Order orders : page.getRecords()){
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())){
|
|
|
+ corpIds = corpIds + orders.getCorpId() + ",";
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())){
|
|
|
+ belongToCorpIds = belongToCorpIds + orders.getBelongToCorpId() + ",";
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())){
|
|
|
+ productionPlantIds = productionPlantIds + orders.getProductionPlant() + ",";
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCreateUser())){
|
|
|
+ createUserIds = createUserIds + orders.getCreateUser() + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CorpsDesc> corpsDescList = corpsDescClient.selectByCorpIds(corpIds);
|
|
|
+ List<CorpsDesc> belongToCorpList = corpsDescClient.selectByCorpIds(belongToCorpIds);
|
|
|
+ List<CorpsDesc> productionPlantList = corpsDescClient.selectByCorpIds(productionPlantIds);
|
|
|
+ //获得创建人信息
|
|
|
+ List<User> createUserList = userClient.selectUserIds(createUserIds);
|
|
|
+
|
|
|
if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|
|
page.getRecords().stream().forEach(item -> {
|
|
|
if (item.getCorpId() != null) {
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());//客户
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
- item.setCorpsName(corpMessage.getData().getCname());
|
|
|
+ if (ObjectUtil.isNotEmpty(corpsDescList)) {
|
|
|
+ item.setCorpsName(corpsDescList.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().get().getCname());
|
|
|
}
|
|
|
}
|
|
|
if (item.getBelongToCorpId() != null) {
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getBelongToCorpId());//销售公司
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
- item.setBelongToCorpName(corpMessage.getData().getCname());
|
|
|
+ if (ObjectUtil.isNotEmpty(belongToCorpList)) {
|
|
|
+ item.setBelongToCorpName(belongToCorpList.stream().filter(e -> e.getId().equals(item.getBelongToCorpId())).findFirst().get().getCname());
|
|
|
}
|
|
|
}
|
|
|
if (item.getProductionPlant() != null) {
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getProductionPlant());//销售公司
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
- item.setProductionPlantName(corpMessage.getData().getCname());
|
|
|
+ if (ObjectUtil.isNotEmpty(productionPlantList)) {
|
|
|
+ item.setProductionPlantName(productionPlantList.stream().filter(e -> e.getId().equals(item.getProductionPlant())).findFirst().get().getCname());
|
|
|
}
|
|
|
}
|
|
|
- R<User> user = userClient.userInfoById(item.getCreateUser());//制单人
|
|
|
- if (user.isSuccess() && user.getData() != null) {
|
|
|
- item.setCreateUserName(user.getData().getName());
|
|
|
+ //制单人
|
|
|
+ if (item.getCreateUser() != null){
|
|
|
+ if (ObjectUtil.isNotEmpty(createUserList)) {
|
|
|
+ item.setCreateUserName(createUserList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().get().getName());
|
|
|
+ }
|
|
|
}
|
|
|
- //获取订单明细
|
|
|
+// //获取订单明细
|
|
|
List<OrderItems> list = orderItemsService.list(new QueryWrapper<OrderItems>().eq("pid", item.getId()).eq("is_deleted", 0));
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
item.setOrderQuantity(list.stream().map(OrderItems::getOrderQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));//数量合计
|
|
|
@@ -245,6 +269,33 @@ public class OrderController extends BladeController {
|
|
|
}
|
|
|
lambdaQueryWrapper.orderByDesc(Order::getId);
|
|
|
List<Order> list = orderService.list(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ String corpIds = "";//客户拼接ids
|
|
|
+ String belongToCorpIds = "";//销售公司ids
|
|
|
+ String productionPlantIds = "";//生产工厂ids
|
|
|
+ String createUserIds = "";//创建人id拼接
|
|
|
+
|
|
|
+ for (Order orders : list){
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())){
|
|
|
+ corpIds = corpIds + orders.getCorpId() + ",";
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())){
|
|
|
+ belongToCorpIds = belongToCorpIds + orders.getBelongToCorpId() + ",";
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCorpId())){
|
|
|
+ productionPlantIds = productionPlantIds + orders.getProductionPlant() + ",";
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(orders.getCreateUser())){
|
|
|
+ createUserIds = createUserIds + orders.getCreateUser() + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CorpsDesc> corpsDescList = corpsDescClient.selectByCorpIds(corpIds);
|
|
|
+ List<CorpsDesc> belongToCorpList = corpsDescClient.selectByCorpIds(belongToCorpIds);
|
|
|
+ List<CorpsDesc> productionPlantList = corpsDescClient.selectByCorpIds(productionPlantIds);
|
|
|
+ //获得创建人信息
|
|
|
+ List<User> createUserList = userClient.selectUserIds(createUserIds);
|
|
|
+
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
list.forEach(item -> {
|
|
|
if (item.getCreatePurchase() == 0){
|
|
|
@@ -263,26 +314,25 @@ public class OrderController extends BladeController {
|
|
|
item.setSpecialCheckName("是");
|
|
|
}
|
|
|
if (item.getCorpId() != null) {
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());//客户
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
- item.setCorpsName(corpMessage.getData().getCname());
|
|
|
+ if (ObjectUtil.isNotEmpty(corpsDescList)) {
|
|
|
+ item.setCorpsName(corpsDescList.stream().filter(e -> e.getId().equals(item.getCorpId())).findFirst().get().getCname());
|
|
|
}
|
|
|
}
|
|
|
if (item.getBelongToCorpId() != null) {
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getBelongToCorpId());//销售公司
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
- item.setBelongToCorpName(corpMessage.getData().getCname());
|
|
|
+ if (ObjectUtil.isNotEmpty(belongToCorpList)) {
|
|
|
+ item.setBelongToCorpName(belongToCorpList.stream().filter(e -> e.getId().equals(item.getBelongToCorpId())).findFirst().get().getCname());
|
|
|
}
|
|
|
}
|
|
|
if (item.getProductionPlant() != null) {
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getProductionPlant());//销售公司
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
- item.setProductionPlantName(corpMessage.getData().getCname());
|
|
|
+ if (ObjectUtil.isNotEmpty(productionPlantList)) {
|
|
|
+ item.setProductionPlantName(productionPlantList.stream().filter(e -> e.getId().equals(item.getProductionPlant())).findFirst().get().getCname());
|
|
|
}
|
|
|
}
|
|
|
- R<User> user = userClient.userInfoById(item.getCreateUser());//制单人
|
|
|
- if (user.isSuccess() && user.getData() != null) {
|
|
|
- item.setCreateUserName(user.getData().getName());
|
|
|
+ //制单人
|
|
|
+ if (item.getCreateUser() != null){
|
|
|
+ if (ObjectUtil.isNotEmpty(createUserList)) {
|
|
|
+ item.setCreateUserName(createUserList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().get().getName());
|
|
|
+ }
|
|
|
}
|
|
|
//获取订单明细
|
|
|
List<OrderItems> itemsListlist = orderItemsService.list(new QueryWrapper<OrderItems>().eq("pid", item.getId()).eq("is_deleted", 0));
|