1.修改视频场景增加监测封堵按钮2.增加patch调用接口更改配置状态方法
This commit is contained in:
@@ -18,7 +18,14 @@ public class AvSignSampleCfg extends BaseCfg<AvSignSampleCfg> {
|
||||
private Integer compileId;
|
||||
|
||||
private Integer isValidOld;
|
||||
private Integer actionOld;//判断动作是否变更
|
||||
|
||||
public Integer getActionOld() {
|
||||
return actionOld;
|
||||
}
|
||||
public void setActionOld(Integer actionOld) {
|
||||
this.actionOld = actionOld;
|
||||
}
|
||||
public Integer getIsValidOld() {
|
||||
return isValidOld;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
@@ -15,6 +16,8 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.utils.HttpClientUtils;
|
||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
|
||||
import org.slf4j.Logger;
|
||||
@@ -28,6 +31,7 @@ import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.httpclient.ClientUtil;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import net.sf.json.JsonConfig;
|
||||
@@ -281,6 +285,39 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
/**
|
||||
* 配置状态修改patch
|
||||
* @param params
|
||||
* @param type,1表示maat配置取消,2表示回调配置取消,3,分组复用删除域
|
||||
* @return
|
||||
*/
|
||||
public static String patch(String params,Integer type) throws MaatConvertException{
|
||||
String result = null;
|
||||
ToMaatResult bean = null;
|
||||
String url = Constants.SERVICE_URL;
|
||||
if(type==1){
|
||||
url = url+Constants.MAAT_CFG;
|
||||
}else if(type==2){
|
||||
url = url+Constants.CALLBACK_CFG;
|
||||
}else if(type==3) {
|
||||
url = url+Constants.GROUP_REUSE_SOURCES;
|
||||
}
|
||||
logger.info("put url:"+url);
|
||||
//创建连接
|
||||
try {
|
||||
ClientUtil.initClient();
|
||||
Client client=ClientUtil.getClient();
|
||||
result = HttpClientUtil.patch(url, params);
|
||||
// JSONObject resObject = JSONObject.fromObject(result);
|
||||
// bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||
//获取响应结果
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 信息获取
|
||||
* @param params
|
||||
|
||||
@@ -15,10 +15,12 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
@@ -83,6 +85,8 @@ public class AvController extends BaseController {
|
||||
model.addAttribute("regionValue",region.getConfigRegionValue());
|
||||
break;
|
||||
}*/
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
//return "/cfg/av/signSampleList";
|
||||
return "/cfg/av/switchSignSample";
|
||||
}
|
||||
@@ -330,21 +334,43 @@ public class AvController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/sample/auditAvSignSample"})
|
||||
public String auditAvSignSample(AvSignSampleCfgModel cfg,Integer functionId,RedirectAttributes redirectAttributes){
|
||||
public String auditAvSignSample(Integer preset,AvSignSampleCfgModel cfg,Integer functionId,RedirectAttributes redirectAttributes){
|
||||
//预置配置
|
||||
try {
|
||||
if(preset!=null&&1==preset){
|
||||
avCfgService.auditAvSignSample();
|
||||
addMessage(redirectAttributes,"audit_success");
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId;
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
if(e1 instanceof MaatConvertException) {
|
||||
logger.error("预置失败",e1);
|
||||
addMessage(redirectAttributes,"request_service_failed");
|
||||
}else {
|
||||
logger.error("auditAvSignSample failed",e1);
|
||||
addMessage(redirectAttributes,"audit_failed");
|
||||
}
|
||||
}
|
||||
//修改下发配置
|
||||
if(cfg != null && cfg.getCfgs() != null ){
|
||||
for (AvSignSampleCfg avSignSampleCfg : cfg.getCfgs()) {
|
||||
if(StringUtil.isEmpty(avSignSampleCfg.getIsValid())){
|
||||
avSignSampleCfg.setIsValid(0);
|
||||
}
|
||||
if(cfg.getAction()!=null){
|
||||
avSignSampleCfg.setAction(cfg.getAction());
|
||||
}
|
||||
//isValid值变更才下发
|
||||
if(!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){
|
||||
// if(!avSignSampleCfg.getAction().equals(avSignSampleCfg.getActionOld())||!avSignSampleCfg.getIsValid().equals(avSignSampleCfg.getIsValidOld())){
|
||||
try {
|
||||
avCfgService.auditAvSignSample(avSignSampleCfg);
|
||||
addMessage(redirectAttributes,"audit_success");
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
if(e instanceof MaatConvertException) {
|
||||
logger.error("下发失败",e);
|
||||
addMessage(redirectAttributes,e.getMessage());
|
||||
addMessage(redirectAttributes,"request_service_failed");
|
||||
}else {
|
||||
logger.error("auditAvSignSample failed",e);
|
||||
addMessage(redirectAttributes,"audit_failed");
|
||||
@@ -352,7 +378,7 @@ public class AvController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId;
|
||||
}
|
||||
|
||||
@@ -513,9 +513,32 @@
|
||||
</update>
|
||||
|
||||
<update id="updateAvSignSampleValid" parameterType="com.nis.domain.configuration.AvSignSampleCfg" >
|
||||
update av_sign_sample_cfg set is_valid = #{isValid,jdbcType=INTEGER},
|
||||
editor_id = #{editorId,jdbcType=INTEGER} ,
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
update av_sign_sample_cfg
|
||||
<set>
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
<if test="serviceId!=null">
|
||||
service_id=#{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="action!=null">
|
||||
action=#{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="level!=null">
|
||||
level=#{level,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime!=''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime!=''" >
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="auditAvSignSample" parameterType="com.nis.domain.configuration.AvSignSampleCfg" >
|
||||
update av_sign_sample_cfg set is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
@@ -376,21 +377,75 @@ public class AvCfgService extends BaseService{
|
||||
}
|
||||
|
||||
}
|
||||
public void auditAvSignSample(AvSignSampleCfg entity) throws MaatConvertException{
|
||||
|
||||
avCfgDao.updateAvSignSampleValid(entity);
|
||||
|
||||
avCfgDao.auditAvSignSample(entity);
|
||||
List<AvSignSampleCfg> list = new ArrayList<AvSignSampleCfg>();
|
||||
list.add(entity);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(list);
|
||||
logger.info("标志状态变更:"+json);
|
||||
//调用服务接口取消配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("音视频标志样状态变更响应信息:"+result.getMsg());
|
||||
|
||||
}
|
||||
//预置配置下发
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditAvSignSample() throws MaatConvertException{
|
||||
try {
|
||||
AvSignSampleCfg entity = new AvSignSampleCfg();
|
||||
List<AvSignSampleCfg> avSignSampleList = avCfgDao.getAvSignSampleList(entity);
|
||||
if(avSignSampleList!=null&&avSignSampleList.size()>0){
|
||||
// avCfgDao.updateAvSignSampleValid(entity);
|
||||
// avCfgDao.auditAvSignSample(entity);
|
||||
// List<AvSignSampleCfg> list = new ArrayList<AvSignSampleCfg>();
|
||||
// avSignSampleList.add(entity);
|
||||
for (AvSignSampleCfg av : avSignSampleList) {
|
||||
av.setAuditTime(new Date());
|
||||
av.setAuditorId(UserUtils.getUser().getId());
|
||||
if(av.getIsValid()!=null&&av.getIsValid()!=1){
|
||||
av.setIsValid(1);
|
||||
}
|
||||
avCfgDao.updateAvSignSampleValid(av);
|
||||
}
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(avSignSampleList);
|
||||
logger.info("标志状态变更:"+json);
|
||||
//调用服务接口取消配置
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
logger.info("音视频标志样状态变更响应信息:"+result.getMsg());
|
||||
}else{
|
||||
logger.info("视频场景预置失败,数据为空");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("视频场景预置失败,数据为空");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditAvSignSample(AvSignSampleCfg entity) throws Exception{
|
||||
List<AvSignSampleCfg> list = new ArrayList<AvSignSampleCfg>();
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setDescription("0");
|
||||
list.add(entity);
|
||||
try {
|
||||
avCfgDao.updateAvSignSampleValid(entity);
|
||||
|
||||
// avCfgDao.auditAvSignSample(entity);
|
||||
//更新配置
|
||||
|
||||
if(entity.getIsValid()!=null&&entity.getIsValid()==Constants.VALID_YES){
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(list);
|
||||
logger.info("标志状态变更:"+json);
|
||||
//调用服务接口取消配置
|
||||
String result = ConfigServiceUtil.patch(json, 2);
|
||||
logger.info("视频标志样状态变更响应信息:"+result);
|
||||
}
|
||||
if(entity.getIsValid()!=null&&entity.getIsValid()==Constants.VALID_NO){
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(list);
|
||||
logger.info("标志状态变更:"+json);
|
||||
//调用服务接口取消配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("视频标志样状态变更响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
/*public void auditAvSignSample(AvSignSampleCfg entity,Integer isAudit) throws MaatConvertException{
|
||||
avCfgDao.auditAvSignSample(entity);
|
||||
List<AvSignSampleCfg> list = new ArrayList<AvSignSampleCfg>();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("input[type=checkbox]").bootstrapSwitch();
|
||||
/* $("input[type=checkbox]").bootstrapSwitch();
|
||||
$("input[type=checkbox]").each(function(){
|
||||
$(this).on("switchChange.bootstrapSwitch",function(event,state){
|
||||
if(state){
|
||||
@@ -14,7 +14,33 @@ $(function(){
|
||||
$(this).val(0);
|
||||
}
|
||||
})
|
||||
}); */
|
||||
if($("#oldAction").val()==1){
|
||||
$("#level").show();
|
||||
}else{
|
||||
$("input[name$='level']").val("");
|
||||
}
|
||||
$(".action").on("change",function(){
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
if($(".action:checked").val()==1){
|
||||
$("#level").show();
|
||||
}else{
|
||||
$("#level").hide();
|
||||
}
|
||||
if($("#level").is(":hidden")){
|
||||
$("input[name$='level']").val("");
|
||||
}
|
||||
});
|
||||
$("#serviceId").val($(".action:checked").attr("serviceId"));
|
||||
$("#save").click(function(){
|
||||
if($(".action:checked").attr("id")=="actionOff"){
|
||||
$("#isValid").val(0);
|
||||
}
|
||||
if($(".action:checked").attr("id")=="actionOn"){
|
||||
$("#isValid").val(1);
|
||||
}
|
||||
|
||||
})
|
||||
$("#cfgFrom").validate({
|
||||
errorPlacement: function(error,element){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
@@ -33,11 +59,11 @@ $(function(){
|
||||
|
||||
<div class="page-content">
|
||||
<h3 class="page-title">
|
||||
<c:forEach items="${regionList}" var="region">
|
||||
<spring:message code="av_sample_video_porn_control"></spring:message>
|
||||
<%-- <c:forEach items="${regionList}" var="region">
|
||||
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||
<spring:message code="${region.configRegionValue}"></spring:message>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach> --%>
|
||||
</h3>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -47,9 +73,26 @@ $(function(){
|
||||
<i class="fa fa-gift"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<div class="portlet-body form ">
|
||||
<sys:message content="${message}" />
|
||||
<!-- BEGIN FORM-->
|
||||
<div class="col-md-2">
|
||||
<form id="presetFrom" action="${ctx}/ntc/av/sample/auditAvSignSample" method="get" class="form-horizontal">
|
||||
<input type="hidden" name="functionId" value="${functionId }">
|
||||
<input type="hidden" name="preset" value="1">
|
||||
<div class="form-actions" style="background-color: #FFFFFF">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-offset-8 col-md-8">
|
||||
<button id="preset" type="submit" class="btn-danger"><spring:message code="preset"/></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<form id="cfgFrom" action="${ctx}/ntc/av/sample/auditAvSignSample" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="functionId" value="${functionId }">
|
||||
<div class="form-body">
|
||||
@@ -58,18 +101,20 @@ $(function(){
|
||||
varStatus="status">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3">
|
||||
<%-- <label class="control-label col-md-3">
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq _cfg.action }">
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</label>
|
||||
</label> --%>
|
||||
<input type="hidden" name="cfgs[${status.index }].cfgId" value="${_cfg.cfgId }">
|
||||
<input type="hidden" name="cfgs[${status.index }].serviceId" value="${_cfg.serviceId }">
|
||||
<input type="hidden" id="serviceId" name="cfgs[${status.index }].serviceId" value="${_cfg.serviceId }">
|
||||
<input type="hidden" name="cfgs[${status.index }].compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" name="cfgs[${status.index }].isValidOld" value="${_cfg.isValid}">
|
||||
<div class="col-md-6">
|
||||
<input type="hidden" id="oldAction" name="cfgs[${status.index }].actionOld" value="${_cfg.action}">
|
||||
<input type="hidden" id="isValid" name="cfgs[${status.index }].isValid" value="${_cfg.isValid}">
|
||||
<%-- <div class="col-md-6">
|
||||
<div class="bootstrap-switch">
|
||||
<input type="checkbox" data-on="danger"
|
||||
data-off="primary"
|
||||
@@ -82,7 +127,41 @@ $(function(){
|
||||
</c:if>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div> --%>
|
||||
<div class="col-md-6">
|
||||
<c:forEach items="${serviceList}" var="service"
|
||||
varStatus="satus">
|
||||
<label class="">
|
||||
<c:if test="${_cfg.functionId eq service.functionId}">
|
||||
<input id="actionOn" type="radio" name="action"
|
||||
serviceId="${service.serviceId }"
|
||||
isValid="${_cfg.isValid}"
|
||||
value="${service.action }" class="required action radio-inline radio-on"
|
||||
<c:if test="${(_cfg.action==service.action || (_cfg.action==null && satus.index==0))&&_cfg.isValid!=0}">checked</c:if>>
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq service.action }">
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
<input id="actionOff" serviceId="${_cfg.serviceId }"
|
||||
isValid="${_cfg.isValid}"
|
||||
type="radio" name="action" class="radio-inline action radio-off" value="0" <c:if test="${_cfg.isValid == 0}">checked</c:if>> <spring:message code="off"/>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div id="level" class="form-group" hidden="hidden">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="harm_level"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required number" range="[0,100]" type="text" name="cfgs[${status.index }].level" value="${_cfg.level }">
|
||||
</div>
|
||||
</div>
|
||||
<div for="cfgs[${status.index }].level"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</c:forEach>
|
||||
|
||||
Reference in New Issue
Block a user