Commit e4e03c294ab3d2345920f0fd777fb10be58dd93a

Authored by 王言钊
1 parent 943c4964

格式化代码

Showing 34 changed files with 1799 additions and 1763 deletions

Too many changes to show.

To preserve performance only 34 of 38 files are displayed.

src/main/java/com/cnlive/shenhe/ShenheApplication.java
@@ -34,19 +34,19 @@ public class ShenheApplication extends SpringBootServletInitializer { @@ -34,19 +34,19 @@ public class ShenheApplication extends SpringBootServletInitializer {
34 * 本机的名称 34 * 本机的名称
35 */ 35 */
36 @Value("${SERVER_NAME}") 36 @Value("${SERVER_NAME}")
37 - private String SERVER_NAME; 37 + private String SERVER_NAME;
38 38
39 /** 39 /**
40 * 登录入口 40 * 登录入口
41 */ 41 */
42 @Value("${SERVICE_LOGIN}") 42 @Value("${SERVICE_LOGIN}")
43 - private String SERVICE_LOGIN; 43 + private String SERVICE_LOGIN;
44 44
45 /** 45 /**
46 * 登出 46 * 登出
47 */ 47 */
48 @Value("${SERVICE_LOGINOUT}") 48 @Value("${SERVICE_LOGINOUT}")
49 - private String SERVICE_LOGINOUT; 49 + private String SERVICE_LOGINOUT;
50 50
51 public static void main(String[] args) { 51 public static void main(String[] args) {
52 SpringApplicationBuilder builder = new SpringApplicationBuilder(ShenheApplication.class); 52 SpringApplicationBuilder builder = new SpringApplicationBuilder(ShenheApplication.class);
src/main/java/com/cnlive/shenhe/api/ChannelControllerApi.java
@@ -19,9 +19,6 @@ import org.springframework.web.bind.annotation.ResponseBody; @@ -19,9 +19,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
19 import java.util.List; 19 import java.util.List;
20 20
21 21
22 -  
23 -  
24 -  
25 /** 22 /**
26 * @author Administrator 23 * @author Administrator
27 */ 24 */
src/main/java/com/cnlive/shenhe/api/CommentsControllerApi.java
@@ -45,39 +45,39 @@ public class CommentsControllerApi { @@ -45,39 +45,39 @@ public class CommentsControllerApi {
45 logger.info("评论入库,param=====" + param); 45 logger.info("评论入库,param=====" + param);
46 JSONObject json = JSONObject.parseObject(param); 46 JSONObject json = JSONObject.parseObject(param);
47 //评论类型,topic:话题 47 //评论类型,topic:话题
48 - String type=json.getString("type")==null?"else":json.getString("type"); 48 + String type = json.getString("type") == null ? "else" : json.getString("type");
49 //评论的级别 49 //评论的级别
50 - Integer level=json.getInteger("level")==null?1:json.getInteger("level");  
51 - String programId=json.getString("programId");  
52 - String originalUrl=json.getString("originalUrl");  
53 - String commentTitle=json.getString("commentTitle");  
54 - Integer commentUserId=json.getInteger("commentUserId");  
55 - String commentUserName=json.getString("commentUserName");  
56 - String commentUserAvatar=json.getString("commentUserAvatar");  
57 - String commentUserIP=json.getString("commentUserIP");  
58 - String commentContent=json.getString("commentContent");  
59 - String appId=json.getString("appId");  
60 - String platform=json.getString("platform");  
61 - String activityId=json.getString("activityId");  
62 - Boolean priority=json.getBoolean("priority");  
63 - String callback=json.getString("callback"); 50 + Integer level = json.getInteger("level") == null ? 1 : json.getInteger("level");
  51 + String programId = json.getString("programId");
  52 + String originalUrl = json.getString("originalUrl");
  53 + String commentTitle = json.getString("commentTitle");
  54 + Integer commentUserId = json.getInteger("commentUserId");
  55 + String commentUserName = json.getString("commentUserName");
  56 + String commentUserAvatar = json.getString("commentUserAvatar");
  57 + String commentUserIP = json.getString("commentUserIP");
  58 + String commentContent = json.getString("commentContent");
  59 + String appId = json.getString("appId");
  60 + String platform = json.getString("platform");
  61 + String activityId = json.getString("activityId");
  62 + Boolean priority = json.getBoolean("priority");
  63 + String callback = json.getString("callback");
64 String commentTime = json.getString("commentTime"); 64 String commentTime = json.getString("commentTime");
65 - Date timestamp =null; 65 + Date timestamp = null;
66 if (CommonUtils.isNotEmpty(commentTime)) { 66 if (CommonUtils.isNotEmpty(commentTime)) {
67 - timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd HH:mm"); 67 + timestamp = CommonUtils.getTimestamp(commentTime, "yyyy-MM-dd HH:mm");
68 } 68 }
69 - 69 +
70 //判断是否存在 70 //判断是否存在
71 ShyComments shyComments = new ShyComments(); 71 ShyComments shyComments = new ShyComments();
72 shyComments.setActivity_id(json.getString("activityId")); 72 shyComments.setActivity_id(json.getString("activityId"));
73 List<ShyComments> commentsList = commentsService.findshyComments(shyComments); 73 List<ShyComments> commentsList = commentsService.findshyComments(shyComments);
74 -  
75 - Integer sp_id=null; 74 +
  75 + Integer sp_id = null;
76 try { 76 try {
77 - sp_id=json.getInteger("spId");  
78 - } catch (Exception e) {  
79 - sp_id=null;  
80 - } 77 + sp_id = json.getInteger("spId");
  78 + } catch (Exception e) {
  79 + sp_id = null;
  80 + }
81 //存在则更新 81 //存在则更新
82 if (commentsList.size() > 0) { 82 if (commentsList.size() > 0) {
83 ShyComments shyComments1 = commentsList.get(0); 83 ShyComments shyComments1 = commentsList.get(0);
@@ -92,7 +92,7 @@ public class CommentsControllerApi { @@ -92,7 +92,7 @@ public class CommentsControllerApi {
92 shyComments1.setComment_content(commentContent); 92 shyComments1.setComment_content(commentContent);
93 shyComments1.setType(type); 93 shyComments1.setType(type);
94 shyComments1.setLevel(level); 94 shyComments1.setLevel(level);
95 - 95 +
96 shyComments1.setComment_time(timestamp); 96 shyComments1.setComment_time(timestamp);
97 shyComments1.setSpid(sp_id); 97 shyComments1.setSpid(sp_id);
98 shyComments1.setApp_id(appId); 98 shyComments1.setApp_id(appId);
src/main/java/com/cnlive/shenhe/api/LiveApplyControllerApi.java
@@ -18,206 +18,205 @@ import java.util.Date; @@ -18,206 +18,205 @@ import java.util.Date;
18 import java.util.List; 18 import java.util.List;
19 19
20 20
21 -  
22 /** 21 /**
23 * @author Administrator 22 * @author Administrator
24 */ 23 */
25 @Controller 24 @Controller
26 @RequestMapping("/api/liveApply") 25 @RequestMapping("/api/liveApply")
27 public class LiveApplyControllerApi { 26 public class LiveApplyControllerApi {
28 - private static Logger logger = LoggerFactory.getLogger(LiveApplyControllerApi.class); 27 + private static Logger logger = LoggerFactory.getLogger(LiveApplyControllerApi.class);
  28 +
  29 + @Autowired
  30 + LiveApplyServiceImpl liveApplyServiceImpl;
29 31
30 - @Autowired  
31 - LiveApplyServiceImpl liveApplyServiceImpl;  
32 -  
33 - @PostMapping("/import")  
34 - @ResponseBody  
35 - public JSONObject impotVideo(String param) {  
36 - JSONObject map = new JSONObject();  
37 - JSONObject result = new JSONObject();  
38 - //初始化一个请求数据库返回结果  
39 - boolean YorN =true; 32 + @PostMapping("/import")
  33 + @ResponseBody
  34 + public JSONObject impotVideo(String param) {
  35 + JSONObject map = new JSONObject();
  36 + JSONObject result = new JSONObject();
  37 + //初始化一个请求数据库返回结果
  38 + boolean YorN = true;
40 39
41 - logger.info("直播申请入库,param=====" + param); 40 + logger.info("直播申请入库,param=====" + param);
42 JSONObject json = JSONObject.parseObject(param); 41 JSONObject json = JSONObject.parseObject(param);
43 //获取所有参数 42 //获取所有参数
44 - //直播活动id  
45 - String activityId = json.getString("activityId");  
46 - //直播频道id  
47 - String channelId = json.getString("channelId");  
48 - Integer spId=null; 43 + //直播活动id
  44 + String activityId = json.getString("activityId");
  45 + //直播频道id
  46 + String channelId = json.getString("channelId");
  47 + Integer spId = null;
49 try { 48 try {
50 - spId=json.getInteger("spId");  
51 - } catch (Exception e) {  
52 - spId=null;  
53 - }  
54 - //直播发起人  
55 - String sender = json.getString("sender");  
56 - //联系方式  
57 - String mobile = json.getString("mobile");  
58 - //回调地址  
59 - String callback = json.getString("callback");  
60 - //直播发起单位  
61 - String organization = json.getString("organization");  
62 - //直播主题  
63 - String theme = json.getString("theme");  
64 - //商务模式:0免费 1收费  
65 - Integer businessModel = Integer.parseInt(json.getString("businessModel"));  
66 - //内容属性:1商业类活动 0非商业活动  
67 - Integer contentProperty = Integer.parseInt(json.getString("contentProperty"));  
68 - //内容简述  
69 - String simpleContent = json.getString("simpleContent");  
70 - //直播类型  
71 - String live_type = json.getString("liveType");  
72 - //要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标  
73 - String keys = json.getString("keys").equals("")?"无":json.getString("keys");  
74 - //直播地点  
75 - String livePlace = json.getString("livePlace");  
76 - //推流地址  
77 - String pushUrl = json.getString("pushUrl");  
78 - //拉流地址  
79 - String pullUrl = json.getString("pullUrl").equals("")?"无拉流地址":json.getString("pullUrl");  
80 - //拉流来源  
81 - String pullSource = json.getString("pullSource").equals("")?"无来源":json.getString("pullSource");  
82 - //播出平台及通道:0网家家 1CNLive网站 2@TV互动电视  
83 - String platforms = json.getString("platforms");  
84 - //预计开始时间  
85 - String startTime = json.getString("preStartTime");  
86 - Date timestamp_start =null; 49 + spId = json.getInteger("spId");
  50 + } catch (Exception e) {
  51 + spId = null;
  52 + }
  53 + //直播发起人
  54 + String sender = json.getString("sender");
  55 + //联系方式
  56 + String mobile = json.getString("mobile");
  57 + //回调地址
  58 + String callback = json.getString("callback");
  59 + //直播发起单位
  60 + String organization = json.getString("organization");
  61 + //直播主题
  62 + String theme = json.getString("theme");
  63 + //商务模式:0免费 1收费
  64 + Integer businessModel = Integer.parseInt(json.getString("businessModel"));
  65 + //内容属性:1商业类活动 0非商业活动
  66 + Integer contentProperty = Integer.parseInt(json.getString("contentProperty"));
  67 + //内容简述
  68 + String simpleContent = json.getString("simpleContent");
  69 + //直播类型
  70 + String live_type = json.getString("liveType");
  71 + //要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标
  72 + String keys = json.getString("keys").equals("") ? "无" : json.getString("keys");
  73 + //直播地点
  74 + String livePlace = json.getString("livePlace");
  75 + //推流地址
  76 + String pushUrl = json.getString("pushUrl");
  77 + //拉流地址
  78 + String pullUrl = json.getString("pullUrl").equals("") ? "无拉流地址" : json.getString("pullUrl");
  79 + //拉流来源
  80 + String pullSource = json.getString("pullSource").equals("") ? "无来源" : json.getString("pullSource");
  81 + //播出平台及通道:0网家家 1CNLive网站 2@TV互动电视
  82 + String platforms = json.getString("platforms");
  83 + //预计开始时间
  84 + String startTime = json.getString("preStartTime");
  85 + Date timestamp_start = null;
87 if (CommonUtils.isNotEmpty(startTime)) { 86 if (CommonUtils.isNotEmpty(startTime)) {
88 - timestamp_start = new Timestamp(Long.valueOf(startTime)); 87 + timestamp_start = new Timestamp(Long.valueOf(startTime));
89 } 88 }
90 - //预计结束时间  
91 - String endTime = json.getString("preEndTime");  
92 - Date timestamp_end =null; 89 + //预计结束时间
  90 + String endTime = json.getString("preEndTime");
  91 + Date timestamp_end = null;
93 if (CommonUtils.isNotEmpty(endTime)) { 92 if (CommonUtils.isNotEmpty(endTime)) {
94 - timestamp_end = new Timestamp(Long.valueOf(endTime)); 93 + timestamp_end = new Timestamp(Long.valueOf(endTime));
95 } 94 }
96 ShyLiveapply shyliveApply1 = new ShyLiveapply(); 95 ShyLiveapply shyliveApply1 = new ShyLiveapply();
97 //得到直播活动id去查询是否已有 96 //得到直播活动id去查询是否已有
98 shyliveApply1.setActivity_id(activityId); 97 shyliveApply1.setActivity_id(activityId);
99 - //查询一下 存在,更新 没有,插入 98 + //查询一下 存在,更新 没有,插入
100 List<ShyLiveapply> listshyLiveApply = liveApplyServiceImpl.findshyLiveApply(shyliveApply1); 99 List<ShyLiveapply> listshyLiveApply = liveApplyServiceImpl.findshyLiveApply(shyliveApply1);
101 - 100 +
102 if (listshyLiveApply.size() > 0) { 101 if (listshyLiveApply.size() > 0) {
103 - ShyLiveapply shyliveApply = listshyLiveApply.get(0); 102 + ShyLiveapply shyliveApply = listshyLiveApply.get(0);
104 //封装数据入库 103 //封装数据入库
105 - //设置spid  
106 - shyliveApply.setSp_id(spId);  
107 - //设置发送者  
108 - shyliveApply.setSender(sender);  
109 - //设置联系方式  
110 - shyliveApply.setMobile(mobile);  
111 - //设置直播发起单位  
112 - shyliveApply.setOrganization(organization);  
113 - //直播主题  
114 - shyliveApply.setTheme(theme);  
115 - //直播类型  
116 - shyliveApply.setLive_type(live_type);  
117 - //预计开始时间  
118 - shyliveApply.setPre_start_time(timestamp_start);  
119 - //预计结束时间  
120 - shyliveApply.setPre_end_time(timestamp_end);  
121 - //商务模式:0免费 1收费  
122 - shyliveApply.setBusiness_model(businessModel);  
123 - //内容属性:1商业类活动 0非商业活动  
124 - shyliveApply.setContent_property(contentProperty);  
125 - //内容简述  
126 - shyliveApply.setSimple_content(simpleContent);  
127 - //要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标  
128 - shyliveApply.setPoint_key(keys);  
129 - //直播地点  
130 - shyliveApply.setLive_place(livePlace);  
131 - //推流地址  
132 - shyliveApply.setPush_url(pushUrl);  
133 - //拉流地址  
134 - shyliveApply.setPull_url(pullUrl);  
135 - //拉流来源  
136 - shyliveApply.setPull_source(pullSource);  
137 - //播出平台及通道:0网家家 1CNLive网站 2@TV互动电视  
138 - shyliveApply.setPlatforms(platforms);  
139 - //设置回调地址  
140 - shyliveApply.setCallback(callback);  
141 - shyliveApply.setReceive(CommonConst.RECEIVE_BEFORE);  
142 - shyliveApply.setShenhe_state(CommonConst.AUDIT_INTT);  
143 - shyliveApply.setEmail_notice_state(CommonConst.NOTICE_INTT);  
144 - shyliveApply.setUpdater(null);  
145 - shyliveApply.setAuditor(null);  
146 - //更新时间  
147 - shyliveApply.setUpdated_at(CommonUtils.getCurrentTime()); 104 + //设置spid
  105 + shyliveApply.setSp_id(spId);
  106 + //设置发送者
  107 + shyliveApply.setSender(sender);
  108 + //设置联系方式
  109 + shyliveApply.setMobile(mobile);
  110 + //设置直播发起单位
  111 + shyliveApply.setOrganization(organization);
  112 + //直播主题
  113 + shyliveApply.setTheme(theme);
  114 + //直播类型
  115 + shyliveApply.setLive_type(live_type);
  116 + //预计开始时间
  117 + shyliveApply.setPre_start_time(timestamp_start);
  118 + //预计结束时间
  119 + shyliveApply.setPre_end_time(timestamp_end);
  120 + //商务模式:0免费 1收费
  121 + shyliveApply.setBusiness_model(businessModel);
  122 + //内容属性:1商业类活动 0非商业活动
  123 + shyliveApply.setContent_property(contentProperty);
  124 + //内容简述
  125 + shyliveApply.setSimple_content(simpleContent);
  126 + //要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标
  127 + shyliveApply.setPoint_key(keys);
  128 + //直播地点
  129 + shyliveApply.setLive_place(livePlace);
  130 + //推流地址
  131 + shyliveApply.setPush_url(pushUrl);
  132 + //拉流地址
  133 + shyliveApply.setPull_url(pullUrl);
  134 + //拉流来源
  135 + shyliveApply.setPull_source(pullSource);
  136 + //播出平台及通道:0网家家 1CNLive网站 2@TV互动电视
  137 + shyliveApply.setPlatforms(platforms);
  138 + //设置回调地址
  139 + shyliveApply.setCallback(callback);
  140 + shyliveApply.setReceive(CommonConst.RECEIVE_BEFORE);
  141 + shyliveApply.setShenhe_state(CommonConst.AUDIT_INTT);
  142 + shyliveApply.setEmail_notice_state(CommonConst.NOTICE_INTT);
  143 + shyliveApply.setUpdater(null);
  144 + shyliveApply.setAuditor(null);
  145 + //更新时间
  146 + shyliveApply.setUpdated_at(CommonUtils.getCurrentTime());
148 147
149 - //获取审核类型  
150 - liveApplyServiceImpl.getShenheType(shyliveApply);  
151 - YorN = liveApplyServiceImpl.updateshyLiveApply(shyliveApply);  
152 - }else{  
153 - //查了,没有,直接插入数据库  
154 - //设置频道id  
155 - shyliveApply1.setChannel_id(channelId);  
156 - //设置spid  
157 - shyliveApply1.setSp_id(spId);  
158 - //设置发送者  
159 - shyliveApply1.setSender(sender);  
160 - //设置联系方式  
161 - shyliveApply1.setMobile(mobile);  
162 - //设置直播发起单位  
163 - shyliveApply1.setOrganization(organization);  
164 - //直播主题  
165 - shyliveApply1.setTheme(theme);  
166 - //直播类型  
167 - shyliveApply1.setLive_type(live_type);  
168 - //预计开始时间  
169 - shyliveApply1.setPre_start_time(timestamp_start);  
170 - //预计结束时间  
171 - shyliveApply1.setPre_end_time(timestamp_end);  
172 - //商务模式:0免费 1收费  
173 - shyliveApply1.setBusiness_model(businessModel);  
174 - //内容属性:1商业类活动 0非商业活动  
175 - shyliveApply1.setContent_property(contentProperty);  
176 - //内容简述  
177 - shyliveApply1.setSimple_content(simpleContent);  
178 - //要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标  
179 - shyliveApply1.setPoint_key(keys);  
180 - //直播地点  
181 - shyliveApply1.setLive_place(livePlace);  
182 - //推流地址  
183 - shyliveApply1.setPush_url(pushUrl);  
184 - //拉流地址  
185 - shyliveApply1.setPull_url(pullUrl);  
186 - //拉流来源  
187 - shyliveApply1.setPull_source(pullSource);  
188 - //播出平台及通道:0网家家 1CNLive网站 2@TV互动电视  
189 - shyliveApply1.setPlatforms(platforms);  
190 - //设置回调地址  
191 - shyliveApply1.setCallback(callback);  
192 - //获取审核类型  
193 - liveApplyServiceImpl.getShenheType(shyliveApply1);  
194 - shyliveApply1.setReceive(CommonConst.RECEIVE_BEFORE);  
195 - shyliveApply1.setShenhe_state(CommonConst.AUDIT_INTT);  
196 - shyliveApply1.setEmail_notice_state(CommonConst.NOTICE_INTT);  
197 - shyliveApply1.setUpdater(null);  
198 - shyliveApply1.setAuditor(null);  
199 - shyliveApply1.setShenhe_msg(null);  
200 - shyliveApply1.setEmail_notice_msg("");  
201 - //创建时间  
202 - shyliveApply1.setCreated_at(CommonUtils.getCurrentTime());  
203 - //更新时间  
204 - shyliveApply1.setUpdated_at(CommonUtils.getCurrentTime()); 148 + //获取审核类型
  149 + liveApplyServiceImpl.getShenheType(shyliveApply);
  150 + YorN = liveApplyServiceImpl.updateshyLiveApply(shyliveApply);
  151 + } else {
  152 + //查了,没有,直接插入数据库
  153 + //设置频道id
  154 + shyliveApply1.setChannel_id(channelId);
  155 + //设置spid
  156 + shyliveApply1.setSp_id(spId);
  157 + //设置发送者
  158 + shyliveApply1.setSender(sender);
  159 + //设置联系方式
  160 + shyliveApply1.setMobile(mobile);
  161 + //设置直播发起单位
  162 + shyliveApply1.setOrganization(organization);
  163 + //直播主题
  164 + shyliveApply1.setTheme(theme);
  165 + //直播类型
  166 + shyliveApply1.setLive_type(live_type);
  167 + //预计开始时间
  168 + shyliveApply1.setPre_start_time(timestamp_start);
  169 + //预计结束时间
  170 + shyliveApply1.setPre_end_time(timestamp_end);
  171 + //商务模式:0免费 1收费
  172 + shyliveApply1.setBusiness_model(businessModel);
  173 + //内容属性:1商业类活动 0非商业活动
  174 + shyliveApply1.setContent_property(contentProperty);
  175 + //内容简述
  176 + shyliveApply1.setSimple_content(simpleContent);
  177 + //要点报备:0品牌植入 1广告植入 2商品推销 3网家家独家麦标
  178 + shyliveApply1.setPoint_key(keys);
  179 + //直播地点
  180 + shyliveApply1.setLive_place(livePlace);
  181 + //推流地址
  182 + shyliveApply1.setPush_url(pushUrl);
  183 + //拉流地址
  184 + shyliveApply1.setPull_url(pullUrl);
  185 + //拉流来源
  186 + shyliveApply1.setPull_source(pullSource);
  187 + //播出平台及通道:0网家家 1CNLive网站 2@TV互动电视
  188 + shyliveApply1.setPlatforms(platforms);
  189 + //设置回调地址
  190 + shyliveApply1.setCallback(callback);
  191 + //获取审核类型
  192 + liveApplyServiceImpl.getShenheType(shyliveApply1);
  193 + shyliveApply1.setReceive(CommonConst.RECEIVE_BEFORE);
  194 + shyliveApply1.setShenhe_state(CommonConst.AUDIT_INTT);
  195 + shyliveApply1.setEmail_notice_state(CommonConst.NOTICE_INTT);
  196 + shyliveApply1.setUpdater(null);
  197 + shyliveApply1.setAuditor(null);
  198 + shyliveApply1.setShenhe_msg(null);
  199 + shyliveApply1.setEmail_notice_msg("");
  200 + //创建时间
  201 + shyliveApply1.setCreated_at(CommonUtils.getCurrentTime());
  202 + //更新时间
  203 + shyliveApply1.setUpdated_at(CommonUtils.getCurrentTime());
205 204
206 - YorN = liveApplyServiceImpl.impotLiveApply(shyliveApply1); 205 + YorN = liveApplyServiceImpl.impotLiveApply(shyliveApply1);
207 } 206 }
208 - 207 +
209 if (YorN == true) { 208 if (YorN == true) {
210 - result.put("errorCode", "0");  
211 - result.put("errorMessage", "直播申请审核请求收到成功");  
212 - map.put("statusCode", "200");  
213 - map.put("result", result);  
214 - } else {  
215 - result.put("errorCode", "-1");  
216 - result.put("errorMessage", "直播申请审核入库失败");  
217 - map.put("statusCode", "300");  
218 - map.put("result", result);  
219 - }  
220 - return map;  
221 - }  
222 - 209 + result.put("errorCode", "0");
  210 + result.put("errorMessage", "直播申请审核请求收到成功");
  211 + map.put("statusCode", "200");
  212 + map.put("result", result);
  213 + } else {
  214 + result.put("errorCode", "-1");
  215 + result.put("errorMessage", "直播申请审核入库失败");
  216 + map.put("statusCode", "300");
  217 + map.put("result", result);
  218 + }
  219 + return map;
  220 + }
  221 +
223 } 222 }
src/main/java/com/cnlive/shenhe/api/LiveControllerApi.java
@@ -26,250 +26,250 @@ import java.util.List; @@ -26,250 +26,250 @@ import java.util.List;
26 @Controller 26 @Controller
27 @RequestMapping("/api/live") 27 @RequestMapping("/api/live")
28 public class LiveControllerApi { 28 public class LiveControllerApi {
29 - private static Logger logger = LoggerFactory.getLogger(LiveControllerApi.class); 29 + private static Logger logger = LoggerFactory.getLogger(LiveControllerApi.class);
30 30
31 - @Autowired  
32 - LiveServiceImpl liveService;  
33 -  
34 - @PostMapping("/import")  
35 - @ResponseBody  
36 - public JSONObject impotVideo(String param) {  
37 - JSONObject map = new JSONObject();  
38 - JSONObject result = new JSONObject();  
39 - //初始化一个请求数据库返回结果  
40 - boolean YorN =true; 31 + @Autowired
  32 + LiveServiceImpl liveService;
41 33
42 - logger.info("直播入库,param=====" + param); 34 + @PostMapping("/import")
  35 + @ResponseBody
  36 + public JSONObject impotVideo(String param) {
  37 + JSONObject map = new JSONObject();
  38 + JSONObject result = new JSONObject();
  39 + //初始化一个请求数据库返回结果
  40 + boolean YorN = true;
  41 +
  42 + logger.info("直播入库,param=====" + param);
43 JSONObject json = JSONObject.parseObject(param); 43 JSONObject json = JSONObject.parseObject(param);
44 //获取所有参数 44 //获取所有参数
45 - //直播活动id  
46 - String activityId = json.getString("activityId");  
47 - //直播活动名称  
48 - String activityName = json.getString("activityName");  
49 - //直播活动状态  
50 - Integer activityStatus = Integer.parseInt(json.getString("activityStatus"));  
51 - //直播频道id  
52 - String channelId = json.getString("channelId");  
53 - //直播频道id  
54 - String live_type = json.getString("liveType");  
55 - //rtmp直播流  
56 - String mp4Url = json.getString("mp4Url");  
57 - //m3u8直播流  
58 - String hlsUrl = json.getString("hlsUrl");  
59 - //spid  
60 - Integer spId = Integer.parseInt(json.getString("spId"));  
61 - //回调地址  
62 - String callback = json.getString("callback");  
63 - //优先级  
64 - Integer is_hot = Integer.parseInt(json.getString("priority"));  
65 - //封面  
66 - String coverImgUrl = json.getString("coverImgUrl");  
67 - //活动描述  
68 - String activityIntro = json.getString("activityIntro");  
69 - //回放地址  
70 - String playbackUrl = json.getString("playbackUrl");  
71 - //开始时间  
72 - String startTime = json.getString("startTime");  
73 - Date timestamp_start =null; 45 + //直播活动id
  46 + String activityId = json.getString("activityId");
  47 + //直播活动名称
  48 + String activityName = json.getString("activityName");
  49 + //直播活动状态
  50 + Integer activityStatus = Integer.parseInt(json.getString("activityStatus"));
  51 + //直播频道id
  52 + String channelId = json.getString("channelId");
  53 + //直播频道id
  54 + String live_type = json.getString("liveType");
  55 + //rtmp直播流
  56 + String mp4Url = json.getString("mp4Url");
  57 + //m3u8直播流
  58 + String hlsUrl = json.getString("hlsUrl");
  59 + //spid
  60 + Integer spId = Integer.parseInt(json.getString("spId"));
  61 + //回调地址
  62 + String callback = json.getString("callback");
  63 + //优先级
  64 + Integer is_hot = Integer.parseInt(json.getString("priority"));
  65 + //封面
  66 + String coverImgUrl = json.getString("coverImgUrl");
  67 + //活动描述
  68 + String activityIntro = json.getString("activityIntro");
  69 + //回放地址
  70 + String playbackUrl = json.getString("playbackUrl");
  71 + //开始时间
  72 + String startTime = json.getString("startTime");
  73 + Date timestamp_start = null;
74 if (CommonUtils.isNotEmpty(startTime)) { 74 if (CommonUtils.isNotEmpty(startTime)) {
75 - timestamp_start = new Timestamp(Long.valueOf(startTime)); 75 + timestamp_start = new Timestamp(Long.valueOf(startTime));
76 } 76 }
77 - //结束时间  
78 - String endTime = json.getString("endTime");  
79 - Date timestamp_end =null; 77 + //结束时间
  78 + String endTime = json.getString("endTime");
  79 + Date timestamp_end = null;
80 if (CommonUtils.isNotEmpty(endTime)) { 80 if (CommonUtils.isNotEmpty(endTime)) {
81 - timestamp_end = new Timestamp(Long.valueOf(endTime)); 81 + timestamp_end = new Timestamp(Long.valueOf(endTime));
82 } 82 }
83 83
84 - //预计开始时间  
85 - String pre_startTime = json.getString("preStartTime");  
86 - Date pre_timestamp_start =null; 84 + //预计开始时间
  85 + String pre_startTime = json.getString("preStartTime");
  86 + Date pre_timestamp_start = null;
87 if (CommonUtils.isNotEmpty(pre_startTime)) { 87 if (CommonUtils.isNotEmpty(pre_startTime)) {
88 - pre_timestamp_start = new Timestamp(Long.valueOf(pre_startTime)); 88 + pre_timestamp_start = new Timestamp(Long.valueOf(pre_startTime));
89 } 89 }
90 - //预计结束时间  
91 - String pre_endTime = json.getString("preEndTime");  
92 - Date pre_timestamp_end =null; 90 + //预计结束时间
  91 + String pre_endTime = json.getString("preEndTime");
  92 + Date pre_timestamp_end = null;
93 if (CommonUtils.isNotEmpty(pre_endTime)) { 93 if (CommonUtils.isNotEmpty(pre_endTime)) {
94 - pre_timestamp_end = new Timestamp(Long.valueOf(pre_endTime)); 94 + pre_timestamp_end = new Timestamp(Long.valueOf(pre_endTime));
95 } 95 }
96 - 96 +
97 ShyLive shylive1 = new ShyLive(); 97 ShyLive shylive1 = new ShyLive();
98 //得到直播活动id去查询是否已有 98 //得到直播活动id去查询是否已有
99 - shylive1.setActivity_id(activityId);  
100 - //查询一下 存在,更新 没有,插入 99 + shylive1.setActivity_id(activityId);
  100 + //查询一下 存在,更新 没有,插入
101 List<ShyLive> listshyLive = liveService.findshyLive(shylive1); 101 List<ShyLive> listshyLive = liveService.findshyLive(shylive1);
102 - 102 +
103 if (listshyLive.size() > 0) { 103 if (listshyLive.size() > 0) {
104 - ShyLive shyLive = listshyLive.get(0); 104 + ShyLive shyLive = listshyLive.get(0);
105 //封装数据入库 105 //封装数据入库
106 - //设置spid  
107 - shyLive.setSp_id(spId);  
108 - //设置直播活动名称  
109 - shyLive.setActivity_name(activityName);  
110 - //设置直播活动状态  
111 - shyLive.setActivity_status(activityStatus);  
112 - shyLive.setPre_start_time(pre_timestamp_start);  
113 - shyLive.setPre_end_time(pre_timestamp_end); 106 + //设置spid
  107 + shyLive.setSp_id(spId);
  108 + //设置直播活动名称
  109 + shyLive.setActivity_name(activityName);
  110 + //设置直播活动状态
  111 + shyLive.setActivity_status(activityStatus);
  112 + shyLive.setPre_start_time(pre_timestamp_start);
  113 + shyLive.setPre_end_time(pre_timestamp_end);
114 114
115 - //直播活动状态,1:直播中,2:直播完成,3:待直播,0:直播撤销(手动),4:直播下线(强制)  
116 - //发布直播  
117 - if(activityStatus.equals(CommonConstStates.ZHIBO_DENGDAI)){  
118 - shyLive.setActivity_start_time(null);  
119 - shyLive.setActivity_end_time(null);  
120 - //是否是热点: 1:不是 ,2: 是  
121 - shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANYES);  
122 - //启动直播  
123 - }else if(activityStatus.equals(CommonConstStates.ZHIBO_ZHENGZAI)){  
124 - shyLive.setActivity_start_time(timestamp_start);  
125 - shyLive.setActivity_end_time(null);  
126 - //是否是热点: 1:不是 ,2: 是  
127 - shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANYES);  
128 - //停止直播  
129 - }else if(activityStatus.equals(CommonConstStates.ZHIBO_JIESHU)){  
130 - shyLive.setActivity_start_time(timestamp_start);  
131 - shyLive.setActivity_end_time(timestamp_end);  
132 - //回放地址  
133 - shyLive.setPlayback_url(playbackUrl);  
134 - //状态 0:未认领 1.已领未审,2:已审  
135 - shyLive.setShenhe_state(CommonConst.RECEIVE_AUDIT);  
136 - //直播完成后自动通过  
137 - shyLive.setUpdater("自动通过");  
138 - //是否是热点: 1:不是 ,2: 是  
139 - shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);  
140 - //审核强制下线  
141 - }else if(activityStatus.equals(CommonConstStates.ZHIBO_XIAXIAN)){  
142 - shyLive.setActivity_start_time(timestamp_start);  
143 - shyLive.setActivity_end_time(timestamp_end);  
144 - //回放地址  
145 - shyLive.setPlayback_url(playbackUrl);  
146 - //是否是热点: 1:不是 ,2: 是  
147 - shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);  
148 - }  
149 - //直播活动简介  
150 - shyLive.setActivity_intro(activityIntro);  
151 - shyLive.setLive_type(live_type);  
152 - //m3u8直播流  
153 - shyLive.setM3u8_url(hlsUrl);  
154 - //rtmp直播流  
155 - shyLive.setRtmp_url(mp4Url);  
156 - //回调地址  
157 - shyLive.setCallback(callback);  
158 - //封面  
159 - shyLive.setCover_img_url(coverImgUrl);  
160 - //审核类型,1:免审,2:机审,3:人工审  
161 - shyLive.setShenhe_type(CommonConst.AUDIT_TYPE_USER);  
162 - //抽帧状态 1:不抽帧 2:待抽帧 3:抽帧中 4:抽帧完成 5:抽帧失败  
163 - shyLive.setAvsample_state(1);  
164 - //直播撤销  
165 - if(activityStatus.equals(CommonConstStates.ZHIBO_CHEXIAO)){  
166 - //是否显示 0:不显示 1:显示  
167 - shyLive.setIs_show(CommonConstStates.SHIFOU_XIANSHINO);  
168 - //是否是热点: 1:不是 ,2: 是  
169 - shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);  
170 - }else{  
171 - shyLive.setIs_show(CommonConstStates.SHIFOU_XIANSHIYES);  
172 - }  
173 - //更新时间  
174 - shyLive.setUpdated_at(CommonUtils.getCurrentTime()); 115 + //直播活动状态,1:直播中,2:直播完成,3:待直播,0:直播撤销(手动),4:直播下线(强制)
  116 + //发布直播
  117 + if (activityStatus.equals(CommonConstStates.ZHIBO_DENGDAI)) {
  118 + shyLive.setActivity_start_time(null);
  119 + shyLive.setActivity_end_time(null);
  120 + //是否是热点: 1:不是 ,2: 是
  121 + shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANYES);
  122 + //启动直播
  123 + } else if (activityStatus.equals(CommonConstStates.ZHIBO_ZHENGZAI)) {
  124 + shyLive.setActivity_start_time(timestamp_start);
  125 + shyLive.setActivity_end_time(null);
  126 + //是否是热点: 1:不是 ,2: 是
  127 + shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANYES);
  128 + //停止直播
  129 + } else if (activityStatus.equals(CommonConstStates.ZHIBO_JIESHU)) {
  130 + shyLive.setActivity_start_time(timestamp_start);
  131 + shyLive.setActivity_end_time(timestamp_end);
  132 + //回放地址
  133 + shyLive.setPlayback_url(playbackUrl);
  134 + //状态 0:未认领 1.已领未审,2:已审
  135 + shyLive.setShenhe_state(CommonConst.RECEIVE_AUDIT);
  136 + //直播完成后自动通过
  137 + shyLive.setUpdater("自动通过");
  138 + //是否是热点: 1:不是 ,2: 是
  139 + shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);
  140 + //审核强制下线
  141 + } else if (activityStatus.equals(CommonConstStates.ZHIBO_XIAXIAN)) {
  142 + shyLive.setActivity_start_time(timestamp_start);
  143 + shyLive.setActivity_end_time(timestamp_end);
  144 + //回放地址
  145 + shyLive.setPlayback_url(playbackUrl);
  146 + //是否是热点: 1:不是 ,2: 是
  147 + shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);
  148 + }
  149 + //直播活动简介
  150 + shyLive.setActivity_intro(activityIntro);
  151 + shyLive.setLive_type(live_type);
  152 + //m3u8直播流
  153 + shyLive.setM3u8_url(hlsUrl);
  154 + //rtmp直播流
  155 + shyLive.setRtmp_url(mp4Url);
  156 + //回调地址
  157 + shyLive.setCallback(callback);
  158 + //封面
  159 + shyLive.setCover_img_url(coverImgUrl);
  160 + //审核类型,1:免审,2:机审,3:人工审
  161 + shyLive.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
  162 + //抽帧状态 1:不抽帧 2:待抽帧 3:抽帧中 4:抽帧完成 5:抽帧失败
  163 + shyLive.setAvsample_state(1);
  164 + //直播撤销
  165 + if (activityStatus.equals(CommonConstStates.ZHIBO_CHEXIAO)) {
  166 + //是否显示 0:不显示 1:显示
  167 + shyLive.setIs_show(CommonConstStates.SHIFOU_XIANSHINO);
  168 + //是否是热点: 1:不是 ,2: 是
  169 + shyLive.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);
  170 + } else {
  171 + shyLive.setIs_show(CommonConstStates.SHIFOU_XIANSHIYES);
  172 + }
  173 + //更新时间
  174 + shyLive.setUpdated_at(CommonUtils.getCurrentTime());
175 175
176 - YorN = liveService.updateshyLive(shyLive);  
177 - }else{  
178 - //查了,没有,直接插入数据库  
179 - //设置直播活动id  
180 - shylive1.setActivity_id(activityId);  
181 - //设置直播活动名称  
182 - shylive1.setActivity_name(activityName);  
183 - //设置直播活动状态  
184 - shylive1.setActivity_status(activityStatus);  
185 - //设置直播频道  
186 - shylive1.setChannel_id(channelId);  
187 - //设置spid  
188 - shylive1.setSp_id(spId);  
189 - //状态 0:未认领 1.已领未审,2:已审  
190 - shylive1.setShenhe_state(CommonConst.RECEIVE_BEFORE);  
191 - //是否是热点: 1:不是 ,2: 是  
192 - shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANYES);  
193 - shylive1.setPre_start_time(pre_timestamp_start);  
194 - shylive1.setPre_end_time(pre_timestamp_end);  
195 - //发布直播  
196 - if(activityStatus.equals(CommonConstStates.ZHIBO_DENGDAI)){  
197 - shylive1.setActivity_start_time(null);  
198 - shylive1.setActivity_end_time(null);  
199 - }else if(activityStatus.equals(CommonConstStates.ZHIBO_ZHENGZAI)){  
200 - //启动直播  
201 - shylive1.setActivity_start_time(timestamp_start);  
202 - shylive1.setActivity_end_time(null);  
203 - //停止直播  
204 - }else if(activityStatus.equals(CommonConstStates.ZHIBO_JIESHU)){  
205 - shylive1.setActivity_start_time(timestamp_start);  
206 - shylive1.setActivity_end_time(timestamp_end);  
207 - //回放地址  
208 - shylive1.setPlayback_url(playbackUrl);  
209 - //状态 0:未认领 1.已领未审,2:已审  
210 - shylive1.setShenhe_state(CommonConst.RECEIVE_AUDIT);  
211 - //直播完成后自动通过  
212 - shylive1.setUpdater("自动通过");  
213 - //是否是热点: 1:不是 ,2: 是  
214 - shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);  
215 - //审核强制下线  
216 - }else if(activityStatus.equals(CommonConstStates.ZHIBO_XIAXIAN)){  
217 - shylive1.setActivity_start_time(timestamp_start);  
218 - shylive1.setActivity_end_time(timestamp_end);  
219 - //回放地址  
220 - shylive1.setPlayback_url(playbackUrl);  
221 - //状态 0:未认领 1.已领未审,2:已审  
222 - shylive1.setShenhe_state(CommonConst.RECEIVE_AUDIT);  
223 - //是否是热点: 1:不是 ,2: 是  
224 - shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);  
225 - }  
226 - //直播活动简介  
227 - shylive1.setActivity_intro(activityIntro);  
228 - shylive1.setLive_type(live_type);  
229 - //m3u8直播流  
230 - shylive1.setM3u8_url(hlsUrl);  
231 - //rtmp直播流  
232 - shylive1.setRtmp_url(mp4Url);  
233 - //回调地址  
234 - shylive1.setCallback(callback);  
235 - //封面  
236 - shylive1.setCover_img_url(coverImgUrl);  
237 - //审核类型,1:免审,2:机审,3:人工审  
238 - shylive1.setShenhe_type(CommonConst.AUDIT_TYPE_USER);  
239 - //抽帧状态 1:不抽帧 2:待抽帧 3:抽帧中 4:抽帧完成 5:抽帧失败  
240 - shylive1.setAvsample_state(1);  
241 - //直播撤销  
242 - if(activityStatus.equals(CommonConstStates.ZHIBO_CHEXIAO)){  
243 - //是否显示 0:不显示 1:显示  
244 - shylive1.setIs_show(CommonConstStates.SHIFOU_XIANSHINO);  
245 - //是否是热点: 1:不是 ,2: 是  
246 - shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);  
247 - }else{  
248 - shylive1.setIs_show(CommonConstStates.SHIFOU_XIANSHIYES);  
249 - } 176 + YorN = liveService.updateshyLive(shyLive);
  177 + } else {
  178 + //查了,没有,直接插入数据库
  179 + //设置直播活动id
  180 + shylive1.setActivity_id(activityId);
  181 + //设置直播活动名称
  182 + shylive1.setActivity_name(activityName);
  183 + //设置直播活动状态
  184 + shylive1.setActivity_status(activityStatus);
  185 + //设置直播频道
  186 + shylive1.setChannel_id(channelId);
  187 + //设置spid
  188 + shylive1.setSp_id(spId);
  189 + //状态 0:未认领 1.已领未审,2:已审
  190 + shylive1.setShenhe_state(CommonConst.RECEIVE_BEFORE);
  191 + //是否是热点: 1:不是 ,2: 是
  192 + shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANYES);
  193 + shylive1.setPre_start_time(pre_timestamp_start);
  194 + shylive1.setPre_end_time(pre_timestamp_end);
  195 + //发布直播
  196 + if (activityStatus.equals(CommonConstStates.ZHIBO_DENGDAI)) {
  197 + shylive1.setActivity_start_time(null);
  198 + shylive1.setActivity_end_time(null);
  199 + } else if (activityStatus.equals(CommonConstStates.ZHIBO_ZHENGZAI)) {
  200 + //启动直播
  201 + shylive1.setActivity_start_time(timestamp_start);
  202 + shylive1.setActivity_end_time(null);
  203 + //停止直播
  204 + } else if (activityStatus.equals(CommonConstStates.ZHIBO_JIESHU)) {
  205 + shylive1.setActivity_start_time(timestamp_start);
  206 + shylive1.setActivity_end_time(timestamp_end);
  207 + //回放地址
  208 + shylive1.setPlayback_url(playbackUrl);
  209 + //状态 0:未认领 1.已领未审,2:已审
  210 + shylive1.setShenhe_state(CommonConst.RECEIVE_AUDIT);
  211 + //直播完成后自动通过
  212 + shylive1.setUpdater("自动通过");
  213 + //是否是热点: 1:不是 ,2: 是
  214 + shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);
  215 + //审核强制下线
  216 + } else if (activityStatus.equals(CommonConstStates.ZHIBO_XIAXIAN)) {
  217 + shylive1.setActivity_start_time(timestamp_start);
  218 + shylive1.setActivity_end_time(timestamp_end);
  219 + //回放地址
  220 + shylive1.setPlayback_url(playbackUrl);
  221 + //状态 0:未认领 1.已领未审,2:已审
  222 + shylive1.setShenhe_state(CommonConst.RECEIVE_AUDIT);
  223 + //是否是热点: 1:不是 ,2: 是
  224 + shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);
  225 + }
  226 + //直播活动简介
  227 + shylive1.setActivity_intro(activityIntro);
  228 + shylive1.setLive_type(live_type);
  229 + //m3u8直播流
  230 + shylive1.setM3u8_url(hlsUrl);
  231 + //rtmp直播流
  232 + shylive1.setRtmp_url(mp4Url);
  233 + //回调地址
  234 + shylive1.setCallback(callback);
  235 + //封面
  236 + shylive1.setCover_img_url(coverImgUrl);
  237 + //审核类型,1:免审,2:机审,3:人工审
  238 + shylive1.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
  239 + //抽帧状态 1:不抽帧 2:待抽帧 3:抽帧中 4:抽帧完成 5:抽帧失败
  240 + shylive1.setAvsample_state(1);
  241 + //直播撤销
  242 + if (activityStatus.equals(CommonConstStates.ZHIBO_CHEXIAO)) {
  243 + //是否显示 0:不显示 1:显示
  244 + shylive1.setIs_show(CommonConstStates.SHIFOU_XIANSHINO);
  245 + //是否是热点: 1:不是 ,2: 是
  246 + shylive1.setIs_hot(CommonConstStates.SHIFOU_REDIANNO);
  247 + } else {
  248 + shylive1.setIs_show(CommonConstStates.SHIFOU_XIANSHIYES);
  249 + }
250 250
251 - //创建时间  
252 - shylive1.setCreated_at(CommonUtils.getCurrentTime());  
253 - //更新时间  
254 - shylive1.setUpdated_at(CommonUtils.getCurrentTime());  
255 - YorN = liveService.impotVideo(shylive1); 251 + //创建时间
  252 + shylive1.setCreated_at(CommonUtils.getCurrentTime());
  253 + //更新时间
  254 + shylive1.setUpdated_at(CommonUtils.getCurrentTime());
  255 + YorN = liveService.impotVideo(shylive1);
256 } 256 }
257 - 257 +
258 if (YorN == true) { 258 if (YorN == true) {
259 - result.put("errorCode", "0");  
260 - result.put("errorMessage", "直播审核请求收到成功");  
261 - map.put("statusCode", "200");  
262 - map.put("result", result);  
263 - } else {  
264 - result.put("errorCode", "-1");  
265 - result.put("errorMessage", "直播审核入库失败");  
266 - map.put("statusCode", "300");  
267 - map.put("result", result);  
268 - }  
269 - return map;  
270 - }  
271 -  
272 - 259 + result.put("errorCode", "0");
  260 + result.put("errorMessage", "直播审核请求收到成功");
  261 + map.put("statusCode", "200");
  262 + map.put("result", result);
  263 + } else {
  264 + result.put("errorCode", "-1");
  265 + result.put("errorMessage", "直播审核入库失败");
  266 + map.put("statusCode", "300");
  267 + map.put("result", result);
  268 + }
  269 + return map;
  270 + }
  271 +
  272 +
273 @RequestMapping(value = "callbackLiveResult", method = RequestMethod.POST) 273 @RequestMapping(value = "callbackLiveResult", method = RequestMethod.POST)
274 @ResponseBody 274 @ResponseBody
275 public void getFilterVideoResult(@RequestBody String json) { 275 public void getFilterVideoResult(@RequestBody String json) {
@@ -284,14 +284,14 @@ public class LiveControllerApi { @@ -284,14 +284,14 @@ public class LiveControllerApi {
284 284
285 } 285 }
286 if ("REJECT".equals(riskLevel)) { 286 if ("REJECT".equals(riskLevel)) {
287 - JSONObject detail = resultObj.getJSONObject("detail");  
288 - logger.info("数美视频回调--REJECT,detail:{}", detail); 287 + JSONObject detail = resultObj.getJSONObject("detail");
  288 + logger.info("数美视频回调--REJECT,detail:{}", detail);
289 } 289 }
290 if ("REVIEW".equals(riskLevel)) { 290 if ("REVIEW".equals(riskLevel)) {
291 } 291 }
292 - }else{ 292 + } else {
293 } 293 }
294 } 294 }
295 } 295 }
296 - 296 +
297 } 297 }
src/main/java/com/cnlive/shenhe/api/TopicControllerApi.java
@@ -38,7 +38,7 @@ public class TopicControllerApi { @@ -38,7 +38,7 @@ public class TopicControllerApi {
38 CommentsServiceImpl commentsService; 38 CommentsServiceImpl commentsService;
39 @Autowired 39 @Autowired
40 TopicServiceImpl topicService; 40 TopicServiceImpl topicService;
41 - 41 +
42 @Autowired 42 @Autowired
43 TransitServiceUtils t; 43 TransitServiceUtils t;
44 44
@@ -53,16 +53,16 @@ public class TopicControllerApi { @@ -53,16 +53,16 @@ public class TopicControllerApi {
53 logger.info("话题入库,param=====" + param); 53 logger.info("话题入库,param=====" + param);
54 JSONObject json = JSONObject.parseObject(param); 54 JSONObject json = JSONObject.parseObject(param);
55 JSONObject result = new JSONObject(); 55 JSONObject result = new JSONObject();
56 - 56 +
57 //获取所有参数 57 //获取所有参数
58 //话题id 58 //话题id
59 String topic_id = json.getString("topicId"); 59 String topic_id = json.getString("topicId");
60 - Integer spId=null; 60 + Integer spId = null;
61 try { 61 try {
62 - spId=json.getInteger("spId");  
63 - } catch (Exception e) {  
64 - spId=null;  
65 - } 62 + spId = json.getInteger("spId");
  63 + } catch (Exception e) {
  64 + spId = null;
  65 + }
66 //话题标题 66 //话题标题
67 String topicTitle = json.getString("topicTitle"); 67 String topicTitle = json.getString("topicTitle");
68 //话题图片 68 //话题图片
@@ -78,15 +78,15 @@ public class TopicControllerApi { @@ -78,15 +78,15 @@ public class TopicControllerApi {
78 String topic_url = json.getString("topicUrl"); 78 String topic_url = json.getString("topicUrl");
79 79
80 //判断是否存在 80 //判断是否存在
81 - ShyTopic shyTopic=new ShyTopic(); 81 + ShyTopic shyTopic = new ShyTopic();
82 shyTopic.setTopic_id(topic_id); 82 shyTopic.setTopic_id(topic_id);
83 List<ShyTopic> topicList = topicService.findshyTopic(shyTopic); 83 List<ShyTopic> topicList = topicService.findshyTopic(shyTopic);
84 - 84 +
85 //获取审核类型 85 //获取审核类型
86 Integer shenheType = topicService.getShenheType(spId); 86 Integer shenheType = topicService.getShenheType(spId);
87 //存在则更新 87 //存在则更新
88 if (topicList.size() > 0) { 88 if (topicList.size() > 0) {
89 - ShyTopic shyTopic1 = topicList.get(0); 89 + ShyTopic shyTopic1 = topicList.get(0);
90 //话题标题 90 //话题标题
91 shyTopic1.setTitle(topicTitle); 91 shyTopic1.setTitle(topicTitle);
92 //话题图片 92 //话题图片
@@ -110,9 +110,9 @@ public class TopicControllerApi { @@ -110,9 +110,9 @@ public class TopicControllerApi {
110 110
111 boolean YorN = topicService.updateshyTopic(shyTopic1); 111 boolean YorN = topicService.updateshyTopic(shyTopic1);
112 if (YorN == true) { 112 if (YorN == true) {
113 - return new ResponseBean(ErrorEnum.SUCCESS,new JSONObject().put("topic_id", topic_id)); 113 + return new ResponseBean(ErrorEnum.SUCCESS, new JSONObject().put("topic_id", topic_id));
114 } else { 114 } else {
115 - return new ResponseBean(ErrorEnum.ERROR,new JSONObject().put("topic_id", topic_id)); 115 + return new ResponseBean(ErrorEnum.ERROR, new JSONObject().put("topic_id", topic_id));
116 } 116 }
117 } 117 }
118 //如果不存在直接插入 118 //如果不存在直接插入
@@ -140,25 +140,25 @@ public class TopicControllerApi { @@ -140,25 +140,25 @@ public class TopicControllerApi {
140 shyTopic.setCreate_date(CommonUtils.getCurrentTime()); 140 shyTopic.setCreate_date(CommonUtils.getCurrentTime());
141 boolean YorN = topicService.impotshyTopic(shyTopic); 141 boolean YorN = topicService.impotshyTopic(shyTopic);
142 if (YorN == true) { 142 if (YorN == true) {
143 - return new ResponseBean(ErrorEnum.SUCCESS,new JSONObject().put("topic_id", topic_id)); 143 + return new ResponseBean(ErrorEnum.SUCCESS, new JSONObject().put("topic_id", topic_id));
144 } else { 144 } else {
145 - return new ResponseBean(ErrorEnum.ERROR,new JSONObject().put("topic_id", topic_id)); 145 + return new ResponseBean(ErrorEnum.ERROR, new JSONObject().put("topic_id", topic_id));
146 } 146 }
147 } 147 }
148 - 148 +
149 @GetMapping("/send") 149 @GetMapping("/send")
150 @ResponseBody 150 @ResponseBody
151 public String send() { 151 public String send() {
152 - System.out.println("1111");  
153 - JSONObject params = new JSONObject(); 152 + System.out.println("1111");
  153 + JSONObject params = new JSONObject();
154 params.put("video_id", "11111"); 154 params.put("video_id", "11111");
155 params.put("state", "22222"); 155 params.put("state", "22222");
156 params.put("attr_tags", "33333"); 156 params.put("attr_tags", "33333");
157 params.put("msg", "4444"); 157 params.put("msg", "4444");
158 - t.send("cms","/api/callback", false, params);  
159 - return "1111"; 158 + t.send("cms", "/api/callback", false, params);
  159 + return "1111";
160 } 160 }
161 - 161 +
162 @PostMapping("/callback") 162 @PostMapping("/callback")
163 @ResponseBody 163 @ResponseBody
164 public ResponseBean callback(@RequestBody String param) { 164 public ResponseBean callback(@RequestBody String param) {
@@ -166,37 +166,37 @@ public class TopicControllerApi { @@ -166,37 +166,37 @@ public class TopicControllerApi {
166 JSONObject json = JSONObject.parseObject(param); 166 JSONObject json = JSONObject.parseObject(param);
167 //获取中转服务器消息 167 //获取中转服务器消息
168 String errorCode = json.getString("errorCode"); 168 String errorCode = json.getString("errorCode");
169 - String errorMessage=json.getString("errorMessage"); 169 + String errorMessage = json.getString("errorMessage");
170 //获取接收方消息 170 //获取接收方消息
171 JSONObject dataObject = json.getJSONObject("data"); 171 JSONObject dataObject = json.getJSONObject("data");
172 - String topic_id=dataObject.getString("topic_id"); 172 + String topic_id = dataObject.getString("topic_id");
173 //获取当前话题实体 173 //获取当前话题实体
174 - ShyTopic topic=new ShyTopic(); 174 + ShyTopic topic = new ShyTopic();
175 topic.setTopic_id(topic_id); 175 topic.setTopic_id(topic_id);
176 topic = topicService.getShyTopic(topic); 176 topic = topicService.getShyTopic(topic);
177 -  
178 - if(errorCode.equals("0")){  
179 - logger.info("话题id为:"+topic_id+",cms系统已通知");  
180 - if(topic!=null){  
181 - topic.setShenhe_msg(topic.getShenhe_msg()+",cms系统已通知");  
182 - }  
183 - }else{//中转服务器失败  
184 - logger.info("话题id为:"+topic_id+",中转服务器调用cms失败,失败消息:"+errorMessage);  
185 - topic.setShenhe_msg(topic.getShenhe_msg()+",中转服务器调用cms失败,失败消息:"+errorMessage);  
186 - topic.setShenhe_status(CommonConst.AUDIT_INTT);  
187 - topic.setShenhe_type(CommonConst.AUDIT_TYPE_USER);  
188 - topic.setAuditor_id(null); 177 +
  178 + if (errorCode.equals("0")) {
  179 + logger.info("话题id为:" + topic_id + ",cms系统已通知");
  180 + if (topic != null) {
  181 + topic.setShenhe_msg(topic.getShenhe_msg() + ",cms系统已通知");
  182 + }
  183 + } else {//中转服务器失败
  184 + logger.info("话题id为:" + topic_id + ",中转服务器调用cms失败,失败消息:" + errorMessage);
  185 + topic.setShenhe_msg(topic.getShenhe_msg() + ",中转服务器调用cms失败,失败消息:" + errorMessage);
  186 + topic.setShenhe_status(CommonConst.AUDIT_INTT);
  187 + topic.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
  188 + topic.setAuditor_id(null);
189 } 189 }
190 boolean rs = topicService.updateshyTopic(topic); 190 boolean rs = topicService.updateshyTopic(topic);
191 - Map<String,Object> ee=new HashMap<>(); 191 + Map<String, Object> ee = new HashMap<>();
192 ee.put("topic_id", topic_id); 192 ee.put("topic_id", topic_id);
193 - if(rs){  
194 - return new ResponseBean(ErrorEnum.SUCCESS,ee); 193 + if (rs) {
  194 + return new ResponseBean(ErrorEnum.SUCCESS, ee);
195 } 195 }
196 -  
197 - return new ResponseBean(300,"话题送审回调成功,入库失败",ee);  
198 - }  
199 -  
200 - 196 +
  197 + return new ResponseBean(300, "话题送审回调成功,入库失败", ee);
  198 + }
  199 +
  200 +
201 } 201 }
202 202
src/main/java/com/cnlive/shenhe/bean/ErrorEnum.java
@@ -7,6 +7,9 @@ package com.cnlive.shenhe.bean; @@ -7,6 +7,9 @@ package com.cnlive.shenhe.bean;
7 7
8 public enum ErrorEnum { 8 public enum ErrorEnum {
9 9
  10 + /**
  11 + * 统一定义状态
  12 + */
10 SUCCESS(0, "success"), 13 SUCCESS(0, "success"),
11 ERROR(500, "服务异常"), 14 ERROR(500, "服务异常"),
12 RECORD_NOT_EXIST(10001, "记录不存在"), 15 RECORD_NOT_EXIST(10001, "记录不存在"),
src/main/java/com/cnlive/shenhe/bean/ResponseBean.java
@@ -42,9 +42,10 @@ public class ResponseBean implements Serializable { @@ -42,9 +42,10 @@ public class ResponseBean implements Serializable {
42 public ResponseBean(ErrorEnum errorEnum) { 42 public ResponseBean(ErrorEnum errorEnum) {
43 this.errorEnum = errorEnum; 43 this.errorEnum = errorEnum;
44 } 44 }
  45 +
45 public ResponseBean(ErrorEnum errorEnum, Object data) { 46 public ResponseBean(ErrorEnum errorEnum, Object data) {
46 - this.errorEnum = errorEnum;  
47 - this.data = data; 47 + this.errorEnum = errorEnum;
  48 + this.data = data;
48 } 49 }
49 50
50 public Integer getErrorCode() { 51 public Integer getErrorCode() {
src/main/java/com/cnlive/shenhe/controller/AudioController.java
@@ -193,7 +193,7 @@ public class AudioController extends BaseController { @@ -193,7 +193,7 @@ public class AudioController extends BaseController {
193 String[] cids = ids.split(","); 193 String[] cids = ids.split(",");
194 for (String cid : cids) { 194 for (String cid : cids) {
195 ShyAudio shyAudio = audioService.selectByPrimaryKey(Integer.parseInt(cid)); 195 ShyAudio shyAudio = audioService.selectByPrimaryKey(Integer.parseInt(cid));
196 - if (!shyAudio.getState() .equals( CommonConst.AUDIT_INTT )|| shyAudio.getReceive() .equals(CommonConst.RECEIVE_BEFORE) || !shyAudio.getReceive_user_id().equals(userId)) { 196 + if (!shyAudio.getState().equals(CommonConst.AUDIT_INTT) || shyAudio.getReceive().equals(CommonConst.RECEIVE_BEFORE) || !shyAudio.getReceive_user_id().equals(userId)) {
197 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,您选中的内容包含已退领的或已经审核的"); 197 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,您选中的内容包含已退领的或已经审核的");
198 } 198 }
199 } 199 }
@@ -241,9 +241,9 @@ public class AudioController extends BaseController { @@ -241,9 +241,9 @@ public class AudioController extends BaseController {
241 241
242 String yuming = ""; 242 String yuming = "";
243 Integer plat = shyAudio.getBucketType(); 243 Integer plat = shyAudio.getBucketType();
244 - if (plat .equals( CommonConst.QINIU_PLAT)) { 244 + if (plat.equals(CommonConst.QINIU_PLAT)) {
245 yuming = qn_domain + "/"; 245 yuming = qn_domain + "/";
246 - } else if (plat .equals( CommonConst.KS_PLAT)) { 246 + } else if (plat.equals(CommonConst.KS_PLAT)) {
247 yuming = ks_domain + "/"; 247 yuming = ks_domain + "/";
248 } 248 }
249 shyAudio.setAttr_tags(CommonUtils.isEmpty(shyAudio.getAttr_tags()) ? "" : shyAudio.getAttr_tags()); 249 shyAudio.setAttr_tags(CommonUtils.isEmpty(shyAudio.getAttr_tags()) ? "" : shyAudio.getAttr_tags());
src/main/java/com/cnlive/shenhe/controller/EmailController.java
@@ -28,7 +28,6 @@ import javax.servlet.http.HttpSession; @@ -28,7 +28,6 @@ import javax.servlet.http.HttpSession;
28 import java.util.List; 28 import java.util.List;
29 29
30 /** 30 /**
31 - *  
32 * @Auther: liwei 31 * @Auther: liwei
33 * @Date: 2019/08/20 14:22 32 * @Date: 2019/08/20 14:22
34 * @Description: 33 * @Description:
@@ -42,47 +41,47 @@ public class EmailController extends BaseController { @@ -42,47 +41,47 @@ public class EmailController extends BaseController {
42 EmailServiceImpl emailServiceImpl; 41 EmailServiceImpl emailServiceImpl;
43 @Autowired 42 @Autowired
44 SitesServiceImpl sitesService; 43 SitesServiceImpl sitesService;
45 - 44 +
46 @Autowired 45 @Autowired
47 UsersServiceImpl usersService; 46 UsersServiceImpl usersService;
48 47
49 - 48 +
50 @GetMapping(value = "/page") 49 @GetMapping(value = "/page")
51 public String page(Model model, EmailDTO emailDTO, HttpSession session) { 50 public String page(Model model, EmailDTO emailDTO, HttpSession session) {
52 logger.info("列表请求参数:{}", JSON.toJSONString(emailDTO)); 51 logger.info("列表请求参数:{}", JSON.toJSONString(emailDTO));
53 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 52 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
54 - if(CommonUtils.isNull(sessionUser)){  
55 - return "redirect:/users/login"; 53 + if (CommonUtils.isNull(sessionUser)) {
  54 + return "redirect:/users/login";
56 } 55 }
57 PageInfo<ShyEmail> emailPage = emailServiceImpl.getPage(emailDTO); 56 PageInfo<ShyEmail> emailPage = emailServiceImpl.getPage(emailDTO);
58 List<ShyEmail> list = emailPage.getList(); 57 List<ShyEmail> list = emailPage.getList();
59 JSONObject email_message = CommonConst.EMAIL_MESSAGE; 58 JSONObject email_message = CommonConst.EMAIL_MESSAGE;
60 if (!list.isEmpty()) { 59 if (!list.isEmpty()) {
61 for (ShyEmail shyEmail : list) { 60 for (ShyEmail shyEmail : list) {
62 - //获取更新人的名称  
63 - String updater="";  
64 - if (CommonUtils.isNotEmpty(shyEmail.getUpdater())) {  
65 - ShyUsers user = new ShyUsers();  
66 - user.setUser_id(shyEmail.getUpdater());  
67 - user = usersService.select(user);  
68 - if (CommonUtils.isNotNull(user)) {  
69 - String email_add = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();  
70 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email_add : user.getUsername();  
71 - updater = userName;  
72 - }  
73 - }  
74 - shyEmail.setUpdater(updater);  
75 -  
76 - //获取邮件消息类型名称  
77 - String email_type_name=shyEmail.getNotice_type();  
78 - if(CommonUtils.isNotEmpty(email_type_name)){  
79 - for (String bkey : email_message.keySet()) {  
80 - email_type_name = email_type_name.replace(bkey, email_message.getString(bkey));  
81 - }  
82 - }else{  
83 - email_type_name="无";  
84 - }  
85 - shyEmail.setEmail_type_name(email_type_name); 61 + //获取更新人的名称
  62 + String updater = "";
  63 + if (CommonUtils.isNotEmpty(shyEmail.getUpdater())) {
  64 + ShyUsers user = new ShyUsers();
  65 + user.setUser_id(shyEmail.getUpdater());
  66 + user = usersService.select(user);
  67 + if (CommonUtils.isNotNull(user)) {
  68 + String email_add = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  69 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email_add : user.getUsername();
  70 + updater = userName;
  71 + }
  72 + }
  73 + shyEmail.setUpdater(updater);
  74 +
  75 + //获取邮件消息类型名称
  76 + String email_type_name = shyEmail.getNotice_type();
  77 + if (CommonUtils.isNotEmpty(email_type_name)) {
  78 + for (String bkey : email_message.keySet()) {
  79 + email_type_name = email_type_name.replace(bkey, email_message.getString(bkey));
  80 + }
  81 + } else {
  82 + email_type_name = "无";
  83 + }
  84 + shyEmail.setEmail_type_name(email_type_name);
86 } 85 }
87 } 86 }
88 model.addAttribute("emailPage", emailPage); 87 model.addAttribute("emailPage", emailPage);
@@ -90,37 +89,37 @@ public class EmailController extends BaseController { @@ -90,37 +89,37 @@ public class EmailController extends BaseController {
90 model.addAttribute("email_message", email_message); 89 model.addAttribute("email_message", email_message);
91 return "page/email.html"; 90 return "page/email.html";
92 } 91 }
93 - 92 +
94 @PostMapping("/updateState") 93 @PostMapping("/updateState")
95 @ResponseBody 94 @ResponseBody
96 public ResponseBean updateState(Integer id, Boolean isEnable, HttpSession session) { 95 public ResponseBean updateState(Integer id, Boolean isEnable, HttpSession session) {
97 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
98 - Integer n = emailServiceImpl.updateState(id, isEnable,sessionUser.getUserId());  
99 - if(n>0){  
100 - return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "当前用户"+(isEnable==true?"启用":"禁用")+"成功"); 96 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  97 + Integer n = emailServiceImpl.updateState(id, isEnable, sessionUser.getUserId());
  98 + if (n > 0) {
  99 + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "当前用户" + (isEnable == true ? "启用" : "禁用") + "成功");
101 } 100 }
102 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试"); 101 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试");
103 } 102 }
  103 +
104 @PostMapping("/deleted") 104 @PostMapping("/deleted")
105 @ResponseBody 105 @ResponseBody
106 - public ResponseBean deleted(Integer id,HttpSession session) {  
107 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
108 - Integer n = emailServiceImpl.deleted(id, sessionUser.getUserId());  
109 - if(n>0){  
110 - return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "数据删除成功");  
111 - }  
112 - return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试"); 106 + public ResponseBean deleted(Integer id, HttpSession session) {
  107 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  108 + Integer n = emailServiceImpl.deleted(id, sessionUser.getUserId());
  109 + if (n > 0) {
  110 + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "数据删除成功");
  111 + }
  112 + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试");
113 } 113 }
114 -  
115 - 114 +
116 115
117 @PostMapping(value = "/write") 116 @PostMapping(value = "/write")
118 - public String write(Model model,Integer id,String email,String remark, String[] write_business, HttpSession session, String redirect_url) {  
119 - if(CommonUtils.isEmpty(email)&&CommonUtils.isEmpty(remark)){  
120 - setmodelParam(model,"email,remark不能为空");  
121 - return "error.html";  
122 - }  
123 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 117 + public String write(Model model, Integer id, String email, String remark, String[] write_business, HttpSession session, String redirect_url) {
  118 + if (CommonUtils.isEmpty(email) && CommonUtils.isEmpty(remark)) {
  119 + setmodelParam(model, "email,remark不能为空");
  120 + return "error.html";
  121 + }
  122 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
124 String write = ""; 123 String write = "";
125 if (CommonUtils.isNotNull(write_business) && write_business.length > 0) { 124 if (CommonUtils.isNotNull(write_business) && write_business.length > 0) {
126 for (String w : write_business) { 125 for (String w : write_business) {
@@ -128,13 +127,13 @@ public class EmailController extends BaseController { @@ -128,13 +127,13 @@ public class EmailController extends BaseController {
128 } 127 }
129 write = write.substring(1); 128 write = write.substring(1);
130 } 129 }
131 - boolean success = emailServiceImpl.update(id,email,remark,write,sessionUser.getUserId()); 130 + boolean success = emailServiceImpl.update(id, email, remark, write, sessionUser.getUserId());
132 if (success) { 131 if (success) {
133 return "redirect:" + redirect_url; 132 return "redirect:" + redirect_url;
134 } else { 133 } else {
135 - setmodelResult(model);  
136 - return "error.html"; 134 + setmodelResult(model);
  135 + return "error.html";
137 } 136 }
138 } 137 }
139 - 138 +
140 } 139 }
src/main/java/com/cnlive/shenhe/controller/LiveApplyController.java
@@ -52,66 +52,66 @@ public class LiveApplyController extends BaseController { @@ -52,66 +52,66 @@ public class LiveApplyController extends BaseController {
52 UsersServiceImpl usersService; 52 UsersServiceImpl usersService;
53 @Autowired 53 @Autowired
54 SitesServiceImpl sitesService; 54 SitesServiceImpl sitesService;
55 - @Autowired  
56 - LiveServiceImpl liveService; 55 + @Autowired
  56 + LiveServiceImpl liveService;
  57 +
57 58
58 -  
59 @Value("${spring.localhost.url}") 59 @Value("${spring.localhost.url}")
60 - private String localhost_url;//本机地址  
61 -  
62 -  
63 - @Autowired  
64 - LiveApplyServiceImpl liveApplyServiceImpl; 60 + private String localhost_url;//本机地址
  61 +
  62 +
  63 + @Autowired
  64 + LiveApplyServiceImpl liveApplyServiceImpl;
65 65
66 /** 66 /**
67 * 直播申请审核信息回调接口 67 * 直播申请审核信息回调接口
68 * 68 *
69 - * @param ids 视频id  
70 - * @param state 状态码 69 + * @param ids 视频id
  70 + * @param state 状态码
71 * @param 71 * @param
72 - * @param msg 备注信息 72 + * @param msg 备注信息
73 * @return 73 * @return
74 */ 74 */
75 @PostMapping("/shenheLiveApply") 75 @PostMapping("/shenheLiveApply")
76 @ResponseBody 76 @ResponseBody
77 - public ResponseBean shenheInfo(String ids, Integer state, String msg, HttpSession session) {  
78 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
79 - String userId = sessionUser.getUserId();  
80 - ResponseBean responseBean = new ResponseBean();  
81 - String[] shyLiveApplyIds = ids.split(",");  
82 - String showMsg = "";  
83 - for (String shyLiveApplyId : shyLiveApplyIds) {  
84 - ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(shyLiveApplyId));  
85 - JSONObject result = null;  
86 - try {  
87 - result = Pass.liveApplyPass(shyLiveapply.getActivity_id(), state+2, msg, msg, shyLiveapply.getCallback());  
88 - } catch (Exception e) {  
89 - logger.error("直播视频审核失败,id==" + shyLiveApplyId, e);  
90 - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败";  
91 - break;  
92 - }  
93 - if (result == null) {  
94 - logger.error("直播视频审核失败且接口错误没有返回信息,id==" + shyLiveApplyId);  
95 - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败";  
96 - break;  
97 - }  
98 - Integer code = result.getInteger("errorCode");  
99 - if (code != 0) {  
100 - logger.error("直播视频审核失败,id:{},code:{}", shyLiveApplyId, code);  
101 - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " " + result.getString(" errorMessage");  
102 - break;  
103 - }  
104 - int i = liveApplyServiceImpl.updateLiveApply(Integer.parseInt(shyLiveApplyId), userId,"", state, msg);  
105 - if (i == 0) {  
106 - showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 更新失败";  
107 - break;  
108 - }  
109 - }  
110 - if (CommonUtils.isNotEmpty(showMsg)) {  
111 - responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());  
112 - responseBean.setErrorMessage(showMsg);  
113 - }  
114 - return responseBean; 77 + public ResponseBean shenheInfo(String ids, Integer state, String msg, HttpSession session) {
  78 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  79 + String userId = sessionUser.getUserId();
  80 + ResponseBean responseBean = new ResponseBean();
  81 + String[] shyLiveApplyIds = ids.split(",");
  82 + String showMsg = "";
  83 + for (String shyLiveApplyId : shyLiveApplyIds) {
  84 + ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(shyLiveApplyId));
  85 + JSONObject result = null;
  86 + try {
  87 + result = Pass.liveApplyPass(shyLiveapply.getActivity_id(), state + 2, msg, msg, shyLiveapply.getCallback());
  88 + } catch (Exception e) {
  89 + logger.error("直播视频审核失败,id==" + shyLiveApplyId, e);
  90 + showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败";
  91 + break;
  92 + }
  93 + if (result == null) {
  94 + logger.error("直播视频审核失败且接口错误没有返回信息,id==" + shyLiveApplyId);
  95 + showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 拒绝请求失败";
  96 + break;
  97 + }
  98 + Integer code = result.getInteger("errorCode");
  99 + if (code != 0) {
  100 + logger.error("直播视频审核失败,id:{},code:{}", shyLiveApplyId, code);
  101 + showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " " + result.getString(" errorMessage");
  102 + break;
  103 + }
  104 + int i = liveApplyServiceImpl.updateLiveApply(Integer.parseInt(shyLiveApplyId), userId, "", state, msg);
  105 + if (i == 0) {
  106 + showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 更新失败";
  107 + break;
  108 + }
  109 + }
  110 + if (CommonUtils.isNotEmpty(showMsg)) {
  111 + responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());
  112 + responseBean.setErrorMessage(showMsg);
  113 + }
  114 + return responseBean;
115 } 115 }
116 116
117 /** 117 /**
@@ -123,49 +123,49 @@ public class LiveApplyController extends BaseController { @@ -123,49 +123,49 @@ public class LiveApplyController extends BaseController {
123 @GetMapping("/page") 123 @GetMapping("/page")
124 public Object getListLiveApply(Model model, LiveApplyDTO liveApplyDTO, HttpSession session) { 124 public Object getListLiveApply(Model model, LiveApplyDTO liveApplyDTO, HttpSession session) {
125 logger.info("列表请求参数:{}", JSON.toJSONString(liveApplyDTO)); 125 logger.info("列表请求参数:{}", JSON.toJSONString(liveApplyDTO));
126 - System.out.println("进入直播申请内容页"); 126 + System.out.println("进入直播申请内容页");
127 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 127 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
128 - if(CommonUtils.isNull(sessionUser)){  
129 - return "redirect:/users/login"; 128 + if (CommonUtils.isNull(sessionUser)) {
  129 + return "redirect:/users/login";
130 } 130 }
131 Integer spid = sessionUser.getSpid(); 131 Integer spid = sessionUser.getSpid();
132 liveApplyDTO.setSpid(spid); 132 liveApplyDTO.setSpid(spid);
133 String userId = sessionUser.getUserId(); 133 String userId = sessionUser.getUserId();
134 liveApplyDTO.setUserId(userId); 134 liveApplyDTO.setUserId(userId);
135 if (CommonUtils.isNotEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) { 135 if (CommonUtils.isNotEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) {
136 - ShySites shySite=sitesService.findspidBySpdesc(liveApplyDTO.getSp_desc());  
137 - if(CommonUtils.isNotNull(shySite)){  
138 - liveApplyDTO.setSpid(shySite.getSpid());  
139 - }else{  
140 - setmodelSite(model);  
141 - return "error.html";  
142 - } 136 + ShySites shySite = sitesService.findspidBySpdesc(liveApplyDTO.getSp_desc());
  137 + if (CommonUtils.isNotNull(shySite)) {
  138 + liveApplyDTO.setSpid(shySite.getSpid());
  139 + } else {
  140 + setmodelSite(model);
  141 + return "error.html";
  142 + }
143 } else if (CommonUtils.isEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) { 143 } else if (CommonUtils.isEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) {
144 liveApplyDTO.setSpid(null); 144 liveApplyDTO.setSpid(null);
145 - } 145 + }
146 PageInfo<ShyLiveapply> liveApplyPage = liveApplyServiceImpl.getListLiveApply(liveApplyDTO); 146 PageInfo<ShyLiveapply> liveApplyPage = liveApplyServiceImpl.getListLiveApply(liveApplyDTO);
147 List<ShyLiveapply> list = liveApplyPage.getList(); 147 List<ShyLiveapply> list = liveApplyPage.getList();
148 if (!list.isEmpty()) { 148 if (!list.isEmpty()) {
149 for (ShyLiveapply liveApply : list) { 149 for (ShyLiveapply liveApply : list) {
150 - if (!liveApply.getShenhe_state().equals(CommonConst.AUDIT_INTT)) {  
151 - String updater =CommonUtils.isEmpty(liveApply.getUpdater()) || "null".equals(liveApply.getUpdater())? "白名单":liveApply.getUpdater();  
152 - String auditor_id = liveApply.getAuditor();  
153 - if (CommonUtils.isNotEmpty(auditor_id)) {  
154 - ShyUsers user = new ShyUsers();  
155 - user.setUser_id(auditor_id);  
156 - user = usersService.select(user);  
157 - if (CommonUtils.isNotNull(user)) {  
158 - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();  
159 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();  
160 - updater = userName;  
161 - }  
162 - }  
163 - liveApply.setUpdater(updater);  
164 - } 150 + if (!liveApply.getShenhe_state().equals(CommonConst.AUDIT_INTT)) {
  151 + String updater = CommonUtils.isEmpty(liveApply.getUpdater()) || "null".equals(liveApply.getUpdater()) ? "白名单" : liveApply.getUpdater();
  152 + String auditor_id = liveApply.getAuditor();
  153 + if (CommonUtils.isNotEmpty(auditor_id)) {
  154 + ShyUsers user = new ShyUsers();
  155 + user.setUser_id(auditor_id);
  156 + user = usersService.select(user);
  157 + if (CommonUtils.isNotNull(user)) {
  158 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  159 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  160 + updater = userName;
  161 + }
  162 + }
  163 + liveApply.setUpdater(updater);
  164 + }
165 //显示spid简称 165 //显示spid简称
166 ShySites shySites = sitesService.findspidDescByspid(liveApply.getSp_id()); 166 ShySites shySites = sitesService.findspidDescByspid(liveApply.getSp_id());
167 if (CommonUtils.isNotNull(shySites)) { 167 if (CommonUtils.isNotNull(shySites)) {
168 - liveApply.setSpid_desc(shySites.getName()); 168 + liveApply.setSpid_desc(shySites.getName());
169 } 169 }
170 } 170 }
171 } 171 }
@@ -182,14 +182,14 @@ public class LiveApplyController extends BaseController { @@ -182,14 +182,14 @@ public class LiveApplyController extends BaseController {
182 */ 182 */
183 @GetMapping("/details") 183 @GetMapping("/details")
184 public Object getDetailsLive(Model model, Integer id) { 184 public Object getDetailsLive(Model model, Integer id) {
185 - ShyLiveapply shyLiveapply = liveApplyServiceImpl.getDetailsLive(id);  
186 - 185 + ShyLiveapply shyLiveapply = liveApplyServiceImpl.getDetailsLive(id);
  186 +
187 //显示spid简称 187 //显示spid简称
188 ShySites shySites = sitesService.findspidDescByspid(shyLiveapply.getSp_id()); 188 ShySites shySites = sitesService.findspidDescByspid(shyLiveapply.getSp_id());
189 if (CommonUtils.isNotNull(shySites)) { 189 if (CommonUtils.isNotNull(shySites)) {
190 - shyLiveapply.setSpid_desc(shySites.getName()); 190 + shyLiveapply.setSpid_desc(shySites.getName());
191 } 191 }
192 - 192 +
193 model.addAttribute("shyLiveapply", shyLiveapply); 193 model.addAttribute("shyLiveapply", shyLiveapply);
194 194
195 return "page/liveApplyDetail.html"; 195 return "page/liveApplyDetail.html";
@@ -213,7 +213,7 @@ public class LiveApplyController extends BaseController { @@ -213,7 +213,7 @@ public class LiveApplyController extends BaseController {
213 if (CommonUtils.isNotEmpty(ids)) { 213 if (CommonUtils.isNotEmpty(ids)) {
214 String[] cids = ids.split(","); 214 String[] cids = ids.split(",");
215 for (String cid : cids) { 215 for (String cid : cids) {
216 - ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(cid)); 216 + ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(cid));
217 if (CommonUtils.isNotNull(shyLiveapply)) { 217 if (CommonUtils.isNotNull(shyLiveapply)) {
218 if (!shyLiveapply.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) { 218 if (!shyLiveapply.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) {
219 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "您领取的内容中有已被领取或者已经被审核,请检查并重试"); 219 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "您领取的内容中有已被领取或者已经被审核,请检查并重试");
@@ -231,6 +231,7 @@ public class LiveApplyController extends BaseController { @@ -231,6 +231,7 @@ public class LiveApplyController extends BaseController {
231 231
232 /** 232 /**
233 * 退领 233 * 退领
  234 + *
234 * @param ids 235 * @param ids
235 * @param session 236 * @param session
236 * @return 237 * @return
@@ -243,8 +244,8 @@ public class LiveApplyController extends BaseController { @@ -243,8 +244,8 @@ public class LiveApplyController extends BaseController {
243 //在退领操作前先判断是否包含已退领或者已经审核的数据,有则退回检查并重新退领 244 //在退领操作前先判断是否包含已退领或者已经审核的数据,有则退回检查并重新退领
244 String[] cids = ids.split(","); 245 String[] cids = ids.split(",");
245 for (String cid : cids) { 246 for (String cid : cids) {
246 - ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(cid));  
247 - if (!shyLiveapply.getReceive().equals(CommonConst.RECEIVE_AFTER) || !shyLiveapply.getAuditor().equals(userId)|| !shyLiveapply.getShenhe_state().equals(CommonConst.AUDIT_INTT)) { 247 + ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(cid));
  248 + if (!shyLiveapply.getReceive().equals(CommonConst.RECEIVE_AFTER) || !shyLiveapply.getAuditor().equals(userId) || !shyLiveapply.getShenhe_state().equals(CommonConst.AUDIT_INTT)) {
248 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,您选中的内容包含已退领的或已经审核的"); 249 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,您选中的内容包含已退领的或已经审核的");
249 } 250 }
250 } 251 }
@@ -268,7 +269,7 @@ public class LiveApplyController extends BaseController { @@ -268,7 +269,7 @@ public class LiveApplyController extends BaseController {
268 String[] shyLiveIds = ids.split(","); 269 String[] shyLiveIds = ids.split(",");
269 String showMsg = ""; 270 String showMsg = "";
270 for (String shyLiveId : shyLiveIds) { 271 for (String shyLiveId : shyLiveIds) {
271 - ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(shyLiveId)); 272 + ShyLiveapply shyLiveapply = liveApplyServiceImpl.selectByPrimaryKey(Integer.parseInt(shyLiveId));
272 JSONObject result = null; 273 JSONObject result = null;
273 try { 274 try {
274 result = Pass.liveApplyPass(shyLiveapply.getActivity_id(), 4, msg, msg, shyLiveapply.getCallback()); 275 result = Pass.liveApplyPass(shyLiveapply.getActivity_id(), 4, msg, msg, shyLiveapply.getCallback());
@@ -288,7 +289,7 @@ public class LiveApplyController extends BaseController { @@ -288,7 +289,7 @@ public class LiveApplyController extends BaseController {
288 showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " " + result.getString(" errorMessage"); 289 showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " " + result.getString(" errorMessage");
289 break; 290 break;
290 } 291 }
291 - int i = liveService.updateLive(Integer.parseInt(shyLiveId), userId,"", 4, msg); 292 + int i = liveService.updateLive(Integer.parseInt(shyLiveId), userId, "", 4, msg);
292 if (i == 0) { 293 if (i == 0) {
293 showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 更新失败"; 294 showMsg = showMsg + "," + shyLiveapply.getActivity_id() + " 更新失败";
294 break; 295 break;
@@ -300,165 +301,165 @@ public class LiveApplyController extends BaseController { @@ -300,165 +301,165 @@ public class LiveApplyController extends BaseController {
300 } 301 }
301 return responseBean; 302 return responseBean;
302 } 303 }
303 - 304 +
304 /** 305 /**
305 - * 根据条件导出excel  
306 - */  
307 - @GetMapping("excel")  
308 - public void getExcel(LiveApplyDTO liveApplyDTO, HttpSession session,HttpServletResponse response) {  
309 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
310 - Integer spid = sessionUser.getSpid();  
311 - liveApplyDTO.setSpid(spid);  
312 - String userId = sessionUser.getUserId();  
313 - liveApplyDTO.setUserId(userId);  
314 - if (CommonUtils.isNotEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) {  
315 - ShySites shySite=sitesService.findspidBySpdesc(liveApplyDTO.getSp_desc());  
316 - if(CommonUtils.isNotNull(shySite)){  
317 - liveApplyDTO.setSpid(shySite.getSpid());  
318 - }  
319 - }else if (CommonUtils.isEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) {  
320 - liveApplyDTO.setSpid(null);  
321 - }  
322 - List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findByCondition(liveApplyDTO); 306 + * 根据条件导出excel
  307 + */
  308 + @GetMapping("excel")
  309 + public void getExcel(LiveApplyDTO liveApplyDTO, HttpSession session, HttpServletResponse response) {
  310 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  311 + Integer spid = sessionUser.getSpid();
  312 + liveApplyDTO.setSpid(spid);
  313 + String userId = sessionUser.getUserId();
  314 + liveApplyDTO.setUserId(userId);
  315 + if (CommonUtils.isNotEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) {
  316 + ShySites shySite = sitesService.findspidBySpdesc(liveApplyDTO.getSp_desc());
  317 + if (CommonUtils.isNotNull(shySite)) {
  318 + liveApplyDTO.setSpid(shySite.getSpid());
  319 + }
  320 + } else if (CommonUtils.isEmpty(liveApplyDTO.getSp_desc()) && liveApplyDTO.getSpid() == 0) {
  321 + liveApplyDTO.setSpid(null);
  322 + }
  323 + List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findByCondition(liveApplyDTO);
  324 +
  325 + String fileName = "直播申请数据";
  326 +
  327 + XSSFWorkbook wb = new XSSFWorkbook();
  328 + ServletOutputStream out = null;
  329 + BufferedInputStream bis = null;
  330 + BufferedOutputStream bos = null;
  331 + try {
  332 + XSSFSheet sheetlist = wb.createSheet(fileName);
  333 + XSSFRow row = sheetlist.createRow(0);//行
  334 + XSSFCell cell = row.createCell(0);//列
  335 + cell.setCellValue("id");
  336 + cell = row.createCell(1);//列
  337 + cell.setCellValue("直播日期");
  338 + cell = row.createCell(2);//列
  339 + cell.setCellValue("预计开始时间");
  340 + cell = row.createCell(3);//列
  341 + cell.setCellValue("预计结束时间");
  342 + cell = row.createCell(4);//列
  343 + cell.setCellValue("直播主题");
  344 + cell = row.createCell(5);//列
  345 + cell.setCellValue("spn昵称");
  346 + cell = row.createCell(6);//列
  347 + cell.setCellValue("直播申请方");
  348 + cell = row.createCell(7);//列
  349 + cell.setCellValue("直播类型");
  350 + cell = row.createCell(8);//列
  351 + cell.setCellValue("直播简介");
  352 + cell = row.createCell(9);//列
  353 + cell.setCellValue("频道_id");
  354 + cell = row.createCell(10);//列
  355 + cell.setCellValue("直播活动id");
  356 + cell = row.createCell(11);//列
  357 + cell.setCellValue("创建时间");
  358 +
  359 + for (int i = 0; i < liveApplyList.size(); i++) {
  360 + row = sheetlist.createRow((short) (i + 1));//行
  361 + cell = row.createCell(0);//列
  362 + cell.setCellValue(liveApplyList.get(i).getId());
  363 + cell = row.createCell(1);//列
  364 + cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getPre_start_time(), "yyyy/MM/dd"));
  365 + cell = row.createCell(2);//列
  366 + cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getPre_start_time(), "HH:mm"));
  367 + String endTime = "";
  368 + long start = liveApplyList.get(i).getPre_start_time().getTime() + 8 * 60 * 60 * 1000;
  369 + if (CommonUtils.isNull(liveApplyList.get(i).getPre_end_time())) {//结束时间为空
  370 + endTime = "待定";
  371 + } else {
  372 + long end = liveApplyList.get(i).getPre_end_time().getTime() + 8 * 60 * 60 * 1000;
  373 + long count = end / (24 * 3600 * 1000) - start / (24 * 3600 * 1000);
  374 + logger.info(String.valueOf(count));
  375 + if (count == 0) {
  376 + endTime = CommonUtils.formatDate(liveApplyList.get(i).getPre_end_time(), "HH:mm");
  377 + } else if (count > 0) {
  378 + endTime = "跨" + count + "天 " + CommonUtils.formatDate(liveApplyList.get(i).getPre_end_time(), "HH:mm");
  379 + }
  380 + }
  381 + cell = row.createCell(3);//列
  382 + cell.setCellValue(endTime);
  383 + cell = row.createCell(4);//列
  384 + cell.setCellValue(liveApplyList.get(i).getTheme());
  385 + cell = row.createCell(5);//列
  386 + cell.setCellValue(sitesService.findspidDescByspid(liveApplyList.get(i).getSp_id()).getName());
  387 + cell = row.createCell(6);//列
  388 + cell.setCellValue(liveApplyList.get(i).getOrganization());
  389 + cell = row.createCell(7);//列
  390 + cell.setCellValue(liveApplyList.get(i).getLive_type());
  391 + cell = row.createCell(8);//列
  392 + cell.setCellValue(liveApplyList.get(i).getSimple_content());
  393 + cell = row.createCell(9);//列
  394 + cell.setCellValue(liveApplyList.get(i).getChannel_id());
  395 + cell = row.createCell(10);//列
  396 + cell.setCellValue(liveApplyList.get(i).getActivity_id());
  397 + cell = row.createCell(11);//列
  398 + cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getCreated_at(), "yyyy-MM-dd HH:mm"));
  399 + }
323 400
324 - String fileName = "直播申请数据";  
325 -  
326 - XSSFWorkbook wb = new XSSFWorkbook();  
327 - ServletOutputStream out = null;  
328 - BufferedInputStream bis = null;  
329 - BufferedOutputStream bos = null;  
330 - try {  
331 - XSSFSheet sheetlist = wb.createSheet(fileName);  
332 - XSSFRow row = sheetlist.createRow(0);//行  
333 - XSSFCell cell = row.createCell(0);//列  
334 - cell.setCellValue("id");  
335 - cell = row.createCell(1);//列  
336 - cell.setCellValue("直播日期");  
337 - cell = row.createCell(2);//列  
338 - cell.setCellValue("预计开始时间");  
339 - cell = row.createCell(3);//列  
340 - cell.setCellValue("预计结束时间");  
341 - cell = row.createCell(4);//列  
342 - cell.setCellValue("直播主题");  
343 - cell = row.createCell(5);//列  
344 - cell.setCellValue("spn昵称");  
345 - cell = row.createCell(6);//列  
346 - cell.setCellValue("直播申请方");  
347 - cell = row.createCell(7);//列  
348 - cell.setCellValue("直播类型");  
349 - cell = row.createCell(8);//列  
350 - cell.setCellValue("直播简介");  
351 - cell = row.createCell(9);//列  
352 - cell.setCellValue("频道_id");  
353 - cell = row.createCell(10);//列  
354 - cell.setCellValue("直播活动id");  
355 - cell = row.createCell(11);//列  
356 - cell.setCellValue("创建时间");  
357 -  
358 - for (int i = 0; i < liveApplyList.size(); i++) {  
359 - row = sheetlist.createRow((short) (i + 1));//行  
360 - cell = row.createCell(0);//列  
361 - cell.setCellValue(liveApplyList.get(i).getId());  
362 - cell = row.createCell(1);//列  
363 - cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getPre_start_time(), "yyyy/MM/dd"));  
364 - cell = row.createCell(2);//列  
365 - cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getPre_start_time(), "HH:mm"));  
366 - String endTime="";  
367 - long start = liveApplyList.get(i).getPre_start_time().getTime()+8*60*60*1000;  
368 - if(CommonUtils.isNull(liveApplyList.get(i).getPre_end_time())){//结束时间为空  
369 - endTime="待定";  
370 - }else{  
371 - long end = liveApplyList.get(i).getPre_end_time().getTime()+8*60*60*1000;  
372 - long count=end/(24*3600*1000)-start/(24*3600*1000);  
373 - logger.info(String.valueOf(count));  
374 - if(count==0){  
375 - endTime=CommonUtils.formatDate(liveApplyList.get(i).getPre_end_time(), "HH:mm");  
376 - }else if(count > 0){  
377 - endTime="跨"+count+"天 "+CommonUtils.formatDate(liveApplyList.get(i).getPre_end_time(), "HH:mm");  
378 - }  
379 - }  
380 - cell = row.createCell(3);//列  
381 - cell.setCellValue(endTime);  
382 - cell = row.createCell(4);//列  
383 - cell.setCellValue(liveApplyList.get(i).getTheme());  
384 - cell = row.createCell(5);//列  
385 - cell.setCellValue(sitesService.findspidDescByspid(liveApplyList.get(i).getSp_id()).getName());  
386 - cell = row.createCell(6);//列  
387 - cell.setCellValue(liveApplyList.get(i).getOrganization());  
388 - cell = row.createCell(7);//列  
389 - cell.setCellValue(liveApplyList.get(i).getLive_type());  
390 - cell = row.createCell(8);//列  
391 - cell.setCellValue(liveApplyList.get(i).getSimple_content());  
392 - cell = row.createCell(9);//列  
393 - cell.setCellValue(liveApplyList.get(i).getChannel_id());  
394 - cell = row.createCell(10);//列  
395 - cell.setCellValue(liveApplyList.get(i).getActivity_id());  
396 - cell = row.createCell(11);//列  
397 - cell.setCellValue(CommonUtils.formatDate(liveApplyList.get(i).getCreated_at(), "yyyy-MM-dd HH:mm"));  
398 - } 401 + ByteArrayOutputStream os = new ByteArrayOutputStream();
  402 + wb.write(os);
  403 + byte[] content = os.toByteArray();
  404 + InputStream is = new ByteArrayInputStream(content);
  405 + response.setContentType("application/vnd.ms-excel;charset=utf-8");
  406 + response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), "iso-8859-1"));
  407 + out = response.getOutputStream();
  408 + bis = new BufferedInputStream(is);
  409 + bos = new BufferedOutputStream(out);
  410 + byte[] buff = new byte[2048];
  411 + int bytesRead;
  412 + while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
  413 + bos.write(buff, 0, bytesRead);
  414 + }
  415 + } catch (final Exception e) {
  416 + e.printStackTrace();
  417 + try {
  418 + if (bis != null) {
  419 + bis.close();
  420 + }
  421 + if (bos != null) {
  422 + bos.close();
  423 + }
  424 + } catch (Exception e1) {
  425 + e1.printStackTrace();
  426 + }
  427 + } finally {
  428 + try {
  429 + if (bis != null) {
  430 + bis.close();
  431 + }
  432 + if (bos != null) {
  433 + bos.close();
  434 + }
  435 + } catch (Exception e2) {
  436 + e2.printStackTrace();
  437 + }
  438 + }
  439 + }
399 440
400 - ByteArrayOutputStream os = new ByteArrayOutputStream();  
401 - wb.write(os);  
402 - byte[] content = os.toByteArray();  
403 - InputStream is = new ByteArrayInputStream(content);  
404 - response.setContentType("application/vnd.ms-excel;charset=utf-8");  
405 - response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), "iso-8859-1"));  
406 - out = response.getOutputStream();  
407 - bis = new BufferedInputStream(is);  
408 - bos = new BufferedOutputStream(out);  
409 - byte[] buff = new byte[2048];  
410 - int bytesRead;  
411 - while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {  
412 - bos.write(buff, 0, bytesRead);  
413 - }  
414 - } catch (final Exception e) {  
415 - e.printStackTrace();  
416 - try {  
417 - if (bis != null) {  
418 - bis.close();  
419 - }  
420 - if (bos != null) {  
421 - bos.close();  
422 - }  
423 - } catch (Exception e1) {  
424 - e1.printStackTrace();  
425 - }  
426 - } finally {  
427 - try {  
428 - if (bis != null) {  
429 - bis.close();  
430 - }  
431 - if (bos != null) {  
432 - bos.close();  
433 - }  
434 - } catch (Exception e2) {  
435 - e2.printStackTrace();  
436 - }  
437 - }  
438 - }  
439 -  
440 - /**  
441 - * @Auther: liwei  
442 - * @Date: 2019/11/08 11:17  
443 - * @Description: 直播申请前台通知接口  
444 - */  
445 - @GetMapping("/liveApplyNotice")  
446 - @ResponseBody  
447 - public Map<String, Object> channelNotice() {  
448 - Map<String, Object> map = new HashMap<>();  
449 - ShyLiveapply shyLiveapply = new ShyLiveapply();  
450 - shyLiveapply.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 审核类型为人工审  
451 - shyLiveapply.setShenhe_state(CommonConst.AUDIT_INTT);  
452 - List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findshyLiveApply(shyLiveapply);  
453 - if (liveApplyList.size() > 0) {  
454 - logger.info("您有" + liveApplyList.size() + "条新的直播申请,请注意查看!");  
455 - map.put("id", "2");// 第二个提示框,避免冲突  
456 - map.put("title", "新直播申请通知");  
457 - map.put("content", "您有" + liveApplyList.size() + "条新的直播申请,请注意查看!");  
458 - map.put("url", localhost_url + "/liveApply/page?shenhe_state=0&receive=0");  
459 - return map;  
460 - }  
461 - return null;  
462 - } 441 + /**
  442 + * @Auther: liwei
  443 + * @Date: 2019/11/08 11:17
  444 + * @Description: 直播申请前台通知接口
  445 + */
  446 + @GetMapping("/liveApplyNotice")
  447 + @ResponseBody
  448 + public Map<String, Object> channelNotice() {
  449 + Map<String, Object> map = new HashMap<>();
  450 + ShyLiveapply shyLiveapply = new ShyLiveapply();
  451 + shyLiveapply.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 审核类型为人工审
  452 + shyLiveapply.setShenhe_state(CommonConst.AUDIT_INTT);
  453 + List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findshyLiveApply(shyLiveapply);
  454 + if (liveApplyList.size() > 0) {
  455 + logger.info("您有" + liveApplyList.size() + "条新的直播申请,请注意查看!");
  456 + map.put("id", "2");// 第二个提示框,避免冲突
  457 + map.put("title", "新直播申请通知");
  458 + map.put("content", "您有" + liveApplyList.size() + "条新的直播申请,请注意查看!");
  459 + map.put("url", localhost_url + "/liveApply/page?shenhe_state=0&receive=0");
  460 + return map;
  461 + }
  462 + return null;
  463 + }
463 464
464 } 465 }
src/main/java/com/cnlive/shenhe/controller/LiveController.java
@@ -56,8 +56,8 @@ public class LiveController extends BaseController { @@ -56,8 +56,8 @@ public class LiveController extends BaseController {
56 UsersServiceImpl usersService; 56 UsersServiceImpl usersService;
57 @Autowired 57 @Autowired
58 SitesServiceImpl sitesService; 58 SitesServiceImpl sitesService;
59 - @Autowired  
60 - LiveServiceImpl liveService; 59 + @Autowired
  60 + LiveServiceImpl liveService;
61 61
62 @Value("${qn_domain}") 62 @Value("${qn_domain}")
63 String qn_domain; 63 String qn_domain;
@@ -84,29 +84,29 @@ public class LiveController extends BaseController { @@ -84,29 +84,29 @@ public class LiveController extends BaseController {
84 String userId = sessionUser.getUserId(); 84 String userId = sessionUser.getUserId();
85 // ShyVideos shyVideos = videosService.selectByPrimaryKey(id); 85 // ShyVideos shyVideos = videosService.selectByPrimaryKey(id);
86 // if (shyVideos.getReceive() && CommonUtils.isNotEmpty(shyVideos.getReceive_user_id()) && userId.equals(shyVideos.getReceive_user_id())) { 86 // if (shyVideos.getReceive() && CommonUtils.isNotEmpty(shyVideos.getReceive_user_id()) && userId.equals(shyVideos.getReceive_user_id())) {
87 - JSONObject result = null;  
88 - try {  
89 - result = Pass.auditPass(activity_id, state, attr_tags, msg, callback);  
90 - } catch (Exception e) {  
91 - e.printStackTrace();  
92 - System.out.println("视频审核失败");  
93 - return new ResponseBean(ErrorEnum.ERROR);  
94 - }  
95 - if (result == null) {  
96 - System.out.println("视频审核失败且接口错误没有返回信息");  
97 - return new ResponseBean(ErrorEnum.ERROR);  
98 - }  
99 - Integer code = result.getInteger("code");  
100 - if (code != 0) {  
101 - System.out.println("审核失败,code==" + code);  
102 - return new ResponseBean(code, result.getString("msg"));  
103 - }  
104 - state = state == 4 ? 2 : 1;  
105 - int i = videosService.updateVideo(id, userId,null,attr_tags, state, msg);  
106 - if (i == 0) {  
107 - return new ResponseBean(ErrorEnum.ERROR);  
108 - }  
109 - return new ResponseBean(ErrorEnum.SUCCESS); 87 + JSONObject result = null;
  88 + try {
  89 + result = Pass.auditPass(activity_id, state, attr_tags, msg, callback);
  90 + } catch (Exception e) {
  91 + e.printStackTrace();
  92 + System.out.println("视频审核失败");
  93 + return new ResponseBean(ErrorEnum.ERROR);
  94 + }
  95 + if (result == null) {
  96 + System.out.println("视频审核失败且接口错误没有返回信息");
  97 + return new ResponseBean(ErrorEnum.ERROR);
  98 + }
  99 + Integer code = result.getInteger("code");
  100 + if (code != 0) {
  101 + System.out.println("审核失败,code==" + code);
  102 + return new ResponseBean(code, result.getString("msg"));
  103 + }
  104 + state = state == 4 ? 2 : 1;
  105 + int i = videosService.updateVideo(id, userId, null, attr_tags, state, msg);
  106 + if (i == 0) {
  107 + return new ResponseBean(ErrorEnum.ERROR);
  108 + }
  109 + return new ResponseBean(ErrorEnum.SUCCESS);
110 // } 110 // }
111 // logger.error("领取逻辑不符,不能审核,Video_id:{}", shyVideos.getVideo_id()); 111 // logger.error("领取逻辑不符,不能审核,Video_id:{}", shyVideos.getVideo_id());
112 // return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "领取逻辑不符,不能审核"); 112 // return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "领取逻辑不符,不能审核");
@@ -194,13 +194,13 @@ public class LiveController extends BaseController { @@ -194,13 +194,13 @@ public class LiveController extends BaseController {
194 @GetMapping("/details") 194 @GetMapping("/details")
195 public Object getDetailsLive(Model model, Integer id) { 195 public Object getDetailsLive(Model model, Integer id) {
196 ShyLive live = liveService.getDetailsLive(id); 196 ShyLive live = liveService.getDetailsLive(id);
197 - 197 +
198 //显示spid简称 198 //显示spid简称
199 ShySites shySites = sitesService.findspidDescByspid(live.getSp_id()); 199 ShySites shySites = sitesService.findspidDescByspid(live.getSp_id());
200 if (CommonUtils.isNotNull(shySites)) { 200 if (CommonUtils.isNotNull(shySites)) {
201 - live.setSpid_desc(shySites.getName()); 201 + live.setSpid_desc(shySites.getName());
202 } 202 }
203 - 203 +
204 model.addAttribute("live", live); 204 model.addAttribute("live", live);
205 205
206 return "page/liveDetail.html"; 206 return "page/liveDetail.html";
@@ -242,6 +242,7 @@ public class LiveController extends BaseController { @@ -242,6 +242,7 @@ public class LiveController extends BaseController {
242 242
243 /** 243 /**
244 * 退领 244 * 退领
  245 + *
245 * @param ids 246 * @param ids
246 * @param session 247 * @param session
247 * @return 248 * @return
@@ -299,7 +300,7 @@ public class LiveController extends BaseController { @@ -299,7 +300,7 @@ public class LiveController extends BaseController {
299 showMsg = showMsg + "," + shyLive.getActivity_id() + " " + result.getString(" errorMessage"); 300 showMsg = showMsg + "," + shyLive.getActivity_id() + " " + result.getString(" errorMessage");
300 break; 301 break;
301 } 302 }
302 - int i = liveService.updateLive(Integer.parseInt(shyLiveId), userId,"", 4, msg); 303 + int i = liveService.updateLive(Integer.parseInt(shyLiveId), userId, "", 4, msg);
303 if (i == 0) { 304 if (i == 0) {
304 showMsg = showMsg + "," + shyLive.getActivity_id() + " 更新失败"; 305 showMsg = showMsg + "," + shyLive.getActivity_id() + " 更新失败";
305 break; 306 break;
@@ -311,7 +312,7 @@ public class LiveController extends BaseController { @@ -311,7 +312,7 @@ public class LiveController extends BaseController {
311 } 312 }
312 return responseBean; 313 return responseBean;
313 } 314 }
314 - 315 +
315 /** 316 /**
316 * 同步直播云信息 317 * 同步直播云信息
317 * 318 *
@@ -323,231 +324,230 @@ public class LiveController extends BaseController { @@ -323,231 +324,230 @@ public class LiveController extends BaseController {
323 @PostMapping("/syncLive") 324 @PostMapping("/syncLive")
324 @ResponseBody 325 @ResponseBody
325 public ResponseBean syncLive(String ids, HttpSession session) { 326 public ResponseBean syncLive(String ids, HttpSession session) {
326 - logger.info("同步直播云信息接口进入");  
327 - ResponseBean responseBean = new ResponseBean();  
328 - String[] shyLiveIds = ids.split(",");  
329 - String showMsg = "";  
330 - for (String shyLiveId : shyLiveIds) {  
331 - ShyLive shyLive = liveService.selectByPrimaryKey(Integer.parseInt(shyLiveId));  
332 - JSONObject result = null;  
333 - try {  
334 - result = Pass.syncLive(shyLive.getActivity_id());  
335 - } catch (Exception e) {  
336 - logger.error("直播云信息同步失败,id==" + shyLiveId, e);  
337 - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";  
338 - break;  
339 - }  
340 - if (result == null) {  
341 - logger.error("直播云信息同步失败且接口错误没有返回信息,id==" + shyLiveId);  
342 - showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";  
343 - break;  
344 - }  
345 - Integer code = result.getInteger("errorCode");  
346 - if (code != 0) {  
347 - logger.error("直播云信息同步失败,id:{},code:{}", shyLiveId, code);  
348 - showMsg = result.getString("errorMessage");  
349 - break;  
350 - }  
351 - }  
352 - if (CommonUtils.isNotEmpty(showMsg)) {  
353 - responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());  
354 - responseBean.setErrorMessage(showMsg);  
355 - }else{  
356 - showMsg="直播云信息同步成功";  
357 - responseBean.setErrorCode(ErrorEnum.SUCCESS.getErrorCode()); 327 + logger.info("同步直播云信息接口进入");
  328 + ResponseBean responseBean = new ResponseBean();
  329 + String[] shyLiveIds = ids.split(",");
  330 + String showMsg = "";
  331 + for (String shyLiveId : shyLiveIds) {
  332 + ShyLive shyLive = liveService.selectByPrimaryKey(Integer.parseInt(shyLiveId));
  333 + JSONObject result = null;
  334 + try {
  335 + result = Pass.syncLive(shyLive.getActivity_id());
  336 + } catch (Exception e) {
  337 + logger.error("直播云信息同步失败,id==" + shyLiveId, e);
  338 + showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";
  339 + break;
  340 + }
  341 + if (result == null) {
  342 + logger.error("直播云信息同步失败且接口错误没有返回信息,id==" + shyLiveId);
  343 + showMsg = showMsg + "," + shyLive.getActivity_id() + " 拒绝请求失败";
  344 + break;
  345 + }
  346 + Integer code = result.getInteger("errorCode");
  347 + if (code != 0) {
  348 + logger.error("直播云信息同步失败,id:{},code:{}", shyLiveId, code);
  349 + showMsg = result.getString("errorMessage");
  350 + break;
  351 + }
  352 + }
  353 + if (CommonUtils.isNotEmpty(showMsg)) {
  354 + responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode());
  355 + responseBean.setErrorMessage(showMsg);
  356 + } else {
  357 + showMsg = "直播云信息同步成功";
  358 + responseBean.setErrorCode(ErrorEnum.SUCCESS.getErrorCode());
358 responseBean.setErrorMessage(showMsg); 359 responseBean.setErrorMessage(showMsg);
359 } 360 }
360 - return responseBean; 361 + return responseBean;
361 } 362 }
362 - 363 +
363 /** 364 /**
364 - * 根据条件导出excel  
365 - */  
366 - @GetMapping("excel")  
367 - public void getExcel(LiveDTO liveDTO, HttpSession session,HttpServletResponse response) { 365 + * 根据条件导出excel
  366 + */
  367 + @GetMapping("excel")
  368 + public void getExcel(LiveDTO liveDTO, HttpSession session, HttpServletResponse response) {
368 369
369 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
370 - Integer spid = sessionUser.getSpid();  
371 - String userId = sessionUser.getUserId();  
372 - liveDTO.setSpid(spid);  
373 - liveDTO.setUserId(userId);  
374 - if (CommonUtils.isNotEmpty(liveDTO.getSp_desc()) && liveDTO.getSpid() == 0) {  
375 - ShySites shySite=sitesService.findspidBySpdesc(liveDTO.getSp_desc());  
376 - if(CommonUtils.isNotNull(shySite)){  
377 - liveDTO.setSpid(shySite.getSpid());  
378 - }  
379 - }else if (CommonUtils.isEmpty(liveDTO.getSp_desc()) && liveDTO.getSpid() == 0) {  
380 - liveDTO.setSpid(null);  
381 - }  
382 - List<ShyLive> liveList = liveService.findByCondition(liveDTO);  
383 -  
384 - String fileName = "直播数据";  
385 -  
386 - XSSFWorkbook wb = new XSSFWorkbook();  
387 - ServletOutputStream out = null;  
388 - BufferedInputStream bis = null;  
389 - BufferedOutputStream bos = null;  
390 - try {  
391 - XSSFSheet sheetlist = wb.createSheet(fileName);  
392 - XSSFRow row = sheetlist.createRow(0);//行  
393 - XSSFCell cell = row.createCell(0);//列  
394 - cell.setCellValue("id");  
395 - cell = row.createCell(1);//列  
396 - cell.setCellValue("预计直播日期");  
397 - cell = row.createCell(2);//列  
398 - cell.setCellValue("预计开始时间");  
399 - cell = row.createCell(3);//列  
400 - cell.setCellValue("预计结束时间");  
401 - cell = row.createCell(4);//列  
402 - cell.setCellValue("直播主题");  
403 - cell = row.createCell(5);//列  
404 - cell.setCellValue("直播申请方");  
405 - cell = row.createCell(6);//列  
406 - cell.setCellValue("直播类型");  
407 - cell = row.createCell(7);//列  
408 - cell.setCellValue("监播人");  
409 - cell = row.createCell(8);//列  
410 - cell.setCellValue("实际直播日期");  
411 - cell = row.createCell(9);//列  
412 - cell.setCellValue("实际开始时间");  
413 - cell = row.createCell(10);//列  
414 - cell.setCellValue("实际结束时间");  
415 - cell = row.createCell(11);//列  
416 - cell.setCellValue("时长");  
417 - cell = row.createCell(12);//列  
418 - cell.setCellValue("备注");  
419 - cell = row.createCell(13);//列  
420 - cell.setCellValue("版权来源");  
421 -  
422 - for (int i = 0; i < liveList.size(); i++) {  
423 - row = sheetlist.createRow((short) (i + 1));//行  
424 - cell = row.createCell(0);//列  
425 - cell.setCellValue(liveList.get(i).getId());  
426 - cell = row.createCell(1);//列  
427 - if (liveList.get(i).getPre_start_time() != null) {  
428 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getPre_start_time(), "yyyy/MM/dd"));  
429 - }  
430 - cell = row.createCell(2);//列  
431 - if (liveList.get(i).getPre_start_time() != null) {  
432 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getPre_start_time(), "HH:mm"));  
433 - }  
434 - /*预计结束时间需要处理成用户可读*/  
435 - String pre_endTime = ""; 370 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  371 + Integer spid = sessionUser.getSpid();
  372 + String userId = sessionUser.getUserId();
  373 + liveDTO.setSpid(spid);
  374 + liveDTO.setUserId(userId);
  375 + if (CommonUtils.isNotEmpty(liveDTO.getSp_desc()) && liveDTO.getSpid() == 0) {
  376 + ShySites shySite = sitesService.findspidBySpdesc(liveDTO.getSp_desc());
  377 + if (CommonUtils.isNotNull(shySite)) {
  378 + liveDTO.setSpid(shySite.getSpid());
  379 + }
  380 + } else if (CommonUtils.isEmpty(liveDTO.getSp_desc()) && liveDTO.getSpid() == 0) {
  381 + liveDTO.setSpid(null);
  382 + }
  383 + List<ShyLive> liveList = liveService.findByCondition(liveDTO);
436 384
437 - if (CommonUtils.isNull(liveList.get(i).getPre_end_time())) {//结束时间为空  
438 - pre_endTime = "待定";  
439 - } else {  
440 - long start = liveList.get(i).getPre_start_time().getTime() + 8 * 60 * 60 * 1000;  
441 - long end = liveList.get(i).getPre_end_time().getTime() + 8 * 60 * 60 * 1000;  
442 - long count = end / (24 * 3600 * 1000) - start / (24 * 3600 * 1000);  
443 - logger.info(String.valueOf(count));  
444 - if (count == 0) {  
445 - pre_endTime = CommonUtils.formatDate(liveList.get(i).getPre_end_time(), "HH:mm");  
446 - } else if (count > 0) {  
447 - pre_endTime = "跨" + count + "天 " + CommonUtils.formatDate(liveList.get(i).getPre_end_time(), "HH:mm");  
448 - }  
449 - }  
450 - cell = row.createCell(3);//列  
451 - cell.setCellValue(pre_endTime);  
452 - cell = row.createCell(4);//列  
453 - cell.setCellValue(liveList.get(i).getActivity_name());  
454 - cell = row.createCell(5);//列  
455 - cell.setCellValue(sitesService.findspidDescByspid(liveList.get(i).getSp_id()).getName());  
456 - cell = row.createCell(6);//列  
457 - cell.setCellValue(liveList.get(i).getLive_type());  
458 - cell = row.createCell(7);//列  
459 - /* 审核员需要做处理*/  
460 - String updater = "";//审核员名字  
461 - if (!liveList.get(i).getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) {  
462 - updater = CommonUtils.isEmpty(liveList.get(i).getUpdater()) || "null".equals(liveList.get(i).getUpdater()) ? "自动通过" : liveList.get(i).getUpdater();  
463 - String auditor_id = liveList.get(i).getAuditor();  
464 - if (CommonUtils.isNotEmpty(auditor_id)) {  
465 - ShyUsers user = new ShyUsers();  
466 - user.setUser_id(auditor_id);  
467 - user = usersService.select(user);  
468 - if (CommonUtils.isNotNull(user)) {  
469 - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();  
470 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();  
471 - updater = userName;  
472 - }  
473 - }  
474 - }  
475 - cell.setCellValue(updater);  
476 - cell = row.createCell(8);//列  
477 - if (liveList.get(i).getActivity_start_time() != null) {  
478 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_start_time(), "yyyy/MM/dd"));  
479 - }  
480 - cell = row.createCell(9);//列  
481 - if (liveList.get(i).getActivity_start_time() != null) {  
482 - cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_start_time(), "HH:mm"));  
483 - }  
484 - /*实际结束时间需要处理成用户可读*/  
485 - String Activity_endTime = "";  
486 - if (liveList.get(i).getActivity_start_time() != null && liveList.get(i).getActivity_end_time()!=null) {  
487 - long Activity_start = liveList.get(i).getActivity_start_time().getTime() + 8 * 60 * 60 * 1000;  
488 - long Activity_end = liveList.get(i).getActivity_end_time().getTime() + 8 * 60 * 60 * 1000;  
489 - long Activity_count = Activity_end / (24 * 3600 * 1000) - Activity_start / (24 * 3600 * 1000);  
490 - logger.info(String.valueOf(Activity_count));  
491 - if (Activity_count == 0) {  
492 - Activity_endTime = CommonUtils.formatDate(liveList.get(i).getActivity_end_time(), "HH:mm");  
493 - } else if (Activity_count > 0) {  
494 - Activity_endTime = "跨" + Activity_count + "天 " + CommonUtils.formatDate(liveList.get(i).getActivity_end_time(), "HH:mm");  
495 - } 385 + String fileName = "直播数据";
496 386
497 - cell = row.createCell(10);//列  
498 - cell.setCellValue(Activity_endTime);  
499 - cell = row.createCell(11);//时长  
500 - /*时长需要处理成用户可读,单位:分钟*/  
501 - long time_length = (Activity_end - Activity_start) / (60 * 1000);  
502 - cell.setCellValue(time_length); 387 + XSSFWorkbook wb = new XSSFWorkbook();
  388 + ServletOutputStream out = null;
  389 + BufferedInputStream bis = null;
  390 + BufferedOutputStream bos = null;
  391 + try {
  392 + XSSFSheet sheetlist = wb.createSheet(fileName);
  393 + XSSFRow row = sheetlist.createRow(0);//行
  394 + XSSFCell cell = row.createCell(0);//列
  395 + cell.setCellValue("id");
  396 + cell = row.createCell(1);//列
  397 + cell.setCellValue("预计直播日期");
  398 + cell = row.createCell(2);//列
  399 + cell.setCellValue("预计开始时间");
  400 + cell = row.createCell(3);//列
  401 + cell.setCellValue("预计结束时间");
  402 + cell = row.createCell(4);//列
  403 + cell.setCellValue("直播主题");
  404 + cell = row.createCell(5);//列
  405 + cell.setCellValue("直播申请方");
  406 + cell = row.createCell(6);//列
  407 + cell.setCellValue("直播类型");
  408 + cell = row.createCell(7);//列
  409 + cell.setCellValue("监播人");
  410 + cell = row.createCell(8);//列
  411 + cell.setCellValue("实际直播日期");
  412 + cell = row.createCell(9);//列
  413 + cell.setCellValue("实际开始时间");
  414 + cell = row.createCell(10);//列
  415 + cell.setCellValue("实际结束时间");
  416 + cell = row.createCell(11);//列
  417 + cell.setCellValue("时长");
  418 + cell = row.createCell(12);//列
  419 + cell.setCellValue("备注");
  420 + cell = row.createCell(13);//列
  421 + cell.setCellValue("版权来源");
503 422
504 - cell = row.createCell(12);//列  
505 - cell.setCellValue("");  
506 - cell = row.createCell(13);//列  
507 - cell.setCellValue("");  
508 - }  
509 - } 423 + for (int i = 0; i < liveList.size(); i++) {
  424 + row = sheetlist.createRow((short) (i + 1));//行
  425 + cell = row.createCell(0);//列
  426 + cell.setCellValue(liveList.get(i).getId());
  427 + cell = row.createCell(1);//列
  428 + if (liveList.get(i).getPre_start_time() != null) {
  429 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getPre_start_time(), "yyyy/MM/dd"));
  430 + }
  431 + cell = row.createCell(2);//列
  432 + if (liveList.get(i).getPre_start_time() != null) {
  433 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getPre_start_time(), "HH:mm"));
  434 + }
  435 + /*预计结束时间需要处理成用户可读*/
  436 + String pre_endTime = "";
510 437
511 - ByteArrayOutputStream os = new ByteArrayOutputStream();  
512 - wb.write(os);  
513 - byte[] content = os.toByteArray();  
514 - InputStream is = new ByteArrayInputStream(content);  
515 - response.setContentType("application/vnd.ms-excel;charset=utf-8");  
516 - response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), "iso-8859-1"));  
517 - out = response.getOutputStream();  
518 - bis = new BufferedInputStream(is);  
519 - bos = new BufferedOutputStream(out);  
520 - byte[] buff = new byte[2048];  
521 - int bytesRead;  
522 - while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {  
523 - bos.write(buff, 0, bytesRead);  
524 - }  
525 - } catch (final Exception e) {  
526 - e.printStackTrace();  
527 - try {  
528 - if (bis != null) {  
529 - bis.close();  
530 - }  
531 - if (bos != null) {  
532 - bos.close();  
533 - }  
534 - } catch (Exception e1) {  
535 - e1.printStackTrace();  
536 - }  
537 - } finally {  
538 - try {  
539 - if (bis != null) {  
540 - bis.close();  
541 - }  
542 - if (bos != null) {  
543 - bos.close();  
544 - }  
545 - } catch (Exception e2) {  
546 - e2.printStackTrace();  
547 - }  
548 - }  
549 - } 438 + if (CommonUtils.isNull(liveList.get(i).getPre_end_time())) {//结束时间为空
  439 + pre_endTime = "待定";
  440 + } else {
  441 + long start = liveList.get(i).getPre_start_time().getTime() + 8 * 60 * 60 * 1000;
  442 + long end = liveList.get(i).getPre_end_time().getTime() + 8 * 60 * 60 * 1000;
  443 + long count = end / (24 * 3600 * 1000) - start / (24 * 3600 * 1000);
  444 + logger.info(String.valueOf(count));
  445 + if (count == 0) {
  446 + pre_endTime = CommonUtils.formatDate(liveList.get(i).getPre_end_time(), "HH:mm");
  447 + } else if (count > 0) {
  448 + pre_endTime = "跨" + count + "天 " + CommonUtils.formatDate(liveList.get(i).getPre_end_time(), "HH:mm");
  449 + }
  450 + }
  451 + cell = row.createCell(3);//列
  452 + cell.setCellValue(pre_endTime);
  453 + cell = row.createCell(4);//列
  454 + cell.setCellValue(liveList.get(i).getActivity_name());
  455 + cell = row.createCell(5);//列
  456 + cell.setCellValue(sitesService.findspidDescByspid(liveList.get(i).getSp_id()).getName());
  457 + cell = row.createCell(6);//列
  458 + cell.setCellValue(liveList.get(i).getLive_type());
  459 + cell = row.createCell(7);//列
  460 + /* 审核员需要做处理*/
  461 + String updater = "";//审核员名字
  462 + if (!liveList.get(i).getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) {
  463 + updater = CommonUtils.isEmpty(liveList.get(i).getUpdater()) || "null".equals(liveList.get(i).getUpdater()) ? "自动通过" : liveList.get(i).getUpdater();
  464 + String auditor_id = liveList.get(i).getAuditor();
  465 + if (CommonUtils.isNotEmpty(auditor_id)) {
  466 + ShyUsers user = new ShyUsers();
  467 + user.setUser_id(auditor_id);
  468 + user = usersService.select(user);
  469 + if (CommonUtils.isNotNull(user)) {
  470 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  471 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  472 + updater = userName;
  473 + }
  474 + }
  475 + }
  476 + cell.setCellValue(updater);
  477 + cell = row.createCell(8);//列
  478 + if (liveList.get(i).getActivity_start_time() != null) {
  479 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_start_time(), "yyyy/MM/dd"));
  480 + }
  481 + cell = row.createCell(9);//列
  482 + if (liveList.get(i).getActivity_start_time() != null) {
  483 + cell.setCellValue(CommonUtils.formatDate(liveList.get(i).getActivity_start_time(), "HH:mm"));
  484 + }
  485 + /*实际结束时间需要处理成用户可读*/
  486 + String Activity_endTime = "";
  487 + if (liveList.get(i).getActivity_start_time() != null && liveList.get(i).getActivity_end_time() != null) {
  488 + long Activity_start = liveList.get(i).getActivity_start_time().getTime() + 8 * 60 * 60 * 1000;
  489 + long Activity_end = liveList.get(i).getActivity_end_time().getTime() + 8 * 60 * 60 * 1000;
  490 + long Activity_count = Activity_end / (24 * 3600 * 1000) - Activity_start / (24 * 3600 * 1000);
  491 + logger.info(String.valueOf(Activity_count));
  492 + if (Activity_count == 0) {
  493 + Activity_endTime = CommonUtils.formatDate(liveList.get(i).getActivity_end_time(), "HH:mm");
  494 + } else if (Activity_count > 0) {
  495 + Activity_endTime = "跨" + Activity_count + "天 " + CommonUtils.formatDate(liveList.get(i).getActivity_end_time(), "HH:mm");
  496 + }
550 497
  498 + cell = row.createCell(10);//列
  499 + cell.setCellValue(Activity_endTime);
  500 + cell = row.createCell(11);//时长
  501 + /*时长需要处理成用户可读,单位:分钟*/
  502 + long time_length = (Activity_end - Activity_start) / (60 * 1000);
  503 + cell.setCellValue(time_length);
  504 +
  505 + cell = row.createCell(12);//列
  506 + cell.setCellValue("");
  507 + cell = row.createCell(13);//列
  508 + cell.setCellValue("");
  509 + }
  510 + }
  511 +
  512 + ByteArrayOutputStream os = new ByteArrayOutputStream();
  513 + wb.write(os);
  514 + byte[] content = os.toByteArray();
  515 + InputStream is = new ByteArrayInputStream(content);
  516 + response.setContentType("application/vnd.ms-excel;charset=utf-8");
  517 + response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), "iso-8859-1"));
  518 + out = response.getOutputStream();
  519 + bis = new BufferedInputStream(is);
  520 + bos = new BufferedOutputStream(out);
  521 + byte[] buff = new byte[2048];
  522 + int bytesRead;
  523 + while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
  524 + bos.write(buff, 0, bytesRead);
  525 + }
  526 + } catch (final Exception e) {
  527 + e.printStackTrace();
  528 + try {
  529 + if (bis != null) {
  530 + bis.close();
  531 + }
  532 + if (bos != null) {
  533 + bos.close();
  534 + }
  535 + } catch (Exception e1) {
  536 + e1.printStackTrace();
  537 + }
  538 + } finally {
  539 + try {
  540 + if (bis != null) {
  541 + bis.close();
  542 + }
  543 + if (bos != null) {
  544 + bos.close();
  545 + }
  546 + } catch (Exception e2) {
  547 + e2.printStackTrace();
  548 + }
  549 + }
  550 + }
551 551
552 552
553 } 553 }
src/main/java/com/cnlive/shenhe/controller/NotSpeakController.java
@@ -42,7 +42,7 @@ public class NotSpeakController extends BaseController { @@ -42,7 +42,7 @@ public class NotSpeakController extends BaseController {
42 42
43 @Autowired 43 @Autowired
44 UsersServiceImpl usersService; 44 UsersServiceImpl usersService;
45 - 45 +
46 @Autowired 46 @Autowired
47 SitesServiceImpl sitesService; 47 SitesServiceImpl sitesService;
48 @Autowired 48 @Autowired
@@ -58,8 +58,8 @@ public class NotSpeakController extends BaseController { @@ -58,8 +58,8 @@ public class NotSpeakController extends BaseController {
58 public String getPage(Model model, NotSpeakDTO notSpeakDTO, HttpSession session) { 58 public String getPage(Model model, NotSpeakDTO notSpeakDTO, HttpSession session) {
59 logger.info("列表请求参数:{}", JSON.toJSONString(notSpeakDTO)); 59 logger.info("列表请求参数:{}", JSON.toJSONString(notSpeakDTO));
60 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 60 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
61 - if(CommonUtils.isNull(sessionUser)){  
62 - return "redirect:/users/login"; 61 + if (CommonUtils.isNull(sessionUser)) {
  62 + return "redirect:/users/login";
63 } 63 }
64 String userId = sessionUser.getUserId(); 64 String userId = sessionUser.getUserId();
65 notSpeakDTO.setUserId(userId); 65 notSpeakDTO.setUserId(userId);
@@ -68,27 +68,27 @@ public class NotSpeakController extends BaseController { @@ -68,27 +68,27 @@ public class NotSpeakController extends BaseController {
68 List<ShyNotspeak> list = shyNotspeakPage.getList(); 68 List<ShyNotspeak> list = shyNotspeakPage.getList();
69 if (!list.isEmpty()) { 69 if (!list.isEmpty()) {
70 for (ShyNotspeak notspeak : list) { 70 for (ShyNotspeak notspeak : list) {
71 - String updater = CommonUtils.isEmpty(notspeak.getUpdater()) || "null".equals(notspeak.getUpdater())? "无":notspeak.getUpdater();  
72 - String auditor_id = notspeak.getAuditor();  
73 - if (CommonUtils.isNotEmpty(auditor_id)) {  
74 - ShyUsers user = new ShyUsers();  
75 - user.setUser_id(auditor_id);  
76 - user = usersService.select(user);  
77 - if (CommonUtils.isNotNull(user)) {  
78 - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();  
79 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();  
80 - updater = userName ;  
81 - } 71 + String updater = CommonUtils.isEmpty(notspeak.getUpdater()) || "null".equals(notspeak.getUpdater()) ? "无" : notspeak.getUpdater();
  72 + String auditor_id = notspeak.getAuditor();
  73 + if (CommonUtils.isNotEmpty(auditor_id)) {
  74 + ShyUsers user = new ShyUsers();
  75 + user.setUser_id(auditor_id);
  76 + user = usersService.select(user);
  77 + if (CommonUtils.isNotNull(user)) {
  78 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  79 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  80 + updater = userName;
  81 + }
  82 + }
  83 + notspeak.setUpdater(updater);
  84 + if (null != notspeak.getSp_id()) {
  85 + //显示spid简称
  86 + ShySites shySites = sitesService.findspidDescByspid(notspeak.getSp_id());
  87 + if (CommonUtils.isNotNull(shySites)) {
  88 + notspeak.setSpid_desc(shySites.getName());
82 } 89 }
83 - notspeak.setUpdater(updater);  
84 - if(null!=notspeak.getSp_id()){  
85 - //显示spid简称  
86 - ShySites shySites = sitesService.findspidDescByspid(notspeak.getSp_id());  
87 - if (CommonUtils.isNotNull(shySites)) {  
88 - notspeak.setSpid_desc(shySites.getName());  
89 - }  
90 - }else{  
91 - notspeak.setSpid_desc("sp无法显示"); 90 + } else {
  91 + notspeak.setSpid_desc("sp无法显示");
92 } 92 }
93 } 93 }
94 } 94 }
@@ -100,6 +100,7 @@ public class NotSpeakController extends BaseController { @@ -100,6 +100,7 @@ public class NotSpeakController extends BaseController {
100 100
101 /** 101 /**
102 * 禁言(通过评论进入) 102 * 禁言(通过评论进入)
  103 + *
103 * @param commentId 104 * @param commentId
104 * @param 105 * @param
105 * @param time 106 * @param time
@@ -108,14 +109,16 @@ public class NotSpeakController extends BaseController { @@ -108,14 +109,16 @@ public class NotSpeakController extends BaseController {
108 */ 109 */
109 @PostMapping("/notSpeakByComment") 110 @PostMapping("/notSpeakByComment")
110 @ResponseBody 111 @ResponseBody
111 - public ResponseBean notSpeakByComment(Integer commentId,Integer time, HttpSession session) { 112 + public ResponseBean notSpeakByComment(Integer commentId, Integer time, HttpSession session) {
112 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 113 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
113 String userId = sessionUser.getUserId(); 114 String userId = sessionUser.getUserId();
114 - ResponseBean success = notSpeakService.notSpeakByComment(commentId, time,userId); 115 + ResponseBean success = notSpeakService.notSpeakByComment(commentId, time, userId);
115 return success; 116 return success;
116 } 117 }
  118 +
117 /** 119 /**
118 * 查询禁言状态(通过评论进入) 120 * 查询禁言状态(通过评论进入)
  121 + *
119 * @param commentId 122 * @param commentId
120 * @param 123 * @param
121 * @param 124 * @param
@@ -125,13 +128,15 @@ public class NotSpeakController extends BaseController { @@ -125,13 +128,15 @@ public class NotSpeakController extends BaseController {
125 @PostMapping("/querySpeakState") 128 @PostMapping("/querySpeakState")
126 @ResponseBody 129 @ResponseBody
127 public ResponseBean querySpeakState(Integer commentId, HttpSession session) { 130 public ResponseBean querySpeakState(Integer commentId, HttpSession session) {
128 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
129 - String userId = sessionUser.getUserId();  
130 - ResponseBean success = notSpeakService.querySpeakState(commentId,userId);  
131 - return success; 131 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  132 + String userId = sessionUser.getUserId();
  133 + ResponseBean success = notSpeakService.querySpeakState(commentId, userId);
  134 + return success;
132 } 135 }
  136 +
133 /** 137 /**
134 * 禁言(通过禁言管理进入) 138 * 禁言(通过禁言管理进入)
  139 + *
135 * @param notSpeakId 140 * @param notSpeakId
136 * @param type 141 * @param type
137 * @param time 142 * @param time
@@ -140,10 +145,10 @@ public class NotSpeakController extends BaseController { @@ -140,10 +145,10 @@ public class NotSpeakController extends BaseController {
140 */ 145 */
141 @PostMapping("/speak") 146 @PostMapping("/speak")
142 @ResponseBody 147 @ResponseBody
143 - public ResponseBean speak(Integer notSpeakId,Integer type,Integer time, HttpSession session) {  
144 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
145 - String userId = sessionUser.getUserId();  
146 - ResponseBean success = notSpeakService.speak(notSpeakId,type, time,userId);  
147 - return success; 148 + public ResponseBean speak(Integer notSpeakId, Integer type, Integer time, HttpSession session) {
  149 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  150 + String userId = sessionUser.getUserId();
  151 + ResponseBean success = notSpeakService.speak(notSpeakId, type, time, userId);
  152 + return success;
148 } 153 }
149 } 154 }
src/main/java/com/cnlive/shenhe/controller/ShyActivityController.java
@@ -73,7 +73,7 @@ public class ShyActivityController extends BaseController { @@ -73,7 +73,7 @@ public class ShyActivityController extends BaseController {
73 logger.info("列表请求参数:{}", JSON.toJSONString(shyActivityDTO)); 73 logger.info("列表请求参数:{}", JSON.toJSONString(shyActivityDTO));
74 PageInfo<ShyActivity> shyActivityPageInfo = shyActivityImpl.selectByExample(shyActivityDTO); 74 PageInfo<ShyActivity> shyActivityPageInfo = shyActivityImpl.selectByExample(shyActivityDTO);
75 List<ShyActivity> list = shyActivityPageInfo.getList(); 75 List<ShyActivity> list = shyActivityPageInfo.getList();
76 - model.addAttribute("exempt_from_trial",shyActivityDTO.getExempt_from_trial()); 76 + model.addAttribute("exempt_from_trial", shyActivityDTO.getExempt_from_trial());
77 model.addAttribute("ShyActivitylist", shyActivityPageInfo); 77 model.addAttribute("ShyActivitylist", shyActivityPageInfo);
78 return "page/activity.html"; 78 return "page/activity.html";
79 } 79 }
src/main/java/com/cnlive/shenhe/controller/SitesController.java
@@ -46,14 +46,14 @@ public class SitesController extends BaseController { @@ -46,14 +46,14 @@ public class SitesController extends BaseController {
46 public String page(Model model, SitesDTO sitesDTO, HttpSession session) { 46 public String page(Model model, SitesDTO sitesDTO, HttpSession session) {
47 logger.info("列表请求参数:{}", JSON.toJSONString(sitesDTO)); 47 logger.info("列表请求参数:{}", JSON.toJSONString(sitesDTO));
48 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 48 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
49 - if(CommonUtils.isNull(sessionUser)){  
50 - return "redirect:/users/login"; 49 + if (CommonUtils.isNull(sessionUser)) {
  50 + return "redirect:/users/login";
51 } 51 }
52 Integer spid = sessionUser.getSpid(); 52 Integer spid = sessionUser.getSpid();
53 sitesDTO.setSpId(spid); 53 sitesDTO.setSpId(spid);
54 if (!sessionUser.isMaster() && sitesDTO.getSpId() != 0) { 54 if (!sessionUser.isMaster() && sitesDTO.getSpId() != 0) {
55 - setmodelSite(model);  
56 - return "error.html"; 55 + setmodelSite(model);
  56 + return "error.html";
57 } 57 }
58 if (spid == 0) { 58 if (spid == 0) {
59 sitesDTO.setSpId(null); 59 sitesDTO.setSpId(null);
@@ -83,11 +83,11 @@ public class SitesController extends BaseController { @@ -83,11 +83,11 @@ public class SitesController extends BaseController {
83 83
84 84
85 @PostMapping(value = "/write") 85 @PostMapping(value = "/write")
86 - public String write(Model model,Integer siteId, String[] write_business, HttpSession session, String redirect_url) { 86 + public String write(Model model, Integer siteId, String[] write_business, HttpSession session, String redirect_url) {
87 ShySites site = sitesService.get(siteId); 87 ShySites site = sitesService.get(siteId);
88 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 88 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
89 - if(CommonUtils.isNull(sessionUser)){  
90 - return "redirect:/users/login"; 89 + if (CommonUtils.isNull(sessionUser)) {
  90 + return "redirect:/users/login";
91 } 91 }
92 String write = ""; 92 String write = "";
93 if (CommonUtils.isNotNull(write_business) && write_business.length > 0) { 93 if (CommonUtils.isNotNull(write_business) && write_business.length > 0) {
@@ -101,8 +101,8 @@ public class SitesController extends BaseController { @@ -101,8 +101,8 @@ public class SitesController extends BaseController {
101 if (success) { 101 if (success) {
102 return "redirect:" + redirect_url; 102 return "redirect:" + redirect_url;
103 } else { 103 } else {
104 - setmodelResult(model);  
105 - return "error.html"; 104 + setmodelResult(model);
  105 + return "error.html";
106 } 106 }
107 } 107 }
108 108
src/main/java/com/cnlive/shenhe/controller/TopicController.java
@@ -56,7 +56,7 @@ public class TopicController extends BaseController { @@ -56,7 +56,7 @@ public class TopicController extends BaseController {
56 56
57 /** 57 /**
58 * 图文列表 58 * 图文列表
59 - * 59 + *
60 * @param model 60 * @param model
61 * @param topicDTO 61 * @param topicDTO
62 * @param session 62 * @param session
@@ -66,23 +66,23 @@ public class TopicController extends BaseController { @@ -66,23 +66,23 @@ public class TopicController extends BaseController {
66 public String getPage(Model model, TopicDTO topicDTO, HttpSession session) { 66 public String getPage(Model model, TopicDTO topicDTO, HttpSession session) {
67 logger.info("列表请求参数:{}", JSON.toJSONString(topicDTO)); 67 logger.info("列表请求参数:{}", JSON.toJSONString(topicDTO));
68 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 68 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
69 - if(CommonUtils.isNull(sessionUser)){  
70 - return "redirect:/users/login"; 69 + if (CommonUtils.isNull(sessionUser)) {
  70 + return "redirect:/users/login";
71 } 71 }
72 Integer spid = sessionUser.getSpid(); 72 Integer spid = sessionUser.getSpid();
73 String userId = sessionUser.getUserId(); 73 String userId = sessionUser.getUserId();
74 topicDTO.setSpid(spid); 74 topicDTO.setSpid(spid);
75 topicDTO.setUserId(userId); 75 topicDTO.setUserId(userId);
76 if (CommonUtils.isNotEmpty(topicDTO.getSp_desc()) && topicDTO.getSpid() == 0) { 76 if (CommonUtils.isNotEmpty(topicDTO.getSp_desc()) && topicDTO.getSpid() == 0) {
77 - ShySites shySite=sitesService.findspidBySpdesc(topicDTO.getSp_desc());  
78 - if(CommonUtils.isNotNull(shySite)){  
79 - topicDTO.setSpid(shySite.getSpid());  
80 - }else{  
81 - setmodelSite(model);  
82 - return "error.html";  
83 - } 77 + ShySites shySite = sitesService.findspidBySpdesc(topicDTO.getSp_desc());
  78 + if (CommonUtils.isNotNull(shySite)) {
  79 + topicDTO.setSpid(shySite.getSpid());
  80 + } else {
  81 + setmodelSite(model);
  82 + return "error.html";
  83 + }
84 } else if (CommonUtils.isEmpty(topicDTO.getSp_desc()) && topicDTO.getSpid() == 0) { 84 } else if (CommonUtils.isEmpty(topicDTO.getSp_desc()) && topicDTO.getSpid() == 0) {
85 - topicDTO.setSpid(null); 85 + topicDTO.setSpid(null);
86 } 86 }
87 87
88 if (CommonUtils.isNotEmpty(topicDTO.getStart_date())) { 88 if (CommonUtils.isNotEmpty(topicDTO.getStart_date())) {
@@ -102,19 +102,19 @@ public class TopicController extends BaseController { @@ -102,19 +102,19 @@ public class TopicController extends BaseController {
102 if (!list.isEmpty()) { 102 if (!list.isEmpty()) {
103 for (ShyTopic topic : list) { 103 for (ShyTopic topic : list) {
104 if (!topic.getShenhe_status().equals(CommonConst.AUDIT_INTT)) { 104 if (!topic.getShenhe_status().equals(CommonConst.AUDIT_INTT)) {
105 - String auditor_id = topic.getAuditor_id();  
106 - String updater = CommonUtils.isEmpty(topic.getUpdater()) || "null".equals(topic.getUpdater())? "白名单":topic.getUpdater();  
107 - updater =sitesService.getUpdater(updater,auditor_id); 105 + String auditor_id = topic.getAuditor_id();
  106 + String updater = CommonUtils.isEmpty(topic.getUpdater()) || "null".equals(topic.getUpdater()) ? "白名单" : topic.getUpdater();
  107 + updater = sitesService.getUpdater(updater, auditor_id);
108 topic.setUpdater(updater); 108 topic.setUpdater(updater);
109 } 109 }
110 //显示spid简称 110 //显示spid简称
111 - if(CommonUtils.isNotNull(topic.getSp_id())){  
112 - ShySites shySites = sitesService.findspidDescByspid(topic.getSp_id());  
113 - if (CommonUtils.isNotNull(shySites)) {  
114 - topic.setSp_desc(shySites.getName());  
115 - }  
116 - }else{  
117 - topic.setSp_desc("sp无法显示"); 111 + if (CommonUtils.isNotNull(topic.getSp_id())) {
  112 + ShySites shySites = sitesService.findspidDescByspid(topic.getSp_id());
  113 + if (CommonUtils.isNotNull(shySites)) {
  114 + topic.setSp_desc(shySites.getName());
  115 + }
  116 + } else {
  117 + topic.setSp_desc("sp无法显示");
118 } 118 }
119 } 119 }
120 } 120 }
@@ -135,14 +135,14 @@ public class TopicController extends BaseController { @@ -135,14 +135,14 @@ public class TopicController extends BaseController {
135 public ResponseBean pass(String ids, HttpSession session) { 135 public ResponseBean pass(String ids, HttpSession session) {
136 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 136 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
137 String userId = sessionUser.getUserId(); 137 String userId = sessionUser.getUserId();
138 - boolean success =false; 138 + boolean success = false;
139 String[] topicIds = ids.split(","); 139 String[] topicIds = ids.split(",");
140 - for (String id : topicIds) {  
141 - success = topicService.callback(id,"审核通过", CommonConst.AUDIT_SUCCESS, userId,"");  
142 - if(!success){  
143 - return new ResponseBean(ErrorEnum.ERROR); 140 + for (String id : topicIds) {
  141 + success = topicService.callback(id, "审核通过", CommonConst.AUDIT_SUCCESS, userId, "");
  142 + if (!success) {
  143 + return new ResponseBean(ErrorEnum.ERROR);
144 } 144 }
145 - } 145 + }
146 return new ResponseBean(ErrorEnum.SUCCESS); 146 return new ResponseBean(ErrorEnum.SUCCESS);
147 } 147 }
148 148
@@ -154,18 +154,18 @@ public class TopicController extends BaseController { @@ -154,18 +154,18 @@ public class TopicController extends BaseController {
154 */ 154 */
155 @PostMapping("/refuse") 155 @PostMapping("/refuse")
156 @ResponseBody 156 @ResponseBody
157 - public ResponseBean refuse(String ids,String msg, HttpSession session) { 157 + public ResponseBean refuse(String ids, String msg, HttpSession session) {
158 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 158 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
159 String userId = sessionUser.getUserId(); 159 String userId = sessionUser.getUserId();
160 - boolean success =false; 160 + boolean success = false;
161 String[] contentIds = ids.split(","); 161 String[] contentIds = ids.split(",");
162 - for (String id : contentIds) {  
163 - success = topicService.callback(id,msg, CommonConst.AUDIT_REFUSE, userId,"");  
164 - if(!success){  
165 - return new ResponseBean(ErrorEnum.ERROR);  
166 - }  
167 - }  
168 - return new ResponseBean(ErrorEnum.SUCCESS); 162 + for (String id : contentIds) {
  163 + success = topicService.callback(id, msg, CommonConst.AUDIT_REFUSE, userId, "");
  164 + if (!success) {
  165 + return new ResponseBean(ErrorEnum.ERROR);
  166 + }
  167 + }
  168 + return new ResponseBean(ErrorEnum.SUCCESS);
169 169
170 } 170 }
171 171
@@ -184,13 +184,13 @@ public class TopicController extends BaseController { @@ -184,13 +184,13 @@ public class TopicController extends BaseController {
184 shyTopic.setShenhe_status(CommonConst.AUDIT_INTT); 184 shyTopic.setShenhe_status(CommonConst.AUDIT_INTT);
185 shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER); 185 shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
186 List<ShyTopic> shyTopicList = topicService.findshyTopic(shyTopic); 186 List<ShyTopic> shyTopicList = topicService.findshyTopic(shyTopic);
187 - if(shyTopicList!=null&&shyTopicList.size()>0){  
188 - logger.info("您有"+shyTopicList.size()+"条新的话题审核,请注意查看!"); 187 + if (shyTopicList != null && shyTopicList.size() > 0) {
  188 + logger.info("您有" + shyTopicList.size() + "条新的话题审核,请注意查看!");
189 // 第三个提示框,避免冲突 189 // 第三个提示框,避免冲突
190 map.put("id", "3"); 190 map.put("id", "3");
191 map.put("title", "新话题审核通知"); 191 map.put("title", "新话题审核通知");
192 map.put("content", "您有" + shyTopicList.size() + "条新的话题审核,请注意查看!"); 192 map.put("content", "您有" + shyTopicList.size() + "条新的话题审核,请注意查看!");
193 - map.put("url", localhost_url+"/topic/page?shenhe_status=0&receive=0"); 193 + map.put("url", localhost_url + "/topic/page?shenhe_status=0&receive=0");
194 return map; 194 return map;
195 } 195 }
196 return null; 196 return null;
src/main/java/com/cnlive/shenhe/controller/UsersController.java
@@ -46,13 +46,13 @@ public class UsersController extends BaseController { @@ -46,13 +46,13 @@ public class UsersController extends BaseController {
46 * 登录入口 46 * 登录入口
47 */ 47 */
48 @Value("${SERVICE_LOGIN}") 48 @Value("${SERVICE_LOGIN}")
49 - private String SERVICE_LOGIN ; 49 + private String SERVICE_LOGIN;
50 50
51 /** 51 /**
52 * 本机的名称 52 * 本机的名称
53 */ 53 */
54 @Value("${spring.localhost.url}") 54 @Value("${spring.localhost.url}")
55 - private String redirectURL ; 55 + private String redirectURL;
56 56
57 @GetMapping(value = "/{id}") 57 @GetMapping(value = "/{id}")
58 @ResponseBody 58 @ResponseBody
@@ -64,13 +64,13 @@ public class UsersController extends BaseController { @@ -64,13 +64,13 @@ public class UsersController extends BaseController {
64 public String index(HttpServletRequest request) { 64 public String index(HttpServletRequest request) {
65 AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal(); 65 AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
66 if (CommonUtils.isNull(principal)) { 66 if (CommonUtils.isNull(principal)) {
67 - return "redirect:https://user.cnlive.com/OpenSSO2/login?service="+SERVICE_LOGIN; 67 + return "redirect:https://user.cnlive.com/OpenSSO2/login?service=" + SERVICE_LOGIN;
68 } 68 }
69 //用户ID 69 //用户ID
70 String id = principal.getName(); 70 String id = principal.getName();
71 if (CommonUtils.isNotEmpty(id)) { 71 if (CommonUtils.isNotEmpty(id)) {
72 ShyUsers user = usersService.get(Integer.parseInt(id)); 72 ShyUsers user = usersService.get(Integer.parseInt(id));
73 - if (CommonUtils.isNotNull(user) && user.getState()){ 73 + if (CommonUtils.isNotNull(user) && user.getState()) {
74 SessionUser sessionUser = new SessionUser(); 74 SessionUser sessionUser = new SessionUser();
75 sessionUser.setUserId(user.getUser_id()); 75 sessionUser.setUserId(user.getUser_id());
76 sessionUser.setSpid(Integer.parseInt(principal.getAttributes().get("new_sp_id").toString())); 76 sessionUser.setSpid(Integer.parseInt(principal.getAttributes().get("new_sp_id").toString()));
@@ -80,7 +80,7 @@ public class UsersController extends BaseController { @@ -80,7 +80,7 @@ public class UsersController extends BaseController {
80 sessionUser.setLogo(user.getUser_logo()); 80 sessionUser.setLogo(user.getUser_logo());
81 sessionUser.setMaster(user.getMaster()); 81 sessionUser.setMaster(user.getMaster());
82 request.getSession().setAttribute(SessionUser.SESSION_KEY, sessionUser); 82 request.getSession().setAttribute(SessionUser.SESSION_KEY, sessionUser);
83 - return "redirect:"+redirectURL+"/videos/page?video_title=&start_date=&end_date=&state=0&receive=0&video_priority="; 83 + return "redirect:" + redirectURL + "/videos/page?video_title=&start_date=&end_date=&state=0&receive=0&video_priority=";
84 } 84 }
85 } 85 }
86 return "page/error.html"; 86 return "page/error.html";
@@ -89,16 +89,16 @@ public class UsersController extends BaseController { @@ -89,16 +89,16 @@ public class UsersController extends BaseController {
89 @RequestMapping("/logout") 89 @RequestMapping("/logout")
90 public String logout(HttpSession session) { 90 public String logout(HttpSession session) {
91 session.invalidate(); 91 session.invalidate();
92 - return "redirect:https://user.cnlive.com/OpenSSO2/logout?service="+SERVICE_LOGIN; 92 + return "redirect:https://user.cnlive.com/OpenSSO2/logout?service=" + SERVICE_LOGIN;
93 } 93 }
94 94
95 - 95 +
96 @GetMapping(value = "/page") 96 @GetMapping(value = "/page")
97 public String page(Model model, UsersDTO usersDTO, HttpSession session) { 97 public String page(Model model, UsersDTO usersDTO, HttpSession session) {
98 logger.info("列表请求参数:{}", JSON.toJSONString(usersDTO)); 98 logger.info("列表请求参数:{}", JSON.toJSONString(usersDTO));
99 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 99 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
100 - if(CommonUtils.isNull(sessionUser)){  
101 - return "redirect:/users/login"; 100 + if (CommonUtils.isNull(sessionUser)) {
  101 + return "redirect:/users/login";
102 } 102 }
103 Integer spid = sessionUser.getSpid(); 103 Integer spid = sessionUser.getSpid();
104 usersDTO.setSp_id(spid); 104 usersDTO.setSp_id(spid);
@@ -111,10 +111,10 @@ public class UsersController extends BaseController { @@ -111,10 +111,10 @@ public class UsersController extends BaseController {
111 JSONObject notice = CommonConst.NOTICE; 111 JSONObject notice = CommonConst.NOTICE;
112 if (!list.isEmpty()) { 112 if (!list.isEmpty()) {
113 for (ShyUsers users : list) { 113 for (ShyUsers users : list) {
114 - //显示spid简称 114 + //显示spid简称
115 ShySites shySites = sitesService.findspidDescByspid(users.getSp_id()); 115 ShySites shySites = sitesService.findspidDescByspid(users.getSp_id());
116 if (CommonUtils.isNotNull(shySites)) { 116 if (CommonUtils.isNotNull(shySites)) {
117 - users.setSp_desc(shySites.getName()); 117 + users.setSp_desc(shySites.getName());
118 } 118 }
119 } 119 }
120 } 120 }
@@ -123,63 +123,64 @@ public class UsersController extends BaseController { @@ -123,63 +123,64 @@ public class UsersController extends BaseController {
123 model.addAttribute("notice", notice); 123 model.addAttribute("notice", notice);
124 return "page/users.html"; 124 return "page/users.html";
125 } 125 }
126 - 126 +
127 /** 127 /**
128 * 获取通知是否显示 128 * 获取通知是否显示
  129 + *
129 * @param 130 * @param
130 * @param session 131 * @param session
131 * @return 132 * @return
132 */ 133 */
133 @PostMapping(value = "/getNoticeShow") 134 @PostMapping(value = "/getNoticeShow")
134 @ResponseBody 135 @ResponseBody
135 - public Map<String,Object> getNoticeShow( HttpSession session) { 136 + public Map<String, Object> getNoticeShow(HttpSession session) {
136 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 137 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
137 ShyUsers shyUser = new ShyUsers(); 138 ShyUsers shyUser = new ShyUsers();
138 shyUser.setUser_id(sessionUser.getUserId()); 139 shyUser.setUser_id(sessionUser.getUserId());
139 - shyUser =usersService.select(shyUser);  
140 - boolean isShow_chinnal=false;//是否显示频道消息框  
141 - boolean isShow_liveApply=false;//是否显示直播申请消息框  
142 - boolean isShow_topic=false;//是否显示话题审核消息框  
143 - if(CommonUtils.isNotEmpty(shyUser.getNotice_show())&&shyUser.getNotice_show().contains(CommonConst.NOTICE_CHANNAL.toString())){  
144 - isShow_chinnal=true; 140 + shyUser = usersService.select(shyUser);
  141 + boolean isShow_chinnal = false;//是否显示频道消息框
  142 + boolean isShow_liveApply = false;//是否显示直播申请消息框
  143 + boolean isShow_topic = false;//是否显示话题审核消息框
  144 + if (CommonUtils.isNotEmpty(shyUser.getNotice_show()) && shyUser.getNotice_show().contains(CommonConst.NOTICE_CHANNAL.toString())) {
  145 + isShow_chinnal = true;
145 } 146 }
146 - if(CommonUtils.isNotEmpty(shyUser.getNotice_show())&&shyUser.getNotice_show().contains(CommonConst.NOTICE_LIVEAPPLY.toString())){  
147 - isShow_liveApply=true; 147 + if (CommonUtils.isNotEmpty(shyUser.getNotice_show()) && shyUser.getNotice_show().contains(CommonConst.NOTICE_LIVEAPPLY.toString())) {
  148 + isShow_liveApply = true;
148 } 149 }
149 - if(CommonUtils.isNotEmpty(shyUser.getNotice_show())&&shyUser.getNotice_show().contains(CommonConst.NOTICE_TOPIC.toString())){  
150 - isShow_topic=true; 150 + if (CommonUtils.isNotEmpty(shyUser.getNotice_show()) && shyUser.getNotice_show().contains(CommonConst.NOTICE_TOPIC.toString())) {
  151 + isShow_topic = true;
151 } 152 }
152 - Map<String,Object> map=new HashMap<>(); 153 + Map<String, Object> map = new HashMap<>();
153 map.put("isShow_chinnal", isShow_chinnal); 154 map.put("isShow_chinnal", isShow_chinnal);
154 map.put("isShow_liveApply", isShow_liveApply); 155 map.put("isShow_liveApply", isShow_liveApply);
155 map.put("isShow_topic", isShow_topic); 156 map.put("isShow_topic", isShow_topic);
156 return map; 157 return map;
157 } 158 }
158 -  
159 - 159 +
  160 +
160 @PostMapping(value = "/write") 161 @PostMapping(value = "/write")
161 - public String write(Model model,Integer userId, String[] write_notice, HttpSession session, String redirect_url) {  
162 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 162 + public String write(Model model, Integer userId, String[] write_notice, HttpSession session, String redirect_url) {
  163 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
163 // Integer spid = sessionUser.getSpid(); 164 // Integer spid = sessionUser.getSpid();
164 // if (spid != 0) { 165 // if (spid != 0) {
165 // return "page/error.html"; 166 // return "page/error.html";
166 // } 167 // }
167 - ShyUsers user = usersService.get(userId);  
168 - String write = "";  
169 - if (CommonUtils.isNotNull(write_notice) && write_notice.length > 0) {  
170 - for (String w : write_notice) {  
171 - write = write + "," + w;  
172 - }  
173 - write = write.substring(1);  
174 - }  
175 - user.setNotice_show(write);  
176 - boolean success = usersService.update(user);  
177 - if (success) {  
178 - return "redirect:" + redirect_url;  
179 - } else {  
180 - setmodelResult(model);  
181 - return "error.html";  
182 - } 168 + ShyUsers user = usersService.get(userId);
  169 + String write = "";
  170 + if (CommonUtils.isNotNull(write_notice) && write_notice.length > 0) {
  171 + for (String w : write_notice) {
  172 + write = write + "," + w;
  173 + }
  174 + write = write.substring(1);
  175 + }
  176 + user.setNotice_show(write);
  177 + boolean success = usersService.update(user);
  178 + if (success) {
  179 + return "redirect:" + redirect_url;
  180 + } else {
  181 + setmodelResult(model);
  182 + return "error.html";
  183 + }
183 } 184 }
184 - 185 +
185 } 186 }
src/main/java/com/cnlive/shenhe/controller/UsersFreeController.java
@@ -36,7 +36,7 @@ import java.util.List; @@ -36,7 +36,7 @@ import java.util.List;
36 @RequestMapping("/usersFree") 36 @RequestMapping("/usersFree")
37 public class UsersFreeController extends BaseController { 37 public class UsersFreeController extends BaseController {
38 38
39 - private static Logger logger = LoggerFactory.getLogger(UsersFreeController.class); 39 + private static Logger logger = LoggerFactory.getLogger(UsersFreeController.class);
40 40
41 41
42 @Autowired 42 @Autowired
@@ -46,68 +46,67 @@ public class UsersFreeController extends BaseController { @@ -46,68 +46,67 @@ public class UsersFreeController extends BaseController {
46 46
47 @GetMapping(value = "/page") 47 @GetMapping(value = "/page")
48 public String wangjiajiaPage(Model model, UsersFreeDTO usersFreeDTO, HttpSession session) { 48 public String wangjiajiaPage(Model model, UsersFreeDTO usersFreeDTO, HttpSession session) {
49 - logger.info("列表请求参数:{}", JSON.toJSONString(usersFreeDTO));  
50 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());  
51 - if(CommonUtils.isNull(sessionUser)){  
52 - return "redirect:/users/login";  
53 - }  
54 - Integer spid = sessionUser.getSpid();  
55 - usersFreeDTO.setSpid(spid);  
56 - if (!sessionUser.isMaster() && usersFreeDTO.getSpid() != 0) {  
57 - return "page/error.html";  
58 - }  
59 - if (spid == 0) {  
60 - usersFreeDTO.setSpid(null);  
61 - }  
62 - PageInfo<ShyUsersfree> usersPage = usersfreeService.getpage(usersFreeDTO);  
63 - List<ShyUsersfree> list = usersPage.getList();  
64 - JSONObject category = CommonConst.CATEGORY;  
65 - if (!list.isEmpty()) {  
66 - for (ShyUsersfree users : list) {  
67 - //显示spid简称  
68 - ShySites shySites = sitesService.findspidDescByspid(users.getSp_id());  
69 - if (CommonUtils.isNotNull(shySites)) {  
70 - users.setSp_desc(shySites.getName());  
71 - }  
72 -  
73 - //获取栏目名称  
74 - String category_name=users.getCategory();  
75 - if(CommonUtils.isNotEmpty(category_name)){  
76 - for (String bkey : category.keySet()) {  
77 - category_name = category_name.replace(bkey, category.getString(bkey)); 49 + logger.info("列表请求参数:{}", JSON.toJSONString(usersFreeDTO));
  50 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  51 + if (CommonUtils.isNull(sessionUser)) {
  52 + return "redirect:/users/login";
  53 + }
  54 + Integer spid = sessionUser.getSpid();
  55 + usersFreeDTO.setSpid(spid);
  56 + if (!sessionUser.isMaster() && usersFreeDTO.getSpid() != 0) {
  57 + return "page/error.html";
  58 + }
  59 + if (spid == 0) {
  60 + usersFreeDTO.setSpid(null);
  61 + }
  62 + PageInfo<ShyUsersfree> usersPage = usersfreeService.getpage(usersFreeDTO);
  63 + List<ShyUsersfree> list = usersPage.getList();
  64 + JSONObject category = CommonConst.CATEGORY;
  65 + if (!list.isEmpty()) {
  66 + for (ShyUsersfree users : list) {
  67 + //显示spid简称
  68 + ShySites shySites = sitesService.findspidDescByspid(users.getSp_id());
  69 + if (CommonUtils.isNotNull(shySites)) {
  70 + users.setSp_desc(shySites.getName());
  71 + }
  72 +
  73 + //获取栏目名称
  74 + String category_name = users.getCategory();
  75 + if (CommonUtils.isNotEmpty(category_name)) {
  76 + for (String bkey : category.keySet()) {
  77 + category_name = category_name.replace(bkey, category.getString(bkey));
78 } 78 }
79 - }else{  
80 - category_name="无";  
81 - }  
82 - users.setCategory_name(category_name);  
83 -  
84 - }  
85 - }  
86 - model.addAttribute("usersPage", usersPage);  
87 - model.addAttribute("pageSize", usersFreeDTO.getPageSize());  
88 - model.addAttribute("category", category);  
89 - return "page/usersFree.html"; 79 + } else {
  80 + category_name = "无";
  81 + }
  82 + users.setCategory_name(category_name);
  83 +
  84 + }
  85 + }
  86 + model.addAttribute("usersPage", usersPage);
  87 + model.addAttribute("pageSize", usersFreeDTO.getPageSize());
  88 + model.addAttribute("category", category);
  89 + return "page/usersFree.html";
90 } 90 }
91 91
92 @PostMapping("/updateState") 92 @PostMapping("/updateState")
93 @ResponseBody 93 @ResponseBody
94 public ResponseBean updateState(Integer id, Boolean isEnable, HttpSession session) { 94 public ResponseBean updateState(Integer id, Boolean isEnable, HttpSession session) {
95 Integer n = usersfreeService.updateState(id, isEnable); 95 Integer n = usersfreeService.updateState(id, isEnable);
96 - if(n>0){  
97 - return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "当前用户"+(isEnable==true?"启用":"禁用")+"成功"); 96 + if (n > 0) {
  97 + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "当前用户" + (isEnable == true ? "启用" : "禁用") + "成功");
98 } 98 }
99 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试"); 99 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试");
100 } 100 }
101 -  
102 - 101 +
103 102
104 @PostMapping(value = "/write") 103 @PostMapping(value = "/write")
105 - public String write(Model model,String userId,String userMobile,Integer spId, String[] write_business, HttpSession session, String redirect_url) {  
106 - if(CommonUtils.isEmpty(userId)&&CommonUtils.isEmpty(userMobile)){  
107 - setmodelParam(model,"userId,userMobile不能为空!");  
108 - return "error.html";  
109 - }  
110 - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); 104 + public String write(Model model, String userId, String userMobile, Integer spId, String[] write_business, HttpSession session, String redirect_url) {
  105 + if (CommonUtils.isEmpty(userId) && CommonUtils.isEmpty(userMobile)) {
  106 + setmodelParam(model, "userId,userMobile不能为空!");
  107 + return "error.html";
  108 + }
  109 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
111 String write = ""; 110 String write = "";
112 if (CommonUtils.isNotNull(write_business) && write_business.length > 0) { 111 if (CommonUtils.isNotNull(write_business) && write_business.length > 0) {
113 for (String w : write_business) { 112 for (String w : write_business) {
@@ -115,11 +114,11 @@ public class UsersFreeController extends BaseController { @@ -115,11 +114,11 @@ public class UsersFreeController extends BaseController {
115 } 114 }
116 write = write.substring(1); 115 write = write.substring(1);
117 } 116 }
118 - boolean success = usersfreeService.update(userId,userMobile,write,spId,sessionUser.getUserId()); 117 + boolean success = usersfreeService.update(userId, userMobile, write, spId, sessionUser.getUserId());
119 if (success) { 118 if (success) {
120 return "redirect:" + redirect_url; 119 return "redirect:" + redirect_url;
121 } else { 120 } else {
122 - setmodelResult(model); 121 + setmodelResult(model);
123 return "error.html"; 122 return "error.html";
124 } 123 }
125 } 124 }
src/main/java/com/cnlive/shenhe/enums/ImageLabels.java
@@ -5,6 +5,9 @@ package com.cnlive.shenhe.enums; @@ -5,6 +5,9 @@ package com.cnlive.shenhe.enums;
5 * @Date: 2020/6/22 15:30 5 * @Date: 2020/6/22 15:30
6 */ 6 */
7 public enum ImageLabels { 7 public enum ImageLabels {
  8 + /**
  9 + * 定义统一=返回状态码
  10 + */
8 PORNOGRAPHIC("色情", 100), SEXYANDVULGAR("性感低俗", 110), ADVERTISEMENT("广告", 200), 11 PORNOGRAPHIC("色情", 100), SEXYANDVULGAR("性感低俗", 110), ADVERTISEMENT("广告", 200),
9 QRCODE("二维码", 210), POLITICSINVOLVED("涉政", 300), ABUSE("谩骂", 400), 12 QRCODE("二维码", 210), POLITICSINVOLVED("涉政", 300), ABUSE("谩骂", 400),
10 IRRIGATION("灌水", 500), OTHER("其他", 900); 13 IRRIGATION("灌水", 500), OTHER("其他", 900);
src/main/java/com/cnlive/shenhe/enums/TextLabels.java
@@ -6,6 +6,9 @@ package com.cnlive.shenhe.enums; @@ -6,6 +6,9 @@ package com.cnlive.shenhe.enums;
6 */ 6 */
7 public enum TextLabels { 7 public enum TextLabels {
8 8
  9 + /**
  10 + * 定义统一返回状态码
  11 + */
9 PORNOGRAPHIC("色情", 100), ADVERTISEMENT("广告", 200), VIOLENTFEAR("暴恐", 300), 12 PORNOGRAPHIC("色情", 100), ADVERTISEMENT("广告", 200), VIOLENTFEAR("暴恐", 300),
10 CONTRABAND("违禁", 400), POLITICSINVOLVED("涉政", 500), ABUSE("谩骂", 600), 13 CONTRABAND("违禁", 400), POLITICSINVOLVED("涉政", 500), ABUSE("谩骂", 600),
11 IRRIGATION("灌水", 700), OTHER("其他", 900); 14 IRRIGATION("灌水", 700), OTHER("其他", 900);
src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
@@ -256,7 +256,7 @@ public class AudioServiceImpl { @@ -256,7 +256,7 @@ public class AudioServiceImpl {
256 256
257 //默认按上传时间倒序排序 257 //默认按上传时间倒序排序
258 example.setOrderByClause("createTime desc"); 258 example.setOrderByClause("createTime desc");
259 - logger.info("page="+audioDTO.getPage()+"-----------pageSize="+audioDTO.getPageSize()); 259 + logger.info("page=" + audioDTO.getPage() + "-----------pageSize=" + audioDTO.getPageSize());
260 PageHelper.startPage(audioDTO.getPage(), audioDTO.getPageSize(), true); 260 PageHelper.startPage(audioDTO.getPage(), audioDTO.getPageSize(), true);
261 List<ShyAudio> shyAudioList = shyAudioMapper.selectByExample(example); 261 List<ShyAudio> shyAudioList = shyAudioMapper.selectByExample(example);
262 PageInfo<ShyAudio> pageInfo = new PageInfo<>(shyAudioList); 262 PageInfo<ShyAudio> pageInfo = new PageInfo<>(shyAudioList);
src/main/java/com/cnlive/shenhe/serviceImpl/EmailServiceImpl.java
@@ -25,33 +25,33 @@ import java.util.List; @@ -25,33 +25,33 @@ import java.util.List;
25 */ 25 */
26 @Service 26 @Service
27 public class EmailServiceImpl { 27 public class EmailServiceImpl {
28 - private static Logger logger = LoggerFactory.getLogger(EmailServiceImpl.class); 28 + private static Logger logger = LoggerFactory.getLogger(EmailServiceImpl.class);
29 @Autowired 29 @Autowired
30 ShyEmailMapper shyEmailMapper; 30 ShyEmailMapper shyEmailMapper;
31 - 31 +
32 public PageInfo<ShyEmail> getPage(EmailDTO emailDTO) { 32 public PageInfo<ShyEmail> getPage(EmailDTO emailDTO) {
33 - logger.info("接受参数列表为:{}", JSON.toJSONString(emailDTO)); 33 + logger.info("接受参数列表为:{}", JSON.toJSONString(emailDTO));
34 Example example = new Example(ShyEmail.class); 34 Example example = new Example(ShyEmail.class);
35 Example.Criteria criteria = example.createCriteria(); 35 Example.Criteria criteria = example.createCriteria();
36 if (CommonUtils.isNotEmpty(emailDTO.getOrderByClause())) { 36 if (CommonUtils.isNotEmpty(emailDTO.getOrderByClause())) {
37 example.setOrderByClause(emailDTO.getOrderByClause()); 37 example.setOrderByClause(emailDTO.getOrderByClause());
38 - }else{  
39 - example.setOrderByClause("created_at desc"); 38 + } else {
  39 + example.setOrderByClause("created_at desc");
40 } 40 }
41 if (CommonUtils.isNotEmpty(emailDTO.getRemark())) { 41 if (CommonUtils.isNotEmpty(emailDTO.getRemark())) {
42 - criteria.andLike("remark", "%" + emailDTO.getRemark() + "%"); 42 + criteria.andLike("remark", "%" + emailDTO.getRemark() + "%");
43 } 43 }
44 if (CommonUtils.isNotEmpty(emailDTO.getEmail())) { 44 if (CommonUtils.isNotEmpty(emailDTO.getEmail())) {
45 - criteria.andLike("email", "%" + emailDTO.getEmail() + "%"); 45 + criteria.andLike("email", "%" + emailDTO.getEmail() + "%");
46 } 46 }
47 - criteria.andEqualTo("is_delete",false); 47 + criteria.andEqualTo("is_delete", false);
48 PageHelper.startPage(emailDTO.getPage(), emailDTO.getPageSize(), true); 48 PageHelper.startPage(emailDTO.getPage(), emailDTO.getPageSize(), true);
49 49
50 List<ShyEmail> ShyEmailList = shyEmailMapper.selectByExample(example); 50 List<ShyEmail> ShyEmailList = shyEmailMapper.selectByExample(example);
51 PageInfo<ShyEmail> pageInfo = new PageInfo<ShyEmail>(ShyEmailList); 51 PageInfo<ShyEmail> pageInfo = new PageInfo<ShyEmail>(ShyEmailList);
52 return pageInfo; 52 return pageInfo;
53 } 53 }
54 - 54 +
55 public ShyEmail get(Integer id) { 55 public ShyEmail get(Integer id) {
56 return shyEmailMapper.selectByPrimaryKey(id); 56 return shyEmailMapper.selectByPrimaryKey(id);
57 } 57 }
@@ -59,79 +59,80 @@ public class EmailServiceImpl { @@ -59,79 +59,80 @@ public class EmailServiceImpl {
59 public ShyEmail select(ShyEmail shyEmail) { 59 public ShyEmail select(ShyEmail shyEmail) {
60 return shyEmailMapper.selectOne(shyEmail); 60 return shyEmailMapper.selectOne(shyEmail);
61 } 61 }
62 -  
63 - public Integer updateState(Integer id, Boolean isEnable,String userId) {  
64 - ShyEmail shyEmail=get(id);  
65 - shyEmail.setIs_enable(isEnable);  
66 - shyEmail.setUpdater(userId);  
67 - shyEmail.setUpdated_at(CommonUtils.getCurrentTime());  
68 - return shyEmailMapper.updateByPrimaryKeySelective(shyEmail);  
69 - }  
70 62
71 - public Integer deleted(Integer id, String userId) {  
72 - ShyEmail shyEmail=get(id);  
73 - shyEmail.setUpdater(userId);  
74 - shyEmail.setIs_delete(true);  
75 - shyEmail.setUpdated_at(CommonUtils.getCurrentTime());  
76 - return shyEmailMapper.updateByPrimaryKeySelective(shyEmail);  
77 - } 63 + public Integer updateState(Integer id, Boolean isEnable, String userId) {
  64 + ShyEmail shyEmail = get(id);
  65 + shyEmail.setIs_enable(isEnable);
  66 + shyEmail.setUpdater(userId);
  67 + shyEmail.setUpdated_at(CommonUtils.getCurrentTime());
  68 + return shyEmailMapper.updateByPrimaryKeySelective(shyEmail);
  69 + }
  70 +
  71 + public Integer deleted(Integer id, String userId) {
  72 + ShyEmail shyEmail = get(id);
  73 + shyEmail.setUpdater(userId);
  74 + shyEmail.setIs_delete(true);
  75 + shyEmail.setUpdated_at(CommonUtils.getCurrentTime());
  76 + return shyEmailMapper.updateByPrimaryKeySelective(shyEmail);
  77 + }
78 78
79 - public boolean update(Integer id, String email, String remark, String write, String updater) { 79 + public boolean update(Integer id, String email, String remark, String write, String updater) {
80 80
81 - ShyEmail shyEmail = new ShyEmail();  
82 - if (CommonUtils.isNotNull(id)) {  
83 - shyEmail.setId(id);  
84 - shyEmail = shyEmailMapper.selectOne(shyEmail);  
85 - if (shyEmail != null) {  
86 - shyEmail.setEmail(email);  
87 - shyEmail.setRemark(remark);  
88 - shyEmail.setNotice_type(write);  
89 - shyEmail.setUpdater(updater);  
90 - shyEmail.setUpdated_at(CommonUtils.getCurrentTime());  
91 - int re = shyEmailMapper.updateByPrimaryKeySelective(shyEmail);  
92 - if (re != 1) {  
93 - return false;  
94 - }  
95 - }  
96 - } else {  
97 - shyEmail.setEmail(email);  
98 - shyEmail.setIs_delete(false);  
99 - shyEmail.setIs_enable(true);  
100 - shyEmail.setNotice_type(write);  
101 - shyEmail.setRemark(remark);  
102 - shyEmail.setUpdater(updater);  
103 - shyEmail.setCreated_at(CommonUtils.getCurrentTime());  
104 - shyEmail.setUpdated_at(CommonUtils.getCurrentTime());  
105 - int re = shyEmailMapper.insertSelective(shyEmail);  
106 - if (re != 1) {  
107 - return false;  
108 - }  
109 - }  
110 - return true;  
111 - } 81 + ShyEmail shyEmail = new ShyEmail();
  82 + if (CommonUtils.isNotNull(id)) {
  83 + shyEmail.setId(id);
  84 + shyEmail = shyEmailMapper.selectOne(shyEmail);
  85 + if (shyEmail != null) {
  86 + shyEmail.setEmail(email);
  87 + shyEmail.setRemark(remark);
  88 + shyEmail.setNotice_type(write);
  89 + shyEmail.setUpdater(updater);
  90 + shyEmail.setUpdated_at(CommonUtils.getCurrentTime());
  91 + int re = shyEmailMapper.updateByPrimaryKeySelective(shyEmail);
  92 + if (re != 1) {
  93 + return false;
  94 + }
  95 + }
  96 + } else {
  97 + shyEmail.setEmail(email);
  98 + shyEmail.setIs_delete(false);
  99 + shyEmail.setIs_enable(true);
  100 + shyEmail.setNotice_type(write);
  101 + shyEmail.setRemark(remark);
  102 + shyEmail.setUpdater(updater);
  103 + shyEmail.setCreated_at(CommonUtils.getCurrentTime());
  104 + shyEmail.setUpdated_at(CommonUtils.getCurrentTime());
  105 + int re = shyEmailMapper.insertSelective(shyEmail);
  106 + if (re != 1) {
  107 + return false;
  108 + }
  109 + }
  110 + return true;
  111 + }
112 112
113 - /**  
114 - * 通过邮件发送类型,获取需要发送邮件的list  
115 - * @param emailSendType  
116 - * @return  
117 - */  
118 - public List<ShyEmail> getEmailSendList(Integer emailSendType) {  
119 - ShyEmail shyEmail= new ShyEmail();  
120 - shyEmail.setIs_delete(false);  
121 - shyEmail.setIs_enable(true);  
122 - List<ShyEmail> shyEmailList = shyEmailMapper.select(shyEmail); 113 + /**
  114 + * 通过邮件发送类型,获取需要发送邮件的list
  115 + *
  116 + * @param emailSendType
  117 + * @return
  118 + */
  119 + public List<ShyEmail> getEmailSendList(Integer emailSendType) {
  120 + ShyEmail shyEmail = new ShyEmail();
  121 + shyEmail.setIs_delete(false);
  122 + shyEmail.setIs_enable(true);
  123 + List<ShyEmail> shyEmailList = shyEmailMapper.select(shyEmail);
123 List<ShyEmail> emailList = new ArrayList<ShyEmail>(); 124 List<ShyEmail> emailList = new ArrayList<ShyEmail>();
124 for (ShyEmail shyEmail2 : shyEmailList) { 125 for (ShyEmail shyEmail2 : shyEmailList) {
125 if (CommonUtils.isNotEmpty(shyEmail2.getNotice_type())) { 126 if (CommonUtils.isNotEmpty(shyEmail2.getNotice_type())) {
126 String[] business = shyEmail2.getNotice_type().split(","); 127 String[] business = shyEmail2.getNotice_type().split(",");
127 List<String> asList = Arrays.asList(business); 128 List<String> asList = Arrays.asList(business);
128 if (asList.contains(emailSendType + "")) { 129 if (asList.contains(emailSendType + "")) {
129 - emailList.add(shyEmail2); 130 + emailList.add(shyEmail2);
130 } 131 }
131 } 132 }
132 } 133 }
133 return emailList; 134 return emailList;
134 -  
135 - } 135 +
  136 + }
136 137
137 } 138 }
src/main/java/com/cnlive/shenhe/serviceImpl/LiveServiceImpl.java
@@ -30,12 +30,12 @@ import java.util.List; @@ -30,12 +30,12 @@ import java.util.List;
30 */ 30 */
31 @Service 31 @Service
32 public class LiveServiceImpl { 32 public class LiveServiceImpl {
33 - private static Logger logger = LoggerFactory.getLogger(LiveServiceImpl.class); 33 + private static Logger logger = LoggerFactory.getLogger(LiveServiceImpl.class);
34 @Autowired 34 @Autowired
35 ShyLiveMapper shyLiveMapper; 35 ShyLiveMapper shyLiveMapper;
36 @Autowired 36 @Autowired
37 ShyUsersMapper shyUsersMapper; 37 ShyUsersMapper shyUsersMapper;
38 - 38 +
39 39
40 //============== 40 //==============
41 public boolean impotVideo(ShyLive shyLive) { 41 public boolean impotVideo(ShyLive shyLive) {
@@ -68,7 +68,7 @@ public class LiveServiceImpl { @@ -68,7 +68,7 @@ public class LiveServiceImpl {
68 } 68 }
69 69
70 //============== 70 //==============
71 - public int updateLive(Integer id, String auditor_id,String updater, Integer activity_status, String msg) { 71 + public int updateLive(Integer id, String auditor_id, String updater, Integer activity_status, String msg) {
72 ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(id); 72 ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(id);
73 shyLive.setAuditor(auditor_id); 73 shyLive.setAuditor(auditor_id);
74 shyLive.setShenhe_state(CommonConst.RECEIVE_AUDIT); 74 shyLive.setShenhe_state(CommonConst.RECEIVE_AUDIT);
@@ -96,19 +96,19 @@ public class LiveServiceImpl { @@ -96,19 +96,19 @@ public class LiveServiceImpl {
96 } 96 }
97 criteria.andGreaterThanOrEqualTo("activity_start_time", startdate); 97 criteria.andGreaterThanOrEqualTo("activity_start_time", startdate);
98 } 98 }
99 - if ( CommonUtils.isNotEmpty(liveDTO.getEnd_date())) {  
100 - Timestamp enddate = null;  
101 - try {  
102 - enddate = CommonUtils.parseDate(liveDTO.getEnd_date(), "yyyy-MM-dd");  
103 - } catch (ParseException e) {  
104 - e.printStackTrace();  
105 - }  
106 - criteria.andLessThanOrEqualTo("activity_start_time", enddate); 99 + if (CommonUtils.isNotEmpty(liveDTO.getEnd_date())) {
  100 + Timestamp enddate = null;
  101 + try {
  102 + enddate = CommonUtils.parseDate(liveDTO.getEnd_date(), "yyyy-MM-dd");
  103 + } catch (ParseException e) {
  104 + e.printStackTrace();
  105 + }
  106 + criteria.andLessThanOrEqualTo("activity_start_time", enddate);
107 } 107 }
108 if (CommonUtils.isNotEmpty(liveDTO.getActivity_name())) { 108 if (CommonUtils.isNotEmpty(liveDTO.getActivity_name())) {
109 criteria.andLike("activity_name", "%" + liveDTO.getActivity_name() + "%"); 109 criteria.andLike("activity_name", "%" + liveDTO.getActivity_name() + "%");
110 } 110 }
111 - 111 +
112 if (CommonUtils.isNotEmpty(liveDTO.getActivity_id())) { 112 if (CommonUtils.isNotEmpty(liveDTO.getActivity_id())) {
113 criteria.andEqualTo("activity_id", liveDTO.getActivity_id()); 113 criteria.andEqualTo("activity_id", liveDTO.getActivity_id());
114 } 114 }
@@ -121,9 +121,9 @@ public class LiveServiceImpl { @@ -121,9 +121,9 @@ public class LiveServiceImpl {
121 criteria.andEqualTo("auditor", liveDTO.getUserId()); 121 criteria.andEqualTo("auditor", liveDTO.getUserId());
122 } 122 }
123 } 123 }
124 - if (CommonUtils.isNotNull(liveDTO.getActivity_status()) ) { 124 + if (CommonUtils.isNotNull(liveDTO.getActivity_status())) {
125 criteria.andEqualTo("activity_status", liveDTO.getActivity_status()); 125 criteria.andEqualTo("activity_status", liveDTO.getActivity_status());
126 - } 126 + }
127 criteria.andEqualTo("is_show", 1); 127 criteria.andEqualTo("is_show", 1);
128 PageHelper.startPage(liveDTO.getPage(), liveDTO.getPageSize(), true); 128 PageHelper.startPage(liveDTO.getPage(), liveDTO.getPageSize(), true);
129 List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example); 129 List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example);
@@ -135,14 +135,14 @@ public class LiveServiceImpl { @@ -135,14 +135,14 @@ public class LiveServiceImpl {
135 public ShyLive getDetailsLive(Integer id) { 135 public ShyLive getDetailsLive(Integer id) {
136 ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(id); 136 ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(id);
137 if (!shyLive.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) { 137 if (!shyLive.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) {
138 - String updater = CommonUtils.isEmpty(shyLive.getUpdater()) || "null".equals(shyLive.getUpdater())? "自动通过":shyLive.getUpdater(); 138 + String updater = CommonUtils.isEmpty(shyLive.getUpdater()) || "null".equals(shyLive.getUpdater()) ? "自动通过" : shyLive.getUpdater();
139 String auditor_id = shyLive.getAuditor(); 139 String auditor_id = shyLive.getAuditor();
140 if (CommonUtils.isNotEmpty(auditor_id)) { 140 if (CommonUtils.isNotEmpty(auditor_id)) {
141 ShyUsers user = new ShyUsers(); 141 ShyUsers user = new ShyUsers();
142 user.setUser_id(auditor_id); 142 user.setUser_id(auditor_id);
143 user = shyUsersMapper.selectOne(user); 143 user = shyUsersMapper.selectOne(user);
144 - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail())? "" : user.getEmail();  
145 - String userName = CommonUtils.isEmpty(user.getUsername()) ? email: user.getUsername(); 144 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  145 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
146 updater = userName; 146 updater = userName;
147 } 147 }
148 shyLive.setUpdater(updater); 148 shyLive.setUpdater(updater);
@@ -158,7 +158,8 @@ public class LiveServiceImpl { @@ -158,7 +158,8 @@ public class LiveServiceImpl {
158 for (String cid : cids) { 158 for (String cid : cids) {
159 ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(Integer.parseInt(cid)); 159 ShyLive shyLive = shyLiveMapper.selectByPrimaryKey(Integer.parseInt(cid));
160 if (CommonUtils.isNotNull(shyLive) && shyLive.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) { 160 if (CommonUtils.isNotNull(shyLive) && shyLive.getShenhe_state().equals(CommonConst.RECEIVE_BEFORE)) {
161 - shyLive.setAuditor(userId);; 161 + shyLive.setAuditor(userId);
  162 + ;
162 shyLive.setShenhe_state(CommonConst.RECEIVE_AFTER); 163 shyLive.setShenhe_state(CommonConst.RECEIVE_AFTER);
163 shyLiveMapper.updateByPrimaryKeySelective(shyLive); 164 shyLiveMapper.updateByPrimaryKeySelective(shyLive);
164 n++; 165 n++;
@@ -205,6 +206,7 @@ public class LiveServiceImpl { @@ -205,6 +206,7 @@ public class LiveServiceImpl {
205 206
206 /** 207 /**
207 * 根据条件导出数据excel 208 * 根据条件导出数据excel
  209 + *
208 * @return 210 * @return
209 */ 211 */
210 public List<ShyLive> findByCondition(LiveDTO liveDTO) { 212 public List<ShyLive> findByCondition(LiveDTO liveDTO) {
@@ -212,8 +214,8 @@ public class LiveServiceImpl { @@ -212,8 +214,8 @@ public class LiveServiceImpl {
212 Example.Criteria criteria = example.createCriteria(); 214 Example.Criteria criteria = example.createCriteria();
213 if (CommonUtils.isNotEmpty(liveDTO.getOrderByClause())) { 215 if (CommonUtils.isNotEmpty(liveDTO.getOrderByClause())) {
214 example.setOrderByClause(liveDTO.getOrderByClause()); 216 example.setOrderByClause(liveDTO.getOrderByClause());
215 - }else{  
216 - example.setOrderByClause("activity_start_time"); 217 + } else {
  218 + example.setOrderByClause("activity_start_time");
217 } 219 }
218 if (CommonUtils.isNotEmpty(liveDTO.getStart_date())) { 220 if (CommonUtils.isNotEmpty(liveDTO.getStart_date())) {
219 Timestamp startdate = null; 221 Timestamp startdate = null;
@@ -225,18 +227,18 @@ public class LiveServiceImpl { @@ -225,18 +227,18 @@ public class LiveServiceImpl {
225 criteria.andGreaterThanOrEqualTo("activity_start_time", startdate); 227 criteria.andGreaterThanOrEqualTo("activity_start_time", startdate);
226 } 228 }
227 if (CommonUtils.isNotEmpty(liveDTO.getEnd_date())) { 229 if (CommonUtils.isNotEmpty(liveDTO.getEnd_date())) {
228 - Timestamp enddate = null;  
229 - try {  
230 - enddate = CommonUtils.parseDate(liveDTO.getEnd_date(), "yyyy-MM-dd");  
231 - } catch (ParseException e) {  
232 - e.printStackTrace();  
233 - }  
234 - criteria.andLessThanOrEqualTo("activity_start_time", enddate); 230 + Timestamp enddate = null;
  231 + try {
  232 + enddate = CommonUtils.parseDate(liveDTO.getEnd_date(), "yyyy-MM-dd");
  233 + } catch (ParseException e) {
  234 + e.printStackTrace();
  235 + }
  236 + criteria.andLessThanOrEqualTo("activity_start_time", enddate);
235 } 237 }
236 if (CommonUtils.isNotEmpty(liveDTO.getActivity_name())) { 238 if (CommonUtils.isNotEmpty(liveDTO.getActivity_name())) {
237 criteria.andLike("activity_name", "%" + liveDTO.getActivity_name() + "%"); 239 criteria.andLike("activity_name", "%" + liveDTO.getActivity_name() + "%");
238 } 240 }
239 - 241 +
240 if (CommonUtils.isNotEmpty(liveDTO.getActivity_id())) { 242 if (CommonUtils.isNotEmpty(liveDTO.getActivity_id())) {
241 criteria.andEqualTo("activity_id", liveDTO.getActivity_id()); 243 criteria.andEqualTo("activity_id", liveDTO.getActivity_id());
242 } 244 }
@@ -249,15 +251,13 @@ public class LiveServiceImpl { @@ -249,15 +251,13 @@ public class LiveServiceImpl {
249 criteria.andEqualTo("auditor", liveDTO.getUserId()); 251 criteria.andEqualTo("auditor", liveDTO.getUserId());
250 } 252 }
251 } 253 }
252 - if (CommonUtils.isNotNull(liveDTO.getActivity_status()) ) { 254 + if (CommonUtils.isNotNull(liveDTO.getActivity_status())) {
253 criteria.andEqualTo("activity_status", liveDTO.getActivity_status()); 255 criteria.andEqualTo("activity_status", liveDTO.getActivity_status());
254 - } 256 + }
255 criteria.andEqualTo("is_show", 1); 257 criteria.andEqualTo("is_show", 1);
256 List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example); 258 List<ShyLive> shyLiveList = shyLiveMapper.selectByExample(example);
257 return shyLiveList; 259 return shyLiveList;
258 } 260 }
259 -  
260 -  
261 - 261 +
262 262
263 } 263 }
src/main/java/com/cnlive/shenhe/serviceImpl/NotspeakServiceImpl.java
@@ -54,24 +54,24 @@ public class NotspeakServiceImpl { @@ -54,24 +54,24 @@ public class NotspeakServiceImpl {
54 VideofilterServiceImpl videofilterServiceImpl; 54 VideofilterServiceImpl videofilterServiceImpl;
55 @Autowired 55 @Autowired
56 AuditPass Pass; 56 AuditPass Pass;
57 - 57 +
58 @Value("${spring.localhost.url}") 58 @Value("${spring.localhost.url}")
59 String localhost_url; 59 String localhost_url;
60 - 60 +
61 @Value("${speak_comment}") 61 @Value("${speak_comment}")
62 String speak_comment; 62 String speak_comment;
63 63
64 public ShyNotspeak getShySpeak(ShyNotspeak shyNotspeak) { 64 public ShyNotspeak getShySpeak(ShyNotspeak shyNotspeak) {
65 List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.select(shyNotspeak); 65 List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.select(shyNotspeak);
66 - if(CommonUtils.isNotNull(shyNotspeakList)&&shyNotspeakList.size()>0){  
67 - return shyNotspeakList.get(0); 66 + if (CommonUtils.isNotNull(shyNotspeakList) && shyNotspeakList.size() > 0) {
  67 + return shyNotspeakList.get(0);
68 } 68 }
69 return new ShyNotspeak(); 69 return new ShyNotspeak();
70 } 70 }
71 71
72 //************************************** 72 //**************************************
73 public List<ShyNotspeak> findshyNotspeak(ShyNotspeak shyNotspeak) { 73 public List<ShyNotspeak> findshyNotspeak(ShyNotspeak shyNotspeak) {
74 - 74 +
75 return shyNotspeakMapper.selectByRowBounds(shyNotspeak, new RowBounds(0, 100)); 75 return shyNotspeakMapper.selectByRowBounds(shyNotspeak, new RowBounds(0, 100));
76 } 76 }
77 77
@@ -92,167 +92,168 @@ public class NotspeakServiceImpl { @@ -92,167 +92,168 @@ public class NotspeakServiceImpl {
92 } 92 }
93 return true; 93 return true;
94 } 94 }
95 -  
96 - public ResponseBean notSpeakByComment(Integer commentId,Integer time, String userId) {  
97 - ResponseBean success;  
98 - ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);  
99 - JSONObject json = new JSONObject();  
100 - json.put("sid", comment.getComment_user_id().toString());  
101 - json.put("type", CommonConst.SPEAK_NOT);  
102 - json.put("minute", time);  
103 - JSONObject result = new JSONObject();  
104 - try {  
105 - result = Pass.commentSpeak(json, speak_comment);  
106 - } catch (Exception e) {  
107 - logger.error("评论禁言失败,comments_id:{}", comment.getId());  
108 - success=new ResponseBean(500,"评论禁言调用互动云服务器失败!");  
109 - return success;  
110 - }  
111 - if (result == null) {  
112 - logger.error("评论禁言错误,且无返回信息。comments_id:{}", comment.getId());  
113 - success=new ResponseBean(500,"评论禁言调用互动云返回结果为空!");  
114 - return success;  
115 - } else {  
116 - Integer errorCode = result.getInteger("errorCode");  
117 - String errorMessage = result.getString("errorMessage");  
118 - if (errorCode != 0) {  
119 - logger.error("评论禁言错误,comments_id:{},errorCode:{},errorMessage:{}", comment.getId(), errorCode, errorMessage);  
120 - success=new ResponseBean(500,"评论禁言调用互动云返回结果errorCode不为0!");  
121 - return success;  
122 - }  
123 - comment.setState(CommonConst.AUDIT_REFUSE);  
124 - comment.setMsg("评论禁言操作");  
125 - comment.setAuditor_id(userId);  
126 - comment.setReceive(1);//已领取  
127 - comment.setReceive_user_id(userId);  
128 - int i = shyCommentsMapper.updateByPrimaryKeySelective(comment);  
129 - if (i != 1) {  
130 - success=new ResponseBean(500,"评论禁言修改当前评论数据失败!");  
131 - return success;  
132 - }  
133 - boolean res =writeNotSpeakByComment(commentId,time,userId);  
134 - if(res==false){  
135 - success=new ResponseBean(500,"评论禁言修改禁言表失败!");  
136 - return success;  
137 - }  
138 - }  
139 - return new ResponseBean(); 95 +
  96 + public ResponseBean notSpeakByComment(Integer commentId, Integer time, String userId) {
  97 + ResponseBean success;
  98 + ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);
  99 + JSONObject json = new JSONObject();
  100 + json.put("sid", comment.getComment_user_id().toString());
  101 + json.put("type", CommonConst.SPEAK_NOT);
  102 + json.put("minute", time);
  103 + JSONObject result = new JSONObject();
  104 + try {
  105 + result = Pass.commentSpeak(json, speak_comment);
  106 + } catch (Exception e) {
  107 + logger.error("评论禁言失败,comments_id:{}", comment.getId());
  108 + success = new ResponseBean(500, "评论禁言调用互动云服务器失败!");
  109 + return success;
  110 + }
  111 + if (result == null) {
  112 + logger.error("评论禁言错误,且无返回信息。comments_id:{}", comment.getId());
  113 + success = new ResponseBean(500, "评论禁言调用互动云返回结果为空!");
  114 + return success;
  115 + } else {
  116 + Integer errorCode = result.getInteger("errorCode");
  117 + String errorMessage = result.getString("errorMessage");
  118 + if (errorCode != 0) {
  119 + logger.error("评论禁言错误,comments_id:{},errorCode:{},errorMessage:{}", comment.getId(), errorCode, errorMessage);
  120 + success = new ResponseBean(500, "评论禁言调用互动云返回结果errorCode不为0!");
  121 + return success;
  122 + }
  123 + comment.setState(CommonConst.AUDIT_REFUSE);
  124 + comment.setMsg("评论禁言操作");
  125 + comment.setAuditor_id(userId);
  126 + comment.setReceive(1);//已领取
  127 + comment.setReceive_user_id(userId);
  128 + int i = shyCommentsMapper.updateByPrimaryKeySelective(comment);
  129 + if (i != 1) {
  130 + success = new ResponseBean(500, "评论禁言修改当前评论数据失败!");
  131 + return success;
  132 + }
  133 + boolean res = writeNotSpeakByComment(commentId, time, userId);
  134 + if (res == false) {
  135 + success = new ResponseBean(500, "评论禁言修改禁言表失败!");
  136 + return success;
  137 + }
  138 + }
  139 + return new ResponseBean();
140 } 140 }
141 - 141 +
142 public ResponseBean querySpeakState(Integer commentId, String userId) { 142 public ResponseBean querySpeakState(Integer commentId, String userId) {
143 - ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);  
144 - ShyNotspeak shyNotspeak=new ShyNotspeak();  
145 - shyNotspeak.setUser_id(comment.getComment_user_id());  
146 - shyNotspeak.setState(CommonConst.SPEAK_NOT);  
147 - List<ShyNotspeak> shyNotspeakList = findshyNotspeak(shyNotspeak);  
148 - if(shyNotspeakList.size()>0){  
149 - shyNotspeak =shyNotspeakList.get(0);  
150 - return new ResponseBean(500,"当前用户已被禁言,禁言剩余时长:"+(shyNotspeak.getEnd_time().getTime()-System.currentTimeMillis())/(1000*60)+"分钟,解禁时间:"+CommonUtils.formatDate(shyNotspeak.getEnd_time(), "yyyy-MM-dd HH:mm:ss"));  
151 - }  
152 - return new ResponseBean(); 143 + ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);
  144 + ShyNotspeak shyNotspeak = new ShyNotspeak();
  145 + shyNotspeak.setUser_id(comment.getComment_user_id());
  146 + shyNotspeak.setState(CommonConst.SPEAK_NOT);
  147 + List<ShyNotspeak> shyNotspeakList = findshyNotspeak(shyNotspeak);
  148 + if (shyNotspeakList.size() > 0) {
  149 + shyNotspeak = shyNotspeakList.get(0);
  150 + return new ResponseBean(500, "当前用户已被禁言,禁言剩余时长:" + (shyNotspeak.getEnd_time().getTime() - System.currentTimeMillis()) / (1000 * 60) + "分钟,解禁时间:" + CommonUtils.formatDate(shyNotspeak.getEnd_time(), "yyyy-MM-dd HH:mm:ss"));
  151 + }
  152 + return new ResponseBean();
153 } 153 }
154 - public ResponseBean speak(Integer notSpeakId, Integer type,Integer time, String userId) {  
155 - ResponseBean success;  
156 - ShyNotspeak shyNotspeak=selectByPrimaryKey(notSpeakId);  
157 - JSONObject json = new JSONObject();  
158 - json.put("sid", shyNotspeak.getUser_id().toString());  
159 - json.put("type", type);  
160 - json.put("minute", time);  
161 - JSONObject result = new JSONObject();  
162 - try {  
163 - result = Pass.commentSpeak(json, speak_comment);  
164 - } catch (Exception e) {  
165 - logger.error("评论禁言失败,shyNotspeak_id:{}", shyNotspeak.getId());  
166 - success=new ResponseBean(500,"评论禁言调用互动云服务器失败!");  
167 - return success;  
168 - }  
169 - if (result == null) {  
170 - logger.error("评论禁言错误,且无返回信息。shyNotspeak_id:{}", shyNotspeak.getId());  
171 - success=new ResponseBean(500,"评论禁言调用互动云返回结果为空!");  
172 - return success;  
173 - } else {  
174 - Integer errorCode = result.getInteger("errorCode");  
175 - String errorMessage = result.getString("errorMessage");  
176 - if (errorCode != 0) {  
177 - logger.error("评论禁言错误,shyNotspeak_id:{},errorCode:{},errorMessage:{}", shyNotspeak.getId(), errorCode, errorMessage);  
178 - success=new ResponseBean(500,"评论禁言调用互动云返回结果errorCode不为0!");  
179 - return success;  
180 - }  
181 - String msg=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss")+"解除禁言";  
182 - shyNotspeak.setState(type);  
183 - if(type.equals(CommonConst.SPEAK_NOT)){  
184 - shyNotspeak.setStart_time(CommonUtils.getCurrentTime());  
185 - shyNotspeak.setTime(time);  
186 - shyNotspeak.setEnd_time(CommonUtils.getAddTime(time));  
187 - shyNotspeak.setCount(shyNotspeak.getCount()+1);  
188 - msg=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss")+"开始禁言,禁言时长为"+time+"分钟,禁言管理里面禁言的";  
189 - }  
190 - if(CommonUtils.isNotEmpty(userId)){  
191 - shyNotspeak.setAuditor(userId);  
192 - shyNotspeak.setUpdater("");  
193 - }else{  
194 - shyNotspeak.setAuditor(null);  
195 - shyNotspeak.setUpdater("自动解除");  
196 - }  
197 - shyNotspeak.setUpdated_at(CommonUtils.getCurrentTime());  
198 - shyNotspeak.setMsg(shyNotspeak.getMsg()+"\n"+msg);  
199 - boolean res =updateshyNotspeak(shyNotspeak);  
200 - if(res==false){  
201 - success=new ResponseBean(500,"评论禁言修改禁言表失败!");  
202 - return success;  
203 - }  
204 -  
205 - }  
206 - return new ResponseBean(); 154 +
  155 + public ResponseBean speak(Integer notSpeakId, Integer type, Integer time, String userId) {
  156 + ResponseBean success;
  157 + ShyNotspeak shyNotspeak = selectByPrimaryKey(notSpeakId);
  158 + JSONObject json = new JSONObject();
  159 + json.put("sid", shyNotspeak.getUser_id().toString());
  160 + json.put("type", type);
  161 + json.put("minute", time);
  162 + JSONObject result = new JSONObject();
  163 + try {
  164 + result = Pass.commentSpeak(json, speak_comment);
  165 + } catch (Exception e) {
  166 + logger.error("评论禁言失败,shyNotspeak_id:{}", shyNotspeak.getId());
  167 + success = new ResponseBean(500, "评论禁言调用互动云服务器失败!");
  168 + return success;
  169 + }
  170 + if (result == null) {
  171 + logger.error("评论禁言错误,且无返回信息。shyNotspeak_id:{}", shyNotspeak.getId());
  172 + success = new ResponseBean(500, "评论禁言调用互动云返回结果为空!");
  173 + return success;
  174 + } else {
  175 + Integer errorCode = result.getInteger("errorCode");
  176 + String errorMessage = result.getString("errorMessage");
  177 + if (errorCode != 0) {
  178 + logger.error("评论禁言错误,shyNotspeak_id:{},errorCode:{},errorMessage:{}", shyNotspeak.getId(), errorCode, errorMessage);
  179 + success = new ResponseBean(500, "评论禁言调用互动云返回结果errorCode不为0!");
  180 + return success;
  181 + }
  182 + String msg = CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss") + "解除禁言";
  183 + shyNotspeak.setState(type);
  184 + if (type.equals(CommonConst.SPEAK_NOT)) {
  185 + shyNotspeak.setStart_time(CommonUtils.getCurrentTime());
  186 + shyNotspeak.setTime(time);
  187 + shyNotspeak.setEnd_time(CommonUtils.getAddTime(time));
  188 + shyNotspeak.setCount(shyNotspeak.getCount() + 1);
  189 + msg = CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss") + "开始禁言,禁言时长为" + time + "分钟,禁言管理里面禁言的";
  190 + }
  191 + if (CommonUtils.isNotEmpty(userId)) {
  192 + shyNotspeak.setAuditor(userId);
  193 + shyNotspeak.setUpdater("");
  194 + } else {
  195 + shyNotspeak.setAuditor(null);
  196 + shyNotspeak.setUpdater("自动解除");
  197 + }
  198 + shyNotspeak.setUpdated_at(CommonUtils.getCurrentTime());
  199 + shyNotspeak.setMsg(shyNotspeak.getMsg() + "\n" + msg);
  200 + boolean res = updateshyNotspeak(shyNotspeak);
  201 + if (res == false) {
  202 + success = new ResponseBean(500, "评论禁言修改禁言表失败!");
  203 + return success;
  204 + }
  205 +
  206 + }
  207 + return new ResponseBean();
207 } 208 }
208 209
209 -  
210 - public boolean writeNotSpeakByComment(Integer commentId,Integer time, String userId){  
211 - boolean result=false;  
212 - ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);  
213 - ShyNotspeak shyNotspeak=new ShyNotspeak();  
214 - shyNotspeak.setUser_id(comment.getComment_user_id());  
215 - String msg=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss")+"开始禁言,禁言时长为"+time+"分钟,禁言的评论为:'"+comment.getComment_content()+"'";  
216 -  
217 - List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.select(shyNotspeak);  
218 - if(CommonUtils.isNotNull(shyNotspeakList)&&shyNotspeakList.size()>0){  
219 - ShyNotspeak notspeak=shyNotspeakList.get(0);  
220 - notspeak.setUser_name(comment.getComment_user_name());  
221 - notspeak.setUser_avatar(comment.getComment_user_avatar());  
222 - notspeak.setSp_id(comment.getSpid());  
223 - notspeak.setState(CommonConst.SPEAK_NOT);  
224 - notspeak.setStart_time(CommonUtils.getCurrentTime());  
225 - notspeak.setTime(time);  
226 - notspeak.setEnd_time(CommonUtils.getAddTime(time));  
227 - notspeak.setUpdated_at(CommonUtils.getCurrentTime());  
228 - notspeak.setMsg(notspeak.getMsg()+"\n"+msg);  
229 - notspeak.setCount(notspeak.getCount()+1);  
230 - notspeak.setUpdater("");  
231 - notspeak.setAuditor(userId);  
232 - result=updateshyNotspeak(notspeak);  
233 - }else{  
234 - shyNotspeak.setUser_name(comment.getComment_user_name());  
235 - shyNotspeak.setUser_id(comment.getComment_user_id());  
236 - shyNotspeak.setUser_avatar(comment.getComment_user_avatar());  
237 - shyNotspeak.setSp_id(comment.getSpid());  
238 - shyNotspeak.setState(CommonConst.SPEAK_NOT);  
239 - shyNotspeak.setStart_time(CommonUtils.getCurrentTime());  
240 - shyNotspeak.setTime(time);  
241 - shyNotspeak.setEnd_time(CommonUtils.getAddTime(time));  
242 - shyNotspeak.setCreated_at(CommonUtils.getCurrentTime());  
243 - shyNotspeak.setUpdated_at(CommonUtils.getCurrentTime());  
244 - shyNotspeak.setMsg(msg);  
245 - shyNotspeak.setCount(1);  
246 - shyNotspeak.setUpdater("");  
247 - shyNotspeak.setAuditor(userId);  
248 - result=impotshyNotspeak(shyNotspeak);  
249 -  
250 - }  
251 - return result; 210 +
  211 + public boolean writeNotSpeakByComment(Integer commentId, Integer time, String userId) {
  212 + boolean result = false;
  213 + ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);
  214 + ShyNotspeak shyNotspeak = new ShyNotspeak();
  215 + shyNotspeak.setUser_id(comment.getComment_user_id());
  216 + String msg = CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss") + "开始禁言,禁言时长为" + time + "分钟,禁言的评论为:'" + comment.getComment_content() + "'";
  217 +
  218 + List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.select(shyNotspeak);
  219 + if (CommonUtils.isNotNull(shyNotspeakList) && shyNotspeakList.size() > 0) {
  220 + ShyNotspeak notspeak = shyNotspeakList.get(0);
  221 + notspeak.setUser_name(comment.getComment_user_name());
  222 + notspeak.setUser_avatar(comment.getComment_user_avatar());
  223 + notspeak.setSp_id(comment.getSpid());
  224 + notspeak.setState(CommonConst.SPEAK_NOT);
  225 + notspeak.setStart_time(CommonUtils.getCurrentTime());
  226 + notspeak.setTime(time);
  227 + notspeak.setEnd_time(CommonUtils.getAddTime(time));
  228 + notspeak.setUpdated_at(CommonUtils.getCurrentTime());
  229 + notspeak.setMsg(notspeak.getMsg() + "\n" + msg);
  230 + notspeak.setCount(notspeak.getCount() + 1);
  231 + notspeak.setUpdater("");
  232 + notspeak.setAuditor(userId);
  233 + result = updateshyNotspeak(notspeak);
  234 + } else {
  235 + shyNotspeak.setUser_name(comment.getComment_user_name());
  236 + shyNotspeak.setUser_id(comment.getComment_user_id());
  237 + shyNotspeak.setUser_avatar(comment.getComment_user_avatar());
  238 + shyNotspeak.setSp_id(comment.getSpid());
  239 + shyNotspeak.setState(CommonConst.SPEAK_NOT);
  240 + shyNotspeak.setStart_time(CommonUtils.getCurrentTime());
  241 + shyNotspeak.setTime(time);
  242 + shyNotspeak.setEnd_time(CommonUtils.getAddTime(time));
  243 + shyNotspeak.setCreated_at(CommonUtils.getCurrentTime());
  244 + shyNotspeak.setUpdated_at(CommonUtils.getCurrentTime());
  245 + shyNotspeak.setMsg(msg);
  246 + shyNotspeak.setCount(1);
  247 + shyNotspeak.setUpdater("");
  248 + shyNotspeak.setAuditor(userId);
  249 + result = impotshyNotspeak(shyNotspeak);
  250 +
  251 + }
  252 + return result;
252 } 253 }
253 254
254 public PageInfo<ShyNotspeak> getPage(NotSpeakDTO notSpeakDTO) { 255 public PageInfo<ShyNotspeak> getPage(NotSpeakDTO notSpeakDTO) {
255 - logger.info("接受参数对象为,NotSpeakDTO:{}", JSON.toJSONString(notSpeakDTO)); 256 + logger.info("接受参数对象为,NotSpeakDTO:{}", JSON.toJSONString(notSpeakDTO));
256 Example example = new Example(ShyNotspeak.class); 257 Example example = new Example(ShyNotspeak.class);
257 Example.Criteria criteria = example.createCriteria(); 258 Example.Criteria criteria = example.createCriteria();
258 if (CommonUtils.isNotEmpty(notSpeakDTO.getOrderByClause())) { 259 if (CommonUtils.isNotEmpty(notSpeakDTO.getOrderByClause())) {
@@ -275,28 +276,28 @@ public class NotspeakServiceImpl { @@ -275,28 +276,28 @@ public class NotspeakServiceImpl {
275 PageInfo<ShyNotspeak> pageInfo = new PageInfo<>(shyNotspeakList); 276 PageInfo<ShyNotspeak> pageInfo = new PageInfo<>(shyNotspeakList);
276 return pageInfo; 277 return pageInfo;
277 } 278 }
278 -  
279 - 279 +
  280 +
280 //************************************** 281 //**************************************
281 public ShyNotspeak selectByPrimaryKey(Integer id) { 282 public ShyNotspeak selectByPrimaryKey(Integer id) {
282 - ShyNotspeak shyNotspeak = shyNotspeakMapper.selectByPrimaryKey(id); 283 + ShyNotspeak shyNotspeak = shyNotspeakMapper.selectByPrimaryKey(id);
283 return shyNotspeak; 284 return shyNotspeak;
284 } 285 }
285 - 286 +
286 public int updateByPrimaryKeySelective(ShyNotspeak shyNotspeak) { 287 public int updateByPrimaryKeySelective(ShyNotspeak shyNotspeak) {
287 return shyNotspeakMapper.updateByPrimaryKeySelective(shyNotspeak); 288 return shyNotspeakMapper.updateByPrimaryKeySelective(shyNotspeak);
288 } 289 }
289 290
290 - public List<ShyNotspeak> getNotSpeakByTime() {  
291 - Example example = new Example(ShyNotspeak.class);  
292 - Example.Criteria criteria = example.createCriteria();  
293 - criteria.andEqualTo("state", CommonConst.SPEAK_NOT);  
294 - criteria.andLessThan("end_time", CommonUtils.getCurrentTime()); 291 + public List<ShyNotspeak> getNotSpeakByTime() {
  292 + Example example = new Example(ShyNotspeak.class);
  293 + Example.Criteria criteria = example.createCriteria();
  294 + criteria.andEqualTo("state", CommonConst.SPEAK_NOT);
  295 + criteria.andLessThan("end_time", CommonUtils.getCurrentTime());
  296 +
  297 + List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.selectByExample(example);
  298 + return shyNotspeakList;
  299 + }
295 300
296 - List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.selectByExample(example);  
297 - return shyNotspeakList;  
298 - }  
299 -  
300 301
301 } 302 }
302 303
src/main/java/com/cnlive/shenhe/serviceImpl/SitesServiceImpl.java
@@ -42,7 +42,7 @@ public class SitesServiceImpl { @@ -42,7 +42,7 @@ public class SitesServiceImpl {
42 } 42 }
43 if (CommonUtils.isNotEmpty(sitesDTO.getKeyword())) { 43 if (CommonUtils.isNotEmpty(sitesDTO.getKeyword())) {
44 criteria.andLike("name", "%" + sitesDTO.getKeyword() + "%"); 44 criteria.andLike("name", "%" + sitesDTO.getKeyword() + "%");
45 - criteria2.andLike("spid", "%" + sitesDTO.getKeyword() + "%"); 45 + criteria2.andLike("spid", "%" + sitesDTO.getKeyword() + "%");
46 example.or(criteria2); 46 example.or(criteria2);
47 } 47 }
48 if (CommonUtils.isNotNull(sitesDTO.getSpId())) { 48 if (CommonUtils.isNotNull(sitesDTO.getSpId())) {
@@ -76,8 +76,8 @@ public class SitesServiceImpl { @@ -76,8 +76,8 @@ public class SitesServiceImpl {
76 criteria.andEqualTo("spid", spId); 76 criteria.andEqualTo("spid", spId);
77 } 77 }
78 List<ShySites> shySites = shySitesMapper.selectByExample(example); 78 List<ShySites> shySites = shySitesMapper.selectByExample(example);
79 - if(CommonUtils.isNotNull(shySites)&&shySites.size()>0){  
80 - return shySites.get(0); 79 + if (CommonUtils.isNotNull(shySites) && shySites.size() > 0) {
  80 + return shySites.get(0);
81 } 81 }
82 return null; 82 return null;
83 } 83 }
@@ -89,13 +89,15 @@ public class SitesServiceImpl { @@ -89,13 +89,15 @@ public class SitesServiceImpl {
89 criteria.andEqualTo("name", sp_desc); 89 criteria.andEqualTo("name", sp_desc);
90 } 90 }
91 List<ShySites> shySites = shySitesMapper.selectByExample(example); 91 List<ShySites> shySites = shySitesMapper.selectByExample(example);
92 - if(CommonUtils.isNotNull(shySites)&&shySites.size()>0){  
93 - return shySites.get(0); 92 + if (CommonUtils.isNotNull(shySites) && shySites.size() > 0) {
  93 + return shySites.get(0);
94 } 94 }
95 return null; 95 return null;
96 } 96 }
  97 +
97 /** 98 /**
98 * 获取免审白名单列表(点播) 99 * 获取免审白名单列表(点播)
  100 + *
99 * @return 101 * @return
100 */ 102 */
101 public List<Integer> getBusinessList(Integer business_) { 103 public List<Integer> getBusinessList(Integer business_) {
@@ -112,19 +114,19 @@ public class SitesServiceImpl { @@ -112,19 +114,19 @@ public class SitesServiceImpl {
112 } 114 }
113 return sites; 115 return sites;
114 } 116 }
115 -  
116 - public String getUpdater(String updater,String auditor_id){  
117 - 117 +
  118 + public String getUpdater(String updater, String auditor_id) {
  119 +
118 if (CommonUtils.isNotEmpty(auditor_id)) { 120 if (CommonUtils.isNotEmpty(auditor_id)) {
119 ShyUsers user = new ShyUsers(); 121 ShyUsers user = new ShyUsers();
120 user.setUser_id(auditor_id); 122 user.setUser_id(auditor_id);
121 user = usersService.select(user); 123 user = usersService.select(user);
122 if (CommonUtils.isNotNull(user)) { 124 if (CommonUtils.isNotNull(user)) {
123 - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail(); 125 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
124 String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername(); 126 String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
125 - updater = userName ; 127 + updater = userName;
126 } 128 }
127 } 129 }
128 - return updater; 130 + return updater;
129 } 131 }
130 } 132 }
src/main/java/com/cnlive/shenhe/serviceImpl/UsersServiceImpl.java
@@ -25,27 +25,27 @@ public class UsersServiceImpl { @@ -25,27 +25,27 @@ public class UsersServiceImpl {
25 private static Logger logger = LoggerFactory.getLogger(UsersServiceImpl.class); 25 private static Logger logger = LoggerFactory.getLogger(UsersServiceImpl.class);
26 @Autowired 26 @Autowired
27 ShyUsersMapper shyUsersMapper; 27 ShyUsersMapper shyUsersMapper;
28 - 28 +
29 public PageInfo<ShyUsers> getPage(UsersDTO usersDTO) { 29 public PageInfo<ShyUsers> getPage(UsersDTO usersDTO) {
30 logger.info("接受参数列表为,UsersDTO:{}", JSON.toJSONString(usersDTO)); 30 logger.info("接受参数列表为,UsersDTO:{}", JSON.toJSONString(usersDTO));
31 Example example = new Example(ShyUsers.class); 31 Example example = new Example(ShyUsers.class);
32 Example.Criteria criteria = example.createCriteria(); 32 Example.Criteria criteria = example.createCriteria();
33 if (CommonUtils.isNotEmpty(usersDTO.getOrderByClause())) { 33 if (CommonUtils.isNotEmpty(usersDTO.getOrderByClause())) {
34 example.setOrderByClause(usersDTO.getOrderByClause()); 34 example.setOrderByClause(usersDTO.getOrderByClause());
35 - }else{  
36 - example.setOrderByClause("created_at desc"); 35 + } else {
  36 + example.setOrderByClause("created_at desc");
37 } 37 }
38 if (CommonUtils.isNotEmpty(usersDTO.getUsername())) { 38 if (CommonUtils.isNotEmpty(usersDTO.getUsername())) {
39 - criteria.andLike("username", "%" + usersDTO.getUsername() + "%"); 39 + criteria.andLike("username", "%" + usersDTO.getUsername() + "%");
40 } 40 }
41 - if(CommonUtils.isNotEmpty(usersDTO.getMobile())){  
42 - criteria.andLike("mobile", "%" + usersDTO.getMobile() + "%" ); 41 + if (CommonUtils.isNotEmpty(usersDTO.getMobile())) {
  42 + criteria.andLike("mobile", "%" + usersDTO.getMobile() + "%");
43 } 43 }
44 - if(CommonUtils.isNotEmpty(usersDTO.getCompany_brief())){  
45 - criteria.andLike("company_brief", "%" + usersDTO.getCompany_brief() + "%" ); 44 + if (CommonUtils.isNotEmpty(usersDTO.getCompany_brief())) {
  45 + criteria.andLike("company_brief", "%" + usersDTO.getCompany_brief() + "%");
46 } 46 }
47 - if(CommonUtils.isNotNull(usersDTO.getSp_id())){  
48 - criteria.andEqualTo("sp_id", usersDTO.getSp_id() ); 47 + if (CommonUtils.isNotNull(usersDTO.getSp_id())) {
  48 + criteria.andEqualTo("sp_id", usersDTO.getSp_id());
49 } 49 }
50 PageHelper.startPage(usersDTO.getPage(), usersDTO.getPageSize(), true); 50 PageHelper.startPage(usersDTO.getPage(), usersDTO.getPageSize(), true);
51 List<ShyUsers> ShyUsersList = shyUsersMapper.selectByExample(example); 51 List<ShyUsers> ShyUsersList = shyUsersMapper.selectByExample(example);
@@ -73,7 +73,7 @@ public class UsersServiceImpl { @@ -73,7 +73,7 @@ public class UsersServiceImpl {
73 public ShyUsers select(ShyUsers shyUsers) { 73 public ShyUsers select(ShyUsers shyUsers) {
74 return shyUsersMapper.selectOne(shyUsers); 74 return shyUsersMapper.selectOne(shyUsers);
75 } 75 }
76 - 76 +
77 public boolean update(ShyUsers shyUsers) { 77 public boolean update(ShyUsers shyUsers) {
78 return shyUsersMapper.updateByPrimaryKeySelective(shyUsers) == 1; 78 return shyUsersMapper.updateByPrimaryKeySelective(shyUsers) == 1;
79 } 79 }
src/main/java/com/cnlive/shenhe/serviceImpl/UsersfreeServiceImpl.java
@@ -25,12 +25,12 @@ import java.util.List; @@ -25,12 +25,12 @@ import java.util.List;
25 */ 25 */
26 @Service 26 @Service
27 public class UsersfreeServiceImpl { 27 public class UsersfreeServiceImpl {
28 - private static Logger logger = LoggerFactory.getLogger(UsersfreeServiceImpl.class); 28 + private static Logger logger = LoggerFactory.getLogger(UsersfreeServiceImpl.class);
29 @Autowired 29 @Autowired
30 ShyUsersfreeMapper shyUsersfreeMapper; 30 ShyUsersfreeMapper shyUsersfreeMapper;
31 @Autowired 31 @Autowired
32 AuditPass Pass; 32 AuditPass Pass;
33 - 33 +
34 public ShyUsersfree get(Integer id) { 34 public ShyUsersfree get(Integer id) {
35 return shyUsersfreeMapper.selectByPrimaryKey(id); 35 return shyUsersfreeMapper.selectByPrimaryKey(id);
36 } 36 }
@@ -38,117 +38,118 @@ public class UsersfreeServiceImpl { @@ -38,117 +38,118 @@ public class UsersfreeServiceImpl {
38 public ShyUsersfree select(ShyUsersfree shyUsersfree) { 38 public ShyUsersfree select(ShyUsersfree shyUsersfree) {
39 return shyUsersfreeMapper.selectOne(shyUsersfree); 39 return shyUsersfreeMapper.selectOne(shyUsersfree);
40 } 40 }
41 - 41 +
42 public Integer updateState(Integer id, Boolean isEnable) { 42 public Integer updateState(Integer id, Boolean isEnable) {
43 - ShyUsersfree shyUsersfree=get(id);  
44 - shyUsersfree.setIs_enable(isEnable);  
45 - return shyUsersfreeMapper.updateByPrimaryKeySelective(shyUsersfree);  
46 - }  
47 - 43 + ShyUsersfree shyUsersfree = get(id);
  44 + shyUsersfree.setIs_enable(isEnable);
  45 + return shyUsersfreeMapper.updateByPrimaryKeySelective(shyUsersfree);
  46 + }
  47 +
48 public PageInfo<ShyUsersfree> getpage(UsersFreeDTO usersFreeDTO) { 48 public PageInfo<ShyUsersfree> getpage(UsersFreeDTO usersFreeDTO) {
49 - logger.info("接受参数列表为,UsersFreeDTO:{}", JSON.toJSONString(usersFreeDTO));  
50 - Example example = new Example(ShyUsers.class);  
51 - Example.Criteria criteria = example.createCriteria();  
52 - if (CommonUtils.isNotEmpty(usersFreeDTO.getOrderByClause())) {  
53 - example.setOrderByClause(usersFreeDTO.getOrderByClause());  
54 - }else{  
55 - example.setOrderByClause("created_at desc");  
56 - }  
57 - if (CommonUtils.isNotEmpty(usersFreeDTO.getUserId())) {  
58 - criteria.andEqualTo("user_id", usersFreeDTO.getUserId() );  
59 - }  
60 - if(CommonUtils.isNotEmpty(usersFreeDTO.getMobile())){  
61 - criteria.andLike("mobile", "%" + usersFreeDTO.getMobile() + "%" );  
62 - }  
63 - PageHelper.startPage(usersFreeDTO.getPage(), usersFreeDTO.getPageSize(), true);  
64 - List<ShyUsersfree> ShyUsersList = shyUsersfreeMapper.selectByExample(example);  
65 - PageInfo<ShyUsersfree> pageInfo = new PageInfo<ShyUsersfree>(ShyUsersList);  
66 - return pageInfo; 49 + logger.info("接受参数列表为,UsersFreeDTO:{}", JSON.toJSONString(usersFreeDTO));
  50 + Example example = new Example(ShyUsers.class);
  51 + Example.Criteria criteria = example.createCriteria();
  52 + if (CommonUtils.isNotEmpty(usersFreeDTO.getOrderByClause())) {
  53 + example.setOrderByClause(usersFreeDTO.getOrderByClause());
  54 + } else {
  55 + example.setOrderByClause("created_at desc");
  56 + }
  57 + if (CommonUtils.isNotEmpty(usersFreeDTO.getUserId())) {
  58 + criteria.andEqualTo("user_id", usersFreeDTO.getUserId());
  59 + }
  60 + if (CommonUtils.isNotEmpty(usersFreeDTO.getMobile())) {
  61 + criteria.andLike("mobile", "%" + usersFreeDTO.getMobile() + "%");
  62 + }
  63 + PageHelper.startPage(usersFreeDTO.getPage(), usersFreeDTO.getPageSize(), true);
  64 + List<ShyUsersfree> ShyUsersList = shyUsersfreeMapper.selectByExample(example);
  65 + PageInfo<ShyUsersfree> pageInfo = new PageInfo<ShyUsersfree>(ShyUsersList);
  66 + return pageInfo;
67 } 67 }
68 - 68 +
69 /** 69 /**
70 * 通过spid、栏目、用户id来查看是否是免审 70 * 通过spid、栏目、用户id来查看是否是免审
  71 + *
71 * @param sp_id 72 * @param sp_id
72 * @param category 73 * @param category
73 * @param user_id 74 * @param user_id
74 * @return 75 * @return
75 */ 76 */
76 - public ShyUsersfree selectUser(Integer sp_id,String category,String user_id) {  
77 - ShyUsersfree shyUserfree=new ShyUsersfree();  
78 - shyUserfree.setSp_id(sp_id); 77 + public ShyUsersfree selectUser(Integer sp_id, String category, String user_id) {
  78 + ShyUsersfree shyUserfree = new ShyUsersfree();
  79 + shyUserfree.setSp_id(sp_id);
79 // shyUserfree.setCategory(category); 80 // shyUserfree.setCategory(category);
80 - shyUserfree.setUser_id(user_id);  
81 - shyUserfree.setIs_enable(true);  
82 - shyUserfree.setIs_delete(false);  
83 - ShyUsersfree shyUserfree1 = shyUsersfreeMapper.selectOne(shyUserfree);  
84 - if(shyUserfree1 != null && shyUserfree1.getCategory().contains(category)){  
85 - return shyUserfree1;  
86 - }  
87 - return null; 81 + shyUserfree.setUser_id(user_id);
  82 + shyUserfree.setIs_enable(true);
  83 + shyUserfree.setIs_delete(false);
  84 + ShyUsersfree shyUserfree1 = shyUsersfreeMapper.selectOne(shyUserfree);
  85 + if (shyUserfree1 != null && shyUserfree1.getCategory().contains(category)) {
  86 + return shyUserfree1;
  87 + }
  88 + return null;
88 } 89 }
89 90
90 - public boolean update(String userId, String userMobile, String write,Integer spId,String updater) {  
91 - JSONObject result = new JSONObject();  
92 - try {  
93 - result = Pass.queryUser(userId,userMobile);  
94 - } catch (Exception e) {  
95 - logger.error("用户白名单获取失败,userId:{},userMobile:{}", userId,userMobile);  
96 - return false;  
97 - }  
98 - if (result == null) {  
99 - logger.error("用户白名单返回无结果,userId:{},userMobile:{}", userId,userMobile);  
100 - return false;  
101 - } else {  
102 - Integer code = result.getInteger("errorCode");  
103 - if (code != 0) {  
104 - logger.error("用户白名单返回code值为,errorCode:{},errorMessage:{},userId:{},userMobile:{}", code, result.getString("errorMessage"), userId,userMobile);  
105 - return false;  
106 - }  
107 - JSONObject jsonData =result.getJSONObject("data");  
108 - String mobile=jsonData.getString("mobile");  
109 - String user_id=jsonData.getString("uid");  
110 - String user_name=jsonData.getString("nickName");  
111 - String email=jsonData.getString("email");  
112 -  
113 - ShyUsersfree shyUserfree=new ShyUsersfree();  
114 - shyUserfree.setUser_id(user_id);  
115 - ShyUsersfree shyUserfree1 = shyUsersfreeMapper.selectOne(shyUserfree);  
116 -  
117 - if(shyUserfree1 != null){  
118 - shyUserfree1.setMobile(mobile);  
119 - shyUserfree1.setCategory(write);  
120 - shyUserfree1.setUser_name(user_name);  
121 - shyUserfree1.setEmail(email);  
122 - shyUserfree1.setSp_id(spId);  
123 - shyUserfree1.setUpdated_at(CommonUtils.getCurrentTime());  
124 - shyUserfree1.setUpdater(updater);  
125 - shyUserfree1.setIs_delete(false);  
126 - shyUserfree1.setIs_enable(true);  
127 - int re = shyUsersfreeMapper.updateByPrimaryKeySelective(shyUserfree1); 91 + public boolean update(String userId, String userMobile, String write, Integer spId, String updater) {
  92 + JSONObject result = new JSONObject();
  93 + try {
  94 + result = Pass.queryUser(userId, userMobile);
  95 + } catch (Exception e) {
  96 + logger.error("用户白名单获取失败,userId:{},userMobile:{}", userId, userMobile);
  97 + return false;
  98 + }
  99 + if (result == null) {
  100 + logger.error("用户白名单返回无结果,userId:{},userMobile:{}", userId, userMobile);
  101 + return false;
  102 + } else {
  103 + Integer code = result.getInteger("errorCode");
  104 + if (code != 0) {
  105 + logger.error("用户白名单返回code值为,errorCode:{},errorMessage:{},userId:{},userMobile:{}", code, result.getString("errorMessage"), userId, userMobile);
  106 + return false;
  107 + }
  108 + JSONObject jsonData = result.getJSONObject("data");
  109 + String mobile = jsonData.getString("mobile");
  110 + String user_id = jsonData.getString("uid");
  111 + String user_name = jsonData.getString("nickName");
  112 + String email = jsonData.getString("email");
  113 +
  114 + ShyUsersfree shyUserfree = new ShyUsersfree();
  115 + shyUserfree.setUser_id(user_id);
  116 + ShyUsersfree shyUserfree1 = shyUsersfreeMapper.selectOne(shyUserfree);
  117 +
  118 + if (shyUserfree1 != null) {
  119 + shyUserfree1.setMobile(mobile);
  120 + shyUserfree1.setCategory(write);
  121 + shyUserfree1.setUser_name(user_name);
  122 + shyUserfree1.setEmail(email);
  123 + shyUserfree1.setSp_id(spId);
  124 + shyUserfree1.setUpdated_at(CommonUtils.getCurrentTime());
  125 + shyUserfree1.setUpdater(updater);
  126 + shyUserfree1.setIs_delete(false);
  127 + shyUserfree1.setIs_enable(true);
  128 + int re = shyUsersfreeMapper.updateByPrimaryKeySelective(shyUserfree1);
  129 + if (re != 1) {
  130 + return false;
  131 + }
  132 + } else {
  133 + shyUserfree.setMobile(mobile);
  134 + shyUserfree.setCategory(write);
  135 + shyUserfree.setUser_name(user_name);
  136 + shyUserfree.setEmail(email);
  137 + shyUserfree.setSp_id(spId);
  138 + shyUserfree.setCreated_at(CommonUtils.getCurrentTime());
  139 + shyUserfree.setUpdated_at(CommonUtils.getCurrentTime());
  140 + shyUserfree.setUpdater(updater);
  141 + shyUserfree.setIs_delete(false);
  142 + shyUserfree.setIs_enable(true);
  143 +
  144 + int re = shyUsersfreeMapper.insertSelective(shyUserfree);
128 if (re != 1) { 145 if (re != 1) {
129 - return false; 146 + return false;
130 } 147 }
131 - }else{  
132 - shyUserfree.setMobile(mobile);  
133 - shyUserfree.setCategory(write);  
134 - shyUserfree.setUser_name(user_name);  
135 - shyUserfree.setEmail(email);  
136 - shyUserfree.setSp_id(spId);  
137 - shyUserfree.setCreated_at(CommonUtils.getCurrentTime());  
138 - shyUserfree.setUpdated_at(CommonUtils.getCurrentTime());  
139 - shyUserfree.setUpdater(updater);  
140 - shyUserfree.setIs_delete(false);  
141 - shyUserfree.setIs_enable(true);  
142 -  
143 - int re = shyUsersfreeMapper.insertSelective(shyUserfree);  
144 - if (re != 1) {  
145 - return false;  
146 - }  
147 - }  
148 - } 148 + }
  149 + }
  150 +
  151 + return true;
  152 + }
149 153
150 - return true;  
151 - }  
152 154
153 -  
154 } 155 }
src/main/java/com/cnlive/shenhe/serviceImpl/VideofilterServiceImpl.java
@@ -30,7 +30,7 @@ public class VideofilterServiceImpl { @@ -30,7 +30,7 @@ public class VideofilterServiceImpl {
30 List<ShyVideofilter> shySites = shyVideofilterMapper.selectAll(); 30 List<ShyVideofilter> shySites = shyVideofilterMapper.selectAll();
31 return shySites; 31 return shySites;
32 } 32 }
33 - 33 +
34 public boolean impotVideofilter(ShyVideofilter videofilter) { 34 public boolean impotVideofilter(ShyVideofilter videofilter) {
35 int result = shyVideofilterMapper.insertSelective(videofilter); 35 int result = shyVideofilterMapper.insertSelective(videofilter);
36 if (result == 0) { 36 if (result == 0) {
src/main/java/com/cnlive/shenhe/utils/AntiFraudUtil.java
@@ -26,14 +26,14 @@ public class AntiFraudUtil { @@ -26,14 +26,14 @@ public class AntiFraudUtil {
26 private static final String REQUEST_URL_VIDEOSTREAM = "http://video-api.fengkongcloud.com/v2/saas/anti_fraud/videostream"; 26 private static final String REQUEST_URL_VIDEOSTREAM = "http://video-api.fengkongcloud.com/v2/saas/anti_fraud/videostream";
27 private static final String RESPONSE_URL_VIDEOSTREAM = "http://video-api.fengkongcloud.com/v2/saas/anti_fraud/query_videostream"; 27 private static final String RESPONSE_URL_VIDEOSTREAM = "http://video-api.fengkongcloud.com/v2/saas/anti_fraud/query_videostream";
28 private static final String FINISH_URL_VIDEOSTREAM = "http://video-api.fengkongcloud.com/v2/saas/anti_fraud/finish_videostream"; 28 private static final String FINISH_URL_VIDEOSTREAM = "http://video-api.fengkongcloud.com/v2/saas/anti_fraud/finish_videostream";
29 -  
30 - 29 +
  30 +
31 private static final String Contents_list = "https://www.fengkongcloud.com/ApiV2/ListService/lists"; 31 private static final String Contents_list = "https://www.fengkongcloud.com/ApiV2/ListService/lists";
32 32
33 /** 33 /**
34 * 智能文本过滤 34 * 智能文本过滤
35 * 35 *
36 - * @param text 需要过滤的文本 36 + * @param text 需要过滤的文本
37 * @param tokenId 建议传UID 37 * @param tokenId 建议传UID
38 * @param channel COMMENT,DYNAMIC_BUSINESS,DYNAMIC_USER,不传为COMMENT 38 * @param channel COMMENT,DYNAMIC_BUSINESS,DYNAMIC_USER,不传为COMMENT
39 * @return 通过:PASS 拒绝:REJECT 可疑:REVIEW 数美异常:null 39 * @return 通过:PASS 拒绝:REJECT 可疑:REVIEW 数美异常:null
@@ -41,7 +41,7 @@ public class AntiFraudUtil { @@ -41,7 +41,7 @@ public class AntiFraudUtil {
41 public static JSONObject filterText(String tokenId, String text, String channel) { 41 public static JSONObject filterText(String tokenId, String text, String channel) {
42 try { 42 try {
43 JSONObject result = reqTextFilter(tokenId, text, channel); 43 JSONObject result = reqTextFilter(tokenId, text, channel);
44 - 44 +
45 /** 45 /**
46 * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理 46 * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理
47 * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置 47 * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置
@@ -49,44 +49,45 @@ public class AntiFraudUtil { @@ -49,44 +49,45 @@ public class AntiFraudUtil {
49 */ 49 */
50 if (result != null) { 50 if (result != null) {
51 Integer code = result.getInteger("code"); 51 Integer code = result.getInteger("code");
52 - 52 +
53 if (code != null && code == 1100) { //请求成功 53 if (code != null && code == 1100) { //请求成功
54 - String riskLevel = result.getString("riskLevel");  
55 -  
56 - if ("PASS".equals(riskLevel)) {  
57 - return result;  
58 - }  
59 -  
60 - if ("REJECT".equals(riskLevel)) {  
61 - JSONObject detail = result.getJSONObject("detail");  
62 -  
63 - result.put("desc",  
64 - String.format("(%s)", detail.getString("riskTypeDesc")));  
65 - return result;  
66 - }  
67 -  
68 - if ("REVIEW".equals(riskLevel)) {  
69 - return result;  
70 - } 54 + String riskLevel = result.getString("riskLevel");
  55 +
  56 + if ("PASS".equals(riskLevel)) {
  57 + return result;
  58 + }
  59 +
  60 + if ("REJECT".equals(riskLevel)) {
  61 + JSONObject detail = result.getJSONObject("detail");
  62 +
  63 + result.put("desc",
  64 + String.format("(%s)", detail.getString("riskTypeDesc")));
  65 + return result;
  66 + }
  67 +
  68 + if ("REVIEW".equals(riskLevel)) {
  69 + return result;
  70 + }
71 } 71 }
72 } 72 }
73 return null; 73 return null;
74 } catch (Exception e) { 74 } catch (Exception e) {
75 - return null; 75 + return null;
76 } 76 }
77 } 77 }
78 78
79 79
80 /** 80 /**
81 * 智能图文过滤 81 * 智能图文过滤
82 - * @param channel COMMENT,NEWS(新闻),CULTURE_SPORTS(娱乐/体育),不传为COMMENT 82 + *
  83 + * @param channel COMMENT,NEWS(新闻),CULTURE_SPORTS(娱乐/体育),不传为COMMENT
83 * @param contents 要检测的网页内容,url链接或文本内容 84 * @param contents 要检测的网页内容,url链接或文本内容
84 - * @param tokenId 建议传UID 85 + * @param tokenId 建议传UID
85 * @return 通过:PASS 拒绝:REJECT 可疑:REVIEW 数美异常:null 86 * @return 通过:PASS 拒绝:REJECT 可疑:REVIEW 数美异常:null
86 */ 87 */
87 - public static JSONObject filterArticle(String tokenId, String contents ,String channel) { 88 + public static JSONObject filterArticle(String tokenId, String contents, String channel) {
88 try { 89 try {
89 - JSONObject result = reqArticleFilter(tokenId, contents ,channel); 90 + JSONObject result = reqArticleFilter(tokenId, contents, channel);
90 /** 91 /**
91 * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理 92 * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理
92 * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置 93 * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置
@@ -97,12 +98,12 @@ public class AntiFraudUtil { @@ -97,12 +98,12 @@ public class AntiFraudUtil {
97 return null; 98 return null;
98 } 99 }
99 } 100 }
100 - 101 +
101 /** 102 /**
102 * 智能图片过滤 103 * 智能图片过滤
103 * 104 *
104 - * @param picArray 需要过滤的图片的集合  
105 - * @param tokenId 建议传UID 105 + * @param picArray 需要过滤的图片的集合
  106 + * @param tokenId 建议传UID
106 * @return 通过:PASS 拒绝:REJECT 异常:REVIEW 107 * @return 通过:PASS 拒绝:REJECT 异常:REVIEW
107 */ 108 */
108 public static JSONObject filterImg(String tokenId, String picArray, String channel) { 109 public static JSONObject filterImg(String tokenId, String picArray, String channel) {
@@ -150,9 +151,9 @@ public class AntiFraudUtil { @@ -150,9 +151,9 @@ public class AntiFraudUtil {
150 } else { 151 } else {
151 jsonObj.put("type", "PASS"); 152 jsonObj.put("type", "PASS");
152 } 153 }
153 - }else{//数美请求结果code为失败状态  
154 - jsonObj.put("type", "REJECT");  
155 - jsonObj.put("desc","code:"+code+",message:"+result.getString("message") ); 154 + } else {//数美请求结果code为失败状态
  155 + jsonObj.put("type", "REJECT");
  156 + jsonObj.put("desc", "code:" + code + ",message:" + result.getString("message"));
156 } 157 }
157 return jsonObj; 158 return jsonObj;
158 } 159 }
@@ -165,11 +166,11 @@ public class AntiFraudUtil { @@ -165,11 +166,11 @@ public class AntiFraudUtil {
165 /** 166 /**
166 * 智能视频过滤 167 * 智能视频过滤
167 * 168 *
168 - * @param url 需要过滤的视频的url  
169 - * @param uuid 需要过滤的视频的唯一标识 169 + * @param url 需要过滤的视频的url
  170 + * @param uuid 需要过滤的视频的唯一标识
170 * @return 通过:PASS 拒绝:REJECT 异常:null 171 * @return 通过:PASS 拒绝:REJECT 异常:null
171 */ 172 */
172 - public static JSONObject filterVideo(String url,String uuid, String channel) { 173 + public static JSONObject filterVideo(String url, String uuid, String channel) {
173 try { 174 try {
174 JSONObject result = reqVideoFilter(url, uuid, channel); 175 JSONObject result = reqVideoFilter(url, uuid, channel);
175 /** 176 /**
@@ -186,7 +187,7 @@ public class AntiFraudUtil { @@ -186,7 +187,7 @@ public class AntiFraudUtil {
186 /** 187 /**
187 * 智能视频过滤 188 * 智能视频过滤
188 * 189 *
189 - * @param uuid 需要查看的视频的唯一标识 190 + * @param uuid 需要查看的视频的唯一标识
190 * @return 通过:PASS 拒绝:REJECT 异常:null 191 * @return 通过:PASS 拒绝:REJECT 异常:null
191 */ 192 */
192 public static JSONObject queryVideoResult(String uuid) { 193 public static JSONObject queryVideoResult(String uuid) {
@@ -194,7 +195,7 @@ public class AntiFraudUtil { @@ -194,7 +195,7 @@ public class AntiFraudUtil {
194 JSONObject userData = new JSONObject(); 195 JSONObject userData = new JSONObject();
195 userData.put("accessKey", ACCESSKEY); 196 userData.put("accessKey", ACCESSKEY);
196 userData.put("btId", uuid); 197 userData.put("btId", uuid);
197 - JSONObject result = HttpClientUtils.httpPost(RESPONSE_URL_VIDEO, userData,false); 198 + JSONObject result = HttpClientUtils.httpPost(RESPONSE_URL_VIDEO, userData, false);
198 System.out.println("响应:" + result); 199 System.out.println("响应:" + result);
199 return result; 200 return result;
200 } catch (Exception e) { 201 } catch (Exception e) {
@@ -203,71 +204,70 @@ public class AntiFraudUtil { @@ -203,71 +204,70 @@ public class AntiFraudUtil {
203 return null; 204 return null;
204 } 205 }
205 } 206 }
206 - 207 +
207 /** 208 /**
208 * 智能视频流过滤(直播) 209 * 智能视频流过滤(直播)
209 * 210 *
210 - * @param url 需要过滤的视频的url  
211 - * @param uuid 需要过滤的视频的唯一标识 211 + * @param url 需要过滤的视频的url
  212 + * @param uuid 需要过滤的视频的唯一标识
212 * @return 通过:PASS 拒绝:REJECT 异常:null 213 * @return 通过:PASS 拒绝:REJECT 异常:null
213 */ 214 */
214 - public static JSONObject filterVideoStream(String url,String uuid,String videoName, String channel) {  
215 - try {  
216 - JSONObject result = reqVideoFilterStream(url, uuid,videoName, channel);  
217 - /**  
218 - * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理  
219 - * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置  
220 - * 其余情况需要根据错误码进行重试或者其它异常处理  
221 - */  
222 - return result;  
223 - } catch (Exception e) {  
224 - return null;  
225 - } 215 + public static JSONObject filterVideoStream(String url, String uuid, String videoName, String channel) {
  216 + try {
  217 + JSONObject result = reqVideoFilterStream(url, uuid, videoName, channel);
  218 + /**
  219 + * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理
  220 + * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置
  221 + * 其余情况需要根据错误码进行重试或者其它异常处理
  222 + */
  223 + return result;
  224 + } catch (Exception e) {
  225 + return null;
  226 + }
226 } 227 }
227 - 228 +
228 /** 229 /**
229 * 智能视频流过滤(直播) 230 * 智能视频流过滤(直播)
230 * 231 *
231 - * @param uuid 需要查看的视频的唯一标识 232 + * @param uuid 需要查看的视频的唯一标识
232 * @return 通过:PASS 拒绝:REJECT 异常:null 233 * @return 通过:PASS 拒绝:REJECT 异常:null
233 */ 234 */
234 public static JSONObject queryVideoStreamResult() { 235 public static JSONObject queryVideoStreamResult() {
235 - try {  
236 - JSONObject userData = new JSONObject();  
237 - userData.put("accessKey", ACCESSKEY);  
238 - JSONObject result = HttpClientUtils.httpPost(RESPONSE_URL_VIDEOSTREAM, userData,false);  
239 - System.out.println("响应:" + result);  
240 - return result;  
241 - } catch (Exception e) {  
242 - System.out.println("...................接口请求失败:");  
243 - e.printStackTrace();  
244 - return null;  
245 - } 236 + try {
  237 + JSONObject userData = new JSONObject();
  238 + userData.put("accessKey", ACCESSKEY);
  239 + JSONObject result = HttpClientUtils.httpPost(RESPONSE_URL_VIDEOSTREAM, userData, false);
  240 + System.out.println("响应:" + result);
  241 + return result;
  242 + } catch (Exception e) {
  243 + System.out.println("...................接口请求失败:");
  244 + e.printStackTrace();
  245 + return null;
  246 + }
246 } 247 }
247 - 248 +
248 /** 249 /**
249 * 视频流关闭(直播--关闭) 250 * 视频流关闭(直播--关闭)
250 * 251 *
251 - * @param url 关闭的视频流的地址  
252 - * @param requestId 关闭的视频流的requestId 252 + * @param url 关闭的视频流的地址
  253 + * @param requestId 关闭的视频流的requestId
253 * @return 通过:PASS 拒绝:REJECT 异常:null 254 * @return 通过:PASS 拒绝:REJECT 异常:null
254 */ 255 */
255 - public static JSONObject finishVideoStream(String url,String requestId) {  
256 - try {  
257 - JSONObject result = reqFinishVideoStream(url, requestId);  
258 - /**  
259 - * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理  
260 - * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置  
261 - * 其余情况需要根据错误码进行重试或者其它异常处理  
262 - */  
263 - return result;  
264 - } catch (Exception e) {  
265 - return null;  
266 - } 256 + public static JSONObject finishVideoStream(String url, String requestId) {
  257 + try {
  258 + JSONObject result = reqFinishVideoStream(url, requestId);
  259 + /**
  260 + * 接口会返回code, code=1100 时说明请求成功,根据不同的 riskLevel 风险级别进行业务处理
  261 + * 当 code!=1100 时,如果是 1902 错误,需要检查参数配置
  262 + * 其余情况需要根据错误码进行重试或者其它异常处理
  263 + */
  264 + return result;
  265 + } catch (Exception e) {
  266 + return null;
  267 + }
267 } 268 }
268 269
269 270
270 -  
271 private static JSONObject reqTextFilter(String tokenId, String text, String channel) throws Exception { 271 private static JSONObject reqTextFilter(String tokenId, String text, String channel) throws Exception {
272 JSONObject userData = new JSONObject(); 272 JSONObject userData = new JSONObject();
273 273
@@ -280,7 +280,7 @@ public class AntiFraudUtil { @@ -280,7 +280,7 @@ public class AntiFraudUtil {
280 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT"); 280 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT");
281 userData.put("data", data); 281 userData.put("data", data);
282 282
283 - return HttpClientUtils.httpPost(REQUEST_URL_TEXT, userData,false); 283 + return HttpClientUtils.httpPost(REQUEST_URL_TEXT, userData, false);
284 } 284 }
285 285
286 private static JSONObject reqImgFilter(String tokenId, JSONArray imgs, String channel) throws Exception { 286 private static JSONObject reqImgFilter(String tokenId, JSONArray imgs, String channel) throws Exception {
@@ -295,57 +295,57 @@ public class AntiFraudUtil { @@ -295,57 +295,57 @@ public class AntiFraudUtil {
295 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT"); 295 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT");
296 userData.put("data", data); 296 userData.put("data", data);
297 297
298 - return HttpClientUtils.httpPost(REQUEST_URL_IMG, userData,false); 298 + return HttpClientUtils.httpPost(REQUEST_URL_IMG, userData, false);
299 } 299 }
300 300
301 - private static JSONObject reqVideoFilter(String url,String uuid, String channel) throws Exception { 301 + private static JSONObject reqVideoFilter(String url, String uuid, String channel) throws Exception {
302 JSONObject userData = new JSONObject(); 302 JSONObject userData = new JSONObject();
303 userData.put("accessKey", ACCESSKEY); 303 userData.put("accessKey", ACCESSKEY);
304 userData.put("btId", uuid); 304 userData.put("btId", uuid);
305 - userData.put("callback","http://apiwjjtest.cnlive.com/Daren/filterVideoResult/callbackVideoResult.action"); 305 + userData.put("callback", "http://apiwjjtest.cnlive.com/Daren/filterVideoResult/callbackVideoResult.action");
306 userData.put("type", "AD_PORN_PERSON_VIOLENCE"); 306 userData.put("type", "AD_PORN_PERSON_VIOLENCE");
307 307
308 308
309 JSONObject data = new JSONObject(); 309 JSONObject data = new JSONObject();
310 data.put("url", url); 310 data.put("url", url);
311 - data.put("addition","AUDIO"); 311 + data.put("addition", "AUDIO");
312 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT"); 312 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT");
313 userData.put("data", data); 313 userData.put("data", data);
314 314
315 - return HttpClientUtils.httpPost(REQUEST_URL_VIDEO, userData,false); 315 + return HttpClientUtils.httpPost(REQUEST_URL_VIDEO, userData, false);
316 } 316 }
317 -  
318 - private static JSONObject reqVideoFilterStream(String url,String uuid,String videoName, String channel) throws Exception {  
319 - JSONObject userData = new JSONObject();  
320 - userData.put("accessKey", ACCESSKEY); 317 +
  318 + private static JSONObject reqVideoFilterStream(String url, String uuid, String videoName, String channel) throws Exception {
  319 + JSONObject userData = new JSONObject();
  320 + userData.put("accessKey", ACCESSKEY);
321 // userData.put("btId", uuid); 321 // userData.put("btId", uuid);
322 - userData.put("callback","http://test.shen.cnlive.com/api/videoStream/callbackVideoStreamResult");  
323 - userData.put("type", "DEFAULT");  
324 -  
325 -  
326 - JSONObject data = new JSONObject();  
327 - data.put("url", url);  
328 - data.put("VideoName", videoName);  
329 - data.put("callbackLevel", true);//true表示返回所有图片的审核结果,false表示只返回非pass的审核结果  
330 - data.put("detectFrequency",10);//视频流截帧频率范围:0.5-60(0.5秒一帧-60秒一帧),默认为5  
331 - data.put("tokenId", uuid);//客户端用户账号唯一标识,用于用户行为分析,建议传入用户UID; 322 + userData.put("callback", "http://test.shen.cnlive.com/api/videoStream/callbackVideoStreamResult");
  323 + userData.put("type", "DEFAULT");
  324 +
  325 +
  326 + JSONObject data = new JSONObject();
  327 + data.put("url", url);
  328 + data.put("VideoName", videoName);
  329 + data.put("callbackLevel", true);//true表示返回所有图片的审核结果,false表示只返回非pass的审核结果
  330 + data.put("detectFrequency", 10);//视频流截帧频率范围:0.5-60(0.5秒一帧-60秒一帧),默认为5
  331 + data.put("tokenId", uuid);//客户端用户账号唯一标识,用于用户行为分析,建议传入用户UID;
332 // data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT"); 332 // data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "COMMENT");
333 - data.put("channel", "VIDEO_LIVE");  
334 - userData.put("data", data);  
335 -  
336 - return HttpClientUtils.httpPost(REQUEST_URL_VIDEOSTREAM, userData,false); 333 + data.put("channel", "VIDEO_LIVE");
  334 + userData.put("data", data);
  335 +
  336 + return HttpClientUtils.httpPost(REQUEST_URL_VIDEOSTREAM, userData, false);
337 } 337 }
338 -  
339 - private static JSONObject reqFinishVideoStream(String url,String requestId) throws Exception {  
340 - JSONObject userData = new JSONObject();  
341 - userData.put("accessKey", ACCESSKEY);  
342 - userData.put("requestId",requestId);  
343 - userData.put("url", url);  
344 -  
345 - return HttpClientUtils.httpPost(FINISH_URL_VIDEOSTREAM, userData,false); 338 +
  339 + private static JSONObject reqFinishVideoStream(String url, String requestId) throws Exception {
  340 + JSONObject userData = new JSONObject();
  341 + userData.put("accessKey", ACCESSKEY);
  342 + userData.put("requestId", requestId);
  343 + userData.put("url", url);
  344 +
  345 + return HttpClientUtils.httpPost(FINISH_URL_VIDEOSTREAM, userData, false);
346 } 346 }
347 347
348 - private static JSONObject reqArticleFilter(String tokenId,String contents ,String channel) throws Exception { 348 + private static JSONObject reqArticleFilter(String tokenId, String contents, String channel) throws Exception {
349 JSONObject userData = new JSONObject(); 349 JSONObject userData = new JSONObject();
350 userData.put("accessKey", ACCESSKEY); 350 userData.put("accessKey", ACCESSKEY);
351 351
@@ -355,21 +355,21 @@ public class AntiFraudUtil { @@ -355,21 +355,21 @@ public class AntiFraudUtil {
355 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "DEFAULT_LOGO"); 355 data.put("channel", StringUtils.isNotEmpty(channel) ? channel : "DEFAULT_LOGO");
356 userData.put("data", data); 356 userData.put("data", data);
357 357
358 - return HttpClientUtils.httpPost(REQUEST_URL_ARTICLE, userData,false); 358 + return HttpClientUtils.httpPost(REQUEST_URL_ARTICLE, userData, false);
359 } 359 }
360 360
361 private static JSONObject getResult(JSONObject result) { 361 private static JSONObject getResult(JSONObject result) {
362 - 362 +
363 if (result != null) { 363 if (result != null) {
364 - System.out.println("数美过滤返回结果" + result);  
365 - JSONObject jsonObj = new JSONObject(); 364 + System.out.println("数美过滤返回结果" + result);
  365 + JSONObject jsonObj = new JSONObject();
366 Integer code = result.getInteger("code"); 366 Integer code = result.getInteger("code");
367 367
368 if (code != null && code == 1100) { //请求成功 368 if (code != null && code == 1100) { //请求成功
369 String riskLevel = result.getString("riskLevel"); 369 String riskLevel = result.getString("riskLevel");
370 370
371 if ("PASS".equals(riskLevel)) { 371 if ("PASS".equals(riskLevel)) {
372 - jsonObj.put("type", "REJECT"); 372 + jsonObj.put("type", "REJECT");
373 return result; 373 return result;
374 } 374 }
375 375
@@ -388,7 +388,7 @@ public class AntiFraudUtil { @@ -388,7 +388,7 @@ public class AntiFraudUtil {
388 return null; 388 return null;
389 } 389 }
390 390
391 - private static JSONArray getJSONArray(String json){ 391 + private static JSONArray getJSONArray(String json) {
392 JSONArray picJson = JSON.parseArray(json); 392 JSONArray picJson = JSON.parseArray(json);
393 JSONArray imgs = new JSONArray(); 393 JSONArray imgs = new JSONArray();
394 for (int i = 0; i < picJson.size(); i++) { 394 for (int i = 0; i < picJson.size(); i++) {
@@ -397,33 +397,38 @@ public class AntiFraudUtil { @@ -397,33 +397,38 @@ public class AntiFraudUtil {
397 JSONObject jsonObject = new JSONObject(); 397 JSONObject jsonObject = new JSONObject();
398 JSONObject jsonObj = picJson.getJSONObject(i); 398 JSONObject jsonObj = picJson.getJSONObject(i);
399 String img = jsonObj.getString("imageUrl"); 399 String img = jsonObj.getString("imageUrl");
400 - jsonObject.put("img",img);  
401 - jsonObject.put("btId",btId); 400 + jsonObject.put("img", img);
  401 + jsonObject.put("btId", btId);
402 imgs.add(jsonObject); 402 imgs.add(jsonObject);
403 } 403 }
404 return imgs; 404 return imgs;
405 } 405 }
  406 +
406 /** 407 /**
407 * 名单列表查询 408 * 名单列表查询
  409 + *
408 * @return 410 * @return
409 */ 411 */
410 - private static String contentsList() { 412 + private static String contentsList() {
411 413
412 - String url=Contents_list+"?accessKey="+ACCESSKEY+"&type=1&serviceId=POST_TEXT"; 414 + String url = Contents_list + "?accessKey=" + ACCESSKEY + "&type=1&serviceId=POST_TEXT";
413 return HttpClientUtils.get(url); 415 return HttpClientUtils.get(url);
414 } 416 }
  417 +
415 /** 418 /**
416 * 名单内容列表查询(敏感词黑名单) 419 * 名单内容列表查询(敏感词黑名单)
  420 + *
417 * @return 421 * @return
418 */ 422 */
419 - private static String blackContentsList() {  
420 -  
421 - String url="https://www.fengkongcloud.com/ApiV2/ListService/lists/0f85d5aab7f59a6070c403c57aefcc0a/contents?accessKey="+ACCESSKEY;  
422 - return HttpClientUtils.get(url); 423 + private static String blackContentsList() {
  424 +
  425 + String url = "https://www.fengkongcloud.com/ApiV2/ListService/lists/0f85d5aab7f59a6070c403c57aefcc0a/contents?accessKey=" + ACCESSKEY;
  426 + return HttpClientUtils.get(url);
423 } 427 }
424 - 428 +
425 /** 429 /**
426 - * 新增名单内容(敏感词黑名单) 430 + * 新增名单内容(敏感词黑名单)
  431 + *
427 * @param contents 432 * @param contents
428 * @return 433 * @return
429 * @throws Exception 434 * @throws Exception
@@ -431,9 +436,9 @@ public class AntiFraudUtil { @@ -431,9 +436,9 @@ public class AntiFraudUtil {
431 private static JSONObject addBlackContents(String contents) throws Exception { 436 private static JSONObject addBlackContents(String contents) throws Exception {
432 437
433 JSONObject data = new JSONObject(); 438 JSONObject data = new JSONObject();
434 - String[] contents1=new String[]{contents}; 439 + String[] contents1 = new String[]{contents};
435 data.put("contents", contents1); 440 data.put("contents", contents1);
436 441
437 - return HttpClientUtils.httpPost("https://www.fengkongcloud.com/ApiV2/ListService/lists/0f85d5aab7f59a6070c403c57aefcc0a/contents?accessKey="+ACCESSKEY, data,false); 442 + return HttpClientUtils.httpPost("https://www.fengkongcloud.com/ApiV2/ListService/lists/0f85d5aab7f59a6070c403c57aefcc0a/contents?accessKey=" + ACCESSKEY, data, false);
438 } 443 }
439 } 444 }
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
@@ -19,18 +19,33 @@ import java.util.Map; @@ -19,18 +19,33 @@ import java.util.Map;
19 @Component 19 @Component
20 public class AuditPass { 20 public class AuditPass {
21 private static Logger logger = LoggerFactory.getLogger(AuditPass.class); 21 private static Logger logger = LoggerFactory.getLogger(AuditPass.class);
  22 + /**
  23 + * //点播platformKey
  24 + */
22 @Value("${platformKey}") 25 @Value("${platformKey}")
23 - private String platformKey;//点播platformKey 26 + private String platformKey;
  27 + /**
  28 + * //点播platformValue
  29 + */
24 @Value("${platformValue}") 30 @Value("${platformValue}")
25 - private String platformValue;//点播platformValue 31 + private String platformValue;
  32 + /**
  33 + * //直播同步信息
  34 + */
26 @Value("${live_url}") 35 @Value("${live_url}")
27 - private String live_url;//直播同步信息 36 + private String live_url;
28 37
  38 + /**
  39 + * //用户云查网家家用户信息(通过手机号)
  40 + */
29 @Value("${queryUserByMobile}") 41 @Value("${queryUserByMobile}")
30 - private String queryUserByMobile;//用户云查网家家用户信息(通过手机号) 42 + private String queryUserByMobile;
31 43
  44 + /**
  45 + * //用户云查网家家用户信息(通过用户id)
  46 + */
32 @Value("${queryUserByUserId}") 47 @Value("${queryUserByUserId}")
33 - private String queryUserByUserId;//用户云查网家家用户信息(通过用户id) 48 + private String queryUserByUserId;
34 49
35 public static void main(String[] args) { 50 public static void main(String[] args) {
36 JSONObject map = new JSONObject(); 51 JSONObject map = new JSONObject();
src/main/java/com/cnlive/shenhe/utils/BusinessEnum.java
@@ -6,8 +6,8 @@ package com.cnlive.shenhe.utils; @@ -6,8 +6,8 @@ package com.cnlive.shenhe.utils;
6 * @Description:审核业务 6 * @Description:审核业务
7 */ 7 */
8 public enum BusinessEnum { 8 public enum BusinessEnum {
9 - VIDEO(1,"点播审核"),  
10 - COMMENT(2,"评论审核"); 9 + VIDEO(1, "点播审核"),
  10 + COMMENT(2, "评论审核");
11 11
12 private Integer businessCode; 12 private Integer businessCode;
13 private String businessMessage; 13 private String businessMessage;
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
@@ -53,11 +53,11 @@ public class CommonConst { @@ -53,11 +53,11 @@ public class CommonConst {
53 /** 53 /**
54 * 领取状态:已领 54 * 领取状态:已领
55 */ 55 */
56 - public static Integer RECEIVE_AFTER= 1; 56 + public static Integer RECEIVE_AFTER = 1;
57 /** 57 /**
58 * 领取状态:已审 58 * 领取状态:已审
59 */ 59 */
60 - public static Integer RECEIVE_AUDIT= 2; 60 + public static Integer RECEIVE_AUDIT = 2;
61 61
62 /** 62 /**
63 * 用户状态:可用 63 * 用户状态:可用
@@ -67,7 +67,7 @@ public class CommonConst { @@ -67,7 +67,7 @@ public class CommonConst {
67 * 用户状态:禁用 67 * 用户状态:禁用
68 */ 68 */
69 public static Integer USER_STATUS_FORBID = 2; 69 public static Integer USER_STATUS_FORBID = 2;
70 - 70 +
71 /** 71 /**
72 * 通知状态:未通知 72 * 通知状态:未通知
73 */ 73 */
@@ -91,17 +91,17 @@ public class CommonConst { @@ -91,17 +91,17 @@ public class CommonConst {
91 * 白名单业务:评论 91 * 白名单业务:评论
92 */ 92 */
93 public static Integer BUSINESS_COMMENT = 2; 93 public static Integer BUSINESS_COMMENT = 2;
94 - 94 +
95 /** 95 /**
96 * 白名单业务:图文 96 * 白名单业务:图文
97 */ 97 */
98 public static Integer BUSINESS_CONTENT = 3; 98 public static Integer BUSINESS_CONTENT = 3;
99 - 99 +
100 /** 100 /**
101 * 白名单业务:频道 101 * 白名单业务:频道
102 */ 102 */
103 public static Integer BUSINESS_CHANNEL = 4; 103 public static Integer BUSINESS_CHANNEL = 4;
104 - 104 +
105 /** 105 /**
106 * 白名单业务:直播申请 106 * 白名单业务:直播申请
107 */ 107 */
@@ -114,15 +114,15 @@ public class CommonConst { @@ -114,15 +114,15 @@ public class CommonConst {
114 * 白名单业务:音频 114 * 白名单业务:音频
115 */ 115 */
116 public static Integer BUSINESS_AUDIO = 7; 116 public static Integer BUSINESS_AUDIO = 7;
117 - 117 +
118 //白名单设置 118 //白名单设置
119 public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\",\"3\":\"图文业务\",\"4\":\"频道业务\",\"5\":\"直播申请业务\",\"6\":\"话题业务\",\"7\":\"音频业务\"}"); 119 public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\",\"3\":\"图文业务\",\"4\":\"频道业务\",\"5\":\"直播申请业务\",\"6\":\"话题业务\",\"7\":\"音频业务\"}");
120 - 120 +
121 /** 121 /**
122 * 弹窗消息:频道 122 * 弹窗消息:频道
123 */ 123 */
124 public static Integer NOTICE_CHANNAL = 1; 124 public static Integer NOTICE_CHANNAL = 1;
125 - 125 +
126 /** 126 /**
127 * 弹窗消息:直播申请 127 * 弹窗消息:直播申请
128 */ 128 */
@@ -132,15 +132,15 @@ public class CommonConst { @@ -132,15 +132,15 @@ public class CommonConst {
132 * 弹窗消息:话题审核 132 * 弹窗消息:话题审核
133 */ 133 */
134 public static Integer NOTICE_TOPIC = 3; 134 public static Integer NOTICE_TOPIC = 3;
135 - 135 +
136 //通知消息设置 136 //通知消息设置
137 public static JSONObject NOTICE = JSONObject.parseObject("{\"1\":\"频道通知\",\"2\":\"直播申请通知\",\"3\":\"话题审核通知\"}"); 137 public static JSONObject NOTICE = JSONObject.parseObject("{\"1\":\"频道通知\",\"2\":\"直播申请通知\",\"3\":\"话题审核通知\"}");
138 - 138 +
139 /** 139 /**
140 * 邮件消息:直播申请 140 * 邮件消息:直播申请
141 */ 141 */
142 public static Integer EMAIL_LIVEAPPLY = 1; 142 public static Integer EMAIL_LIVEAPPLY = 1;
143 - 143 +
144 //邮件消息设置 144 //邮件消息设置
145 public static JSONObject EMAIL_MESSAGE = JSONObject.parseObject("{\"1\":\"直播申请邮件通知\"}"); 145 public static JSONObject EMAIL_MESSAGE = JSONObject.parseObject("{\"1\":\"直播申请邮件通知\"}");
146 146
@@ -199,19 +199,19 @@ public class CommonConst { @@ -199,19 +199,19 @@ public class CommonConst {
199 * 栏目分类,其他 199 * 栏目分类,其他
200 */ 200 */
201 public static String CATEGORY_ELSE = "else"; 201 public static String CATEGORY_ELSE = "else";
202 -  
203 - 202 +
  203 +
204 public static JSONObject CATEGORY = JSONObject.parseObject("{\"witness\":\"目击者\",\"moment\":\"朋友圈\",\"sub\":\"达人\",\"snow\":\"上冰雪\",\"aviation\":\"航空节\",\"topic\":\"话题\"}"); 204 public static JSONObject CATEGORY = JSONObject.parseObject("{\"witness\":\"目击者\",\"moment\":\"朋友圈\",\"sub\":\"达人\",\"snow\":\"上冰雪\",\"aviation\":\"航空节\",\"topic\":\"话题\"}");
205 /** 205 /**
206 * 数美过滤器尺度状态:用户 206 * 数美过滤器尺度状态:用户
207 */ 207 */
208 public static String DYNAMIC_USER = "DYNAMIC_USER"; 208 public static String DYNAMIC_USER = "DYNAMIC_USER";
209 - 209 +
210 /** 210 /**
211 * 数美过滤器尺度状态:商户 211 * 数美过滤器尺度状态:商户
212 */ 212 */
213 public static String DYNAMIC_BUSINESS = "DYNAMIC_BUSINESS"; 213 public static String DYNAMIC_BUSINESS = "DYNAMIC_BUSINESS";
214 - 214 +
215 /** 215 /**
216 * 数美过滤器尺度状态:新闻 216 * 数美过滤器尺度状态:新闻
217 */ 217 */
src/main/java/com/cnlive/shenhe/utils/CommonConstStates.java
@@ -30,7 +30,6 @@ public class CommonConstStates { @@ -30,7 +30,6 @@ public class CommonConstStates {
30 public static Integer ZHIBO_XIAXIAN = 4; 30 public static Integer ZHIBO_XIAXIAN = 4;
31 31
32 32
33 -  
34 //是否是热点: 0:全部 ,1:不是 ,2: 是 33 //是否是热点: 0:全部 ,1:不是 ,2: 是
35 34
36 /** 35 /**
@@ -59,7 +58,6 @@ public class CommonConstStates { @@ -59,7 +58,6 @@ public class CommonConstStates {
59 public static Integer SHIFOU_XIANSHIYES = 1; 58 public static Integer SHIFOU_XIANSHIYES = 1;
60 59
61 60
62 -  
63 //商务模式:0免费 1收费 61 //商务模式:0免费 1收费
64 /** 62 /**
65 * 商务模式:0免费 1收费 63 * 商务模式:0免费 1收费
src/main/java/com/cnlive/shenhe/utils/CommonUtils.java
@@ -48,7 +48,9 @@ public class CommonUtils { @@ -48,7 +48,9 @@ public class CommonUtils {
48 return new Timestamp(System.currentTimeMillis()); 48 return new Timestamp(System.currentTimeMillis());
49 } 49 }
50 50
51 - //获取当前时间加上一个时间(分钟算) 51 + /**
  52 + * 获取当前时间加上一个时间(分钟算)
  53 + */
52 public static Timestamp getAddTime(Integer addTime) { 54 public static Timestamp getAddTime(Integer addTime) {
53 return new Timestamp(System.currentTimeMillis() + addTime * 60 * 1000); 55 return new Timestamp(System.currentTimeMillis() + addTime * 60 * 1000);
54 } 56 }
@@ -171,7 +173,7 @@ public class CommonUtils { @@ -171,7 +173,7 @@ public class CommonUtils {
171 } 173 }
172 174
173 private static String toHexString(byte[] b) { 175 private static String toHexString(byte[] b) {
174 - char HEX_DIGITS[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; 176 + char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
175 StringBuilder sb = new StringBuilder(b.length * 2); 177 StringBuilder sb = new StringBuilder(b.length * 2);
176 for (int i = 0; i < b.length; i++) { 178 for (int i = 0; i < b.length; i++) {
177 sb.append(HEX_DIGITS[(b[i] & 0xf0) >>> 4]); 179 sb.append(HEX_DIGITS[(b[i] & 0xf0) >>> 4]);
@@ -185,7 +187,7 @@ public class CommonUtils { @@ -185,7 +187,7 @@ public class CommonUtils {
185 187
186 MessageDigest digest = MessageDigest.getInstance("MD5"); 188 MessageDigest digest = MessageDigest.getInstance("MD5");
187 digest.update(SourceString.getBytes()); 189 digest.update(SourceString.getBytes());
188 - byte messageDigest[] = digest.digest(); 190 + byte[] messageDigest = digest.digest();
189 return toHexString(messageDigest); 191 return toHexString(messageDigest);
190 } catch (Exception e) { 192 } catch (Exception e) {
191 e.printStackTrace(); 193 e.printStackTrace();
@@ -238,15 +240,15 @@ public class CommonUtils { @@ -238,15 +240,15 @@ public class CommonUtils {
238 public static String md5(String str) throws NoSuchAlgorithmException, UnsupportedEncodingException { 240 public static String md5(String str) throws NoSuchAlgorithmException, UnsupportedEncodingException {
239 MessageDigest md5 = MessageDigest.getInstance("MD5"); 241 MessageDigest md5 = MessageDigest.getInstance("MD5");
240 md5.update(str.getBytes("UTF-8")); 242 md5.update(str.getBytes("UTF-8"));
241 - byte digest[] = md5.digest();  
242 - char chars[] = toHexChars(digest); 243 + byte[] digest = md5.digest();
  244 + char[] chars = toHexChars(digest);
243 return new String(chars); 245 return new String(chars);
244 } 246 }
245 247
246 - private static char[] toHexChars(byte digest[]) {  
247 - char chars[] = new char[digest.length * 2]; 248 + private static char[] toHexChars(byte[] digest) {
  249 + char[] chars = new char[digest.length * 2];
248 int i = 0; 250 int i = 0;
249 - byte abyte0[] = digest; 251 + byte[] abyte0 = digest;
250 int j = abyte0.length; 252 int j = abyte0.length;
251 for (int k = 0; k < j; k++) { 253 for (int k = 0; k < j; k++) {
252 byte b = abyte0[k]; 254 byte b = abyte0[k];