Browse Source

fix:修改推送 不走mq 直接调用

dist.1.3.0
pref_mail@163.com 9 months ago
parent
commit
bb4db23b9f
  1. 10
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionSignforClient.java
  2. 239
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionSignforClient.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  4. 23
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/DistributionDatarepair.java

10
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionSignforClient.java

@ -19,6 +19,7 @@ package com.logpm.distribution.feign;
import com.logpm.distribution.entity.DistributionSignforEntity;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -36,6 +37,7 @@ public interface IDistributionSignforClient {
String API_PREFIX = "signfor/client";
String TOP = API_PREFIX + "/top";
String CLERKCHECKPUSHDATA = API_PREFIX + "/clerkCheckPushData";
/**
* 获取签收管理列表
@ -52,4 +54,12 @@ public interface IDistributionSignforClient {
@GetMapping(TOP+"push0ldSystemSignInfo")
void push0ldSystemSignInfo(@RequestParam("current") Long signingId);
/**
* 推送老系统签收
* @param id
* @return
*/
@GetMapping(CLERKCHECKPUSHDATA)
Boolean clerkCheckPushData(@RequestParam("id") Long id);
}

239
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionSignforClient.java

@ -17,16 +17,42 @@
package com.logpm.distribution.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.entity.DistributionSignforEntity;
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.IDistributionSignforService;
import com.logpm.distribution.service.IDistributionStockService;
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 lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RedisKeyConstant;
import org.springblade.common.constant.stockup.StockAssignStatusConstant;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 签收管理 Feign实现类
*
@ -35,20 +61,38 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@ApiIgnore()
@RestController
@Slf4j
@AllArgsConstructor
public class DistributionSignforClient implements IDistributionSignforClient {
private final IDistributionSignforService distributionSignforService;
private final IDistributionSignforService distributionSignforService;
private final IDistributionStockService distributionStockService;
private final IOldSignPushClient oldSystemDataPushClient;
private final DistributionSignforMapper distributionSignforMapper;
private final DistributionDeliveryListMapper distributionDeliveryListMapper;
private final DistributionReservationMapper distributionReservationMapper;
private final DistributionDeliverySelfMapper distributionDeliverySelfMapper;
private final DistributionDeliveryTripartiteMapper distributionDeliveryTripartiteMapper;
private final IUserClient userClient;
private final IBasicdataTripartiteWarehouseClient basicdataTripartiteWarehouseClient;
@Override
@GetMapping(TOP)
public BladePage<DistributionSignforEntity> top(Integer current, Integer size) {
Query query = new Query();
query.setCurrent(current);
query.setSize(size);
IPage<DistributionSignforEntity> page = distributionSignforService.page(Condition.getPage(query));
return BladePage.of(page);
}
private final IWarehouseClient warehouseClient;
private BladeRedis bladeRedis;
@Override
@GetMapping(TOP)
public BladePage<DistributionSignforEntity> top(Integer current, Integer size) {
Query query = new Query();
query.setCurrent(current);
query.setSize(size);
IPage<DistributionSignforEntity> page = distributionSignforService.page(Condition.getPage(query));
return BladePage.of(page);
}
/**
* @param signingId
@ -59,4 +103,177 @@ public class DistributionSignforClient implements IDistributionSignforClient {
}
@Override
public Boolean clerkCheckPushData(Long id) {
try {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 推送老系统签收队列");
//得到审核的任务ID
if (ObjectUtil.isEmpty(id)) {
log.info(">>>>>>>>>>>>> clerkCheckPushDataHandler 签收ID为空");
return false;
}
//得到签收对象
DistributionSignforEntity distributionSignforEntity = distributionSignforMapper.selectById(id);
//需要检测文员是否进行复核了
if (ObjectUtil.isEmpty(distributionSignforEntity)) {
log.info(">>>>>>>>>>>> clerkCheckPushDataHandler distributionSignforEntity {}", distributionSignforEntity);
return false;
}
// 得到配送计划
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distributionSignforEntity.getDeliveryId());
if (ObjectUtil.isEmpty(distributionDeliveryListEntity)) {
log.info(">>>>>>>>>>> clerkCheckPushDataHandler distributionDeliveryListEntity {}", distributionDeliveryListEntity);
return false;
}
// 得到配送客户
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(distributionSignforEntity.getReservationId());
if (ObjectUtil.isEmpty(distributionReservationEntity)) {
log.info(">>>>>>>>>>>> clerkCheckPushDataHandler distributionReservationEntity {}", distributionReservationEntity);
return false;
}
//组合配送信息
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());
}
}
//完成客户信息添加
delivery.setSignPushDataContactDTOs(customer);
}
}
Boolean b = oldSystemDataPushClient.pushOldSystemSignInfo(delivery);
return b;
} catch (Exception e) {
log.error(">>>>> 推送老系统签收信息报错", e);
}
return false;
}
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.getAccount())) {
signPushDataUnitDTO.setAdministratorsPhone(user.getAccount());
} else {
if (ObjectUtils.isNotEmpty(user.getAccount())) {
signPushDataUnitDTO.setAdministratorsPhone(user.getAccount());
} else {
log.info("用户无电话号码且账号信息为空>>用户名称:{}", user.getName());
}
}
}
}
}
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml

@ -1237,7 +1237,7 @@
lddl.id AS distribution_id,
lddl.train_number AS trans_no,
ldsl.incoming_batch AS waybill_no,
lddl.order_code AS orderSelfNum,
ldsl.incoming_batch AS orderSelfNum,
ldsld.stock_package_code AS unitNo,
ldl.signfor_state AS type,
ldl.create_time AS operateTime,

23
blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/DistributionDatarepair.java

@ -6,6 +6,7 @@ import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionSignforEntity;
import com.logpm.distribution.feign.IDistributionDeliveryListClient;
import com.logpm.distribution.feign.IDistributionReservationClient;
import com.logpm.distribution.feign.IDistributionSignforClient;
import com.logpm.patch.mapper.WarehouseMappingDataMapper;
import com.logpm.patch.service.ISyncDistributionParcelListService;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient;
@ -46,6 +47,9 @@ public class DistributionDatarepair {
private final WarehouseMappingDataMapper warehouseMappingDataMapper;
private final IDistributionSignforClient distributionSignforClient;
/**
* 预约状态修复
*
@ -179,27 +183,20 @@ public class DistributionDatarepair {
public ReturnT<String> pushNotification(String params) {
// 得到当前仓库所有的签收任务
List<JSONObject> allSignfor = warehouseMappingDataMapper.findAllSignfor();
for (JSONObject entries : allSignfor) {
Long id = entries.getLong("singnforId");
DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity();
distributionSignforEntity.setId(id);
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
mapState.put("messageData", distributionSignforEntity);
mapState.put("createTime", System.currentTimeMillis());
try {
log.info(">>>>>>>>>>>>>>>>>>> 推送老系统 的签收数据 {} ", mapState);
rabbitTemplate.convertAndSend(RabbitConstant.CLERK_CHECK_PUSH_DATA_EXCHANGE, RabbitConstant.CLERK_CHECK_PUSH_DATA_ROUTING, mapState);
Boolean b = distributionSignforClient.clerkCheckPushData(id);
if(b){
warehouseMappingDataMapper.updateClearSignforStatus(id, entries.getLong("warehouseId"), 1);
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! {}", customerException.getMessage());
log.info(">>> 推送成功 {}",id);
}else{
log.error(">>> 推送失败 id="+id);
}
}

Loading…
Cancel
Save