Sfoglia il codice sorgente

add 下单商品配置

he2802 3 anni fa
parent
commit
6d293cbdb8
16 ha cambiato i file con 583 aggiunte e 6 eliminazioni
  1. 92 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/order/OrderBusinessConfigGoodsController.java
  2. 14 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderInvoiceController.java
  3. 39 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigGoodsAddBo.java
  4. 44 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigGoodsEditBo.java
  5. 51 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigGoodsQueryBo.java
  6. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigQueryBo.java
  7. 43 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/OrderBusinessConfigGoods.java
  8. 21 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderBusinessConfigGoodsMapper.java
  9. 54 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderBusinessConfigGoodsService.java
  10. 116 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderBusinessConfigGoodsServiceImpl.java
  11. 6 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderBusinessConfigServiceImpl.java
  12. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderInvoiceServiceImpl.java
  13. 49 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderBusinessConfigGoodsVo.java
  14. 43 0
      zhongzheng-system/src/main/resources/mapper/modules/order/OrderBusinessConfigGoodsMapper.xml
  15. 2 2
      zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml
  16. 1 1
      zhongzheng-system/src/main/resources/mapper/modules/order/OrderInvoiceMapper.xml

+ 92 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/order/OrderBusinessConfigGoodsController.java

@@ -0,0 +1,92 @@
+package com.zhongzheng.controller.order;
+
+import java.util.List;
+import java.util.Arrays;
+
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsAddBo;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsEditBo;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsQueryBo;
+import com.zhongzheng.modules.order.service.IOrderBusinessConfigGoodsService;
+import com.zhongzheng.modules.order.vo.OrderBusinessConfigGoodsVo;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.zhongzheng.common.annotation.Log;
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.poi.ExcelUtil;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 订单配置商品Controller
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+@Api(value = "订单配置商品控制器", tags = {"订单配置商品管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/order/config/goods")
+public class OrderBusinessConfigGoodsController extends BaseController {
+
+    private final IOrderBusinessConfigGoodsService iOrderBusinessConfigGoodsService;
+
+    /**
+     * 查询订单配置商品列表
+     */
+    @ApiOperation("查询订单配置商品列表")
+    @PreAuthorize("@ss.hasPermi('system:goods:list')")
+    @GetMapping("/list")
+    public TableDataInfo<OrderBusinessConfigGoodsVo> list(OrderBusinessConfigGoodsQueryBo bo) {
+        startPage();
+        List<OrderBusinessConfigGoodsVo> list = iOrderBusinessConfigGoodsService.selectList(bo);
+        return getDataTable(list);
+    }
+
+
+
+    /**
+     * 获取订单配置商品详细信息
+     */
+    @ApiOperation("获取订单配置商品详细信息")
+    @PreAuthorize("@ss.hasPermi('system:goods:query')")
+    @GetMapping("/{id}")
+    public AjaxResult<OrderBusinessConfigGoodsVo> getInfo(@PathVariable("id" ) Long id) {
+        return AjaxResult.success(iOrderBusinessConfigGoodsService.queryById(id));
+    }
+
+    /**
+     * 新增订单配置商品
+     */
+    @ApiOperation("新增订单配置商品")
+    @PreAuthorize("@ss.hasPermi('system:goods:add')")
+    @Log(title = "订单配置商品", businessType = BusinessType.INSERT)
+    @PostMapping()
+    public AjaxResult<Void> add(@RequestBody OrderBusinessConfigGoodsAddBo bo) {
+        return toAjax(iOrderBusinessConfigGoodsService.insertByAddBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改订单配置商品
+     */
+    @ApiOperation("修改订单配置商品")
+    @PreAuthorize("@ss.hasPermi('system:goods:edit')")
+    @Log(title = "订单配置商品", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    public AjaxResult<Void> edit(@RequestBody OrderBusinessConfigGoodsEditBo bo) {
+        return toAjax(iOrderBusinessConfigGoodsService.updateByEditBo(bo) ? 1 : 0);
+    }
+
+
+}

+ 14 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/order/OrderInvoiceController.java

@@ -93,4 +93,18 @@ public class OrderInvoiceController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 撤销订单发票
+     */
+    @ApiOperation("撤销订单发票")
+    @PreAuthorize("@ss.hasPermi('system:invoice:edit')")
+    @Log(title = "撤销订单发票", businessType = BusinessType.UPDATE)
+    @PostMapping("/cancel")
+    public AjaxResult<Void> cancel(@RequestBody OrderInvoiceEditBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        bo.setStatus(-1);
+        return toAjax(iOrderInvoiceService.updateByEditBo(bo) ? 1 : 0);
+    }
+
 }

+ 39 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigGoodsAddBo.java

@@ -0,0 +1,39 @@
+package com.zhongzheng.modules.order.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 订单配置商品添加对象 order_business_config_goods
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+@Data
+@ApiModel("订单配置商品添加对象")
+public class OrderBusinessConfigGoodsAddBo {
+
+    /** 业务层次配置id */
+    @ApiModelProperty("业务层次配置id")
+    private Long configId;
+    /** 科目ID */
+    @ApiModelProperty("科目ID")
+    private Long subjectId;
+    /** 商品ID ,拼接 */
+    @ApiModelProperty("商品ID ,拼接")
+    private String goodsIds;
+    /** 0 未启用 1启用 */
+    @ApiModelProperty("0 未启用 1启用")
+    private Integer status;
+    /** 添加时间 */
+    @ApiModelProperty("添加时间")
+    private Long createTime;
+    /** 修改时间 */
+    @ApiModelProperty("修改时间")
+    private Long updateTime;
+}

+ 44 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigGoodsEditBo.java

@@ -0,0 +1,44 @@
+package com.zhongzheng.modules.order.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+/**
+ * 订单配置商品编辑对象 order_business_config_goods
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+@Data
+@ApiModel("订单配置商品编辑对象")
+public class OrderBusinessConfigGoodsEditBo {
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long id;
+
+    /** 业务层次配置id */
+    @ApiModelProperty("业务层次配置id")
+    private Long configId;
+
+    /** 科目ID */
+    @ApiModelProperty("科目ID")
+    private Long subjectId;
+
+    /** 商品ID ,拼接 */
+    @ApiModelProperty("商品ID ,拼接")
+    private String goodsIds;
+
+    /** 0 未启用 1启用 */
+    @ApiModelProperty("0 未启用 1启用")
+    private Integer status;
+
+    /** 修改时间 */
+    @ApiModelProperty("修改时间")
+    private Long updateTime;
+
+}

+ 51 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigGoodsQueryBo.java

@@ -0,0 +1,51 @@
+package com.zhongzheng.modules.order.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import com.zhongzheng.common.core.domain.BaseEntity;
+
+/**
+ * 订单配置商品分页查询对象 order_business_config_goods
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel("订单配置商品分页查询对象")
+public class OrderBusinessConfigGoodsQueryBo extends BaseEntity {
+
+	/** 分页大小 */
+	@ApiModelProperty("分页大小")
+	private Integer pageSize;
+	/** 当前页数 */
+	@ApiModelProperty("当前页数")
+	private Integer pageNum;
+	/** 排序列 */
+	@ApiModelProperty("排序列")
+	private String orderByColumn;
+	/** 排序的方向desc或者asc */
+	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
+	private String isAsc;
+
+
+	/** 业务层次配置id */
+	@ApiModelProperty("业务层次配置id")
+	private Long configId;
+	/** 科目ID */
+	@ApiModelProperty("科目ID")
+	private Long subjectId;
+	/** 商品ID ,拼接 */
+	@ApiModelProperty("商品ID ,拼接")
+	private String goodsIds;
+	/** 0 未启用 1启用 */
+	@ApiModelProperty("0 未启用 1启用")
+	private Integer status;
+}

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderBusinessConfigQueryBo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -44,5 +45,5 @@ public class OrderBusinessConfigQueryBo extends BaseEntity {
 	private String configName;
 	/** 状态 1有效 0无效 */
 	@ApiModelProperty("状态 1有效 0无效")
-	private Integer status;
+	private List<Integer> status;
 }

+ 43 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/OrderBusinessConfigGoods.java

@@ -0,0 +1,43 @@
+package com.zhongzheng.modules.order.domain;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.zhongzheng.common.annotation.Excel;
+
+/**
+ * 订单配置商品对象 order_business_config_goods
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("order_business_config_goods")
+public class OrderBusinessConfigGoods implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+    /** 业务层次配置id */
+    private Long configId;
+    /** 科目ID */
+    private Long subjectId;
+    /** 商品ID ,拼接 */
+    private String goodsIds;
+    /** 0 未启用 1启用 */
+    private Integer status;
+    /** 添加时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+    /** 修改时间 */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+}

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderBusinessConfigGoodsMapper.java

@@ -0,0 +1,21 @@
+package com.zhongzheng.modules.order.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsQueryBo;
+import com.zhongzheng.modules.order.bo.OrderInvoiceQueryBo;
+import com.zhongzheng.modules.order.domain.OrderBusinessConfigGoods;
+import com.zhongzheng.modules.order.vo.OrderBusinessConfigGoodsVo;
+import com.zhongzheng.modules.order.vo.OrderInvoiceVo;
+
+import java.util.List;
+
+/**
+ * 订单配置商品Mapper接口
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+public interface OrderBusinessConfigGoodsMapper extends BaseMapper<OrderBusinessConfigGoods> {
+    List<OrderBusinessConfigGoodsVo> selectList(OrderBusinessConfigGoodsQueryBo bo);
+}

+ 54 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderBusinessConfigGoodsService.java

@@ -0,0 +1,54 @@
+package com.zhongzheng.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsAddBo;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsEditBo;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsQueryBo;
+import com.zhongzheng.modules.order.domain.OrderBusinessConfigGoods;
+import com.zhongzheng.modules.order.vo.OrderBusinessConfigGoodsVo;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 订单配置商品Service接口
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+public interface IOrderBusinessConfigGoodsService extends IService<OrderBusinessConfigGoods> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	OrderBusinessConfigGoodsVo queryById(Long id);
+
+	/**
+	 * 查询列表
+	 */
+	List<OrderBusinessConfigGoodsVo> queryList(OrderBusinessConfigGoodsQueryBo bo);
+
+	/**
+	 * 根据新增业务对象插入订单配置商品
+	 * @param bo 订单配置商品新增业务对象
+	 * @return
+	 */
+	Boolean insertByAddBo(OrderBusinessConfigGoodsAddBo bo);
+
+	/**
+	 * 根据编辑业务对象修改订单配置商品
+	 * @param bo 订单配置商品编辑业务对象
+	 * @return
+	 */
+	Boolean updateByEditBo(OrderBusinessConfigGoodsEditBo bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	List<OrderBusinessConfigGoodsVo> selectList(OrderBusinessConfigGoodsQueryBo bo);
+}

+ 116 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderBusinessConfigGoodsServiceImpl.java

@@ -0,0 +1,116 @@
+package com.zhongzheng.modules.order.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
+import cn.hutool.core.util.StrUtil;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsAddBo;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsEditBo;
+import com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsQueryBo;
+import com.zhongzheng.modules.order.domain.OrderBusinessConfigGoods;
+import com.zhongzheng.modules.order.mapper.OrderBusinessConfigGoodsMapper;
+import com.zhongzheng.modules.order.service.IOrderBusinessConfigGoodsService;
+import com.zhongzheng.modules.order.vo.OrderBusinessConfigGoodsVo;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.Page;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 订单配置商品Service业务层处理
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+@Service
+public class OrderBusinessConfigGoodsServiceImpl extends ServiceImpl<OrderBusinessConfigGoodsMapper, OrderBusinessConfigGoods> implements IOrderBusinessConfigGoodsService {
+
+    @Override
+    public OrderBusinessConfigGoodsVo queryById(Long id){
+        OrderBusinessConfigGoods db = this.baseMapper.selectById(id);
+        return BeanUtil.toBean(db, OrderBusinessConfigGoodsVo.class);
+    }
+
+    @Override
+    public List<OrderBusinessConfigGoodsVo> queryList(OrderBusinessConfigGoodsQueryBo bo) {
+        LambdaQueryWrapper<OrderBusinessConfigGoods> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getConfigId() != null, OrderBusinessConfigGoods::getConfigId, bo.getConfigId());
+        lqw.eq(bo.getSubjectId() != null, OrderBusinessConfigGoods::getSubjectId, bo.getSubjectId());
+        lqw.eq(StrUtil.isNotBlank(bo.getGoodsIds()), OrderBusinessConfigGoods::getGoodsIds, bo.getGoodsIds());
+        lqw.eq(bo.getStatus() != null, OrderBusinessConfigGoods::getStatus, bo.getStatus());
+        return entity2Vo(this.list(lqw));
+    }
+
+    /**
+    * 实体类转化成视图对象
+    *
+    * @param collection 实体类集合
+    * @return
+    */
+    private List<OrderBusinessConfigGoodsVo> entity2Vo(Collection<OrderBusinessConfigGoods> collection) {
+        List<OrderBusinessConfigGoodsVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, OrderBusinessConfigGoodsVo.class))
+                .collect(Collectors.toList());
+        if (collection instanceof Page) {
+            Page<OrderBusinessConfigGoods> page = (Page<OrderBusinessConfigGoods>)collection;
+            Page<OrderBusinessConfigGoodsVo> pageVo = new Page<>();
+            BeanUtil.copyProperties(page,pageVo);
+            pageVo.addAll(voList);
+            voList = pageVo;
+        }
+        return voList;
+    }
+
+    @Override
+    public Boolean insertByAddBo(OrderBusinessConfigGoodsAddBo bo) {
+        OrderBusinessConfigGoods add = BeanUtil.toBean(bo, OrderBusinessConfigGoods.class);
+        validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        return this.save(add);
+    }
+
+    @Override
+    public Boolean updateByEditBo(OrderBusinessConfigGoodsEditBo bo) {
+        if(bo.getStatus()==-1){
+            //删除
+            if(Validator.isNotEmpty(bo.getConfigId())&&Validator.isNotEmpty(bo.getSubjectId())){
+                remove(new LambdaQueryWrapper<OrderBusinessConfigGoods>().eq(OrderBusinessConfigGoods::getConfigId, bo.getConfigId()).eq(OrderBusinessConfigGoods::getSubjectId, bo.getSubjectId()));
+            }
+            return true;
+        }
+        OrderBusinessConfigGoods update = BeanUtil.toBean(bo, OrderBusinessConfigGoods.class);
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(OrderBusinessConfigGoods entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return this.removeByIds(ids);
+    }
+
+    @Override
+    public List<OrderBusinessConfigGoodsVo> selectList(OrderBusinessConfigGoodsQueryBo bo) {
+        return this.baseMapper.selectList(bo);
+    }
+}

+ 6 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderBusinessConfigServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.order.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.course.domain.CourseChapter;
 import com.zhongzheng.modules.order.bo.OrderBusinessConfigAddBo;
@@ -43,7 +44,7 @@ public class OrderBusinessConfigServiceImpl extends ServiceImpl<OrderBusinessCon
         LambdaQueryWrapper<OrderBusinessConfig> lqw = Wrappers.lambdaQuery();
         lqw.eq(bo.getBusinessId() != null, OrderBusinessConfig::getBusinessId, bo.getBusinessId());
         lqw.like(StrUtil.isNotBlank(bo.getConfigName()), OrderBusinessConfig::getConfigName, bo.getConfigName());
-        lqw.eq(bo.getStatus() != null, OrderBusinessConfig::getStatus, bo.getStatus());
+        lqw.in(bo.getStatus() != null, OrderBusinessConfig::getStatus, bo.getStatus());
         return entity2Vo(this.list(lqw));
     }
 
@@ -91,6 +92,9 @@ public class OrderBusinessConfigServiceImpl extends ServiceImpl<OrderBusinessCon
      */
     private void validEntityBeforeSave(OrderBusinessConfig entity){
         //TODO 做一些数据校验,如唯一约束
+        if(checkNameUnique(entity)){
+            throw new CustomException("名称重复");
+        }
     }
 
     @Override
@@ -103,7 +107,7 @@ public class OrderBusinessConfigServiceImpl extends ServiceImpl<OrderBusinessCon
 
     private boolean checkNameUnique(OrderBusinessConfig entity) {
         OrderBusinessConfig info = getOne(new LambdaQueryWrapper<OrderBusinessConfig>()
-                .eq(OrderBusinessConfig::getConfigName,entity.getConfigName()).ne(OrderBusinessConfig::getStatus,-1).last("limit 1"));
+                .eq(OrderBusinessConfig::getConfigName,entity.getConfigName()).eq(OrderBusinessConfig::getBusinessId,entity.getBusinessId()).ne(OrderBusinessConfig::getStatus,-1).last("limit 1"));
         if (Validator.isNotNull(info)) {
             if(Validator.isNotEmpty(entity.getId())){
                 if(entity.getId().longValue() != info.getId().longValue()){

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderInvoiceServiceImpl.java

@@ -132,6 +132,12 @@ public class OrderInvoiceServiceImpl extends ServiceImpl<OrderInvoiceMapper, Ord
         validEntityBeforeSave(update);
         //获取旧的实体
         OrderInvoiceVo old = queryById(bo.getInvoiceId());
+        //撤销
+        if(bo.getStatus()==-1){
+            if(old.getPeriodStatus()!=1||old.getUserId().longValue()!=bo.getUserId().longValue()||update.getPeriodStatus()!=1){
+                throw new CustomException("无法撤销操作");
+            }
+        }
         if(old.getPeriodStatus()==2&&bo.getPeriodStatus()!=2){
             throw new CustomException("驳回状态无法修改");
         }

+ 49 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderBusinessConfigGoodsVo.java

@@ -0,0 +1,49 @@
+package com.zhongzheng.modules.order.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 订单配置商品视图对象 mall_package
+ *
+ * @author hjl
+ * @date 2022-04-01
+ */
+@Data
+@ApiModel("订单配置商品视图对象")
+public class OrderBusinessConfigGoodsVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** 业务层次配置id */
+	@Excel(name = "业务层次配置id")
+	@ApiModelProperty("业务层次配置id")
+	private Long configId;
+	/** 科目ID */
+	@Excel(name = "科目ID")
+	@ApiModelProperty("科目ID")
+	private Long subjectId;
+	/** 商品ID ,拼接 */
+	@Excel(name = "商品ID ,拼接")
+	@ApiModelProperty("商品ID ,拼接")
+	private String goodsIds;
+	/** 0 未启用 1启用 */
+	@Excel(name = "0 未启用 1启用")
+	@ApiModelProperty("0 未启用 1启用")
+	private Integer status;
+	@ApiModelProperty("商品名称")
+	private String goodsName;
+	@ApiModelProperty("商品id")
+	private String goodsId;
+	@ApiModelProperty("商品类型 1视频2题库 3补考 4前培 ")
+	private Long goodsType;
+}

+ 43 - 0
zhongzheng-system/src/main/resources/mapper/modules/order/OrderBusinessConfigGoodsMapper.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhongzheng.modules.order.mapper.OrderBusinessConfigGoodsMapper">
+
+    <resultMap type="com.zhongzheng.modules.order.domain.OrderBusinessConfigGoods" id="OrderBusinessConfigGoodsResult">
+        <result property="id" column="id"/>
+        <result property="configId" column="config_id"/>
+        <result property="subjectId" column="subject_id"/>
+        <result property="goodsIds" column="goods_ids"/>
+        <result property="status" column="status"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.order.vo.OrderBusinessConfigGoodsVo" id="OrderBusinessConfigGoodsVoResult">
+        <result property="id" column="id"/>
+        <result property="configId" column="config_id"/>
+        <result property="subjectId" column="subject_id"/>
+        <result property="goodsIds" column="goods_ids"/>
+        <result property="status" column="status"/>
+        <result property="goodsName" column="goods_name"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="goodsType" column="goods_type"/>
+    </resultMap>
+
+
+    <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderBusinessConfigGoodsQueryBo" resultMap="OrderBusinessConfigGoodsVoResult">
+        SELECT
+            bcg.*,
+            g.goods_name,
+            g.goods_id,
+            g.goods_type
+        FROM
+            order_business_config_goods bcg
+                LEFT JOIN goods g ON FIND_IN_SET( g.goods_id, bcg.goods_ids )
+        WHERE
+            bcg.config_id = #{configId}
+          AND bcg.subject_id = #{subjectId}
+    </select>
+
+</mapper>

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -247,14 +247,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN `order` o ON o.order_sn = og.order_sn
         WHERE
         1 = 1
-        AND og.goods_id NOT IN (
+        AND og.order_goods_id NOT IN (
         SELECT
         oio.order_goods_id
         FROM
         order_invoice oi
         LEFT JOIN order_invoice_order oio ON oi.invoice_id = oio.invoice_id
         WHERE
-        oi.period_status IN ( 1, 3 ) and  oi.user_id = #{userId})
+        oi.period_status IN ( 1, 3 ) and  oi.user_id = #{userId} and oi.status != -1)
         <if test="refundStatusList != null and refundStatusList.size()!=0 ">
             AND og.refund_status in
             <foreach collection="refundStatusList" item="item" index="index" open="(" close=")" separator=",">

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/order/OrderInvoiceMapper.xml

@@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         oi.*,u.id_card,u.realname
         FROM
         order_invoice oi LEFT JOIN `user` u on oi.user_id = u.user_id
-        where 1=1
+        where 1=1 and oi.`status` != -1
         <if test="type != null and type != ''">
             AND oi.type = #{type}
         </if>