appip全量下发逻辑:

1、全量下发
(1)、批量下发已下发过的app的app IP配置(走maat配置下发接口)

appip批量审核逻辑:
1、审核通过
(1)、批量下发已下发过的app的app IP配置(走ip复用接口)
		 批量修改app ip配置状态为已下发
(2)、批量下发未下发过的app的app ip配置(走maat下发接口)
		批量修改group_info为已下发
		批量修改app ip为已下发
2、取消审核通过
(1)、批量失效已下发过的app的app IP配置(走ip复用接口)
		 批量修改app ip配置状态为失效
(2)、未下发过的app不存在已下发的配置,无需处理取消。
This commit is contained in:
DuanDongmei
2018-12-07 10:07:53 +08:00
parent 1c3dc455e3
commit 95dbe2a123
9 changed files with 389 additions and 141 deletions

View File

@@ -373,39 +373,66 @@ public class AppCfgController extends BaseController {
*/
@RequestMapping(value = {"auditAppIpCfg"})
@RequiresPermissions(value={"app:ip:confirm"})
public String auditAppIpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
AppIpCfg entity = new AppIpCfg();
String[] idArray = ids.split(",");
//同一编译IP的分组
Map<Integer,List<AppIpCfg>> dataMap=new HashMap<>();
for(String id :idArray){
entity = appCfgService.getAppIpCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setTableName(AppIpCfg.getTablename());
if(dataMap.containsKey(entity.getCompileId())) {
dataMap.get(entity.getCompileId()).add(entity);
}else {
List<AppIpCfg> ipList=new ArrayList<>();
ipList.add(entity);
dataMap.put(entity.getCompileId(), ipList);
}
}
for(List<AppIpCfg> entitys:dataMap.values()) {
try {
appCfgService.auditAppIpCfg(entitys,isAudit);
} catch (Exception e) {
e.printStackTrace();
logger.error("app协议IP配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
public String auditAppIpCfg(Model model,@ModelAttribute("cfg")AppIpCfg cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
if(!StringUtil.isEmpty(ids)) {
AppIpCfg entity = new AppIpCfg();
String[] idArray = ids.split(",");
//同一编译IP的分组
Map<Integer,List<AppIpCfg>> dataMap=new HashMap<>();
for(String id :idArray){
entity = appCfgService.getAppIpCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setTableName(AppIpCfg.getTablename());
if(dataMap.containsKey(entity.getCompileId())) {
dataMap.get(entity.getCompileId()).add(entity);
}else {
addMessage(redirectAttributes,"error","audit_failed");
List<AppIpCfg> ipList=new ArrayList<>();
ipList.add(entity);
dataMap.put(entity.getCompileId(), ipList);
}
}
for(List<AppIpCfg> entitys:dataMap.values()) {
try {
appCfgService.auditAppIpCfg(entitys,isAudit);
} catch (Exception e) {
e.printStackTrace();
logger.error("app协议IP配置下发失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
}else {
addMessage(redirectAttributes,"error","audit_failed");
}
}
}
}else {
Page<AppIpCfg> searchPage=new Page<AppIpCfg>(request,response,"r");
Page<AppIpCfg> auditPage=new Page<AppIpCfg>(request,response,"r");
BeanUtils.copyProperties(searchPage, auditPage);
try {
auditAll(auditPage,isValid , cfg);
} catch (Exception e) {
logger.error("配置下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else {
addMessage(redirectAttributes,"error", "audit_failed");
}
}
return ipCfgList(model, cfg, request, response);
}
return "redirect:" + adminPath +"/app/ipCfgList?functionId="+functionId;