Commit afbc066e1a4e9b37c3893ea32e27392d9e5ff513

Authored by 王言钊
1 parent 61d1ddab

优化审核云直播审核排序、添加方法的注释描述

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