|
|
@@ -59,6 +59,9 @@ public class OfficialApiServiceImpl implements IOfficialApiService {
|
|
|
@Value("${studyApi.domain}")
|
|
|
private String SYS_DOMAIN;
|
|
|
|
|
|
+ @Value("${studyApi.h5Domain}")
|
|
|
+ private String SYS_H5DOMAIN;
|
|
|
+
|
|
|
@Value("${studyApi.tenantId}")
|
|
|
private String SYS_TENANTID;
|
|
|
|
|
|
@@ -249,6 +252,82 @@ public class OfficialApiServiceImpl implements IOfficialApiService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<CourseBusinessVo> getBusinessList(OfficialOpenBo bo) {
|
|
|
+ CommonOfficialBo studentBo = new CommonOfficialBo();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
|
|
|
+ studentBo.setStamp(nowTime);
|
|
|
+ studentBo.setSign(sign);
|
|
|
+ HashMap<String, String> headersMap = new HashMap<>();
|
|
|
+ headersMap.put("TenantId",StringUtils.isNotBlank(bo.getTenantId())?bo.getTenantId():SYS_TENANTID);
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.sendPostHeader(SYS_EDUPATH, JSONObject.parseObject(JSONObject.toJSONString(studentBo)),headersMap);
|
|
|
+ if (!respone.contains("\"code\":200")) {
|
|
|
+ throw new CustomException("云学堂教育类型获取失败");
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(respone);
|
|
|
+ List<EducationVo> educationVos = JSONArray.parseArray(jsonObject.get("data").toString(), EducationVo.class);
|
|
|
+ List<CourseBusinessVo> businessVos = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(educationVos)){
|
|
|
+ //填充跳转地址
|
|
|
+ String path = SYS_H5DOMAIN + "pages/course/index?";
|
|
|
+ educationVos.forEach(item -> {
|
|
|
+ if (CollectionUtils.isNotEmpty(item.getBusinessList())){
|
|
|
+ item.getBusinessList().forEach(x -> {
|
|
|
+ x.setJumpUrl(path+String.format("educationId=%s&projectId=%s&businessId=%s",item.getId(),x.getProjectId(),x.getId()));
|
|
|
+ });
|
|
|
+ businessVos.addAll(item.getBusinessList());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return businessVos;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new CustomException("云学堂教育类型获取失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<OfficialGoodsVo> getEduApiGoodsList(OfficialOpenBo bo) {
|
|
|
+ CommonOfficialBo studentBo = new CommonOfficialBo();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
|
|
|
+ studentBo.setStamp(nowTime);
|
|
|
+ studentBo.setSign(sign);
|
|
|
+ studentBo.setPlatform(2);
|
|
|
+ studentBo.setStatus(1);
|
|
|
+ HashMap<String, String> headersMap = new HashMap<>();
|
|
|
+ headersMap.put("TenantId",StringUtils.isNotBlank(bo.getTenantId())?bo.getTenantId():SYS_TENANTID);
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.sendPostHeader(SYS_GOODSPATH, JSONObject.parseObject(JSONObject.toJSONString(studentBo)),headersMap);
|
|
|
+ if (!respone.contains("\"code\":200")) {
|
|
|
+ throw new CustomException("云学堂推荐商品列表获取失败");
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(respone);
|
|
|
+ List<OfficialRecommendVo> educationVos = JSONArray.parseArray(jsonObject.get("data").toString(), OfficialRecommendVo.class);
|
|
|
+ List<OfficialGoodsVo> goodsVos = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(educationVos)){
|
|
|
+ //填充跳转地址
|
|
|
+ String path = SYS_H5DOMAIN + "pages3/course/detail?";
|
|
|
+ educationVos.forEach(item -> {
|
|
|
+ if (CollectionUtils.isNotEmpty(item.getGoodsList())){
|
|
|
+ for (OfficialGoodsVo goodsVo : item.getGoodsList()) {
|
|
|
+ goodsVo.setJumpUrl(path+String.format("id=%s&goodsType=%s",goodsVo.getGoodsId(),goodsVo.getGoodsType()));
|
|
|
+ }
|
|
|
+ goodsVos.addAll(item.getGoodsList());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return goodsVos;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new CustomException("云学堂推荐商品列表获取失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void getChildren(OfficialMenuVo parent) {
|
|
|
List<OfficialMenu> list = officialMenuService.list(new LambdaQueryWrapper<OfficialMenu>()
|
|
|
.eq(OfficialMenu::getParentId, parent.getMenuId())
|