Commit ba831bfcc3f0a95faa91c4ff28c8966715dc777d

Authored by 郑超
1 parent 76d28cbd

update

src/main/java/com/cnlive/shenhe/controller/BaseController.java
@@ -48,18 +48,6 @@ public class BaseController { @@ -48,18 +48,6 @@ public class BaseController {
48 } 48 }
49 49
50 /** 50 /**
51 - * 获取session中的用户id  
52 - *  
53 - * @return  
54 - */  
55 - public String getSessionUserId() {  
56 - SessionUser sessionUser = getSessionUser();  
57 - if (sessionUser != null) return sessionUser.getUserId();  
58 - return null;  
59 - }  
60 -  
61 -  
62 - /**  
63 * 设置用户session 51 * 设置用户session
64 */ 52 */
65 public void setSessionUser(SessionUser sessionUser) { 53 public void setSessionUser(SessionUser sessionUser) {
@@ -97,13 +85,5 @@ public class BaseController { @@ -97,13 +85,5 @@ public class BaseController {
97 model.addAttribute("remindMessage", "提示:如连续两次以上入库失败,请联系开发人员"); 85 model.addAttribute("remindMessage", "提示:如连续两次以上入库失败,请联系开发人员");
98 } 86 }
99 87
100 - /**  
101 - * 设置报错页面显示信息——权限不足  
102 - *  
103 - * @param model  
104 - */  
105 - public void setmodelLimit(Model model) {  
106 - model.addAttribute("errorMessage", "您没有此操作的权限,请重试或者联系管理员开通!");  
107 - }  
108 88
109 } 89 }
src/main/java/com/cnlive/shenhe/controller/VideosController.java
@@ -13,7 +13,10 @@ import com.cnlive.shenhe.serviceImpl.ShyActivityImpl; @@ -13,7 +13,10 @@ import com.cnlive.shenhe.serviceImpl.ShyActivityImpl;
13 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; 13 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
14 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 14 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
15 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; 15 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
16 -import com.cnlive.shenhe.utils.*; 16 +import com.cnlive.shenhe.utils.AuditPass;
  17 +import com.cnlive.shenhe.utils.CommonConst;
  18 +import com.cnlive.shenhe.utils.CommonUtils;
  19 +import com.cnlive.shenhe.utils.HttpClientUtils;
17 import com.github.pagehelper.PageInfo; 20 import com.github.pagehelper.PageInfo;
18 import org.apache.poi.xssf.usermodel.XSSFCell; 21 import org.apache.poi.xssf.usermodel.XSSFCell;
19 import org.apache.poi.xssf.usermodel.XSSFRow; 22 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -46,8 +49,6 @@ public class VideosController extends BaseController { @@ -46,8 +49,6 @@ public class VideosController extends BaseController {
46 @Autowired 49 @Autowired
47 AuditPass Pass; 50 AuditPass Pass;
48 @Autowired 51 @Autowired
49 - InfoUtil infoUtil;  
50 - @Autowired  
51 VideosServiceImpl videosService; 52 VideosServiceImpl videosService;
52 @Autowired 53 @Autowired
53 UsersServiceImpl usersService; 54 UsersServiceImpl usersService;
@@ -80,28 +81,26 @@ public class VideosController extends BaseController { @@ -80,28 +81,26 @@ public class VideosController extends BaseController {
80 logger.info("id:{},activity_id:{},state:{},attr_tags:{},msg:{},callback:{}", id, activity_id, state, attr_tags, msg, callback); 81 logger.info("id:{},activity_id:{},state:{},attr_tags:{},msg:{},callback:{}", id, activity_id, state, attr_tags, msg, callback);
81 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 82 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
82 String userId = sessionUser.getUserId(); 83 String userId = sessionUser.getUserId();
83 -// ShyVideos shyVideos = videosService.selectByPrimaryKey(id);  
84 -// if (shyVideos.getReceive() && CommonUtils.isNotEmpty(shyVideos.getReceive_user_id()) && userId.equals(shyVideos.getReceive_user_id())) {  
85 - JSONObject result = null; 84 + JSONObject result;
86 try { 85 try {
87 result = Pass.auditPass(activity_id, state, attr_tags, msg, callback); 86 result = Pass.auditPass(activity_id, state, attr_tags, msg, callback);
88 } catch (Exception e) { 87 } catch (Exception e) {
89 e.printStackTrace(); 88 e.printStackTrace();
90 - System.out.println("视频审核失败"); 89 + logger.error("视频审核失败", e);
91 return new ResponseBean(ErrorEnum.ERROR); 90 return new ResponseBean(ErrorEnum.ERROR);
92 } 91 }
93 if (result == null) { 92 if (result == null) {
94 - System.out.println("视频审核失败且接口错误没有返回信息"); 93 + logger.error("视频审核失败且接口错误没有返回信息");
95 return new ResponseBean(ErrorEnum.ERROR); 94 return new ResponseBean(ErrorEnum.ERROR);
96 } 95 }
97 Integer code = result.getInteger("code"); 96 Integer code = result.getInteger("code");
98 String errorCode = result.getString("errorCode"); 97 String errorCode = result.getString("errorCode");
99 if (code != null && code != 0) { 98 if (code != null && code != 0) {
100 - System.out.println("审核失败,code==" + code); 99 + logger.error("审核失败,code==" + code);
101 return new ResponseBean(code, result.getString("msg")); 100 return new ResponseBean(code, result.getString("msg"));
102 } 101 }
103 if (errorCode != null && !"0".equals(errorCode)) { 102 if (errorCode != null && !"0".equals(errorCode)) {
104 - System.out.println("审核失败,code==" + code); 103 + logger.error("审核失败,code==" + code);
105 return new ResponseBean(Integer.valueOf(errorCode), "服务器异常"); 104 return new ResponseBean(Integer.valueOf(errorCode), "服务器异常");
106 } 105 }
107 state = state == 4 ? 2 : 1; 106 state = state == 4 ? 2 : 1;
@@ -110,7 +109,6 @@ public class VideosController extends BaseController { @@ -110,7 +109,6 @@ public class VideosController extends BaseController {
110 return new ResponseBean(ErrorEnum.ERROR); 109 return new ResponseBean(ErrorEnum.ERROR);
111 } 110 }
112 return new ResponseBean(ErrorEnum.SUCCESS); 111 return new ResponseBean(ErrorEnum.SUCCESS);
113 -// }  
114 } 112 }
115 113
116 /** 114 /**
@@ -137,21 +135,22 @@ public class VideosController extends BaseController { @@ -137,21 +135,22 @@ public class VideosController extends BaseController {
137 if (CommonUtils.isNull(sessionUser)) { 135 if (CommonUtils.isNull(sessionUser)) {
138 return "redirect:/users/login"; 136 return "redirect:/users/login";
139 } 137 }
140 - Integer spid = sessionUser.getSpid();  
141 - logger.info("sp_Id:{},spid:{}", sp_Id, spid); 138 +
  139 + Integer sessionUserSpid = sessionUser.getSpid();
  140 + logger.info("sp_Id:{},sessionUserSpid:{}", sp_Id, sessionUserSpid);
142 String userId = sessionUser.getUserId(); 141 String userId = sessionUser.getUserId();
143 if (CommonUtils.isNull(page)) page = 1; 142 if (CommonUtils.isNull(page)) page = 1;
144 if (CommonUtils.isNull(pageSize)) pageSize = 10; 143 if (CommonUtils.isNull(pageSize)) pageSize = 10;
145 - if (CommonUtils.isNotEmpty(sp_desc) && spid == 0) { 144 + if (CommonUtils.isNotEmpty(sp_desc) && sessionUserSpid == 0) {
146 ShySites shySite = sitesService.findspidBySpdesc(sp_desc); 145 ShySites shySite = sitesService.findspidBySpdesc(sp_desc);
147 if (CommonUtils.isNotNull(shySite)) { 146 if (CommonUtils.isNotNull(shySite)) {
148 - spid = shySite.getSpid(); 147 + sessionUserSpid = shySite.getSpid();
149 } else { 148 } else {
150 setmodelSite(model); 149 setmodelSite(model);
151 return "error.html"; 150 return "error.html";
152 } 151 }
153 - } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {  
154 - spid = null; 152 + } else if (CommonUtils.isEmpty(sp_desc) && sessionUserSpid == 0) {
  153 + sessionUserSpid = null;
155 } 154 }
156 155
157 if (CommonUtils.isNotNull(contentId)) { 156 if (CommonUtils.isNotNull(contentId)) {
@@ -168,23 +167,22 @@ public class VideosController extends BaseController { @@ -168,23 +167,22 @@ public class VideosController extends BaseController {
168 } 167 }
169 } 168 }
170 169
171 - PageInfo<ShyVideos> videoPage = videosService.getListContent(video_title, start_date, end_date, state, receive, page, pageSize, video_priority, orderByClause, spid, userId, sp_Id, source, video_user_id, shen_auditor_id, video_id); 170 + PageInfo<ShyVideos> videoPage = videosService.getListContent(video_title, start_date, end_date, state, receive, page, pageSize, video_priority, orderByClause, sessionUserSpid, userId, sp_Id, source, video_user_id, shen_auditor_id, video_id);
172 //查询查询条件 171 //查询查询条件
173 List<ShyActivity> activityList = shyActivityImpl.selectAll(); 172 List<ShyActivity> activityList = shyActivityImpl.selectAll();
174 List<ShyVideos> list = videoPage.getList(); 173 List<ShyVideos> list = videoPage.getList();
175 if (!list.isEmpty()) { 174 if (!list.isEmpty()) {
176 for (ShyVideos videos : list) { 175 for (ShyVideos videos : list) {
177 - if (videos.getState() != CommonConst.AUDIT_INTT) { 176 + if (!videos.getState().equals(CommonConst.AUDIT_INTT)) {
178 String updater = CommonUtils.isEmpty(videos.getUpdater()) || "null".equals(videos.getUpdater()) ? "白名单" : videos.getUpdater(); 177 String updater = CommonUtils.isEmpty(videos.getUpdater()) || "null".equals(videos.getUpdater()) ? "白名单" : videos.getUpdater();
179 - String auditor_id = videos.getAuditor_id();  
180 - if (CommonUtils.isNotEmpty(auditor_id)) { 178 + String auditorId = videos.getAuditor_id();
  179 + if (CommonUtils.isNotEmpty(auditorId)) {
181 ShyUsers user = new ShyUsers(); 180 ShyUsers user = new ShyUsers();
182 - user.setUser_id(auditor_id); 181 + user.setUser_id(auditorId);
183 user = usersService.select(user); 182 user = usersService.select(user);
184 if (CommonUtils.isNotNull(user)) { 183 if (CommonUtils.isNotNull(user)) {
185 String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail(); 184 String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
186 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();  
187 - updater = userName; 185 + updater = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
188 } 186 }
189 } 187 }
190 videos.setUpdater(updater); 188 videos.setUpdater(updater);
@@ -193,7 +191,7 @@ public class VideosController extends BaseController { @@ -193,7 +191,7 @@ public class VideosController extends BaseController {
193 ShySites shySites = sitesService.findspidDescByspid(videos.getSpid()); 191 ShySites shySites = sitesService.findspidDescByspid(videos.getSpid());
194 if (CommonUtils.isNotNull(shySites)) { 192 if (CommonUtils.isNotNull(shySites)) {
195 if (CommonUtils.isNotEmpty(videos.getCategory()) && videos.getCategory().equals(CommonConst.CATEGORY_WITNESS)) { 193 if (CommonUtils.isNotEmpty(videos.getCategory()) && videos.getCategory().equals(CommonConst.CATEGORY_WITNESS)) {
196 - //0-目击者 1-童声共济 2-全民健身 3-目击者政府监督 4-美食中国 5-老年大学 6-旅游摄影大赛 7-老年大学公开课 8-甲申同文 9-万人同唱一首歌 10-上太空 11-芳华归来个人 12-芳华归来团体 13-小小表演家 100-追问发布会 33-万人同唱献给党-独唱 34-万人同唱献给党-合唱 194 + //0-目击者 1-童声共济 2-全民健身 3-目击者政府监督 .....
197 String source1 = videos.getSource(); 195 String source1 = videos.getSource();
198 if (CommonUtils.isNotEmpty(source1)) { 196 if (CommonUtils.isNotEmpty(source1)) {
199 for (ShyActivity activity : activityList) { 197 for (ShyActivity activity : activityList) {
@@ -215,9 +213,9 @@ public class VideosController extends BaseController { @@ -215,9 +213,9 @@ public class VideosController extends BaseController {
215 } 213 }
216 /* 获取参数值给前台 用来判断是否需要把查看显示出来 state recive*/ 214 /* 获取参数值给前台 用来判断是否需要把查看显示出来 state recive*/
217 String state1 = state == null ? "" : state.toString(); 215 String state1 = state == null ? "" : state.toString();
218 - String receive1 = ""; 216 + String receive1;
219 if (CommonUtils.isNotNull(receive)) { 217 if (CommonUtils.isNotNull(receive)) {
220 - receive1 = receive == CommonConst.RECEIVE_AFTER ? "true" : "false"; 218 + receive1 = receive.equals(CommonConst.RECEIVE_AFTER) ? "true" : "false";
221 } else { 219 } else {
222 receive1 = ""; 220 receive1 = "";
223 } 221 }