Commit 286d7f2d60dd7fdde7222f9240dea5eb3d0870fb
1 parent
d51b917d
代码格式优化
Showing
47 changed files
with
284 additions
and
115 deletions
src/main/java/com/cnlive/shenhe/api/ChannelControllerApi.java
src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
| ... | ... | @@ -20,6 +20,9 @@ import org.springframework.web.bind.annotation.ResponseBody; |
| 20 | 20 | import java.util.Date; |
| 21 | 21 | import java.util.List; |
| 22 | 22 | |
| 23 | +/** | |
| 24 | + * @author Administrator | |
| 25 | + */ | |
| 23 | 26 | @Controller |
| 24 | 27 | @RequestMapping("/api/comments") |
| 25 | 28 | public class CommentsControllerApi { |
| ... | ... | @@ -30,9 +33,6 @@ public class CommentsControllerApi { |
| 30 | 33 | CommentsServiceImpl commentsService; |
| 31 | 34 | @Autowired |
| 32 | 35 | TopicServiceImpl topicService; |
| 33 | - | |
| 34 | -// @Value("${topic_comment_shareH5}") | |
| 35 | -// String topic_comment_shareH5; | |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @Auther: chenhao |
| ... | ... | @@ -44,8 +44,10 @@ public class CommentsControllerApi { |
| 44 | 44 | public ResponseBean impotComment(String param) { |
| 45 | 45 | logger.info("评论入库,param=====" + param); |
| 46 | 46 | JSONObject json = JSONObject.parseObject(param); |
| 47 | - String type=json.getString("type")==null?"else":json.getString("type");//评论类型,topic:话题 | |
| 48 | - Integer level=json.getInteger("level")==null?1:json.getInteger("level");//评论的级别 | |
| 47 | + //评论类型,topic:话题 | |
| 48 | + String type=json.getString("type")==null?"else":json.getString("type"); | |
| 49 | + //评论的级别 | |
| 50 | + Integer level=json.getInteger("level")==null?1:json.getInteger("level"); | |
| 49 | 51 | String programId=json.getString("programId"); |
| 50 | 52 | String originalUrl=json.getString("originalUrl"); |
| 51 | 53 | String commentTitle=json.getString("commentTitle"); | ... | ... |
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
| ... | ... | @@ -173,22 +173,27 @@ public class ContentControllerApi { |
| 173 | 173 | JSONObject json = JSONObject.parseObject(param); |
| 174 | 174 | //判断是否存在 |
| 175 | 175 | ShyContent shyContent = new ShyContent(); |
| 176 | - shyContent.setContent_id(json.getString("momentId"));//朋友圈id | |
| 177 | - shyContent.setContent_tag("moment");//朋友圈标签 | |
| 176 | + //朋友圈id | |
| 177 | + shyContent.setContent_id(json.getString("momentId")); | |
| 178 | + //朋友圈标签 | |
| 179 | + shyContent.setContent_tag("moment"); | |
| 178 | 180 | List<ShyContent> contentList = contentService.findshyContent(shyContent); |
| 179 | 181 | //获取审核类型 |
| 180 | 182 | Integer shenheType = contentService.getShenheType(json.getInteger("spId"), "moment"); |
| 181 | 183 | |
| 182 | 184 | //获取生活圈内容的类型 1:图片 2:视频 3:分享 |
| 183 | 185 | Integer contentType = json.getInteger("contentType"); |
| 184 | - String contentImageUrl = "";//内容图片地址 | |
| 186 | + //内容图片地址 | |
| 187 | + String contentImageUrl = ""; | |
| 185 | 188 | if (contentType != null && contentType == 1) { |
| 186 | - JSONArray contentImageUrlList = JSONObject.parseArray(json.getString("contentImageUrl"));//朋友圈分享的内容的url | |
| 189 | + //朋友圈分享的内容的url | |
| 190 | + JSONArray contentImageUrlList = JSONObject.parseArray(json.getString("contentImageUrl")); | |
| 187 | 191 | for (int i = 0; i < contentImageUrlList.size(); i++) { |
| 188 | 192 | JSONObject contentImageUrlMap = contentImageUrlList.getJSONObject(i); |
| 189 | 193 | contentImageUrl += contentImageUrlMap.getString("imageUrl") + ","; |
| 190 | 194 | } |
| 191 | - contentImageUrl = contentImageUrl.substring(0, contentImageUrl.length() - 1);//去掉最后一个逗号 | |
| 195 | + //去掉最后一个逗号 | |
| 196 | + contentImageUrl = contentImageUrl.substring(0, contentImageUrl.length() - 1); | |
| 192 | 197 | } else { |
| 193 | 198 | contentImageUrl = json.getString("contentImageUrl"); |
| 194 | 199 | } |
| ... | ... | @@ -196,12 +201,14 @@ public class ContentControllerApi { |
| 196 | 201 | //存在则更新 |
| 197 | 202 | if (contentList.size() > 0) { |
| 198 | 203 | ShyContent shyContent1 = contentList.get(0); |
| 199 | - shyContent1.setTitle(json.getString("title"));//标题 | |
| 200 | - shyContent1.setTitle_image(json.getString("image"));//用户头像 | |
| 204 | + //标题 | |
| 205 | + shyContent1.setTitle(json.getString("title")); | |
| 206 | + //用户头像 | |
| 207 | + shyContent1.setTitle_image(json.getString("image")); | |
| 201 | 208 | shyContent1.setShenhe_type(shenheType);//审核类型 |
| 202 | 209 | String contentTime = json.getString("createTime");//朋友圈内容创建时间 |
| 203 | 210 | if (CommonUtils.isNotEmpty(contentTime)) { |
| 204 | -// Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | |
| 211 | + //Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | |
| 205 | 212 | shyContent1.setContent_time(new Date(Long.valueOf(contentTime))); |
| 206 | 213 | |
| 207 | 214 | } | ... | ... |
src/main/java/com/cnlive/shenhe/api/LiveApplyControllerApi.java
| ... | ... | @@ -18,7 +18,10 @@ import java.util.Date; |
| 18 | 18 | import java.util.List; |
| 19 | 19 | |
| 20 | 20 | |
| 21 | -@SuppressWarnings("unused") | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * @author Administrator | |
| 24 | + */ | |
| 22 | 25 | @Controller |
| 23 | 26 | @RequestMapping("/api/liveApply") |
| 24 | 27 | public class LiveApplyControllerApi { |
| ... | ... | @@ -32,20 +35,24 @@ public class LiveApplyControllerApi { |
| 32 | 35 | public JSONObject impotVideo(String param) { |
| 33 | 36 | JSONObject map = new JSONObject(); |
| 34 | 37 | JSONObject result = new JSONObject(); |
| 35 | - boolean YorN =true;//初始化一个请求数据库返回结果 | |
| 36 | - | |
| 38 | + //初始化一个请求数据库返回结果 | |
| 39 | + boolean YorN =true; | |
| 40 | + | |
| 37 | 41 | logger.info("直播申请入库,param=====" + param); |
| 38 | 42 | JSONObject json = JSONObject.parseObject(param); |
| 39 | 43 | //获取所有参数 |
| 40 | - String activityId = json.getString("activityId");//直播活动id | |
| 41 | - String channelId = json.getString("channelId");//直播频道id | |
| 42 | - Integer spId=null; | |
| 44 | + //直播活动id | |
| 45 | + String activityId = json.getString("activityId"); | |
| 46 | + //直播频道id | |
| 47 | + String channelId = json.getString("channelId"); | |
| 48 | + Integer spId=null; | |
| 43 | 49 | try { |
| 44 | 50 | spId=json.getInteger("spId"); |
| 45 | 51 | } catch (Exception e) { |
| 46 | 52 | spId=null; |
| 47 | 53 | } |
| 48 | - String sender = json.getString("sender");//直播发起人 | |
| 54 | + //直播发起人 | |
| 55 | + String sender = json.getString("sender"); | |
| 49 | 56 | String mobile = json.getString("mobile");//联系方式 |
| 50 | 57 | String callback = json.getString("callback");//回调地址 |
| 51 | 58 | String organization = json.getString("organization");//直播发起单位 | ... | ... |
src/main/java/com/cnlive/shenhe/api/LiveControllerApi.java
| ... | ... | @@ -19,6 +19,9 @@ import java.util.List; |
| 19 | 19 | import java.util.UUID; |
| 20 | 20 | |
| 21 | 21 | |
| 22 | +/** | |
| 23 | + * @author Administrator | |
| 24 | + */ | |
| 22 | 25 | @SuppressWarnings("unused") |
| 23 | 26 | @Controller |
| 24 | 27 | @RequestMapping("/api/live") |
| ... | ... | @@ -33,12 +36,14 @@ public class LiveControllerApi { |
| 33 | 36 | public JSONObject impotVideo(String param) { |
| 34 | 37 | JSONObject map = new JSONObject(); |
| 35 | 38 | JSONObject result = new JSONObject(); |
| 36 | - boolean YorN =true;//初始化一个请求数据库返回结果 | |
| 37 | - | |
| 39 | + //初始化一个请求数据库返回结果 | |
| 40 | + boolean YorN =true; | |
| 41 | + | |
| 38 | 42 | logger.info("直播入库,param=====" + param); |
| 39 | 43 | JSONObject json = JSONObject.parseObject(param); |
| 40 | 44 | //获取所有参数 |
| 41 | - String activityId = json.getString("activityId");//直播活动id | |
| 45 | + //直播活动id | |
| 46 | + String activityId = json.getString("activityId"); | |
| 42 | 47 | String activityName = json.getString("activityName");//直播活动名称 |
| 43 | 48 | Integer activityStatus = Integer.parseInt(json.getString("activityStatus"));//直播活动状态 |
| 44 | 49 | String channelId = json.getString("channelId");//直播频道id |
| ... | ... | @@ -238,7 +243,7 @@ public class LiveControllerApi { |
| 238 | 243 | |
| 239 | 244 | /** |
| 240 | 245 | * 测试视频流 |
| 241 | - * @param videoStream | |
| 246 | + * @param | |
| 242 | 247 | */ |
| 243 | 248 | @RequestMapping(value="ceshiFinishVideo") |
| 244 | 249 | @ResponseBody |
| ... | ... | @@ -252,7 +257,7 @@ public class LiveControllerApi { |
| 252 | 257 | |
| 253 | 258 | /** |
| 254 | 259 | * 测试视频流 |
| 255 | - * @param videoStream | |
| 260 | + * @param | |
| 256 | 261 | */ |
| 257 | 262 | @RequestMapping(value="queryVideo") |
| 258 | 263 | @ResponseBody | ... | ... |
src/main/java/com/cnlive/shenhe/api/TopicControllerApi.java
src/main/java/com/cnlive/shenhe/bean/ErrorEnum.java
src/main/java/com/cnlive/shenhe/bean/ResponseBean.java
src/main/java/com/cnlive/shenhe/config/MyInterceptor.java
| ... | ... | @@ -11,6 +11,9 @@ import javax.servlet.http.HttpServletRequest; |
| 11 | 11 | import javax.servlet.http.HttpServletResponse; |
| 12 | 12 | import javax.servlet.http.HttpSession; |
| 13 | 13 | |
| 14 | +/** | |
| 15 | + * @author Administrator | |
| 16 | + */ | |
| 14 | 17 | @Component |
| 15 | 18 | public class MyInterceptor implements HandlerInterceptor { |
| 16 | 19 | @Override | ... | ... |
src/main/java/com/cnlive/shenhe/config/SessionFilter.java
| 1 | 1 | package com.cnlive.shenhe.config; |
| 2 | + | |
| 2 | 3 | import org.slf4j.LoggerFactory; |
| 3 | 4 | import org.springframework.web.context.request.RequestContextHolder; |
| 4 | 5 | import org.springframework.web.context.request.ServletRequestAttributes; |
| ... | ... | @@ -16,14 +17,15 @@ import java.util.regex.Matcher; |
| 16 | 17 | import java.util.regex.Pattern; |
| 17 | 18 | |
| 18 | 19 | /** |
| 19 | - * Created by liwei on 2018/08/28. | |
| 20 | - * | |
| 20 | + * @author liwei | |
| 21 | + * @date 2018/08/28 | |
| 22 | + * <p> | |
| 21 | 23 | * 过滤器 |
| 22 | 24 | */ |
| 23 | 25 | public class SessionFilter implements Filter { |
| 24 | 26 | private static final org.slf4j.Logger logger = LoggerFactory.getLogger(SessionFilter.class); |
| 25 | - HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); | |
| 26 | - HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse(); | |
| 27 | + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |
| 28 | + HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse(); | |
| 27 | 29 | /** |
| 28 | 30 | * 封装,不需要过滤的list列表 |
| 29 | 31 | */ |
| ... | ... | @@ -44,19 +46,19 @@ public class SessionFilter implements Filter { |
| 44 | 46 | url = url.substring(1); |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | - if (isInclude(url)){ | |
| 49 | + if (isInclude(url)) { | |
| 48 | 50 | chain.doFilter(httpRequest, httpResponse); |
| 49 | 51 | return; |
| 50 | 52 | } else { |
| 51 | 53 | HttpSession session = httpRequest.getSession(); |
| 52 | - if (session.getAttribute(SessionUser.getSessionKey()) != null){ | |
| 54 | + if (session.getAttribute(SessionUser.getSessionKey()) != null) { | |
| 53 | 55 | // session存在 |
| 54 | 56 | chain.doFilter(httpRequest, httpResponse); |
| 55 | 57 | return; |
| 56 | 58 | } else { |
| 57 | 59 | // session不存在 准备跳转失败 |
| 58 | - RequestDispatcher dispatcher = request.getRequestDispatcher("/users/login"); | |
| 59 | - dispatcher.forward(request, response); | |
| 60 | + RequestDispatcher dispatcher = request.getRequestDispatcher("/users/login"); | |
| 61 | + dispatcher.forward(request, response); | |
| 60 | 62 | // chain.doFilter(httpRequest, httpResponse); |
| 61 | 63 | return; |
| 62 | 64 | } |
| ... | ... | @@ -73,6 +75,7 @@ public class SessionFilter implements Filter { |
| 73 | 75 | |
| 74 | 76 | /** |
| 75 | 77 | * 是否需要过滤 |
| 78 | + * | |
| 76 | 79 | * @param url |
| 77 | 80 | * @return |
| 78 | 81 | */ | ... | ... |
src/main/java/com/cnlive/shenhe/config/WebConfiguration.java
src/main/java/com/cnlive/shenhe/controller/ChannelController.java
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
| ... | ... | @@ -324,7 +324,8 @@ public class CommentsController extends BaseController { |
| 324 | 324 | BufferedOutputStream bos = null; |
| 325 | 325 | try { |
| 326 | 326 | XSSFSheet sheetlist = wb.createSheet(fileName); |
| 327 | - XSSFRow row = sheetlist.createRow(0);//行 | |
| 327 | + //行 | |
| 328 | + XSSFRow row = sheetlist.createRow(0); | |
| 328 | 329 | XSSFCell cell = row.createCell(0);//列 |
| 329 | 330 | cell.setCellValue("id"); |
| 330 | 331 | cell = row.createCell(1);//列 | ... | ... |
src/main/java/com/cnlive/shenhe/controller/ContentController.java
src/main/java/com/cnlive/shenhe/controller/EmailController.java
src/main/java/com/cnlive/shenhe/controller/LiveApplyController.java
src/main/java/com/cnlive/shenhe/controller/LiveController.java
src/main/java/com/cnlive/shenhe/controller/NotSpeakController.java
src/main/java/com/cnlive/shenhe/controller/SitesController.java
src/main/java/com/cnlive/shenhe/controller/TopicController.java
src/main/java/com/cnlive/shenhe/controller/UsersFreeController.java
src/main/java/com/cnlive/shenhe/job/ChannelJob.java
| ... | ... | @@ -2,8 +2,6 @@ package com.cnlive.shenhe.job; |
| 2 | 2 | |
| 3 | 3 | import com.cnlive.shenhe.entity.ShyChannel; |
| 4 | 4 | import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl; |
| 5 | -import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | |
| 6 | -import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | |
| 7 | 5 | import com.cnlive.shenhe.utils.AuditPass; |
| 8 | 6 | import com.cnlive.shenhe.utils.CommonConst; |
| 9 | 7 | import com.cnlive.shenhe.utils.InfoUtil; |
| ... | ... | @@ -16,6 +14,9 @@ import org.springframework.stereotype.Component; |
| 16 | 14 | |
| 17 | 15 | import java.util.List; |
| 18 | 16 | |
| 17 | +/** | |
| 18 | + * @author Administrator | |
| 19 | + */ | |
| 19 | 20 | @Component |
| 20 | 21 | public class ChannelJob { |
| 21 | 22 | private static Logger logger = LoggerFactory.getLogger(ChannelJob.class); | ... | ... |
src/main/java/com/cnlive/shenhe/job/CommentsJob.java
| ... | ... | @@ -2,7 +2,6 @@ package com.cnlive.shenhe.job; |
| 2 | 2 | |
| 3 | 3 | import com.cnlive.shenhe.entity.ShyComments; |
| 4 | 4 | import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; |
| 5 | -import com.cnlive.shenhe.utils.AuditPass; | |
| 6 | 5 | import com.cnlive.shenhe.utils.CommonConst; |
| 7 | 6 | import org.slf4j.Logger; |
| 8 | 7 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -12,6 +11,9 @@ import org.springframework.stereotype.Component; |
| 12 | 11 | |
| 13 | 12 | import java.util.List; |
| 14 | 13 | |
| 14 | +/** | |
| 15 | + * @author Administrator | |
| 16 | + */ | |
| 15 | 17 | @Component |
| 16 | 18 | public class CommentsJob { |
| 17 | 19 | private static Logger logger = LoggerFactory.getLogger(CommentsJob.class); | ... | ... |
src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java
| ... | ... | @@ -8,8 +8,10 @@ import com.cnlive.shenhe.mapper.ShyLiveapplyMapper; |
| 8 | 8 | import com.cnlive.shenhe.serviceImpl.EmailServiceImpl; |
| 9 | 9 | import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl; |
| 10 | 10 | import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; |
| 11 | -import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | |
| 12 | -import com.cnlive.shenhe.utils.*; | |
| 11 | +import com.cnlive.shenhe.utils.CommonConst; | |
| 12 | +import com.cnlive.shenhe.utils.CommonUtils; | |
| 13 | +import com.cnlive.shenhe.utils.HttpUtil; | |
| 14 | +import com.cnlive.shenhe.utils.OpenUtil; | |
| 13 | 15 | import org.slf4j.Logger; |
| 14 | 16 | import org.slf4j.LoggerFactory; |
| 15 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -23,6 +25,9 @@ import java.util.HashMap; |
| 23 | 25 | import java.util.List; |
| 24 | 26 | import java.util.Map; |
| 25 | 27 | |
| 28 | +/** | |
| 29 | + * @author Administrator | |
| 30 | + */ | |
| 26 | 31 | @Component |
| 27 | 32 | public class LiveApplyJob { |
| 28 | 33 | private static Logger logger = LoggerFactory.getLogger(LiveApplyJob.class); | ... | ... |
src/main/java/com/cnlive/shenhe/job/NotSpeakJob.java
| 1 | 1 | package com.cnlive.shenhe.job; |
| 2 | 2 | |
| 3 | 3 | import com.cnlive.shenhe.entity.ShyNotspeak; |
| 4 | -import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; | |
| 5 | 4 | import com.cnlive.shenhe.serviceImpl.NotspeakServiceImpl; |
| 6 | -import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | |
| 7 | -import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | |
| 8 | -import com.cnlive.shenhe.utils.AuditPass; | |
| 9 | 5 | import com.cnlive.shenhe.utils.CommonConst; |
| 10 | 6 | import org.slf4j.Logger; |
| 11 | 7 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -15,6 +11,9 @@ import org.springframework.stereotype.Component; |
| 15 | 11 | |
| 16 | 12 | import java.util.List; |
| 17 | 13 | |
| 14 | +/** | |
| 15 | + * @author Administrator | |
| 16 | + */ | |
| 18 | 17 | @Component |
| 19 | 18 | public class NotSpeakJob { |
| 20 | 19 | private static Logger logger = LoggerFactory.getLogger(NotSpeakJob.class); | ... | ... |
src/main/java/com/cnlive/shenhe/job/UsersSiteJob.java
| ... | ... | @@ -19,12 +19,12 @@ import org.springframework.scheduling.annotation.Scheduled; |
| 19 | 19 | import org.springframework.stereotype.Component; |
| 20 | 20 | import tk.mybatis.mapper.entity.Example; |
| 21 | 21 | |
| 22 | -import java.util.Date; | |
| 23 | 22 | import java.util.HashMap; |
| 24 | 23 | import java.util.List; |
| 25 | 24 | import java.util.Map; |
| 26 | 25 | |
| 27 | 26 | /** |
| 27 | + * @author Administrator | |
| 28 | 28 | * @Auther: 周伟鹏 |
| 29 | 29 | * @Date: 2018/11/30 11:31 |
| 30 | 30 | * @Description:同步用户和站点信息 |
| ... | ... | @@ -55,11 +55,13 @@ public class UsersSiteJob { |
| 55 | 55 | List<ShyUsers> usersList = shyUsersMapper.selectByExample(usersExample); |
| 56 | 56 | if (!usersList.isEmpty()) { |
| 57 | 57 | Long tmStr = usersList.get(0).getTm(); |
| 58 | - if (CommonUtils.isNotNull(tmStr)) tm = tmStr + ""; | |
| 58 | + if (CommonUtils.isNotNull(tmStr)) { | |
| 59 | + tm = tmStr + ""; | |
| 60 | + } | |
| 59 | 61 | } |
| 60 | 62 | HashMap<String, String> dataMap = new HashMap<>(); |
| 61 | 63 | dataMap.put("tm", tm); |
| 62 | - dataMap.put("timestamp", new Date().getTime() / 1000 + ""); | |
| 64 | + dataMap.put("timestamp", System.currentTimeMillis() / 1000 + ""); | |
| 63 | 65 | String httpUrl = OpenUtil.buildURL(syncUserApi, dataMap, app_key); |
| 64 | 66 | logger.info("httpUrl===" + httpUrl); |
| 65 | 67 | Map<String, String> resultMap = HttpUtil.init().post(httpUrl); | ... | ... |
src/main/java/com/cnlive/shenhe/job/VideosJob.java
| 1 | 1 | package com.cnlive.shenhe.job; |
| 2 | 2 | |
| 3 | 3 | import com.cnlive.shenhe.entity.ShyVideos; |
| 4 | -import com.cnlive.shenhe.entity.ShyYidun; | |
| 5 | 4 | import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; |
| 6 | 5 | import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; |
| 7 | 6 | import com.cnlive.shenhe.utils.CommonConst; |
| ... | ... | @@ -13,6 +12,9 @@ import org.springframework.stereotype.Component; |
| 13 | 12 | |
| 14 | 13 | import java.util.List; |
| 15 | 14 | |
| 15 | +/** | |
| 16 | + * @author Administrator | |
| 17 | + */ | |
| 16 | 18 | @Component |
| 17 | 19 | public class VideosJob { |
| 18 | 20 | private static Logger logger = LoggerFactory.getLogger(VideosJob.class); | ... | ... |
src/main/java/com/cnlive/shenhe/jsoup/GetData.java
src/main/java/com/cnlive/shenhe/jsoup/newCrawl.java
src/main/java/com/cnlive/shenhe/serviceImpl/ChannelServiceImpl.java
| ... | ... | @@ -40,7 +40,6 @@ public class ChannelServiceImpl { |
| 40 | 40 | SitesServiceImpl sitesService; |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - //************************************** | |
| 44 | 43 | public List<ShyChannel> findshyChannel(ShyChannel shyChannel) { |
| 45 | 44 | return shyChannelMapper.selectByRowBounds(shyChannel, new RowBounds(0, 100)); |
| 46 | 45 | } | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
| ... | ... | @@ -78,6 +78,7 @@ public class CommentsServiceImpl { |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public PageInfo<ShyComments> getPage(CommentsDTO commentsDTO) { |
| 81 | + logger.info("接受参数对象为,CommentsDTO:{}",JSONObject.toJSON(commentsDTO)); | |
| 81 | 82 | Example example = new Example(ShyComments.class); |
| 82 | 83 | Example.Criteria criteria = example.createCriteria(); |
| 83 | 84 | if (CommonUtils.isNotEmpty(commentsDTO.getOrderByClause())) { |
| ... | ... | @@ -85,7 +86,7 @@ public class CommentsServiceImpl { |
| 85 | 86 | } else { |
| 86 | 87 | example.setOrderByClause("comment_time desc"); |
| 87 | 88 | } |
| 88 | - if (CommonUtils.isNotNull(commentsDTO.getStart_date()) && CommonUtils.isNotNull(commentsDTO.getEnd_date())) { | |
| 89 | + if (CommonUtils.isNotEmpty(commentsDTO.getStart_date()) && CommonUtils.isNotEmpty(commentsDTO.getEnd_date())) { | |
| 89 | 90 | criteria.andGreaterThanOrEqualTo("comment_time", commentsDTO.getStart_date()); |
| 90 | 91 | criteria.andLessThanOrEqualTo("comment_time", commentsDTO.getEnd_date()); |
| 91 | 92 | } |
| ... | ... | @@ -104,9 +105,9 @@ public class CommentsServiceImpl { |
| 104 | 105 | if (CommonUtils.isNotNull(commentsDTO.getComment_user_id())) { |
| 105 | 106 | criteria.andEqualTo("comment_user_id", commentsDTO.getComment_user_id()); |
| 106 | 107 | } |
| 107 | - if (CommonUtils.isNotNull(commentsDTO.getType()) && commentsDTO.getType() == "0") { | |
| 108 | + if (CommonUtils.isNotEmpty(commentsDTO.getType()) && commentsDTO.getType() == "0") { | |
| 108 | 109 | criteria.andEqualTo("type", CommonConst.CATEGORY_TOPIC); |
| 109 | - } else if (CommonUtils.isNotNull(commentsDTO.getType()) && commentsDTO.getType() == "1") { | |
| 110 | + } else if (CommonUtils.isNotEmpty(commentsDTO.getType()) && commentsDTO.getType() == "1") { | |
| 110 | 111 | criteria.andEqualTo("type", CommonConst.CATEGORY_ELSE); |
| 111 | 112 | } |
| 112 | 113 | if (CommonUtils.isNotEmpty(commentsDTO.getActivity_id())) { |
| ... | ... | @@ -119,14 +120,14 @@ public class CommentsServiceImpl { |
| 119 | 120 | } |
| 120 | 121 | } |
| 121 | 122 | |
| 122 | -// if (CommonUtils.isNotEmpty(states)) { | |
| 123 | -// Example.Criteria criteria1 = example.createCriteria(); | |
| 124 | -// String[] stas = states.split(","); | |
| 125 | -// for (String s : stas) { | |
| 126 | -// criteria1.orEqualTo("state", Integer.parseInt(s)); | |
| 127 | -// } | |
| 128 | -// example.and(criteria1); | |
| 129 | -// } | |
| 123 | + //if (CommonUtils.isNotNull(commentsDTO.getState())) { | |
| 124 | + // Example.Criteria criteria1 = example.createCriteria(); | |
| 125 | + // String[] stas = String.valueOf(commentsDTO.getState()).split(","); | |
| 126 | + // for (String s : stas) { | |
| 127 | + // criteria1.orEqualTo("state", s); | |
| 128 | + // } | |
| 129 | + // example.and(criteria1); | |
| 130 | + //} | |
| 130 | 131 | |
| 131 | 132 | if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() != 3) { |
| 132 | 133 | criteria.andEqualTo("state", commentsDTO.getState()); |
| ... | ... | @@ -167,9 +168,9 @@ public class CommentsServiceImpl { |
| 167 | 168 | if (CommonUtils.isNotNull(commentsDTO.getIs_hot())) { |
| 168 | 169 | criteria.andEqualTo("is_hot", commentsDTO.getIs_hot()); |
| 169 | 170 | } |
| 170 | - if (CommonUtils.isNotEmpty(commentsDTO.getType()) && commentsDTO.getType()=="0") { | |
| 171 | + if (CommonUtils.isNotEmpty(commentsDTO.getType()) && commentsDTO.getType() == "0") { | |
| 171 | 172 | criteria.andEqualTo("type", CommonConst.CATEGORY_TOPIC); |
| 172 | - } else if (CommonUtils.isNotEmpty(commentsDTO.getType()) && commentsDTO.getType()=="1") { | |
| 173 | + } else if (CommonUtils.isNotEmpty(commentsDTO.getType()) && commentsDTO.getType() == "1") { | |
| 173 | 174 | criteria.andIsNull("type"); |
| 174 | 175 | } |
| 175 | 176 | if (CommonUtils.isNotEmpty(commentsDTO.getActivity_id())) { |
| ... | ... | @@ -182,14 +183,14 @@ public class CommentsServiceImpl { |
| 182 | 183 | } |
| 183 | 184 | } |
| 184 | 185 | |
| 185 | - //if (CommonUtils.isNotEmpty(String.valueOf(commentsDTO.getState()))) { | |
| 186 | - // Example.Criteria criteria1 = example.createCriteria(); | |
| 187 | - // String[] stas = String.valueOf(commentsDTO.getState()).split(","); | |
| 188 | - // for (String s : stas) { | |
| 189 | - // criteria1.orEqualTo("state", Integer.parseInt(s)); | |
| 190 | - // } | |
| 191 | - // example.and(criteria1); | |
| 192 | - //} | |
| 186 | + if (CommonUtils.isNotEmpty(String.valueOf(commentsDTO.getState()))) { | |
| 187 | + Example.Criteria criteria1 = example.createCriteria(); | |
| 188 | + String[] stas = String.valueOf(commentsDTO.getState()).split(","); | |
| 189 | + for (String s : stas) { | |
| 190 | + criteria1.orEqualTo("state", Integer.parseInt(s)); | |
| 191 | + } | |
| 192 | + example.and(criteria1); | |
| 193 | + } | |
| 193 | 194 | |
| 194 | 195 | if (CommonUtils.isNotNull(commentsDTO.getState()) && commentsDTO.getState() != 3) { |
| 195 | 196 | criteria.andEqualTo("state", commentsDTO.getState()); | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
| ... | ... | @@ -264,7 +264,8 @@ public class ContentServiceImpl { |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - content.setContent_status(state);// 设置图文状态为审核后的状态 | |
| 267 | + // 设置图文状态为审核后的状态 | |
| 268 | + content.setContent_status(state); | |
| 268 | 269 | content.setReceive_status(CommonConst.RECEIVE_AUDIT);// 领取状态为已审核 |
| 269 | 270 | content.setShenhe_msg(msg);// 设置审核消息 |
| 270 | 271 | if (CommonUtils.isNotEmpty(userId)) { |
| ... | ... | @@ -283,7 +284,6 @@ public class ContentServiceImpl { |
| 283 | 284 | return success; |
| 284 | 285 | } |
| 285 | 286 | |
| 286 | - //********************************** | |
| 287 | 287 | public Integer receive(String ids, Integer num, String userId, Integer spid) { |
| 288 | 288 | Integer n = 0; |
| 289 | 289 | if (CommonUtils.isNotEmpty(ids)) { |
| ... | ... | @@ -320,7 +320,6 @@ public class ContentServiceImpl { |
| 320 | 320 | return n; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - //*************************************** | |
| 324 | 323 | public Integer retReceive(String ids, String userId) { |
| 325 | 324 | Integer n = 0; |
| 326 | 325 | String[] cids = ids.split(","); |
| ... | ... | @@ -339,7 +338,7 @@ public class ContentServiceImpl { |
| 339 | 338 | return n; |
| 340 | 339 | } |
| 341 | 340 | |
| 342 | - //************************************** | |
| 341 | + | |
| 343 | 342 | public ShyContent selectByPrimaryKey(Integer id) { |
| 344 | 343 | ShyContent shyContent = shyContentMapper.selectByPrimaryKey(id); |
| 345 | 344 | return shyContent; | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/EmailServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.alibaba.fastjson.JSON; | |
| 4 | 5 | import com.cnlive.shenhe.dto.EmailDTO; |
| 5 | 6 | import com.cnlive.shenhe.entity.ShyEmail; |
| 6 | 7 | import com.cnlive.shenhe.mapper.ShyEmailMapper; |
| ... | ... | @@ -29,6 +30,7 @@ public class EmailServiceImpl { |
| 29 | 30 | ShyEmailMapper shyEmailMapper; |
| 30 | 31 | |
| 31 | 32 | public PageInfo<ShyEmail> getPage(EmailDTO emailDTO) { |
| 33 | + logger.info("接受参数列表为:{}", JSON.toJSONString(emailDTO)); | |
| 32 | 34 | Example example = new Example(ShyEmail.class); |
| 33 | 35 | Example.Criteria criteria = example.createCriteria(); |
| 34 | 36 | if (CommonUtils.isNotEmpty(emailDTO.getOrderByClause())) { | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/LiveApplyServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.alibaba.fastjson.JSON; | |
| 4 | 5 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | 6 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | 7 | import com.cnlive.shenhe.dto.LiveApplyDTO; |
| ... | ... | @@ -93,6 +94,7 @@ public class LiveApplyServiceImpl { |
| 93 | 94 | |
| 94 | 95 | //=============== |
| 95 | 96 | public PageInfo<ShyLiveapply> getListLiveApply(LiveApplyDTO liveApplyDTO) { |
| 97 | + logger.info("接参数列表为,LiveApplyDTO:{}", JSON.toJSONString(liveApplyDTO)); | |
| 96 | 98 | Example example = new Example(ShyLiveapply.class); |
| 97 | 99 | Example.Criteria criteria = example.createCriteria(); |
| 98 | 100 | if (CommonUtils.isNotEmpty(liveApplyDTO.getOrderByClause())) { | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/LiveServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 4 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 5 | 6 | import com.cnlive.shenhe.dto.LiveDTO; |
| ... | ... | @@ -80,6 +81,7 @@ public class LiveServiceImpl { |
| 80 | 81 | |
| 81 | 82 | //=============== |
| 82 | 83 | public PageInfo<ShyLive> getListContent(LiveDTO liveDTO) { |
| 84 | + logger.info("接受参数对象,LiveDTO:{}", JSON.toJSONString(liveDTO)); | |
| 83 | 85 | Example example = new Example(ShyLive.class); |
| 84 | 86 | Example.Criteria criteria = example.createCriteria(); |
| 85 | 87 | if (CommonUtils.isNotEmpty(liveDTO.getOrderByClause())) { | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/NotspeakServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.alibaba.fastjson.JSON; | |
| 4 | 5 | import com.alibaba.fastjson.JSONObject; |
| 5 | 6 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | 7 | import com.cnlive.shenhe.dto.NotSpeakDTO; |
| ... | ... | @@ -251,6 +252,7 @@ public class NotspeakServiceImpl { |
| 251 | 252 | } |
| 252 | 253 | |
| 253 | 254 | public PageInfo<ShyNotspeak> getPage(NotSpeakDTO notSpeakDTO) { |
| 255 | + logger.info("接受参数对象为,NotSpeakDTO:{}", JSON.toJSONString(notSpeakDTO)); | |
| 254 | 256 | Example example = new Example(ShyNotspeak.class); |
| 255 | 257 | Example.Criteria criteria = example.createCriteria(); |
| 256 | 258 | if (CommonUtils.isNotEmpty(notSpeakDTO.getOrderByClause())) { | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/ShyActivityImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.alibaba.fastjson.JSON; | |
| 4 | 5 | import com.cnlive.shenhe.dto.ShyActivityDTO; |
| 5 | 6 | import com.cnlive.shenhe.entity.ShyActivity; |
| 6 | 7 | import com.cnlive.shenhe.mapper.ShyActivityMapper; |
| 7 | 8 | import com.cnlive.shenhe.utils.CommonUtils; |
| 8 | 9 | import com.github.pagehelper.PageHelper; |
| 9 | 10 | import com.github.pagehelper.PageInfo; |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 10 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 14 | import org.springframework.stereotype.Service; |
| 12 | 15 | import tk.mybatis.mapper.entity.Example; |
| ... | ... | @@ -22,6 +25,8 @@ import java.util.List; |
| 22 | 25 | @Service |
| 23 | 26 | public class ShyActivityImpl { |
| 24 | 27 | |
| 28 | + private static Logger logger = LoggerFactory.getLogger(ShyActivityImpl.class); | |
| 29 | + | |
| 25 | 30 | @Autowired |
| 26 | 31 | private ShyActivityMapper ShyActivityMapper; |
| 27 | 32 | |
| ... | ... | @@ -73,6 +78,7 @@ public class ShyActivityImpl { |
| 73 | 78 | * @return |
| 74 | 79 | */ |
| 75 | 80 | public PageInfo<ShyActivity> selectByExample(ShyActivityDTO shyActivityDTO) { |
| 81 | + logger.info("参数接受对象为,ShyActivityDTO:{}", JSON.toJSONString(shyActivityDTO)); | |
| 76 | 82 | Example example = new Example(ShyActivity.class); |
| 77 | 83 | //如果为空 按照倒序排序 分页查询所有 |
| 78 | 84 | //以创建时间为条件进行倒序 | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/SitesServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.cnlive.shenhe.dto.SitesDTO; |
| 4 | 5 | import com.cnlive.shenhe.entity.ShySites; |
| 5 | 6 | import com.cnlive.shenhe.entity.ShyUsers; |
| ... | ... | @@ -7,6 +8,8 @@ import com.cnlive.shenhe.mapper.ShySitesMapper; |
| 7 | 8 | import com.cnlive.shenhe.utils.CommonUtils; |
| 8 | 9 | import com.github.pagehelper.PageHelper; |
| 9 | 10 | import com.github.pagehelper.PageInfo; |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 10 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 14 | import org.springframework.stereotype.Service; |
| 12 | 15 | import tk.mybatis.mapper.entity.Example; |
| ... | ... | @@ -15,6 +18,7 @@ import java.util.ArrayList; |
| 15 | 18 | import java.util.Arrays; |
| 16 | 19 | import java.util.List; |
| 17 | 20 | |
| 21 | + | |
| 18 | 22 | /** |
| 19 | 23 | * @Auther: 周伟鹏 |
| 20 | 24 | * @Date: 2018/11/29 14:23 |
| ... | ... | @@ -22,12 +26,14 @@ import java.util.List; |
| 22 | 26 | */ |
| 23 | 27 | @Service |
| 24 | 28 | public class SitesServiceImpl { |
| 29 | + private static Logger logger = LoggerFactory.getLogger(SitesServiceImpl.class); | |
| 25 | 30 | @Autowired |
| 26 | 31 | ShySitesMapper shySitesMapper; |
| 27 | 32 | @Autowired |
| 28 | 33 | UsersServiceImpl usersService; |
| 29 | 34 | |
| 30 | 35 | public PageInfo<ShySites> getPage(SitesDTO sitesDTO) { |
| 36 | + logger.info("接受参数列表为,SitesDTO:{}", JSON.toJSONString(sitesDTO)); | |
| 31 | 37 | Example example = new Example(ShySites.class); |
| 32 | 38 | Example.Criteria criteria = example.createCriteria(); |
| 33 | 39 | Example.Criteria criteria2 = example.createCriteria(); | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/TopicServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | 5 | import com.cnlive.shenhe.dto.TopicDTO; |
| 5 | 6 | import com.cnlive.shenhe.entity.ShyComments; |
| ... | ... | @@ -94,6 +95,7 @@ public class TopicServiceImpl { |
| 94 | 95 | } |
| 95 | 96 | |
| 96 | 97 | public PageInfo<ShyTopic> getPage(TopicDTO topicDTO) { |
| 98 | + logger.info("接受参数列表为,TopicDTO:{}", JSON.toJSONString(topicDTO)); | |
| 97 | 99 | Example example = new Example(ShyTopic.class); |
| 98 | 100 | Example.Criteria criteria = example.createCriteria(); |
| 99 | 101 | if (CommonUtils.isNotEmpty(topicDTO.getOrderByClause())) { | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/UsersServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.cnlive.shenhe.dto.UsersDTO; |
| 4 | 5 | import com.cnlive.shenhe.entity.ShyUsers; |
| 5 | 6 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 6 | 7 | import com.cnlive.shenhe.utils.CommonUtils; |
| 7 | 8 | import com.github.pagehelper.PageHelper; |
| 8 | 9 | import com.github.pagehelper.PageInfo; |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 9 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 13 | import org.springframework.stereotype.Service; |
| 11 | 14 | import tk.mybatis.mapper.entity.Example; |
| ... | ... | @@ -19,10 +22,12 @@ import java.util.List; |
| 19 | 22 | */ |
| 20 | 23 | @Service |
| 21 | 24 | public class UsersServiceImpl { |
| 25 | + private static Logger logger = LoggerFactory.getLogger(UsersServiceImpl.class); | |
| 22 | 26 | @Autowired |
| 23 | 27 | ShyUsersMapper shyUsersMapper; |
| 24 | 28 | |
| 25 | 29 | public PageInfo<ShyUsers> getPage(UsersDTO usersDTO) { |
| 30 | + logger.info("接受参数列表为,UsersDTO:{}", JSON.toJSONString(usersDTO)); | |
| 26 | 31 | Example example = new Example(ShyUsers.class); |
| 27 | 32 | Example.Criteria criteria = example.createCriteria(); |
| 28 | 33 | if (CommonUtils.isNotEmpty(usersDTO.getOrderByClause())) { | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/UsersfreeServiceImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 3 | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | 5 | import com.cnlive.shenhe.dto.UsersFreeDTO; |
| 5 | 6 | import com.cnlive.shenhe.entity.ShyUsers; |
| ... | ... | @@ -45,6 +46,7 @@ public class UsersfreeServiceImpl { |
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | public PageInfo<ShyUsersfree> getpage(UsersFreeDTO usersFreeDTO) { |
| 49 | + logger.info("接受参数列表为,UsersFreeDTO:{}", JSON.toJSONString(usersFreeDTO)); | |
| 48 | 50 | Example example = new Example(ShyUsers.class); |
| 49 | 51 | Example.Criteria criteria = example.createCriteria(); |
| 50 | 52 | if (CommonUtils.isNotEmpty(usersFreeDTO.getOrderByClause())) { | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| ... | ... | @@ -38,7 +38,8 @@ import java.util.UUID; |
| 38 | 38 | */ |
| 39 | 39 | @Service |
| 40 | 40 | public class VideosServiceImpl { |
| 41 | - private static Logger logger = LoggerFactory.getLogger(VideosServiceImpl.class); | |
| 41 | + | |
| 42 | + private static Logger logger = LoggerFactory.getLogger(VideofilterServiceImpl.class); | |
| 42 | 43 | @Autowired |
| 43 | 44 | ShyVideosMapper shyVideosMapper; |
| 44 | 45 | @Autowired |
| ... | ... | @@ -112,6 +113,7 @@ public class VideosServiceImpl { |
| 112 | 113 | } |
| 113 | 114 | |
| 114 | 115 | public PageInfo<ShyVideos> getListContent(VideosDTO videosDTO) { |
| 116 | + logger.info("接受桉树列表为,VideosDTO:{}",JSON.toJSONString(videosDTO)); | |
| 115 | 117 | Example example = new Example(ShyVideos.class); |
| 116 | 118 | Example.Criteria criteria = example.createCriteria(); |
| 117 | 119 | Example.Criteria criteria2 = example.createCriteria(); | ... | ... |
src/main/java/com/cnlive/shenhe/utils/CommonUtils.java
| ... | ... | @@ -21,8 +21,11 @@ import java.text.ParseException; |
| 21 | 21 | import java.text.SimpleDateFormat; |
| 22 | 22 | import java.util.*; |
| 23 | 23 | |
| 24 | +/** | |
| 25 | + * @author Administrator | |
| 26 | + */ | |
| 24 | 27 | public class CommonUtils { |
| 25 | - private static char md5Chars[] = { | |
| 28 | + private static char[] md5Chars = { | |
| 26 | 29 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
| 27 | 30 | 'a', 'b', 'c', 'd', 'e', 'f' |
| 28 | 31 | }; | ... | ... |
src/main/java/com/cnlive/shenhe/utils/HttpClientUtils.java
| ... | ... | @@ -24,6 +24,9 @@ import java.util.ArrayList; |
| 24 | 24 | import java.util.List; |
| 25 | 25 | import java.util.Map; |
| 26 | 26 | |
| 27 | +/** | |
| 28 | + * @author Administrator | |
| 29 | + */ | |
| 27 | 30 | public class HttpClientUtils { |
| 28 | 31 | public static String post(String url, Map<String, Object> map) { |
| 29 | 32 | // 创建post请求 |
| ... | ... | @@ -42,9 +45,12 @@ public class HttpClientUtils { |
| 42 | 45 | HttpEntity postEntity = new UrlEncodedFormEntity(param, "utf-8"); |
| 43 | 46 | // 把请求实体放到post请求中 |
| 44 | 47 | post.setEntity(postEntity); |
| 45 | - HttpResponse response = client.execute(post); // 执行post请求 | |
| 46 | - HttpEntity entity = response.getEntity();// 从响应中取得一个响应实体 | |
| 47 | - text = EntityUtils.toString(entity);// 把响应实体转成文本信息 | |
| 48 | + // 执行post请求 | |
| 49 | + HttpResponse response = client.execute(post); | |
| 50 | + // 从响应中取得一个响应实体 | |
| 51 | + HttpEntity entity = response.getEntity(); | |
| 52 | + // 把响应实体转成文本信息 | |
| 53 | + text = EntityUtils.toString(entity); | |
| 48 | 54 | } catch (Exception e) { |
| 49 | 55 | e.printStackTrace(); |
| 50 | 56 | } finally { |
| ... | ... | @@ -57,11 +63,15 @@ public class HttpClientUtils { |
| 57 | 63 | String text = "请求失败"; |
| 58 | 64 | HttpGet httpGet = null; |
| 59 | 65 | try { |
| 60 | - HttpClient client = HttpClients.createDefault();// 创建http访问的客户端 | |
| 66 | + // 创建http访问的客户端 | |
| 67 | + HttpClient client = HttpClients.createDefault(); | |
| 61 | 68 | httpGet = new HttpGet(url); |
| 62 | - HttpResponse response = client.execute(httpGet); // 执行get请求 | |
| 63 | - HttpEntity entity = response.getEntity();// 从响应中取得一个响应实体 | |
| 64 | - text = EntityUtils.toString(entity);// 把响应实体转成文本信息 | |
| 69 | + // 执行get请求 | |
| 70 | + HttpResponse response = client.execute(httpGet); | |
| 71 | + // 从响应中取得一个响应实体 | |
| 72 | + HttpEntity entity = response.getEntity(); | |
| 73 | + // 把响应实体转成文本信息 | |
| 74 | + text = EntityUtils.toString(entity); | |
| 65 | 75 | } catch (Exception e) { |
| 66 | 76 | e.printStackTrace(); |
| 67 | 77 | } finally { |
| ... | ... | @@ -74,7 +84,8 @@ public class HttpClientUtils { |
| 74 | 84 | String text = "请求失败"; |
| 75 | 85 | HttpGet httpGet = null; |
| 76 | 86 | try { |
| 77 | - HttpClient client = HttpClients.createDefault();// 创建http访问的客户端 | |
| 87 | + // 创建http访问的客户端 | |
| 88 | + HttpClient client = HttpClients.createDefault(); | |
| 78 | 89 | List<NameValuePair> params = new ArrayList<NameValuePair>(); |
| 79 | 90 | if (map != null && map.size() > 0) { |
| 80 | 91 | for (Map.Entry<String, String> entry : map.entrySet()) { |
| ... | ... | @@ -83,9 +94,12 @@ public class HttpClientUtils { |
| 83 | 94 | } |
| 84 | 95 | String paramsStr = EntityUtils.toString(new UrlEncodedFormEntity(params, "UTF-8")); |
| 85 | 96 | httpGet = new HttpGet(url + "?" + paramsStr); |
| 86 | - HttpResponse response = client.execute(httpGet); // 执行get请求 | |
| 87 | - HttpEntity entity = response.getEntity();// 从响应中取得一个响应实体 | |
| 88 | - text = EntityUtils.toString(entity);// 把响应实体转成文本信息 | |
| 97 | + // 执行get请求 | |
| 98 | + HttpResponse response = client.execute(httpGet); | |
| 99 | + // 从响应中取得一个响应实体 | |
| 100 | + HttpEntity entity = response.getEntity(); | |
| 101 | + // 把响应实体转成文本信息 | |
| 102 | + text = EntityUtils.toString(entity); | |
| 89 | 103 | } catch (Exception e) { |
| 90 | 104 | e.printStackTrace(); |
| 91 | 105 | } finally { |
| ... | ... | @@ -98,23 +112,31 @@ public class HttpClientUtils { |
| 98 | 112 | HttpPost post = null; |
| 99 | 113 | String text = "请求失败"; |
| 100 | 114 | try { |
| 101 | - HttpClient client = HttpClients.createDefault();// 创建http访问的客户端 | |
| 115 | + // 创建http访问的客户端 | |
| 116 | + HttpClient client = HttpClients.createDefault(); | |
| 102 | 117 | List<NameValuePair> param = new ArrayList<>(); |
| 103 | 118 | if (map != null && map.size() > 0) { |
| 104 | 119 | for (Map.Entry<String, String> entry : map.entrySet()) { |
| 105 | 120 | param.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); |
| 106 | 121 | } |
| 107 | 122 | } |
| 108 | - HttpEntity postEntity = new UrlEncodedFormEntity(param, "utf-8");// 用参数构造请求实体 | |
| 109 | - post = new HttpPost(url);// 创建post请求 | |
| 110 | - post.setEntity(postEntity);// 把请求实体放到post请求中 | |
| 111 | - HttpResponse response = client.execute(post); // 执行post请求 | |
| 112 | - HttpEntity entity = response.getEntity();// 从响应中取得一个响应实体 | |
| 113 | - text = EntityUtils.toString(entity);// 把响应实体转成文本信息 | |
| 123 | + // 用参数构造请求实体 | |
| 124 | + HttpEntity postEntity = new UrlEncodedFormEntity(param, "utf-8"); | |
| 125 | + // 创建post请求 | |
| 126 | + post = new HttpPost(url); | |
| 127 | + // 把请求实体放到post请求中 | |
| 128 | + post.setEntity(postEntity); | |
| 129 | + // 执行post请求 | |
| 130 | + HttpResponse response = client.execute(post); | |
| 131 | + // 从响应中取得一个响应实体 | |
| 132 | + HttpEntity entity = response.getEntity(); | |
| 133 | + // 把响应实体转成文本信息 | |
| 134 | + text = EntityUtils.toString(entity); | |
| 114 | 135 | } catch (Exception e) { |
| 115 | 136 | e.printStackTrace(); |
| 116 | 137 | } finally { |
| 117 | - post.releaseConnection();// 释放连接 | |
| 138 | + // 释放连接 | |
| 139 | + post.releaseConnection(); | |
| 118 | 140 | } |
| 119 | 141 | return text; |
| 120 | 142 | } | ... | ... |
src/main/java/com/cnlive/shenhe/utils/HttpUtil.java
| ... | ... | @@ -53,14 +53,35 @@ public class HttpUtil { |
| 53 | 53 | |
| 54 | 54 | private Logger logger = LoggerFactory.getLogger(HttpUtil.class); |
| 55 | 55 | |
| 56 | - private static PoolingHttpClientConnectionManager pcm;//httpclient连接池 | |
| 57 | - private CloseableHttpClient httpClient = null; //http连接 | |
| 58 | - private int connectTimeout = 120000;//连接超时时间 | |
| 59 | - private int connectionRequestTimeout = 10000;//从连接池获取连接超时时间 | |
| 60 | - private int socketTimeout = 300000;//获取数据超时时间 | |
| 56 | + /** | |
| 57 | + * httpclient连接池 | |
| 58 | + */ | |
| 59 | + private static PoolingHttpClientConnectionManager pcm; | |
| 60 | + /** | |
| 61 | + * http连接 | |
| 62 | + */ | |
| 63 | + private CloseableHttpClient httpClient = null; | |
| 64 | + /** | |
| 65 | + * 连接超时时间 | |
| 66 | + */ | |
| 67 | + private int connectTimeout = 120000; | |
| 68 | + /** | |
| 69 | + * 从连接池获取连接超时时间 | |
| 70 | + */ | |
| 71 | + private int connectionRequestTimeout = 10000; | |
| 72 | + /** | |
| 73 | + * 获取数据超时时间 | |
| 74 | + */ | |
| 75 | + private int socketTimeout = 300000; | |
| 61 | 76 | private String charset = "utf-8"; |
| 62 | - private RequestConfig requestConfig = null;//请求配置 | |
| 63 | - private Builder requestConfigBuilder = null;//build requestConfig | |
| 77 | + /** | |
| 78 | + * 请求配置 | |
| 79 | + */ | |
| 80 | + private RequestConfig requestConfig = null; | |
| 81 | + /** | |
| 82 | + * build requestConfig | |
| 83 | + */ | |
| 84 | + private Builder requestConfigBuilder = null; | |
| 64 | 85 | |
| 65 | 86 | private List<NameValuePair> nvps = new ArrayList<>(); |
| 66 | 87 | private List<Header> headers = new ArrayList<>(); |
| ... | ... | @@ -298,7 +319,8 @@ public class HttpUtil { |
| 298 | 319 | if (entity != null) { |
| 299 | 320 | try { |
| 300 | 321 | result = EntityUtils.toString(entity, charset); |
| 301 | - EntityUtils.consume(entity);//释放连接 | |
| 322 | + //释放连接 | |
| 323 | + EntityUtils.consume(entity); | |
| 302 | 324 | } catch (Exception e) { |
| 303 | 325 | logger.error("获取http请求返回值解析失败", e); |
| 304 | 326 | request.abort(); |
| ... | ... | @@ -403,6 +425,7 @@ public class HttpUtil { |
| 403 | 425 | |
| 404 | 426 | /** |
| 405 | 427 | * from请求 |
| 428 | + * | |
| 406 | 429 | * @param url |
| 407 | 430 | * @param params |
| 408 | 431 | * @return |
| ... | ... | @@ -475,13 +498,13 @@ public class HttpUtil { |
| 475 | 498 | |
| 476 | 499 | |
| 477 | 500 | JSONObject params = new JSONObject(); |
| 478 | - params.put("video_id","60_8be004799c424688949704814ea0d16d"); | |
| 479 | - params.put("state",3+""); | |
| 480 | - params.put("attr_tags",""); | |
| 481 | - params.put("msg",""); | |
| 501 | + params.put("video_id", "60_8be004799c424688949704814ea0d16d"); | |
| 502 | + params.put("state", 3 + ""); | |
| 503 | + params.put("attr_tags", ""); | |
| 504 | + params.put("msg", ""); | |
| 482 | 505 | HttpUtil httpUtil = HttpUtil.init(); |
| 483 | - httpUtil.setParam("param",params.toJSONString()); | |
| 484 | - String URL ="http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify?platform=AUDIT&token=2718c88930175686e40398994cead75c"; | |
| 506 | + httpUtil.setParam("param", params.toJSONString()); | |
| 507 | + String URL = "http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify?platform=AUDIT&token=2718c88930175686e40398994cead75c"; | |
| 485 | 508 | Map<String, String> post = httpUtil.post(URL); |
| 486 | 509 | System.out.println(post.get("result")); |
| 487 | 510 | } | ... | ... |
src/main/java/com/cnlive/shenhe/utils/OpenUtil.java
| 1 | 1 | package com.cnlive.shenhe.utils; |
| 2 | 2 | |
| 3 | 3 | import javax.servlet.ServletRequest; |
| 4 | - | |
| 5 | -import com.alibaba.fastjson.JSONObject; | |
| 6 | - | |
| 7 | 4 | import java.io.UnsupportedEncodingException; |
| 8 | 5 | import java.net.URLDecoder; |
| 9 | 6 | import java.net.URLEncoder; |
| 10 | 7 | import java.util.*; |
| 11 | 8 | |
| 9 | +/** | |
| 10 | + * @author Administrator | |
| 11 | + */ | |
| 12 | 12 | public class OpenUtil { |
| 13 | 13 | |
| 14 | 14 | ... | ... |
src/main/java/com/cnlive/shenhe/utils/TransitServiceUtils.java
| ... | ... | @@ -6,13 +6,22 @@ import org.springframework.amqp.core.AmqpTemplate; |
| 6 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 | |
| 9 | +/** | |
| 10 | + * @author Administrator | |
| 11 | + */ | |
| 9 | 12 | @Component |
| 10 | 13 | public class TransitServiceUtils { |
| 11 | 14 | |
| 12 | 15 | @Autowired |
| 13 | - private AmqpTemplate rabbitTemplate; | |
| 14 | - private String exchange = "transitService";//交换机 | |
| 15 | - private String routingKey = "audit";//路由 | |
| 16 | + private AmqpTemplate rabbitTemplate; | |
| 17 | + /**交换机 | |
| 18 | + * | |
| 19 | + */ | |
| 20 | + private String exchange = "transitService"; | |
| 21 | + /**路由 | |
| 22 | + * | |
| 23 | + */ | |
| 24 | + private String routingKey = "audit"; | |
| 16 | 25 | |
| 17 | 26 | /** |
| 18 | 27 | * MQ 生产者工具类 |
| ... | ... | @@ -27,7 +36,7 @@ public class TransitServiceUtils { |
| 27 | 36 | try{ |
| 28 | 37 | JSONObject json = new JSONObject(); |
| 29 | 38 | json.put("callerId", "audit"); |
| 30 | - json.put("calleeId", calleeId);// | |
| 39 | + json.put("calleeId", calleeId); | |
| 31 | 40 | json.put("cmdId", cmdId); |
| 32 | 41 | if (isCallback) { |
| 33 | 42 | json.put("isCallback", "0"); | ... | ... |