Parcourir la source

提交:商品专题页

yangdamao il y a 3 ans
Parent
commit
b87cc0121c

+ 23 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java

@@ -11,7 +11,11 @@ import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.framework.web.service.WxLoginService;
 import com.zhongzheng.modules.base.bo.ConfigQueryBo;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
+import com.zhongzheng.modules.course.bo.CourseTopicGoodsQueryBo;
 import com.zhongzheng.modules.course.service.ICourseService;
+import com.zhongzheng.modules.course.service.ICourseTopicService;
+import com.zhongzheng.modules.course.vo.CourseTopicGoodsVo;
+import com.zhongzheng.modules.course.vo.CourseTopicVo;
 import com.zhongzheng.modules.course.vo.CourseUserVo;
 import com.zhongzheng.modules.exam.bo.ExamActivityApplyBo;
 import com.zhongzheng.modules.exam.bo.ExamActivityApplyVo;
@@ -54,6 +58,25 @@ public class CommonController extends BaseController {
 
     private final IExamActivityService iExamActivityService;
 
+    private final ICourseTopicService iCourseTopicService;
+
+    /**
+     * 获取商品专题页指定商品信息
+     */
+    @ApiOperation("获取商品专题页指定商品信息")
+    @GetMapping("/get/goodsInfo/{topicId}")
+    public AjaxResult<CourseTopicVo> getGoodsInfo(@PathVariable("topicId") Integer topicId) {
+        return AjaxResult.success(iCourseTopicService.getGoodsInfo(topicId));
+    }
+
+    /**
+     * 获取专题页组合班级商品
+     */
+    @ApiOperation("获取专题页组合班级商品")
+    @GetMapping("/get/goodsList")
+    public AjaxResult<List<CourseTopicGoodsVo>> getGoodsList(CourseTopicGoodsQueryBo bo) {
+        return AjaxResult.success(iCourseTopicService.getGoodsList(bo));
+    }
 
     /**
      * 查询课程列表

+ 13 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -883,6 +883,19 @@ public class WxLoginService implements IWxLoginService {
         return result;
     }
 
+    @Override
+    public String getTopicEnCode(Long topicId) {
+        String wxGzhAccessToken = getWxSmallAccessToken();
+        String param = String.format(small_wxEnCodeParam, wxGzhAccessToken);
+        String url = small_wxEnCodeUrl + "?" + param;
+        JSONObject obj = new JSONObject();
+        obj.put("page", "pages4/courseTopic/goodsTopic");
+        obj.put("scene",String.format("topicId=%s",topicId));
+        obj.put("env_version",enCodeVersion);
+        String result = HttpUtils.sendPost(url, obj);
+        return result;
+    }
+
     public Boolean subGzh(String openId) {
         String unionId = getWxGzhUserCgiInfo(openId);
         if (Validator.isNotEmpty(unionId)) {

+ 9 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseTopicServiceImpl.java

@@ -18,6 +18,7 @@ import com.zhongzheng.modules.course.vo.CourseTopicGoodsVo;
 import com.zhongzheng.modules.course.vo.CourseTopicVo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.wx.service.IWxLoginService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -50,6 +51,9 @@ public class CourseTopicServiceImpl extends ServiceImpl<CourseTopicMapper, Cours
     @Autowired
     private IGoodsService iGoodsService;
 
+    @Autowired
+    private IWxLoginService wxLoginService;
+
     @Override
     public CourseTopicVo queryById(Long topicId){
         CourseTopic db = this.baseMapper.selectById(topicId);
@@ -69,7 +73,11 @@ public class CourseTopicServiceImpl extends ServiceImpl<CourseTopicMapper, Cours
         lqw.eq(bo.getType() != null, CourseTopic::getType, bo.getType());
         lqw.eq( CourseTopic::getStatus, 1);
         List<CourseTopicVo> courseTopicVos = entity2Vo(this.list(lqw));
-        //todo 小程序二维码和PC链接
+        courseTopicVos.forEach(item -> {
+            //todo 小程序二维码和PC链接
+            String enCode = wxLoginService.getTopicEnCode(item.getTopicId());
+            item.setEnCode(enCode);
+        });
         return courseTopicVos;
     }
 

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/IWxLoginService.java

@@ -27,4 +27,7 @@ public interface IWxLoginService
     String sendSignatureTpMsg(String openId, Map<String,String> paramMap);
 
     String getActivityApplyCode(Long activityId);
+
+    String getTopicEnCode(Long topicId);
+
 }