|
@@ -44,11 +44,15 @@ import vip.xiaonuo.biz.modular.bizconfig.entity.BizConfig;
|
|
|
import vip.xiaonuo.biz.modular.bizconfig.service.BizConfigService;
|
|
|
import vip.xiaonuo.biz.modular.bizexcessconfig.entity.BizExcessConfig;
|
|
|
import vip.xiaonuo.biz.modular.bizexcessconfig.service.BizExcessConfigService;
|
|
|
+import vip.xiaonuo.biz.modular.bizloadtime.entity.BizLoadTime;
|
|
|
+import vip.xiaonuo.biz.modular.bizloadtime.service.BizLoadTimeService;
|
|
|
import vip.xiaonuo.biz.modular.bizorder.entity.BizOrder;
|
|
|
import vip.xiaonuo.biz.modular.bizorder.param.BizOrderExportResult;
|
|
|
import vip.xiaonuo.biz.modular.bizorder.service.BizOrderService;
|
|
|
import vip.xiaonuo.biz.modular.bizorderconfig.entity.BizOrderConfig;
|
|
|
import vip.xiaonuo.biz.modular.bizorderconfig.service.BizOrderConfigService;
|
|
|
+import vip.xiaonuo.biz.modular.bizsupplier.entity.BizSupplierTransport;
|
|
|
+import vip.xiaonuo.biz.modular.bizsupplier.service.BizSupplierTransportService;
|
|
|
import vip.xiaonuo.biz.modular.customer.entity.BizCustomer;
|
|
|
import vip.xiaonuo.biz.modular.customer.service.BizCustomerService;
|
|
|
import vip.xiaonuo.biz.modular.goods.entity.BizGoods;
|
|
@@ -123,6 +127,12 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
@Resource
|
|
|
private MqttSubscribeClient mqttSubscribeClient;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private BizSupplierTransportService bizSupplierTransportService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BizLoadTimeService bizLoadTimeService;
|
|
|
+
|
|
|
@Override
|
|
|
public Page<BizAppointmentRecord> page(BizAppointmentRecordPageParam bizAppointmentRecordPageParam) {
|
|
|
QueryWrapper<BizAppointmentRecord> queryWrapper = getQueryWrapper(bizAppointmentRecordPageParam);
|
|
@@ -210,6 +220,14 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
bizAppointmentTime.setApplyNumberAlready(bizAppointmentTime.getApplyNumberAlready()+1);
|
|
|
bizOrderConfigService.updateById(bizAppointmentTime);
|
|
|
}
|
|
|
+ //更新装卸时间段的已约次数
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getLoadTimeId())){
|
|
|
+ BizLoadTime bizLoadTime = bizLoadTimeService.getById(bizAppointmentRecordAddParam.getLoadTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(bizLoadTime)){
|
|
|
+ bizLoadTime.setAlreadyNumber(bizLoadTime.getAlreadyNumber()+1);
|
|
|
+ bizLoadTimeService.updateById(bizLoadTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/*if(StringUtils.equals(bizAppointmentRecord.getStatus(),"3")){
|
|
|
sendAccount(bizAppointmentRecord,null);
|
|
@@ -334,6 +352,15 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
throw new CommonException("提货时间段已过,不可预约!");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //查询车辆是否在供应商名下
|
|
|
+ BizSupplierTransport transport = bizSupplierTransportService.getOne(new QueryWrapper<BizSupplierTransport>().lambda().
|
|
|
+ eq(BizSupplierTransport::getSupplierId, bizOrder.getSupplierId()).
|
|
|
+ eq(BizSupplierTransport::getTransportNo, bizAppointmentRecordAddParam.getLicenseNumber()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNull(transport)){
|
|
|
+ throw new CommonException("该车辆没有绑定在供应商下,不可预约!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getOrderId())){
|
|
@@ -346,13 +373,50 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
if(ObjectUtil.isNotNull(bizOrderConfig)){
|
|
|
//校验预约时间段是否预约满
|
|
|
//查询预约时间段内的预约记录,10:已出场 11:已签收 12:自动审核 13:销售已审核 14:已取消这些状态都占用预约名额
|
|
|
- long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
|
|
|
+ /*long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
|
|
|
eq(BizAppointmentRecord::getTimeId, bizAppointmentRecordAddParam.getTimeId()).
|
|
|
notIn(BizAppointmentRecord::getStatus, "10", "11", "12", "13", "14","15"));
|
|
|
if(count>=bizOrderConfig.getApplyNumber()){
|
|
|
throw new CommonException("该订单已经预约满!");
|
|
|
+ }*/
|
|
|
+ if(bizOrderConfig.getApplyNumber()-bizOrderConfig.getApplyNumberAlready() <=0){
|
|
|
+ throw new CommonException("该订单已经预约满!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ getTimeCount(bizAppointmentRecordAddParam);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void getTimeCount(BizAppointmentRecordAddParam bizAppointmentRecordAddParam){
|
|
|
+ lock.lock();
|
|
|
+ try{
|
|
|
+ //判断装卸预约次数是否满足
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getLoadTimeId())){
|
|
|
+ BizLoadTime bizLoadTime = bizLoadTimeService.queryEntity(bizAppointmentRecordAddParam.getLoadTimeId());
|
|
|
+ if(bizLoadTime.getAvailableNumber()-bizLoadTime.getAlreadyNumber() <= 0){
|
|
|
+ throw new CommonException("当前装卸时段预约已满,不可预约!");
|
|
|
}
|
|
|
}
|
|
|
+ }finally {
|
|
|
+ lock.unlock(); // 释放锁
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void getTimeCount(BizAppointmentRecordEditParam bizAppointmentRecordEditParam){
|
|
|
+ lock.lock();
|
|
|
+ try{
|
|
|
+ //判断装卸预约次数是否满足
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getLoadTimeId())){
|
|
|
+ BizLoadTime bizLoadTime = bizLoadTimeService.queryEntity(bizAppointmentRecordEditParam.getLoadTimeId());
|
|
|
+ if(bizLoadTime.getAvailableNumber()-bizLoadTime.getAlreadyNumber() <= 0){
|
|
|
+ throw new CommonException("当前装卸时段预约已满,不可预约!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }finally {
|
|
|
+ lock.unlock(); // 释放锁
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -394,6 +458,15 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
throw new CommonException("提货时间段已过,不可预约!");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //查询车辆是否在供应商名下
|
|
|
+ BizSupplierTransport transport = bizSupplierTransportService.getOne(new QueryWrapper<BizSupplierTransport>().lambda().
|
|
|
+ eq(BizSupplierTransport::getSupplierId, bizOrder.getSupplierId()).
|
|
|
+ eq(BizSupplierTransport::getTransportNo, bizAppointmentRecordEditParam.getLicenseNumber()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNull(transport)){
|
|
|
+ throw new CommonException("该车辆没有绑定在供应商下,不可预约!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if(ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getOrderId())){
|
|
@@ -406,15 +479,22 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
if(ObjectUtil.isNotNull(bizOrderConfig)){
|
|
|
//校验预约时间段是否预约满
|
|
|
//查询预约时间段内的预约记录,10:已出场 11:已签收 12:自动审核 13:销售已审核 14:已取消这些状态都占用预约名额
|
|
|
- long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
|
|
|
+ /*long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
|
|
|
eq(BizAppointmentRecord::getTimeId, bizAppointmentRecordEditParam.getTimeId()).
|
|
|
notIn(BizAppointmentRecord::getStatus, "10", "11", "12", "13", "14","15"));
|
|
|
if(count>=bizOrderConfig.getApplyNumber()+1){
|
|
|
throw new CommonException("该订单已经预约满!");
|
|
|
+ }*/
|
|
|
+ if(bizOrderConfig.getApplyNumber()-bizOrderConfig.getApplyNumberAlready() <=0){
|
|
|
+ throw new CommonException("该订单已经预约满!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getLoadTimeId(),bizAppointmentRecordEditParam.getLoadTimeId())){
|
|
|
+ getTimeCount(bizAppointmentRecordEditParam);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -446,6 +526,24 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getLoadTimeId(),bizAppointmentRecordEditParam.getLoadTimeId())){
|
|
|
+ //调整了装卸时段,释放之前的已约次数,更新新的时段已约次数
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getLoadTimeId())){
|
|
|
+ BizLoadTime bizLoadTime = bizLoadTimeService.getById(bizAppointmentRecordEditParam.getLoadTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(bizLoadTime)){
|
|
|
+ bizLoadTime.setAlreadyNumber(bizLoadTime.getAlreadyNumber()+1);
|
|
|
+ bizLoadTimeService.updateById(bizLoadTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecord.getLoadTimeId())){
|
|
|
+ BizLoadTime bizLoadTime = bizLoadTimeService.getById(bizAppointmentRecord.getLoadTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(bizLoadTime)){
|
|
|
+ bizLoadTime.setAlreadyNumber(bizLoadTime.getAlreadyNumber()-1);
|
|
|
+ bizLoadTimeService.updateById(bizLoadTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if(!StringUtils.equals(bizAppointmentRecord.getOrderId(),bizAppointmentRecordEditParam.getOrderId())){
|
|
|
bizAppointmentRecordEditParam.setTimeId(bizOrderService.queryEntity(bizAppointmentRecordEditParam.getOrderId()).getDeliveryTimeId());
|
|
|
}
|
|
@@ -486,6 +584,14 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
bizAppointmentTime.setApplyNumberAlready(bizAppointmentTime.getApplyNumberAlready()-1);
|
|
|
bizOrderConfigService.updateById(bizAppointmentTime);
|
|
|
}
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecord.getLoadTimeId())){
|
|
|
+ BizLoadTime bizLoadTime = bizLoadTimeService.getById(bizAppointmentRecord.getLoadTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(bizLoadTime)){
|
|
|
+ bizLoadTime.setAlreadyNumber(bizLoadTime.getAlreadyNumber()-1);
|
|
|
+ bizLoadTimeService.updateById(bizLoadTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// 执行删除
|
|
|
this.removeByIds(CollStreamUtil.toList(bizAppointmentRecordIdParamList, BizAppointmentRecordIdParam::getId));
|
|
@@ -857,6 +963,22 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
//取消
|
|
|
bizAppointmentRecord.setStatus("14");
|
|
|
this.updateById(bizAppointmentRecord);
|
|
|
+
|
|
|
+ //释放物流订单预约数
|
|
|
+ BizOrderConfig bizAppointmentTime = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecord.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNotNull(bizAppointmentTime)){
|
|
|
+ bizAppointmentTime.setApplyNumberAlready(bizAppointmentTime.getApplyNumberAlready()-1);
|
|
|
+ bizOrderConfigService.updateById(bizAppointmentTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ //释放装卸时间已约次数
|
|
|
+ BizLoadTime bizLoadTime = bizLoadTimeService.getById(bizAppointmentRecord.getLoadTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(bizLoadTime)){
|
|
|
+ bizLoadTime.setAlreadyNumber(bizLoadTime.getAlreadyNumber()-1);
|
|
|
+ bizLoadTimeService.updateById(bizLoadTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -881,4 +1003,12 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
bizRecordService.removeById(bizRecord.getId());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exitTemp(BizAppointmentRecordIdParam bizAppointmentRecordIdParam) {
|
|
|
+ //修改过磅记录已出场
|
|
|
+ BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordIdParam.getId());
|
|
|
+ bizAppointmentRecord.setStatus("10");
|
|
|
+ this.updateById(bizAppointmentRecord);
|
|
|
+ }
|
|
|
}
|