|
@@ -206,7 +206,7 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
// 校验数据范围
|
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
|
if (ObjectUtil.isEmpty(loginUserDataScope)) {
|
|
|
- queryWrapper.eq("bar.create_user", StpUtil.getLoginIdAsString());
|
|
|
+ queryWrapper.eq("bar.driver_id", StpUtil.getLoginIdAsString());
|
|
|
}
|
|
|
if (ObjectUtil.isNotEmpty(bizAppointmentRecordPageParam.getLoadNumber())) {
|
|
|
queryWrapper.like("bla.load_number", bizAppointmentRecordPageParam.getLoadNumber());
|
|
@@ -245,6 +245,17 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
bizAppointmentRecord.setStatus("4");
|
|
|
}
|
|
|
}
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getDriverId())){
|
|
|
+ BizUser bizUser = bizUserService.getById(bizAppointmentRecordAddParam.getDriverId());
|
|
|
+ if(ObjectUtil.isNotNull(bizUser)){
|
|
|
+ if(ObjectUtil.isEmpty(bizAppointmentRecordAddParam.getDriverName())){
|
|
|
+ bizAppointmentRecord.setDriverName(bizUser.getName());
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isEmpty(bizAppointmentRecordAddParam.getDriverMobile())){
|
|
|
+ bizAppointmentRecord.setDriverMobile(bizUser.getPhone());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//this.save(bizAppointmentRecord);
|
|
|
saveRecord(bizAppointmentRecord);
|
|
|
|
|
@@ -621,6 +632,17 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
//如果当前状态是审核不通过的状态,修改后重新提交审核
|
|
|
bizAppointmentRecord.setStatus("1");
|
|
|
}
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getDriverId())){
|
|
|
+ BizUser bizUser = bizUserService.getById(bizAppointmentRecordEditParam.getDriverId());
|
|
|
+ if(ObjectUtil.isNotNull(bizUser)){
|
|
|
+ if(ObjectUtil.isEmpty(bizAppointmentRecordEditParam.getDriverName())){
|
|
|
+ bizAppointmentRecord.setDriverName(bizUser.getName());
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isEmpty(bizAppointmentRecordEditParam.getDriverMobile())){
|
|
|
+ bizAppointmentRecord.setDriverMobile(bizUser.getPhone());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
this.updateById(bizAppointmentRecord);
|
|
|
}
|
|
|
|
|
@@ -666,6 +688,68 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
this.removeByIds(CollStreamUtil.toList(bizAppointmentRecordIdParamList, BizAppointmentRecordIdParam::getId));
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void replaceAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
|
|
|
+ BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getOrderId(),bizAppointmentRecordEditParam.getOrderId())){
|
|
|
+ //查询旧订单预约配置
|
|
|
+ BizOrderConfig oldOrderConfig = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecord.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNotNull(oldOrderConfig)){
|
|
|
+ //释放旧订单预约次数
|
|
|
+ oldOrderConfig.setApplyNumberAlready(oldOrderConfig.getApplyNumberAlready()-1);
|
|
|
+ bizOrderConfigService.updateById(oldOrderConfig);
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询新订单预约配置
|
|
|
+ BizOrderConfig newOrderConfig = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecordEditParam.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNotNull(newOrderConfig)){
|
|
|
+ newOrderConfig.setApplyNumberAlready(newOrderConfig.getApplyNumberAlready()+1);
|
|
|
+ bizOrderConfigService.updateById(newOrderConfig);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //判断装卸时间是否一致
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getLoadTimeId(),bizAppointmentRecordEditParam.getLoadTimeId())){
|
|
|
+ //装卸时间段修改
|
|
|
+ //查询旧时间段预约次数
|
|
|
+ BizLoadTime oldTime = bizLoadTimeService.getById(bizAppointmentRecord.getLoadTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(oldTime)){
|
|
|
+ //释放旧时段预约次数
|
|
|
+ oldTime.setAlreadyNumber(oldTime.getAlreadyNumber()-1);
|
|
|
+ bizLoadTimeService.updateById(oldTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询新时段的预约次数
|
|
|
+ BizLoadTime newTime = bizLoadTimeService.getById(bizAppointmentRecordEditParam.getLoadTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(newTime)){
|
|
|
+ //添加新时段预约次数
|
|
|
+ newTime.setAlreadyNumber(newTime.getAlreadyNumber()+1);
|
|
|
+ bizLoadTimeService.updateById(newTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getOrderId(),bizAppointmentRecordEditParam.getOrderId())){
|
|
|
+ //订单修改
|
|
|
+ bizAppointmentRecord.setOrderId(bizAppointmentRecordEditParam.getOrderId());
|
|
|
+ //装卸点位
|
|
|
+ bizAppointmentRecord.setLoadPointId(bizAppointmentRecordEditParam.getLoadPointId());
|
|
|
+ //装卸时间
|
|
|
+ bizAppointmentRecord.setLoadTimeId(bizAppointmentRecordEditParam.getLoadTimeId());
|
|
|
+ }
|
|
|
+ //车牌号
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getLicenseNumber(),bizAppointmentRecordEditParam.getLicenseNumber())){
|
|
|
+ bizAppointmentRecord.setLicenseNumber(bizAppointmentRecordEditParam.getLicenseNumber());
|
|
|
+ }
|
|
|
+ //车辆轴数
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getOverId(),bizAppointmentRecordEditParam.getOverId())){
|
|
|
+ bizAppointmentRecord.setOverId(bizAppointmentRecordEditParam.getOverId());
|
|
|
+ }
|
|
|
+ this.updateById(bizAppointmentRecord);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public BizAppointmentRecord detail(BizAppointmentRecordIdParam bizAppointmentRecordIdParam) {
|
|
|
return this.queryEntity(bizAppointmentRecordIdParam.getId());
|
|
@@ -1272,6 +1356,13 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
this.updateById(bizAppointmentRecord);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void endLoadAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
|
|
|
+ BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
|
|
|
+ bizAppointmentRecord.setStatus("10");
|
|
|
+ this.updateById(bizAppointmentRecord);
|
|
|
+ }
|
|
|
+
|
|
|
public void checkLoadParam(BizAppointmentRecordEditParam bizAppointmentRecordEditParam, BizAppointmentRecord bizAppointmentRecord) {
|
|
|
//校验车牌号
|
|
|
if (ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getLicenseNumber())) {
|
|
@@ -1577,6 +1668,20 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void completePipeAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
|
|
|
+ BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
|
|
|
+ bizAppointmentRecord.setStatus("9");
|
|
|
+ this.updateById(bizAppointmentRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void endPipeAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
|
|
|
+ BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
|
|
|
+ bizAppointmentRecord.setStatus("10");
|
|
|
+ this.updateById(bizAppointmentRecord);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void addOtherAppointment(BizOtherAppointmentAddParam bizOtherAppointmentAddParam) {
|
|
@@ -1676,6 +1781,13 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
this.updateById(bizAppointmentRecord);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void bizOtherAppointmentComplete(BizAppointmentRecordIdParam bizAppointmentRecordIdParam) {
|
|
|
+ BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordIdParam.getId());
|
|
|
+ bizAppointmentRecord.setStatus("7");
|
|
|
+ this.updateById(bizAppointmentRecord);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void bizOtherAppointmentExport(BizAppointmentRecordPageParam bizAppointmentRecordPageParam, HttpServletResponse response) throws IOException {
|
|
@@ -1795,6 +1907,31 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void bizChargeStationReservationExit(BizAppointmentRecordIdParam bizAppointmentRecordIdParam) {
|
|
|
+ lock.lock();
|
|
|
+ try {
|
|
|
+ //充电结束
|
|
|
+ BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordIdParam.getId());
|
|
|
+ bizAppointmentRecord.setStatus("18");
|
|
|
+ if(this.updateById(bizAppointmentRecord)){
|
|
|
+ //释放充电数量
|
|
|
+ //查询充电桩配置信息
|
|
|
+ BizChargeStation bizChargeStation = bizChargeStationService.getOne(new QueryWrapper<BizChargeStation>()
|
|
|
+ .lambda().eq(BizChargeStation::getDeleteFlag, 0).last("limit 1"));
|
|
|
+ if (ObjectUtil.isNotNull(bizChargeStation)) {
|
|
|
+ bizChargeStation.setChargeStationUsedNumber(bizChargeStation.getChargeStationUsedNumber() - 1);
|
|
|
+ bizChargeStationService.updateById(bizChargeStation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } finally {
|
|
|
+ lock.unlock();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public void bizChargeStationEnd(BizAppointmentRecordIdParam bizAppointmentRecordIdParam) {
|
|
|
lock.lock();
|
|
|
try {
|
|
|
BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordIdParam.getId());
|
|
@@ -1821,7 +1958,6 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
} finally {
|
|
|
lock.unlock();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|