APP策略、文件摘要加SubscribeId域.
This commit is contained in:
@@ -30,7 +30,10 @@ public class FileDigestCfg extends BaseCfg<FileDigestCfg> {
|
||||
private String digest;
|
||||
private Integer cfdsLevel;
|
||||
private String fileUrl;
|
||||
|
||||
|
||||
private NtcSubscribeIdCfg ntcSubscribeIdCfg;
|
||||
private List<NtcSubscribeIdCfg> ntcSubscribeIdCfgList;
|
||||
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
@@ -61,5 +64,17 @@ public class FileDigestCfg extends BaseCfg<FileDigestCfg> {
|
||||
public void setFileUrl(String fileUrl) {
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
public NtcSubscribeIdCfg getNtcSubscribeIdCfg() {
|
||||
return ntcSubscribeIdCfg;
|
||||
}
|
||||
public void setNtcSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg) {
|
||||
this.ntcSubscribeIdCfg = ntcSubscribeIdCfg;
|
||||
}
|
||||
public List<NtcSubscribeIdCfg> getNtcSubscribeIdCfgList() {
|
||||
return ntcSubscribeIdCfgList;
|
||||
}
|
||||
public void setNtcSubscribeIdCfgList(List<NtcSubscribeIdCfg> ntcSubscribeIdCfgList) {
|
||||
this.ntcSubscribeIdCfgList = ntcSubscribeIdCfgList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ public class FileTransferCfgController extends BaseController{
|
||||
entity.setCreateTime(date);
|
||||
fileTime=entity.getCreateTime();
|
||||
}
|
||||
ToMaatResult result = null;
|
||||
ToMaatResult result = new ToMaatResult();
|
||||
if(file!=null && file.getSize()>0 && entity!=null){
|
||||
String sep = System.getProperty("file.separator");
|
||||
String digestFilePath = request.getRealPath("/")+"digestFile";
|
||||
@@ -245,6 +245,9 @@ public class FileTransferCfgController extends BaseController{
|
||||
String md5 = DigestUtils.md5Hex(file.getBytes());
|
||||
fileMap.put("checksum", md5);
|
||||
result = ConfigServiceUtil.getFileDigest(null, uploadFile, JsonMapper.toJsonString(fileMap));
|
||||
if((result.getData().getRawLen() == null) || (result.getData().getDigest() == null)) {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+null);
|
||||
}
|
||||
logger.info("获取文件摘要响应信息:"+result);
|
||||
}
|
||||
fileTransferCfgService.saveOrUpdateFileDigestCfg(entity,result,areaCfgIds);
|
||||
@@ -282,6 +285,25 @@ public class FileTransferCfgController extends BaseController{
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/fileTransfer/fileDigestList?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"ajaxFileDigestSubIdList"})
|
||||
public String ajaxFileDigestSubIdList(Model model,Long cfgId,Integer index) {
|
||||
FileDigestCfg cfg = fileTransferCfgService.getFileDigestSubIdCfg(cfgId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
//查询SubscribeId域配置
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
String cfgType = null;
|
||||
for(NtcSubscribeIdCfg ntc:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!ntc.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",ntc.getCfgType()});
|
||||
cfgType = ntc.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/fileTransfer/fileDigestSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"p2pList"})
|
||||
public String p2pList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
@@ -1508,7 +1508,7 @@
|
||||
<include refid="AppCommonCfg_Value_List" />,
|
||||
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER}
|
||||
,#{userRegion1,jdbcType=VARCHAR} ,#{userRegion2,jdbcType=VARCHAR} ,#{userRegion3,jdbcType=VARCHAR}
|
||||
,#{userRegion4,jdbcType=VARCHAR} ,#{userRegion5,jdbcType=VARCHAR}
|
||||
,#{userRegion4,jdbcType=VARCHAR} ,#{userRegion5,jdbcType=VARCHAR} ,#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertAppIpCfg" parameterType="com.nis.domain.configuration.AppIpCfg" >
|
||||
|
||||
@@ -38,6 +38,8 @@ public interface FileTransferCfgDao extends CrudDao<CfgIndexInfo> {
|
||||
public void auditCfg(BaseCfg entity);
|
||||
public FileDigestCfg getFileDigest(Long id);
|
||||
public void updateFileDigestCfg(FileDigestCfg entity);
|
||||
public void deleteFileDigestSubscribeIdCfg(FileDigestCfg entity);
|
||||
public List<NtcSubscribeIdCfg> getFileDigestSubscribeidList(FileDigestCfg entity);
|
||||
|
||||
// P2P域配置新增
|
||||
public void saveP2pHashCfg(BaseStringCfg cfg);
|
||||
@@ -53,4 +55,5 @@ public interface FileTransferCfgDao extends CrudDao<CfgIndexInfo> {
|
||||
public void deleteP2pHashCfg(CfgIndexInfo entity);
|
||||
public void deleteP2pKeywordCfg(CfgIndexInfo entity);
|
||||
public void deleteP2pSubscribeIdCfg(CfgIndexInfo entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -1051,11 +1051,14 @@
|
||||
<delete id="deleteP2pKeywordCfg">
|
||||
delete from p2p_keyword_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
<!-- 删除p2pSubscribeId配置 -->
|
||||
<!-- 删除p2pSubscribeId配置 -->
|
||||
<delete id="deleteP2pSubscribeIdCfg">
|
||||
delete from ntc_subscribe_id_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
|
||||
<!-- 删除FileDigest SubscribeId配置 -->
|
||||
<delete id="deleteFileDigestSubscribeIdCfg">
|
||||
delete from ntc_subscribe_id_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
|
||||
<!-- File Digest Cfg -->
|
||||
<select id="getFileDigestList" resultMap="digestCfgMap" parameterType="com.nis.domain.configuration.FileDigestCfg" >
|
||||
@@ -1151,6 +1154,15 @@
|
||||
FROM file_digest_cfg a where cfg_id=#{cfgId}
|
||||
</select>
|
||||
|
||||
<select id="getFileDigestSubscribeidList" resultMap="stringCfgMap" parameterType="com.nis.domain.configuration.FileDigestCfg">
|
||||
SELECT
|
||||
<include refid="StrCfg_Column" />
|
||||
FROM ntc_subscribe_id_cfg a where compile_id=#{compileId} and function_id=#{functionId}
|
||||
<!-- <if test="cfgType != null and cfgType != ''">
|
||||
and a.cfg_type =#{cfgType,jdbcType=VARCHAR}
|
||||
</if> -->
|
||||
</select>
|
||||
|
||||
<update id="updateFileDigestCfg" parameterType="com.nis.domain.configuration.FileDigestCfg" >
|
||||
update file_digest_cfg
|
||||
<set >
|
||||
|
||||
@@ -378,6 +378,8 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
|
||||
|
||||
public FileDigestCfg getFileDigestCfg(Long cfgId){
|
||||
FileDigestCfg entity = fileTransferCfgDao.getFileDigest(cfgId);
|
||||
List<NtcSubscribeIdCfg> subscribeidList = fileTransferCfgDao.getFileDigestSubscribeidList(entity);
|
||||
entity.setNtcSubscribeIdCfgList(subscribeidList);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -402,18 +404,21 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
|
||||
}
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
Long rawLen = result.getData().getRawLen();
|
||||
String digest = result.getData().getDigest();
|
||||
if((result!=null && result.getData()!=null) && (rawLen != null && digest!= null)){
|
||||
entity.setRawLen(rawLen);
|
||||
entity.setDigest(digest);
|
||||
entity.setFileUrl(result.getData().getAccessUrl());
|
||||
}else {
|
||||
logger.info("获取文件摘要属性有误");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+null);
|
||||
}
|
||||
entity.setRawLen(result.getData().getRawLen());
|
||||
entity.setDigest(result.getData().getDigest());
|
||||
entity.setFileUrl(result.getData().getAccessUrl());
|
||||
|
||||
mailCfgDao.saveMailFileDigestCfg(entity);
|
||||
|
||||
// 保存SubscribeId域配置信息
|
||||
if(entity.getNtcSubscribeIdCfgList()!=null){
|
||||
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
fileTransferCfgDao.saveP2pSubscribeIdCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
||||
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
||||
@@ -427,12 +432,26 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
|
||||
|
||||
entity.setEditorId(entity.getCurrentUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
if(result!=null && result.getData()!=null){
|
||||
if(result.getData() !=null ) {
|
||||
entity.setRawLen(result.getData().getRawLen());
|
||||
entity.setDigest(result.getData().getDigest());
|
||||
entity.setFileUrl(result.getData().getAccessUrl());
|
||||
}
|
||||
|
||||
fileTransferCfgDao.updateFileDigestCfg(entity);
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
entity.setCreateTime(new Date());
|
||||
|
||||
// SubscribeId域配置 先删后加
|
||||
fileTransferCfgDao.deleteFileDigestSubscribeIdCfg(entity);
|
||||
if(entity.getNtcSubscribeIdCfgList()!=null){
|
||||
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
fileTransferCfgDao.saveP2pSubscribeIdCfg(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
|
||||
if(!StringUtil.isEmpty(entity.getAreaCfg())){
|
||||
@@ -592,6 +611,17 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
|
||||
}
|
||||
}
|
||||
|
||||
public FileDigestCfg getFileDigestSubIdCfg(Long cfgId) {
|
||||
FileDigestCfg entity = fileTransferCfgDao.getFileDigest(cfgId);
|
||||
if(entity.getCompileId()!=null){
|
||||
NtcSubscribeIdCfg ntcSubscribeIdCfg = new NtcSubscribeIdCfg();
|
||||
ntcSubscribeIdCfg.setCompileId(entity.getCompileId());
|
||||
List<NtcSubscribeIdCfg> ntcList = stringCfgDao.findSubscribeIdCfgList(ntcSubscribeIdCfg);
|
||||
entity.setNtcSubscribeIdCfgList(ntcList);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Page<CfgIndexInfo> getP2pList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
|
||||
// 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL)
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||||
@@ -943,4 +973,5 @@ public class FileTransferCfgService extends CrudService<FileTransferCfgDao,CfgIn
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user