Browse Source

1.增加创建配送任务 推送商场

master
pref_mail@163.com 8 months ago
parent
commit
8f991a3d9f
  1. 2
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java
  2. 46
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java
  3. 45
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java
  4. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/RabbitMqConfiguration.java
  5. 58
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java
  6. 44
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java
  7. 25
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushBillDataQueueHandler.java
  8. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java
  9. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  10. 27
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java
  11. 14
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java

2
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java

@ -264,6 +264,8 @@ public class DistributionBusinessPreOrderEntity extends TenantEntity {
@ApiModelProperty(value = "暂存单id")
private Long advanceId;//暂存单id
@ApiModelProperty(value = "配送车次号")
private String distrCarNumber;
// /**
// * 配送状态

46
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java

@ -17,6 +17,7 @@
package com.logpm.basicdata.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@ -49,10 +50,7 @@ import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -144,15 +142,47 @@ public class BasicdataDriverArteryServiceImpl extends BaseServiceImpl<BasicdataD
ArrayList<BasicdataDriverArteryVO> basicdataDriverArteryVOS = new ArrayList<>();
List<BasicdataDriverArteryEntity> list = baseMapper.selectListByWarehouseId(warehouseId);
log.info("################getDriverList list:{}", list);
List<Long> ids =list.stream() // 创建一个流
.map(BasicdataDriverArteryEntity::getId) // 使用map方法获取每个对象的ID
.collect(Collectors.toList());
List<BasicdataDrivermiddleEntity> list1 = basicdataDrivermiddleService.list(Wrappers.<BasicdataDrivermiddleEntity>query().lambda()
.in(BasicdataDrivermiddleEntity::getDriverId, ids));
Map<Long, List<BasicdataDrivermiddleEntity>> groupedEntities =
list1.stream()
.collect(Collectors.groupingBy(BasicdataDrivermiddleEntity::getDriverId));
LambdaQueryWrapper<BasicdataVehicleEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BasicdataVehicleEntity::getIsDeleted, 0);
List<BasicdataVehicleEntity> list2 = basicdataVehicleService.list(queryWrapper);
for (BasicdataDriverArteryEntity driverArteryEntity : list) {
BasicdataDriverArteryVO driverArteryVO = Func.copy(driverArteryEntity, BasicdataDriverArteryVO.class);
List<Long> vehicleIds = basicdataDrivermiddleService.list(Wrappers.<BasicdataDrivermiddleEntity>query().lambda()
.eq(BasicdataDrivermiddleEntity::getDriverId, driverArteryEntity.getId())).stream().filter(f -> Func.isNotEmpty(f.getBrandId())).map(BasicdataDrivermiddleEntity::getBrandId).collect(Collectors.toList());
if (Func.isNotEmpty(vehicleIds)) {
driverArteryVO.setVehicleVOList(basicdataVehicleService.list(Wrappers.<BasicdataVehicleEntity>query().lambda().in(BasicdataVehicleEntity::getId, vehicleIds)));
List<BasicdataDrivermiddleEntity> basicdataDrivermiddleEntities = groupedEntities.get(driverArteryEntity.getId());
if (Func.isNotEmpty(basicdataDrivermiddleEntities)) {
List<Long> vehicleIds = basicdataDrivermiddleEntities.stream().filter(f -> Func.isNotEmpty(f.getBrandId())).map(BasicdataDrivermiddleEntity::getBrandId).collect(Collectors.toList());
if (Func.isNotEmpty(vehicleIds)) {
List<BasicdataVehicleEntity> vehicleList = new ArrayList<>();
for (Long vehicleId : vehicleIds) {
for (BasicdataVehicleEntity basicdataVehicleEntity : list2) {
if (vehicleId.equals(basicdataVehicleEntity.getId())) {
vehicleList.add(basicdataVehicleEntity);
}
}
}
driverArteryVO.setVehicleVOList(vehicleList);
}
}
basicdataDriverArteryVOS.add(driverArteryVO);
}
return basicdataDriverArteryVOS;
}

45
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java

@ -18,6 +18,7 @@ package com.logpm.basicdata.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
@ -51,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -141,14 +143,49 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl<BasicdataVehicl
public List<BasicdataVehicleVO> getVehicleList() {
List<BasicdataVehicleEntity> list = this.list();
List<BasicdataVehicleVO> basicdataVehicleVOS = new ArrayList<>();
if(Func.isEmpty(list)){
return null;
}
// 查询所有的iD
List<Long> ids = list.stream() // 创建一个流
.map(BasicdataVehicleEntity::getId) // 使用map方法获取每个对象的ID
.collect(Collectors.toList()); // 使用collect方法将ID收集到一个新的List中
LambdaQueryWrapper<BasicdataDrivermiddleEntity> queryWrapper = Wrappers.<BasicdataDrivermiddleEntity>query().lambda().in(BasicdataDrivermiddleEntity::getBrandId, ids);
List<BasicdataDrivermiddleEntity> list1 = basicdataDrivermiddleService.list(queryWrapper);
Map<Long, List<BasicdataDrivermiddleEntity>> groupedEntities =
list1.stream()
.collect(Collectors.groupingBy(BasicdataDrivermiddleEntity::getBrandId));
QueryWrapper queryWrapper1 = new QueryWrapper();
queryWrapper1.eq("is_deleted",0);
List<BasicdataDriverArteryEntity> basicdataDriverArteryEntities1 = basicdataDriverArteryMapper.selectList(queryWrapper1);
if (Func.isNotEmpty(list)){
list.forEach(l->{
BasicdataVehicleVO vehicleVO = Func.copy(l, BasicdataVehicleVO.class);
List<Long> driverIds = basicdataDrivermiddleService.list(Wrappers.<BasicdataDrivermiddleEntity>query().lambda().eq(BasicdataDrivermiddleEntity::getBrandId, vehicleVO.getId())).stream().filter(f -> Func.isNotEmpty(f.getDriverId())).map(BasicdataDrivermiddleEntity::getDriverId).collect(Collectors.toList());
if (Func.isNotEmpty(driverIds)){
List<BasicdataDriverArteryEntity> basicdataDriverArteryEntities = basicdataDriverArteryMapper.selectList(Wrappers.<BasicdataDriverArteryEntity>query().lambda().in(BasicdataDriverArteryEntity::getId,driverIds));
vehicleVO.setDriverArteryEntityList(basicdataDriverArteryEntities);
List<BasicdataDrivermiddleEntity> basicdataDrivermiddleEntities = groupedEntities.get(vehicleVO.getId());
if(Func.isNotEmpty(basicdataDrivermiddleEntities)){
List<Long> driverIds = basicdataDrivermiddleEntities.
stream().filter(f -> Func.isNotEmpty(f.getDriverId())).map(BasicdataDrivermiddleEntity::getDriverId).collect(Collectors.toList());
if (Func.isNotEmpty(driverIds)){
List<BasicdataDriverArteryEntity> basicdataDriverArteryEntities = new ArrayList();
for (Long driverId : driverIds) {
basicdataDriverArteryEntities1.forEach(e->{
if (driverId.equals(e.getId())){
basicdataDriverArteryEntities.add(e);
}
});
}
vehicleVO.setDriverArteryEntityList(basicdataDriverArteryEntities);
}
}
basicdataVehicleVOS.add(vehicleVO);
});
}

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/config/RabbitMqConfiguration.java

@ -171,5 +171,21 @@ public class RabbitMqConfiguration {
}
@Bean
public Queue businessPreConversionQueue() {
return new Queue(RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_QUEUE, true);
}
@Bean
public CustomExchange businessPreConversionExchange() {
Map<String, Object> args = Maps.newHashMap();
args.put("x-delayed-type", "direct");
return new CustomExchange(RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_EXCHANGE, "x-delayed-message", true, false, args);
}
@Bean
public Binding businessPreConversionBinding(Queue businessPreConversionQueue, CustomExchange businessPreConversionExchange) {
return BindingBuilder.bind(businessPreConversionQueue).to(businessPreConversionExchange).with(RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_ROUTING).noargs();
}
}

58
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java

@ -0,0 +1,58 @@
package com.logpm.distribution.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity;
import com.logpm.distribution.entity.DistributionDeliveryListEntity;
import com.logpm.distribution.service.IDistributionBusinessPreOrderService;
import com.logpm.distribution.vo.DistributionDeliveryListVO;
import com.logpm.distribution.wrapper.DistributionDeliveryListWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@RestController
@AllArgsConstructor
@RequestMapping("/businessPreOrder")
@Api(value = "配送增值服务明细", tags = "预入库信息控制器")
public class DistributionBusinessPreOrderController extends BladeController {
private final IDistributionBusinessPreOrderService distributionBusinessPreOrderService;
/**
* 预入库信息 分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入distributionDeliveryList")
public R<IPage<DistributionBusinessPreOrderEntity>> list(@ApiIgnore @RequestParam Map<String, Object> distributionBusinessPreOrderEntity, Query query) {
IPage<DistributionBusinessPreOrderEntity> pages = distributionBusinessPreOrderService.page(Condition.getPage(query), Condition.getQueryWrapper(distributionBusinessPreOrderEntity, DistributionBusinessPreOrderEntity.class));
return R.data(pages);
}
@GetMapping("/inOrder")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入distributionDeliveryList")
public R<Boolean> inOrder(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
Boolean isSuccess =distributionBusinessPreOrderService.inOrder(ids);
return R.data(isSuccess);
}
}

44
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java

@ -3,33 +3,31 @@ package com.logpm.distribution.receiver;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.mapper.DistributionBusinessPreOrderMapper;
import com.logpm.distribution.entity.DistributionDeliveryListEntity;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.entity.DistributionReservationPackageEntity;
import com.logpm.distribution.service.*;
import com.rabbitmq.client.Channel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Tenant;
import org.springblade.system.feign.ISysClient;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.awt.*;
import java.nio.channels.Channel;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
//@RabbitListener(queues = RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_QUEUE)
@RabbitListener(queues = RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_QUEUE)
@Component
@AllArgsConstructor
public class BusinessPreOrderDataQueueHandler {
@ -41,15 +39,11 @@ public class BusinessPreOrderDataQueueHandler {
private final IDistributionBusinessPreOrderService distributionBusinessPreOrderService;
private final ISysClient sysClient;
// @RabbitHandler
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_QUEUE),
exchange = @Exchange(name = RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_EXCHANGE, type = ExchangeTypes.TOPIC),
key = RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_ROUTING
))
@RabbitHandler
public void businessPreOrderDataHandler(Map map, Message message, Channel channel) {
String mallName = "金牌衣柜内江区";
String mallName = "仁寿欧派大家具";
Long t = (Long) map.get("messageData");
if (ObjectUtil.isEmpty(t)) {
@ -98,13 +92,12 @@ public class BusinessPreOrderDataQueueHandler {
List<DistributionBusinessPreOrderEntity> dataResult = new ArrayList<>();
for (DistributionParcelListEntity distributionParcelListEntity : list1) {
distributionParcelListEntity.setTenantId(null);
distributionParcelListEntity.setId(null);
DistributionBusinessPreOrderEntity data = BeanUtil.copy(distributionParcelListEntity, DistributionBusinessPreOrderEntity.class);
DistributionBusinessPreOrderEntity data = BeanUtil.copy(distributionParcelListEntity, DistributionBusinessPreOrderEntity.class);
data.setDriverName(distributionDeliveryListEntity.getDriverName());
data.setVehicleName(distributionDeliveryListEntity.getVehicleName());
data.setDistrCarNumber(distributionDeliveryListEntity.getTrainNumber());
dataResult.add(data);
}
@ -122,13 +115,18 @@ public class BusinessPreOrderDataQueueHandler {
public void saveOtherDataBase(List<DistributionBusinessPreOrderEntity> dataResult, String maillName) {
R<Tenant> tenantByName = sysClient.getTenantByName("仁寿欧派大家具");
R<Tenant> tenantByName = sysClient.getTenantByName(maillName);
if(tenantByName.isSuccess()){
Tenant tenant = tenantByName.getData();
if(ObjectUtil.isEmpty(tenant)){
log.info(">>>>>>>>>>>>> BusinessPreOrderDataQueueHandler 租户不存在");
return;
}
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : dataResult) {
distributionBusinessPreOrderEntity.setTenantId(tenant.getTenantId());
}
DynamicDataSourceContextHolder.push(tenant.getTenantId());
distributionBusinessPreOrderService.saveBatch(dataResult);
DynamicDataSourceContextHolder.poll();

25
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushBillDataQueueHandler.java

@ -1,42 +1,17 @@
package com.logpm.distribution.receiver;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.feign.IBasicdataTripartiteWarehouseClient;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.mapper.*;
import com.logpm.distribution.service.IDistributionDeliveryListService;
import com.logpm.distribution.service.IDistributionStockService;
import com.logpm.distribution.service.IDistrilbutionBillLadingService;
import com.logpm.distribution.vo.DistributionSignPrintVO;
import com.logpm.oldproject.dto.SignPushDataContactDTO;
import com.logpm.oldproject.dto.SignPushDataDTO;
import com.logpm.oldproject.dto.SignPushDataUnitDTO;
import com.logpm.oldproject.entity.WarehouseEntity;
import com.logpm.oldproject.feign.IOldSignPushClient;
import com.logpm.oldproject.feign.IWarehouseClient;
import com.rabbitmq.client.Channel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.RedisKeyConstant;
import org.springblade.common.constant.stockup.StockAssignStatusConstant;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.User;
import org.springblade.system.feign.IUserClient;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java

@ -5,4 +5,10 @@ import com.logpm.distribution.entity.DistributionBillLadingScanEntity;
import org.springblade.core.mp.base.BaseService;
public interface IDistributionBusinessPreOrderService extends BaseService<DistributionBusinessPreOrderEntity> {
/**
* 预备入库ID集合
* @param ids
* @return
*/
Boolean inOrder(String ids);
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -724,7 +724,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//进行解托操作
Map<String,Object> info = new HashMap<>();
info.put("orderPackageCode",parcelListEntity.getOrderPackageCode());

27
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java

@ -6,6 +6,33 @@ import com.logpm.distribution.service.IDistributionBusinessPreOrderService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Service
public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<DistributionBusinessPreOrderMapper, DistributionBusinessPreOrderEntity> implements IDistributionBusinessPreOrderService {
@Override
public Boolean inOrder(String ids) {
// 查询出来需要处理的包条码
List<String> codes= new ArrayList<>();
beachOrderByOrderPackageCode(codes);
return null;
}
/**
* 处理包条码到当前租户对应的数据库
* @param codes
*/
private void beachOrderByOrderPackageCode(List<String> codes) {
}
}

14
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java

@ -108,20 +108,6 @@ public class RabbitMqConfiguration {
// @Bean
// public Queue businessPreConversionQueue() {
// return new Queue(RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_QUEUE, true);
// }
// @Bean
// public CustomExchange businessPreConversionExchange() {
// Map<String, Object> args = Maps.newHashMap();
// args.put("x-delayed-type", "direct");
// return new CustomExchange(RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_EXCHANGE, "x-delayed-message", true, false, args);
// }
// @Bean
// public Binding businessPreConversionBinding(Queue businessPreConversionQueue, CustomExchange businessPreConversionExchange) {
// return BindingBuilder.bind(businessPreConversionQueue).to(businessPreConversionExchange).with(RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_ROUTING).noargs();
// }

Loading…
Cancel
Save