p2p配置提交以及相关国际化代码.
This commit is contained in:
@@ -29,9 +29,13 @@ import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.FileDigestCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.P2pHashCfg;
|
||||
import com.nis.domain.configuration.P2pKeywordCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
@@ -226,4 +230,154 @@ public class FileTransferCfgController extends BaseController{
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/fileTransfer/fileDigestList?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"p2pList"})
|
||||
public String p2pList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> page = fileTransferCfgService.getP2pList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/fileTransfer/p2pList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"p2pForm"})
|
||||
@RequiresPermissions(value={"fileTransfer:p2p:config"})
|
||||
public String p2pForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
// 跳转操作页面(根据ids判断是新增 or 修改)
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = fileTransferCfgService.getP2pCfg(Long.parseLong(ids));
|
||||
|
||||
// 添加配置域Key,用于新增页面判断
|
||||
P2pHashCfg hashCfg = new P2pHashCfg();
|
||||
hashCfg.setCfgType(Constants.P2P_HASH_BIN_REGION);
|
||||
entity.setP2pHash(hashCfg);
|
||||
P2pKeywordCfg keywordCfg = new P2pKeywordCfg();
|
||||
keywordCfg.setCfgType(Constants.P2P_KEYWORDS_REGION);
|
||||
entity.setP2pKeyword(keywordCfg);
|
||||
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
|
||||
subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID_REGION);
|
||||
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
|
||||
|
||||
if(entity.getP2pHashList().size() == 0) {
|
||||
entity.getP2pHashList().add(hashCfg);
|
||||
}
|
||||
if(entity.getP2pKeywordList().size() == 0) {
|
||||
entity.getP2pKeywordList().add(keywordCfg);
|
||||
}
|
||||
if(entity.getNtcSubscribeIdCfgList().size() == 0) {
|
||||
entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg);
|
||||
}
|
||||
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
// 添加配置域Key,用于修改页面判断
|
||||
P2pHashCfg hashCfg = new P2pHashCfg();
|
||||
hashCfg.setCfgType(Constants.P2P_HASH_BIN_REGION);
|
||||
entity.setP2pHash(hashCfg);
|
||||
P2pKeywordCfg keywordCfg = new P2pKeywordCfg();
|
||||
keywordCfg.setCfgType(Constants.P2P_KEYWORDS_REGION);
|
||||
entity.setP2pKeyword(keywordCfg);
|
||||
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
|
||||
subscribeIdCfg.setCfgType(Constants.NTC_SUBSCRIBE_ID_REGION);
|
||||
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
|
||||
|
||||
List<P2pHashCfg> hashList = new ArrayList<P2pHashCfg>();
|
||||
hashList.add(hashCfg);
|
||||
entity.setP2pHashList(hashList);
|
||||
List<P2pKeywordCfg> keywordList = new ArrayList<P2pKeywordCfg>();
|
||||
keywordList.add(keywordCfg);
|
||||
entity.setP2pKeywordList(keywordList);
|
||||
ArrayList<NtcSubscribeIdCfg> subscribeIdList = new ArrayList<NtcSubscribeIdCfg>();
|
||||
subscribeIdList.add(subscribeIdCfg);
|
||||
entity.setNtcSubscribeIdCfgList(subscribeIdList);
|
||||
|
||||
initFormCondition(model,entity);
|
||||
}
|
||||
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/fileTransfer/p2pForm";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"saveP2pCfg"})
|
||||
@RequiresPermissions(value={"fileTransfer:p2p:config"})
|
||||
public String saveP2pCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
fileTransferCfgService.saveP2pCfg(entity);
|
||||
return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"updateP2pCfgValid"})
|
||||
@RequiresPermissions(value={"fileTransfer:p2p:config"})
|
||||
public String updateP2pCfgValid(Integer isValid,String ids,Integer functionId) {
|
||||
fileTransferCfgService.updateP2pCfgValid(isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"ajaxP2pSubList"})
|
||||
public String ajaxP2pSubList(Model model,Long cfgId,Integer index) {
|
||||
CfgIndexInfo cfg = fileTransferCfgService.getP2pCfg(cfgId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getP2pHashList()!=null){
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg hash:cfg.getP2pHashList()){
|
||||
if(!hash.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",hash.getCfgType()});
|
||||
cfgType = hash.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getP2pKeywordList()!=null){
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getP2pKeywordList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getNtcSubscribeIdCfgList()!=null){
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg subscribeId:cfg.getNtcSubscribeIdCfgList()){
|
||||
if(!subscribeId.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",subscribeId.getCfgType()});
|
||||
cfgType = subscribeId.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/fileTransfer/p2pSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"auditP2pCfg"})
|
||||
@RequiresPermissions(value={"fileTransfer:p2p:confirm"})
|
||||
public String auditP2pCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = fileTransferCfgService.getP2pCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
fileTransferCfgService.auditP2pCfg(entity,isAudit);
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("p2p配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/fileTransfer/p2pList?functionId="+functionId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user