app内置特征文件上传
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 内置文件上传
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class AppBuiltInFeatureFile extends BaseCfg<AppBuiltInFeatureFile> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -2720862431960415564L;
|
||||
private String filePath;
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class AppByteCfg extends BaseCfg<AppByteCfg> {
|
||||
@Expose
|
||||
private Integer compileId;
|
||||
@Expose
|
||||
private Integer ratelimit;
|
||||
private String ratelimit;
|
||||
private Integer appCode;//specific_service_cfg表一级节点的spec_service_code
|
||||
private Integer behavCode;//specific_service_cfg表二级节点的spec_service_code
|
||||
private Integer specServiceId;
|
||||
@@ -93,11 +93,11 @@ public class AppByteCfg extends BaseCfg<AppByteCfg> {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public Integer getRatelimit() {
|
||||
public String getRatelimit() {
|
||||
return ratelimit;
|
||||
}
|
||||
|
||||
public void setRatelimit(Integer ratelimit) {
|
||||
public void setRatelimit(String ratelimit) {
|
||||
this.ratelimit = ratelimit;
|
||||
}
|
||||
public Integer getAppCode() {
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.domain.configuration.AppBuiltInFeatureFile;
|
||||
import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
@@ -66,6 +67,7 @@ import com.nis.web.service.UserService;
|
||||
import com.nis.web.service.basics.PolicyGroupInfoService;
|
||||
import com.nis.web.service.basics.ServiceDictInfoService;
|
||||
import com.nis.web.service.basics.SysDictInfoService;
|
||||
import com.nis.web.service.configuration.AppBuiltInFeatureService;
|
||||
import com.nis.web.service.configuration.AppCfgService;
|
||||
import com.nis.web.service.configuration.AvCfgService;
|
||||
import com.nis.web.service.configuration.AvContentCfgService;
|
||||
@@ -191,6 +193,8 @@ public class BaseController {
|
||||
protected ProxyFileStrategyService proxyFileStrategyService;//代理文件策略service
|
||||
@Autowired
|
||||
protected PxyObjKeyringService pxyObjKeyringService;//拦截策略service
|
||||
@Autowired
|
||||
protected AppBuiltInFeatureService appBuiltInFeatureService;//拦截策略service
|
||||
|
||||
/**
|
||||
* 管理基础路径
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -13,10 +16,14 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.AppBuiltInFeatureFile;
|
||||
import com.nis.domain.configuration.AppByteCfg;
|
||||
import com.nis.domain.configuration.AppDomainCfg;
|
||||
import com.nis.domain.configuration.AppHeaderCfg;
|
||||
@@ -28,13 +35,21 @@ import com.nis.domain.configuration.AppTcpCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.AppBuiltInFeatureFile;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.maat.ToMaatResult.ResponseData;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.CallExternalProceduresException;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.CodeDicUtils;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.configuration.AppBuiltInFeatureDao;
|
||||
import com.nis.web.dao.dashboard.codedic.CodeResult;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -1135,4 +1150,126 @@ public class AppCfgController extends BaseController {
|
||||
}
|
||||
return "redirect:" + adminPath +"/app/topicDomainCfgList?functionId="+functionId;
|
||||
}
|
||||
|
||||
|
||||
/**********************内置APP特征文件上传*******************************/
|
||||
@RequestMapping(value = {"/appBuiltinFeatureFileForm"})
|
||||
@RequiresPermissions(value={"app:built_in_file:config"})
|
||||
public String from(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")AppBuiltInFeatureFile cfg
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(cfg == null){
|
||||
cfg=new AppBuiltInFeatureFile();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = appBuiltInFeatureService.getAppBuiltInFeatureFile(Long.valueOf(ids),-1);
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", false);
|
||||
}else{
|
||||
initFormCondition(model, cfg);
|
||||
model.addAttribute("isAdd", true);
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/app/appBuiltinFeatureFileForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/appBuiltinFeatureFileSaveOrUpdate"})
|
||||
@RequiresPermissions(value={"app:built_in_file:config"})
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AppBuiltInFeatureFile cfg,
|
||||
MultipartFile file,
|
||||
RedirectAttributes redirectAttributes){
|
||||
File fileD=null;
|
||||
try{
|
||||
|
||||
if(file != null) {
|
||||
String filename = file.getOriginalFilename();
|
||||
String prefix = FileUtils.getPrefix(filename, false);
|
||||
String suffix = FileUtils.getSuffix(filename, false);
|
||||
fileD = File.createTempFile("file_"+ prefix, suffix);
|
||||
file.transferTo(fileD);//复制文件
|
||||
String md5 = FileUtils.getFileMD5(fileD);
|
||||
Map<String,Object> srcMap = Maps.newHashMap();
|
||||
srcMap.put("filetype", suffix);
|
||||
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
|
||||
srcMap.put("createTime",new Date());
|
||||
srcMap.put("key",prefix);
|
||||
srcMap.put("fileName", filename);
|
||||
srcMap.put("checksum", md5);
|
||||
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, fileD, JsonMapper.toJsonString(srcMap));
|
||||
logger.info("APP 内置特征 文件上传响应信息:"+JsonMapper.toJsonString(result));
|
||||
String accessUrl = null;
|
||||
if(!StringUtil.isEmpty(result)){
|
||||
ResponseData data = result.getData();
|
||||
accessUrl=data.getAccessUrl();
|
||||
cfg.setFilePath(accessUrl);;
|
||||
}
|
||||
}
|
||||
appBuiltInFeatureService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/app/appBuiltinFeatureFileList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/appBuiltinFeatureFileList"})
|
||||
public String list(Model model,HttpServletRequest request,HttpServletResponse response
|
||||
,@ModelAttribute("cfg")AppBuiltInFeatureFile entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
Page<AppBuiltInFeatureFile> page = appBuiltInFeatureService.findPage(new Page<AppBuiltInFeatureFile>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model);
|
||||
return "/cfg/app/appBuiltinFeatureFileList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/appBuiltinFeatureFileDelete"})
|
||||
@RequiresPermissions(value={"app:built_in_file:config"})
|
||||
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId
|
||||
,Model model,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
appBuiltInFeatureService.delete(isAudit,isValid,ids,functionId);
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/app/appBuiltinFeatureFileList?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/audit"})
|
||||
@RequiresPermissions(value={"app:built_in_file:confirm"})
|
||||
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
try {
|
||||
appBuiltInFeatureService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
} catch (MaatConvertException e) {
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/app/appBuiltinFeatureFileList?functionId="+functionId;
|
||||
}
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/validCfgId")
|
||||
public boolean validCfgId(Long cfgId) {
|
||||
AppBuiltInFeatureFile dns=appBuiltInFeatureService.getAppBuiltInFeatureFile(cfgId,null);
|
||||
if(dns == null ){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.AppBuiltInFeatureFile;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface AppBuiltInFeatureDao extends CrudDao< AppBuiltInFeatureFile> {
|
||||
List<AppBuiltInFeatureFile> findPage( AppBuiltInFeatureFile entity);
|
||||
List<AppBuiltInFeatureFile> findList(@Param("cfgId")Long cfgId
|
||||
,@Param("isAudit")Integer isAudit
|
||||
,@Param("isValid")Integer isValid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.configuration.AppBuiltInFeatureDao" >
|
||||
|
||||
<resultMap id="AppBuiltInFeatureFileMap" type="com.nis.domain.configuration.AppBuiltInFeatureFile" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="file_path" property="filePath" 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" />
|
||||
<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="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="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="AppBuiltInFeatureFileColumns">
|
||||
r.cfg_id,r.cfg_desc
|
||||
, r.file_path
|
||||
,r.cfg_type,r.action
|
||||
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
|
||||
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id
|
||||
,r.is_area_effective,r.classify,r.attribute,r.lable
|
||||
,r.area_effective_ids,r.function_id,r.cfg_region_code,r.compile_id
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findPage" resultMap="AppBuiltInFeatureFileMap">
|
||||
SELECT
|
||||
<include refid="AppBuiltInFeatureFileColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
</trim>
|
||||
FROM app_builtin_feature_file r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
left join sys_user u on r.auditor_id=u.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 r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
AND r.compile_id=#{compileId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="action != null">
|
||||
AND r.ACTION=#{action,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null">
|
||||
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.IS_VALID != -1
|
||||
</if>
|
||||
<if test="isAudit != null">
|
||||
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName != ''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null and classify != ''">
|
||||
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="attribute != null and attribute != ''">
|
||||
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="lable != null and lable != ''">
|
||||
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.CFG_ID desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findList" resultMap="AppBuiltInFeatureFileMap">
|
||||
SELECT
|
||||
<include refid="AppBuiltInFeatureFileColumns"/>
|
||||
FROM app_builtin_feature_file r
|
||||
<where>
|
||||
<if test="isValid == -1">
|
||||
AND r.is_valid !=-1
|
||||
</if>
|
||||
<if test="isValid == 1">
|
||||
AND r.is_valid =1
|
||||
</if>
|
||||
<if test="isValid == 0">
|
||||
AND r.is_valid =0
|
||||
</if>
|
||||
<if test="isAudit == 0">
|
||||
AND r.is_audit =0
|
||||
</if>
|
||||
<if test="isAudit == 1">
|
||||
AND r.is_audit =1
|
||||
</if>
|
||||
<if test="cfgType != null">
|
||||
AND r.cfg_type =#{cfgType,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="cfgId != null">
|
||||
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.AppBuiltInFeatureFile" >
|
||||
insert into app_builtin_feature_file (
|
||||
CFG_ID,
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
file_path,
|
||||
cfg_type,
|
||||
compile_Id,
|
||||
cfg_region_code
|
||||
)values (
|
||||
#{cfgId,jdbcType=VARCHAR},
|
||||
#{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},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{filePath, jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{cfgRegionCode,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.configuration.AppBuiltInFeatureFile" >
|
||||
update app_builtin_feature_file
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="compileId != null " >
|
||||
compile_Id = #{compileId,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="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime != ''" >
|
||||
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</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="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="filePath != null" >
|
||||
file_path = #{filePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
<if test="functionId != null" >
|
||||
and function_id = #{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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.AppBuiltInFeatureFile;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.AppBuiltInFeatureDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 内置文件
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class AppBuiltInFeatureService extends BaseService{
|
||||
@Autowired
|
||||
protected AppBuiltInFeatureDao appBuiltInFeatureDao;
|
||||
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<AppBuiltInFeatureFile> findPage(Page<AppBuiltInFeatureFile> page, AppBuiltInFeatureFile entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<AppBuiltInFeatureFile> list=appBuiltInFeatureDao.findPage(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
public List<AppBuiltInFeatureFile> findAppBuiltInFeatureFiles(Long cfgId,Integer isValid,Integer isAudit,String cfgType) {
|
||||
List<AppBuiltInFeatureFile> list=appBuiltInFeatureDao.findList(cfgId,isValid,isAudit);
|
||||
return list;
|
||||
}
|
||||
|
||||
public AppBuiltInFeatureFile getAppBuiltInFeatureFile(Long id,Integer isValid) {
|
||||
List<AppBuiltInFeatureFile> list=appBuiltInFeatureDao.findList(id,isValid,null);
|
||||
AppBuiltInFeatureFile dnsResStrategy=null;
|
||||
if(list != null && list.size()>0){
|
||||
dnsResStrategy=list.get(0);
|
||||
}
|
||||
return dnsResStrategy;
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(AppBuiltInFeatureFile entity){
|
||||
Date createTime=new Date();
|
||||
setAreaEffectiveIds(entity);
|
||||
entity.setIsValid(1);
|
||||
entity.setIsAudit(1);
|
||||
//新增
|
||||
if(StringUtil.isEmpty(entity.getCfgId())){
|
||||
entity.initDefaultValue();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
/*//调用服务接口获取compileId
|
||||
List<Integer> compileIds = new ArrayList<Integer>();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
||||
entity.setCompileId(compileIds.get(0));
|
||||
}*/
|
||||
appBuiltInFeatureDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
|
||||
appBuiltInFeatureDao.update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids compileIds
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
AppBuiltInFeatureFile entity = new AppBuiltInFeatureFile();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.valueOf(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
appBuiltInFeatureDao.update(entity);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids cfgId
|
||||
* @param functionId
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
||||
AppBuiltInFeatureFile cfg=new AppBuiltInFeatureFile();
|
||||
cfg.setCfgId(Long.valueOf(id));
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setIsAudit(isAudit);
|
||||
cfg.setEditTime(auditTime);
|
||||
cfg.setEditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(auditTime);
|
||||
appBuiltInFeatureDao.update(cfg);
|
||||
/*cfg=getAppBuiltInFeatureFile(cfg.getCfgId(), null);
|
||||
String json="";
|
||||
if(cfg.getIsAudit()==1){
|
||||
List<ProxyObjKeyring> resStrategyList=new ArrayList<ProxyObjKeyring>();
|
||||
ProxyObjKeyring resStrategy=convertCallBackProxyObjKeyring(cfg);
|
||||
resStrategyList.add(resStrategy);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(resStrategyList);
|
||||
logger.info("拦截策略配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("拦截策略配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("拦截策略配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else if(cfg.getIsAudit()==3){
|
||||
List<ProxyObjKeyring> resStrategyList=new ArrayList<>();
|
||||
ProxyObjKeyring ntcAppBuiltInFeatureFile=convertCallBackProxyObjKeyring(cfg);
|
||||
resStrategyList.add(ntcAppBuiltInFeatureFile);
|
||||
//调用服务接口取消配置
|
||||
json=gsonToJson(resStrategyList);
|
||||
logger.info("拦截策略配置配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("拦截策略配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("拦截策略配置配置失败");
|
||||
throw e;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user