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