he2802 2 年之前
父节点
当前提交
e14070d31e

+ 35 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsFirstChoiceAddBo.java

@@ -0,0 +1,35 @@
+package com.zhongzheng.modules.goods.bo;
+
+import com.zhongzheng.modules.course.bo.CourseMenuAddBo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 商品添加对象 goods
+ *
+ * @author hjl
+ * @date 2021-10-12
+ */
+@Data
+@ApiModel("商品添加对象")
+public class GoodsFirstChoiceAddBo {
+
+    @ApiModelProperty("用户ID")
+    private Long userId;
+
+    @ApiModelProperty("订单商品ID")
+    private Long orderGoodsId;
+
+    @ApiModelProperty("商品ID")
+    private Long goodsId;
+
+    @ApiModelProperty("课程ID")
+    private Long courseId;
+
+    @ApiModelProperty("章列表ID")
+    private List<Long> chapterIdList;
+}

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -163,5 +163,5 @@ public interface IGoodsService extends IService<Goods> {
 
 	List<Goods> getRelGoodsNoTenant(String businessName, String categoryName, Long tenantId);
 
-	Long firstChoiceGoods();
+
 }

+ 1 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -5199,10 +5199,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return baseMapper.getRelGoodsNoTenant(businessName,categoryName,tenantId);
     }
 
-    @Override
-    public Long firstChoiceGoods() {
-        return null;
-    }
+
 
     private void updateHandoutsId(Long goodsId, Long tenantId, Long handoutsId) {
         baseMapper.updateHandoutsId(goodsId,tenantId,handoutsId);

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsVo.java

@@ -388,4 +388,6 @@ public class GoodsVo {
 	@Excel(name = "优选生成商品 0否 1是")
 	@ApiModelProperty("优选生成商品 0否 1是")
 	private Integer firstChoiceGoods;
+	@ApiModelProperty("业务别名")
+	private String aliasName;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.order.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.course.vo.CourseLiveVo;
 import com.zhongzheng.modules.goods.bo.CheckGoodsStatusBo;
+import com.zhongzheng.modules.goods.bo.GoodsFirstChoiceAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.bo.GoodsSectionListBo;
 import com.zhongzheng.modules.goods.vo.GoodsSectionListVo;
@@ -124,4 +125,6 @@ public interface IOrderGoodsService extends IService<OrderGoods> {
     Long countOrderGoodsByYear(String sevenYear, Long goodsId, Long userId);
 
     String getOrderSevenYear(Long orderGoodsId);
+
+    Long firstChoiceGoods(GoodsFirstChoiceAddBo bo);
 }

+ 22 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -37,10 +37,7 @@ import com.zhongzheng.modules.exam.service.IExamApplySiteTimeService;
 import com.zhongzheng.modules.exam.service.IExamApplyUserService;
 import com.zhongzheng.modules.exam.service.IExamBeforeService;
 import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
-import com.zhongzheng.modules.goods.bo.CheckGoodsStatusBo;
-import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
-import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
-import com.zhongzheng.modules.goods.bo.GoodsSectionListBo;
+import com.zhongzheng.modules.goods.bo.*;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.domain.GoodsQuestionRel;
 import com.zhongzheng.modules.goods.domain.QuestionMerchant;
@@ -921,4 +918,25 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
 
         return true;
     }
+
+    @Override
+    public Long firstChoiceGoods(GoodsFirstChoiceAddBo bo) {
+        if(Validator.isEmpty(bo.getGoodsId())||Validator.isEmpty(bo.getOrderGoodsId())){
+            throw new CustomException("参数错误");
+        }
+        Goods goodsOld = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
+                .eq(Goods::getGoodsId, bo.getGoodsId()));
+        if(Validator.isEmpty(goodsOld)){
+            throw new CustomException("数据错误");
+        }
+        if(Validator.isEmpty(goodsOld.getFirstChoiceStatus())||goodsOld.getFirstChoiceStatus()!=1){
+            throw new CustomException("非法商品操作");
+        }
+        OrderGoods orderGoods = getOne(new LambdaQueryWrapper<OrderGoods>()
+                .eq(OrderGoods::getOrderGoodsId, bo.getOrderGoodsId()));
+        if(Validator.isEmpty(orderGoods)||orderGoods.getGoodsId()!=bo.getGoodsId()){
+            throw new CustomException("订单商品数据错误");
+        }
+        return null;
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -151,6 +151,7 @@
         <result property="firstChoiceStatus" column="first_choice_status"/>
         <result property="minClassHour" column="min_class_hour"/>
         <result property="firstChoiceGoods" column="first_choice_goods"/>
+        <result property="aliasName" column="alias_name"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
@@ -196,6 +197,7 @@
         cet.education_name,
         cpt.project_name,
         cb.business_name,
+        cb.alias_name,
         cb.goods_learning_order,
         s.school_name,
         m.category_name,