Browse Source

预约转配送

dev-warehouse
kilo 2 years ago
parent
commit
15e0cae710
  1. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionDeliverySelfEntity.java
  2. 12
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionDeliveryAllocationDTO.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliverySelfMapper.xml
  4. 42
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionDeliverySelfEntity.java

@ -45,7 +45,7 @@ public class DistributionDeliverySelfEntity extends TenantEntity {
* 配送司机
*/
@ApiModelProperty(value = "配送司机")
private String slaveDriverId;
private String driverId;
/**
* 车辆编号
*/

12
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionDeliveryAllocationDTO.java

@ -50,6 +50,18 @@ public class DistributionDeliveryAllocationDTO {
@ApiModelProperty(value = "三方配送司机车辆信息")
private DistributionDeliveryTripartiteDTO tripartite;
/**
* 主司机名称
*/
@ApiModelProperty(value = "主司机名称")
private String masterDriverName;
/**
* 主车辆车牌号
*/
@ApiModelProperty(value = "主车辆车牌号")
private String masterVehicleNub;
}

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

@ -14,7 +14,7 @@
<result column="is_deleted" property="isDeleted"/>
<result column="create_dept" property="createDept"/>
<result column="reservation_ids" property="reservationIds"/>
<result column="slave_driver_id" property="slaveDriverId"/>
<result column="slave_driver_id" property="driverId"/>
<result column="vehicle_id" property="vehicleId"/>
<result column="is_master" property="isMaster"/>
<result column="delivery_id" property="deliveryId"/>

42
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -29,6 +29,7 @@ import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.RandomType;
import org.springframework.beans.BeanUtils;
@ -68,6 +69,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
private final IDistributionDeliveryListService distributionDeliveryListService;
private final IDistributionDeliverySelfService distributionDeliverySelfService;
private final IDistributionDeliveryTripartiteService distributionDeliveryTripartiteService;
private final IDistributionReservationStockarticleService distributionReservationStockarticleService;
@ -323,7 +328,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
String stockupId = distributionStockupInfoEntity.getStockupId();
DistributionStockupEntity stockupEntity = distributionStockupService.getById(stockupId);
//2、预约单存在备货任务还未指派
if (Func.equals(stockupEntity.getAssignStatus(),"2")){
if (Func.equals(stockupEntity.getAssignStatus(),"1")){
//对原有的备货关系进行修改
distributionStockupInfoEntity.setStockupId(stockupEntityId.toString());
distributionStockupInfoService.updateById(distributionStockupInfoEntity);
@ -376,18 +381,47 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
});
}
});
DistributionDeliveryListEntity distributionDeliveryListEntity = new DistributionDeliveryListEntity();
//设置车次号
String today = DateUtil.today();
String random = Func.random(7, RandomType.ALL);
distributionDeliveryListEntity.setTrainNumber(random+today);
distributionDeliveryListService.save(distributionDeliveryListEntity);
Long id = distributionDeliveryListEntity.getId();
//操作司机信息
DistributionDeliveryTripartiteDTO tripartite = allocationDTO.getTripartite();
if (Func.isEmpty(tripartite)){
//这里就是自主配送
}else {
//这里就是三方配送
DistributionDeliveryTripartiteEntity tripartiteEntity = Func.copy(tripartite, DistributionDeliveryTripartiteEntity.class);
tripartiteEntity.setReservationIds(reservationId.substring(reservationId.length()-1));
// TODO 配置信息编号
}else {
//这里就是自主配送
List<DistributionDeliverySelfDTO> allocationInfo = allocationDTO.getAllocationInfo();
allocationInfo.forEach(a->{
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity();
//设置车辆编号
distributionDeliverySelfEntity.setDeliveryId(Long.parseLong(a.getDriverId()));
//设置预约单号拼接
distributionDeliverySelfEntity.setReservationIds(reservationId.substring(reservationId.length()-1));
//设置司机信息
distributionDeliverySelfEntity.setVehicleId(a.getVehicleId());
//设置是否为主司机
if (Func.equals(allocationDTO.getMasterDriverName(),a.getDriver())){
//设置主司机
distributionDeliverySelfEntity.setIsMaster(1);
}
// TODO 配置信息编号
//完成对自主配送司机信息保存
distributionDeliverySelfService.save(distributionDeliverySelfEntity);
});
}
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return null;
return R.status(true);
}

Loading…
Cancel
Save