Browse Source

Merge branch 'pre-production'

master
zhenghaoyu 11 months ago
parent
commit
2a2d0c29d7
  1. 4
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataPriceCategoryWarehouseEntity.java
  2. 4
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/PriceWarehouseBasicVO.java
  3. 45
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/JobAnnotationAspect.java
  4. 14
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml
  5. 41
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/aspect/JobAnnotationAspect.java
  6. 43
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java
  7. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java
  8. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupZeroDTO.java
  9. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml
  10. 52
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  11. 123
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  12. 46
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java
  13. 41
      blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/aspect/JobAnnotationAspect.java
  14. 41
      blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/JobAnnotationAspect.java
  15. 6
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/InterceptorAdapterConfig.java
  16. 42
      blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/LocalServerLoginAccountsInterceptor.java
  17. 41
      blade-service/logpm-patch/src/main/java/com/logpm/patch/aspect/JobAnnotationAspect.java
  18. 368
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportDeliverMapper.xml
  19. 14
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  20. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml
  21. 28
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java
  22. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java
  23. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java
  24. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  25. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java
  26. 122
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java
  27. 36
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  28. 5
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/InterceptorAdapterConfig.java
  29. 49
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/RedissonConfig.java
  30. 39
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/interceptor/LocalServerLoginAccountsInterceptor.java
  31. 8
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java

4
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataPriceCategoryWarehouseEntity.java

@ -60,8 +60,10 @@ public class BasicdataPriceCategoryWarehouseEntity extends TenantEntity {
private Double withinThirtyPrice;
@ApiModelProperty(value = "30-60天")
private Double betweenThirtySixtyPrice;
@ApiModelProperty(value = "60天外")
@ApiModelProperty(value = "60-90天外")
private Double beyondSixtyPrice;
@ApiModelProperty(value = "90天外")
private Double beyondNinetyPrice;
@ApiModelProperty(value = "上限价格")
private Double maximumPrice;
@ApiModelProperty(value = "操作/装卸费")

4
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/PriceWarehouseBasicVO.java

@ -38,8 +38,10 @@ public class PriceWarehouseBasicVO implements Serializable {
private Double withinThirtyPrice;
@ApiModelProperty(value = "30-60天")
private Double betweenThirtySixtyPrice;
@ApiModelProperty(value = "60天")
@ApiModelProperty(value = "60-90天")
private Double beyondSixtyPrice;
@ApiModelProperty(value = "90天外")
private Double beyondNinetyPrice;
@ApiModelProperty(value = "上限价格")
private Double maximumPrice;

45
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/JobAnnotationAspect.java

@ -8,12 +8,11 @@ import lombok.AllArgsConstructor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springblade.common.annotations.LogpmAsync;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.constant.LauncherConstant;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
@ -22,10 +21,10 @@ import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
@ -33,6 +32,7 @@ import java.util.Objects;
public class JobAnnotationAspect {
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
@Around("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
public Object xxlJobAnnotationMethods(ProceedingJoinPoint joinPoint) throws Throwable {
@ -59,25 +59,32 @@ public class JobAnnotationAspect {
}
private JSONObject mockLogin(){
private JSONObject mockLogin() throws InterruptedException {
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,3200L);
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,20L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
return data;
}

14
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml

@ -57,11 +57,12 @@
lawo.work_order_type,
lawo.discovery_node,
lawo.work_order_number,
lawo.waybill_number,
laap.waybill_number,
lawo.order_code,
lawo.train_number,
lawo.FIRST,
lawo.secondary,
GROUP_CONCAT(laap.`first` separator ',') as `first`,
GROUP_CONCAT(laap.secondary separator ',') as secondary,
group_concat( DISTINCT laap.brand_name SEPARATOR ',' ) AS brandName,
lawo.vehicle_route,
lawo.deliver_goods_time,
lawo.discovery_time,
@ -84,7 +85,6 @@
lawo.process_number,
lawo.customer_service_name customerServiceName,
lawo.warehouse_id warehouseId,
lawo.brand_name brandName,
lawo.customer_service_id customerServiceId
FROM
logpm_aftersales_work_order lawo
@ -93,6 +93,7 @@
AND lap.conditions IN ( 1, 2 )
LEFT JOIN logpm_aftersales_completion_record lacr ON lacr.work_order_id = lawo.id
AND lacr.is_deleted = '0'
left join logpm_aftersales_abnormal_package laap on lawo.id = laap.work_order_id
<where>
lawo.is_deleted = 0
<if test="param.workOrderStatusNameS != null and param.workOrderStatusNameS != '' ">and lawo.work_order_status = #{param.workOrderStatusNameS } </if>
@ -156,9 +157,10 @@
<if test="param.vehicleRoute != null and param.vehicleRoute != '' ">and lawo.vehicle_route like concat('%', #{param.vehicleRoute },'%') </if>
<if test="param.workOrderStatus != null and param.workOrderStatus != '' and param.handleStatus != 40 "> and lawo.work_order_status in ( #{param.workOrderStatus }) </if>
<if test="param.customerServiceState!= null and param.customerServiceState == 80 ">and lawo.work_order_status in ('10') </if>
ORDER BY lawo.create_time DESC
</where>
</where>
group by lawo.id
ORDER BY lawo.create_time DESC
</select>
<update id="updateList">
<foreach collection="list" separator=";" close="" index="index" item="item" open="">

41
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/aspect/JobAnnotationAspect.java

@ -11,6 +11,8 @@ import org.aspectj.lang.annotation.Aspect;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.constant.LauncherConstant;
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.utils.ThreadLocalUtil;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
@ -22,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
@ -29,6 +32,7 @@ import java.util.Objects;
public class JobAnnotationAspect {
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
@Around("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
public Object xxlJobAnnotationMethods(ProceedingJoinPoint joinPoint) throws Throwable {
@ -55,25 +59,32 @@ public class JobAnnotationAspect {
}
private JSONObject mockLogin(){
private JSONObject mockLogin() throws InterruptedException {
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,3200L);
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,20L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
return data;
}

43
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java

@ -1461,14 +1461,16 @@ public class DistributionStockupAppController extends BladeController {
String audioValue = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.saomiaochenggong.getValue());
//进行备货库位上架
JSONObject jsonObject = new JSONObject();
jsonObject.put("warehouseId", myCurrentWarehouse.getId());
jsonObject.put("code",packetBarCode);
// jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
jsonObject.put("type", 2);
jsonObject.put("num", 1);
//TODO
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// if (!Func.isEmpty(stockupDTO.getStockupAllocationId())){
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("warehouseId", myCurrentWarehouse.getId());
// jsonObject.put("code",packetBarCode);
// jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
// jsonObject.put("type", 2);
// jsonObject.put("num", 1);
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// }
//扫码成功
return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue);
case 2:
@ -1589,12 +1591,6 @@ public class DistributionStockupAppController extends BladeController {
entity.setBillLadingId(reservationId);
DistributionStockupEntity byId = distributionStockupService.getById(stockupId);
entity.setStockupArea(byId.getStockupArea());
//修改包件备货状态
// one.setOrderPackageStockupStatus(StockupStatusConstant.yibeihuo.getValue());
//todo 待下架操作
// warehouseUpdownTypeClient.downPackage(stockupDTO.getPacketBarCode());
// distributionParcelListService.updateById(one);
} else {
entity.setReservationId(reservationId);
}
@ -1654,15 +1650,16 @@ public class DistributionStockupAppController extends BladeController {
});
//查询是否货位数据是否该下架
JSONObject jsonObject = new JSONObject();
jsonObject.put("warehouseId", myCurrentWarehouse.getId());
jsonObject.put("code",packetBarCode);
// jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
jsonObject.put("type", 2);
jsonObject.put("num", 1);
//进行了备货库位的选择才进行备货库位的上架
//TODO
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// if (!Func.isEmpty(stockupDTO.getStockupAllocationId())){
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("warehouseId", myCurrentWarehouse.getId());
// jsonObject.put("code",packetBarCode);
// jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
// jsonObject.put("type", 1);
// jsonObject.put("num", 1);
// //进行了备货库位的选择才进行备货库位的上架
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// }
//修改包件备货状态
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity();
parcelListEntity.setId(entity.getParcelListId());

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java

@ -14,7 +14,7 @@ public class StockupDTO implements Serializable {
private Integer status;//0未完成 1已完成
// private Long stockupAllocationId;//0未完成 1已完成
// private String stockupAllocationName;//0未完成 1已完成
private String stockupAllocationName;//0未完成 1已完成
/**
* 客户名城

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupZeroDTO.java

@ -22,7 +22,7 @@ public class StockupZeroDTO implements Serializable {
private String typeService;//备货类型 3 自提
private Long reservationId;//预约单id
private Integer num;//预约单id
private Long stockupAllocationId;//备货库位Id
// private Long stockupAllocationId;//备货库位Id
private String stockupAllocationName;//备货库位Id
}

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

@ -832,7 +832,7 @@
IFNULL(SUM(ldbls.quantity),0) AS actual_plan,
IFNULL(SUM(ldbls.quantity),0) AS delivery,
IFNULL(SUM(ldbls.quantity),0) AS sign,
(SELECT GROUP_CONCAT(site) FROM logpm_distribution_print WHERE bill_lading_id = ldbl.id GROUP BY bill_lading_id)
(SELECT GROUP_CONCAT(site) FROM logpm_distribution_print WHERE bill_lading_id = ldbl.id GROUP BY bill_lading_id) AS image
FROM
logpm_distrilbution_bill_lading AS ldbl
LEFT JOIN logpm_distribution_bill_lading_scan AS ldbls ON ldbls.bill_lading_id = ldbl.id AND ldbls.is_deleted = 0

52
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -595,20 +595,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//获取当前用户司机
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode())
);
if (!abnormalEntities.isEmpty()) {
//判断异常是否属于自身
boolean flag = abnormalEntities.stream().allMatch(a -> !distributionDeliveryListEntity.getId().equals(a.getDeliveryListId()) || !distrilbutionloadingscanDTO.getReservationId().equals(a.getReservationId()));
if (flag){
//该异常属于其他车次
String collect = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(","));
log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}",distributionDeliveryListEntity.getTrainNumber(),collect);
return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常");
}
}
//异步确认包条扫描信息
// distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode());
List<Long> packageLockIds = new ArrayList<>();
@ -657,6 +644,22 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode())
.eq(DistributionLoadscanAbnormalEntity::getPackageId, parcelList.getId())
);
if (!abnormalEntities.isEmpty()) {
//判断异常是否属于自身
boolean flag = abnormalEntities.stream().allMatch(a -> !distributionDeliveryListEntity.getId().equals(a.getDeliveryListId()) || !distrilbutionloadingscanDTO.getReservationId().equals(a.getReservationId()));
if (flag){
//该异常属于其他车次
String collect = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(","));
log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}",distributionDeliveryListEntity.getTrainNumber(),collect);
return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常");
}
}
@ -912,7 +915,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
jsonObject.put("code",trayTypeDataVO.getTrayCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distrilbutionloadingscanDTO.getReservationId());
jsonObject.put("type",3);
jsonObject.put("type",1);
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
@ -968,7 +971,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//备货库位下架
log.info("备货库位下架>>>>>>>>>>>>>>>>>>>>>>jsonObjects:{}",jsonObjects);
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
//查询已装车件数
// String str = getLoadingMsg(distrilbutionloadingscanDTO);
@ -2132,8 +2135,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
// TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
} else {
return Resp.scanFail("窜货", "窜货");
}
@ -5669,8 +5671,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
jsonObject.put("num",1);
jsonObject.put("remark","异常装车下架");
jsonObjects.add(jsonObject);
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
//修改包件装车状态
//修改包件状态 维护订单状态
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
@ -5893,7 +5894,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
jsonObject.put("code",loadedNum.intValue());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",loadscanEntity.getReservationId());
jsonObject.put("type",2);
jsonObject.put("type",3);
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
@ -5952,6 +5953,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionAsyncService.checkZeroStockArticleLoadingStatus(parcelNumberEntity, loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId());
// distributionAsyncService.checkLoadingByPackage(parcelListEntity,loadscanEntity.getDeliveryId(),loadscanEntity.getReservationId());
packageLockIds.add(loadscanEntity.getPackageId());
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",parcelListEntity.getOrderCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",loadscanEntity.getReservationId());
jsonObject.put("type",3);
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
}
}
} else {
@ -6025,8 +6034,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
log.error("#######################查询预约订单信息错误,reservationID:{}", distrilbutionloadingscanDTO.getReservationId());
}
}
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
//该客户的装车件数进行返回
//查询已装车件数
AtomicInteger abnormalLoadingNum = new AtomicInteger();

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

@ -822,8 +822,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
}
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
}
return R.status(true);
}
@ -1335,8 +1334,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//维护客户状态
distributionReservationService.maintenanceReservationInfo(reservationId);
//备货库位下架
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
return R.success("操作成功");
}
@ -2424,34 +2422,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
//查询当前客户的所有异常情况
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode())
// .eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, 1)
//修改 状态
);
if (!abnormalEntities.isEmpty()) {
//判断此包件的异常是否是当前扫描车次和客户
//首先判断存在异常是否不属于当前车次和客户
boolean flag = abnormalEntities.stream().allMatch(a -> !deliveryListEntity.getId().equals(a.getDeliveryListId()) || !distrilbutionloadingscanDTO.getReservationId().equals(a.getReservationId()));
if (flag){
//该异常属于其他车次
String collect = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(","));
log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}",deliveryListEntity.getTrainNumber(),collect);
return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常");
}
//判断具体的装车信息
// boolean flag = abnormalEntities.stream().filter(f->f.getAuditingStatus() == 1).allMatch(a -> deliveryListEntity.getId().equals(a.getDeliveryListId()) && distrilbutionloadingscanDTO.getReservationId().equals(a.getReservationId()));
// if (flag){
// //存在异常 进行异常签收还是异常装车区分
// return Resp.scanFail("包件已存在异常", "包件已存在异常");
// }
// String collect = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(","));
// log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}",deliveryListEntity.getTrainNumber(),collect);
// return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常");
}
if (Func.isNotEmpty(list)) {
//满足条件此码必定为库存品
//判断该库存品是否属于当前客户
@ -2466,6 +2437,25 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//查询该客户是否存在该包件信息
List<DistributionParcelListEntity> collect = parcelListEntityList.stream().filter(p -> p.getOrderPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
if (Func.isNotEmpty(collect) && collect.size() == 1) {
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode())
.eq(DistributionLoadscanAbnormalEntity::getPackageId, collect.get(0).getId())
//修改 状态
);
if (!abnormalEntities.isEmpty()) {
//判断此包件的异常是否是当前扫描车次和客户
//首先判断存在异常是否不属于当前车次和客户
boolean flag = abnormalEntities.stream().allMatch(a -> !deliveryListEntity.getId().equals(a.getDeliveryListId()) || !distrilbutionloadingscanDTO.getReservationId().equals(a.getReservationId()));
if (flag){
//该异常属于其他车次
String info = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(","));
log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}",deliveryListEntity.getTrainNumber(),info);
return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常");
}
//判断具体的装车信息
}
//存在则查询该包件是否进行装车
DistributionLoadscanEntity loadscanEntity = distributionLoadscanMapper.selectOne(Wrappers.<DistributionLoadscanEntity>query().lambda()
.ne(DistributionLoadscanEntity::getScanStatus, 1)
@ -2589,8 +2579,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
jsonObject.put("num",1);
jsonObject.put("remark","签收下架");
jsonObjects.add(jsonObject);
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
} else if (Func.isEmpty(collect)) {
//这里就需要对该包件信息是否属于该配送计划进行判定。如果属于该配送计划则是串货。不是那么则需要提示是否异常签收或者返回的操作
@ -3215,8 +3204,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
jsonObject.put("num",1);
jsonObject.put("remark","异常签收下架");
jsonObjects.add(jsonObject);
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
// Integer j = distributionSignforMapper.updateSignforNum(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
if (Func.isEmpty(loadscanEntity)) {
//更新装车包件数和签收包件数
@ -3677,8 +3665,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
jsonObject.put("num",1);
jsonObject.put("remark","签收下架");
jsonObjects.add(jsonObject);
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
}
//进行库存品包件状态维护
DisStockListDetailEntity disStockListDetailEntity = new DisStockListDetailEntity();
@ -4863,20 +4850,19 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - newLoadscaninvnEntity.getPackageNub());
stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + newLoadscaninvnEntity.getPackageNub());
distributionStockListService.updateById(stockListEntity);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",detailEntity.getStockPackageCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distributionSignforEntity.getReservationId());
jsonObject.put("type",2);
jsonObject.put("num",1);
jsonObject.put("remark","批量签收下架");
jsonObjects.add(jsonObject);
}
//不存在装车数据 这里需要进行装车数据的补录
detailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue());
detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue());
disStockListDetailService.updateById(detailEntity);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",detailEntity.getStockPackageCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distributionSignforEntity.getReservationId());
jsonObject.put("type",2);
jsonObject.put("num",1);
jsonObject.put("remark","批量签收下架");
jsonObjects.add(jsonObject);
}
} else {
log.error("################库存品未进行备货操作+{}", detailEntities);
@ -4939,6 +4925,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadscanEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionLoadscanEntity.setWarehouseName(myCurrentWarehouse.getName());
distributionLoadscanService.updateById(distributionLoadscanEntity);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",parcelListEntity.getOrderPackageCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distributionSignforEntity.getReservationId());
jsonObject.put("type",3);
jsonObject.put("num",parcelNumberEntity.getReservationNum() - distributionLoadscanEntity.getLoadedNub());
jsonObject.put("remark","批量签收下架");
jsonObjects.add(jsonObject);
} else {
//不存在装车数据
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity();
@ -5077,7 +5071,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
distributionLoadscanService.save(loadscanEntity);
packageLockIds.add(loadscanEntity.getPackageId());
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",parcelListEntity.getOrderPackageCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distributionSignforEntity.getReservationId());
jsonObject.put("type",3);
jsonObject.put("num",1);
jsonObject.put("remark","批量签收下架");
jsonObjects.add(jsonObject);
} else {
//存在装车数据
@ -5098,21 +5099,12 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
loadscanEntities.setSigningTime(signingTime);
distributionLoadscanService.updateById(loadscanEntities);
packageLockIds.add(loadscanEntities.getPackageId());
}
}
// distributionAsyncService.sendFactory(parcelListEntity, simpleDateFormat.format(new Date()), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
packageIds.add(parcelListEntity.getId());
orderCodes.add(parcelListEntity.getOrderCode());
packageCodes.add(parcelListEntity.getOrderPackageCode());
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",parcelListEntity.getOrderPackageCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distributionSignforEntity.getReservationId());
jsonObject.put("type",1);
jsonObject.put("num",1);
jsonObject.put("remark","批量签收下架");
jsonObjects.add(jsonObject);
}
@ -5795,7 +5787,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
reservationMap = reservationZeroPackageEntity.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getParcelListId));
}
int sum = parcelNumberDTOS.stream().mapToInt(DistributionParcelNumberDTO::getSigningNum).sum();
List<JSONObject> jsonObjects = new ArrayList<>();
for (DistributionParcelNumberDTO parcelNumberDTO : parcelNumberDTOS) {
List<DistributionReservationZeroPackageEntity> zeroPackageEntities = reservationMap.get(parcelNumberDTO.getParcelListId());
DistributionParcelNumberEntity distributionParcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.<DistributionParcelNumberEntity>query().lambda()
@ -5820,10 +5812,12 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
if (parcelNumberDTO.getSigningNum() > distributionReservationZeroPackageEntity.getQuantity()) {
log.info("#############零担签收超过计划数量ParcelListId:{},计划:{}录入,:{}", parcelNumberDTO.getParcelListId(), distributionReservationZeroPackageEntity.getQuantity(), parcelNumberDTO.getSigningNum());
}
int a = 0;
if (distributionLoadscanEntity.getLoadedNub() < parcelNumberDTO.getSigningNum()) {
//将装车和签收进行统一数量
distributionLoadscanEntity.setLoadedNub(parcelNumberDTO.getSigningNum());
distributionLoadscanEntity.setPackageNub(parcelNumberDTO.getSigningNum());
a = parcelNumberDTO.getSigningNum() - distributionLoadscanEntity.getLoadedNub();
}
deliveryNumber = distributionParcelNumberEntity.getDeliveryQuantity() + distributionLoadscanEntity.getReceivedQuantity() - parcelNumberDTO.getSigningNum();
@ -5843,6 +5837,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
signingNumber += distributionLoadscanEntity.getReceivedQuantity();
//进行签收数量的统计
distributionLoadscanService.updateById(distributionLoadscanEntity);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",parcelListEntity.getOrderCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distributionLoadscanEntity.getReservationId());
jsonObject.put("type",3);
jsonObject.put("num",a);
jsonObject.put("remark","签收下架");
jsonObjects.add(jsonObject);
} else {
log.info("#############零担签收存在多个装车记录ParcelListId:{}", parcelNumberDTO.getParcelListId());
}
@ -5896,17 +5898,15 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
handQuantity = distributionParcelNumberEntity.getHandQuantity() - parcelNumberDTO.getSigningNum();
outboundQuantity = distributionParcelNumberEntity.getOutboundQuantity() + parcelNumberDTO.getSigningNum();
signinQuantity = distributionParcelNumberEntity.getSigninQuantity() + parcelNumberDTO.getSigningNum();
List<JSONObject> jsonObjects = new ArrayList<>();
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",parcelListEntity.getOrderCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",loadscanEntity.getReservationId());
jsonObject.put("type",3);
jsonObject.put("num",1);
jsonObject.put("num",loadscanEntity.getLoadedNub());
jsonObject.put("remark","签收下架");
jsonObjects.add(jsonObject);
//TODO
// warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
}
//维护订单
if (outboundQuantity.equals(distributionParcelNumberEntity.getQuantity())) {
@ -5914,7 +5914,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
if (handQuantity == 0) {
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
}
if (signingNumber.equals(distributionParcelNumberEntity.getQuantity())) {
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue());

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

@ -1997,14 +1997,15 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
distributionStockService.saveBatch(list1);
//备货库位上架
JSONObject jsonObject = new JSONObject();
jsonObject.put("warehouseId", myCurrentWarehouse.getId());
jsonObject.put("code", stockupDTO.getTrayBarCode());
// jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
jsonObject.put("type", 4);
jsonObject.put("num", list1.size());
// TODO
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// if (!Func.isEmpty(stockupDTO.getStockupAllocationId())){
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("warehouseId", myCurrentWarehouse.getId());
// jsonObject.put("code", stockupDTO.getTrayBarCode());
// jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
// jsonObject.put("type", 4);
// jsonObject.put("num", list1.size());
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// }
}
int i = list1.isEmpty() ? 0 : list1.size();
return Resp.scanSuccess("整托拣货" + i + "件", "整托拣货" + i + "件");
@ -2526,10 +2527,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
return Resp.scanFail("请输入正确备货数量 !", "请输入正确备货数量 !");
}
}
if (ObjectUtils.isNull(stockupDTO.getStockupAllocationId())) {
log.error(method + "零担备货参数缺失AllocationId", stockupDTO);
return R.fail(3002, "请扫描备货库位!");
}
// if (ObjectUtils.isNull(stockupDTO.getStockupAllocationId())) {
// log.error(method + "零担备货参数缺失AllocationId", stockupDTO);
// return R.fail(3002, "请扫描备货库位!");
// }
//查询预约
DistributionReservationEntity reservationEntity = distributionReservationService.getById(stockupDTO.getReservationId());
if (Func.isEmpty(reservationEntity)) {
@ -2623,7 +2624,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
stockEntity.setMarketId(stockArticleEntity.getMallId());
stockEntity.setReservationCode(reservationEntity.getReservationCode());
stockEntity.setStockupArea(stockupDTO.getStockupAllocationName());
stockEntity.setStockupAreaId(stockupDTO.getStockupAllocationId());
// stockEntity.setStockupAreaId(stockupDTO.getStockupAllocationId());
if (Func.isNotEmpty(stockupDTO.getAllocationId())) {
log.info(method + "库位备货");
//查询库位零担
@ -2692,15 +2693,16 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
log.info(method + "无库位无托盘备货");
}
distributionStockService.save(stockEntity);
JSONObject jsonObject = new JSONObject();
jsonObject.put("warehouseId", myCurrentWarehouse.getId());
jsonObject.put("code", stockArticleEntity.getOrderCode());
jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
jsonObject.put("type", 3);
jsonObject.put("num", stockupDTO.getNum());
//备货库位上架
//TODO
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// if (!Func.isEmpty(stockupDTO.getStockupAllocationId())){
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("warehouseId", myCurrentWarehouse.getId());
// jsonObject.put("code", stockArticleEntity.getOrderCode());
// jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId());
// jsonObject.put("type", 3);
// jsonObject.put("num", stockupDTO.getNum());
// //备货库位上架
// warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject);
// }
return Resp.scanSuccess("备货成功", "本次成功备货" + stockupDTO.getNum() + "件");
}

41
blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/aspect/JobAnnotationAspect.java

@ -11,6 +11,8 @@ import org.aspectj.lang.annotation.Aspect;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.constant.LauncherConstant;
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.utils.ThreadLocalUtil;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
@ -22,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
@ -29,6 +32,7 @@ import java.util.Objects;
public class JobAnnotationAspect {
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
@Around("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
public Object xxlJobAnnotationMethods(ProceedingJoinPoint joinPoint) throws Throwable {
@ -55,25 +59,32 @@ public class JobAnnotationAspect {
}
private JSONObject mockLogin(){
private JSONObject mockLogin() throws InterruptedException {
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,3200L);
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,20L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
return data;
}

41
blade-service/logpm-factory/src/main/java/com/logpm/factory/aspect/JobAnnotationAspect.java

@ -11,6 +11,8 @@ import org.aspectj.lang.annotation.Aspect;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.constant.LauncherConstant;
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.utils.ThreadLocalUtil;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
@ -22,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
@ -29,6 +32,7 @@ import java.util.Objects;
public class JobAnnotationAspect {
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
@Around("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
public Object xxlJobAnnotationMethods(ProceedingJoinPoint joinPoint) throws Throwable {
@ -55,25 +59,32 @@ public class JobAnnotationAspect {
}
private JSONObject mockLogin(){
private JSONObject mockLogin() throws InterruptedException {
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,3200L);
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,20L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
return data;
}

6
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/InterceptorAdapterConfig.java

@ -7,9 +7,9 @@ import com.logpm.factory.interceptor.ZbFactoryAccountsInterceptor;
import com.logpm.factory.props.ZbFactoryProperties;
import lombok.AllArgsConstructor;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -25,6 +25,8 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer {
private final Environment environment;
private final RedisLockClient redisLockClient;
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
@ -36,7 +38,7 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer {
.excludePathPatterns("/factory/common/**").order(2);
interceptorRegistry.addInterceptor(new ZbFactoryAccountsInterceptor(zbFactoryProperties))
.addPathPatterns("/factory/zb/**").order(3);
interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis,environment)).addPathPatterns("/**").order(1);
interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis,environment,redisLockClient)).addPathPatterns("/**").order(1);
}
}

42
blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/LocalServerLoginAccountsInterceptor.java

@ -3,13 +3,15 @@ package com.logpm.factory.interceptor;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
import org.springblade.common.wrapper.CustomHttpServletRequestWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.constant.LauncherConstant;
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.ThreadLocalUtil;
import org.springframework.core.env.Environment;
@ -25,6 +27,7 @@ import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Log4j2
@AllArgsConstructor
@ -32,6 +35,8 @@ public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapt
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws CustomerException {
@ -41,20 +46,27 @@ public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapt
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
cn.hutool.http.HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,3200L);
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,20L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
// 修改或添加header

41
blade-service/logpm-patch/src/main/java/com/logpm/patch/aspect/JobAnnotationAspect.java

@ -11,6 +11,8 @@ import org.aspectj.lang.annotation.Aspect;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.constant.LauncherConstant;
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.utils.ThreadLocalUtil;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
@ -22,6 +24,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Aspect
@Component
@ -29,6 +32,7 @@ import java.util.Objects;
public class JobAnnotationAspect {
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
@Around("@annotation(com.xxl.job.core.handler.annotation.XxlJob)")
public Object xxlJobAnnotationMethods(ProceedingJoinPoint joinPoint) throws Throwable {
@ -55,25 +59,32 @@ public class JobAnnotationAspect {
}
private JSONObject mockLogin(){
private JSONObject mockLogin() throws InterruptedException {
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,3200L);
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,20L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
return data;
}

368
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportDeliverMapper.xml

@ -27,198 +27,194 @@
ss_num,
unloading_team_name
from (select
d.train_number train_number,
d.task_time task_time,
d.warehouse_name warehouse_name,
CASE
WHEN d.type = 1 THEN
'商配'
WHEN d.type = 2 THEN
'市配'
ELSE ''
END type,
CASE
WHEN d.kind = 1 THEN
'自主配送'
WHEN d.kind = 2 THEN
'自主配送'
ELSE ''
END kind,
d.vehicle_name vehicle_name,
d.driver_name driver_name,
d.distribution_company distribution_company,
CASE
WHEN d.delivery_status = 1 THEN
'待配送'
WHEN d.delivery_status = 2 THEN
'配送中'
WHEN d.delivery_status = 3 THEN
'已完成'
ELSE ''
END delivery_status,
d.customers_number customers_number,
d.price,
d.order_number order_number,
rn.num reservation_num,
rn.stnum reservation_stock_listNum,
IFNULL(loadScan.loadedNum, 0) loaded_num,
IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num,
IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num,
IFNULL(loadScan.reNum, 0) re_num,
IFNULL(loadscaninvn.reNum, 0) invn_re_num,
IFNULL(loadScan.exReNum, 0) ex_reNum,
ifnull(rn.dsNum, 0) ds_num,
ifnull(rn.ssNum, 0) ss_num,
ifnull(d.unloading_team_name, '') unloading_team_name
from
logpm_distribution_delivery_list d
LEFT JOIN (
SELECT lds.delivery_id,
COALESCE(sum(ldr1.reservation_num), 0) num,
COALESCE(sum(ldr1.reservation_stock_list_num), 0) stnum,
SUM(CASE
WHEN lds.driver_signing = 2 THEN
1
ELSE
0
END) dsNum,
SUM(CASE
WHEN lds.signing_status = 2 THEN
1
ELSE
0
END) ssNum
FROM logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr1 ON lds.reservation_id = ldr1.id
WHERE ldr1.reservation_status != '40'
GROUP BY lds.delivery_id order by null
) rn ON rn.delivery_id = d.id
left join (select t.delivery_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum,
sum(if(t.is_abnormal_loading = 1, 0, 1)) exLoadedNum,
sum(if(t.is_abnormal_signing = 1, 0, 1)) exReNum
from logpm_distribution_loadscan t
where t.scan_status != 1
group by t.delivery_id order by null) loadScan on loadScan.delivery_id = d.id
left join (select t.delivery_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum
from logpm_distribution_loadscaninvn t
where t.scan_status != 1
group by t.delivery_id order by null) loadscaninvn on loadscaninvn.delivery_id = d.id
where d.customers_number != 0) t
d.train_number train_number,
d.task_time task_time,
d.warehouse_name warehouse_name,
CASE
WHEN d.type = 1 THEN
'商配'
WHEN d.type = 2 THEN
'市配'
ELSE ''
END type,
CASE
WHEN d.kind = 1 THEN
'自主配送'
WHEN d.kind = 2 THEN
'自主配送'
ELSE ''
END kind,
d.vehicle_name vehicle_name,
d.driver_name driver_name,
d.distribution_company distribution_company,
CASE
WHEN d.delivery_status = 1 THEN
'待配送'
WHEN d.delivery_status = 2 THEN
'配送中'
WHEN d.delivery_status = 3 THEN
'已完成'
ELSE ''
END delivery_status,
d.customers_number customers_number,
d.price,
d.order_number order_number,
rn.num reservation_num,
rn.stnum reservation_stock_listNum,
IFNULL(loadScan.loadedNum, 0) loaded_num,
IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num,
IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num,
IFNULL(loadScan.reNum, 0) re_num,
IFNULL(loadscaninvn.reNum, 0) invn_re_num,
IFNULL(loadScan.exReNum, 0) ex_reNum,
ifnull(rn.dsNum, 0) ds_num,
ifnull(rn.ssNum, 0) ss_num,
ifnull(d.unloading_team_name, '') unloading_team_name
from logpm_distribution_delivery_list d
LEFT JOIN (SELECT lds.delivery_id,
COALESCE(sum(ldr1.reservation_num), 0) num,
COALESCE(sum(ldr1.reservation_stock_list_num), 0) stnum,
SUM(CASE
WHEN lds.driver_signing = 2 THEN
1
ELSE
0
END) dsNum,
SUM(CASE
WHEN lds.signing_status = 2 THEN
1
ELSE
0
END) ssNum
FROM logpm_distribution_signfor lds
left JOIN logpm_distribution_reservation ldr1 ON lds.reservation_id = ldr1.id
WHERE ldr1.reservation_status <![CDATA[<]]> '40'
GROUP BY lds.delivery_id
order by null) rn ON rn.delivery_id = d.id
left join (select t.delivery_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum,
sum(if(t.is_abnormal_loading = 1, 0, 1)) exLoadedNum,
sum(if(t.is_abnormal_signing = 1, 0, 1)) exReNum
from logpm_distribution_loadscan t
where t.scan_status != 1
group by t.delivery_id
order by null) loadScan on loadScan.delivery_id = d.id
left join (select t.delivery_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum
from logpm_distribution_loadscaninvn t
where t.scan_status != 1
group by t.delivery_id
order by null) loadscaninvn on loadscaninvn.delivery_id = d.id
where
d.customers_number > 0
and rn.num > 0) t
${ew.customSqlSegment}
</select>
<select id="getCustomerPage" resultType="com.logpm.report.vo.ReportCustomerVO">
select train_number,
reservation_code,
stock_article_id,
task_time,
warehouse_name,
receiving_unit,
mall_name,
consignee,
delivery_phone,
delivery_address,
type,
kind,
vehicle_name,
driver_name,
distribution_company,
delivery_status,
order_number,
reservation_num,
reservation_stock_sist_num,
loaded_num,
invn_loaded_num,
ex_loaded_num,
re_num,
invn_re_num,
ex_re_num,
sjsigning_time,
signee_name,
signing_time,
examine_user_name
reservation_code,
stock_article_id,
task_time,
warehouse_name,
receiving_unit,
mall_name,
consignee,
delivery_phone,
delivery_address,
type,
kind,
vehicle_name,
driver_name,
distribution_company,
delivery_status,
order_number,
reservation_num,
reservation_stock_sist_num,
loaded_num,
invn_loaded_num,
ex_loaded_num,
re_num,
invn_re_num,
ex_re_num,
sjsigning_time,
signee_name,
signing_time,
examine_user_name
from (select lddl.train_number train_number,
obj.reservation_code reservation_code,
obj.stock_article_id stock_article_id,
lddl.task_time task_time,
lddl.warehouse_name warehouse_name,
obj.receiving_unit receiving_unit,
obj.mall_name mall_name,
obj.consignee,
obj.delivery_phone delivery_phone,
obj.delivery_address delivery_address,
CASE
WHEN lddl.type = 1 THEN
'商配'
WHEN lddl.type = 2 THEN
'市配'
ELSE ''
END type,
CASE
WHEN lddl.kind = 1 THEN
'自主配送'
WHEN lddl.kind = 2 THEN
'自主配送'
ELSE ''
END kind,
lddl.vehicle_name vehicle_name,
lddl.driver_name driver_name,
lddl.distribution_company distribution_company,
CASE
WHEN lddl.delivery_status = 1 THEN
'待配送'
WHEN lddl.delivery_status = 2 THEN
'配送中'
WHEN lddl.delivery_status = 3 THEN
'已完成'
ELSE ''
END delivery_status,
lddl.order_number order_number,
rn.num reservation_num,
rsln.num reservation_stock_sist_num,
IFNULL(loadScan.loadedNum, 0) loaded_num,
IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num,
IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num,
IFNULL(loadScan.reNum, 0) re_num,
IFNULL(loadscaninvn.reNum, 0) invn_re_num,
IFNULL(loadScan.exReNum, 0) ex_re_num,
lds.sjsigning_time sjsigning_time,
lds.signee_name signee_name,
lds.signing_time signing_time,
lds.examine_user_name examine_user_name
from logpm_distribution_reservation obj
left join logpm_distribution_signfor lds on lds.reservation_id = obj.id
left join logpm_distribution_delivery_list lddl on lds.delivery_id = lddl.id
LEFT JOIN (SELECT lds.delivery_id,
COALESCE(sum(ldr.reservation_num), 0) num
FROM logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
WHERE ldr.reservation_status != '40'
GROUP BY lds.delivery_id) rn ON rn.delivery_id = lddl.id
LEFT JOIN (SELECT lds.delivery_id,
COALESCE(sum(ldr.reservation_stock_list_num), 0) num
FROM logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
GROUP BY lds.delivery_id) rsln ON rsln.delivery_id = lddl.id
left join (select t.delivery_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum,
sum(if(t.is_abnormal_loading = 1, 0, 1)) exLoadedNum,
sum(if(t.is_abnormal_signing = 1, 0, 1)) exReNum
from logpm_distribution_loadscan t
where t.scan_status != 1
group by t.delivery_id) loadScan on loadScan.delivery_id = lddl.id
obj.reservation_code reservation_code,
stockarticle.code stock_article_id,
lddl.task_time task_time,
lddl.warehouse_name warehouse_name,
obj.receiving_unit receiving_unit,
obj.mall_name mall_name,
obj.consignee,
obj.delivery_phone delivery_phone,
obj.delivery_address delivery_address,
CASE
WHEN lddl.type = 1 THEN
'商配'
WHEN lddl.type = 2 THEN
'市配'
ELSE ''
END type,
CASE
WHEN lddl.kind = 1 THEN
'自主配送'
WHEN lddl.kind = 2 THEN
'自主配送'
ELSE ''
END kind,
lddl.vehicle_name vehicle_name,
lddl.driver_name driver_name,
lddl.distribution_company distribution_company,
CASE
WHEN lddl.delivery_status = 1 THEN
'待配送'
WHEN lddl.delivery_status = 2 THEN
'配送中'
WHEN lddl.delivery_status = 3 THEN
'已完成'
ELSE ''
END delivery_status,
stockarticle.num order_number,
obj.reservation_num reservation_num,
obj.reservation_stock_list_num reservation_stock_sist_num,
IFNULL(loadScan.loadedNum, 0) loaded_num,
IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num,
IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num,
IFNULL(loadScan.reNum, 0) re_num,
IFNULL(loadscaninvn.reNum, 0) invn_re_num,
IFNULL(loadScan.exReNum, 0) ex_re_num,
lds.sjsigning_time sjsigning_time,
lds.signee_name signee_name,
lds.signing_time signing_time,
lds.examine_user_name examine_user_name
from logpm_distribution_reservation obj
left join logpm_distribution_signfor lds on lds.reservation_id = obj.id
left join logpm_distribution_delivery_list lddl on lds.delivery_id = lddl.id
left join (select stockarticle.reservation_id, count(*) num, group_concat(ldsa.order_code) code
from logpm_distribution_reservation_stockarticle stockarticle
left join logpm_distribution_stock_article ldsa on ldsa.id = stockarticle.stock_article_id
where stockarticle.stock_article_status != 2
group by stockarticle.reservation_id order by null) stockarticle on stockarticle.reservation_id = obj.id
left join (select t.reservation_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum,
sum(if(t.is_abnormal_loading = 1, 0, 1)) exLoadedNum,
sum(if(t.is_abnormal_signing = 1, 0, 1)) exReNum
from logpm_distribution_loadscan t
where t.scan_status != 1
group by t.reservation_id) loadScan on loadScan.reservation_id = obj.id
left join (select t.delivery_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum
from logpm_distribution_loadscaninvn t
group by t.delivery_id) loadscaninvn on loadscaninvn.delivery_id = lddl.id) t
left join (select t.reservation_id,
SUM(t.loaded_nub) loadedNum,
sum(t.received_quantity) reNum
from logpm_distribution_loadscaninvn t
group by t.reservation_id) loadscaninvn on loadscaninvn.reservation_id = obj.id
where obj.reservation_status <![CDATA[<]]> '40' and lddl.customers_number > 0
) t
${ew.customSqlSegment}
</select>
<select id="getDetailsPage" resultType="com.logpm.report.vo.ReportDetailVO">

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

@ -350,18 +350,10 @@
<select id="findListByExistsAndOrderPackageCodes" resultType="String">
select ltad.order_package_code
from logpm_trunkline_advance_detail ltad
where exists(
select 1 from (
<foreach collection="orderPackageCodeGroup" index="ind" item="item">
<if test="ind == 0">
select #{item} orderPackageCode
</if>
<if test="ind != 0">
union all
select #{item} orderPackageCode
</if>
where ltad.order_package_code in
<foreach collection="orderPackageCodeGroup" index="ind" item="item" open="(" separator="," close=")">
#{item}
</foreach>
) orderPackageCodes where orderPackageCodes.orderPackageCode = ltad.order_package_code)
</select>

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml

@ -705,7 +705,7 @@
sum(IF(ltcls.unload_node_id = #{warehouseId} and ltcls.type = 2 and ltcls.scan_status = '1',ltcls.unload_num,0)) manualNum
from logpm_trunkline_cars_load_scan ltcls
left join logpm_trunkline_cars_order ltco on ltco.waybill_id = ltcls.waybill_id and ltco.order_code = ltcls.order_code and ltco.load_id = #{loadId}
where ltcls.load_id =
where ltcls.load_id = #{loadId}
</select>
<select id="findParceListByCarsLoadScanIds" resultType="com.logpm.distribution.entity.DistributionParcelListEntity">

28
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java

@ -3,10 +3,8 @@ package com.logpm.trunkline.mq;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity;
import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity;
import com.logpm.trunkline.entity.TrunklineCarsOrderEntity;
import com.logpm.trunkline.dto.InComingDTO;
import com.logpm.trunkline.entity.*;
import com.logpm.trunkline.service.*;
import com.rabbitmq.client.Channel;
import lombok.AllArgsConstructor;
@ -27,13 +25,14 @@ import java.util.*;
@RabbitListener(queues = RabbitConstant.OPEN_ORDER_LOAD_SCAN_QUEUE)
public class OpenOrderToLoadListener {
private final ITrunklineAdvanceService advanceService;
private final ITrunklineAdvanceDetailService advanceDetailService;
private final ITrunklineCarsLoadScanService carsLoadScanService;
private final ITrunklineCarsLoadService carsLoadService;
private final ITrunklineCarsOrderService carsOrderService;
private final ITrunklineCarsLoadLineService carsLoadLineService;
private final ITrunklineWaybillOrderService waybillOrderService;
private final IInComingService inComingService;
@RabbitHandler
@Transactional(rollbackFor = Exception.class)
@ -48,6 +47,7 @@ public class OpenOrderToLoadListener {
Set<Long> loadIds = new HashSet<>();
for (Object object : advanceIds) {
Long advanceId = (Long) object;
TrunklineAdvanceEntity advanceEntity = advanceService.getById(advanceId);
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = advanceDetailService.findListByAdvanceId(advanceId);
for (TrunklineAdvanceDetailEntity advanceDetailEntity : advanceDetailEntityList) {
String orderPackageCode = advanceDetailEntity.getOrderPackageCode();
@ -61,7 +61,21 @@ public class OpenOrderToLoadListener {
carsLoadScanEntity.setIsSupple(1);
carsLoadScanEntity.setLoadingAbnormal(0);
carsLoadScanEntity.setUnloadAbnormal(0);
String packageStatus = advanceDetailEntity.getPackageStatus();
if("0".equals(packageStatus)){
//未入库,强制入库
Long warehouseId = advanceDetailEntity.getWarehouseId();
InComingDTO inComingDTO = new InComingDTO();
inComingDTO.setOrderPackageCode(orderPackageCode);
inComingDTO.setIncomingType(10);
inComingDTO.setWarehouseId(warehouseId);
inComingService.incomingPackage(inComingDTO);
carsLoadScanEntity.setFromWarehouseId(warehouseId);
}else{
carsLoadScanEntity.setFromWarehouseId(advanceDetailEntity.getIncomingWarehouseId());
}
carsLoadScanService.updateById(carsLoadScanEntity);
Long loadId = carsLoadScanEntity.getLoadId();
Long warehouseId = carsLoadScanEntity.getWarehouseId();
String warehouseName = carsLoadScanEntity.getWarehouseName();
@ -87,8 +101,8 @@ public class OpenOrderToLoadListener {
trunklineCarsOrderEntity.setLoadLineId(carsLoadLineEntity.getId());
trunklineCarsOrderEntity.setOrderCode(orderCode);
trunklineCarsOrderEntity.setWaybillNo(waybillNo);
Integer totalNum = waybillOrderService.findTotalNumByWaybillNoAndOrderCode(waybillId,orderCode);
trunklineCarsOrderEntity.setTotalNum(totalNum);
// Integer totalNum = waybillOrderService.findTotalNumByWaybillNoAndOrderCode(waybillId,orderCode);
trunklineCarsOrderEntity.setTotalNum(advanceEntity.getTotalNum());
trunklineCarsOrderEntity.setPlanNum(0);
trunklineCarsOrderEntity.setIsCustomer("0");
trunklineCarsOrderEntity.setRealNum(0);

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java

@ -27,7 +27,6 @@ import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -418,6 +417,8 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
@Override
public void abnormalListUnloadCheckByLoadIdAndWarehouseId(Long loadId, Long warehouseId, String warehouseName, String tenantId, Long userId, String nickName, Long deptId) {
log.info("################abnormalListUnloadCheckByLoadIdAndWarehouseId: 卸车报告生成开始 loadId={}",loadId);
UnloadReportVO unloadReportVO = trunklineCarsLoadScanService.findUnloadReport(loadId,warehouseId);
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId);
if(!Objects.isNull(carsLoadLineEntity)){

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

@ -49,7 +49,7 @@ public class InComingServiceImpl implements IInComingService {
Long warehouseId = inComingDTO.getWarehouseId();//仓库id
String warehouseName = inComingDTO.getWarehouseName();
Long billladingId = inComingDTO.getBillladingId();//提货单id
Integer incomingType = inComingDTO.getIncomingType();//入库类型 1码板打托 2扫码入库 3直接入库 4 按车次号入库 5按订单入库 6扫描入库 7 批量卸车入库 8卸车托盘 9卸分一体
Integer incomingType = inComingDTO.getIncomingType();//入库类型 1码板打托 2扫码入库 3直接入库 4 按车次号入库 5按订单入库 6扫描入库 7 批量卸车入库 8卸车托盘 9卸分一体 10补录数据入库
String trayCode = inComingDTO.getTrayCode();//托盘码
String trayType = inComingDTO.getTrayType();//打托方式

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

@ -332,7 +332,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
return R.success("验证成功");
}
@GlobalTransactional
@Transactional(rollbackFor = Exception.class)
@Override
public R openWaybill(OpenOrderDTO openOrderDTO) {

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

@ -184,7 +184,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
String filename = QRCodeUtil.createCodeToFile(vo.getQrCode());
map.put("img", QRCodeUtil.getEmpAutograph(filename));
// 订单号 生成二维码
String fileTypeName = QRCodeUtil.createCodeToFile(vo.getOrderCode());
String fileTypeName = QRCodeUtil.createCodeToFile(vo.getQrCode());
map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName));
data.add(map);
}

122
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

@ -456,8 +456,12 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
stockArticleEntity.setTypeService("1");//默认商配
if(!StringUtil.isBlank(waybillNo)){
if(!Objects.isNull(waybillEntity)){
if(Objects.isNull(waybillEntity)){
if(!StringUtil.isBlank(waybillNo)){
waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
if(Objects.isNull(waybillEntity)){
throw new CustomerException(405,"运单信息不存在");
}
Long consigneeId = waybillEntity.getConsigneeId();
BasicdataClientEntity clientEntity = basicdataClientClient.findEntityById(consigneeId);
@ -479,45 +483,67 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
if(!Objects.isNull(basicdataStoreBusinessEntity)){
stockArticleEntity.setTypeService(basicdataStoreBusinessEntity.getMold());
}
}
}else{
Long clientId = basicdataTripartiteMallClient.getClientIdByNameAndBrand(dealerName, advanceEntity.getBrand());
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(clientId);
if(!Objects.isNull(basicdataClientEntity)){
String clientType = basicdataClientEntity.getClientType();
if("5".equals(clientType)){
stockArticleEntity.setStoreId(basicdataClientEntity.getId());
stockArticleEntity.setStoreCode(basicdataClientEntity.getClientCode());
stockArticleEntity.setStoreName(basicdataClientEntity.getClientName());
//查询门店的父级商场
Long pid = basicdataClientEntity.getPid();
BasicdataClientEntity pidEntity = basicdataClientClient.findEntityById(pid);
if(!Objects.isNull(pidEntity)){
String pidEntityClientType = pidEntity.getClientType();
if("2".equals(pidEntityClientType)){
//商城
stockArticleEntity.setMallId(pidEntity.getId());
stockArticleEntity.setMallName(pidEntity.getClientName());
stockArticleEntity.setMallCode(pidEntity.getClientCode());
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(pidEntity.getId(), 3);
if(!Objects.isNull(basicdataStoreBusinessEntity)){
stockArticleEntity.setTypeService(basicdataStoreBusinessEntity.getMold());
}else{
Long clientId = basicdataTripartiteMallClient.getClientIdByNameAndBrand(dealerName, advanceEntity.getBrand());
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(clientId);
if(!Objects.isNull(basicdataClientEntity)){
String clientType = basicdataClientEntity.getClientType();
if("5".equals(clientType)){
stockArticleEntity.setStoreId(basicdataClientEntity.getId());
stockArticleEntity.setStoreCode(basicdataClientEntity.getClientCode());
stockArticleEntity.setStoreName(basicdataClientEntity.getClientName());
//查询门店的父级商场
Long pid = basicdataClientEntity.getPid();
BasicdataClientEntity pidEntity = basicdataClientClient.findEntityById(pid);
if(!Objects.isNull(pidEntity)){
String pidEntityClientType = pidEntity.getClientType();
if("2".equals(pidEntityClientType)){
//商城
stockArticleEntity.setMallId(pidEntity.getId());
stockArticleEntity.setMallName(pidEntity.getClientName());
stockArticleEntity.setMallCode(pidEntity.getClientCode());
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(pidEntity.getId(), 3);
if(!Objects.isNull(basicdataStoreBusinessEntity)){
stockArticleEntity.setTypeService(basicdataStoreBusinessEntity.getMold());
}
}
}
}
}else if("2".equals(clientType)){
//商城
stockArticleEntity.setMallId(basicdataClientEntity.getId());
stockArticleEntity.setMallName(basicdataClientEntity.getClientName());
stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(basicdataClientEntity.getId(), 3);
if(!Objects.isNull(basicdataStoreBusinessEntity)){
stockArticleEntity.setTypeService(basicdataStoreBusinessEntity.getMold());
}else if("2".equals(clientType)){
//商城
stockArticleEntity.setMallId(basicdataClientEntity.getId());
stockArticleEntity.setMallName(basicdataClientEntity.getClientName());
stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(basicdataClientEntity.getId(), 3);
if(!Objects.isNull(basicdataStoreBusinessEntity)){
stockArticleEntity.setTypeService(basicdataStoreBusinessEntity.getMold());
}
}
}
}
}else{
Long consigneeId = waybillEntity.getConsigneeId();
BasicdataClientEntity clientEntity = basicdataClientClient.findEntityById(consigneeId);
if(!Objects.isNull(clientEntity)){
stockArticleEntity.setMallId(clientEntity.getId());
stockArticleEntity.setMallName(clientEntity.getClientName());
stockArticleEntity.setMallCode(clientEntity.getClientCode());
}
String consignee = waybillEntity.getConsignee();
String consigneeName = waybillEntity.getConsigneeName();
String consigneeMobile = waybillEntity.getConsigneeMobile();
String consigneeAddress = waybillEntity.getConsigneeAddress();
stockArticleEntity.setConsigneeUnit(consignee);
stockArticleEntity.setConsigneePerson(consigneeName);
stockArticleEntity.setConsigneeMobile(consigneeMobile);
stockArticleEntity.setConsigneeAddress(consigneeAddress);
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(consigneeId, 3);
if(!Objects.isNull(basicdataStoreBusinessEntity)){
stockArticleEntity.setTypeService(basicdataStoreBusinessEntity.getMold());
}
}
stockArticleEntity.setCustomerName(advanceEntity.getCustomerName());
@ -564,19 +590,17 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelList.setWarehouse(warehouseEntity.getName());
parcelList.setWarehouseId(warehouseId);
String waybillNo = advanceEntity.getWaybillNo();
if(StringUtil.isNotBlank(waybillNo)){
if(!Objects.isNull(waybillEntity)){
Long departureWarehouseId = waybillEntity.getDepartureWarehouseId();
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId();
parcelList.setWaybillId(waybillEntity.getId());
parcelList.setWaybillNumber(waybillEntity.getWaybillNo());
parcelList.setSendWarehouseId(departureWarehouseId);
parcelList.setSendWarehouseName(waybillEntity.getDepartureWarehouseName());
parcelList.setAcceptWarehouseId(destinationWarehouseId);
parcelList.setAcceptWarehouseName(waybillEntity.getDestinationWarehouseName());
if(departureWarehouseId.equals(destinationWarehouseId)){
parcelList.setIsTransfer(0);
}
if(!Objects.isNull(waybillEntity)){
Long departureWarehouseId = waybillEntity.getDepartureWarehouseId();
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId();
parcelList.setWaybillId(waybillEntity.getId());
parcelList.setWaybillNumber(waybillEntity.getWaybillNo());
parcelList.setSendWarehouseId(departureWarehouseId);
parcelList.setSendWarehouseName(waybillEntity.getDepartureWarehouseName());
parcelList.setAcceptWarehouseId(destinationWarehouseId);
parcelList.setAcceptWarehouseName(waybillEntity.getDestinationWarehouseName());
if(departureWarehouseId.equals(destinationWarehouseId)){
parcelList.setIsTransfer(0);
}
}
parcelList.setConditions(1);

36
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -914,7 +914,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
String loadStatus = carsLoadEntity.getLoadStatus();
if (!"80".equals(loadStatus)) {
if ("80".equals(loadStatus)) {
log.warn("#############unloadByLoadId: 配载计划已终点卸车确认 loadStatus={}", loadStatus);
throw new CustomerException(400, "配载计划已终点卸车确认");
}
@ -2194,7 +2194,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
// log.warn("################loadingScan: 下架及解托包件失败");
// }
carsLoadScanEntity.setIsData(1);
isData = 1;
Long otherPackageId = otherParcelListEntity.getId();
@ -2243,16 +2242,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Long packageId = parcelListEntity.getId();
waybillNo = parcelListEntity.getWaybillNumber();
orderCode = parcelListEntity.getOrderCode();
waybillId = parcelListEntity.getWaybillId();
fromWarehouseId = parcelListEntity.getWarehouseId();
BasicdataWarehouseEntity fromWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(fromWarehouseId);
if (!Objects.isNull(fromWarehouseEntity)) {
fromWarehouseName = fromWarehouseEntity.getName();
}
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
if (!Objects.isNull(waybillEntity)) {
waybillId = waybillEntity.getId();
}
carsLoadScanEntity.setWaybillId(waybillId);
carsLoadScanEntity.setWaybillNo(waybillNo);
@ -5332,12 +5327,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, fromWarehouseId);
if (Objects.isNull(stockArticleEntity)) {
log.warn("##################removeCarsLoadScan: 订单信息不存在 fromWarehouseId={} orderCode={}", fromWarehouseId, orderCode);
return R.fail(405, "订单信息不存在");
if (!Objects.isNull(stockArticleEntity)) {
Long articleId = stockArticleEntity.getId();
distributionStockArticleClient.submitHandleNumByOrderId(-num, articleId);
}
Long articleId = stockArticleEntity.getId();
distributionStockArticleClient.submitHandleNumByOrderId(-num, articleId);
if (type == 1) {
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(scanCode, fromWarehouseId);
@ -5347,15 +5340,20 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
Long wid = parcelListEntity.getWarehouseId();
String waybillNumber = parcelListEntity.getWaybillNumber();
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNumber);
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId();
parcelListEntity.setOrderPackageStatus("20");
if (destinationWarehouseId.equals(wid)) {
Long waybillId = parcelListEntity.getWaybillId();
if(!Objects.isNull(waybillId)){
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId);
parcelListEntity.setIsTransfer(0);
} else {
parcelListEntity.setIsTransfer(1);
if(!Objects.isNull(waybillEntity)){
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId();
parcelListEntity.setOrderPackageStatus("20");
if (destinationWarehouseId.equals(wid)) {
parcelListEntity.setIsTransfer(0);
} else {
parcelListEntity.setIsTransfer(1);
}
}
}
distributionParcelListClient.update(parcelListEntity);
if (StringUtil.isNotBlank(trayCode)) {
updownTypeClient.downPackageOrDelTray(scanCode, warehouseId, "包件下架解托");

5
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/InterceptorAdapterConfig.java

@ -3,6 +3,7 @@ package com.logpm.warehouse.config;
import com.logpm.warehouse.config.interceptor.LocalServerLoginAccountsInterceptor;
import lombok.AllArgsConstructor;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@ -16,9 +17,11 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer {
private final Environment environment;
private final RedisLockClient redisLockClient;
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis,environment)).addPathPatterns("/oldpush/**").order(1);
interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis,environment,redisLockClient)).addPathPatterns("/oldpush/**").order(1);
}
}

49
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/RedissonConfig.java

@ -1,35 +1,26 @@
package com.logpm.warehouse.config;
import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
@Configuration
//@Configuration
public class RedissonConfig {
@Bean
public Redisson redisson() {
// 单机模式
Config config = new Config();
BladeRedis bean = SpringUtil.getBean(BladeRedis.class);
RedisConnectionFactory connectionFactory = bean.getRedisTemplate().getConnectionFactory();
LettuceConnectionFactory factory = (LettuceConnectionFactory) connectionFactory;
String hostName = factory.getHostName();
int port = factory.getPort();
String password = factory.getPassword();
config.useSingleServer().setAddress("redis://"+hostName+":"+port).setDatabase(2);
config.useSingleServer().setPassword(password);
return (Redisson) Redisson.create(config);
}
// @Bean
// public Redisson redisson() {
// // 单机模式
// Config config = new Config();
//
// BladeRedis bean = SpringUtil.getBean(BladeRedis.class);
//
// RedisConnectionFactory connectionFactory = bean.getRedisTemplate().getConnectionFactory();
//
// LettuceConnectionFactory factory = (LettuceConnectionFactory) connectionFactory;
//
// String hostName = factory.getHostName();
// int port = factory.getPort();
// String password = factory.getPassword();
//
// config.useSingleServer().setAddress("redis://"+hostName+":"+port).setDatabase(2);
// config.useSingleServer().setPassword(password);
// return (Redisson) Redisson.create(config);
// }
}

39
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/config/interceptor/LocalServerLoginAccountsInterceptor.java

@ -10,6 +10,8 @@ import org.springblade.common.constant.LauncherConstant;
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.ThreadLocalUtil;
import org.springframework.core.env.Environment;
@ -25,6 +27,7 @@ import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Log4j2
@AllArgsConstructor
@ -32,6 +35,7 @@ public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapt
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws CustomerException {
@ -41,20 +45,27 @@ public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapt
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,3200L);
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(Objects.requireNonNull(environment.getActiveProfiles()[0]))+"/blade-auth/oauth/token";
HttpRequest urlRequest = HttpRequest.post(url);
urlRequest.header("Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0");
urlRequest.header("Tenant-Id", "627683");
Map<String, Object> params = new HashMap<>();
params.put("grant_type", "local_server");
params.put("scope", "all");
params.put("username", account);
params.put("tenantId", "627683");
HttpResponse execute = urlRequest.form(params).execute();
String body = execute.body();
data = JSONObject.parseObject(body);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,20L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
// 修改或添加header

8
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java

@ -149,6 +149,7 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
this.save(warehouseUpdownStockupArea);
break;
case 2:
//库存
UpDownStockupAreaVO byPacketBarCodeAndWarehouseId = disStockListDetailClient.findByPacketBarCodeAndWarehouseId(warehouseId, code);
warehouseUpdownStockupArea.setAssociationValue(byPacketBarCodeAndWarehouseId.getAssociationValue());
warehouseUpdownStockupArea.setAssociationId(byPacketBarCodeAndWarehouseId.getAssociationId());
@ -171,7 +172,7 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
.eq(WarehouseUpdownStockupAreaEntity::getWarehouseId, warehouseId)
.eq(WarehouseUpdownStockupAreaEntity::getAssociationId, stockArticleEntity.getId())
.eq(WarehouseUpdownStockupAreaEntity::getAssociationValue, stockArticleEntity.getOrderCode())
.eq(WarehouseUpdownStockupAreaEntity::getAssociationValue, "3")
.eq(WarehouseUpdownStockupAreaEntity::getGoodsType, "3")
);
if (Func.isEmpty(updownStockupAreaEntity)) {
warehouseUpdownStockupArea.setAssociationValue(stockArticleEntity.getOrderCode());
@ -181,7 +182,7 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
warehouseUpdownStockupArea.setGoodsName(stockArticleEntity.getDescriptionGoods());
warehouseUpdownStockupArea.setMarketName(stockArticleEntity.getMallName());
warehouseUpdownStockupArea.setMarketId(stockArticleEntity.getMallId());
warehouseUpdownStockupArea.setGoodsType("2");
warehouseUpdownStockupArea.setGoodsType("3");
this.save(warehouseUpdownStockupArea);
} else {
int newNum = updownStockupAreaEntity.getNum() + num;
@ -217,7 +218,7 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
warehouseUpdownStockupAreaLogEntity.setNum(num);
warehouseUpdownStockupAreaLogService.save(warehouseUpdownStockupAreaLogEntity);
//修改库位状态
basicdataGoodsAllocationClient.updateAllocationStatus(stockUpAllocationId,"2");
basicdataGoodsAllocationClient.updateAllocationStatus(stockUpAllocationId,"3");
return null;
}
@ -276,7 +277,6 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
switch (warehouseUpdownStockupArea.getAssociationType()) {
case "1":
case "2":
case "4":
//库存品包件
//订制品
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func.copy(warehouseUpdownStockupArea, WarehouseUpdownStockupAreaLogEntity.class);

Loading…
Cancel
Save