Commit 15ea612a2a0b56c4c7cbd33377278145d9fa0c85

Authored by 王言钊
1 parent 05f0375f

优化审核云点播、话题、直播申请、频道、音频、评论等模块的条件查询并测试

src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
... ... @@ -210,51 +210,38 @@ public class AudioServiceImpl {
210 210 public PageInfo<ShyAudio> getListContent(AudioDTO audioDTO) {
211 211 Example example = new Example(ShyAudio.class);
212 212 Example.Criteria criteria = example.createCriteria();
213   - Example.Criteria criteria2 = example.createCriteria();
214 213 if (CommonUtils.isNotEmpty(audioDTO.getOrderByClause())) {
215 214 example.setOrderByClause(audioDTO.getOrderByClause());
216 215 }
217 216 if (CommonUtils.isNotEmpty(audioDTO.getStart_date()) && CommonUtils.isNotEmpty(audioDTO.getEnd_date())) {
218 217 criteria.andGreaterThanOrEqualTo("createTime", audioDTO.getStart_date());
219   - criteria2.andGreaterThanOrEqualTo("createTime", audioDTO.getStart_date());
220 218 criteria.andLessThanOrEqualTo("createTime", audioDTO.getEnd_date());
221   - criteria2.andLessThanOrEqualTo("createTime", audioDTO.getEnd_date());
222 219 }
223 220 if (CommonUtils.isNotEmpty(audioDTO.getVideo_title())) {
224 221 criteria.andLike("audioTitle", "%" + audioDTO.getVideo_title() + "%");
225   - criteria2.andLike("audioTitle", "%" + audioDTO.getVideo_title() + "%");
226 222 }
227   -
228 223 if (CommonUtils.isNotEmpty(audioDTO.getVideo_priority())) {
229 224 criteria.andEqualTo("priority", audioDTO.getVideo_priority());
230   - criteria2.andEqualTo("priority", audioDTO.getVideo_priority());
231 225 }
232   -
233 226 if (CommonUtils.isNotNull(audioDTO.getSpid())) {
234 227 criteria.andEqualTo("spId", audioDTO.getSpid());
235   - criteria2.andEqualTo("spId", audioDTO.getSpid());
236 228 } else if (CommonUtils.isNotEmpty(audioDTO.getSp_Id())) {
237 229 criteria.andEqualTo("spId", audioDTO.getSp_Id());
238   - criteria2.andEqualTo("spId", audioDTO.getSp_Id());
239 230 }
240   -
241 231 //领取状态 0-未领取 1-已领取
242 232 if (CommonUtils.isNotNull(audioDTO.getReceive())) {
243 233 criteria.andEqualTo("receive", audioDTO.getReceive());
244   - criteria2.andEqualTo("receive", audioDTO.getReceive());
245 234 if (audioDTO.getReceive().equals(CommonConst.RECEIVE_AFTER)) {
246 235 criteria.andEqualTo("receive_user_id", audioDTO.getUserId());
247   - criteria2.andEqualTo("receive_user_id", audioDTO.getUserId());
248 236 }
249 237 }
250   -
251   - //审核状态 0-未审核 1-已审核 2-拒绝
  238 + //审核状态 0-未审核 1-已审核 2-拒绝 3-我的已审
  239 + //不是 我的已审 进来的,只查一种状态
252 240 if (CommonUtils.isNotNull(audioDTO.getState()) && audioDTO.getState() != 3) {
253 241 criteria.andEqualTo("state", audioDTO.getState());
  242 + //是 我的已审,查通过和拒绝的两种状态
254 243 } else if (CommonUtils.isNotNull(audioDTO.getState()) && audioDTO.getState() == 3) {
255   - criteria.andEqualTo("state", 1);
256   - criteria2.andEqualTo("state", 2);
257   - example.or(criteria2);
  244 + criteria.andBetween("state", CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
258 245 }
259 246  
260 247 //默认按上传时间倒序排序
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/ChannelServiceImpl.java
... ... @@ -99,10 +99,7 @@ public class ChannelServiceImpl {
99 99 criteria.andEqualTo("shenhe_status", channelDTO.getShenhe_status());
100 100 //是 我的已审,查通过和拒绝的两种状态
101 101 } else if (CommonUtils.isNotNull(channelDTO.getShenhe_status()) && channelDTO.getShenhe_status() == 3) {
102   - Example.Criteria criteria1 = example.createCriteria();
103   - criteria1.orEqualTo("shenhe_status", CommonConst.AUDIT_SUCCESS);
104   - criteria1.orEqualTo("shenhe_status", CommonConst.AUDIT_REFUSE);
105   - example.and(criteria1);
  102 + criteria.andBetween("shenhe_status",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
106 103 }
107 104  
108 105 PageHelper.startPage(channelDTO.getPage(), channelDTO.getPageSize(), true);
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
... ... @@ -123,10 +123,7 @@ public class CommentsServiceImpl {
123 123 if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() != 3) {
124 124 criteria.andEqualTo("state", commentsDTO.getState());
125 125 } else if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() == 3) {
126   - Example.Criteria criteria1 = example.createCriteria();
127   - criteria1.orEqualTo("state", CommonConst.AUDIT_SUCCESS);
128   - criteria1.orEqualTo("state", CommonConst.AUDIT_REFUSE);
129   - example.and(criteria1);
  126 + criteria.andBetween("state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
130 127 }
131 128  
132 129 PageHelper.startPage(commentsDTO.getPage(), commentsDTO.getPageSize(), true);
... ... @@ -173,14 +170,12 @@ public class CommentsServiceImpl {
173 170 criteria.andEqualTo("receive_user_id", commentsDTO.getUserId());
174 171 }
175 172 }
176   -
  173 + //不是 我的已审 进来的,只查一种状态
177 174 if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() != 3) {
178 175 criteria.andEqualTo("state", commentsDTO.getState());
  176 + //是 我的已审,查通过和拒绝的两种状态
179 177 } else if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() == 3) {
180   - Example.Criteria criteria1 = example.createCriteria();
181   - criteria1.orEqualTo("state", CommonConst.AUDIT_SUCCESS);
182   - criteria1.orEqualTo("state", CommonConst.AUDIT_REFUSE);
183   - example.and(criteria1);
  178 + criteria.andBetween("state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
184 179 }
185 180  
186 181 List<ShyComments> commentsList = shyCommentsMapper.selectByExample(example);
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/LiveApplyServiceImpl.java
... ... @@ -127,10 +127,12 @@ public class LiveApplyServiceImpl {
127 127 if (CommonUtils.isNotNull(liveApplyDTO.getSpid())) {
128 128 criteria.andEqualTo("sp_id", liveApplyDTO.getSpid());
129 129 }
  130 + //不是 我的已审 进来的,只查一种状态
130 131 if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() != 3) {
131 132 criteria.andEqualTo("shenhe_state", liveApplyDTO.getShenhe_state());
  133 + //是 我的已审,查通过和拒绝的两种状态
132 134 } else if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() == 3) {
133   - criteria.andNotEqualTo("shenhe_state", 0);
  135 + criteria.andBetween("shenhe_state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
134 136 }
135 137 if (CommonUtils.isNotNull(liveApplyDTO.getReceive())) {
136 138 criteria.andEqualTo("receive", liveApplyDTO.getReceive());
... ... @@ -262,10 +264,12 @@ public class LiveApplyServiceImpl {
262 264 if (CommonUtils.isNotNull(liveApplyDTO.getSpid())) {
263 265 criteria.andEqualTo("sp_id", liveApplyDTO.getSpid());
264 266 }
  267 + //不是 我的已审 进来的,只查一种状态
265 268 if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() != 3) {
266 269 criteria.andEqualTo("shenhe_state", liveApplyDTO.getShenhe_state());
  270 + //是 我的已审,查通过和拒绝的两种状态
267 271 } else if (CommonUtils.isNotNull(liveApplyDTO.getShenhe_state()) && liveApplyDTO.getShenhe_state() == 3) {
268   - criteria.andNotEqualTo("shenhe_state", 0);
  272 + criteria.andBetween("shenhe_state",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
269 273 }
270 274 if (CommonUtils.isNotNull(liveApplyDTO.getReceive())) {
271 275 criteria.andEqualTo("receive", liveApplyDTO.getReceive());
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/TopicServiceImpl.java
... ... @@ -122,12 +122,8 @@ public class TopicServiceImpl {
122 122 criteria.andEqualTo("shenhe_status", topicDTO.getShenhe_status());
123 123 //是 我的已审,查通过和拒绝的两种状态
124 124 } else if (CommonUtils.isNotNull(topicDTO.getShenhe_status()) && topicDTO.getShenhe_status() == 3) {
125   - Example.Criteria criteria1 = example.createCriteria();
126   - criteria1.orEqualTo("shenhe_status", 1);
127   - criteria1.orEqualTo("shenhe_status", 2);
128   - example.and(criteria1);
  125 + criteria.andBetween("shenhe_status",CommonConst.AUDIT_SUCCESS,CommonConst.AUDIT_REFUSE);
129 126 }
130   -
131 127 PageHelper.startPage(topicDTO.getPage(), topicDTO.getPageSize(), true);
132 128 List<ShyTopic> topicList = shyTopicMapper.selectByExample(example);
133 129 PageInfo<ShyTopic> pageInfo = new PageInfo<>(topicList);
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
... ... @@ -117,7 +117,6 @@ public class VideosServiceImpl {
117 117 logger.info("接受点播列表为,VideosDTO:{}", JSON.toJSONString(videosDTO));
118 118 Example example = new Example(ShyVideos.class);
119 119 Example.Criteria criteria = example.createCriteria();
120   - Example.Criteria criteria2 = example.createCriteria();
121 120 if (CommonUtils.isNotEmpty(videosDTO.getOrderByClause())) {
122 121 example.setOrderByClause(videosDTO.getOrderByClause());
123 122 }
... ... @@ -130,73 +129,58 @@ public class VideosServiceImpl {
130 129 e.printStackTrace();
131 130 }
132 131 criteria.andGreaterThanOrEqualTo("created_at", videosDTO.getStart_date());
133   - criteria2.andGreaterThanOrEqualTo("created_at", videosDTO.getStart_date());
134 132 criteria.andLessThanOrEqualTo("created_at", videosDTO.getEnd_date());
135   - criteria2.andLessThanOrEqualTo("created_at", videosDTO.getEnd_date());
136 133 }
137 134 if (CommonUtils.isNotEmpty(videosDTO.getVideo_title())) {
138 135 criteria.andLike("video_title", "%" + videosDTO.getVideo_title() + "%");
139   - criteria2.andLike("video_title", "%" + videosDTO.getVideo_title() + "%");
140 136 }
141 137  
142 138 if (CommonUtils.isNotEmpty(videosDTO.getVideo_priority())) {
143 139 criteria.andEqualTo("video_priority", videosDTO.getVideo_priority());
144   - criteria2.andEqualTo("video_priority", videosDTO.getVideo_priority());
145 140 }
146 141  
147 142 if (CommonUtils.isNotEmpty(videosDTO.getVideo_id())) {
148 143 criteria.andEqualTo("video_id", videosDTO.getVideo_id());
149   - criteria2.andEqualTo("video_id", videosDTO.getVideo_id());
150 144 }
151 145  
152 146 if (CommonUtils.isNotEmpty(videosDTO.getShen_auditor_id())) {
153 147 if ("白名单".equals(videosDTO.getShen_auditor_id()) || "自动审核".equals(videosDTO.getShen_auditor_id())) {
154 148 criteria.andEqualTo("updater", videosDTO.getShen_auditor_id());
155   - criteria2.andEqualTo("updater", videosDTO.getShen_auditor_id());
156 149 } else {
157 150 criteria.andEqualTo("auditor_id", videosDTO.getShen_auditor_id());
158   - criteria2.andEqualTo("auditor_id", videosDTO.getShen_auditor_id());
159 151 }
160 152 }
161 153  
162 154 if (CommonUtils.isNotEmpty(videosDTO.getSource()) && !"22".equals(videosDTO.getSource()) && !"102".equals(videosDTO.getSource())) {
163 155 criteria.andEqualTo("source", videosDTO.getSource());
164   - criteria2.andEqualTo("source", videosDTO.getSource());
165 156 } else if (CommonUtils.isNotEmpty(videosDTO.getSource()) && "22".equals(videosDTO.getSource())) {
166 157 criteria.andEqualTo("category", "moment");
167   - criteria2.andEqualTo("category", "moment");
168 158 } else if (CommonUtils.isNotEmpty(videosDTO.getSource()) && "102".equals(videosDTO.getSource())) {
169 159 criteria.andEqualTo("source", "102".equals(videosDTO.getSource()) ? "0" : videosDTO.getSource());
170   - criteria2.andEqualTo("source", "102".equals(videosDTO.getSource()) ? "0" : videosDTO.getSource());
171 160 }
172 161  
173 162 if (CommonUtils.isNotEmpty(videosDTO.getVideo_user_id())) {
174 163 criteria.andEqualTo("video_user_id", videosDTO.getVideo_user_id());
175   - criteria2.andEqualTo("video_user_id", videosDTO.getVideo_user_id());
176 164 }
177 165  
178 166 if (CommonUtils.isNotNull(videosDTO.getSpid())) {
179 167 criteria.andEqualTo("spid", videosDTO.getSpid());
180   - criteria2.andEqualTo("spid", videosDTO.getSpid());
181 168 } else if (CommonUtils.isNotEmpty(videosDTO.getSp_Id())) {
182 169 criteria.andEqualTo("spid", videosDTO.getSp_Id());
183   - criteria2.andEqualTo("spid", videosDTO.getSp_Id());
184 170 }
185 171  
186 172 if (CommonUtils.isNotNull(videosDTO.getReceive())) {
187 173 criteria.andEqualTo("receive", videosDTO.getReceive());
188   - criteria2.andEqualTo("receive", videosDTO.getReceive());
189 174 if (videosDTO.getReceive().equals(CommonConst.RECEIVE_AFTER)) {
190 175 criteria.andEqualTo("receive_user_id", videosDTO.getUserId());
191   - criteria2.andEqualTo("receive_user_id", videosDTO.getUserId());
192 176 }
193 177 }
  178 + //不是 我的已审 进来的,只查一种状态
194 179 if (CommonUtils.isNotNull(videosDTO.getState()) && videosDTO.getState() != 3) {
195 180 criteria.andEqualTo("state", videosDTO.getState());
  181 + //是 我的已审,查通过和拒绝的两种状态
196 182 } else if (CommonUtils.isNotNull(videosDTO.getState()) && videosDTO.getState() == 3) {
197   - criteria.andEqualTo("state", 1);
198   - criteria2.andEqualTo("state", 2);
199   - example.or(criteria2);
  183 + criteria.andBetween("state", CommonConst.AUDIT_SUCCESS, CommonConst.AUDIT_REFUSE);
200 184 }
201 185 //默认按上传时间倒序排序
202 186 example.setOrderByClause("created_at desc");
... ... @@ -290,7 +274,6 @@ public class VideosServiceImpl {
290 274 example.setOrderByClause(videosDTO.getOrderByClause());
291 275 }
292 276 if (CommonUtils.isNotEmpty(videosDTO.getStart_date()) && CommonUtils.isNotEmpty(videosDTO.getEnd_date())) {
293   -
294 277 try {
295 278 videosDTO.setStart_date(String.valueOf(CommonUtils.parseDate(videosDTO.getStart_date(), "yyyy-MM-dd")));
296 279 videosDTO.setEnd_date(String.valueOf(CommonUtils.parseDate(videosDTO.getEnd_date(), "yyyy-MM-dd")));
... ...