|
@@ -39,6 +39,8 @@ import vip.xiaonuo.biz.modular.bizexcessconfig.service.BizExcessConfigService;
|
|
|
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.goods.entity.BizGoods;
|
|
|
import vip.xiaonuo.biz.modular.goods.service.BizGoodsService;
|
|
|
import vip.xiaonuo.biz.modular.goodsConf.entity.BizGoodsConf;
|
|
@@ -83,6 +85,8 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
private BizExcessConfigService bizExcessConfigService;
|
|
|
@Resource
|
|
|
private BizGoodsConfService bizGoodsConfService;
|
|
|
+ @Resource
|
|
|
+ private BizOrderConfigService bizOrderConfigService;
|
|
|
|
|
|
@Override
|
|
|
public Page<BizAppointmentRecord> page(BizAppointmentRecordPageParam bizAppointmentRecordPageParam) {
|
|
@@ -154,11 +158,13 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
bizOrderService.updateById(bizOrder);
|
|
|
|
|
|
//更新时间段内已预约数
|
|
|
- /*BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecordAddParam.getTimeId());
|
|
|
+ BizOrderConfig bizAppointmentTime = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecordAddParam.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
if(ObjectUtil.isNotNull(bizAppointmentTime)){
|
|
|
bizAppointmentTime.setApplyNumberAlready(bizAppointmentTime.getApplyNumberAlready()+1);
|
|
|
- bizAppointmentTimeService.updateById(bizAppointmentTime);
|
|
|
- }*/
|
|
|
+ bizOrderConfigService.updateById(bizAppointmentTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void checkParam(BizAppointmentRecordAddParam bizAppointmentRecordAddParam){
|
|
@@ -196,18 +202,23 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- /*if(ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getTimeId())){
|
|
|
- //校验预约时间段是否预约满
|
|
|
- //查询预约时间段内的预约记录,10:已出场 11:已签收 12:自动审核 13:销售已审核 14:已取消这些状态都占用预约名额
|
|
|
- long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
|
|
|
- eq(BizAppointmentRecord::getTimeId, bizAppointmentRecordAddParam.getTimeId()).
|
|
|
- notIn(BizAppointmentRecord::getStatus, "10", "11", "12", "13", "14"));
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getOrderId())){
|
|
|
//查询预约时间段内可预约次数
|
|
|
- BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecordAddParam.getTimeId());
|
|
|
- if(count>=bizAppointmentTime.getApplyNumber()){
|
|
|
- throw new CommonException("该时间段已经预约满!");
|
|
|
+ //BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecordAddParam.getTimeId());
|
|
|
+ BizOrderConfig bizOrderConfig = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecordAddParam.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNotNull(bizOrderConfig)){
|
|
|
+ //校验预约时间段是否预约满
|
|
|
+ //查询预约时间段内的预约记录,10:已出场 11:已签收 12:自动审核 13:销售已审核 14:已取消这些状态都占用预约名额
|
|
|
+ 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("该订单已经预约满!");
|
|
|
+ }
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -249,21 +260,23 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- /*if(ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getTimeId())){
|
|
|
- if(!StringUtils.equals(bizAppointmentRecord.getTimeId(),bizAppointmentRecordEditParam.getTimeId())){
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getOrderId())){
|
|
|
+ //查询预约时间段内可预约次数
|
|
|
+ //BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecordAddParam.getTimeId());
|
|
|
+ BizOrderConfig bizOrderConfig = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecordEditParam.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNotNull(bizOrderConfig)){
|
|
|
//校验预约时间段是否预约满
|
|
|
//查询预约时间段内的预约记录,10:已出场 11:已签收 12:自动审核 13:销售已审核 14:已取消这些状态都占用预约名额
|
|
|
long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
|
|
|
eq(BizAppointmentRecord::getTimeId, bizAppointmentRecordEditParam.getTimeId()).
|
|
|
- notIn(BizAppointmentRecord::getStatus, "10", "11", "12", "13", "14"));
|
|
|
- //查询预约时间段内可预约次数
|
|
|
- BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecordEditParam.getTimeId());
|
|
|
- if(count>=bizAppointmentTime.getApplyNumber()){
|
|
|
- throw new CommonException("该时间段已经预约满!");
|
|
|
+ notIn(BizAppointmentRecord::getStatus, "10", "11", "12", "13", "14","15"));
|
|
|
+ if(count>=bizOrderConfig.getApplyNumber()){
|
|
|
+ throw new CommonException("该订单已经预约满!");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -272,17 +285,27 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
public void edit(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
|
|
|
BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
|
|
|
checkParam(bizAppointmentRecordEditParam,bizAppointmentRecord);
|
|
|
- /*if(!StringUtils.equals(bizAppointmentRecord.getTimeId(),bizAppointmentRecordEditParam.getTimeId())){
|
|
|
+ if(!StringUtils.equals(bizAppointmentRecord.getOrderId(),bizAppointmentRecordEditParam.getOrderId())){
|
|
|
//调整了预约时段,释放之前预约时段的预约次数
|
|
|
- BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecord.getTimeId());
|
|
|
- bizAppointmentTime.setApplyNumberAlready(bizAppointmentTime.getApplyNumberAlready()-1);
|
|
|
- bizAppointmentTimeService.updateById(bizAppointmentTime);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//新的预约时段,增加已约次数
|
|
|
- BizAppointmentTime time = bizAppointmentTimeService.getById(bizAppointmentRecordEditParam.getTimeId());
|
|
|
- time.setApplyNumberAlready(time.getApplyNumberAlready()+1);
|
|
|
- bizAppointmentTimeService.updateById(time);
|
|
|
- }*/
|
|
|
+ BizOrderConfig time = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecordEditParam.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNotNull(time)){
|
|
|
+ time.setApplyNumberAlready(time.getApplyNumberAlready()+1);
|
|
|
+ bizOrderConfigService.updateById(time);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
if(!StringUtils.equals(bizAppointmentRecord.getOrderId(),bizAppointmentRecordEditParam.getOrderId())){
|
|
|
bizAppointmentRecordEditParam.setTimeId(bizOrderService.queryEntity(bizAppointmentRecordEditParam.getOrderId()).getDeliveryTimeId());
|
|
|
}
|
|
@@ -298,14 +321,17 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
@Override
|
|
|
public void delete(List<BizAppointmentRecordIdParam> bizAppointmentRecordIdParamList) {
|
|
|
//释放预约数
|
|
|
- /*for(BizAppointmentRecordIdParam bizAppointmentRecordIdParam : bizAppointmentRecordIdParamList){
|
|
|
+ for(BizAppointmentRecordIdParam bizAppointmentRecordIdParam : bizAppointmentRecordIdParamList){
|
|
|
BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordIdParam.getId());
|
|
|
- BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecord.getTimeId());
|
|
|
+ BizOrderConfig bizAppointmentTime = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecord.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ //BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecord.getTimeId());
|
|
|
if(ObjectUtil.isNotNull(bizAppointmentTime)){
|
|
|
bizAppointmentTime.setApplyNumberAlready(bizAppointmentTime.getApplyNumberAlready()-1);
|
|
|
- bizAppointmentTimeService.updateById(bizAppointmentTime);
|
|
|
+ bizOrderConfigService.updateById(bizAppointmentTime);
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
// 执行删除
|
|
|
this.removeByIds(CollStreamUtil.toList(bizAppointmentRecordIdParamList, BizAppointmentRecordIdParam::getId));
|
|
|
}
|
|
@@ -407,18 +433,54 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
this.updateById(bizAppointmentRecord);
|
|
|
|
|
|
//释放预约数
|
|
|
- /*BizAppointmentTime bizAppointmentTime = bizAppointmentTimeService.getById(bizAppointmentRecord.getTimeId());
|
|
|
+ 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);
|
|
|
- bizAppointmentTimeService.updateById(bizAppointmentTime);
|
|
|
- }*/
|
|
|
+ bizOrderConfigService.updateById(bizAppointmentTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public void adjustOrder(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
|
|
|
BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
|
|
|
+ //校验订单
|
|
|
+ if(ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getOrderId())){
|
|
|
+ BizOrder bizOrder = bizOrderService.getById(bizAppointmentRecordEditParam.getOrderId());
|
|
|
+ if(ObjectUtil.isNotNull(bizOrder)){
|
|
|
+ if(!StringUtils.equals(bizOrder.getOrderStatus(),"3") && !StringUtils.equals(bizOrder.getOrderStatus(),"4")){
|
|
|
+ throw new CommonException("当前订单不可预约!");
|
|
|
+ }
|
|
|
+ BizGoodsConf bizGoodsConf = bizGoodsConfService.getById(bizOrder.getDeliveryTimeId());
|
|
|
+ if(ObjectUtil.isNotNull(bizGoodsConf)){
|
|
|
+ if(new Date().getTime() > bizGoodsConf.getConfEndTime().getTime()){
|
|
|
+ throw new CommonException("提货时间段已过,不可预约!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if(!StringUtils.equals(bizAppointmentRecord.getOrderId(),bizAppointmentRecordEditParam.getOrderId())){
|
|
|
+ //调整了预约时段,释放之前预约时段的预约次数
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //新的预约时段,增加已约次数
|
|
|
+ BizOrderConfig time = bizOrderConfigService.getOne(new QueryWrapper<BizOrderConfig>().lambda().
|
|
|
+ eq(BizOrderConfig::getOrderId, bizAppointmentRecordEditParam.getOrderId()).
|
|
|
+ last("limit 1"));
|
|
|
+ if(ObjectUtil.isNotNull(time)){
|
|
|
+ time.setApplyNumberAlready(time.getApplyNumberAlready()+1);
|
|
|
+ bizOrderConfigService.updateById(time);
|
|
|
+ }
|
|
|
+
|
|
|
//调整过订单
|
|
|
if(StringUtils.equals(bizAppointmentRecord.getStatus(),"8") || StringUtils.equals(bizAppointmentRecord.getStatus(),"9")){
|
|
|
//查询过磅记录重量
|
|
@@ -443,6 +505,8 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
|
|
|
}else{
|
|
|
bizAppointmentRecord.setOrderId(bizAppointmentRecordEditParam.getOrderId());
|
|
|
}
|
|
|
+
|
|
|
+ bizAppointmentRecord.setTimeId(bizOrderService.queryEntity(bizAppointmentRecordEditParam.getOrderId()).getDeliveryTimeId());
|
|
|
this.updateById(bizAppointmentRecord);
|
|
|
}
|
|
|
}
|