社交应用功能,增加批量处理功能按钮。

This commit is contained in:
zhangwei
2018-04-08 17:19:43 +08:00
parent 40ff67f6f2
commit 75cab20b25
4 changed files with 338 additions and 260 deletions

View File

@@ -11,6 +11,7 @@ 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.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.ServiceConfigInfo;
@@ -186,7 +187,7 @@ public class AppCfgController extends BaseController {
logger.info("saveOrUpdateAppCfg loaded");
if(cfg==null){
logger.error("无法保存空的配置!");
addMessage(model,"保存失败!");
addMessage(model,"save_failed");
}else{
SpecificServiceCfg protocol = specificServiceCfgService.getBySpecServiceId(cfg.getAppId().intValue());
if(protocol!=null){
@@ -202,7 +203,7 @@ public class AppCfgController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("配置保存失败!"+e.getMessage());
addMessage(model,"保存失败!");
addMessage(model,"save_failed");
}
}else{
cfg.setEditorId(cfg.getCurrentUser().getId());
@@ -212,15 +213,15 @@ public class AppCfgController extends BaseController {
} catch (Exception e) {
e.printStackTrace();
logger.error("配置保存失败!"+e.getMessage());
addMessage(model,"保存失败!");
addMessage(model,"save_failed");
}
}
model.addAttribute("serviceId",serviceId);
model.addAttribute("action",cfg.getAction());
addMessage(model,"保存成功,正在为您跳转页面...");
addMessage(model,"save_success");
}else{
logger.error("所选协议信息无效!");
addMessage(model,"保存失败!");
addMessage(model,"save_failed");
}
}
@@ -237,36 +238,27 @@ public class AppCfgController extends BaseController {
* @since 1.0.0
*/
@RequestMapping(value = {"auditCfg"})
public String auditAppCfg(String cfgName,AppIdCfg cfg,Model model) {
public String auditAppCfg(String cfgName,String ids,Integer auditState,Integer serviceId,Integer action,
Model model,RedirectAttributes redirectAttributes) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("audit", Constants.AUDIT_PAGE);
if(cfg==null){
logger.error("无法审核空的配置!");
}else{
int audit=appCfgService.getIsAudit(cfg.getCfgId());
if(audit==Constants.AUDIT_YES&&cfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
logger.error("审核通过的配置只能取消审核通过!");
model.addAttribute("serviceId", serviceId);
model.addAttribute("action",action);
model.addAttribute("cfgType","app");
try {
String[] cfgIds = ids.split(",");
int result=appCfgService.auditAppCfg(cfgIds,auditState);
if(result==1){
addMessage(model,"audit_success");
}else{
cfg.setAuditorId(cfg.getCurrentUser().getId());
cfg.setAuditTime(new Date());
if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过设置有效标志为0
cfg.setIsValid(Constants.VALID_NO);
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1
cfg.setIsValid(Constants.VALID_YES);
}
try {
int result=appCfgService.auditAppCfg(cfg);
} catch (Exception e) {
e.printStackTrace();
logger.error("配置下发maat失败"+e.getMessage());
addMessage(model,"配置审核下发失败!");
}
model.addAttribute("serviceId", cfg.getServiceId());
model.addAttribute("action", cfg.getAction());
addMessage(model,"audit_failed");
}
} catch (Exception e) {
e.printStackTrace();
logger.error("配置下发maat失败"+e.getMessage());
addMessage(model,"audit_failed");
}
return "redirect:" + adminPath + "/cfg/app/list";
return "/cfg/resultPage";
}
/**
*
@@ -278,25 +270,18 @@ public class AppCfgController extends BaseController {
* @since 1.0.0
*/
@RequestMapping(value = {"deleteCfg"})
public String deleteAppCfg(int action,long cfgId,Integer compileId,String cfgName,Integer serviceId,Model model) {
public String deleteAppCfg(int action,String ids,String cfgName,Integer serviceId,Model model,RedirectAttributes redirectAttributes) {
model.addAttribute("serviceId", serviceId);
model.addAttribute("cfgName", cfgName);
model.addAttribute("action", action);
model.addAttribute("cfgType","app");
model.addAttribute("audit", Constants.CFG_PAGE);
int audit=appCfgService.getIsAudit(cfgId);
//未审核时可删除
if(audit!=Constants.AUDIT_YES){
AppIdCfg cfg=new AppIdCfg();
cfg.setCfgId(cfgId);
cfg.setEditorId(cfg.getCurrentUser().getId());
cfg.setEditTime(new Date());
cfg.setIsValid(Constants.VALID_DEL);
cfg.setCompileId(compileId);
int result=appCfgService.deleteAppCfg(cfg);
addMessage(model,"删除成功,正在为您跳转页面...");
String[] cfgIds = ids.split(",");
int result=appCfgService.deleteAppCfg(cfgIds);
if(result==1){
addMessage(redirectAttributes,"delete_success");
}else{
logger.error("通过审核的配置不能删除!");
addMessage(redirectAttributes,"delete_failed");
}
return "/cfg/resultPage";
}