Browse Source

Merge branch 'dev' into pre-production

master
pref_mail@163.com 10 months ago
parent
commit
231ce89e49
  1. 33
      blade-service/logpm-business/src/main/java/com/logpm/business/service/impl/BusinessPreOrderServiceImpl.java
  2. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryInfoService.java
  3. 159
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java
  4. 24
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

33
blade-service/logpm-business/src/main/java/com/logpm/business/service/impl/BusinessPreOrderServiceImpl.java

@ -57,6 +57,15 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
@Override
public Boolean inOrder(String ids) throws ServiceException {
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
throw new CustomerException("仓库信息不能为空");
}
// 查询出来需要处理的包条码
List<String> idArray = Arrays.asList(ids.split(","));
QueryWrapper wrapper = new QueryWrapper();
@ -66,6 +75,7 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
List<BusinessPreOrderEntity> list = baseMapper.selectList(wrapper);
List<BusinessPreOrderEntity> data = new ArrayList<>();
List<String> carNumberList = new ArrayList<>();
for (BusinessPreOrderEntity distributionBusinessPreOrderEntity : list) {
if (distributionBusinessPreOrderEntity.getInWarehouse() == 1) {
@ -76,10 +86,19 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
}
sb.append(distributionBusinessPreOrderEntity.getOrderPackageCode());
data.add(distributionBusinessPreOrderEntity);
if(!carNumberList.contains(distributionBusinessPreOrderEntity.getDistrCarNumber())){
carNumberList.add(distributionBusinessPreOrderEntity.getDistrCarNumber());
}
}
if(carNumberList.size()>1){
throw new ServiceException("不能同时操作多个车次");
}
BusinessSanDTO businessSanDTO = new BusinessSanDTO();
businessSanDTO.setOrderPackageCode(sb.toString());
businessSanDTO.setInWarehouseException(0);
businessSanDTO.setDistrCarNumber(carNumberList.get(0));
R r = inOrderWarehourse(businessSanDTO);
if (r.isSuccess()) {
// 更新成功
@ -281,7 +300,8 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
this.updateById(selectD);
int a = 0;
//记录当前车次的异常件数
Object o = bladeRedis.get(RedisKeyConstant.BUSINESS_IN_CARNUMBER + businessSanDTO.getDistrCarNumber());
String key =RedisKeyConstant.BUSINESS_IN_CARNUMBER + businessSanDTO.getDistrCarNumber()+businessSanDTO.getTrayCode();
Object o = bladeRedis.get(key);
if (Objects.isNull(o)) {
// 查询当前车次的异常入库数量
@ -295,12 +315,12 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
o = list3.size();
a = (int) o;
}
bladeRedis.setEx(RedisKeyConstant.BUSINESS_IN_CARNUMBER + businessSanDTO.getDistrCarNumber(), o, 60 * 60 * 24L);
bladeRedis.setEx(key, o, 60 * 60 * 24L);
} else {
a = (int) o;
a = a + 1;
bladeRedis.setEx(RedisKeyConstant.BUSINESS_IN_CARNUMBER + businessSanDTO.getDistrCarNumber(), a, 60 * 60 * 24L);
bladeRedis.setEx(key, a, 60 * 60 * 24L);
}
@ -336,12 +356,13 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
this.save(t);
}
R r = inOrderWarehourseByFeign(businessSanDTO);
if (r.isSuccess()) {
if (r.isSuccess() && t!=null) {
t.setInWarehouse(1);
this.updateById(t);
int a = 0;
//记录当前车次的异常件数
Object o = bladeRedis.get(RedisKeyConstant.BUSINESS_INEXCE_CARNUMBER + businessSanDTO.getDistrCarNumber());
String key =RedisKeyConstant.BUSINESS_INEXCE_CARNUMBER + businessSanDTO.getDistrCarNumber()+businessSanDTO.getTrayCode();
if (Objects.isNull(o)) {
// 查询当前车次的异常入库数量
@ -355,12 +376,12 @@ public class BusinessPreOrderServiceImpl extends BaseServiceImpl<BusinessPreOrde
if (!list3.isEmpty()) {
a = list3.size();
}
bladeRedis.setEx(RedisKeyConstant.BUSINESS_INEXCE_CARNUMBER + businessSanDTO.getDistrCarNumber(), a, 60 * 60 * 24L);
bladeRedis.setEx(key, a, 60 * 60 * 24L);
} else {
a = (int) o;
a = a + 1;
bladeRedis.setEx(RedisKeyConstant.BUSINESS_INEXCE_CARNUMBER + businessSanDTO.getDistrCarNumber(), a, 60 * 60 * 24L);
bladeRedis.setEx(key, a, 60 * 60 * 24L);
}
return Resp.scanSuccess("扫描成功", "异常" + a + "件");

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

@ -58,7 +58,7 @@ public interface IDistributionDeliveryInfoService extends BaseService<Distributi
* 从预约客户查询包条自定义分页
*
* @param page
* @param distributionDeliveryInfoDTO
* @param reservationPackageDTO
* @return
*/
IPage<DistributionParcelListVO> selectDistributionDeliveryInfowrapPage(Map<String,Object> reservationPackageDTO,IPage<DistributionParcelListVO> page);

159
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java

@ -98,73 +98,122 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
@Override
public IPage<DistributionParcelListVO> selectDistributionDeliveryInfowrapPage(Map<String, Object> reservationPackageDTO, IPage<DistributionParcelListVO> page) {
if (Func.isEmpty(reservationPackageDTO.get("reservationId"))) {
// 参数非空校验
if (reservationPackageDTO == null || page == null) {
throw new IllegalArgumentException("ReservationPackageDTO and page cannot be null");
}
// reservationId的数据类型转换安全性校验
String reservationIdStr = (String) reservationPackageDTO.get("reservationId");
if (Func.isEmpty(reservationIdStr)) {
return null;
}
long reservationId;
try {
reservationId = Long.parseLong(reservationIdStr);
} catch (NumberFormatException e) {
log.error("Invalid reservationId format: {}", reservationIdStr, e);
throw new IllegalArgumentException("Invalid reservationId format");
}
// 逻辑保持不变,优化了数据类型转换的安全性检查
if (Func.isNotEmpty(reservationPackageDTO.get("orderPackageStatus"))) {
String orderPackageStatus = (String) reservationPackageDTO.get("orderPackageStatus");
if (Func.isNotBlank(orderPackageStatus)) {
if (!"70".equals(orderPackageStatus)) {
reservationPackageDTO.put("unSigning", "70");
reservationPackageDTO.remove("orderPackageStatus");
}
if (Func.isNotBlank(orderPackageStatus) && !"70".equals(orderPackageStatus)) {
reservationPackageDTO.put("unSigning", "70");
reservationPackageDTO.remove("orderPackageStatus");
}
}
List<DistributionParcelListEntity> parcelListEntityList = baseMapper.selectDistributionDeliverywrapInfoPage(page, reservationPackageDTO);
Set<Long> ids = new HashSet<>();
Set<String> orderPackageCodes = new HashSet<>();
for (DistributionParcelListEntity distributionParcelListEntity : parcelListEntityList) {
ids.add(distributionParcelListEntity.getId());
orderPackageCodes.add(distributionParcelListEntity.getOrderPackageCode());
}
List<DistributionParcelListVO> parcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntityList);
parcelListVOS.forEach(p -> {
//查询扫描表,
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getPackageId, p.getId())
.eq(DistributionLoadscanEntity::getReservationId, Long.parseLong((String) reservationPackageDTO.get("reservationId")))
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
.eq(DistributionLoadscanEntity::getOrderPackageCode, p.getOrderPackageCode())
);
if (Func.isNotEmpty(loadscanEntity)) {
try {
p.setLoadingTime(loadscanEntity.getScanTime());
switch (loadscanEntity.getScanStatus()) {
case "1":
p.setScanStatus(LoadingStatusConstant.quxiao.getName());
break;
case "2":
p.setScanStatus(LoadingStatusConstant.saomiao.getName());
break;
case "3":
p.setScanStatus(LoadingStatusConstant.queren.getName());
break;
case "4":
p.setScanStatus(LoadingStatusConstant.yijianzhuangche.getName());
break;
case "5":
p.setScanStatus(LoadingStatusConstant.buluzhuangche.getName());
break;
default:
log.info("selectDistributionDeliveryInfowrapPage >>>loadscanEntity.getScanStatus() 不满足匹配条件 {}",loadscanEntity.getScanStatus());
break;
}
if (Func.isNotEmpty(loadscanEntity.getSigningTime())) {
p.setSigningTime(loadscanEntity.getSigningTime());
}
if (Func.isNotEmpty(loadscanEntity.getScanUser())) {
p.setScanUser(loadscanEntity.getScanUser());
}
if (Func.isNotEmpty(loadscanEntity.getDriverName())) {
p.setDriverName(loadscanEntity.getDriverName());
}
if (Func.isNotEmpty(loadscanEntity.getSigningUser())) {
p.setSigningUser(loadscanEntity.getSigningUser());
}
} catch (Exception e) {
log.error(">>> 系统异常",e);
throw new CustomerException("系统异常,请联系管理员");
}
}
});
// 保持不变,优化性能需要注意的是ids和orderPackageCodes的处理
List<DistributionLoadscanEntity> loadscanEntitys = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda()
.in(DistributionLoadscanEntity::getPackageId, ids)
.eq(DistributionLoadscanEntity::getReservationId, reservationId)
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
.in(DistributionLoadscanEntity::getOrderPackageCode, orderPackageCodes)
);
// 对加载的VO列表进行处理的逻辑抽取到一个独立的方法
processParcelListVOS(parcelListVOS, loadscanEntitys, reservationIdStr);
return page.setRecords(parcelListVOS);
}
private void processParcelListVOS(List<DistributionParcelListVO> parcelListVOS, List<DistributionLoadscanEntity> loadscanEntitys, String reservationIdStr) {
parcelListVOS.forEach(p -> {
DistributionLoadscanEntity loadscanEntity = getLoadscanEntity(loadscanEntitys, p);
if (Func.isNotEmpty(loadscanEntity)) {
try {
updateParcelStatus(p, loadscanEntity);
} catch (Exception e) {
log.error("Processing parcel failed for reservationId: {}, Error: {}", reservationIdStr, e.getMessage(), e);
throw new CustomerException("Processing parcel failed. Please contact administrator");
}
}
});
}
private void updateParcelStatus(DistributionParcelListVO parcel, DistributionLoadscanEntity loadscanEntity) {
parcel.setLoadingTime(loadscanEntity.getScanTime());
switch (loadscanEntity.getScanStatus()) {
case "1":
parcel.setScanStatus(LoadingStatusConstant.quxiao.getName());
break;
case "2":
parcel.setScanStatus(LoadingStatusConstant.saomiao.getName());
break;
case "3":
parcel.setScanStatus(LoadingStatusConstant.queren.getName());
break;
case "4":
parcel.setScanStatus(LoadingStatusConstant.yijianzhuangche.getName());
break;
case "5":
parcel.setScanStatus(LoadingStatusConstant.buluzhuangche.getName());
break;
default:
log.info("loadscanEntity.getScanStatus() does not meet matching conditions: {}", loadscanEntity.getScanStatus());
break;
}
if (Func.isNotEmpty(loadscanEntity.getSigningTime())) {
parcel.setSigningTime(loadscanEntity.getSigningTime());
}
if (Func.isNotEmpty(loadscanEntity.getScanUser())) {
parcel.setScanUser(loadscanEntity.getScanUser());
}
if (Func.isNotEmpty(loadscanEntity.getDriverName())) {
parcel.setDriverName(loadscanEntity.getDriverName());
}
if (Func.isNotEmpty(loadscanEntity.getSigningUser())) {
parcel.setSigningUser(loadscanEntity.getSigningUser());
}
}
private DistributionLoadscanEntity getLoadscanEntity(List<DistributionLoadscanEntity> loadscanEntitys, DistributionParcelListVO p) {
for (DistributionLoadscanEntity loadscanEntity : loadscanEntitys) {
if(loadscanEntity.getPackageId().equals(p.getId())&& loadscanEntity.getOrderPackageCode().equals(p.getOrderPackageCode())){
return loadscanEntity;
}
}
return null;
}
@Override
public IPage<DistributionDeliveryInfoVO> selectDistributionDeliveryInfopackdetail(IPage<DistributionDeliveryInfoVO> page, DistributionDeliveryInfoDTO distributionDeliveryInfoDTO) {
List<DistributionDeliveryInfoVO> distributionDeliveryInfoVOS = baseMapper.selectDistributionDeliverypackdetailPage(page, distributionDeliveryInfoDTO);

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

@ -2687,9 +2687,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
trunklinePackageTrackLogClient.addPackageTrackLog(aaa);
// 推送
sendMessage(distrilbutionloadingscanDTO.getBarcode(), distributionReservationEntity.getReservationCode(),
deliveryListEntity.getTrainNumber(),deliveryListEntity.getVehicleName(),deliveryListEntity.getDriverName(),
AuthUtil.getUserName(),myCurrentWarehouse.getId(),AuthUtil.getTenantId());
try {
sendMessage(distrilbutionloadingscanDTO.getBarcode(), distributionReservationEntity.getReservationCode(),
deliveryListEntity.getTrainNumber(),deliveryListEntity.getVehicleName(),deliveryListEntity.getDriverName(),
AuthUtil.getUserName(),myCurrentWarehouse.getId(),AuthUtil.getTenantId());
} catch (Exception e) {
// throw new RuntimeException(e);
log.error(">>>> 签收推送报错",e);
}
@ -2963,6 +2968,19 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionAsyncService.sendFactory(parcelListEntity, simpleDateFormat.format(new Date()), distributionReservationEntity.getId(), distributionReservationEntity.getReservationCode(), myCurrentWarehouse.getName(), nickName);
//收集包件
orderpackages.add(updatePackage.getOrderPackageCode());
// 推送商家端
// 推送
try {
sendMessage(orderPackageCode, distributionReservationEntity.getReservationCode(),
deliveryListEntity.getTrainNumber(),deliveryListEntity.getVehicleName(),deliveryListEntity.getDriverName(),
AuthUtil.getUserName(),myCurrentWarehouse.getId(),AuthUtil.getTenantId());
} catch (Exception e) {
// throw new RuntimeException(e);
log.error(">>>> 签收推送报错",e);
}
} else {
//一个客户下出现重复包条码
log.error("############出现重复包条码:{}", collect);

Loading…
Cancel
Save