| | |
| | | List<SalesProcessCardDto.ProcessNodeDto> nodeDtos = new ArrayList<>(); |
| | | |
| | | if (CollectionUtils.isEmpty(salesLedgerProcessRoutes)) { |
| | | // 无自定义路线,取默认路线 |
| | | ProcessRoute defaultRoute = processRouteMapper.selectOne( |
| | | // 无自定义路线:先查询默认工艺路线;若无默认,获取创建时间最近的一条 |
| | | ProcessRoute fallbackRoute = processRouteMapper.selectOne( |
| | | new LambdaQueryWrapper<ProcessRoute>().eq(ProcessRoute::getIsDefault, 1).last("LIMIT 1")); |
| | | if (defaultRoute != null) { |
| | | if (fallbackRoute == null) { |
| | | fallbackRoute = processRouteMapper.selectOne( |
| | | new LambdaQueryWrapper<ProcessRoute>() |
| | | .orderByDesc(ProcessRoute::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | } |
| | | if (fallbackRoute != null) { |
| | | List<ProcessRouteItem> routeItems = processRouteItemMapper.selectList( |
| | | new LambdaQueryWrapper<ProcessRouteItem>() |
| | | .eq(ProcessRouteItem::getRouteId, defaultRoute.getId()) |
| | | .eq(ProcessRouteItem::getRouteId, fallbackRoute.getId()) |
| | | .orderByAsc(ProcessRouteItem::getDragSort)); |
| | | for (ProcessRouteItem i : routeItems) { |
| | | SalesProcessCardDto.ProcessNodeDto node = new SalesProcessCardDto.ProcessNodeDto(); |
| | |
| | | ledger.setStockStatus(allStocked ? 2 : (hasStocked ? 1 : 0)); |
| | | baseMapper.updateById(ledger); |
| | | } |
| | | |
| | | @Override |
| | | public List<Customer> shippedCustomers() { |
| | | List<SalesLedger> ledgers = list(Wrappers.<SalesLedger>lambdaQuery() |
| | | .eq(SalesLedger::getDeliveryStatus, 5) |
| | | .isNotNull(SalesLedger::getCustomerId) |
| | | .select(SalesLedger::getCustomerId)); |
| | | if (CollectionUtils.isEmpty(ledgers)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | Set<Long> customerIds = ledgers.stream() |
| | | .map(SalesLedger::getCustomerId) |
| | | .collect(Collectors.toCollection(LinkedHashSet::new)); |
| | | return customerMapper.selectList(Wrappers.<Customer>lambdaQuery() |
| | | .in(Customer::getId, customerIds) |
| | | .orderByAsc(Customer::getCustomerName)); |
| | | } |
| | | } |