package com.doumee.service.business.impl; import com.alibaba.fastjson.JSONObject; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.biz.zbom.ZbomZhongTaiService; import com.doumee.biz.zbom.model.zhongtai.ZTCatalogListRequest; import com.doumee.biz.zbom.model.zhongtai.ZTConstants; import com.doumee.biz.zbom.model.zhongtai.ZTContentInfoRequest; import com.doumee.biz.zbom.model.zhongtai.ZTContentListRequest; import com.doumee.biz.zbom.model.zhongtai.response.*; import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.dao.business.IamInterfaceLogMapper; import com.doumee.dao.business.MemberMapper; import com.doumee.dao.business.UsersMapper; import com.doumee.service.business.GetZhongTaiDataService; import com.github.xiaoymin.knife4j.core.util.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Objects; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2024/7/15 14:12 */ @Service public class GetZhongTaiDataServiceImpl implements GetZhongTaiDataService { @Autowired private ZbomZhongTaiService zbomZhongTaiService; @Autowired private MemberMapper memberMapper; @Autowired private UsersMapper usersMapper; @Autowired private SystemDictDataBiz systemDictDataBiz; @Override public List getCatalogList(ZTCatalogListRequest ztCatalogListRequest){ if(Objects.isNull(ztCatalogListRequest) || StringUtils.isBlank(ztCatalogListRequest.getCatalogCode())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } if(ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.ZHISHUO_ZHUANGXIU) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.CHANPING) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.ZIXUN) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.QW_CASE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"分类信息错误"); } return zbomZhongTaiService.getCatalogList(ztCatalogListRequest); } @Override public List getCataLogTagList(ZTCatalogListRequest ztCatalogListRequest){ if(Objects.isNull(ztCatalogListRequest) || StringUtils.isBlank(ztCatalogListRequest.getCatalogCode())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } if(ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.ZHISHUO_ZHUANGXIU) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.CHANPING) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.ZIXUN) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.QW_CASE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"分类信息错误"); } return zbomZhongTaiService.getTagList(ztCatalogListRequest); } /** * 获取父子级结构数据列表 * 志说装修 zb_deco 产品 product_intro 资讯product_info 全屋案例 whole_case * 获取父子级结构数据 * @return */ @Override public List getZTCatalogInfoResponse(ZTCatalogListRequest ztCatalogListRequest){ if(Objects.isNull(ztCatalogListRequest) || StringUtils.isBlank(ztCatalogListRequest.getCatalogCode())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } if(ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.ZHISHUO_ZHUANGXIU) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.CHANPING) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.ZIXUN) ||ztCatalogListRequest.getCatalogCode().equals(ZTConstants.CatalogCode.QW_CASE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"分类信息错误"); } List ztCatalogInfoResponseList = zbomZhongTaiService.getCatalogList(ztCatalogListRequest); if(CollectionUtils.isNotEmpty(ztCatalogInfoResponseList)){ for (ZTCatalogInfoResponse ztCatalogInfoResponse:ztCatalogInfoResponseList) { ZTCatalogListRequest ztCatalogTagListRequest = new ZTCatalogListRequest(); ztCatalogTagListRequest.setCatalogCode(ztCatalogInfoResponse.getCode()); List ztTagInfoResponseList = zbomZhongTaiService.getTagList(ztCatalogTagListRequest); if(CollectionUtils.isNotEmpty(ztCatalogInfoResponseList)){ ztCatalogInfoResponse.setChildTagList(ztTagInfoResponseList); } } } return ztCatalogInfoResponseList; } /** * 内容 分页数据 * @param ztContentListRequest * @return */ @Override public ZTBasePageResponse pageContentList(ZTContentListRequest ztContentListRequest){ if(Objects.isNull(ztContentListRequest) || Objects.isNull(ztContentListRequest.getPageNum()) || Objects.isNull(ztContentListRequest.getPageSize()) || StringUtils.isBlank(ztContentListRequest.getCatalogCode()) || StringUtils.isBlank(ztContentListRequest.getTagCodes()) || StringUtils.isBlank(ztContentListRequest.getQuery()) || StringUtils.isBlank(ztContentListRequest.getSortType()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } //查询 中台 String token = MemberServiceImpl.getZTToken(zbomZhongTaiService,memberMapper,usersMapper,systemDictDataBiz,ztContentListRequest.getUserId(),ztContentListRequest.getUserType()); ztContentListRequest.setToken(token); String catalogCode = ztContentListRequest.getCatalogCode(); if(catalogCode.equals(ZTConstants.CatalogCode.ZHISHUO_ZHUANGXIU) ||catalogCode.equals(ZTConstants.CatalogCode.CHANPING) ||catalogCode.equals(ZTConstants.CatalogCode.ZIXUN) ||catalogCode.equals(ZTConstants.CatalogCode.QW_CASE)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"分类信息错误"); } ZTBasePageResponse response = zbomZhongTaiService.pageContentList(ztContentListRequest); return response; } @Override public ZTContentInfoResponse getContentInfo(String id,String userType,Long userId){ //查询 中台 TOKEN String token = MemberServiceImpl.getZTToken(zbomZhongTaiService,memberMapper,usersMapper,systemDictDataBiz,userId.toString(),userType); ZTContentInfoRequest ztContentListRequest = new ZTContentInfoRequest(); ztContentListRequest.setToken(token); ztContentListRequest.setUserType(userType); ztContentListRequest.setId(id); ZTContentInfoResponse response = zbomZhongTaiService.getContentInfo(ztContentListRequest); return response; } }