diff --git a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java index ef1cdc71..d7e29e1a 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java @@ -49,6 +49,9 @@ public class CmsContentController { @Resource private BsMsgService bsMsgService; + @Resource + private tPigController tPigController; + @Autowired private UserCenter userCenter; @@ -94,6 +97,7 @@ public class CmsContentController { object.put("sort" , cmsCategory.getSort()); object.put("code" , cmsCategory.getCode()); cmsContent = cmsContentService.getListCmsContentByCategoryId(cmsCategory.getId() , companyId , platform); + if (cmsContent.size() > 0) { dataWhetherNull = false; } @@ -168,7 +172,15 @@ public class CmsContentController { object.put("name" , category.getName()); object.put("sort" , category.getSort()); object.put("code" , category.getCode()); - object.put("childCategory" , cmsContentService.getListCmsContentByCategoryId(category.getId() , companyId , platform)); + + cmsContent = cmsContentService.getListCmsContentByCategoryId(category.getId() , companyId , platform); + + for (CmsContent content : cmsContent) { + if (content.getTitle().equals("电影票")) { + content.setJumpUrl(cmsCategoryService.queryCinemaUrl()); + } + } + object.put("childCategory" , cmsContent); return ResponseMsgUtil.success(object); } diff --git a/hai-service/src/main/java/com/hai/service/CmsCategoryService.java b/hai-service/src/main/java/com/hai/service/CmsCategoryService.java index 285c22b4..ee82bba5 100644 --- a/hai-service/src/main/java/com/hai/service/CmsCategoryService.java +++ b/hai-service/src/main/java/com/hai/service/CmsCategoryService.java @@ -147,4 +147,6 @@ public interface CmsCategoryService { */ List getRolesOfCategory(Long id) throws Exception; + String queryCinemaUrl() throws Exception; + } diff --git a/hai-service/src/main/java/com/hai/service/impl/CmsCategoryServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CmsCategoryServiceImpl.java index 01f76aec..395a67a9 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CmsCategoryServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CmsCategoryServiceImpl.java @@ -4,12 +4,18 @@ import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.security.UserCenter; +import com.hai.config.CommonSysConst; +import com.hai.config.QianZhuConfig; import com.hai.dao.CmsCategoryMapper; import com.hai.entity.CmsCategory; import com.hai.entity.CmsCategoryExample; +import com.hai.entity.HighUser; import com.hai.model.CmsCategoryTreeModel; +import com.hai.model.HighUserModel; import com.hai.service.CmsCategoryRoleService; import com.hai.service.CmsCategoryService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -27,6 +33,9 @@ public class CmsCategoryServiceImpl implements CmsCategoryService { @Resource private CmsCategoryRoleService cmsCategoryRoleService; + @Autowired + private UserCenter userCenter; + @Override @Transactional public int addCategory(CmsCategory cmsCategory, List roleList) throws Exception { @@ -273,4 +282,28 @@ public class CmsCategoryServiceImpl implements CmsCategoryService { return false; } + + @Override + public String queryCinemaUrl() throws Exception { + HighUserModel sessionModel = userCenter.getSessionModel(HighUserModel.class); + if (sessionModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + // 查询用户 + HighUser user = sessionModel.getHighUser(); + if (user == null || sessionModel.getHighUser() == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + // 获取token + JSONObject token = QianZhuConfig.getToken(""+user.getId() , user.getName() , user.getPhone()); + String url = ""; + if (token.getBoolean("success")) { + JSONObject data = token.getJSONObject("data"); + url = CommonSysConst.getSysConfig().getQinzhuHtmlUrl()+"/cinema/?platformId="+CommonSysConst.getSysConfig().getQinzhuPlatformId()+"&token="+data.getString("accessToken"); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取地址失败"); + } + return url; + } }