Commit d5af56bcbfabb040536f72fb85230bed3e497fb3

Authored by 陈浩
1 parent d48a002e

整理代码格式

src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Controller; @@ -16,6 +16,7 @@ import org.springframework.stereotype.Controller;
16 import org.springframework.web.bind.annotation.PostMapping; 16 import org.springframework.web.bind.annotation.PostMapping;
17 import org.springframework.web.bind.annotation.RequestMapping; 17 import org.springframework.web.bind.annotation.RequestMapping;
18 import org.springframework.web.bind.annotation.ResponseBody; 18 import org.springframework.web.bind.annotation.ResponseBody;
  19 +
19 import java.util.Date; 20 import java.util.Date;
20 import java.util.List; 21 import java.util.List;
21 22
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
@@ -36,7 +36,7 @@ public class VideosControllerApi { @@ -36,7 +36,7 @@ public class VideosControllerApi {
36 VideosServiceImpl videosService; 36 VideosServiceImpl videosService;
37 @Autowired 37 @Autowired
38 UsersServiceImpl usersService; 38 UsersServiceImpl usersService;
39 - //先统一入库,入库时查询是否已有,有,更新 无,插入 白名单单独定时任务 39 +
40 @PostMapping("/import") 40 @PostMapping("/import")
41 @ResponseBody 41 @ResponseBody
42 public ResponseBean impotVideo(String param) { 42 public ResponseBean impotVideo(String param) {
@@ -48,7 +48,7 @@ public class VideosControllerApi { @@ -48,7 +48,7 @@ public class VideosControllerApi {
48 shyVideos1.setVideo_id(videoId); 48 shyVideos1.setVideo_id(videoId);
49 //查询一下 存在,更新 没有,插入 49 //查询一下 存在,更新 没有,插入
50 List<ShyVideos> listshyVideos = videosService.findshyVideo(shyVideos1); 50 List<ShyVideos> listshyVideos = videosService.findshyVideo(shyVideos1);
51 - if(listshyVideos.size()>0){ 51 + if (listshyVideos.size() > 0) {
52 ShyVideos shyVideos = listshyVideos.get(0); 52 ShyVideos shyVideos = listshyVideos.get(0);
53 //封装数据入库 53 //封装数据入库
54 shyVideos.setVideo_id(videoId); 54 shyVideos.setVideo_id(videoId);
@@ -69,9 +69,9 @@ public class VideosControllerApi { @@ -69,9 +69,9 @@ public class VideosControllerApi {
69 shyVideos.setSpid(Integer.parseInt(json.getString("spId"))); 69 shyVideos.setSpid(Integer.parseInt(json.getString("spId")));
70 shyVideos.setState(CommonConst.AUDIT_INTT); 70 shyVideos.setState(CommonConst.AUDIT_INTT);
71 boolean YorN = videosService.updateshyVideos(shyVideos); 71 boolean YorN = videosService.updateshyVideos(shyVideos);
72 - if(YorN == true){ 72 + if (YorN == true) {
73 return new ResponseBean(ErrorEnum.SUCCESS); 73 return new ResponseBean(ErrorEnum.SUCCESS);
74 - }else { 74 + } else {
75 return new ResponseBean(ErrorEnum.ERROR); 75 return new ResponseBean(ErrorEnum.ERROR);
76 } 76 }
77 } 77 }
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
@@ -74,7 +74,7 @@ public class CommentsController { @@ -74,7 +74,7 @@ public class CommentsController {
74 List<ShyComments> list = commentPage.getList(); 74 List<ShyComments> list = commentPage.getList();
75 if (!list.isEmpty()) { 75 if (!list.isEmpty()) {
76 for (ShyComments comment : list) { 76 for (ShyComments comment : list) {
77 - if(comment.getState()!=CommonConst.AUDIT_INTT){ 77 + if (comment.getState() != CommonConst.AUDIT_INTT) {
78 String auditor = "白名单"; 78 String auditor = "白名单";
79 String auditor_id = comment.getAuditor_id(); 79 String auditor_id = comment.getAuditor_id();
80 if (CommonUtils.isNotEmpty(auditor_id)) { 80 if (CommonUtils.isNotEmpty(auditor_id)) {
src/main/java/com/cnlive/shenhe/controller/UsersController.java
@@ -29,21 +29,21 @@ public class UsersController { @@ -29,21 +29,21 @@ public class UsersController {
29 29
30 @GetMapping(value = "/{id}") 30 @GetMapping(value = "/{id}")
31 @ResponseBody 31 @ResponseBody
32 - public Object getTest(@PathVariable Integer id){  
33 - return usersService.get(id); 32 + public Object getTest(@PathVariable Integer id) {
  33 + return usersService.get(id);
34 } 34 }
35 35
36 @RequestMapping("/login") 36 @RequestMapping("/login")
37 public String index(HttpServletRequest request) { 37 public String index(HttpServletRequest request) {
38 AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal(); 38 AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
39 - if(CommonUtils.isNull(principal)){ 39 + if (CommonUtils.isNull(principal)) {
40 return "redirect:https://user.cnlive.com/OpenSSO2/login?service=http://shenhe.cnlive.com/users/login"; 40 return "redirect:https://user.cnlive.com/OpenSSO2/login?service=http://shenhe.cnlive.com/users/login";
41 } 41 }
42 //用户ID 42 //用户ID
43 String id = principal.getName(); 43 String id = principal.getName();
44 - if(CommonUtils.isNotEmpty(id)){ 44 + if (CommonUtils.isNotEmpty(id)) {
45 ShyUsers user = usersService.get(Integer.parseInt(id)); 45 ShyUsers user = usersService.get(Integer.parseInt(id));
46 - if(CommonUtils.isNotNull(user)&&user.getState()){ 46 + if (CommonUtils.isNotNull(user) && user.getState()) {
47 SessionUser sessionUser = new SessionUser(); 47 SessionUser sessionUser = new SessionUser();
48 sessionUser.setUserId(user.getUser_id()); 48 sessionUser.setUserId(user.getUser_id());
49 sessionUser.setSpid(Integer.parseInt(principal.getAttributes().get("new_sp_id").toString())); 49 sessionUser.setSpid(Integer.parseInt(principal.getAttributes().get("new_sp_id").toString()));
@@ -52,7 +52,7 @@ public class UsersController { @@ -52,7 +52,7 @@ public class UsersController {
52 sessionUser.setEmail(user.getEmail()); 52 sessionUser.setEmail(user.getEmail());
53 sessionUser.setLogo(user.getUser_logo()); 53 sessionUser.setLogo(user.getUser_logo());
54 sessionUser.setMaster(user.getMaster()); 54 sessionUser.setMaster(user.getMaster());
55 - request.getSession().setAttribute(SessionUser.SESSION_KEY,sessionUser); 55 + request.getSession().setAttribute(SessionUser.SESSION_KEY, sessionUser);
56 return "redirect:/videos/page"; 56 return "redirect:/videos/page";
57 } 57 }
58 } 58 }
src/main/java/com/cnlive/shenhe/controller/VideosController.java
@@ -77,7 +77,7 @@ public class VideosController { @@ -77,7 +77,7 @@ public class VideosController {
77 } 77 }
78 Integer code = result.getInteger("code"); 78 Integer code = result.getInteger("code");
79 if (code != 0) { 79 if (code != 0) {
80 - System.out.println("审核失败,"); 80 + System.out.println("审核失败,code==" + code);
81 return new ResponseBean(code, result.getString("msg")); 81 return new ResponseBean(code, result.getString("msg"));
82 } 82 }
83 state = state == 4 ? 2 : 1; 83 state = state == 4 ? 2 : 1;
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
@@ -49,9 +49,10 @@ public class CommentsServiceImpl { @@ -49,9 +49,10 @@ public class CommentsServiceImpl {
49 List<ShyComments> commentsList = shyCommentsMapper.select(shyComments); 49 List<ShyComments> commentsList = shyCommentsMapper.select(shyComments);
50 return commentsList; 50 return commentsList;
51 } 51 }
  52 +
52 public boolean updateshyComments1(ShyComments shyComments) { 53 public boolean updateshyComments1(ShyComments shyComments) {
53 int result = shyCommentsMapper.updateByPrimaryKeySelective(shyComments); 54 int result = shyCommentsMapper.updateByPrimaryKeySelective(shyComments);
54 - if(result==0){ 55 + if (result == 0) {
55 return false; 56 return false;
56 } 57 }
57 return true; 58 return true;
@@ -59,7 +60,7 @@ public class CommentsServiceImpl { @@ -59,7 +60,7 @@ public class CommentsServiceImpl {
59 60
60 public boolean impotComments(ShyComments shyComments) { 61 public boolean impotComments(ShyComments shyComments) {
61 int result = shyCommentsMapper.insert(shyComments); 62 int result = shyCommentsMapper.insert(shyComments);
62 - if(result==0){ 63 + if (result == 0) {
63 return false; 64 return false;
64 } 65 }
65 return true; 66 return true;
src/main/java/com/cnlive/shenhe/serviceImpl/SitesServiceImpl.java
@@ -21,13 +21,13 @@ public class SitesServiceImpl { @@ -21,13 +21,13 @@ public class SitesServiceImpl {
21 @Autowired 21 @Autowired
22 ShySitesMapper shySitesMapper; 22 ShySitesMapper shySitesMapper;
23 23
24 - public PageInfo<ShySites> getPage(Integer page, Integer pageSize, String orderByClause,String key, Integer spId){ 24 + public PageInfo<ShySites> getPage(Integer page, Integer pageSize, String orderByClause, String key, Integer spId) {
25 Example example = new Example(ShySites.class); 25 Example example = new Example(ShySites.class);
26 Example.Criteria criteria = example.createCriteria(); 26 Example.Criteria criteria = example.createCriteria();
27 if (CommonUtils.isNotEmpty(orderByClause)) { 27 if (CommonUtils.isNotEmpty(orderByClause)) {
28 example.setOrderByClause(orderByClause); 28 example.setOrderByClause(orderByClause);
29 } 29 }
30 - if (CommonUtils.isNotEmpty(key)){ 30 + if (CommonUtils.isNotEmpty(key)) {
31 criteria.andLike("name", "%" + key + "%"); 31 criteria.andLike("name", "%" + key + "%");
32 criteria.andLike("company", "%" + key + "%"); 32 criteria.andLike("company", "%" + key + "%");
33 } 33 }
@@ -45,8 +45,9 @@ public class SitesServiceImpl { @@ -45,8 +45,9 @@ public class SitesServiceImpl {
45 } 45 }
46 46
47 public boolean update(ShySites site) { 47 public boolean update(ShySites site) {
48 - return shySitesMapper.updateByPrimaryKeySelective(site)==1; 48 + return shySitesMapper.updateByPrimaryKeySelective(site) == 1;
49 } 49 }
  50 +
50 public List<ShySites> findAll() { 51 public List<ShySites> findAll() {
51 List<ShySites> shySites = shySitesMapper.selectAll(); 52 List<ShySites> shySites = shySitesMapper.selectAll();
52 return shySites; 53 return shySites;
src/main/java/com/cnlive/shenhe/serviceImpl/UsersServiceImpl.java
@@ -16,7 +16,7 @@ public class UsersServiceImpl { @@ -16,7 +16,7 @@ public class UsersServiceImpl {
16 @Autowired 16 @Autowired
17 ShyUsersMapper shyUsersMapper; 17 ShyUsersMapper shyUsersMapper;
18 18
19 - public ShyUsers get(Integer id){ 19 + public ShyUsers get(Integer id) {
20 return shyUsersMapper.selectByPrimaryKey(id); 20 return shyUsersMapper.selectByPrimaryKey(id);
21 } 21 }
22 22
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
@@ -33,7 +33,7 @@ public class VideosServiceImpl { @@ -33,7 +33,7 @@ public class VideosServiceImpl {
33 33
34 public boolean impotVideo(ShyVideos shyVideos) { 34 public boolean impotVideo(ShyVideos shyVideos) {
35 int result = shyVideosMapper.insert(shyVideos); 35 int result = shyVideosMapper.insert(shyVideos);
36 - if(result==0){ 36 + if (result == 0) {
37 return false; 37 return false;
38 } 38 }
39 return true; 39 return true;
@@ -43,7 +43,7 @@ public class VideosServiceImpl { @@ -43,7 +43,7 @@ public class VideosServiceImpl {
43 List<ShySites> sitesList = shySitesMapper.select(shySites); 43 List<ShySites> sitesList = shySitesMapper.select(shySites);
44 return sitesList; 44 return sitesList;
45 } 45 }
46 -// 重改逻辑后新加的方法============================ 46 +
47 public List<ShyVideos> findshyVideo(ShyVideos shyVideos) { 47 public List<ShyVideos> findshyVideo(ShyVideos shyVideos) {
48 List<ShyVideos> shyVideoslist = shyVideosMapper.select(shyVideos); 48 List<ShyVideos> shyVideoslist = shyVideosMapper.select(shyVideos);
49 return shyVideoslist; 49 return shyVideoslist;
@@ -51,12 +51,13 @@ public class VideosServiceImpl { @@ -51,12 +51,13 @@ public class VideosServiceImpl {
51 51
52 public boolean updateshyVideos(ShyVideos shyVideos) { 52 public boolean updateshyVideos(ShyVideos shyVideos) {
53 int i = shyVideosMapper.updateByPrimaryKeySelective(shyVideos); 53 int i = shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
54 - if(i==0){ 54 + if (i == 0) {
55 return false; 55 return false;
56 } 56 }
57 return true; 57 return true;
58 } 58 }
59 - public int updateVideo(Integer id, String auditor_id, Integer state, String msg) { 59 +
  60 + public int updateVideo(Integer id, String auditor_id, Integer state, String msg) {
60 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id); 61 ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id);
61 shyVideos.setAuditor_id(auditor_id); 62 shyVideos.setAuditor_id(auditor_id);
62 shyVideos.setState(state); 63 shyVideos.setState(state);
@@ -75,7 +76,7 @@ public class VideosServiceImpl { @@ -75,7 +76,7 @@ public class VideosServiceImpl {
75 Timestamp startdate = null; 76 Timestamp startdate = null;
76 Timestamp enddate = null; 77 Timestamp enddate = null;
77 try { 78 try {
78 - startdate = CommonUtils.parseDate(start_date,"yyyy-MM-dd HH:mm:ss"); 79 + startdate = CommonUtils.parseDate(start_date, "yyyy-MM-dd HH:mm:ss");
79 enddate = CommonUtils.parseDate(end_date, "yyyy-MM-dd HH:mm:ss"); 80 enddate = CommonUtils.parseDate(end_date, "yyyy-MM-dd HH:mm:ss");
80 } catch (ParseException e) { 81 } catch (ParseException e) {
81 e.printStackTrace(); 82 e.printStackTrace();
@@ -86,14 +87,14 @@ public class VideosServiceImpl { @@ -86,14 +87,14 @@ public class VideosServiceImpl {
86 if (CommonUtils.isNotEmpty(video_title)) { 87 if (CommonUtils.isNotEmpty(video_title)) {
87 criteria.andLike("video_title", "%" + video_title + "%"); 88 criteria.andLike("video_title", "%" + video_title + "%");
88 } 89 }
89 - if (CommonUtils.isNotNull(state) && state == 0) { 90 + if (CommonUtils.isNotNull(state) && state == 0) {
90 criteria.andEqualTo("state", state); 91 criteria.andEqualTo("state", state);
91 - }else if (CommonUtils.isNotNull(state) && state == 1){ 92 + } else if (CommonUtils.isNotNull(state) && state == 1) {
92 criteria.andEqualTo("state", state); 93 criteria.andEqualTo("state", state);
93 - criteria2.andEqualTo("state",2); 94 + criteria2.andEqualTo("state", 2);
94 example.or(criteria2); 95 example.or(criteria2);
95 } 96 }
96 - if (CommonUtils.isNotNull(video_priority)) { 97 + if (CommonUtils.isNotEmpty(video_priority)) {
97 criteria.andEqualTo("video_priority", video_priority); 98 criteria.andEqualTo("video_priority", video_priority);
98 } 99 }
99 if (CommonUtils.isNotNull(spid)) { 100 if (CommonUtils.isNotNull(spid)) {