Browse Source

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

fix-sign
pref_mail@163.com 3 months ago
parent
commit
89474c986c
  1. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java
  2. 1
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpClientVO.java
  3. 10
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpScanDetailVO.java
  4. 41
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpTrayDetailVO.java
  5. 26
      blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/ReportConfigOrderAllEntity.java
  6. 27
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java
  7. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java
  8. 40
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  9. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml
  10. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.java
  11. 41
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml
  12. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java
  13. 204
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java
  14. 9
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/config/InterceptorAdapterConfig.java
  15. 28
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/controller/OrderController.java
  16. 148
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/interceptor/FactoryAccountsInterceptor.java
  17. 118
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/interceptor/LocalServerLoginAccountsInterceptor.java
  18. 2
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/DeliveryNoteMapper.java
  19. 9
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/DeliveryNoteServiceImpl.java
  20. 12
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/FactoryDataServiceImpl.java
  21. 2
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/vo/FactoryOrderDataVO.java
  22. 4
      blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/vo/Resp.java
  23. 25
      blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportConfigController.java
  24. 15
      blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportTimeController.java
  25. 13
      blade-service/logpm-report/src/main/java/com/logpm/report/dto/DestinationWarehouseDTO.java
  26. 3
      blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportConfigDTO.java
  27. 14
      blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportTimeDTO.java
  28. 13
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportConfigOrderAllMapper.java
  29. 31
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportConfigOrderAllMapper.xml
  30. 5
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.java
  31. 302
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml
  32. 14
      blade-service/logpm-report/src/main/java/com/logpm/report/service/IReportConfigOrderAllService.java
  33. 4
      blade-service/logpm-report/src/main/java/com/logpm/report/service/IReportTimeService.java
  34. 51
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportConfigAllTrunklineServiceImpl.java
  35. 85
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportConfigOrderAllServiceImpl.java
  36. 98
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportTimeServiceImpl.java
  37. 103
      blade-service/logpm-report/src/main/java/com/logpm/report/vo/ReportOrderAllTimeVO.java
  38. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

3
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java

@ -204,4 +204,7 @@ public class DistributionStockEntity extends TenantEntity {
@ApiModelProperty(value = "取消操作人")
private String cancelUser;
@ApiModelProperty(value = "是否整托备货 0-否 1-是")
private Integer isTray;
}

1
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpClientVO.java

@ -49,6 +49,7 @@ public class DistributionAppStockUpClientVO implements Serializable {
private List<DistributionAppStockUpInventoryDetailVO> stockUpInventoryDetailVOList;
private List<DistributionAppStockUpZeroOrderDetailVO> stockUpZeroOrderDetailVOList;
private List<DistributionAppStockUpPackageDetailVO> deliveryPackageDetailList;
private List<DistributionAppStockUpTrayDetailVO> deliveryTrayList;

10
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpScanDetailVO.java

@ -31,12 +31,10 @@ import java.util.List;
public class DistributionAppStockUpScanDetailVO implements Serializable {
private static final long serialVersionUID = 1L;
private Long Id;
private String orderPackageCode;
private String typeName;
private String goodsName;
private String orderCode;
private String stockupAllocation;
private String trayName;
private String trayCode;
private Integer planNum;
private Integer scanNum;
}

41
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpTrayDetailVO.java

@ -0,0 +1,41 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.distribution.vo.app;
import lombok.Data;
import java.io.Serializable;
/**
* 在库订单包件清单 视图实体类
*
* @author cyz
* @since 2023-06-13
*/
@Data
public class DistributionAppStockUpTrayDetailVO implements Serializable {
private Long orderId;
private Long packageId;
private String waybillNumber;
private String orderCode;
private String categoryName;
private Integer planNum;
private String scanNum;
}

26
blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/ReportConfigOrderAllEntity.java

@ -0,0 +1,26 @@
package com.logpm.report.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.*;
import org.springblade.core.tenant.mp.TenantEntity;
@Data
@TableName("logpm_reportconfig_order_all")
@ApiModel(value = " ReportConfigOrderAll对象", description = "订单整体时效报表配置")
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ReportConfigOrderAllEntity extends TenantEntity {
private Long departureWarehouseId;
private String departureWarehouseName;
private Long destinationWarehouseId;
private String destinationWarehouseName;
private String brand;
private Integer dayTime;
}

27
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java

@ -1113,9 +1113,6 @@ public class DistributionStockupAppController extends BladeController {
if (Objects.isNull(stockupDTO.getReservationId())){
return R.fail("stockupDTO.getReservationId()参数缺失");
}
if (Objects.isNull(stockupDTO.getOrderId())){
return R.fail("stockupDTO.getOrderId()参数缺失");
}
if (Objects.isNull(stockupDTO.getTypeService())){
return R.fail("stockupDTO.getTypeService()参数缺失");
}
@ -1132,6 +1129,30 @@ public class DistributionStockupAppController extends BladeController {
}
}
@ResponseBody
@PostMapping("/trayDetail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "客户订单包件列表", notes = "传入stockupDTO")
public R trayDetail(@RequestBody StockupDTO stockupDTO) {
if (Objects.isNull(stockupDTO.getReservationId())){
return R.fail("stockupDTO.getReservationId()参数缺失");
}
if (Objects.isNull(stockupDTO.getTypeService())){
return R.fail("stockupDTO.getTypeService()参数缺失");
}
String typeService = stockupDTO.getTypeService();
Long orderId = stockupDTO.getOrderId();
Long reservationId = stockupDTO.getReservationId();
switch (typeService){
case "1": case "2":
return distributionStockupService.handleDeliveryTrayDetailList(reservationId);
case "3":
return distributionStockupService.handleBillTrayDetailList(reservationId);
default:
return R.fail("未知的typeService");
}
}
@ResponseBody
@PostMapping("/stockupScan")
@ApiOperationSupport(order = 1)

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

@ -26,9 +26,11 @@ import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionReservationExcel;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.DistributionAppStockUpTrayDetailVO;
import com.logpm.oldproject.dto.SignPushDataContactDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
@ -438,4 +440,12 @@ public interface DistributionReservationMapper extends BaseMapper<DistributionRe
* @return
*/
Integer getZeroPackagePlanNum(@Param("orderId")Long orderId,@Param("reservationId") Long reservationId,@Param("packageId") Long packageId);
/**
* 查询商市配可备货托盘
* @param reservationId
* @return
*/
List<DistributionAppStockUpTrayDetailVO> deliveryTrayDetailList(@Param("reservationId") Long reservationId);
}

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

@ -72,6 +72,46 @@
WHERE
reservation_id = #{reservationId} AND parce_list_id = #{packageId}
</delete>
<select id="deliveryTrayDetailList" resultType="com.logpm.distribution.vo.app.DistributionAppStockUpScanDetailVO" >
SELECT
t.trayName,
t.trayCode,
t.planNum,
t.scanNum,
SUM( lwtg.num )
FROM
(
SELECT
ldpl.pallet AS trayName,
lwt.pallet_code AS trayCode,
IFNULL( sum( ldpl.quantity ), 0 ) AS planNum,
ldpl.warehouse_id,
IFNULL( SUM( lds.stock_quantity ), 0 ) AS scanNum
FROM
logpm_distribution_reservation_package AS ldrp
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldrp.parce_list_id AND ldpl.is_deleted = 0 AND ldpl.is_transfer = 0
LEFT JOIN logpm_warehouse_tray AS lwt ON ldpl.pallet = lwt.pallet_name
AND lwt.warehouse_id = ldpl.warehouse_id
LEFT JOIN logpm_distribution_stock AS lds ON lds.reservation_id = ldrp.reservation_id
AND lds.type = 1
AND lds.outbound_type != 3
AND lds.cancel_status != 1
WHERE
ldrp.is_deleted = 0 AND ldrp.packet_bar_status != 2
AND ldrp.reservation_id = #{reservationId}
GROUP BY
ldpl.pallet
HAVING
IFNULL( sum( ldpl.quantity ), 0 ) > 0
) AS t
LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON lwtg.tray_code = t.trayCode
AND lwtg.is_deleted = 0
AND lwtg.warehouse_id = t.warehouse_id
GROUP BY
lwtg.tray_id
HAVING
t.planNum >= SUM( lwtg.num )
</select>
<update id="cancelReservationZeroPackage">
UPDATE logpm_distribution_reservation_zero_package AS ldrzp
SET ldrzp.quantity = ( ldrzp.quantity - #{retentionQuantity})

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml

@ -2347,7 +2347,7 @@
WHERE
ldrp.is_deleted = 0
AND ldrp.packet_bar_status != 2
AND ldrp.reservation_id = #{reservationId} AND ldrp.stock_article_id = #{orderId}
AND ldrp.reservation_id = #{reservationId}
</select>
<select id="selectBillPackageDetailList"
resultType="com.logpm.distribution.vo.app.DistributionAppStockUpPackageDetailVO">
@ -2368,7 +2368,7 @@
WHERE
ldbp.is_deleted = 0
AND ldbp.packet_bar_status != 2
AND ldbp.bill_lading_id = #{billId} AND ldbp.stock_article_id = #{orderId}
AND ldbp.bill_lading_id = #{billId}
</select>
</mapper>

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

@ -25,6 +25,7 @@ import com.logpm.distribution.dto.app.BillLadingAppDTO;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistrilbutionBillLadingExcel;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.DistributionAppStockUpTrayDetailVO;
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingDetailVO;
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderMainVO;
import com.logpm.oldproject.dto.SignPushDataContactDTO;
@ -214,7 +215,7 @@ public interface DistrilbutionBillLadingMapper extends BaseMapper<DistrilbutionB
List<DisStockListDetailEntity> selectInventoryListByBill(@Param("billId")Long billId);
List<DistributionAppStockUpTrayDetailVO> billTrayDetailList(@Param("billId")Long billId);
// Page<DistrilbutionBillLadingAppVO> getInventoryPage(IPage<Object> page, DistrilbutionBillLadingEntity distrilbutionBillLadingEntity);

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

@ -1124,6 +1124,47 @@
<select id="selectInventoryListByBill" resultType="com.logpm.distribution.entity.DisStockListDetailEntity">
SELECT * FROM logpm_dis_stock_list_detail WHERE reservation_id = #{billId} AND stock_package_status != 2
</select>
<select id="billTrayDetailList"
resultType="com.logpm.distribution.vo.app.DistributionAppStockUpTrayDetailVO">
SELECT
t.trayName,
t.trayCode,
t.planNum,
t.scanNum,
SUM( lwtg.num )
FROM
(
SELECT
ldpl.pallet AS trayName,
lwt.pallet_code AS trayCode,
IFNULL( sum( ldpl.quantity ), 0 ) AS planNum,
ldpl.warehouse_id,
IFNULL( SUM( lds.stock_quantity ), 0 ) AS scanNum
FROM
logpm_distrilbution_bill_package AS ldbp
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldbp.parce_list_id AND ldpl.is_deleted = 0 AND ldpl.is_transfer = 0
LEFT JOIN logpm_warehouse_tray AS lwt ON ldpl.pallet = lwt.pallet_name
AND lwt.warehouse_id = ldpl.warehouse_id
LEFT JOIN logpm_distribution_stock AS lds ON lds.reservation_id = ldbp.bill_lading_id
AND lds.type = 1
AND lds.outbound_type = 3
AND lds.cancel_status != 1
WHERE
ldbp.is_deleted = 0 AND ldbp.packet_bar_status != 2
AND ldbp.bill_lading_id = #{billId}
GROUP BY
ldpl.pallet
HAVING
IFNULL( sum( ldpl.quantity ), 0 ) > 0
) AS t
LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON lwtg.tray_code = t.trayCode
AND lwtg.is_deleted = 0
AND lwtg.warehouse_id = t.warehouse_id
GROUP BY
lwtg.tray_id
HAVING
t.planNum >= SUM( lwtg.num )
</select>
</mapper>

14
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java

@ -421,4 +421,18 @@ public interface IDistributionStockupService extends BaseService<DistributionSto
R cancelStock(StockupDTO stockupDTO);
boolean judgeIsPickingStaff(BladeUser user);
/**
* 查询客货下可备货托盘
* @param reservationId
* @return
*/
R handleDeliveryTrayDetailList(Long reservationId);
/**
* 查询自提托盘备货详情列表
* @param reservationId
* @return
*/
R handleBillTrayDetailList(Long reservationId);
}

204
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java

@ -105,14 +105,7 @@ import com.logpm.distribution.vo.DistributionStockupTrayVO;
import com.logpm.distribution.vo.DistributionStockupVO;
import com.logpm.distribution.vo.PackageStockupVO;
import com.logpm.distribution.vo.StockListInfoListVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpClientVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpInventoryConfiglVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpInventoryDetailVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpOrderDetailVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpPackageDetailVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpScanDetailVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpVO;
import com.logpm.distribution.vo.app.DistributionAppStockUpZeroOrderDetailVO;
import com.logpm.distribution.vo.app.*;
import com.logpm.distribution.wrapper.DistributionStockupWrapper;
import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient;
import com.logpm.warehouse.entity.WarehouseGoodsAllocationEntity;
@ -1985,8 +1978,6 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
return Resp.scanFail(PdaAudioLingoStatus.baojianbucunzai.getName(), PdaAudioLingoStatus.baojianbucunzai.getName());
}
//查询托盘上面的包件
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(stockupDTO.getTrayId(), stockupDTO.getTrayBarCode());
List<DistributionStockPackageVO> voList = new ArrayList<>();
List<DistributionStockPackageVO> finalList = list;
@ -4651,12 +4642,96 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
case 3:
//配送零担备货
return handleDeliveryZeroStockUp(stockupDTO, myCurrentWarehouse, reservationId, stockupEntity);
case 4:
//配送零担备货
return handleDeliveryTrayStockUp(stockupDTO, myCurrentWarehouse, reservationId, stockupEntity);
default:
log.error(method + "未知scanType");
return Resp.scanFail("未知操作类型", "未知操作类型");
}
}
private R handleDeliveryTrayStockUp(StockupDTO stockupDTO, BasicdataWarehouseEntity myCurrentWarehouse, Long reservationId, DistributionStockupEntity stockupEntity) {
String method = "#######################DistributionStockupServiceImpl.handleDeliveryTrayStockUp";
if (Objects.isNull(stockupDTO.getTrayBarCode())){
log.info(method+"参数缺失>>>>>>>>>>>>>>>>>>stockupDTO.getOrderId()");
return R.fail("参数缺失,请联系管理员");
}
if (Objects.isNull(AuthUtil.getUser())){
log.info(method+"参数缺失>>>>>>>>>>>>>>>>>>AuthUtil.getUser():{}",AuthUtil.getUser());
return R.fail("请重新登陆后操作");
}
DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId);
if (Objects.isNull(reservationEntity)) {
return Resp.scanFail("当前计划信息错误", "当前计划信息错误");
}
BladeUser user = AuthUtil.getUser();
//校验托盘
BasicdataTrayEntity trayByTrayCode = basicdataTrayClient.getTrayByTrayCode(stockupDTO.getTrayBarCode());
if (Objects.isNull(trayByTrayCode)){
log.info(method+"当前托盘信息不存在>>>>>>>>>>>>>>>>>>当前托盘信息不存在:{}",AuthUtil.getUser());
return R.fail("当前托盘信息不存在");
}
//查询当前托盘上货物是否都存在计划内
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(String.valueOf(trayByTrayCode.getId()), trayByTrayCode.getPalletCode());
if (trayIdList.isEmpty()) {
return R.fail("当前托盘无货物信息");
}
boolean isAllPackage = trayIdList.stream().allMatch(a -> "3".equals(a.getAssociationType()));
if (!isAllPackage) {
return R.fail("当前托盘存在其他类型货物");
}
//查询计划包件信息
List<DistributionParcelListEntity> distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationId);
if (distributionParcelListEntities.isEmpty()) {
log.info(method+"查询预约包件计划信息错误>>>>>>>>>>>>>>>>>>>>>>reservationId:{}",reservationId);
return R.fail("查询计划信息错误");
}
List<Long> trayPackageIds = trayIdList.stream().map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList());
List<DistributionParcelListEntity> packageData = distributionParcelListEntities.stream().filter(f -> trayPackageIds.contains(f.getId())).collect(Collectors.toList());
if (packageData.isEmpty()) {
return R.fail("当前托盘无此客户的货物");
}
warehouseUpdownTypeClient.downTray(trayByTrayCode.getPalletCode(),myCurrentWarehouse.getId());
//生成扫描数据
List<DistributionStockEntity> stockEntityList = generateDeliveryTrayPackageStockEntity(reservationEntity,packageData,myCurrentWarehouse,user,stockupDTO.getStockupId());
if (!stockEntityList.isEmpty()) {
distributionStockService.saveBatch(stockEntityList);
}
return Resp.scanSuccess("操作成功"," ");
}
private List<DistributionStockEntity> generateDeliveryTrayPackageStockEntity(DistributionReservationEntity reservationEntity,
List<DistributionParcelListEntity> packageData,
BasicdataWarehouseEntity warehouse,
BladeUser user,
Long stockUpId) {
List<DistributionStockEntity> list= new ArrayList<>();
for (DistributionParcelListEntity parcelListEntity : packageData) {
DistributionStockEntity distributionStockEntity = new DistributionStockEntity();
distributionStockEntity.setWarehouseId(warehouse.getId());
distributionStockEntity.setWarehouseName(warehouse.getName());
distributionStockEntity.setReservationId(reservationEntity.getId());
distributionStockEntity.setReservationCode(reservationEntity.getReservationCode());
distributionStockEntity.setStockQuantity(parcelListEntity.getQuantity());
distributionStockEntity.setOrderSelfNumbering(parcelListEntity.getOrderCode());
distributionStockEntity.setStockArticle(parcelListEntity.getStockArticleId());
distributionStockEntity.setParcelListId(parcelListEntity.getId());
distributionStockEntity.setCoding(parcelListEntity.getOrderPackageCode());
distributionStockEntity.setOutboundType(reservationEntity.getDeliveryType());
distributionStockEntity.setStockupId(stockUpId);
distributionStockEntity.setGoodsName(parcelListEntity.getThirdProduct());
distributionStockEntity.setType(1);
distributionStockEntity.setMaterialId(parcelListEntity.getMaterialId());
distributionStockEntity.setMarketId(reservationEntity.getMallId());
distributionStockEntity.setScanUser(user.getNickName());
distributionStockEntity.setIsTray(Integer.parseInt(IsOrNoConstant.yes.getValue()));
list.add(distributionStockEntity);
}
return list;
}
/**
*
* @param stockupDTO
@ -5172,12 +5247,96 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
case 3:
//零担
return handleBillZeroStockUp(stockupDTO, myCurrentWarehouse, reservationId, stockupEntity);
case 4:
//零担
return handleBilltrayStockUp(stockupDTO, myCurrentWarehouse, reservationId, stockupEntity);
default:
log.error(method + "未知scanType");
return Resp.scanFail("未知操作类型", "未知操作类型");
}
}
private R handleBilltrayStockUp(StockupDTO stockupDTO, BasicdataWarehouseEntity myCurrentWarehouse, Long reservationId, DistributionStockupEntity stockupEntity) {
String method = "#######################DistributionStockupServiceImpl.handleBilltrayStockUp";
if (Objects.isNull(stockupDTO.getTrayBarCode())){
log.info(method+"参数缺失>>>>>>>>>>>>>>>>>>stockupDTO.getTrayBarCode()");
return R.fail("参数缺失,请联系管理员");
}
if (Objects.isNull(AuthUtil.getUser())){
log.info(method+"参数缺失>>>>>>>>>>>>>>>>>>AuthUtil.getUser():{}",AuthUtil.getUser());
return R.fail("请重新登陆后操作");
}
DistrilbutionBillLadingEntity billLadingEntity = distrilbutionBillLadingService.getById(reservationId);
if (Objects.isNull(billLadingEntity)) {
return Resp.scanFail("当前计划信息错误", "当前计划信息错误");
}
BladeUser user = AuthUtil.getUser();
//校验托盘
BasicdataTrayEntity trayByTrayCode = basicdataTrayClient.getTrayByTrayCode(stockupDTO.getTrayBarCode());
if (Objects.isNull(trayByTrayCode)){
log.info(method+"当前托盘信息不存在>>>>>>>>>>>>>>>>>>当前托盘信息不存在:{}",AuthUtil.getUser());
return R.fail("当前托盘信息不存在");
}
//查询当前托盘上货物是否都存在计划内
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(String.valueOf(trayByTrayCode.getId()), trayByTrayCode.getPalletCode());
if (trayIdList.isEmpty()) {
return R.fail("当前托盘无货物信息");
}
boolean isAllPackage = trayIdList.stream().allMatch(a -> "3".equals(a.getAssociationType()));
if (!isAllPackage) {
return R.fail("当前托盘存在其他类型货物");
}
//查询计划包件信息
List<DistributionParcelListEntity> distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationId);
if (distributionParcelListEntities.isEmpty()) {
log.info(method+"查询预约包件计划信息错误>>>>>>>>>>>>>>>>>>>>>>reservationId:{}",reservationId);
return R.fail("查询计划信息错误");
}
List<Long> trayPackageIds = trayIdList.stream().map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList());
List<DistributionParcelListEntity> packageData = distributionParcelListEntities.stream().filter(f -> trayPackageIds.contains(f.getId())).collect(Collectors.toList());
if (packageData.isEmpty()) {
return R.fail("当前托盘无此客户的货物");
}
warehouseUpdownTypeClient.downTray(trayByTrayCode.getPalletCode(),myCurrentWarehouse.getId());
//生成扫描数据
List<DistributionStockEntity> stockEntityList = generateBillTrayPackageStockEntity(billLadingEntity,packageData,myCurrentWarehouse,user,stockupDTO.getStockupId());
if (!stockEntityList.isEmpty()) {
distributionStockService.saveBatch(stockEntityList);
}
return Resp.scanSuccess("操作成功"," ");
}
private List<DistributionStockEntity> generateBillTrayPackageStockEntity(DistrilbutionBillLadingEntity billLadingEntity,
List<DistributionParcelListEntity> packageData,
BasicdataWarehouseEntity myCurrentWarehouse,
BladeUser user,
Long stockupId) {
List<DistributionStockEntity> list= new ArrayList<>();
for (DistributionParcelListEntity parcelListEntity : packageData) {
DistributionStockEntity distributionStockEntity = new DistributionStockEntity();
distributionStockEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionStockEntity.setWarehouseName(myCurrentWarehouse.getName());
distributionStockEntity.setReservationId(billLadingEntity.getId());
distributionStockEntity.setReservationCode(billLadingEntity.getPickupBatch());
distributionStockEntity.setStockQuantity(parcelListEntity.getQuantity());
distributionStockEntity.setOrderSelfNumbering(parcelListEntity.getOrderCode());
distributionStockEntity.setStockArticle(parcelListEntity.getStockArticleId());
distributionStockEntity.setParcelListId(parcelListEntity.getId());
distributionStockEntity.setCoding(parcelListEntity.getOrderPackageCode());
distributionStockEntity.setOutboundType("3");
distributionStockEntity.setStockupId(stockupId);
distributionStockEntity.setGoodsName(parcelListEntity.getThirdProduct());
distributionStockEntity.setType(1);
distributionStockEntity.setMaterialId(parcelListEntity.getMaterialId());
distributionStockEntity.setMarketId(billLadingEntity.getClientId());
distributionStockEntity.setScanUser(user.getNickName());
distributionStockEntity.setIsTray(Integer.parseInt(IsOrNoConstant.yes.getValue()));
list.add(distributionStockEntity);
}
return list;
}
private R handleBillZeroStockUp(StockupDTO stockupDTO, BasicdataWarehouseEntity myCurrentWarehouse, Long reservationId, DistributionStockupEntity stockupEntity) {
String method = "#######################DistributionStockupServiceImpl.handleDeliveryZeroStockUp";
if (Objects.isNull(stockupDTO.getOrderId())){
@ -5392,9 +5551,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
List<DistributionAppStockUpZeroOrderDetailVO> stockUpZeroOrderDetailVOList = this.handleStockupDeliveryZeroOrder(reservationEntity);
if (!stockUpZeroOrderDetailVOList.isEmpty()) {
stockUpClientVO.setStockUpZeroOrderDetailVOList(stockUpZeroOrderDetailVOList);
}
//零担
break;
}
default:
log.info("未知orderStatus>>>>>>>>>>>>>>orderStatus:{}",orderStatus);
}
break;
case "3":
@ -5426,6 +5586,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
stockUpClientVO.setStockUpZeroOrderDetailVOList(stockupBillZeroOrder);
}
break;
default:
log.info("未知orderStatus>>>>>>>>>>>>>>orderStatus:{}",orderStatus);
}
break;
default:
@ -5435,6 +5597,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
return R.data(stockUpClientVO);
}
@Override
public void maintainDeliveryStockUpEntity(Long stockupId) {
//查询此备货任务所关联的包件信息
@ -5892,6 +6056,17 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
return false;
}
@Override
public R handleDeliveryTrayDetailList(Long reservationId) {
return R.data(distributionReservationMapper.deliveryTrayDetailList(reservationId));
}
@Override
public R handleBillTrayDetailList(Long reservationId) {
return R.data(distrilbutionBillLadingMapper.billTrayDetailList(reservationId));
}
/**
* 自提库存品备货
*
@ -6430,6 +6605,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
.eq(DistributionReservationPackageEntity::getPacketBarCode, packetBarCode)
.ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
if (!packageEntityList.isEmpty()) {
return Resp.scanFail("无此备货计划","无此备货计划");
}
if (packageEntityList.size() > 1) {
return Resp.scanFail("当前包件计划重复", "当前包件计划重复");
}

9
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/config/InterceptorAdapterConfig.java

@ -1,5 +1,6 @@
package com.logpm.factorydata.suofeiya.config;
import com.logpm.factorydata.suofeiya.interceptor.FactoryAccountsInterceptor;
import com.logpm.factorydata.suofeiya.interceptor.LocalServerLoginAccountsInterceptor;
import com.logpm.factorydata.suofeiya.pros.FactoryDataSuoFeiYaProperties;
import com.logpm.factorydata.suofeiya.service.DeliveryNoteService;
@ -36,9 +37,11 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
// interceptorRegistry.addInterceptor(new FactoryAccountsInterceptor(factoryTokenService))
// .addPathPatterns("/**").order(1);
interceptorRegistry.addInterceptor(new FactoryAccountsInterceptor(redis, environment, redisLockClient, mockLoginService, suoFeiYaProperties, deliveryNoteService))
.addPathPatterns("/order/v1").order(2);
interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis, environment, redisLockClient, mockLoginService, suoFeiYaProperties, deliveryNoteService))
.addPathPatterns("/**").order(2);
.addPathPatterns("/**")
.excludePathPatterns("/order/v1")
.order(3);
}
}

28
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/controller/OrderController.java

@ -1,6 +1,7 @@
package com.logpm.factorydata.suofeiya.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.factorydata.suofeiya.service.DeliveryNoteService;
@ -10,6 +11,8 @@ import com.logpm.factorydata.suofeiya.vo.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -18,6 +21,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* 工厂订单 前端控制器
@ -34,6 +38,8 @@ public class OrderController {
@Lazy
@Resource
private DeliveryNoteService service;
@Resource
private RabbitTemplate rabbitTemplate;
@ResponseBody
@PostMapping
@ -64,9 +70,12 @@ public class OrderController {
log.info("接收工厂订单:{} ", jsonStr);
String res = "";
try {
DeliveryNoteVO params = vo.getParams();
if (ObjectUtil.isNotEmpty(params)) {
res = service.order(params);
String params = vo.getParams();
if(StrUtil.isNotEmpty(params)){
DeliveryNoteVO bean = JSONUtil.toBean(params, DeliveryNoteVO.class);
if (ObjectUtil.isNotEmpty(bean)) {
res = service.order(bean);
}
}
} catch (Exception e) {
log.error("工厂订单异常:{} ", e);
@ -75,4 +84,17 @@ public class OrderController {
return Resp.success(res);
}
@ResponseBody
@PostMapping("pushData")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "推送工厂节点数据", notes = "推送工厂节点数据")
public Resp pushData(@RequestBody String msg, HttpServletRequest request) {
log.info("推送工厂节点数据:{}", msg);
if (StrUtil.isNotEmpty(msg)) {
rabbitTemplate.convertAndSend(FactoryDataConstants.Mq.Exchanges.NODE_DATA_PUSH,
FactoryDataConstants.Mq.RoutingKeys.SFY_NODE_DATA_PUSH, msg);
}
return Resp.success("成功");
}
}

148
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/interceptor/FactoryAccountsInterceptor.java

@ -1,58 +1,148 @@
package com.logpm.factorydata.suofeiya.interceptor;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSONObject;
import com.logpm.factorydata.suofeiya.service.IFactoryTokenService;
import com.logpm.factorydata.suofeiya.pros.FactoryDataSuoFeiYaProperties;
import com.logpm.factorydata.suofeiya.service.DeliveryNoteService;
import com.logpm.factorydata.suofeiya.vo.FactoryAuthVO;
import com.logpm.factorydata.suofeiya.wrapper.RequestWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.component.MockLoginService;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.wrapper.CustomHttpServletRequestWrapper;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.Instant;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Log4j2
@AllArgsConstructor
public class FactoryAccountsInterceptor implements HandlerInterceptor {
private final IFactoryTokenService factoryTokenService;
@Resource
private BladeRedis bladeRedis;
@Resource
private Environment environment;
@Resource
private RedisLockClient redisLockClient;
@Resource
private MockLoginService mockLoginService;
@Resource
private FactoryDataSuoFeiYaProperties suoFeiYaProperties;
@Lazy
@Resource
private DeliveryNoteService deliveryNoteService;
public FactoryAccountsInterceptor(BladeRedis redis, Environment environment, RedisLockClient redisLockClient, MockLoginService mockLoginService, FactoryDataSuoFeiYaProperties suoFeiYaProperties, DeliveryNoteService deliveryNoteService) {
this.bladeRedis = redis;
this.environment = environment;
this.redisLockClient = redisLockClient;
this.mockLoginService = mockLoginService;
this.suoFeiYaProperties = suoFeiYaProperties;
this.deliveryNoteService = deliveryNoteService;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws CustomerException {
try {
log.info("##########preHandle: 认证开始--------------");
RequestWrapper myRequestWrapper = new RequestWrapper(request);
String body = myRequestWrapper.getBody();
log.info("##########preHandle: body={}", body);
JSONObject jsonObject = JSONObject.parseObject(body);
//获取头中参数
String token = request.getHeader("Authorization");
String corpId = request.getHeader("corpid");
if(StringUtil.isBlank(corpId)){
corpId = jsonObject.getString("corpid");
}
if(!StringUtil.hasLength(token)){
returnJson(response,JSONObject.toJSONString(R.fail(203,"认证不通过,token有误")));
// 获取头中参数
String authTime = request.getHeader("authTime");
if (StrUtil.isEmpty(authTime)) {
log.info("##########preHandle: 时间戳不能为空");
returnJson(response, JSONObject.toJSONString(R.fail(1, "时间戳不能为空")));
return false;
}
if(!StringUtil.hasLength(corpId)){
returnJson(response,JSONObject.toJSONString(R.fail(203,"认证不通过,corpId有误")));
String sign = request.getHeader("sign");
String companyCodeH = request.getHeader("companyCode");
log.info("##########preHandle: authTime={},sign={},companyCodeH={}", authTime, sign, companyCodeH);
String companyCode = jsonObject.getString("companyCode");
long secondTimestamp = Instant.now().getEpochSecond();
// 验证时间 不能大于5秒
if (StringUtil.isNotBlank(authTime)) {
long authTimeLong = Long.parseLong(authTime);
if (secondTimestamp - authTimeLong > suoFeiYaProperties.getAuthTime()) {
log.info("##########preHandle: 时间戳过期");
returnJson(response, JSONObject.toJSONString(R.fail(1, "认证不通过,时间戳过期")));
return false;
}
}
// 验证签名
String auth = suoFeiYaProperties.getAuth();
String md5Hex = MD5.create().digestHex(auth + authTime).toUpperCase();
log.info("##########preHandle: md5Hex={}", md5Hex);
if (!StrUtil.equals(md5Hex, sign)) {
log.info("##########preHandle: 签名不正确");
returnJson(response, JSONObject.toJSONString(R.fail(1, "认证不通过,签名不正确")));
return false;
}
log.info("##########preHandle: token={}",token);
//验证token
boolean b = factoryTokenService.verifyToken(token,corpId);
if(!b){
returnJson(response,JSONObject.toJSONString(R.fail(203,"认证不通过,token不存在或已过期")));
String account = "shujutongbu";
String tenantId = "627683";
String authorizationHeader = "bG9jYWw6bG9jYWxfc2VjcmV0";
if (StringUtil.isNotBlank(companyCode)) {
FactoryAuthVO authVO = deliveryNoteService.findFactoryAuth(companyCode);
if (ObjectUtil.isNotEmpty(authVO)) {
account = authVO.getLoginAccount();
tenantId = authVO.getTenantCode();
authorizationHeader = authVO.getAuthorizationHeader();
org.springblade.common.wrapper.CustomHttpServletRequestWrapper wrappedRequest = new CustomHttpServletRequestWrapper(request);
String key = CacheNames.LOCAL_SERVER_USER + tenantId + ":" + account;
String lockKey = key + ":lock";
JSONObject data = bladeRedis.get(key);
if (Objects.isNull(data)) {
boolean flag = redisLockClient.tryLock(lockKey, LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if (flag) {
data = bladeRedis.get(key);
if (Objects.isNull(data)) {
data = mockLoginService.mockToken(tenantId, account);
bladeRedis.setEx(key, data, 2591990L);
redisLockClient.unLock(lockKey, LockType.FAIR);
}
}
}
// 发送登录请求
log.info("##########preHandle: request={}", request);
wrappedRequest.addHeader("Blade-Auth", "bearer " + data.getString("access_token"));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Blade-Auth", "bearer " + data.get("access_token"));
httpHeaders.add("Authorization", "Basic " + authorizationHeader);
ThreadLocalUtil.put("bladeContext", httpHeaders);
// 用包装后的request替换原始request
request = wrappedRequest;
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return true;
}
}else{
returnJson(response, JSONObject.toJSONString(R.fail(1, "缺少参数 companyCode")));
return false;
}
return true;
return false;
} catch (Exception e) {
returnJson(response,JSONObject.toJSONString(R.fail(500,"服务异常,请联系管理员")));
e.printStackTrace();
returnJson(response, JSONObject.toJSONString(R.fail(5, "服务异常,请联系管理员")));
return false;
}
}
@ -68,19 +158,9 @@ public class FactoryAccountsInterceptor implements HandlerInterceptor {
} catch (IOException e) {
System.out.println(e.getMessage());
} finally {
if (writer != null){
if (writer != null) {
writer.close();
}
}
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
}
}

118
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/interceptor/LocalServerLoginAccountsInterceptor.java

@ -1,13 +1,9 @@
package com.logpm.factorydata.suofeiya.interceptor;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSONObject;
import com.logpm.factorydata.suofeiya.pros.FactoryDataSuoFeiYaProperties;
import com.logpm.factorydata.suofeiya.service.DeliveryNoteService;
import com.logpm.factorydata.suofeiya.vo.FactoryAuthVO;
import com.logpm.factorydata.suofeiya.wrapper.RequestWrapper;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.component.MockLoginService;
@ -17,7 +13,6 @@ import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
@ -31,7 +26,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.Instant;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@ -60,89 +54,47 @@ public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapt
this.suoFeiYaProperties = suoFeiYaProperties;
this.deliveryNoteService = deliveryNoteService;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws CustomerException {
String tenantId = request.getHeader("tenantCode");
if(StrUtil.isEmpty(tenantId)){
tenantId = "627683";
}
try {
log.info("##########preHandle: 认证开始--------------");
RequestWrapper myRequestWrapper = new RequestWrapper(request);
String body = myRequestWrapper.getBody();
log.info("##########preHandle: body={}", body);
JSONObject jsonObject = JSONObject.parseObject(body);
// 获取头中参数
String authTime = request.getHeader("authTime");
if (StrUtil.isEmpty(authTime)) {
log.info("##########preHandle: 时间戳不能为空");
returnJson(response, JSONObject.toJSONString(R.fail(1, "时间戳不能为空")));
return false;
}
String sign = request.getHeader("sign");
String companyCodeH = request.getHeader("companyCode");
log.info("##########preHandle: authTime={},sign={},companyCodeH={}", authTime, sign, companyCodeH);
String companyCode = jsonObject.getString("companyCode");
long secondTimestamp = Instant.now().getEpochSecond();
// 验证时间 不能大于5秒
if (StringUtil.isNotBlank(authTime)) {
long authTimeLong = Long.parseLong(authTime);
if (secondTimestamp - authTimeLong > suoFeiYaProperties.getAuthTime()) {
log.info("##########preHandle: 时间戳过期");
returnJson(response, JSONObject.toJSONString(R.fail(1, "认证不通过,时间戳过期")));
return false;
}
}
// 验证签名
String auth = suoFeiYaProperties.getAuth();
String md5Hex = MD5.create().digestHex(auth + authTime).toUpperCase();
log.info("##########preHandle: md5Hex={}", md5Hex);
if (!StrUtil.equals(md5Hex, sign)) {
log.info("##########preHandle: 签名不正确");
returnJson(response, JSONObject.toJSONString(R.fail(1, "认证不通过,签名不正确")));
return false;
}
String account = "shujutongbu";
String tenantId = "627683";
String authorizationHeader = "bG9jYWw6bG9jYWxfc2VjcmV0";
if (StringUtil.isNotBlank(companyCode)) {
FactoryAuthVO authVO = deliveryNoteService.findFactoryAuth(companyCode);
if (ObjectUtil.isNotEmpty(authVO)) {
account = authVO.getLoginAccount();
tenantId = authVO.getTenantCode();
authorizationHeader = authVO.getAuthorizationHeader();
org.springblade.common.wrapper.CustomHttpServletRequestWrapper wrappedRequest = new CustomHttpServletRequestWrapper(request);
String key = CacheNames.LOCAL_SERVER_USER + tenantId + ":" + account;
String lockKey = key + ":lock";
JSONObject data = bladeRedis.get(key);
if (Objects.isNull(data)) {
boolean flag = redisLockClient.tryLock(lockKey, LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if (flag) {
data = bladeRedis.get(key);
if (Objects.isNull(data)) {
data = mockLoginService.mockToken(tenantId, account);
bladeRedis.setEx(key, data, 2591990L);
redisLockClient.unLock(lockKey, LockType.FAIR);
}
}
org.springblade.common.wrapper.CustomHttpServletRequestWrapper wrappedRequest = new CustomHttpServletRequestWrapper(request);
String account ="shujutongbu";
String key = CacheNames.LOCAL_SERVER_USER+tenantId+":"+account;
String lockKey =key+":lock";
JSONObject data =bladeRedis.get(key);
if(Objects.isNull(data)){
boolean flag = redisLockClient.tryLock(lockKey, LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(key);
if(Objects.isNull(data)){
data = mockLoginService.mockToken(tenantId,account);
bladeRedis.setEx(key,data,2591990L);
redisLockClient.unLock(lockKey, LockType.FAIR);
}
// 发送登录请求
log.info("##########preHandle: request={}", request);
wrappedRequest.addHeader("Blade-Auth", "bearer " + data.getString("access_token"));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Blade-Auth", "bearer " + data.get("access_token"));
httpHeaders.add("Authorization", "Basic " + authorizationHeader);
ThreadLocalUtil.put("bladeContext", httpHeaders);
// 用包装后的request替换原始request
request = wrappedRequest;
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return true;
}
}else{
returnJson(response, JSONObject.toJSONString(R.fail(1, "缺少参数 companyCode")));
return false;
}
return false;
// 修改或添加header
// 发送登录请求
log.info("##########preHandle: request={}", data);
wrappedRequest.addHeader("Blade-Auth", "bearer "+data.getString("access_token"));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Blade-Auth","bearer "+data.get("access_token") );
httpHeaders.add( "Authorization", "Basic bG9jYWw6bG9jYWxfc2VjcmV0");
ThreadLocalUtil.put("bladeContext", httpHeaders);
// 用包装后的request替换原始request
request = wrappedRequest;
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return true;
} catch (Exception e) {
e.printStackTrace();
returnJson(response, JSONObject.toJSONString(R.fail(5, "服务异常,请联系管理员")));
returnJson(response, JSONObject.toJSONString(R.fail(500, "服务异常,请联系管理员")));
return false;
}
}
@ -165,4 +117,6 @@ public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapt
}
}

2
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/mapper/DeliveryNoteMapper.java

@ -17,7 +17,7 @@ import java.util.List;
@Mapper
public interface DeliveryNoteMapper extends BaseMapper<DeliveryNoteEntity> {
FactoryAuthVO findFactoryAuth(@Param("companyCode") String companyCode);
List<FactoryAuthVO> findFactoryAuth(@Param("companyCode") String companyCode);
List<FactoryAuthVO> findFactoryAuthByTenantCode(@Param("tenantId") String tenantId);
}

9
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/DeliveryNoteServiceImpl.java

@ -259,9 +259,12 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl<DeliveryNoteMapper,
if (StrUtil.isNotBlank(json)) {
return JSONUtil.toBean(json, FactoryAuthVO.class);
} else {
FactoryAuthVO factoryAuth = baseMapper.findFactoryAuth(companyCode);
bladeRedis.setEx(key, JSONUtil.toJsonStr(factoryAuth), Duration.ofDays(1));
return factoryAuth;
List<FactoryAuthVO> factoryAuth = baseMapper.findFactoryAuth(companyCode);
if(CollUtil.isNotEmpty(factoryAuth)){
FactoryAuthVO authVO = factoryAuth.get(0);
bladeRedis.setEx(key, JSONUtil.toJsonStr(authVO), Duration.ofDays(1));
return authVO;
}
}
}
return null;

12
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/service/impl/FactoryDataServiceImpl.java

@ -1,6 +1,7 @@
package com.logpm.factorydata.suofeiya.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
@ -218,7 +219,9 @@ public class FactoryDataServiceImpl implements FactoryDataService {
}
}
jsons.set("packageInfo", new JSONArray(packages));
jsons.set("orderType", key);
if(StrUtil.equals(key, "Z")){
jsons.set("orderType", key);
}
String jsonStr = JSONUtil.toJsonStr(jsons);
if (oldProperties.getEnable()) {
try {
@ -267,7 +270,9 @@ public class FactoryDataServiceImpl implements FactoryDataService {
jsons.set("paNo", JSONUtil.toJsonStr(packages));
jsons.set("remark", "");
jsons.set("orderExtendFields", new JSONArray());
jsons.set("orderType", key);
if(StrUtil.equals(key, "Z")){
jsons.set("orderType", key);
}
String jsonStr = JSONUtil.toJsonStr(jsons);
if (oldProperties.getEnable()) {
try {
@ -296,7 +301,8 @@ public class FactoryDataServiceImpl implements FactoryDataService {
param.put("timestamp", time);
// 加密
String digest = MD5.create().digestHex(jsonStr + appKey + time);
param.put("digest", digest);
String encode = Base64.encode(digest);
param.put("digest", encode);
log.info("推送节点数据:{}", JSONUtil.toJsonStr(param));
String post = HttpUtil.post(dataSuoFeiYaProperties.getPush().getPushHost() + paStatusUrl, param);
log.info("推送结果:{}", post);

2
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/vo/FactoryOrderDataVO.java

@ -22,6 +22,6 @@ public class FactoryOrderDataVO {
private String companyCode;
@ApiModelProperty("订单信息")
private DeliveryNoteVO params;
private String params;
}

4
blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/vo/Resp.java

@ -1,5 +1,6 @@
package com.logpm.factorydata.suofeiya.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
@ -7,7 +8,10 @@ import java.io.Serializable;
@Data
public class Resp implements Serializable {
@JsonProperty("result_code")
private String resultCode;
@JsonProperty("result_message")
private String resultMessage;
public Resp(String code, String message) {

25
blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportConfigController.java

@ -24,6 +24,7 @@ public class ReportConfigController extends BladeController {
private final IReportConfigDespatchService reportConfigDespatchService;
private final IReportConfigTransferService reportConfigTransferService;
private final IReportConfigAllTrunklineService reportConfigAllTrunklineService;
private final IReportConfigOrderAllService reportConfigOrderAllService;
//-------------------------开单及时率
@ -139,4 +140,28 @@ public class ReportConfigController extends BladeController {
return reportConfigAllTrunklineService.deleteAllTrunklineConfig(reportConfigDTO);
}
//--------------------订单整体准时
@PostMapping("/orderAllConfigPage")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "订单整体准时配置", notes = "订单整体准时配置")
public R orderAllConfigPage(@RequestBody ReportConfigDTO reportConfigDTO) {
return reportConfigOrderAllService.orderAllConfigPage(reportConfigDTO);
}
@PostMapping("/addOrderAllConfig")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增订单整体准时配置", notes = "新增订单整体准时配置")
public R addOrderAllConfig(@RequestBody ReportConfigDTO reportConfigDTO) {
return reportConfigOrderAllService.addOrderAllConfig(reportConfigDTO);
}
@PostMapping("/deleteOrderAllConfig")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "删除订单整体准时配置", notes = "删除订单整体准时配置")
public R deleteOrderAllConfig(@RequestBody ReportConfigDTO reportConfigDTO) {
return reportConfigOrderAllService.deleteOrderAllConfig(reportConfigDTO);
}
}

15
blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportTimeController.java

@ -150,5 +150,20 @@ public class ReportTimeController extends BladeController {
reportTimeService.zeroAllTrunklineTimeExport(reportTimeDTO,response);
}
//-----------------------订单整体时效------------------------
@PostMapping("/orderAllTimePage")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "订单整体时效报表", notes = "订单整体时效报表")
public R orderAllTimePage(@RequestBody ReportTimeDTO reportTimeDTO) {
return reportTimeService.orderAllTimePage(reportTimeDTO);
}
@PostMapping("/orderAllTimeExport")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "订单整体时效导出", notes = "订单整体时效导出")
public void orderAllTimeExport(@RequestBody ReportTimeDTO reportTimeDTO, HttpServletResponse response) {
reportTimeService.orderAllTimeExport(reportTimeDTO,response);
}
}

13
blade-service/logpm-report/src/main/java/com/logpm/report/dto/DestinationWarehouseDTO.java

@ -0,0 +1,13 @@
package com.logpm.report.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class DestinationWarehouseDTO implements Serializable {
private Long warehouseId;
private String warehouseName;
}

3
blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportConfigDTO.java

@ -21,12 +21,15 @@ public class ReportConfigDTO implements Serializable {
private String brand;
private Integer hoursTime;
private Integer dayTime;
private Long id;
private List<Long> departureWarehouseIds;
private List<Long> destinationWarehouseIds;
private List<DestinationWarehouseDTO> destinationWarehouseDTOList;
private Long departureWarehouseId;
private String departureWarehouseName;

14
blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportTimeDTO.java

@ -25,5 +25,19 @@ public class ReportTimeDTO implements Serializable {
private Date endTime;
private Integer hoursTime;
private Integer dayTime;
private String orderCode;
private String waybillCode;
private String brand;
private String shipper;
private String consignee;
private String departureWarehouseName;
private String destinationWarehouseName;
private String trainNumber;
private String loadCode;
}

13
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportConfigOrderAllMapper.java

@ -0,0 +1,13 @@
package com.logpm.report.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.report.dto.ReportConfigDTO;
import com.logpm.report.entity.ReportConfigOrderAllEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ReportConfigOrderAllMapper extends BaseMapper<ReportConfigOrderAllEntity> {
IPage<ReportConfigOrderAllEntity> orderAllConfigPage(IPage<Object> page, @Param("param") ReportConfigDTO reportConfigDTO);
}

31
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportConfigOrderAllMapper.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.logpm.report.mapper.ReportConfigOrderAllMapper">
<select id="orderAllConfigPage" resultType="com.logpm.report.entity.ReportConfigOrderAllEntity">
select *
from logpm_reportconfig_order_all rat
<where>
and rat.is_deleted = 0
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and rat.departure_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and rat.destination_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.brands != null and param.brands.size() > 0">
and rat.brand in
<foreach collection="param.brands" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

5
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.java

@ -2,6 +2,7 @@ package com.logpm.report.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.report.dto.ReportTimeDTO;
import com.logpm.report.entity.ReportConfigOrderAllEntity;
import com.logpm.report.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -43,4 +44,8 @@ public interface ReportTimeMapper {
IPage<ReportPackgeAllTrunklineTimeVO> zeroAllTrunklineTimePage(IPage<Object> page, @Param("param") ReportTimeDTO reportTimeDTO);
List<ReportPackgeAllTrunklineTimeVO> zeroAllTrunklineTimeExport(@Param("param") ReportTimeDTO reportTimeDTO);
IPage<ReportOrderAllTimeVO> orderAllTimePage(IPage<Object> page, @Param("param") ReportTimeDTO reportTimeDTO);
List<ReportConfigOrderAllEntity> orderAllTimeExport(@Param("param") ReportTimeDTO reportTimeDTO);
}

302
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml

@ -829,12 +829,10 @@
IFNULL(round(sum(IFNULL(t.sevenToTenNum,0))/sum(lww.total_count)*100,2),'0.00') sevenToTenArriveRate,
sum(IFNULL(t.moreTenNum,0)) moreTenArriveNum,
IFNULL(round(sum(IFNULL(t.moreTenNum,0))/sum(lww.total_count)*100,2),'0.00') moreTenArriveRate
from logpm_warehouse_waybill lww
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
left join (select ldpl.waybill_id,
from (select ldpl.waybill_id,
sum(ldpl.quantity) totalNum,
sum(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time )) timeSecond,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,0) HOUR ),1,0)) onTimeNum,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,#{param.hoursTime}) HOUR ),1,0)) onTimeNum,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0)) oneNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0)) twoNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0)) threeNum,
@ -850,24 +848,6 @@
where ldpl.conditions != 3
and ldpl.send_warehouse_id != ldpl.accept_warehouse_id
and ltad.create_time > '2024-10-22 00:00:00'
<if test="param.brandList != null and param.brandList.size() > 0">
and ltad.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and ldpl.send_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and ldpl.accept_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.startTime != null ">
and ltad.create_time &gt;= #{param.startTime}
</if>
@ -876,10 +856,10 @@
</if>
and ldpl.warehouse_id = ldpl.accept_warehouse_id
and ldpl.warehouse_id != ldpl.send_warehouse_id
group by ldpl.waybill_id) t on t.waybill_id = lww.id
where lww.waybill_type = 1
and lww.departure_warehouse_id != lww.destination_warehouse_id
and lww.create_time > '2024-10-22 00:00:00'
group by ldpl.waybill_id) t
left join logpm_warehouse_waybill lww on lww.id = t.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
where 1=1
<if test="param.businessLineList != null and param.businessLineList.size() > 0">
and waw.business_line in
<foreach collection="param.businessLineList" item="item" open="(" separator="," close=")">
@ -887,29 +867,23 @@
</foreach>
</if>
<if test="param.brandList != null and param.brandList.size() > 0">
and lww.brand in
and ltad.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and lww.departure_warehouse_id in
and ldpl.send_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and lww.destination_warehouse_id in
and ldpl.accept_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.startTime != null ">
and lww.create_time &gt;= #{param.startTime}
</if>
<if test="param.endTime != null ">
and lww.create_time &lt;= #{param.endTime}
</if>
group by waw.business_line,
lww.departure_warehouse_name,
lww.destination_warehouse_name,
@ -948,12 +922,10 @@
IFNULL(concat(round(sum(IFNULL(t.sevenToTenNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') sevenToTenArriveRate,
sum(IFNULL(t.moreTenNum,0)) moreTenArriveNum,
IFNULL(concat(round(sum(IFNULL(t.moreTenNum,0))/sum(lww.total_count)*100,2),'%'),'0.00%') moreTenArriveRate
from logpm_warehouse_waybill lww
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
left join (select ldpl.waybill_id,
from (select ldpl.waybill_id,
sum(ldpl.quantity) totalNum,
sum(TIMESTAMPDIFF(SECOND,ltad.create_time,ldpl.create_time )) timeSecond,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,0) HOUR ),1,0)) onTimeNum,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL IFNULL(lrat.hours_time,#{param.hoursTime}) HOUR ),1,0)) onTimeNum,
sum(if(ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ),1,0)) oneNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 24 HOUR ) &lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 48 HOUR ),1,0)) twoNum,
sum(if(DATE_ADD( ltad.create_time, INTERVAL 48 HOUR )&lt;ldpl.create_time and ldpl.create_time &lt;= DATE_ADD( ltad.create_time, INTERVAL 72 HOUR ),1,0)) threeNum,
@ -969,24 +941,6 @@
where ldpl.conditions != 3
and ldpl.send_warehouse_id != ldpl.accept_warehouse_id
and ltad.create_time > '2024-10-22 00:00:00'
<if test="param.brandList != null and param.brandList.size() > 0">
and ltad.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and ldpl.send_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and ldpl.accept_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.startTime != null ">
and ltad.create_time &gt;= #{param.startTime}
</if>
@ -995,10 +949,10 @@
</if>
and ldpl.warehouse_id = ldpl.accept_warehouse_id
and ldpl.warehouse_id != ldpl.send_warehouse_id
group by ldpl.waybill_id) t on t.waybill_id = lww.id
where lww.waybill_type = 1
and lww.departure_warehouse_id != lww.destination_warehouse_id
and lww.create_time > '2024-10-22 00:00:00'
group by ldpl.waybill_id) t
left join logpm_warehouse_waybill lww on lww.id = t.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = lww.departure_warehouse_id
where 1=1
<if test="param.businessLineList != null and param.businessLineList.size() > 0">
and waw.business_line in
<foreach collection="param.businessLineList" item="item" open="(" separator="," close=")">
@ -1006,29 +960,23 @@
</foreach>
</if>
<if test="param.brandList != null and param.brandList.size() > 0">
and lww.brand in
and ltad.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and lww.departure_warehouse_id in
and ldpl.send_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and lww.destination_warehouse_id in
and ldpl.accept_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.startTime != null ">
and lww.create_time &gt;= #{param.startTime}
</if>
<if test="param.endTime != null ">
and lww.create_time &lt;= #{param.endTime}
</if>
group by waw.business_line,
lww.departure_warehouse_name,
lww.destination_warehouse_name,
@ -1399,4 +1347,218 @@
lww.brand
</select>
<select id="orderAllTimePage" resultType="com.logpm.report.vo.ReportOrderAllTimeVO">
select ltad.order_code orderCode,
ltad.waybill_no waybillNo,
ltad.brand brand,
lww.shipper shipper,
lww.consignee consignee,
lww.departure_warehouse_name departureWarehouseName,
lww.destination_warehouse_name destinationWarehouseName,
GROUP_CONCAT(DISTINCT ltad.train_number) trainNumber,
GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) loadCode,
count(ltad.id) totalNum,
min(ltad.create_time) createTime,
min(ldpls.create_time) startIncomingTime,
min(ltcll.start_date) startTime,
min(ldplm.create_time) endIncomingTime,
min(lww.create_time) openTime,
min(lqd.delivery_plan_time) deliveryPlanTime,
min(lqd.sign_time) signTime,
min(lqd.review_time) reviewTime,
min(ltcllm.unload_date) endUnloadTime,
IFNULL(oat.day_time,#{param.dayTime}) dayTime,
IF(min(lqd.sign_time) IS NULL,'否','是') isUploadSignOrder,
IF(min(lqd.sign_time) IS NULL,'否','是') isUploadPut,
CEIL(TIMESTAMPDIFF(SECOND,min(ltad.create_time),min(ldplm.create_time))/3600/24) realdayTime,
CEIL(TIMESTAMPDIFF(SECOND,min(ltad.create_time),min(ldplm.create_time))/3600/24)-IFNULL(oat.day_time,#{param.dayTime}) delayTime,
if(CEIL(TIMESTAMPDIFF(SECOND,min(ltad.create_time),min(ldplm.create_time))/3600/24)-IFNULL(oat.day_time,#{param.dayTime}) > 0,'是','否') delayStatus,
case when sum(if(ldplm.order_package_status='70',1,0))=0 then '未签收'
when count(ltad.id) != sum(if(ldplm.order_package_status='70',1,0)) then '部分签收'
when count(ltad.id) = sum(if(ldplm.order_package_status='70',1,0)) then '已签收'
else '未知' end signStatus,
sum(if(ldplm.order_package_status='70',1,0)) signNum
from logpm_trunkline_advance_detail ltad
left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id
left join logpm_distribution_parcel_list ldpls on ldpls.warehouse_id = lww.departure_warehouse_id and ldpls.order_package_code = ltad.order_package_code
left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = ldpls.order_package_code and ltcls.warehouse_id = ldpls.warehouse_id
left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id
left join logpm_distribution_parcel_list ldplm on ldplm.warehouse_id = lww.destination_warehouse_id and ldplm.order_package_code = ltad.order_package_code
left join logpm_trunkline_cars_load_scan ltclsm on ltclsm.scan_code = ldplm.order_package_code and ltclsm.unload_node_id = ldplm.warehouse_id
left join logpm_trunkline_cars_load_line ltcllm on ltcllm.load_id = ltclsm.load_id and ltcllm.node_id = ltclsm.unload_node_id
left join logpm_quality_deliver lqd on lqd.order_package_code = ltad.order_package_code and lqd.retention_time is null
left join logpm_reportconfig_order_all oat on oat.departure_warehouse_id = lww.departure_warehouse_id and oat.destination_warehouse_id = lww.destination_warehouse_id and oat.brand = lww.brand
where ltad.waybill_id is not null
and ltad.create_time > '2024-10-22 00:00:00'
and lww.departure_warehouse_id != lww.destination_warehouse_id
<if test="param.startTime != null ">
and ltad.create_time &gt;= #{param.startTime}
</if>
<if test="param.endTime != null ">
and ltad.create_time &lt;= #{param.endTime}
</if>
<if test="param.brandList != null and param.brandList.size() > 0">
and lww.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and lww.departure_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and lww.destination_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.brand != null and param.brand !='' ">
and ltad.brand = #{param.brand}
</if>
<if test="param.orderCode != null and param.orderCode !='' ">
and ltad.order_code like concat('%',#{param.orderCode},'%')
</if>
<if test="param.waybillCode != null and param.waybillCode !='' ">
and ltad.waybill_no like concat('%',#{param.waybillCode},'%')
</if>
<if test="param.shipper != null and param.shipper !='' ">
and lww.shipper like concat('%',#{param.shipper},'%')
</if>
<if test="param.consignee != null and param.consignee !='' ">
and lww.consignee like concat('%',#{param.consignee},'%')
</if>
<if test="param.departureWarehouseName != null and param.departureWarehouseName !='' ">
and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%')
</if>
<if test="param.destinationWarehouseName != null and param.destinationWarehouseName !='' ">
and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%')
</if>
<if test="param.trainNumber != null and param.trainNumber !='' ">
and GROUP_CONCAT(DISTINCT ltad.train_number) like concat('%',#{param.trainNumber},'%')
GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) loadCode,
</if>
<if test="param.loadCode != null and param.loadCode !='' ">
and GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) like concat('%',#{param.loadCode},'%')
</if>
group by ltad.order_code,
ltad.waybill_no,
ltad.brand,
lww.shipper,
lww.consignee,
lww.departure_warehouse_name,
lww.destination_warehouse_name,
oat.day_time
</select>
<select id="orderAllTimeExport" resultType="com.logpm.report.vo.ReportOrderAllTimeVO">
select ltad.order_code orderCode,
ltad.waybill_no waybillNo,
ltad.brand brand,
lww.shipper shipper,
lww.consignee consignee,
lww.departure_warehouse_name departureWarehouseName,
lww.destination_warehouse_name destinationWarehouseName,
GROUP_CONCAT(DISTINCT ltad.train_number) trainNumber,
GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) loadCode,
count(ltad.id) totalNum,
min(ltad.create_time) createTime,
min(ldpls.create_time) startIncomingTime,
min(ltcll.start_date) startTime,
min(ldplm.create_time) endIncomingTime,
min(lww.create_time) openTime,
min(lqd.delivery_plan_time) deliveryPlanTime,
min(lqd.sign_time) signTime,
min(lqd.review_time) reviewTime,
min(ltcllm.unload_date) endUnloadTime,
IFNULL(oat.day_time,#{param.dayTime}) dayTime,
IF(min(lqd.sign_time) IS NULL,'否','是') isUploadSignOrder,
IF(min(lqd.sign_time) IS NULL,'否','是') isUploadPut,
CEIL(TIMESTAMPDIFF(SECOND,min(ltad.create_time),min(ldplm.create_time))/3600/24) realdayTime,
CEIL(TIMESTAMPDIFF(SECOND,min(ltad.create_time),min(ldplm.create_time))/3600/24)-IFNULL(oat.day_time,#{param.dayTime}) delayTime,
if(CEIL(TIMESTAMPDIFF(SECOND,min(ltad.create_time),min(ldplm.create_time))/3600/24)-IFNULL(oat.day_time,#{param.dayTime}) > 0,'是','否') delayStatus,
case when sum(if(ldplm.order_package_status='70',1,0))=0 then '未签收'
when count(ltad.id) != sum(if(ldplm.order_package_status='70',1,0)) then '部分签收'
when count(ltad.id) = sum(if(ldplm.order_package_status='70',1,0)) then '已签收'
else '未知' end signStatus,
sum(if(ldplm.order_package_status='70',1,0)) signNum
from logpm_trunkline_advance_detail ltad
left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id
left join logpm_distribution_parcel_list ldpls on ldpls.warehouse_id = lww.departure_warehouse_id and ldpls.order_package_code = ltad.order_package_code
left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = ldpls.order_package_code and ltcls.warehouse_id = ldpls.warehouse_id
left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id
left join logpm_distribution_parcel_list ldplm on ldplm.warehouse_id = lww.destination_warehouse_id and ldplm.order_package_code = ltad.order_package_code
left join logpm_trunkline_cars_load_scan ltclsm on ltclsm.scan_code = ldplm.order_package_code and ltclsm.unload_node_id = ldplm.warehouse_id
left join logpm_trunkline_cars_load_line ltcllm on ltcllm.load_id = ltclsm.load_id and ltcllm.node_id = ltclsm.unload_node_id
left join logpm_quality_deliver lqd on lqd.order_package_code = ltad.order_package_code and lqd.retention_time is null
left join logpm_reportconfig_order_all oat on oat.departure_warehouse_id = lww.departure_warehouse_id and oat.destination_warehouse_id = lww.destination_warehouse_id and oat.brand = lww.brand
where ltad.waybill_id is not null
and ltad.create_time > '2024-10-22 00:00:00'
and lww.departure_warehouse_id != lww.destination_warehouse_id
<if test="param.startTime != null ">
and ltad.create_time &gt;= #{param.startTime}
</if>
<if test="param.endTime != null ">
and ltad.create_time &lt;= #{param.endTime}
</if>
<if test="param.brandList != null and param.brandList.size() > 0">
and lww.brand in
<foreach collection="param.brandList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.departureWarehouseIds != null and param.departureWarehouseIds.size() > 0">
and lww.departure_warehouse_id in
<foreach collection="param.departureWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.destinationWarehouseIds != null and param.destinationWarehouseIds.size() > 0">
and lww.destination_warehouse_id in
<foreach collection="param.destinationWarehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.brand != null and param.brand !='' ">
and ltad.brand = #{param.brand}
</if>
<if test="param.orderCode != null and param.orderCode !='' ">
and ltad.order_code like concat('%',#{param.orderCode},'%')
</if>
<if test="param.waybillCode != null and param.waybillCode !='' ">
and ltad.waybill_no like concat('%',#{param.waybillCode},'%')
</if>
<if test="param.shipper != null and param.shipper !='' ">
and lww.shipper like concat('%',#{param.shipper},'%')
</if>
<if test="param.consignee != null and param.consignee !='' ">
and lww.consignee like concat('%',#{param.consignee},'%')
</if>
<if test="param.departureWarehouseName != null and param.departureWarehouseName !='' ">
and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%')
</if>
<if test="param.destinationWarehouseName != null and param.destinationWarehouseName !='' ">
and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%')
</if>
<if test="param.trainNumber != null and param.trainNumber !='' ">
and GROUP_CONCAT(DISTINCT ltad.train_number) like concat('%',#{param.trainNumber},'%')
GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) loadCode,
</if>
<if test="param.loadCode != null and param.loadCode !='' ">
and GROUP_CONCAT(DISTINCT IFNULL(ltcls.load_code,ltclsm.load_code)) like concat('%',#{param.loadCode},'%')
</if>
group by ltad.order_code,
ltad.waybill_no,
ltad.brand,
lww.shipper,
lww.consignee,
lww.departure_warehouse_name,
lww.destination_warehouse_name,
oat.day_time
</select>
</mapper>

14
blade-service/logpm-report/src/main/java/com/logpm/report/service/IReportConfigOrderAllService.java

@ -0,0 +1,14 @@
package com.logpm.report.service;
import com.logpm.report.dto.ReportConfigDTO;
import com.logpm.report.entity.ReportConfigOrderAllEntity;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
public interface IReportConfigOrderAllService extends BaseService<ReportConfigOrderAllEntity> {
R orderAllConfigPage(ReportConfigDTO reportConfigDTO);
R addOrderAllConfig(ReportConfigDTO reportConfigDTO);
R deleteOrderAllConfig(ReportConfigDTO reportConfigDTO);
}

4
blade-service/logpm-report/src/main/java/com/logpm/report/service/IReportTimeService.java

@ -39,4 +39,8 @@ public interface IReportTimeService {
R zeroAllTrunklineTimePage(ReportTimeDTO reportTimeDTO);
void zeroAllTrunklineTimeExport(ReportTimeDTO reportTimeDTO, HttpServletResponse response);
R orderAllTimePage(ReportTimeDTO reportTimeDTO);
void orderAllTimeExport(ReportTimeDTO reportTimeDTO, HttpServletResponse response);
}

51
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportConfigAllTrunklineServiceImpl.java

@ -1,8 +1,10 @@
package com.logpm.report.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.report.dto.DestinationWarehouseDTO;
import com.logpm.report.dto.ReportConfigDTO;
import com.logpm.report.entity.ReportConfigAdvanceDetailOpenEntity;
import com.logpm.report.entity.ReportConfigAllTrunklineEntity;
@ -14,6 +16,8 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
@ -35,27 +39,38 @@ public class ReportConfigAllTrunklineServiceImpl extends BaseServiceImpl<ReportC
public R addAllTrunklineConfig(ReportConfigDTO reportConfigDTO) {
Long departureWarehouseId = reportConfigDTO.getDepartureWarehouseId();
String departureWarehouseName = reportConfigDTO.getDepartureWarehouseName();
Long destinationWarehouseId = reportConfigDTO.getDestinationWarehouseId();
String destinationWarehouseName = reportConfigDTO.getDestinationWarehouseName();
List<DestinationWarehouseDTO> destinationWarehouseDTOList = reportConfigDTO.getDestinationWarehouseDTOList();
String brand = reportConfigDTO.getBrand();
QueryWrapper<ReportConfigAllTrunklineEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name",departureWarehouseName)
.eq("destination_warehouse_name",destinationWarehouseName)
.eq("is_deleted",0);
ReportConfigAllTrunklineEntity reportConfigAllTrunklineEntity = baseMapper.selectOne(queryWrapper);
if(!Objects.isNull(reportConfigAllTrunklineEntity)){
reportConfigAllTrunklineEntity.setHoursTime(reportConfigDTO.getHoursTime());
}else{
reportConfigAllTrunklineEntity = ReportConfigAllTrunklineEntity.builder()
.departureWarehouseId(departureWarehouseId)
.departureWarehouseName(departureWarehouseName)
.destinationWarehouseId(destinationWarehouseId)
.destinationWarehouseName(destinationWarehouseName)
.hoursTime(reportConfigDTO.getHoursTime())
.build();
List<ReportConfigAllTrunklineEntity> list = new ArrayList<>();
destinationWarehouseDTOList.forEach(destinationWarehouseDTO -> {
Long destinationWarehouseId = destinationWarehouseDTO.getWarehouseId();
String destinationWarehouseName = destinationWarehouseDTO.getWarehouseName();
QueryWrapper<ReportConfigAllTrunklineEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name",departureWarehouseName)
.eq("destination_warehouse_name",destinationWarehouseName)
.eq("is_deleted",0);
ReportConfigAllTrunklineEntity reportConfigAllTrunklineEntity = baseMapper.selectOne(queryWrapper);
if(!Objects.isNull(reportConfigAllTrunklineEntity)){
reportConfigAllTrunklineEntity.setHoursTime(reportConfigDTO.getHoursTime());
}else{
reportConfigAllTrunklineEntity = ReportConfigAllTrunklineEntity.builder()
.departureWarehouseId(departureWarehouseId)
.departureWarehouseName(departureWarehouseName)
.destinationWarehouseId(destinationWarehouseId)
.destinationWarehouseName(destinationWarehouseName)
.hoursTime(reportConfigDTO.getHoursTime())
.build();
}
list.add(reportConfigAllTrunklineEntity);
});
if(CollUtil.isNotEmpty(list)){
saveOrUpdateBatch(list);
}
saveOrUpdate(reportConfigAllTrunklineEntity);
return R.success("保存成功");
}

85
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportConfigOrderAllServiceImpl.java

@ -0,0 +1,85 @@
package com.logpm.report.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.report.dto.DestinationWarehouseDTO;
import com.logpm.report.dto.ReportConfigDTO;
import com.logpm.report.entity.ReportConfigOrderAllEntity;
import com.logpm.report.mapper.ReportConfigOrderAllMapper;
import com.logpm.report.service.IReportConfigOrderAllService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
@Slf4j
@AllArgsConstructor
public class ReportConfigOrderAllServiceImpl extends BaseServiceImpl<ReportConfigOrderAllMapper, ReportConfigOrderAllEntity> implements IReportConfigOrderAllService {
@Override
public R orderAllConfigPage(ReportConfigDTO reportConfigDTO) {
IPage<Object> page = new Page<>();
page.setCurrent(reportConfigDTO.getPageNum());
page.setSize(reportConfigDTO.getPageSize());
IPage<ReportConfigOrderAllEntity> ipage = baseMapper.orderAllConfigPage(page, reportConfigDTO);
return R.data(ipage);
}
@Override
public R addOrderAllConfig(ReportConfigDTO reportConfigDTO) {
Long departureWarehouseId = reportConfigDTO.getDepartureWarehouseId();
String departureWarehouseName = reportConfigDTO.getDepartureWarehouseName();
// Long destinationWarehouseId = reportConfigDTO.getDestinationWarehouseId();
// String destinationWarehouseName = reportConfigDTO.getDestinationWarehouseName();
List<DestinationWarehouseDTO> destinationWarehouseDTOList = reportConfigDTO.getDestinationWarehouseDTOList();
String brand = reportConfigDTO.getBrand();
List<ReportConfigOrderAllEntity> list = new ArrayList<>();
destinationWarehouseDTOList.forEach(destinationWarehouseDTO -> {
Long destinationWarehouseId = destinationWarehouseDTO.getWarehouseId();
String destinationWarehouseName = destinationWarehouseDTO.getWarehouseName();
QueryWrapper<ReportConfigOrderAllEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name",departureWarehouseName)
.eq("destination_warehouse_name",destinationWarehouseName)
.eq("is_deleted",0);
ReportConfigOrderAllEntity reportConfigOrderAllEntity = baseMapper.selectOne(queryWrapper);
if(!Objects.isNull(reportConfigOrderAllEntity)){
reportConfigOrderAllEntity.setDayTime(reportConfigDTO.getDayTime());
}else{
reportConfigOrderAllEntity = ReportConfigOrderAllEntity.builder()
.departureWarehouseId(departureWarehouseId)
.departureWarehouseName(departureWarehouseName)
.destinationWarehouseId(destinationWarehouseId)
.destinationWarehouseName(destinationWarehouseName)
.dayTime(reportConfigDTO.getDayTime())
.build();
}
list.add(reportConfigOrderAllEntity);
});
if(CollUtil.isNotEmpty(list)){
saveOrUpdateBatch(list);
}
return R.success("保存成功");
}
@Override
public R deleteOrderAllConfig(ReportConfigDTO reportConfigDTO) {
Long id = reportConfigDTO.getId();
removeById(id);
return R.success("删除成功");
}
}

98
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportTimeServiceImpl.java

@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.report.dto.ReportTimeDTO;
import com.logpm.report.entity.ReportConfigAdvanceDetailOpenEntity;
import com.logpm.report.entity.ReportConfigCheckWaybillEntity;
import com.logpm.report.entity.ReportConfigDespatchEntity;
import com.logpm.report.entity.ReportConfigTransferEntity;
import com.logpm.report.entity.*;
import com.logpm.report.mapper.ReportTimeMapper;
import com.logpm.report.service.*;
import com.logpm.report.vo.*;
@ -32,6 +29,8 @@ public class ReportTimeServiceImpl implements IReportTimeService {
private final IReportConfigCheckWaybillService checkWaybillService;
private final IReportConfigDespatchService despatchService;
private final IReportConfigTransferService transferService;
private final IReportConfigAllTrunklineService allTrunklineService;
private final IReportConfigOrderAllService orderAllService;
@Override
@ -320,6 +319,17 @@ public class ReportTimeServiceImpl implements IReportTimeService {
reportTimeDTO.setStartTime(CommonUtil.getStartByDateStr(reportTimeDTO.getStartTimeStr()));
reportTimeDTO.setEndTime(CommonUtil.getEndByDateStr(reportTimeDTO.getEndTimeStr()));
reportTimeDTO.setHoursTime(0);
QueryWrapper<ReportConfigAllTrunklineEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name","全部")
.eq("destination_warehouse_name","全部")
.eq("is_deleted",0);
ReportConfigAllTrunklineEntity allTrunklineEntity = allTrunklineService.getOne(queryWrapper);
if(!Objects.isNull(allTrunklineEntity)){
reportTimeDTO.setHoursTime(allTrunklineEntity.getHoursTime());
}
IPage<ReportPackgeAllTrunklineTimeVO> iPage = reportTimeMapper.packageAllTrunklineTimePage(page,reportTimeDTO);
@ -331,6 +341,17 @@ public class ReportTimeServiceImpl implements IReportTimeService {
reportTimeDTO.setStartTime(CommonUtil.getStartByDateStr(reportTimeDTO.getStartTimeStr()));
reportTimeDTO.setEndTime(CommonUtil.getEndByDateStr(reportTimeDTO.getEndTimeStr()));
reportTimeDTO.setHoursTime(0);
QueryWrapper<ReportConfigAllTrunklineEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name","全部")
.eq("destination_warehouse_name","全部")
.eq("is_deleted",0);
ReportConfigAllTrunklineEntity allTrunklineEntity = allTrunklineService.getOne(queryWrapper);
if(!Objects.isNull(allTrunklineEntity)){
reportTimeDTO.setHoursTime(allTrunklineEntity.getHoursTime());
}
List<ReportPackgeAllTrunklineTimeVO> list = reportTimeMapper.packageAllTrunklineTimeExport(reportTimeDTO);
//导出ls
@ -346,6 +367,18 @@ public class ReportTimeServiceImpl implements IReportTimeService {
reportTimeDTO.setStartTime(CommonUtil.getStartByDateStr(reportTimeDTO.getStartTimeStr()));
reportTimeDTO.setEndTime(CommonUtil.getEndByDateStr(reportTimeDTO.getEndTimeStr()));
reportTimeDTO.setHoursTime(0);
QueryWrapper<ReportConfigAllTrunklineEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name","全部")
.eq("destination_warehouse_name","全部")
.eq("is_deleted",0);
ReportConfigAllTrunklineEntity allTrunklineEntity = allTrunklineService.getOne(queryWrapper);
if(!Objects.isNull(allTrunklineEntity)){
reportTimeDTO.setHoursTime(allTrunklineEntity.getHoursTime());
}
IPage<ReportPackgeAllTrunklineTimeVO> iPage = reportTimeMapper.zeroAllTrunklineTimePage(page,reportTimeDTO);
@ -357,9 +390,66 @@ public class ReportTimeServiceImpl implements IReportTimeService {
reportTimeDTO.setStartTime(CommonUtil.getStartByDateStr(reportTimeDTO.getStartTimeStr()));
reportTimeDTO.setEndTime(CommonUtil.getEndByDateStr(reportTimeDTO.getEndTimeStr()));
reportTimeDTO.setHoursTime(0);
QueryWrapper<ReportConfigAllTrunklineEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name","全部")
.eq("destination_warehouse_name","全部")
.eq("is_deleted",0);
ReportConfigAllTrunklineEntity allTrunklineEntity = allTrunklineService.getOne(queryWrapper);
if(!Objects.isNull(allTrunklineEntity)){
reportTimeDTO.setHoursTime(allTrunklineEntity.getHoursTime());
}
List<ReportPackgeAllTrunklineTimeVO> list = reportTimeMapper.zeroAllTrunklineTimeExport(reportTimeDTO);
//导出ls
ExcelUtil.export(response, "零担干线整体时效报表导出", "零担干线整体时效报表导出", list, ReportPackgeAllTrunklineTimeVO.class);
}
@Override
public R orderAllTimePage(ReportTimeDTO reportTimeDTO) {
IPage<Object> page = new Page<>();
page.setCurrent(reportTimeDTO.getPageNum());
page.setSize(reportTimeDTO.getPageSize());
reportTimeDTO.setStartTime(CommonUtil.getStartByDateStr(reportTimeDTO.getStartTimeStr()));
reportTimeDTO.setEndTime(CommonUtil.getEndByDateStr(reportTimeDTO.getEndTimeStr()));
reportTimeDTO.setDayTime(0);
QueryWrapper<ReportConfigOrderAllEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name","全部")
.eq("destination_warehouse_name","全部")
.eq("is_deleted",0);
ReportConfigOrderAllEntity orderAllEntity = orderAllService.getOne(queryWrapper);
if(!Objects.isNull(orderAllEntity)){
reportTimeDTO.setDayTime(orderAllEntity.getDayTime());
}
IPage<ReportOrderAllTimeVO> iPage = reportTimeMapper.orderAllTimePage(page,reportTimeDTO);
return R.data(iPage);
}
@Override
public void orderAllTimeExport(ReportTimeDTO reportTimeDTO, HttpServletResponse response) {
reportTimeDTO.setStartTime(CommonUtil.getStartByDateStr(reportTimeDTO.getStartTimeStr()));
reportTimeDTO.setEndTime(CommonUtil.getEndByDateStr(reportTimeDTO.getEndTimeStr()));
reportTimeDTO.setDayTime(0);
QueryWrapper<ReportConfigOrderAllEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("departure_warehouse_name","全部")
.eq("destination_warehouse_name","全部")
.eq("is_deleted",0);
ReportConfigOrderAllEntity orderAllEntity = orderAllService.getOne(queryWrapper);
if(!Objects.isNull(orderAllEntity)){
reportTimeDTO.setDayTime(orderAllEntity.getDayTime());
}
List<ReportConfigOrderAllEntity> list = reportTimeMapper.orderAllTimeExport(reportTimeDTO);
//导出ls
ExcelUtil.export(response, "订单整体时效报表导出", "订单整体时效报表导出", list, ReportConfigOrderAllEntity.class);
}
}

103
blade-service/logpm-report/src/main/java/com/logpm/report/vo/ReportOrderAllTimeVO.java

@ -0,0 +1,103 @@
package com.logpm.report.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class ReportOrderAllTimeVO implements Serializable {
@ExcelProperty(value = "品牌")
private String brand;
@ExcelProperty(value = "发货单位")
private String shipper;
@ExcelProperty(value = "收货单位")
private String consignee;
@ExcelProperty(value = "订单号")
private String orderCode;
@ExcelProperty(value = "运单号")
private String waybillNo;
@ExcelProperty(value = "订单件数")
private Integer totalNum;
@ExcelProperty(value = "始发仓")
private String departureWarehouseName;
@ExcelProperty(value = "目的仓")
private String destinationWarehouseName;
@ExcelProperty(value = "客户车次号")
private String trainNumber;
@ExcelProperty(value = "干线车次号")
private String loadCode;
@ExcelProperty(value = "创建时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ExcelProperty(value = "始发仓入库时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date startIncomingTime;
@ExcelProperty(value = "发车时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@ExcelProperty(value = "目的仓入库")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date endIncomingTime;
@ExcelProperty(value = "目的仓卸车确认时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date endUnloadTime;
@ExcelProperty(value = "开单时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date openTime;
@ExcelProperty(value = "配送计划时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date deliveryPlanTime;
@ExcelProperty(value = "签收时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date signTime;
@ExcelProperty(value = "复核时间")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date reviewTime;
@ExcelProperty(value = "是否上传签收单")
private String isUploadSignOrder;
@ExcelProperty(value = "是否上传摆放照")
private String isUploadPut;
@ExcelProperty(value = "标准时效")
private Integer dayTime;
@ExcelProperty(value = "实际时效")
private Integer realdayTime;
@ExcelProperty(value = "延期时效")
private Integer delayTime;
@ExcelProperty(value = "是否超时")
private String delayStatus;
@ExcelProperty(value = "签收状态")
private String signStatus;
@ExcelProperty(value = "签收件数")
private Integer signNum;
}

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

@ -513,12 +513,9 @@
ltad.weight weight,
ltad.volume volume,
lbfc1.category_id incomeCategoryId,
IFNULL(lbfc1.category,'其他') incomeCategoryName,
lbfc2.category_id costCategoryId,
IFNULL(lbfc2.category,'其他') costCategoryName
IFNULL(lbfc1.category,'其他') incomeCategoryName
from logpm_trunkline_advance_detail ltad
left join logpm_basicdata_factory_category lbfc1 on lbfc1.brand = ltad.brand and IFNULL(lbfc1.firsts,1) = IFNULL(ltad.first_pack_name,1) and IFNULL(lbfc1.seconds,2) = IFNULL(ltad.second_pack_name,2) and IFNULL(lbfc1.thirds,3) = IFNULL(ltad.third_pack_name,3) and lbfc1.type = 1 AND IFNULL(lbfc1.materiel_name,4) = IFNULL(ltad.material_name,4) AND lbfc1.is_deleted = 0
left join logpm_basicdata_factory_category lbfc2 on lbfc2.brand = ltad.brand and IFNULL(lbfc2.firsts,1) = IFNULL(ltad.first_pack_name,1) and IFNULL(lbfc2.seconds,2) = IFNULL(ltad.second_pack_name,2) and IFNULL(lbfc2.thirds,3) = IFNULL(ltad.third_pack_name,3) and lbfc1.type = 2 AND IFNULL(lbfc2.materiel_name,4) = IFNULL(ltad.material_name,4) AND lbfc2.is_deleted = 0
where ltad.is_deleted = 0
<if test="param.advanceIds != null and param.advanceIds.size() > 0">
and ltad.advance_id in

Loading…
Cancel
Save