|
|
|
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataTripartiteWarehouseClient; |
|
|
|
|
import com.logpm.distribution.dto.DistributionSignforDTO; |
|
|
|
|
import com.logpm.distribution.entity.*; |
|
|
|
|
import com.logpm.distribution.feign.IDistributionSignforClient; |
|
|
|
|
import com.logpm.distribution.mapper.*; |
|
|
|
|
import com.logpm.distribution.service.IDistributionSignforService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionStockService; |
|
|
|
|
import com.logpm.distribution.service.IDistrilbutionBillLadingService; |
|
|
|
|
import com.logpm.distribution.vo.DistributionSignPrintVO; |
|
|
|
@ -16,6 +18,7 @@ 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; |
|
|
|
@ -46,183 +49,23 @@ import java.util.stream.Collectors;
|
|
|
|
|
@Slf4j |
|
|
|
|
@RabbitListener(queues = RabbitConstant.CLERK_CHECK_PUSH_DATA_QUEUE) |
|
|
|
|
@Component |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
public class ClerkCheckPushDataQueueHandler { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionStockService distributionStockService; |
|
|
|
|
@Autowired |
|
|
|
|
private IOldSignPushClient oldSystemDataPushClient; |
|
|
|
|
@Autowired |
|
|
|
|
private DistributionSignforMapper distributionSignforMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private DistributionDeliveryListMapper distributionDeliveryListMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private DistributionReservationMapper distributionReservationMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private DistributionDeliverySelfMapper distributionDeliverySelfMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private DistributionDeliveryTripartiteMapper distributionDeliveryTripartiteMapper; |
|
|
|
|
@Autowired |
|
|
|
|
private IUserClient userClient; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataTripartiteWarehouseClient basicdataTripartiteWarehouseClient; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseClient warehouseClient; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private BladeRedis bladeRedis; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private DistrilbutionBillLadingMapper distrilbutionBillLadingMapper; |
|
|
|
|
|
|
|
|
|
private final IDistributionSignforService distributionSignforService; |
|
|
|
|
|
|
|
|
|
@RabbitHandler |
|
|
|
|
public void clerkCheckPushDataHandler(Map map, Message message, Channel channel) { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 推送老系统签收队列"); |
|
|
|
|
//得到审核的任务ID
|
|
|
|
|
DistributionSignforEntity t = (DistributionSignforEntity) map.get("messageData"); |
|
|
|
|
Long signfor_id = t.getId(); |
|
|
|
|
if (ObjectUtil.isEmpty(signfor_id)) { |
|
|
|
|
Long t = (Long) map.get("messageData"); |
|
|
|
|
if (ObjectUtil.isEmpty(t)) { |
|
|
|
|
log.info(">>>>>>>>>>>>> clerkCheckPushDataHandler 签收ID为空"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//得到签收对象
|
|
|
|
|
DistributionSignforEntity distributionSignforEntity = distributionSignforMapper.selectById(signfor_id); |
|
|
|
|
|
|
|
|
|
//需要检测文员是否进行复核了
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(distributionSignforEntity)) { |
|
|
|
|
log.info(">>>>>>>>>>>> clerkCheckPushDataHandler distributionSignforEntity {}", distributionSignforEntity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 得到配送计划
|
|
|
|
|
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distributionSignforEntity.getDeliveryId()); |
|
|
|
|
if (ObjectUtil.isEmpty(distributionDeliveryListEntity)) { |
|
|
|
|
log.info(">>>>>>>>>>> clerkCheckPushDataHandler distributionDeliveryListEntity {}", distributionDeliveryListEntity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 得到配送客户
|
|
|
|
|
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(distributionSignforEntity.getReservationId()); |
|
|
|
|
if (ObjectUtil.isEmpty(distributionReservationEntity)) { |
|
|
|
|
log.info(">>>>>>>>>>>> clerkCheckPushDataHandler distributionReservationEntity {}", distributionReservationEntity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//组合配送信息
|
|
|
|
|
SignPushDataDTO delivery = distributionDeliveryListMapper.selectPushOldDelivery(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); |
|
|
|
|
|
|
|
|
|
WarehouseEntity warehouseEntity = warehouseClient.findByName(distributionReservationEntity.getWarehouseName()); |
|
|
|
|
if (ObjectUtils.isNotNull(warehouseEntity)) { |
|
|
|
|
// 需要增加老系统的仓库ID
|
|
|
|
|
delivery.setWarehouseId(Long.parseLong(warehouseEntity.getId() + "")); |
|
|
|
|
delivery.setWarehouseName(warehouseEntity.getTitle()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//还需要配送的出库人、配送人、操作人信息
|
|
|
|
|
if (Func.isNotEmpty(delivery)) { |
|
|
|
|
if ("1".equals(delivery.getKind())) { |
|
|
|
|
//自主配送
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(Wrappers.<DistributionDeliverySelfEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliverySelfEntity::getDeliveryId, delivery.getId()) |
|
|
|
|
.eq(DistributionDeliverySelfEntity::getIsMaster, 2) |
|
|
|
|
); |
|
|
|
|
if (Func.isNotEmpty(distributionDeliverySelfEntity)) { |
|
|
|
|
delivery.setOutId(Long.parseLong(distributionDeliverySelfEntity.getDriverId())); |
|
|
|
|
delivery.setOutName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
delivery.setOutPhone(distributionDeliverySelfEntity.getDriverPhone()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//外协
|
|
|
|
|
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(Wrappers.<DistributionDeliveryTripartiteEntity>query().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, delivery.getId())); |
|
|
|
|
if (Func.isNotEmpty(distributionDeliveryTripartiteEntity)) { |
|
|
|
|
delivery.setOutName(distributionDeliveryTripartiteEntity.getDriverName()); |
|
|
|
|
delivery.setOutPhone(distributionDeliveryTripartiteEntity.getDriverPhone()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
R<User> userR = userClient.userInfoById(delivery.getAdministratorsId()); |
|
|
|
|
if (Func.isNotEmpty(userR)) { |
|
|
|
|
User user = userR.getData(); |
|
|
|
|
delivery.setAdministratorsName(user.getName()); |
|
|
|
|
delivery.setAdministratorsPhone(user.getPhone()); |
|
|
|
|
} |
|
|
|
|
DistributionStockupEntity distributionStockupEntity = distributionReservationMapper.selectStockup(distributionSignforEntity.getReservationId()); |
|
|
|
|
if (Func.isNotEmpty(distributionStockupEntity)) { |
|
|
|
|
if (distributionStockupEntity.getAssignStatus().equals(StockAssignStatusConstant.yizhipai.getValue())) { |
|
|
|
|
delivery.setOutToId(distributionStockupEntity.getStockupUserId()); |
|
|
|
|
delivery.setOutToName(distributionStockupEntity.getStockupUser()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询客户信息
|
|
|
|
|
List<SignPushDataContactDTO> customer = distributionReservationMapper.selectPushOldCustomer(distributionSignforEntity.getReservationId()); |
|
|
|
|
if (Func.isNotEmpty(customer)) { |
|
|
|
|
//查询客户订单
|
|
|
|
|
List<SignPushDataUnitDTO> signPushDataUnitDTOS = new ArrayList<>(); |
|
|
|
|
if (distributionReservationEntity.getReservationNum() > 0) { |
|
|
|
|
//查询包件扫描签收
|
|
|
|
|
//查询包件扫描签收
|
|
|
|
|
List<SignPushDataUnitDTO> pushOldPackageLoading = distributionSignforMapper.selectPushOldPackageLoading(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); |
|
|
|
|
List<SignPushDataUnitDTO> pushOldPackageSigning = distributionSignforMapper.selectPushOldPackageSigning(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); |
|
|
|
|
if (Func.isNotEmpty(pushOldPackageLoading)) { |
|
|
|
|
buildNameAndPhone(pushOldPackageLoading); |
|
|
|
|
signPushDataUnitDTOS.addAll(pushOldPackageLoading); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(pushOldPackageSigning)) { |
|
|
|
|
buildNameAndPhone(pushOldPackageSigning); |
|
|
|
|
signPushDataUnitDTOS.addAll(pushOldPackageSigning); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (distributionReservationEntity.getReservationStockListNum() > 0) { |
|
|
|
|
//查询库存品扫描签收
|
|
|
|
|
List<SignPushDataUnitDTO> loadingPushOldInventory = distributionSignforMapper.selectLoadingPushOldInventory(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); |
|
|
|
|
List<SignPushDataUnitDTO> signingPushOldInventory = distributionSignforMapper.selectSigningPushOldInventory(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId()); |
|
|
|
|
if (Func.isNotEmpty(loadingPushOldInventory)) { |
|
|
|
|
buildNameAndPhone(loadingPushOldInventory); |
|
|
|
|
signPushDataUnitDTOS.addAll(loadingPushOldInventory); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(signingPushOldInventory)) { |
|
|
|
|
buildNameAndPhone(signingPushOldInventory); |
|
|
|
|
signPushDataUnitDTOS.addAll(signingPushOldInventory); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//查询签收图片
|
|
|
|
|
List<DistributionSignPrintVO> distributionSignPrintVOS = distributionSignforMapper.selectSignImgsUrl(distributionReservationEntity.getId()); |
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(signPushDataUnitDTOS)) { |
|
|
|
|
SignPushDataContactDTO signPushDataContactDTO = customer.get(0); |
|
|
|
|
signPushDataContactDTO.setSignPushDataUnitDTOs(signPushDataUnitDTOS); |
|
|
|
|
if (Func.isNotEmpty(distributionSignPrintVOS)) { |
|
|
|
|
String urls = distributionSignPrintVOS.stream().map(DistributionSignPrintVO::getUrlRoute).collect(Collectors.joining(",")); |
|
|
|
|
signPushDataContactDTO.setImage(urls); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distributionSignforEntity.getClerkSignRemarks())) { |
|
|
|
|
signPushDataContactDTO.setContact(distributionSignforEntity.getClerkSignRemarks()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//完成客户信息添加
|
|
|
|
|
buildReservationNameAndPhone(customer); |
|
|
|
|
delivery.setSignPushDataContactDTOs(customer); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Boolean b = oldSystemDataPushClient.pushOldSystemSignInfo(delivery); |
|
|
|
|
Boolean b = distributionSignforService.clerkCheckPushData(t); |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 推送老系统签收队列 成功状态: {}",b); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error(">>>>> 推送老系统签收信息报错", e); |
|
|
|
|
} |
|
|
|
@ -230,68 +73,4 @@ public class ClerkCheckPushDataQueueHandler {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建名称和电话号码 |
|
|
|
|
* |
|
|
|
|
* @param pushOldPackageSigning |
|
|
|
|
*/ |
|
|
|
|
private void buildNameAndPhone(List<SignPushDataUnitDTO> pushOldPackageSigning) { |
|
|
|
|
for (SignPushDataUnitDTO signPushDataUnitDTO : pushOldPackageSigning) { |
|
|
|
|
User user = bladeRedis.get(RedisKeyConstant.USER_NAME_PHONE_KEY + signPushDataUnitDTO.getAdministratorsId()); |
|
|
|
|
log.info("buildNameAndPhone >>> 获取缓存的中的用户信息{}",user); |
|
|
|
|
if (user == null) { |
|
|
|
|
R<User> userT = userClient.userInfoById(signPushDataUnitDTO.getAdministratorsId()); |
|
|
|
|
if (userT.isSuccess()) { |
|
|
|
|
user = userT.getData(); |
|
|
|
|
bladeRedis.setEx(RedisKeyConstant.USER_NAME_PHONE_KEY + signPushDataUnitDTO.getAdministratorsId(), user, 3600L); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(user)) { |
|
|
|
|
assert user != null; |
|
|
|
|
signPushDataUnitDTO.setAdministratorsName(user.getName()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(user.getPhone())){ |
|
|
|
|
signPushDataUnitDTO.setAdministratorsPhone(user.getPhone()); |
|
|
|
|
}else { |
|
|
|
|
if (ObjectUtils.isNotEmpty(user.getAccount())){ |
|
|
|
|
signPushDataUnitDTO.setAdministratorsPhone(user.getAccount()); |
|
|
|
|
}else { |
|
|
|
|
log.info("用户无电话号码且账号信息为空>>用户名称:{}",user.getName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} /** |
|
|
|
|
* 构建名称和电话号码 |
|
|
|
|
* |
|
|
|
|
* @param customers |
|
|
|
|
*/ |
|
|
|
|
private void buildReservationNameAndPhone(List<SignPushDataContactDTO> customers) { |
|
|
|
|
for (SignPushDataContactDTO signPushDataUnitDTO : customers) { |
|
|
|
|
User user = bladeRedis.get(RedisKeyConstant.USER_NAME_PHONE_KEY + signPushDataUnitDTO.getSignUserId()); |
|
|
|
|
log.info("buildNameAndPhone >>> 获取缓存的中的用户信息{}",user); |
|
|
|
|
if (user == null) { |
|
|
|
|
R<User> userT = userClient.userInfoById(signPushDataUnitDTO.getSignUserId()); |
|
|
|
|
if (userT.isSuccess()) { |
|
|
|
|
user = userT.getData(); |
|
|
|
|
bladeRedis.setEx(RedisKeyConstant.USER_NAME_PHONE_KEY + signPushDataUnitDTO.getSignUserId(), user, 3600L); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(user)) { |
|
|
|
|
assert user != null; |
|
|
|
|
signPushDataUnitDTO.setSignUserName(user.getName()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(user.getPhone())){ |
|
|
|
|
signPushDataUnitDTO.setSignUserPhone(user.getPhone()); |
|
|
|
|
}else { |
|
|
|
|
if (ObjectUtils.isNotEmpty(user.getAccount())){ |
|
|
|
|
signPushDataUnitDTO.setSignUserPhone(user.getAccount()); |
|
|
|
|
}else { |
|
|
|
|
log.info("用户无电话号码且账号信息为空>>用户名称:{}",user.getName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|