Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dist.1.3.0
zhaoqiaobo 11 months ago
parent
commit
9ab5400226
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
  2. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java
  3. 147
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionSignforClient.java
  4. 161
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  5. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  6. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml
  7. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml
  8. 154
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushBillDataQueueHandler.java
  9. 239
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushDataQueueHandler.java
  10. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java
  11. 252
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  12. 50
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java
  13. 14
      blade-service/logpm-distribution/src/test/java/com/logpm/distribution/TestService.java
  14. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java
  15. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java
  16. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java
  17. 20
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  18. 3
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/SignPushClient.java
  19. 1
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/DistributionDatarepair.java
  20. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAsyncService.java
  21. 10
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java
  22. 96
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/LauncherConstant.java

@ -93,7 +93,7 @@ public interface LauncherConstant {
/**
* 本地登录 dev地址
*/
String APPLICATION_DEV_LOGIN_ADDR = "192.168.3.2:13000";
String APPLICATION_DEV_LOGIN_ADDR = "127.0.0.1:13000";
/**
* 本地登录 test地址
*/

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java

@ -314,10 +314,9 @@ public class DistributionDeliveryListController extends BladeController {
@GetMapping("/export-distributionDeliveryList")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导出数据", notes = "传入distributionDeliveryList")
public R exportDistributionDeliveryList(@ApiIgnore @RequestParam Map<String, Object> distributionDeliveryList, BladeUser bladeUser, HttpServletResponse response) {
public void exportDistributionDeliveryList(@ApiIgnore @RequestParam Map<String, Object> distributionDeliveryList, BladeUser bladeUser, HttpServletResponse response) {
List<DistributionDeliveryListExcel> list = distributionDeliveryListService.exportDistributionDeliveryList(distributionDeliveryList);
ExcelUtil.export(response, "配送管理数据" + DateUtil.time(), "配送管理数据表", list, DistributionDeliveryListExcel.class);
return R.status(true);
}
/**

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

@ -103,151 +103,16 @@ public class DistributionSignforClient implements IDistributionSignforClient {
}
/**
* 推送老系统签收
* @param id
* @return
*/
@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());
}
}
buildReservationNameAndPhone(customer);
//完成客户信息添加
delivery.setSignPushDataContactDTOs(customer);
}
}
log.info(">>>> clerkCheckPushData SignPushDataDTO :{}",delivery);
Boolean b = oldSystemDataPushClient.pushOldSystemSignInfo(delivery);
return b;
} catch (Exception e) {
log.error(">>>>> 推送老系统签收信息报错", e);
}
return distributionSignforService.clerkCheckPushData(id);
return false;
}
private void buildNameAndPhone(List<SignPushDataUnitDTO> pushOldPackageSigning) {

161
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml

@ -319,7 +319,7 @@
<select id="exportDistributionDeliveryList" resultType="com.logpm.distribution.excel.DistributionDeliveryListExcel">
SELECT
lddl.id id,
lww.name AS warehouseName,
lww.NAME AS warehouseName,
lddl.train_number trainNumber,
lddl.warehouse_name warehouseName,
lddl.warehouse_id warehouseId,
@ -330,29 +330,33 @@
lddl.distribution_company distributionCompany,
lddl.delivery_status deliveryStatus,
lddl.delivery_list_loading_status deliveryListLoadingStatus,
GROUP_CONCAT(y.order_code) AS orderCode,
CASE lddl.kind
WHEN 1 THEN '自主配送'
WHEN 2 THEN '三方配送'
ELSE
'其他'
GROUP_CONCAT( y.order_code ) AS orderCode,
CASE
lddl.kind
WHEN 1 THEN
'自主配送'
WHEN 2 THEN
'三方配送' ELSE '其他'
END kind,
CASE lddl.type
WHEN 1 THEN '商配'
WHEN 2 THEN '市配'
CASE
lddl.type
WHEN 1 THEN
'商配'
WHEN 2 THEN
'市配'
END type,
CASE lddl.delivery_status
WHEN 1 THEN '待配送'
WHEN 2 THEN '配送中'
WHEN 3 THEN '已完成'
ELSE
'其他'
CASE
lddl.delivery_status
WHEN 1 THEN
'待配送'
WHEN 2 THEN
'配送中'
WHEN 3 THEN
'已完成' ELSE '其他'
END state,
(
SELECT
GROUP_CONCAT(
DISTINCT ldsu.forklift_name SEPARATOR ','
)
GROUP_CONCAT( DISTINCT ldsu.forklift_name SEPARATOR ',' )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
@ -363,42 +367,42 @@
) forkliftName,
lddl.create_time createTime,
(
SELECT
COALESCE (COUNT(*), 0)
SELECT COALESCE
( COUNT(*), 0 )
FROM
logpm_distribution_signfor lds INNER JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
logpm_distribution_signfor lds
INNER JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
WHERE
lds.delivery_id = lddl.id and ldr.reservation_status != '40' AND (ldr.reservation_num + ldr.reservation_stock_list_num) > 0
lds.delivery_id = lddl.id
AND ldr.reservation_status != '40'
AND ( ldr.reservation_num + ldr.reservation_stock_list_num ) > 0
) customersNumber,
lddl.price price,
lddl.added_services_id addedServicesId,
(
SELECT
COALESCE (COUNT(*), 0)
SELECT COALESCE
( COUNT(*), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
JOIN logpm_distribution_reservation_stockarticle ldrs ON ldrs.reservation_id = ldr.id
WHERE
lds.delivery_id = lddl.id and ldrs.stock_article_status != 2
lds.delivery_id = lddl.id
AND ldrs.stock_article_status != 2
) orderNumber,
(
SELECT
COALESCE (sum(ldr.reservation_num), 0)
SELECT COALESCE
( sum( ldr.reservation_num ), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
WHERE
lds.delivery_id = lddl.id and ldr.reservation_status != '40'
lds.delivery_id = lddl.id
AND ldr.reservation_status != '40'
) deliveryNumber,
(
SELECT
COALESCE (
sum(
ldr.reservation_stock_list_num
),
0
)
SELECT COALESCE
( sum( ldr.reservation_stock_list_num ), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
@ -407,9 +411,7 @@
) reservationStockListNum,
(
SELECT
GROUP_CONCAT(
DISTINCT lds.loader_name SEPARATOR ','
)
GROUP_CONCAT( DISTINCT lds.loader_name SEPARATOR ',' )
FROM
logpm_distribution_signfor ldsf
JOIN logpm_distribution_reservation ldr ON ldr.id = ldsf.reservation_id
@ -420,9 +422,7 @@
) loadingTeamName,
(
SELECT
GROUP_CONCAT(
DISTINCT lds.fix_time SEPARATOR ','
)
GROUP_CONCAT( DISTINCT lds.fix_time SEPARATOR ',' )
FROM
logpm_distribution_signfor ldsf
JOIN logpm_distribution_reservation ldr ON ldr.id = ldsf.reservation_id
@ -430,8 +430,6 @@
INNER JOIN logpm_distribution_stockup AS lds ON ldsi.stockup_id = lds.id
WHERE
ldsf.delivery_id = lddl.id
-- ) leadTime,
-- lds.delivery_id = lddl.id
) reservationId,
lddl.order_id orderId,
lddl.fee fee,
@ -440,13 +438,8 @@
lddl.note_number noteNumber,
lddl.source source,
(
SELECT
COALESCE (
sum(
ldr.reservation_stock_list_num
),
0
)
SELECT COALESCE
( sum( ldr.reservation_stock_list_num ), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
@ -454,29 +447,44 @@
lds.delivery_id = lddl.id
) inventoryNub,
(
SELECT
COALESCE (sum(lds.loaded_number), 0) + COALESCE (sum(lds.loadedin_number), 0)
SELECT COALESCE
( sum( lds.loaded_number ), 0 ) + COALESCE ( sum( lds.loadedin_number ), 0 )
FROM
logpm_distribution_signfor lds
WHERE
lddl.id = lds.delivery_id
) scannedNumber,
(SELECT
COALESCE (sum(lds.received_quantity), 0) + COALESCE (sum(lds.receivedin_quantity), 0)
(
SELECT COALESCE
( sum( lds.received_quantity ), 0 ) + COALESCE ( sum( lds.receivedin_quantity ), 0 )
FROM
logpm_distribution_signfor lds
WHERE
lddl.id = lds.delivery_id
) signingNumber,
GROUP_CONCAT(DISTINCT ldr.consignee SEPARATOR ',') consignee,
GROUP_CONCAT(DISTINCT ldr.mall_name SEPARATOR ',') mallName,
(SELECT group_concat( DISTINCT ldsa.order_code SEPARATOR ',' ) FROM logpm_distribution_delivery_list lddll LEFT JOIN logpm_distribution_signfor lds ON lddll.id = lds.delivery_id LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON lds.reservation_id = ldrs.reservation_id AND ldrs.stock_article_status != 2 LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id WHERE lddll.id = lddl.id GROUP BY lddl.id ) AS orderCode
FROM logpm_distribution_delivery_list lddl
GROUP_CONCAT( DISTINCT a.consignee SEPARATOR ',' ) consignee,
GROUP_CONCAT( DISTINCT a.mallName SEPARATOR ',' ) mallName,
(
SELECT
group_concat( DISTINCT ldsa.order_code SEPARATOR ',' )
FROM
logpm_distribution_delivery_list lddll
LEFT JOIN logpm_distribution_signfor lds ON lddll.id = lds.delivery_id
LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON lds.reservation_id = ldrs.reservation_id
AND ldrs.stock_article_status != 2
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id
WHERE
lddll.id = lddl.id
GROUP BY
lddl.id
) AS orderCode
FROM
logpm_distribution_delivery_list lddl
LEFT JOIN (
SELECT
lddl.id,
a.consignee AS consignee,
a.mall_name AS mallName,
ldr.consignee AS consignee,
ldr.mall_name AS mallName
FROM
logpm_distribution_delivery_list lddl
LEFT JOIN logpm_distribution_signfor lds ON lddl.id = lds.delivery_id
@ -487,25 +495,40 @@
IF
( lddl.inventory_nub IS NULL, 0, lddl.inventory_nub ) > 0
AND ( lddl.customers_number > 0 AND ldr.reservation_num + ldr.reservation_stock_list_num ) > 0
AND lds.is_deleted = 0 AND lddl.is_deleted = 0 AND ldr.is_deleted = 0
AND lds.is_deleted = 0
AND lddl.is_deleted = 0
AND ldr.is_deleted = 0
GROUP BY
lddl.id
) AS a On a.id = lddl.id
LEFT JOIN (SELECT lddl.id,ldsa.order_code FROM logpm_distribution_delivery_list lddl
) AS a ON a.id = lddl.id
LEFT JOIN (
SELECT
lddl.id,
ldsa.order_code
FROM
logpm_distribution_delivery_list lddl
LEFT JOIN logpm_distribution_signfor lds ON lddl.id = lds.delivery_id
LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON lds.reservation_id = ldrs.reservation_id AND ldrs.stock_article_status != 2
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id ) AS y ON y.id = lddl.id
LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON lds.reservation_id = ldrs.reservation_id
AND ldrs.stock_article_status != 2
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id
) AS y ON y.id = lddl.id
LEFT JOIN logpm_warehouse_warehouse AS lww ON lddl.warehouse_id = lww.id
<where>
lddl.is_deleted = 0
AND (IF(lddl.delivery_number is null ,0,lddl.delivery_number) + IF(lddl.inventory_nub is null ,0,lddl.inventory_nub)) > 0
AND (lddl.customers_number > 0 AND ldr.reservation_num + ldr.reservation_stock_list_num) >0
AND lddl.customers_number > 0
<if test="param.ids != null and param.ids!=''">
and lddl.id in
<foreach collection="param.ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="param.trainNumber != null and param.trainNumber!=''">
and lddl.train_number like concat('%',#{param.trainNumber},'%')
</if>
<if test="param.warehouseIdList != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(param.warehouseIdList)">
<if test="param.warehouseIds != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(param.warehouseIds)">
and lddl.warehouse_id in
<foreach collection="param.warehouseIdList" item="item" open="(" close=")" separator=",">
<foreach collection="param.warehouseIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -1038,6 +1038,7 @@
WHERE
stock_list_status IN ( '1', '3' )
AND reservation_id = #{reservationId}
AND is_deleted = 0
</select>
<select id="selectReservationPackageByReservationId"
resultType="com.logpm.distribution.entity.DistributionReservationPackageEntity">

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml

@ -749,7 +749,7 @@
<select id="getSignPushDataDTO" resultType="com.logpm.oldproject.dto.SignPushDataDTO">
SELECT
ldbl.id,
ldbl.warehouse_id AS warehouseId,
lww.old_id AS warehouseId,
lww.name AS warehouseName,
3 AS type,
3 AS finishState,
@ -843,7 +843,7 @@
<select id="selectPushOldPackageSigning" resultType="com.logpm.oldproject.dto.SignPushDataUnitDTO">
SELECT
ldbls.id AS id,
ldsa.warehouse_id AS warehouse_id,
lww.old_id AS warehouse_id,
ldbls.create_user AS distribution_contact_id,
ldbls.bill_lading_id AS distributionId,
ldbl.pickup_batch AS transNo,
@ -867,13 +867,14 @@
logpm_distribution_bill_lading_scan AS ldbls
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbls.bill_lading_id = ldbl.id AND ldbl.is_deleted = 0
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldbls.stock_article_id = ldsa.id AND ldsa.is_deleted = 0
LEFT JOIN logpm_warehouse_warehouse AS lww ON ldbl.warehouse_id = lww.id
WHERE
bill_lading_id = #{id} AND ldbls.is_deleted = 0 AND ldbls.scan_type = 1
</select>
<select id="selectPushOldInventorySigning" resultType="com.logpm.oldproject.dto.SignPushDataUnitDTO">
SELECT
ldbls.id,
ldbl.warehouse_id,
lww.old_id as warehouse_id,
ldbls.create_user AS distribution_contact_id,
ldbls.bill_lading_id AS distributionId,
ldbl.pickup_batch AS transNo,
@ -911,6 +912,7 @@
AND ldbls.stock_list_id = ldsld.stock_list_id
LEFT JOIN logpm_distribution_stock_list AS ldsl ON ldsld.stock_list_id = ldsl.id AND ldsl.is_deleted = 0
LEFT JOIN logpm_distrilbution_bill_lading AS ldbl ON ldbls.bill_lading_id = ldbl.id AND ldbl.is_deleted = 0
LEFT JOIN logpm_warehouse_warehouse AS lww ON ldbl.warehouse_id = lww.id
WHERE
ldbls.bill_lading_id = #{id}
AND ldbls.scan_type = 2

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

@ -161,7 +161,7 @@
<where>
ldbs.is_deleted = 0 and ldbs.bill_lading_id = #{param.billLadingId} and ldbs.order_status in (1,3)
</where>
GROUP BY ldbl.id,ldsa.id
GROUP BY ldbl.id
</select>
<select id="getBillOrderPack" resultType="com.logpm.distribution.vo.DistributionBillOrderPackVO">
SELECT

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

@ -6,6 +6,7 @@ import com.logpm.basicdata.feign.IBasicdataTripartiteWarehouseClient;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.mapper.*;
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;
@ -14,6 +15,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;
@ -44,166 +46,30 @@ import java.util.stream.Collectors;
@Slf4j
@RabbitListener(queues = RabbitConstant.BILL_CLERK_CHECK_PUSH_DATA_QUEUE)
@Component
@AllArgsConstructor
public class ClerkCheckPushBillDataQueueHandler {
@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 IDistrilbutionBillLadingService distrilbutionBillLadingService;
@RabbitHandler
public void clerkCheckPushBillLLadingDataHandler(Map map, Message message, Channel channel) {
try {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 推送老系统签收队列");
//得到审核的任务ID
DistributionSignforEntity t = (DistributionSignforEntity) map.get("messageData");
Long billId = t.getId();
if (ObjectUtil.isEmpty(billId)) {
log.info(">>>>>>>>>>>>> clerkCheckPushBillLLadingDataHandler 签收ID为空");
return;
}
//得到签收对象
DistrilbutionBillLadingEntity billLadingEntity = distrilbutionBillLadingMapper.selectById(billId);
//需要检测文员是否进行复核了
if (ObjectUtil.isEmpty(billLadingEntity)) {
log.info(">>>>>>>>>>>> clerkCheckPushBillLLadingDataHandler billLadingEntity {}", billLadingEntity);
Long t = (Long) map.get("messageData");
if (ObjectUtil.isEmpty(t )) {
log.info(">>>>>>>>>>>>> clerkCheckPushBillLLadingDataHandler 自提ID为空");
return;
}
Boolean b = distrilbutionBillLadingService.clerkBillCheckPushData(t);
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 推送自提到老系统队列 成功状态 {}",b);
//组合配送信息
SignPushDataDTO delivery = distrilbutionBillLadingMapper.getSignPushDataDTO(billId);
//还需要配送的出库人、配送人、操作人信息
if (Func.isNotEmpty(delivery)) {
R<User> userR = userClient.userInfoById(delivery.getAdministratorsId());
if (Func.isNotEmpty(userR)) {
User user = userR.getData();
delivery.setAdministratorsName(user.getName());
delivery.setAdministratorsPhone(user.getPhone());
}
//查询客户信息
List<SignPushDataContactDTO> customer = distrilbutionBillLadingMapper.selectPushOldCustomer(billId);
if (Func.isNotEmpty(customer)) {
//查询客户订单
List<SignPushDataUnitDTO> signPushDataUnitDTOS = new ArrayList<>();
//查询包件扫描签收
//查询包件扫描签收
List<SignPushDataUnitDTO> pushOldPackageSigning = distrilbutionBillLadingMapper.selectPushOldPackageSigning(billId);
if (Func.isNotEmpty(pushOldPackageSigning)) {
buildNameAndPhone(pushOldPackageSigning);
signPushDataUnitDTOS.addAll(pushOldPackageSigning);
}
buildClientNameAndPhone(customer);
//完成客户信息添加
delivery.setSignPushDataContactDTOs(customer);
}
}
Boolean b = oldSystemDataPushClient.pushOldSystemSignInfo(delivery);
} catch (Exception e) {
log.error(">>>>> 推送老系统签收信息报错", e);
log.error(">>>>> 推送老系统自提信息报错", e);
}
}
/**
* 构建名称和电话号码
*
* @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 customer
*/
private void buildClientNameAndPhone(List<SignPushDataContactDTO> customer) {
for (SignPushDataContactDTO signPushDataUnitDTO : customer) {
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());
}
}
}
}
}
}

239
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/ClerkCheckPushDataQueueHandler.java

@ -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());
}
}
}
}
}
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java

@ -343,4 +343,6 @@ public interface IDistributionSignforService extends BaseService<DistributionSig
void push0ldSystemSignInfo(Long signingId);
SignforPageCountVO selectDistributionSignforPageCount( DistributionSignforVO distributionSignfor);
Boolean clerkCheckPushData(Long id);
}

252
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -626,7 +626,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
Integer loadingNum = distributionSignfor.getLoadedNumber() + distributionSignfor.getLoadedinNumber();
Integer signNum = distributionSignfor.getReceivedQuantity() + distributionSignfor.getReceivedinQuantity();
int i = loadingNum - signNum;
if (i < 0){
if (loadingNum > signNum){
log.info("复核签收装车数和签收数不一致,装车数:{},签收数:{}", loadingNum,signNum);
return R.fail("存在装车还未签收数据!!!");
}
@ -1656,38 +1656,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
/**
* 构建名称和电话号码
*
* @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());
}
}
}
}
}
private List<DeliveryNodeVo> handleStockUp(DistributionStockupEntity distributionStockupEntity) {
List<DeliveryNodeVo> nodeVos = new ArrayList<>();
@ -2456,6 +2425,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
);
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode())
.eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, 1)
//修改 状态
);
if (!abnormalEntities.isEmpty()) {
boolean flag = abnormalEntities.stream().allMatch(a -> deliveryListEntity.getId().equals(a.getDeliveryListId()) );
@ -6005,15 +5976,16 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
DistributionSignforEntity signforEntity = BeanUtil.copy(distributionSignfor,DistributionSignforEntity.class);
mapState.put("messageData", signforEntity);
mapState.put("messageData", distributionSignfor.getId());
mapState.put("createTime", System.currentTimeMillis());
try {
log.info(">>>>>>>>>>>>>>>>>>> 推送老系统 的签收数据 {} ", mapState);
rabbitTemplate.convertAndSend(RabbitConstant.CLERK_CHECK_PUSH_DATA_EXCHANGE, RabbitConstant.CLERK_CHECK_PUSH_DATA_ROUTING, mapState);
rabbitTemplate.convertAndSend(RabbitConstant.CLERK_CHECK_PUSH_DATA_EXCHANGE, RabbitConstant.CLERK_CHECK_PUSH_DATA_ROUTING, mapState,message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! {}", customerException.getMessage());
@ -6188,4 +6160,210 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
@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());
}
}
buildReservationNameAndPhone(customer);
//完成客户信息添加
delivery.setSignPushDataContactDTOs(customer);
}
}
log.info(">>>> clerkCheckPushData SignPushDataDTO :{}",delivery);
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());
}
}
}
}
}
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());
}
}
}
}
}
}

50
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -74,6 +74,7 @@ import org.springblade.common.constant.reservation.ReservationPackageStatusConst
import org.springblade.common.constant.stockup.StockAssignStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.common.constant.stockup.StockupTypeConstant;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
@ -1329,15 +1330,33 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
}
// 转换仓库ID
// modifyWarehouseId(delivery);
Boolean b = oldSystemDataPushClient.pushOldSystemSignInfo(delivery);
return b;
} catch (Exception e) {
log.error(">>>>> 推送老系统签收信息报错", e);
log.error(">>>>> 推送老系统自提签收信息报错", e);
return false;
}
}
/**
* 转换老系统的ID
* @param delivery
*/
private void modifyWarehouseId(SignPushDataDTO delivery) {
if(!Objects.isNull(delivery.getWarehouseId())){
// 查询老系统的ID
BasicdataWarehouseEntity entityWarehouseId = warehouseClient.getEntityWarehouseId(delivery.getWarehouseId());
if(Objects.nonNull(entityWarehouseId)){
delivery.setWarehouseId(Long.parseLong(entityWarehouseId.getOldId()+""));
}
}
}
/**
* 构建名称和电话号码
@ -3325,12 +3344,41 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
//处理库存品签收数据
updateStock(s);
// 回传老系统自提数据
sendOldSystem(Long.parseLong(s));
}
// 回传工厂数据
sendFactory(myCurrentWarehouse, parcelListIds);
return true;
}
/**
* 自提签收推淞老系统
* @param id
*/
private void sendOldSystem(Long id) {
Map mapState = new HashMap();
mapState.put("messageId", CommonUtil.getUUID());
mapState.put("messageData", id);
mapState.put("createTime", System.currentTimeMillis());
try {
log.info(">>>>>>>>>>>>>>>>>>> 推送老系统 的自提数据 {} ", mapState);
rabbitTemplate.convertAndSend(RabbitConstant.BILL_CLERK_CHECK_PUSH_DATA_EXCHANGE, RabbitConstant.BILL_CLERK_CHECK_PUSH_DATA_ROUTING, mapState,message -> {
message.getMessageProperties()
.setHeader("x-delay", 5000);
return message;
});
} catch (Exception customerException) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! {}", customerException.getMessage());
}
}
private void sendFactory(BasicdataWarehouseEntity myCurrentWarehouse, Set<Long> parcelListIds) {
try {
// ladingScanEntities中的包件id数据封装为set

14
blade-service/logpm-distribution/src/test/java/com/logpm/distribution/TestService.java

@ -6,10 +6,7 @@ import com.logpm.distribution.dto.DistributionSignforDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.service.IDistributionDeliveryListService;
import com.logpm.distribution.service.IDistributionParcelListService;
import com.logpm.distribution.service.IDistributionSignforService;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.distribution.service.*;
import com.logpm.distribution.service.impl.DistributionSignforServiceImpl;
import com.logpm.distribution.vo.print.PrintPreviewVO;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
@ -37,6 +34,9 @@ public class TestService {
@Autowired
private DistributionSignforServiceImpl iDistributionSignforService;
@Autowired
private IDistrilbutionBillLadingService distrilbutionBillLadingService;
@Test
public void test2() throws Exception {
@ -157,5 +157,11 @@ public class TestService {
System.out.println(byWaybillId);
}
@Test
public void test199(){
distrilbutionBillLadingService.clerkBillCheckPushData(1788142166947786754L);
}
}

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java

@ -153,7 +153,7 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
try {
if ("1".equals(status) || "4".equals(status)) {
// 始发仓和目的仓入库
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
panFactoryDataService.handleDataToPlatform(unitNo, operationTime,Integer.parseInt(currentWarehouseId));
} else {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的状态");
}

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java

@ -38,7 +38,7 @@ public class OpReceivingDataHandler {
String receivingTime = object.getString("receivingTime");
//真正处理需要的数据
try {
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime);
panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime,null);
} catch (CustomerException e) {
log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,orderPackageCode:{},receivingTime:{},msg:{}",

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java

@ -18,7 +18,7 @@ public interface IPanFactoryDataService {
R hwyHandleStatusData(OrderStatusDTO orderStatusDTO);
void handleDataToPlatform(String unitNo,String operationTime);
void handleDataToPlatform(String unitNo,String operationTime,Integer oldWarehouseId);
Long saveData(PanFactoryOrderDTO factoryOrderDTO);
}

20
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -23,7 +23,6 @@ import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.factory.comfac.dto.OrderInfoDTO;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.comfac.service.IOrderStatusLogService;
import com.logpm.factory.pan.dto.PanFactoryOrderDTO;
import com.logpm.factory.pan.dto.PanPackageInfoDTO;
import com.logpm.factory.pan.dto.PanPackageListDTO;
@ -455,11 +454,19 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
@Transactional(rollbackFor = Exception.class)
@Override
public void handleDataToPlatform(String unitNo, String operationTime) {
public void handleDataToPlatform(String unitNo, String operationTime,Integer oldWarehouseId) {
log.info("############handleDataToPlatform: 处理数据到platform unitNo={}", unitNo);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(oldWarehouseId);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############handleDataToPlatform: 仓库信息不存在 oldWarehouseId={}",oldWarehouseId);
throw new CustomerException(405, "仓库信息不存在");
}
Long warehouseId = basicdataWarehouseEntity.getId();
//先查询包件是否已存入到新系统数据库
List<DistributionParcelListEntity> distributionParcelListEntity = distributionParcelListClient.findByPacketBarCode(unitNo);
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(unitNo,warehouseId);
if (ObjectUtils.isEmpty(distributionParcelListEntity)) {
//未找到包件信息那就去新增
//1.根据包条码去老系统数据库找到对应的包条信息
@ -501,12 +508,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
// Integer oldId = orderDetailEntity.getNowWarehouseId();
// 查询数据对应的仓库名称
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.findByName(destinationWarehouse);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############handleDataToPlatform: 仓库信息不存在 destinationWarehouse={}",destinationWarehouse);
throw new CustomerException(405, "仓库信息不存在");
}
Long warehouseId = basicdataWarehouseEntity.getId();
// OrderCountEntity orderCountEntity = orderCountClient.getEntityByOrderCode(orderSelfNum,oldId);
// if(Objects.isNull(orderCountEntity)){

3
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/SignPushClient.java

@ -29,6 +29,7 @@ public class SignPushClient implements IOldSignPushClient {
public Boolean pushOldSystemSignInfo(SignPushDataDTO signPushDataDTO) {
//todo 这里存在调用老系统的接口 将数据会写给老系统
int timeoutMilliseconds = 60000;
Boolean result =false;
log.info(">>>> pushOldSystemSignInfo 程序执行 start time: {}",System.currentTimeMillis());
@ -39,7 +40,7 @@ public class SignPushClient implements IOldSignPushClient {
String data = JSON.toJSONString(signPushDataDTO);
log.info(">>>> pushOldSystemSignInfo request url:{} data:{}",url,data);
String body = HttpRequest.post(url).body(data).header("token", authCode).execute().body();
String body = HttpRequest.post(url).body(data).header("token", authCode).setConnectionTimeout(timeoutMilliseconds).execute().body();
if (StringUtil.isNotBlank(body)) {
JSONObject res = JSON.parseObject(body);
if ("200".equals(res.getString("code"))) {

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

@ -218,7 +218,6 @@ public class DistributionDatarepair {
@XxlJob("pushBillNotification")
public ReturnT<String> pushBillNotification(String params) {
// 得到当前仓库所有的签收任务
Integer parmeId = null;
if(StringUtil.isNotBlank(params)){
parmeId = Integer.parseInt(params);

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAsyncService.java

@ -11,4 +11,6 @@ public interface IAsyncService {
CompletableFuture<Boolean> getResponseFromCp(List<TrunklineAdvanceDetailEntity> list, int queryType);
CompletableFuture<Boolean> saveAdvanceEntity(List<TrunklineAdvanceEntity> list, int queryType);
CompletableFuture<Boolean> updateAdvanceEntity(List<TrunklineAdvanceEntity> list, int queryType);
}

10
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java

@ -7,7 +7,6 @@ import com.logpm.trunkline.service.ITrunklineAdvanceDetailService;
import com.logpm.trunkline.service.ITrunklineAdvanceService;
import org.springblade.common.annotations.LogpmAsync;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
@ -39,4 +38,13 @@ public class AsyncServiceImpl implements IAsyncService {
);
}
@LogpmAsync("asyncExecutor")
@Override
public CompletableFuture<Boolean> updateAdvanceEntity(List<TrunklineAdvanceEntity> list, int queryType) {
return CompletableFuture
.completedFuture(
advanceService.updateBatchById(list)
);
}
}

96
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -1097,11 +1097,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
List<String> hasOrderPackageCodeList = new ArrayList<>();
//把orderPackageCodeKeys每2000个元素为一组
int batchSize = 2000;
int packageBatchSize = 1000;
List<List<String>> orderPackageCodeGroups = new ArrayList<>();
for (int i = 0; i < orderPackageCodeKeys.size(); i += batchSize) {
int endIndex = Math.min(i + batchSize, orderPackageCodeKeys.size());
for (int i = 0; i < orderPackageCodeKeys.size(); i += packageBatchSize) {
int endIndex = Math.min(i + packageBatchSize, orderPackageCodeKeys.size());
orderPackageCodeGroups.add(orderPackageCodeKeys.subList(i, endIndex));
}
@ -1141,6 +1141,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//把orderCodeList分成每2000个元素一组
List<List<String>> orderedGroups = new ArrayList<>();
int batchSize = 1000;
for (int i = 0; i < orderCodeList.size(); i += batchSize) {
int endIndex = Math.min(i + batchSize, orderCodeList.size());
orderedGroups.add(orderCodeList.subList(i, endIndex));
@ -1160,6 +1162,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntityMap.put(key,advanceEntity);
});
List<TrunklineAdvanceEntity> updateAdvanceEntityList = new ArrayList<>();
listMap.keySet().forEach(str -> {
List<PacakgeDetailExcelDTO> excelDTOS = listMap.get(str);
PacakgeDetailExcelDTO pacakgeDetailExcelDTO = excelDTOS.get(0);
@ -1217,14 +1221,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity.setCreateUserName(AuthUtil.getNickName());
advanceEntityList.add(advanceEntity);
} else {
advanceEntity.setTotalNum(advanceEntity.getTotalNum() + excelDTOS.size());
updateAdvanceEntityList.add(advanceEntity);
advanceIds.add(advanceEntity.getId());
advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity);
}
});
if (!advanceEntityList.isEmpty()) {
//把advanceDetailEntities分成相等数量的10个集合
List<List<TrunklineAdvanceEntity>> advanceEntitiesList = advanceEntityList.stream().collect(Collectors.groupingBy(item -> advanceDetailEntities.indexOf(item) / 1000)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
//把advanceEntityList每1000个元素分组
List<List<TrunklineAdvanceEntity>> advanceEntitiesList = advanceEntityList.stream().collect(Collectors.groupingBy(item -> advanceEntityList.indexOf(item) / 1000)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
List<CompletableFuture> comlist = new ArrayList<>();
for (int i = 0; i < advanceEntitiesList.size(); i++) {
List<TrunklineAdvanceEntity> list = advanceEntitiesList.get(i);
@ -1235,6 +1241,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}
if (!updateAdvanceEntityList.isEmpty()) {
//把advanceDetailEntities分成相等数量的10个集合
List<List<TrunklineAdvanceEntity>> advanceEntitiesList = updateAdvanceEntityList.stream().collect(Collectors.groupingBy(item -> updateAdvanceEntityList.indexOf(item) / 1000)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
List<CompletableFuture> comlist = new ArrayList<>();
for (int i = 0; i < advanceEntitiesList.size(); i++) {
List<TrunklineAdvanceEntity> list = advanceEntitiesList.get(i);
CompletableFuture<Boolean> fromCpFirstReq = asyncService.updateAdvanceEntity(list, i+1);
comlist.add(fromCpFirstReq);
}
CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join();
}
advanceEntityList.forEach(advanceEntity -> {
advanceIds.add(advanceEntity.getId());
String trainNumber = advanceEntity.getTrainNumber();
@ -1411,11 +1432,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
List<String> hasOrderPackageCodeList = new ArrayList<>();
//把orderPackageCodeKeys每2000个元素为一组
int batchSize = 2000;
int packageBatchSize = 1000;
List<List<String>> orderPackageCodeGroups = new ArrayList<>();
for (int i = 0; i < orderPackageCodeKeys.size(); i += batchSize) {
int endIndex = Math.min(i + batchSize, orderPackageCodeKeys.size());
for (int i = 0; i < orderPackageCodeKeys.size(); i += packageBatchSize) {
int endIndex = Math.min(i + packageBatchSize, orderPackageCodeKeys.size());
orderPackageCodeGroups.add(orderPackageCodeKeys.subList(i, endIndex));
}
@ -1428,6 +1449,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
importCustomizedOuPaiDTOS = importCustomizedOuPaiDTOS.stream().filter(item -> !hasOrderPackageCodeList.contains(item.getOrderPackageCode())).collect(Collectors.toList());
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>();
List<TrunklineAdvanceEntity> updateAdvanceEntityList = new ArrayList<>();
if(importCustomizedOuPaiDTOS.isEmpty()){
log.warn("##################importCustomizedOuPai: 没有需要处理的数据 importCustomizedOuPaiDTOS={}",importCustomizedOuPaiDTOS);
@ -1447,6 +1469,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//把orderCodeList分成每2000个元素一组
List<List<String>> orderedGroups = new ArrayList<>();
int batchSize = 1000;
for (int i = 0; i < orderCodeList.size(); i += batchSize) {
int endIndex = Math.min(i + batchSize, orderCodeList.size());
orderedGroups.add(orderCodeList.subList(i, endIndex));
@ -1525,6 +1548,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity.setHasPackage(1);
advanceEntityList.add(advanceEntity);
} else {
advanceEntity.setTotalNum(advanceEntity.getTotalNum() + excelDTOS.size());
updateAdvanceEntityList.add(advanceEntity);
advanceIds.add(advanceEntity.getId());
String trainNumber = advanceEntity.getTrainNumber();
advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity);
@ -1533,7 +1559,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
if (!advanceEntityList.isEmpty()) {
//把advanceDetailEntities分成相等数量的10个集合
List<List<TrunklineAdvanceEntity>> advanceEntitiesList = advanceEntityList.stream().collect(Collectors.groupingBy(item -> advanceDetailEntities.indexOf(item) / 1000)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
List<List<TrunklineAdvanceEntity>> advanceEntitiesList = advanceEntityList.stream().collect(Collectors.groupingBy(item -> advanceEntityList.indexOf(item) / 1000)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
List<CompletableFuture> comlist = new ArrayList<>();
for (int i = 0; i < advanceEntitiesList.size(); i++) {
List<TrunklineAdvanceEntity> list = advanceEntitiesList.get(i);
@ -1544,6 +1570,20 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}
if (!updateAdvanceEntityList.isEmpty()) {
//把advanceDetailEntities分成相等数量的10个集合
List<List<TrunklineAdvanceEntity>> advanceEntitiesList = updateAdvanceEntityList.stream().collect(Collectors.groupingBy(item -> updateAdvanceEntityList.indexOf(item) / 1000)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
List<CompletableFuture> comlist = new ArrayList<>();
for (int i = 0; i < advanceEntitiesList.size(); i++) {
List<TrunklineAdvanceEntity> list = advanceEntitiesList.get(i);
CompletableFuture<Boolean> fromCpFirstReq = asyncService.updateAdvanceEntity(list, i+1);
comlist.add(fromCpFirstReq);
}
CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join();
}
advanceEntityList.forEach(advanceEntity -> {
advanceIds.add(advanceEntity.getId());
String trainNumber = advanceEntity.getTrainNumber();
@ -1672,11 +1712,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
List<String> hasOrderPackageCodeList = new ArrayList<>();
//把orderPackageCodeKeys每2000个元素为一组
int batchSize = 2000;
int packageBatchSize = 1000;
List<List<String>> orderPackageCodeGroups = new ArrayList<>();
for (int i = 0; i < orderPackageCodeKeys.size(); i += batchSize) {
int endIndex = Math.min(i + batchSize, orderPackageCodeKeys.size());
for (int i = 0; i < orderPackageCodeKeys.size(); i += packageBatchSize) {
int endIndex = Math.min(i + packageBatchSize, orderPackageCodeKeys.size());
orderPackageCodeGroups.add(orderPackageCodeKeys.subList(i, endIndex));
}
@ -1689,6 +1729,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
importStandardOuPaiDTOS = importStandardOuPaiDTOS.stream().filter(item -> !hasOrderPackageCodeList.contains(item.getOrderPackageCode())).collect(Collectors.toList());
List<TrunklineAdvanceEntity> advanceEntityList = new ArrayList<>();
List<TrunklineAdvanceEntity> updateAdvanceEntityList = new ArrayList<>();
if(importStandardOuPaiDTOS.isEmpty()){
log.warn("##################importStandardOuPai: 没有需要处理的数据 importStandardOuPaiDTOS={}",importStandardOuPaiDTOS);
@ -1714,6 +1755,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//把orderCodeList分成每2000个元素一组
List<List<String>> orderedGroups = new ArrayList<>();
int batchSize = 1000;
for (int i = 0; i < orderCodeList.size(); i += batchSize) {
int endIndex = Math.min(i + batchSize, orderCodeList.size());
orderedGroups.add(orderCodeList.subList(i, endIndex));
@ -1781,6 +1823,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity.setHasPackage(1);
advanceEntityList.add(advanceEntity);
} else {
advanceEntity.setTotalNum(advanceEntity.getTotalNum()+excelDTOS.size());
updateAdvanceEntityList.add(advanceEntity);
advanceIds.add(advanceEntity.getId());
String trainNumber = advanceEntity.getTrainNumber();
advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity);
@ -1796,6 +1841,18 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
comlist.add(fromCpFirstReq);
}
CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join();
}
if (!updateAdvanceEntityList.isEmpty()) {
//把advanceDetailEntities分成相等数量的10个集合
List<List<TrunklineAdvanceEntity>> advanceEntitiesList = updateAdvanceEntityList.stream().collect(Collectors.groupingBy(item -> updateAdvanceEntityList.indexOf(item) / 1000)).entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
List<CompletableFuture> comlist = new ArrayList<>();
for (int i = 0; i < advanceEntitiesList.size(); i++) {
List<TrunklineAdvanceEntity> list = advanceEntitiesList.get(i);
CompletableFuture<Boolean> fromCpFirstReq = asyncService.updateAdvanceEntity(list, i+1);
comlist.add(fromCpFirstReq);
}
CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join();
}
@ -2237,6 +2294,19 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//把importOrderNoPackageExcelDTOS中的orderCode存入一个set集合
Set<String> orderCodes = importOrderNoPackageExcelDTOS.parallelStream().map(ImportOrderNoPackageExcelDTO::getOrderCode).collect(Collectors.toSet());
Map<String, Long> orderCodeCounts = importOrderNoPackageExcelDTOS.stream()
.collect(Collectors.groupingBy(a -> a.getOrderCode() + "&" + a.getTrainNumber(), Collectors.counting()));
Set<String> duplicateOrderCodes = orderCodeCounts.entrySet().stream()
.filter(entry -> entry.getValue() > 1)
.map(Map.Entry::getKey)
.collect(Collectors.toSet());
if(!duplicateOrderCodes.isEmpty()){
log.warn("#####################openLabelHasPacakage: 订单重复 {}",duplicateOrderCodes);
return R.fail(405, "包条码重复"+duplicateOrderCodes);
}
//把importOrderNoPackageExcelDTOS的每个元素提取成一个key为orderCode和trainNumber的拼接,value为元素本身的map
Map<String, ImportOrderNoPackageExcelDTO> importOrderNoPackageExcelDTOMap = importOrderNoPackageExcelDTOS.parallelStream().collect(Collectors.toMap(a -> a.getOrderCode() + "&" + a.getTrainNumber(), a -> a));
@ -2247,7 +2317,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//把orderCodes转成List
List<String> orderCodeList = new ArrayList<>(orderCodes);
//把orderCodeList分成每2000个元素一组
int batchSize = 2000;
int batchSize = 1000;
List<List<String>> orderedGroups = new ArrayList<>();
for (int i = 0; i < orderCodeList.size(); i += batchSize) {

Loading…
Cancel
Save