@ -64,7 +64,9 @@ import org.springblade.common.constant.reservation.*;
import org.springblade.common.constant.signing.SignforDriverSigningStatusConstant ;
import org.springblade.common.constant.signing.SignforStatusConstant ;
import org.springblade.common.exception.CustomerException ;
import org.springblade.common.node.BillLadingNode ;
import org.springblade.common.node.DeliveryNode ;
import org.springblade.common.node.ReservationNode ;
import org.springblade.common.serviceConstant.ServiceConstant ;
import org.springblade.common.utils.CommonUtil ;
import org.springblade.common.utils.FileUtil ;
@ -181,6 +183,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
@Lazy
private IDistributionReservationService distributionReservationService ;
@Autowired
@Lazy
private IDistrilbutionBillLadingService distrilbutionBillLadingService ;
@Autowired
private RabbitTemplate rabbitTemplate ;
@Autowired
@ -786,10 +791,22 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//进行数据组装
break ;
case 2 :
DistributionReservationEntity reservationEntity = distributionReservationService . selectByReservationCode ( searchCode ) ;
if ( Func . isEmpty ( reservationEntity ) ) {
return R . fail ( "未查询到预约单信息,请查看搜索类型是否匹配" ) ;
}
//解析配送节点
nodeVos = handleReservationNode ( reservationEntity ) ;
//预约单查询
break ;
case 3 :
//订单自编号查询
//自提单号
DistrilbutionBillLadingEntity distrilbutionBillLadingEntity = distrilbutionBillLadingService . selectByBillLadingCode ( searchCode ) ;
if ( Func . isEmpty ( distrilbutionBillLadingEntity ) ) {
return R . fail ( "未查询到自提单信息,请查看搜索类型是否匹配" ) ;
}
//解析配送节点
nodeVos = handleBillLading ( distrilbutionBillLadingEntity ) ;
break ;
case 4 :
//包条码查询
@ -798,6 +815,151 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return R . data ( nodeVos ) ;
}
private List < DeliveryNodeVo > handleBillLading ( DistrilbutionBillLadingEntity distrilbutionBillLadingEntity ) {
List < DeliveryNodeVo > nodeVos = new ArrayList < > ( ) ;
try {
DeliveryNodeVo billLadingNodeVo = new DeliveryNodeVo ( ) ;
billLadingNodeVo . setTime ( distrilbutionBillLadingEntity . getCreateTime ( ) ) ;
billLadingNodeVo . setNodeName ( BillLadingNode . chuangjianchenggong . getName ( ) ) ;
String name = userClient . userInfoById ( distrilbutionBillLadingEntity . getCreateUser ( ) ) . getData ( ) . getName ( ) ;
billLadingNodeVo . setNodeUserName ( name ) ;
//查询自提的自提数量
Integer billLadingNum = distrilbutionBillLadingService . selectBillLadingPlanNum ( distrilbutionBillLadingEntity . getId ( ) ) ;
billLadingNodeVo . setNodeInfo ( "计划自提" + billLadingNum + "件" ) ;
nodeVos . add ( billLadingNodeVo ) ;
//查询自提扫描数量
} catch ( Exception e ) {
}
return nodeVos ;
}
private List < DeliveryNodeVo > handleReservationNode ( DistributionReservationEntity reservationEntity ) {
List < DeliveryNodeVo > nodeVos = new ArrayList < > ( ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ;
try {
DeliveryNodeVo reservationNodeVo = new DeliveryNodeVo ( ) ;
int projectNum = reservationEntity . getReservationNum ( ) + reservationEntity . getReservationStockListNum ( ) ;
reservationNodeVo . setTime ( reservationEntity . getCreateTime ( ) ) ;
String name = userClient . userInfoById ( reservationEntity . getCreateUser ( ) ) . getData ( ) . getName ( ) ;
reservationNodeVo . setNodeUserName ( name ) ;
reservationNodeVo . setNodeName ( ReservationNode . chuangjianchenggong . getName ( ) ) ;
reservationNodeVo . setNodeInfo ( "计划配送" + projectNum + "件" ) ;
nodeVos . add ( reservationNodeVo ) ;
//查询装车
Integer loadingNum = distributionLoadscanMapper . selectLoadingNumByReservationId ( reservationEntity . getId ( ) ) ;
if ( loadingNum > 0 ) {
DeliveryNodeVo middleReservationNodeVo = new DeliveryNodeVo ( ) ;
middleReservationNodeVo . setNodeName ( ReservationNode . zhuangchezhong . getName ( ) ) ;
//查询预约装车操作人有那些
List < DistributionLoadscanEntity > loadscanEntityList = distributionLoadscanMapper . selectList ( Wrappers . < DistributionLoadscanEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscanEntity : : getReservationId , reservationEntity . getId ( ) )
. ne ( DistributionLoadscanEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) )
) ;
List < String > scanUser = new ArrayList < > ( ) ;
List < String > loadingTime = new ArrayList < > ( ) ;
if ( Func . isNotEmpty ( loadscanEntityList ) ) {
List < String > packageScanUser = loadscanEntityList . stream ( ) . map ( DistributionLoadscanEntity : : getScanUser ) . collect ( Collectors . toList ( ) ) ;
scanUser . addAll ( packageScanUser ) ;
List < String > packagheLoadingTime = loadscanEntityList . stream ( ) . map ( DistributionLoadscanEntity : : getScanTime ) . collect ( Collectors . toList ( ) ) ;
loadingTime . addAll ( packagheLoadingTime ) ;
}
List < DistributionLoadscaninvnEntity > inventoryLoading = distributionLoadscaninvnMapper . selectList ( Wrappers . < DistributionLoadscaninvnEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscaninvnEntity : : getReservationId , reservationEntity . getId ( ) )
. ne ( DistributionLoadscaninvnEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) )
) ;
if ( Func . isNotEmpty ( inventoryLoading ) ) {
List < String > InventoryScanUser = inventoryLoading . stream ( ) . map ( DistributionLoadscaninvnEntity : : getScanUser ) . collect ( Collectors . toList ( ) ) ;
scanUser . addAll ( InventoryScanUser ) ;
List < String > inventoryLoadingTime = inventoryLoading . stream ( ) . map ( DistributionLoadscaninvnEntity : : getScanTime ) . collect ( Collectors . toList ( ) ) ;
loadingTime . addAll ( inventoryLoadingTime ) ;
}
if ( Func . isNotEmpty ( scanUser ) ) {
String scanUsers = scanUser . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
middleReservationNodeVo . setNodeUserName ( scanUsers ) ;
}
if ( Func . isNotEmpty ( loadingTime ) ) {
String max = Collections . max ( loadingTime ) ;
middleReservationNodeVo . setTime ( sdf . parse ( max ) ) ;
}
if ( reservationEntity . getLoadingStatus ( ) . equals ( ReservationLoadingStatusConstant . yizhuangche . getValue ( ) ) ) {
middleReservationNodeVo . setNodeName ( ReservationNode . zhuangchewancheng . getName ( ) ) ;
}
middleReservationNodeVo . setNodeInfo ( "计划配送" + projectNum + "件" + "装车" + loadingNum + "件" ) ;
nodeVos . add ( middleReservationNodeVo ) ;
}
Integer signingNum = distributionLoadscanMapper . selectSigningNumByReservationId ( reservationEntity . getId ( ) ) ;
if ( signingNum > 0 ) {
DeliveryNodeVo endReservationNodeVo = new DeliveryNodeVo ( ) ;
endReservationNodeVo . setNodeName ( ReservationNode . qianshouzhong . getName ( ) ) ;
//查询预约装车操作人有那些
List < DistributionLoadscanEntity > loadscanEntityList = distributionLoadscanMapper . selectList ( Wrappers . < DistributionLoadscanEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscanEntity : : getReservationId , reservationEntity . getId ( ) )
. eq ( DistributionLoadscanEntity : : getSignforState , LoadScanSigningStatusConstant . yiqianshou . getValue ( ) )
. ne ( DistributionLoadscanEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) )
) ;
List < String > scanUser = new ArrayList < > ( ) ;
List < String > signTime = new ArrayList < > ( ) ;
if ( Func . isNotEmpty ( loadscanEntityList ) ) {
List < String > packageScanUser = loadscanEntityList . stream ( ) . map ( DistributionLoadscanEntity : : getScanUser ) . collect ( Collectors . toList ( ) ) ;
scanUser . addAll ( packageScanUser ) ;
List < String > packagheSignTimeTime = loadscanEntityList . stream ( ) . map ( DistributionLoadscanEntity : : getSigningTime ) . collect ( Collectors . toList ( ) ) ;
signTime . addAll ( packagheSignTimeTime ) ;
}
List < DistributionLoadscaninvnEntity > inventoryLoading = distributionLoadscaninvnMapper . selectList ( Wrappers . < DistributionLoadscaninvnEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscaninvnEntity : : getReservationId , reservationEntity . getId ( ) )
. eq ( DistributionLoadscaninvnEntity : : getSignforState , LoadScanSigningStatusConstant . yiqianshou . getValue ( ) )
. ne ( DistributionLoadscaninvnEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) )
) ;
if ( Func . isNotEmpty ( inventoryLoading ) ) {
List < String > inventoryScanUser = inventoryLoading . stream ( ) . map ( DistributionLoadscaninvnEntity : : getScanUser ) . collect ( Collectors . toList ( ) ) ;
scanUser . addAll ( inventoryScanUser ) ;
List < String > inventorySignTimeTime = inventoryLoading . stream ( ) . map ( DistributionLoadscaninvnEntity : : getSigningTime ) . collect ( Collectors . toList ( ) ) ;
signTime . addAll ( inventorySignTimeTime ) ;
}
if ( Func . isNotEmpty ( scanUser ) ) {
String scanUsers = scanUser . stream ( ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
endReservationNodeVo . setNodeUserName ( scanUsers ) ;
}
if ( Func . isNotEmpty ( signTime ) ) {
String max = Collections . max ( signTime ) ;
endReservationNodeVo . setTime ( sdf . parse ( max ) ) ;
}
if ( reservationEntity . getSigningStatus ( ) . equals ( ReservationSigningStatusConstant . yiqianshou . getValue ( ) ) ) {
endReservationNodeVo . setNodeName ( ReservationNode . qianshouwancheng . getName ( ) ) ;
}
endReservationNodeVo . setNodeInfo ( "计划配送" + projectNum + "件;" + "装车" + loadingNum + "件;" + "签收" + signingNum + "件" ) ;
nodeVos . add ( endReservationNodeVo ) ;
}
//查询此预约是否完成复核
DistributionSignforEntity signforEntity = distributionSignforMapper . selectByReservationId ( reservationEntity . getId ( ) ) ;
if ( Func . isNotEmpty ( signforEntity ) ) {
if ( signforEntity . getSigningStatus ( ) . equals ( SignforStatusConstant . yiqianshou . getValue ( ) ) ) {
DeliveryNodeVo signReservationNodeVo = new DeliveryNodeVo ( ) ;
signReservationNodeVo . setTime ( sdf . parse ( signforEntity . getSigningTime ( ) ) ) ;
signReservationNodeVo . setNodeUserName ( signforEntity . getExamineUserName ( ) ) ;
signReservationNodeVo . setNodeName ( ReservationNode . fuhewancheng . getName ( ) ) ;
signReservationNodeVo . setNodeInfo ( "计划配送" + projectNum + "件;" + "装车" + loadingNum + "件;" + "签收" + signingNum + "件" ) ;
nodeVos . add ( signReservationNodeVo ) ;
}
}
} catch ( Exception e ) {
throw new RuntimeException ( e ) ;
}
return nodeVos ;
}
private List < DeliveryNodeVo > handleDeliveryNode ( DistributionDeliveryListEntity deliveryListEntity ) {
List < DeliveryNodeVo > nodeVos = new ArrayList < > ( ) ;
try {