jiangping
2024-07-16 b0b94a084ed6c1a685caebb8dfb1a0d65fdd9ef6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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<ZTCatalogInfoResponse> 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<ZTTagInfoResponse> 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<ZTCatalogInfoResponse> 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<ZTCatalogInfoResponse>  ztCatalogInfoResponseList = zbomZhongTaiService.getCatalogList(ztCatalogListRequest);
        if(CollectionUtils.isNotEmpty(ztCatalogInfoResponseList)){
            for (ZTCatalogInfoResponse ztCatalogInfoResponse:ztCatalogInfoResponseList) {
                ZTCatalogListRequest ztCatalogTagListRequest = new ZTCatalogListRequest();
                ztCatalogTagListRequest.setCatalogCode(ztCatalogInfoResponse.getCode());
                List<ZTTagInfoResponse> ztTagInfoResponseList = zbomZhongTaiService.getTagList(ztCatalogTagListRequest);
                if(CollectionUtils.isNotEmpty(ztCatalogInfoResponseList)){
                    ztCatalogInfoResponse.setChildTagList(ztTagInfoResponseList);
                }
            }
        }
        return ztCatalogInfoResponseList;
    }
 
 
    /**
     * 内容 分页数据
     * @param ztContentListRequest
     * @return
     */
    @Override
    public ZTBasePageResponse<ZTContentListResponse> 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<ZTContentListResponse> 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;
    }
 
 
 
 
 
 
 
 
 
 
}