|
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import vip.xiaonuo.biz.modular.customer.entity.BizCustomer;
|
|
import vip.xiaonuo.biz.modular.customer.entity.BizCustomer;
|
|
import vip.xiaonuo.biz.modular.goodsConf.entity.BizGoodsConf;
|
|
import vip.xiaonuo.biz.modular.goodsConf.entity.BizGoodsConf;
|
|
|
|
+import vip.xiaonuo.biz.modular.goodsConf.enums.BizGoodsConfEnum;
|
|
import vip.xiaonuo.biz.modular.goodsConf.service.BizGoodsConfService;
|
|
import vip.xiaonuo.biz.modular.goodsConf.service.BizGoodsConfService;
|
|
import vip.xiaonuo.biz.modular.user.mapper.BizUserMapper;
|
|
import vip.xiaonuo.biz.modular.user.mapper.BizUserMapper;
|
|
import vip.xiaonuo.biz.modular.user.service.BizUserService;
|
|
import vip.xiaonuo.biz.modular.user.service.BizUserService;
|
|
@@ -40,6 +41,7 @@ import vip.xiaonuo.biz.modular.bizloadtime.param.BizLoadTimePageParam;
|
|
import vip.xiaonuo.biz.modular.bizloadtime.service.BizLoadTimeService;
|
|
import vip.xiaonuo.biz.modular.bizloadtime.service.BizLoadTimeService;
|
|
import vip.xiaonuo.sys.api.SysUserApi;
|
|
import vip.xiaonuo.sys.api.SysUserApi;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -72,7 +74,7 @@ public class BizLoadTimeServiceImpl extends ServiceImpl<BizLoadTimeMapper, BizLo
|
|
queryWrapper.orderBy(true, bizLoadTimePageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
|
|
queryWrapper.orderBy(true, bizLoadTimePageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
|
|
StrUtil.toUnderlineCase(bizLoadTimePageParam.getSortField()));
|
|
StrUtil.toUnderlineCase(bizLoadTimePageParam.getSortField()));
|
|
} else {
|
|
} else {
|
|
- queryWrapper.lambda().orderByAsc(BizLoadTime::getId);
|
|
|
|
|
|
+ queryWrapper.lambda().orderByDesc(BizLoadTime::getCreateTime);
|
|
}
|
|
}
|
|
return this.page(CommonPageRequest.defaultPage(), queryWrapper);
|
|
return this.page(CommonPageRequest.defaultPage(), queryWrapper);
|
|
}
|
|
}
|
|
@@ -81,6 +83,10 @@ public class BizLoadTimeServiceImpl extends ServiceImpl<BizLoadTimeMapper, BizLo
|
|
@Override
|
|
@Override
|
|
public void add(BizLoadTimeAddParam bizLoadTimeAddParam) {
|
|
public void add(BizLoadTimeAddParam bizLoadTimeAddParam) {
|
|
BizLoadTime bizLoadTime = BeanUtil.toBean(bizLoadTimeAddParam, BizLoadTime.class);
|
|
BizLoadTime bizLoadTime = BeanUtil.toBean(bizLoadTimeAddParam, BizLoadTime.class);
|
|
|
|
+ if(!checkBizLoadTime(bizLoadTime)){
|
|
|
|
+ // 当前时间段内的提货配置重叠了
|
|
|
|
+ throw new CommonException("装货配置时间段重叠,请重新选择。");
|
|
|
|
+ }
|
|
this.save(bizLoadTime);
|
|
this.save(bizLoadTime);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -88,10 +94,28 @@ public class BizLoadTimeServiceImpl extends ServiceImpl<BizLoadTimeMapper, BizLo
|
|
@Override
|
|
@Override
|
|
public void edit(BizLoadTimeEditParam bizLoadTimeEditParam) {
|
|
public void edit(BizLoadTimeEditParam bizLoadTimeEditParam) {
|
|
BizLoadTime bizLoadTime = this.queryEntity(bizLoadTimeEditParam.getId());
|
|
BizLoadTime bizLoadTime = this.queryEntity(bizLoadTimeEditParam.getId());
|
|
|
|
+ if(!checkBizLoadTime(bizLoadTime)){
|
|
|
|
+ // 当前时间段内的提货配置重叠了
|
|
|
|
+ throw new CommonException("装货配置时间段重叠,请重新选择。");
|
|
|
|
+ }
|
|
BeanUtil.copyProperties(bizLoadTimeEditParam, bizLoadTime);
|
|
BeanUtil.copyProperties(bizLoadTimeEditParam, bizLoadTime);
|
|
this.updateById(bizLoadTime);
|
|
this.updateById(bizLoadTime);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ @Override
|
|
|
|
+ public void editAvailableNumber(String bizLoadTimeId) {
|
|
|
|
+ BizLoadTime bizLoadTime = this.queryEntity(bizLoadTimeId);
|
|
|
|
+ if(null != bizLoadTime){
|
|
|
|
+ /** 原已预约次数 */
|
|
|
|
+ int alreadyNumber = bizLoadTime.getAlreadyNumber();
|
|
|
|
+ alreadyNumber += 1;
|
|
|
|
+ // 更新已提货重量
|
|
|
|
+ bizLoadTime.setAlreadyNumber(alreadyNumber);
|
|
|
|
+ this.updateById(bizLoadTime);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public void delete(List<BizLoadTimeIdParam> bizLoadTimeIdParamList) {
|
|
public void delete(List<BizLoadTimeIdParam> bizLoadTimeIdParamList) {
|
|
@@ -136,6 +160,14 @@ public class BizLoadTimeServiceImpl extends ServiceImpl<BizLoadTimeMapper, BizLo
|
|
}
|
|
}
|
|
|
|
|
|
// 校验同一个点位的时间段是否有交集
|
|
// 校验同一个点位的时间段是否有交集
|
|
|
|
+ public Boolean checkBizLoadTime(BizLoadTime bizLoadTime){
|
|
|
|
+ List<BizLoadTime> list = this.baseMapper.getSearch(bizLoadTime.getPointId(), bizLoadTime.getBeginTime(), bizLoadTime.getEndTime());
|
|
|
|
+ if(null != list && list.size() > 0){
|
|
|
|
+ return false;
|
|
|
|
+ }else{
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|