Commit afbc066e1a4e9b37c3893ea32e27392d9e5ff513
1 parent
61d1ddab
优化审核云直播审核排序、添加方法的注释描述
Showing
1 changed file
with
67 additions
and
15 deletions
src/main/java/com/cnlive/shenhe/serviceImpl/LiveServiceImpl.java
| ... | ... | @@ -9,6 +9,7 @@ import com.cnlive.shenhe.entity.ShyUsers; |
| 9 | 9 | import com.cnlive.shenhe.mapper.ShyLiveMapper; |
| 10 | 10 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 11 | 11 | import com.cnlive.shenhe.utils.CommonConst; |
| 12 | +import com.cnlive.shenhe.utils.CommonConstStates; | |
| 12 | 13 | import com.cnlive.shenhe.utils.CommonUtils; |
| 13 | 14 | import com.github.pagehelper.PageHelper; |
| 14 | 15 | import com.github.pagehelper.PageInfo; |
| ... | ... | @@ -38,7 +39,12 @@ public class LiveServiceImpl { |
| 38 | 39 | ShyUsersMapper shyUsersMapper; |
| 39 | 40 | |
| 40 | 41 | |
| 41 | - //============== | |
| 42 | + /** | |
| 43 | + * 直播导入 | |
| 44 | + * | |
| 45 | + * @param shyLive | |
| 46 | + * @return | |
| 47 | + */ | |
| 42 | 48 | public boolean impotVideo(ShyLive shyLive) { |
| 43 | 49 | int result = shyLiveMapper.insertSelective(shyLive); |
| 44 | 50 | if (result == 0) { |
| ... | ... | @@ -47,19 +53,34 @@ public class LiveServiceImpl { |
| 47 | 53 | return true; |
| 48 | 54 | } |
| 49 | 55 | |
| 50 | - //============== | |
| 56 | + /** | |
| 57 | + * 根据id查询 返回直播对象 | |
| 58 | + * | |
| 59 | + * @param id | |
| 60 | + * @return | |
| 61 | + */ | |
| 51 | 62 | public ShyLive selectByPrimaryKey(Integer id) { |
| 52 | 63 | ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(id); |
| 53 | 64 | return shyLive; |
| 54 | 65 | } |
| 55 | 66 | |
| 56 | - //============= | |
| 67 | + /** | |
| 68 | + * 根据条件查询 返回直播对象集合 | |
| 69 | + * | |
| 70 | + * @param shyLive | |
| 71 | + * @return | |
| 72 | + */ | |
| 57 | 73 | public List<ShyLive> findshyLive(ShyLive shyLive) { |
| 58 | 74 | List<ShyLive> shyLivelist = shyLiveMapper.selectByRowBounds(shyLive, new RowBounds(0, 100)); |
| 59 | 75 | return shyLivelist; |
| 60 | 76 | } |
| 61 | 77 | |
| 62 | - //============== | |
| 78 | + /** | |
| 79 | + * 修改直播对象 返回boolean类型 | |
| 80 | + * | |
| 81 | + * @param shyLive | |
| 82 | + * @return | |
| 83 | + */ | |
| 63 | 84 | public boolean updateshyLive(ShyLive shyLive) { |
| 64 | 85 | int i = shyLiveMapper.updateByPrimaryKey(shyLive); |
| 65 | 86 | if (i == 0) { |
| ... | ... | @@ -68,7 +89,16 @@ public class LiveServiceImpl { |
| 68 | 89 | return true; |
| 69 | 90 | } |
| 70 | 91 | |
| 71 | - //============== | |
| 92 | + /** | |
| 93 | + * 根据id查询,修改对象的关键信息 返回int类型 | |
| 94 | + * | |
| 95 | + * @param id | |
| 96 | + * @param auditor_id | |
| 97 | + * @param updater | |
| 98 | + * @param activity_status | |
| 99 | + * @param msg | |
| 100 | + * @return | |
| 101 | + */ | |
| 72 | 102 | public int updateLive(Integer id, String auditor_id, String updater, Integer activity_status, String msg) { |
| 73 | 103 | ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(id); |
| 74 | 104 | shyLive.setAuditor(auditor_id); |
| ... | ... | @@ -76,14 +106,20 @@ public class LiveServiceImpl { |
| 76 | 106 | shyLive.setActivity_status(activity_status); |
| 77 | 107 | shyLive.setShenhe_msg(msg); |
| 78 | 108 | shyLive.setUpdater(updater); |
| 79 | - shyLive.setIs_hot(1); | |
| 109 | + shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANNO); | |
| 80 | 110 | return shyLiveMapper.updateByPrimaryKey(shyLive); |
| 81 | 111 | } |
| 82 | 112 | |
| 83 | - //=============== | |
| 113 | + /** | |
| 114 | + * 分页、条件查询、返回分页结果集合 | |
| 115 | + * | |
| 116 | + * @param liveDTO | |
| 117 | + * @return | |
| 118 | + */ | |
| 84 | 119 | public PageInfo<ShyLive> getListContent(LiveDTO liveDTO) { |
| 85 | 120 | logger.info("接受参数对象,LiveDTO:{}", JSON.toJSONString(liveDTO)); |
| 86 | 121 | Example example = new Example(ShyLive.class); |
| 122 | + example.setOrderByClause("`created_at` desc"); | |
| 87 | 123 | Example.Criteria criteria = example.createCriteria(); |
| 88 | 124 | if (CommonUtils.isNotEmpty(liveDTO.getOrderByClause())) { |
| 89 | 125 | example.setOrderByClause(liveDTO.getOrderByClause()); |
| ... | ... | @@ -125,14 +161,19 @@ public class LiveServiceImpl { |
| 125 | 161 | if (CommonUtils.isNotNull(liveDTO.getActivity_status())) { |
| 126 | 162 | criteria.andEqualTo("activity_status", liveDTO.getActivity_status()); |
| 127 | 163 | } |
| 128 | - criteria.andEqualTo("is_show", 1); | |
| 164 | + criteria.andEqualTo("is_show", CommonConstStates.SHIFOU_XIANSHIYES); | |
| 129 | 165 | PageHelper.startPage(liveDTO.getPage(), liveDTO.getPageSize(), true); |
| 130 | 166 | List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example); |
| 131 | 167 | PageInfo<ShyLive> pageInfo = new PageInfo<>(shyLiveList); |
| 132 | 168 | return pageInfo; |
| 133 | 169 | } |
| 134 | 170 | |
| 135 | - //====================== | |
| 171 | + /** | |
| 172 | + * 根据id获取直播详情信息 | |
| 173 | + * | |
| 174 | + * @param id | |
| 175 | + * @return | |
| 176 | + */ | |
| 136 | 177 | public ShyLive getDetailsLive(Integer id) { |
| 137 | 178 | ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(id); |
| 138 | 179 | if (!shyLive.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) { |
| ... | ... | @@ -153,7 +194,15 @@ public class LiveServiceImpl { |
| 153 | 194 | return shyLive; |
| 154 | 195 | } |
| 155 | 196 | |
| 156 | - //==================== | |
| 197 | + /** | |
| 198 | + * 认领 | |
| 199 | + * | |
| 200 | + * @param ids | |
| 201 | + * @param num | |
| 202 | + * @param userId | |
| 203 | + * @param spid | |
| 204 | + * @return | |
| 205 | + */ | |
| 157 | 206 | public Integer receive(String ids, Integer num, String userId, Integer spid) { |
| 158 | 207 | Integer n = 0; |
| 159 | 208 | if (CommonUtils.isNotEmpty(ids)) { |
| ... | ... | @@ -162,7 +211,6 @@ public class LiveServiceImpl { |
| 162 | 211 | ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(Integer.parseInt(cid)); |
| 163 | 212 | if (CommonUtils.isNotNull(shyLive) && shyLive.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) { |
| 164 | 213 | shyLive.setAuditor(userId); |
| 165 | - ; | |
| 166 | 214 | shyLive.setShenhe_state(CommonConst.RECEIVE_AFTER); |
| 167 | 215 | shyLiveMapper.updateByPrimaryKeySelective(shyLive); |
| 168 | 216 | n++; |
| ... | ... | @@ -188,7 +236,13 @@ public class LiveServiceImpl { |
| 188 | 236 | return n; |
| 189 | 237 | } |
| 190 | 238 | |
| 191 | - //================ | |
| 239 | + /** | |
| 240 | + * 退领 | |
| 241 | + * | |
| 242 | + * @param ids | |
| 243 | + * @param userId | |
| 244 | + * @return | |
| 245 | + */ | |
| 192 | 246 | public ResponseBean retReceive(String ids, String userId) { |
| 193 | 247 | String[] cids = ids.split(","); |
| 194 | 248 | for (String cid : cids) { |
| ... | ... | @@ -257,10 +311,8 @@ public class LiveServiceImpl { |
| 257 | 311 | if (CommonUtils.isNotNull(liveDTO.getActivity_status())) { |
| 258 | 312 | criteria.andEqualTo("activity_status", liveDTO.getActivity_status()); |
| 259 | 313 | } |
| 260 | - criteria.andEqualTo("is_show", 1); | |
| 314 | + criteria.andEqualTo("is_show", CommonConstStates.SHIFOU_XIANSHIYES); | |
| 261 | 315 | List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example); |
| 262 | 316 | return shyLiveList; |
| 263 | 317 | } |
| 264 | - | |
| 265 | - | |
| 266 | 318 | } | ... | ... |