音视频样例配置审核流程(配置下发,配置取消)完善
This commit is contained in:
@@ -1,16 +1,51 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class AvFileSampleCfg extends BaseCfg<AvFileSampleCfg> {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2356472662189941874L;
|
||||
@Expose
|
||||
@SerializedName("srcFile")
|
||||
private String srcUrl;
|
||||
@Expose
|
||||
@SerializedName("sampleFile")
|
||||
private String sampleUrl;
|
||||
@Expose
|
||||
@SerializedName("srcFileMd5")
|
||||
private String srcMd5;
|
||||
@Expose
|
||||
@SerializedName("sampleFileMd5")
|
||||
private String sampleMd5;
|
||||
@Expose
|
||||
private Integer level;
|
||||
@Expose
|
||||
@SerializedName("cfgId")
|
||||
private Integer compileId;
|
||||
private String srcPath;
|
||||
private String samplePath;
|
||||
|
||||
public String getSrcPath() {
|
||||
return srcPath;
|
||||
}
|
||||
public void setSrcPath(String srcPath) {
|
||||
this.srcPath = srcPath;
|
||||
}
|
||||
public String getSamplePath() {
|
||||
return samplePath;
|
||||
}
|
||||
public void setSamplePath(String samplePath) {
|
||||
this.samplePath = samplePath;
|
||||
}
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
public String getSrcUrl() {
|
||||
return srcUrl;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class AvSignSampleCfg extends BaseCfg<AvSignSampleCfg> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8002327858986390761L;
|
||||
@Expose
|
||||
private String description;
|
||||
@Expose
|
||||
private Integer level;
|
||||
@Expose
|
||||
@SerializedName("cfgId")
|
||||
private Integer compileId;
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
@@ -20,4 +28,11 @@ public class AvSignSampleCfg extends BaseCfg<AvSignSampleCfg> {
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ package com.nis.domain.configuration;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
@@ -54,6 +57,7 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* 有效标识
|
||||
*/
|
||||
@Expose
|
||||
protected Integer isValid;
|
||||
/**
|
||||
* 是否审核
|
||||
@@ -94,10 +98,14 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("opTime")
|
||||
protected Date auditTime;
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("service")
|
||||
protected Integer serviceId;
|
||||
/**
|
||||
* 来函id
|
||||
@@ -332,7 +340,7 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
* auditTime
|
||||
* @return auditTime
|
||||
*/
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
|
||||
public Date getAuditTime() {
|
||||
return auditTime;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
|
||||
|
||||
@@ -95,7 +97,7 @@ public class ConfigServiceUtil {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String postFileCfg(String params,File file,Map<String, Object> fileDesc) throws Exception{
|
||||
public static String postFileCfg(String params,File file,JSONObject fileDesc) throws Exception{
|
||||
String result = null;
|
||||
String url = Constants.SERVICE_URL+Constants.FILE_UPLOAD_CFG;
|
||||
//创建连接
|
||||
@@ -103,7 +105,7 @@ public class ConfigServiceUtil {
|
||||
FormDataMultiPart formDataMultiPart=new FormDataMultiPart();
|
||||
FileDataBodyPart bodyPart=new FileDataBodyPart("file",file);
|
||||
formDataMultiPart.bodyPart(bodyPart);
|
||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("File-Desc",ClientUtil.formatFileDesc(fileDesc) );
|
||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("File-Desc",fileDesc);
|
||||
Response response= header.post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()));
|
||||
if( response.getStatus() == 200){
|
||||
result= response.readEntity(String.class);
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
@@ -666,7 +667,25 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件前缀
|
||||
*
|
||||
* @param filename
|
||||
* @param isDot
|
||||
* true:加“.”
|
||||
* @return
|
||||
*/
|
||||
public static String getPrefix(String filename, Boolean isDot) {
|
||||
String prefix = "";
|
||||
int pos = filename.lastIndexOf('.');
|
||||
if (pos > 0 && pos < filename.length() - 1) {
|
||||
if (!isDot) {
|
||||
pos = pos - 1;
|
||||
}
|
||||
prefix = filename.substring(0,pos);
|
||||
}
|
||||
return prefix;
|
||||
}
|
||||
/**
|
||||
* 获取文件后缀
|
||||
*
|
||||
@@ -728,4 +747,36 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 计算文件MD5
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static String getFileMD5(File file){
|
||||
if(!file.isFile()){
|
||||
return "";
|
||||
}
|
||||
String md5 = "";
|
||||
MessageDigest digest=null;
|
||||
FileInputStream in=null;
|
||||
byte[] buffer=new byte[1024];
|
||||
int len;
|
||||
try{
|
||||
digest=MessageDigest.getInstance("MD5");
|
||||
in=new FileInputStream(file);
|
||||
while ((len=in.read(buffer,0,1024)) !=-1) {
|
||||
digest.update(buffer,0,len);
|
||||
}
|
||||
in.close();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
byte[] b = digest.digest();
|
||||
for (int i=0; i < b.length; i++) {
|
||||
md5 += Integer.toString( (b[i] & 0xff ) + 0x100, 16).substring(1);//加0x100是因为有的b[i]的十六进制只有1位
|
||||
}
|
||||
// BigInteger bigInt=new BigInteger(1,digest.digest());
|
||||
return md5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
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.multipart.MultipartFile;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AppIdCfg;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -63,8 +69,48 @@ public class AvController extends BaseController {
|
||||
}
|
||||
//保存文件样例配置
|
||||
@RequestMapping(value = {"/sample/saveFileSample"})
|
||||
public String saveFileSample(Model model,HttpServletRequest request,HttpServletResponse response,String ids,AvFileSampleCfg entity){
|
||||
avCfgService.saveOrUpdateAvFileSample(entity);
|
||||
public String saveFileSample(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
String ids,AvFileSampleCfg entity,MultipartFile srcFile,MultipartFile sampleFile){
|
||||
try{
|
||||
if(StringUtil.isEmpty(entity.getSrcUrl()) &&
|
||||
StringUtil.isEmpty(entity.getSampleUrl()) &&
|
||||
srcFile!=null && sampleFile!=null &&
|
||||
srcFile.getSize()>0 && sampleFile.getSize()>0){
|
||||
|
||||
String sep = System.getProperty("file.separator");
|
||||
String srcFilePath = request.getRealPath("/")+"srcFile";
|
||||
String sampleFilePath = request.getRealPath("/")+"sampleFile";
|
||||
FileUtils.createDirectory(srcFilePath);
|
||||
FileUtils.createDirectory(sampleFilePath);
|
||||
String srcFileName = UUID.randomUUID()+FileUtils.getSuffix(srcFile.getOriginalFilename(), true);
|
||||
String sampleFileName = UUID.randomUUID()+FileUtils.getSuffix(sampleFile.getOriginalFilename(), true);
|
||||
File uploadSrcFile = new File(srcFilePath+sep+srcFileName);
|
||||
File uploadSampleFile = new File(sampleFilePath+sep+sampleFileName);
|
||||
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);
|
||||
FileCopyUtils.copy(sampleFile.getBytes(),uploadSampleFile);
|
||||
String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+request.getContextPath();
|
||||
String srcUrl = host+"/srcFile/"+uploadSrcFile.getName();
|
||||
String sampleUrl = host+"/sampleFile/"+uploadSampleFile.getName();
|
||||
logger.info("srcUrl:"+srcUrl);
|
||||
logger.info("sampleUrl:"+sampleUrl);
|
||||
String srcMd5 = FileUtils.getFileMD5(uploadSrcFile);
|
||||
String sampleMd5 = FileUtils.getFileMD5(uploadSampleFile);
|
||||
entity.setSrcUrl(srcUrl);
|
||||
entity.setSrcPath(uploadSrcFile.getPath());
|
||||
entity.setSampleUrl(sampleUrl);
|
||||
entity.setSamplePath(uploadSampleFile.getPath());
|
||||
entity.setSrcMd5(srcMd5);
|
||||
entity.setSampleMd5(sampleMd5);
|
||||
}
|
||||
|
||||
avCfgService.saveOrUpdateAvFileSample(entity);
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("文件上传失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(model,"file_upload_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
//保存标志样例配置
|
||||
@@ -73,4 +119,28 @@ public class AvController extends BaseController {
|
||||
avCfgService.saveOrUpdateAvSignSample(entity);
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
//修改文件样例配置状态
|
||||
@RequestMapping(value = {"/sample/updateAvFileSampleValid"})
|
||||
public String updateAvFileSampleValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avCfgService.updateAvFileSampleValid(isAudit,isValid,ids);
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId;
|
||||
}
|
||||
//修改文件样例配置审核状态
|
||||
@RequestMapping(value = {"/sample/auditAvFileSample"})
|
||||
public String auditAvFileSample(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avCfgService.auditAvFileSample(isAudit,isValid,ids);
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+functionId;
|
||||
}
|
||||
//修改标志样例配置状态
|
||||
@RequestMapping(value = {"/sample/updateAvSignSampleValid"})
|
||||
public String updateAvSignSampleValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avCfgService.updateAvSignSampleValid(isAudit,isValid,ids);
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId;
|
||||
}
|
||||
//修改标志样例配置审核状态
|
||||
@RequestMapping(value = {"/sample/auditAvSignSample"})
|
||||
public String auditAvSignSample(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avCfgService.auditAvSignSample(isAudit,isValid,ids);
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/signSampleList?functionId="+functionId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
<select id="findByParentIdsLike" resultType="sysMenu">
|
||||
SELECT
|
||||
a.id,
|
||||
a.id,a.function_id,
|
||||
a.parent_id AS "parent.id",
|
||||
a.parent_ids
|
||||
FROM sys_menu a
|
||||
|
||||
@@ -17,4 +17,8 @@ public interface AvCfgDao {
|
||||
public void insertAvSignSample(AvSignSampleCfg entity);
|
||||
public void updateAvFileSample(AvFileSampleCfg entity);
|
||||
public void updateAvSignSample(AvSignSampleCfg entity);
|
||||
public void updateAvFileSampleValid(AvFileSampleCfg entity);
|
||||
public void updateAvSignSampleValid(AvSignSampleCfg entity);
|
||||
public void auditAvFileSample(AvFileSampleCfg entity);
|
||||
public void auditAvSignSample(AvSignSampleCfg entity);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,43 @@
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="src_url" property="srcUrl" jdbcType="VARCHAR" />
|
||||
<result column="sample_url" property="sampleUrl" jdbcType="VARCHAR" />
|
||||
<result column="src_path" property="srcPath" jdbcType="VARCHAR" />
|
||||
<result column="sample_path" property="samplePath" jdbcType="VARCHAR" />
|
||||
<result column="src_md5" property="srcMd5" jdbcType="VARCHAR" />
|
||||
<result column="sample_md5" property="sampleMd5" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="level" property="level" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
|
||||
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
|
||||
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="AvSignSampleMap" type="com.nis.domain.configuration.AvSignSampleCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
<result column="level" property="level" jdbcType="INTEGER" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
@@ -32,11 +65,18 @@
|
||||
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
|
||||
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="AvFileSample_Column" >
|
||||
a.CFG_ID, a.SRC_URL,a.SAMPLE_URL, a.SRC_MD5,a.SAMPLE_MD5,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,a.LEVEL,
|
||||
a.src_path,a.sample_path
|
||||
</sql>
|
||||
|
||||
<sql id="AvSignSample_Column" >
|
||||
a.CFG_ID, a.description,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,a.LEVEL
|
||||
</sql>
|
||||
|
||||
@@ -47,6 +87,13 @@
|
||||
WHERE a.CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<select id="getAvSignSampleById" resultMap="AvSignSampleMap" parameterType="java.lang.Long" >
|
||||
SELECT
|
||||
<include refid="AvSignSample_Column" />
|
||||
FROM av_sign_sample_cfg a
|
||||
WHERE a.CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<select id="getAvFileSampleList" resultMap="AvFileSampleMap" >
|
||||
SELECT
|
||||
<include refid="AvFileSample_Column" />
|
||||
@@ -59,9 +106,7 @@
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
left join service_dict_info sdic on a.classify=sdic.item_code and sdic.item_type=1 and sdic.is_leaf=0
|
||||
left join service_dict_info sdia on a.attribute=sdia.item_code and sdia.item_type=2 and sdia.is_leaf=0
|
||||
left join service_dict_info sdil on a.lable=sdil.item_code and sdil.item_type=3 and sdil.is_leaf=0
|
||||
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
@@ -129,6 +174,106 @@
|
||||
<if test="functionId != null">
|
||||
AND a.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="level != null">
|
||||
AND a.level=#{level,jdbcType=INTEGER}
|
||||
</if>
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="getAvSignSampleList" resultMap="AvSignSampleMap" >
|
||||
SELECT
|
||||
<include refid="AvSignSample_Column" />
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
,ri.request_title as requestName
|
||||
</trim>
|
||||
FROM av_sign_sample_cfg a
|
||||
left join sys_user s on a.creator_id=s.id
|
||||
left join sys_user e on a.editor_id=e.id
|
||||
left join sys_user u on a.auditor_id=u.id
|
||||
left join request_info ri on a.request_id=ri.id
|
||||
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND a.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND a.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
AND a.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''">
|
||||
AND a.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName != ''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''">
|
||||
AND a.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
|
||||
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND a.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="level != null">
|
||||
AND a.level=#{level,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
AND a.description like concat(concat('%',#{description,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
@@ -148,19 +293,41 @@
|
||||
SRC_URL,SAMPLE_URL, SRC_MD5,SAMPLE_MD5,LEVEL,CFG_DESC,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,function_id,cfg_type,cfg_region_code,level
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,function_id,cfg_type,cfg_region_code,src_path,sample_path
|
||||
)values (
|
||||
#{srcUrl,jdbcType=VARCHAR},#{sampleUrl,jdbcType=VARCHAR},#{srcMd5,jdbcType=VARCHAR},
|
||||
#{sampleMd5,jdbcType=VARCHAR},#{level,jdbcType=INTEGER},#{cfgDesc,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
||||
0,0,#{creatorId,jdbcType=INTEGER},
|
||||
now(),#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
|
||||
#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{level,jdbcType=INTEGER}
|
||||
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{srcPath,jdbcType=VARCHAR},#{samplePath,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertAvSignSample" parameterType="com.nis.domain.configuration.AvSignSampleCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into av_sign_sample_cfg (
|
||||
description,LEVEL,CFG_DESC,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,function_id,cfg_type,cfg_region_code
|
||||
)values (
|
||||
#{description,jdbcType=VARCHAR},#{level,jdbcType=INTEGER},#{cfgDesc,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
|
||||
0,0,#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},#{functionId,jdbcType=INTEGER},
|
||||
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateAvFileSample" parameterType="com.nis.domain.configuration.AvFileSampleCfg" >
|
||||
update av_file_sample_cfg
|
||||
<set >
|
||||
@@ -192,7 +359,80 @@
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
edit_time = now(),
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null and classify != ''" >
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''" >
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null and lable != ''" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null" >
|
||||
function_id = #{functionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null" >
|
||||
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="cfgType != null" >
|
||||
cfg_type = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="level != null" >
|
||||
level = #{level,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcPath != null and srcPath != ''">
|
||||
src_path = #{srcPath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="samplePath != null and samplePath != ''">
|
||||
sample_path = #{samplePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="updateAvSignSample" parameterType="com.nis.domain.configuration.AvSignSampleCfg" >
|
||||
update av_sign_sample_cfg
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAudit != null" >
|
||||
is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="creatorId != null" >
|
||||
creator_id = #{creatorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
@@ -245,5 +485,20 @@
|
||||
</if>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</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>
|
||||
<update id="auditAvSignSample" parameterType="com.nis.domain.configuration.AvSignSampleCfg" >
|
||||
update av_sign_sample_cfg set is_audit = #{isAudit,jdbcType=INTEGER},
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="isValid != null" >
|
||||
,is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -1,20 +1,32 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
|
||||
import info.monitorenter.cpdetector.util.FileUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AppIdCfg;
|
||||
import com.nis.domain.configuration.AvFileSampleCfg;
|
||||
import com.nis.domain.configuration.AvSignSampleCfg;
|
||||
import com.nis.web.dao.FunctionRegionDictDao;
|
||||
import com.nis.web.dao.FunctionServiceDictDao;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.web.dao.configuration.AvCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,7 +35,7 @@ import com.nis.web.service.CrudService;
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class AvCfgService {
|
||||
public class AvCfgService extends BaseService{
|
||||
// @Autowired
|
||||
// protected FunctionRegionDictDao functionRegionDictDao;
|
||||
// @Autowired
|
||||
@@ -52,18 +64,204 @@ public class AvCfgService {
|
||||
public void saveOrUpdateAvFileSample(AvFileSampleCfg entity){
|
||||
if(entity.getCfgId()==null){
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCompileId(0);
|
||||
avCfgDao.insertAvFileSample(entity);
|
||||
entity.setCreateTime(new Date());
|
||||
//调用服务接口获取compileId
|
||||
String result = "";
|
||||
try {
|
||||
result = ConfigServiceUtil.getId(1,1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("获取编译ID出错");
|
||||
}
|
||||
Integer compileId = Integer.parseInt(result);
|
||||
if(compileId!=0){
|
||||
entity.setCompileId(compileId);
|
||||
avCfgDao.insertAvFileSample(entity);
|
||||
}else{
|
||||
throw new MaatConvertException("获取编译ID出错");
|
||||
}
|
||||
}else{
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
avCfgDao.updateAvFileSample(entity);
|
||||
}
|
||||
}
|
||||
public void saveOrUpdateAvSignSample(AvSignSampleCfg entity){
|
||||
if(entity.getCfgId()==null){
|
||||
avCfgDao.insertAvSignSample(entity);
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(new Date());
|
||||
//调用服务接口获取compileId
|
||||
String result = "";
|
||||
try {
|
||||
result = ConfigServiceUtil.getId(1,1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("获取编译ID出错");
|
||||
}
|
||||
Integer compileId = Integer.parseInt(result);
|
||||
if(compileId!=0){
|
||||
entity.setCompileId(compileId);
|
||||
avCfgDao.insertAvSignSample(entity);
|
||||
}else{
|
||||
throw new MaatConvertException("获取编译ID出错");
|
||||
}
|
||||
|
||||
}else{
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
avCfgDao.updateAvSignSample(entity);
|
||||
}
|
||||
}
|
||||
public void updateAvFileSampleValid(Integer isAudit,Integer isValid,String ids){
|
||||
AvFileSampleCfg entity = new AvFileSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
avCfgDao.updateAvFileSampleValid(entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void auditAvFileSample(Integer isAudit,Integer isValid,String ids){
|
||||
AvFileSampleCfg entity = new AvFileSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
List<AvFileSampleCfg> list = new ArrayList();
|
||||
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
for(String id :idArray){
|
||||
entity = getAvFileSampleById(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
if(isAudit==1){
|
||||
//音视频文件上传接口调用
|
||||
try {
|
||||
File srcFile = new File(entity.getSrcPath());
|
||||
Map<String,Object> srcMap = new HashMap();
|
||||
srcMap.put("filetype", FileUtils.getSuffix(srcFile.getName(), false));
|
||||
srcMap.put("createTime", entity.getCreateTime());
|
||||
srcMap.put("key",FileUtils.getPrefix(srcFile.getName(), false));
|
||||
srcMap.put("fileName", srcFile.getName());
|
||||
srcMap.put("checksum", entity.getSrcMd5());
|
||||
String result1 = ConfigServiceUtil.postFileCfg(null, srcFile, JSONObject.fromObject(srcMap));
|
||||
logger.info("音视频源文件上传响应信息:"+result1);
|
||||
|
||||
File smapleFile = new File(entity.getSamplePath());
|
||||
Map<String,Object> sampleMap = new HashMap();
|
||||
sampleMap.put("filetype", FileUtils.getSuffix(smapleFile.getName(), false));
|
||||
sampleMap.put("createTime", entity.getCreateTime());
|
||||
sampleMap.put("key",FileUtils.getPrefix(smapleFile.getName(), false));
|
||||
sampleMap.put("fileName", smapleFile.getName());
|
||||
sampleMap.put("checksum", entity.getSampleMd5());
|
||||
String result2 = ConfigServiceUtil.postFileCfg(null, srcFile, JSONObject.fromObject(sampleMap));
|
||||
logger.info("音视频样例文件上传响应信息:"+result2);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("音视频文件样例配置下发失败");
|
||||
throw new MaatConvertException("音视频文件样例配置下发失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
avCfgDao.auditAvFileSample(entity);
|
||||
list.add(entity);
|
||||
|
||||
}
|
||||
if(isAudit==1){
|
||||
//调用服务接口下发配置数据
|
||||
String json=gson.toJson(list);
|
||||
logger.info("音视频文件样例下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
String result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
logger.info("音视频文件样例配置下发响应信息:"+result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("音视频文件样例配置下发失败");
|
||||
throw new MaatConvertException("音视频文件样例配置下发失败:"+e.getMessage());
|
||||
}
|
||||
}else if(isAudit==3){
|
||||
//调用服务接口取消配置
|
||||
String json=gson.toJson(list);
|
||||
logger.info("音视频文件样例下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
String result = ConfigServiceUtil.put(json,2);
|
||||
logger.info("音视频文件样例取消配置响应信息:"+result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("音视频文件样取消配置失败");
|
||||
throw new MaatConvertException("音视频文件样例取消配置失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updateAvSignSampleValid(Integer isAudit,Integer isValid,String ids){
|
||||
AvSignSampleCfg entity = new AvSignSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
avCfgDao.updateAvSignSampleValid(entity);
|
||||
}
|
||||
}
|
||||
public void auditAvSignSample(Integer isAudit,Integer isValid,String ids){
|
||||
AvSignSampleCfg entity = new AvSignSampleCfg();
|
||||
String[] idArray = ids.split(",");
|
||||
List<AvSignSampleCfg> list = new ArrayList();
|
||||
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
for(String id :idArray){
|
||||
entity = getAvSignSampleById(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
avCfgDao.auditAvSignSample(entity);
|
||||
list.add(entity);
|
||||
}
|
||||
if(isAudit==1){
|
||||
//调用服务接口下发配置数据
|
||||
String json=gson.toJson(list);
|
||||
logger.info("文件样例下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
String result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
logger.info("音视频标志样例配置下发响应信息:"+result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("音视频标志样例配置下发失败");
|
||||
throw new MaatConvertException("音视频标识样例配置下发失败:"+e.getMessage());
|
||||
}
|
||||
}else if(isAudit==3){
|
||||
//调用服务接口取消配置
|
||||
String json=gson.toJson(list);
|
||||
logger.info("标志样例下发配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
String result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("音视频标志样例配置取消配置响应信息:"+result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("音视频标志样例取消配置失败");
|
||||
throw new MaatConvertException("音视频标识样例取消失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,15 +46,28 @@ $(function(){
|
||||
$(".action").on("change",function(){
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
});
|
||||
$("#cfgFrom").validate({
|
||||
$("#cfgFrom").validate({
|
||||
submitHandler: function(form){
|
||||
var srcFile = $("#srcFile").val();
|
||||
var sampleFile = $("#sampleFile").val();
|
||||
var srcUrl = $("#srcUrl").val();
|
||||
var sampleUrl = $("#sampleUrl").val();
|
||||
if((srcUrl==null||srcUrl=="") && (srcFile==null || srcFile=="")){
|
||||
$("div[for='srcFile']").append("<label id='level-error' class='error' for='srcFile'><spring:message code='required'></spring:message></label>");
|
||||
return false;
|
||||
}else if((sampleUrl==null || sampleUrl=="") && (sampleFile==null || sampleFile=="")){
|
||||
$("div[for='sampleFile']").append("<label id='level-error' class='error' for='sampleFile'><spring:message code='required'></spring:message></label>");
|
||||
return false;
|
||||
}else{
|
||||
//loading('onloading...');
|
||||
form.submit();
|
||||
}
|
||||
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
errorPlacement: function(error,element){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
//loading('onloading...');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -79,7 +92,7 @@ $(function(){
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<!-- BEGIN FORM-->
|
||||
<form id="cfgFrom" action="${ctx}/ntc/av/sample/saveFileSample" method="post" class="form-horizontal">
|
||||
<form id="cfgFrom" action="${ctx}/ntc/av/sample/saveFileSample" enctype="multipart/form-data" method="post" class="form-horizontal">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
@@ -101,32 +114,41 @@ $(function(){
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="src_url"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="srcUrl" value="${_cfg.srcUrl }">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="sample_url"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required" type="text" name="sampleUrl" value="${_cfg.sampleUrl}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<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" type="text" name="level" value="${_cfg.level }">
|
||||
</div>
|
||||
<div for="level"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="src_url"/></label>
|
||||
<div class="col-md-6">
|
||||
<%-- <input class="form-control required" type="text" name="srcUrl" value="${_cfg.srcUrl }"> --%>
|
||||
<input id="srcFile" name="srcFile" type="file" style="width: 330px" />
|
||||
<input id="srcUrl" name="srcUrl" type="hidden" value="${_cfg.srcUrl }"/>
|
||||
</div>
|
||||
<div for="srcFile"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="sample_url"/></label>
|
||||
<div class="col-md-6">
|
||||
<%-- <input class="form-control required" type="text" name="sampleUrl" value="${_cfg.sampleUrl}"> --%>
|
||||
<input id="sampleFile" name="sampleFile" type="file"style="width: 330px" />
|
||||
<input id="sampleUrl" name="sampleUrl" type="hidden" value="${_cfg.sampleUrl }" />
|
||||
</div>
|
||||
<div for="sampleFile"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
@@ -143,10 +165,12 @@ $(function(){
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp" %>
|
||||
<%-- <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> --%>
|
||||
<input type="hidden" name="isAreaEffective" value="0">
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
//搜索框提示语初始化
|
||||
if("${cfg.cfgDesc}"){
|
||||
$("#intype").val("${cfg.cfgDesc}");
|
||||
} else{
|
||||
}else if("${cfg.level}"){
|
||||
$("#intype").val("${cfg.level}");
|
||||
}else{
|
||||
$("#intype").attr("placeholder","<spring:message code='input'/> "+$("#seltype").find("option:selected").text());
|
||||
}
|
||||
$("#seltype").change(function(){
|
||||
@@ -27,7 +29,7 @@
|
||||
$(this).find("option:first").attr("selected",true);
|
||||
});
|
||||
$(".Wdate").attr("value",'');
|
||||
$("#keywords").attr("value",'');
|
||||
$("#level").attr("value",'');
|
||||
$("#searchForm")[0].reset();
|
||||
});
|
||||
});
|
||||
@@ -65,7 +67,7 @@
|
||||
<div class="portlet">
|
||||
<div class="portlet-body">
|
||||
<div class="row" >
|
||||
<form:form id="searchForm" modelAttribute="cfg" action="${ctx}/ntc/av/sample/fileSamplelist" method="post" class="form-search">
|
||||
<form:form id="searchForm" modelAttribute="cfg" action="${ctx}/ntc/av/sample/fileSampleList?functionId=${cfg.functionId}" method="post" class="form-search">
|
||||
<input id="functionId" name="functionId" type="hidden" value="${cfg.functionId}"/>
|
||||
<input id="audit" name="audit" type="hidden" value="${audit}"/>
|
||||
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
||||
@@ -94,6 +96,7 @@
|
||||
|
||||
<form:select path="seltype" class="selectpicker select2 input-small" >
|
||||
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
|
||||
<form:option value="level"><spring:message code="harm_level"></spring:message></form:option>
|
||||
</form:select>
|
||||
|
||||
</div>
|
||||
@@ -110,7 +113,7 @@
|
||||
<div class="pull-right">
|
||||
<shiro:hasPermission name="avFileSample:config">
|
||||
<sys:delRow url="${ctx}/ntc/av/sample/fileSampleForm" id="contentTable" label="update"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/ntc/av/sample/saveFileSample?isValid=-1" id="contentTable" label="delete"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/ntc/av/sample/updateAvFileSampleValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||
</shiro:hasPermission>
|
||||
<shiro:hasPermission name="avFileSample:audit">
|
||||
<div class="btn-group">
|
||||
@@ -119,9 +122,9 @@
|
||||
<i class="fa fa-angle-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li><sys:delRow url="${ctx}/ntc/av/sample/saveFileSample?isAudit=1&isValid=1" id="contentTable" label="approved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/ntc/av/sample/saveFileSample?isAudit=2&isValid=0" id="contentTable" label="unapproved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/ntc/av/sample/saveFileSample?isAudit=3&isValid=0" id="contentTable" label="cancelPass"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/ntc/av/sample/auditAvFileSample?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/ntc/av/sample/auditAvFileSample?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li>
|
||||
<li><sys:delRow url="${ctx}/ntc/av/sample/auditAvFileSample?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
|
||||
</ul>
|
||||
</div>
|
||||
</shiro:hasPermission>
|
||||
@@ -289,8 +292,18 @@
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.cfgId}" value="${cfg.isAudit}"></td>
|
||||
<td>${cfg.srcUrl }</td>
|
||||
<td>${cfg.sampleUrl }</td>
|
||||
<td>
|
||||
<a href="${cfg.srcUrl }" data-original-title="${cfg.srcUrl }"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fn:substring(cfg.srcUrl,0,20) }
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="${cfg.sampleUrl }" target="_blank" data-original-title="${cfg.sampleUrl }"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fn:substring(cfg.sampleUrl,0,20) }
|
||||
</a>
|
||||
</td>
|
||||
<td>${cfg.level }</td>
|
||||
<td>${cfg.cfgDesc }</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user