|
@@ -4,13 +4,22 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.course.domain.CourseChapter;
|
|
import com.zhongzheng.modules.course.domain.CourseChapter;
|
|
|
|
|
+import com.zhongzheng.modules.course.domain.Major;
|
|
|
|
|
+import com.zhongzheng.modules.course.service.IMajorService;
|
|
|
|
|
+import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
|
|
+import com.zhongzheng.modules.goods.vo.GoodsBusinessVo;
|
|
|
import com.zhongzheng.modules.order.bo.OrderBusinessConfigAddBo;
|
|
import com.zhongzheng.modules.order.bo.OrderBusinessConfigAddBo;
|
|
|
import com.zhongzheng.modules.order.bo.OrderBusinessConfigEditBo;
|
|
import com.zhongzheng.modules.order.bo.OrderBusinessConfigEditBo;
|
|
|
import com.zhongzheng.modules.order.bo.OrderBusinessConfigQueryBo;
|
|
import com.zhongzheng.modules.order.bo.OrderBusinessConfigQueryBo;
|
|
|
import com.zhongzheng.modules.order.domain.OrderBusinessConfig;
|
|
import com.zhongzheng.modules.order.domain.OrderBusinessConfig;
|
|
|
|
|
+import com.zhongzheng.modules.order.domain.OrderBusinessConfigGoods;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderBusinessConfigMapper;
|
|
import com.zhongzheng.modules.order.mapper.OrderBusinessConfigMapper;
|
|
|
import com.zhongzheng.modules.order.service.IOrderBusinessConfigGoodsService;
|
|
import com.zhongzheng.modules.order.service.IOrderBusinessConfigGoodsService;
|
|
|
import com.zhongzheng.modules.order.service.IOrderBusinessConfigService;
|
|
import com.zhongzheng.modules.order.service.IOrderBusinessConfigService;
|
|
@@ -23,9 +32,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
|
|
|
-import java.util.Collection;
|
|
|
|
|
-import java.util.Collections;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -40,6 +47,12 @@ public class OrderBusinessConfigServiceImpl extends ServiceImpl<OrderBusinessCon
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IOrderBusinessConfigGoodsService iOrderBusinessConfigGoodsService;
|
|
private IOrderBusinessConfigGoodsService iOrderBusinessConfigGoodsService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IGoodsService iGoodsService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IMajorService iMajorService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public OrderBusinessConfigVo queryById(Long id){
|
|
public OrderBusinessConfigVo queryById(Long id){
|
|
@@ -136,6 +149,44 @@ public class OrderBusinessConfigServiceImpl extends ServiceImpl<OrderBusinessCon
|
|
|
return this.removeByIds(ids);
|
|
return this.removeByIds(ids);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<OrderBusinessConfigVo> getBusinessConfigList(OrderBusinessConfigQueryBo bo) {
|
|
|
|
|
+ List<OrderBusinessConfigVo> configVos = baseMapper.getList(bo);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(configVos)){
|
|
|
|
|
+ configVos.forEach(configVo -> {
|
|
|
|
|
+ List<OrderBusinessConfigGoods> configGoods = iOrderBusinessConfigGoodsService
|
|
|
|
|
+ .list(new LambdaQueryWrapper<OrderBusinessConfigGoods>()
|
|
|
|
|
+ .eq(OrderBusinessConfigGoods::getConfigId, configVo.getId())
|
|
|
|
|
+ .eq(OrderBusinessConfigGoods::getStatus, 1));
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(configGoods)){
|
|
|
|
|
+ List<GoodsBusinessVo> voList = new ArrayList<>();
|
|
|
|
|
+ configGoods.forEach(item -> {
|
|
|
|
|
+ if (StringUtils.isNotBlank(item.getGoodsIds())){
|
|
|
|
|
+ List<String> ids = Arrays.stream(item.getGoodsIds().split(",")).collect(Collectors.toList());
|
|
|
|
|
+ List<Goods> goodsList = iGoodsService.listByIds(ids);
|
|
|
|
|
+ List<GoodsBusinessVo> businessVos = goodsList.stream().map(x -> {
|
|
|
|
|
+ GoodsBusinessVo goodsBusinessVo = new GoodsBusinessVo();
|
|
|
|
|
+ goodsBusinessVo.setGoodsId(x.getGoodsId());
|
|
|
|
|
+ goodsBusinessVo.setGoodsName(x.getGoodsName());
|
|
|
|
|
+ goodsBusinessVo.setGoodsType(x.getGoodsType());
|
|
|
|
|
+ goodsBusinessVo.setStandPrice(x.getStandPrice());
|
|
|
|
|
+ if (ObjectUtils.isNotNull(x.getMajorId())) {
|
|
|
|
|
+ Major major = iMajorService.getById(x.getMajorId());
|
|
|
|
|
+ goodsBusinessVo.setMajorId(x.getMajorId());
|
|
|
|
|
+ goodsBusinessVo.setMajorName(major.getCategoryName());
|
|
|
|
|
+ }
|
|
|
|
|
+ return goodsBusinessVo;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ voList.addAll(businessVos);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ configVo.setGoodsBusinessVos(voList);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ return configVos;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private boolean checkNameUnique(OrderBusinessConfig entity) {
|
|
private boolean checkNameUnique(OrderBusinessConfig entity) {
|
|
|
OrderBusinessConfig info = getOne(new LambdaQueryWrapper<OrderBusinessConfig>()
|
|
OrderBusinessConfig info = getOne(new LambdaQueryWrapper<OrderBusinessConfig>()
|
|
|
.eq(OrderBusinessConfig::getConfigName,entity.getConfigName()).eq(OrderBusinessConfig::getBusinessId,entity.getBusinessId()).ne(OrderBusinessConfig::getStatus,-1).last("limit 1"));
|
|
.eq(OrderBusinessConfig::getConfigName,entity.getConfigName()).eq(OrderBusinessConfig::getBusinessId,entity.getBusinessId()).ne(OrderBusinessConfig::getStatus,-1).last("limit 1"));
|