Browse Source

团队重构

master
陈裕财 3 years ago
parent
commit
a71d4219df
  1. 26
      xm-core/src/main/java/com/xm/core/ctrl/XmMenuController.java
  2. 45
      xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java

26
xm-core/src/main/java/com/xm/core/ctrl/XmMenuController.java

@ -68,6 +68,10 @@ public class XmMenuController {
private XmGroupService groupService; private XmGroupService groupService;
@Autowired
private XmProductQxService productQxService;
@Autowired @Autowired
private XmProductService productService; private XmProductService productService;
@ -77,9 +81,7 @@ public class XmMenuController {
@Autowired @Autowired
PushNotifyMsgService notifyMsgService; PushNotifyMsgService notifyMsgService;
@Autowired
XmMenuOperQxService menuOperQxService;
@Autowired @Autowired
SensitiveWordService sensitiveWordService; SensitiveWordService sensitiveWordService;
@ -290,7 +292,7 @@ public class XmMenuController {
if(xmProduct==null){ if(xmProduct==null){
return ResponseHelper.failed("data-0","产品已不存在"); return ResponseHelper.failed("data-0","产品已不存在");
} }
tips=groupService.checkProductQx(xmProduct,1,user);
tips=productQxService.checkProductQx(xmProduct,0,user);
if(!tips.isOk()){ if(!tips.isOk()){
return failed(tips); return failed(tips);
} }
@ -358,7 +360,7 @@ public class XmMenuController {
if(xmProduct==null){ if(xmProduct==null){
return ResponseHelper.failed("product-data-0","产品已不存在"); return ResponseHelper.failed("product-data-0","产品已不存在");
} }
tips=groupService.checkProductQx(xmProduct,1,user,xmMenuDb.getMmUserid());
tips=productQxService.checkProductQx(null,xmProduct,0,user,xmMenuDb.getMmUserid(),xmMenuDb.getMmUsername(),null);
if(!tips.isOk()){ if(!tips.isOk()){
return failed(tips); return failed(tips);
} }
@ -398,7 +400,7 @@ public class XmMenuController {
if(xmProduct==null){ if(xmProduct==null){
return ResponseHelper.failed("product-data-0","产品已不存在"); return ResponseHelper.failed("product-data-0","产品已不存在");
} }
tips=groupService.checkProductQx(xmProduct,1,user,xmMenuDb.getMmUserid());
tips=productQxService.checkProductQx(null,xmProduct,0,user,xmMenuDb.getMmUserid(),xmMenuDb.getMmUsername(),null);
if(!tips.isOk()){ if(!tips.isOk()){
return failed(tips); return failed(tips);
} }
@ -478,7 +480,7 @@ public class XmMenuController {
return ResponseHelper.failed("product-data-0","产品已不存在"); return ResponseHelper.failed("product-data-0","产品已不存在");
} }
Map<String,List<XmGroupVo>> groupsMap=new HashMap<>(); Map<String,List<XmGroupVo>> groupsMap=new HashMap<>();
tips=groupService.checkProductQx(groupsMap,xmProduct,0,user);
tips=productQxService.checkProductQx(groupsMap,xmProduct,0,user);
if(!tips.isOk()){ if(!tips.isOk()){
return failed(tips); return failed(tips);
} }
@ -486,11 +488,11 @@ public class XmMenuController {
String mmUserid= (String) xmMenuMap.get("mmUserid"); String mmUserid= (String) xmMenuMap.get("mmUserid");
String mmUsername= (String) xmMenuMap.get("mmUsername"); String mmUsername= (String) xmMenuMap.get("mmUsername");
if(!user.getUserid().equals(mmUserid)){ if(!user.getUserid().equals(mmUserid)){
tips=groupService.checkProductScopeQx(groupsMap,xmProduct,0,user,mmUserid,mmUsername,null);
tips=productQxService.checkProductScopeQx(groupsMap,xmProduct,0,user,mmUserid,mmUsername,null);
if(!tips.isOk()){ if(!tips.isOk()){
return failed(tips); return failed(tips);
} }
tips=groupService.checkProductTransmitQx(groupsMap,xmProduct,0,user,mmUserid,mmUsername);
tips=productQxService.checkProductTransmitQx(groupsMap,xmProduct,0,user,mmUserid,mmUsername);
if(!tips.isOk()){ if(!tips.isOk()){
return failed(tips); return failed(tips);
} }
@ -500,7 +502,7 @@ public class XmMenuController {
List<XmMenu> noOper=new ArrayList<>(); List<XmMenu> noOper=new ArrayList<>();
Map<String,Tips> noOperTips=new HashMap<>(); Map<String,Tips> noOperTips=new HashMap<>();
for (XmMenu xm : xmMenusDb) { for (XmMenu xm : xmMenusDb) {
tips=groupService.checkProductQx(groupsMap,xmProduct,0,user,xm.getMmUserid());
tips=productQxService.checkProductQx(groupsMap,xmProduct,0,user,xm.getMmUserid(), xm.getMmUsername(), null);
if(tips.isOk()){ if(tips.isOk()){
canOper.add(xm); canOper.add(xm);
}else{ }else{
@ -589,7 +591,7 @@ public class XmMenuController {
return ResponseHelper.failed("product-data-0","产品已不存在"); return ResponseHelper.failed("product-data-0","产品已不存在");
} }
for (XmMenu xm : xmMenusDb) { for (XmMenu xm : xmMenusDb) {
tips=groupService.checkProductQx(groupsMap,xmProduct,1,user,xm.getMmUserid());
tips=productQxService.checkProductQx(groupsMap,xmProduct,0,user,xm.getMmUserid(),xm.getMmUsername(),null);
if(tips.isOk()){ if(tips.isOk()){
canOper.add(xm); canOper.add(xm);
}else{ }else{
@ -727,7 +729,7 @@ public class XmMenuController {
return ResponseHelper.failed("product-data-0","产品已不存在"); return ResponseHelper.failed("product-data-0","产品已不存在");
} }
for (XmMenu xm : xmMenusDb) { for (XmMenu xm : xmMenusDb) {
tips=groupService.checkProductQx(groupsMap,xmProduct,1,user,xm.getMmUserid());
tips=productQxService.checkProductQx(groupsMap,xmProduct,0,user,xm.getMmUserid(),xm.getMmUsername(),null);
if(tips.isOk()){ if(tips.isOk()){
canOper.add(xm); canOper.add(xm);
}else{ }else{

45
xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java

@ -17,6 +17,7 @@ import com.mdp.swagger.ApiEntityParams;
import com.xm.core.entity.*; import com.xm.core.entity.*;
import com.xm.core.service.*; import com.xm.core.service.*;
import com.xm.core.service.push.XmPushMsgService; import com.xm.core.service.push.XmPushMsgService;
import com.xm.core.vo.XmGroupVo;
import com.xm.core.vo.XmQuestionVo; import com.xm.core.vo.XmQuestionVo;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -74,6 +75,14 @@ public class XmQuestionController {
XmGroupService groupService; XmGroupService groupService;
@Autowired
XmProductQxService productQxService;
@Autowired
XmProjectQxService projectQxService;
@Autowired @Autowired
PushNotifyMsgService notifyMsgService; PushNotifyMsgService notifyMsgService;
@ -321,7 +330,11 @@ public class XmQuestionController {
Map<String,Tips> noOperTips=new HashMap<>(); Map<String,Tips> noOperTips=new HashMap<>();
this.checkQx(xmQuestionsDb,canOper,noOper,noOperTips);
if(xmQuestionMap.containsKey("handlerUserid")){
this.checkQx(xmQuestionsDb,canOper,noOper,noOperTips,2);
}else{
this.checkQx(xmQuestionsDb,canOper,noOper,noOperTips,1);
}
if(canOper.size()>0){ if(canOper.size()>0){
xmQuestionMap.put("ids",canOper.stream().map(k->k.getId()).collect(Collectors.toList())); xmQuestionMap.put("ids",canOper.stream().map(k->k.getId()).collect(Collectors.toList()));
@ -338,7 +351,7 @@ public class XmQuestionController {
String handlerUserid= (String) xmQuestionMap.get("handlerUserid"); String handlerUserid= (String) xmQuestionMap.get("handlerUserid");
String handlerUsername= (String) xmQuestionMap.get("handlerUsername"); String handlerUsername= (String) xmQuestionMap.get("handlerUsername");
XmQuestion xmQuedb=canOper.get(0); XmQuestion xmQuedb=canOper.get(0);
Tips tips1=groupService.checkProductScopeQx(null,productService.getProductFromCache(xmQuedb.getProductId()),1,handlerUserid,handlerUsername,null);
Tips tips1=productQxService.checkProductScopeQx(null,productService.getProductFromCache(xmQuedb.getProductId()),1,handlerUserid,handlerUsername,null);
if(!tips1.isOk()){ if(!tips1.isOk()){
if(StringUtils.hasText(xmQuedb.getProjectId())){ if(StringUtils.hasText(xmQuedb.getProjectId())){
tips1=groupService.checkProjectScopeQx(projectService.getProjectFromCache(xmQuedb.getProjectId()),handlerUserid,handlerUsername,null); tips1=groupService.checkProjectScopeQx(projectService.getProjectFromCache(xmQuedb.getProjectId()),handlerUserid,handlerUsername,null);
@ -452,7 +465,7 @@ public class XmQuestionController {
Map<String,Tips> noOperTips=new HashMap<>(); Map<String,Tips> noOperTips=new HashMap<>();
this.checkQx(xmQuestionsDb,canOper,noOper,noOperTips);
this.checkQx(xmQuestionsDb,canOper,noOper,noOperTips,0);
if(canOper.size()>0){ if(canOper.size()>0){
xmQuestionService.batchDelete(canOper); xmQuestionService.batchDelete(canOper);
@ -498,13 +511,13 @@ public class XmQuestionController {
if(!tips1.isOk()){ if(!tips1.isOk()){
if(StringUtils.hasText(productId)){ if(StringUtils.hasText(productId)){
XmProduct xmProduct=productService.getProductFromCache(productId); XmProduct xmProduct=productService.getProductFromCache(productId);
tips1=this.groupService.checkProductQx(xmProduct,1,user);
tips1=this.productQxService.checkProductQx(xmProduct,1,user);
} }
} }
return tips1; return tips1;
} }
public void checkQx(List<XmQuestion> xmQuestionsDb, List<XmQuestion> canOper, List<XmQuestion> noOper, Map<String,Tips> noOperTips){
public void checkQx(List<XmQuestion> xmQuestionsDb, List<XmQuestion> canOper, List<XmQuestion> noOper, Map<String,Tips> noOperTips,int opType/**0-删除,1修改其它信息,2指派新负责人**/){
User user=LoginUtils.getCurrentUserInfo(); User user=LoginUtils.getCurrentUserInfo();
/** /**
* 如果有测试计划有产品编号走产品团队判断权限 * 如果有测试计划有产品编号走产品团队判断权限
@ -535,10 +548,11 @@ public class XmQuestionController {
} }
List<XmQuestion> productNoDel=new ArrayList<>(); List<XmQuestion> productNoDel=new ArrayList<>();
Map<String,List<XmGroupVo>> groupsMap=new HashMap<>();
if(productsMap.size()>0){ if(productsMap.size()>0){
for (String productId : productsMap.keySet()) { for (String productId : productsMap.keySet()) {
XmProduct xmProduct=productService.getProductFromCache(productId); XmProduct xmProduct=productService.getProductFromCache(productId);
Tips tips1=groupService.checkProductQx(xmProduct,1,user);
Tips tips1=productQxService.checkProductQx(groupsMap,xmProduct,1,user);
if(!tips1.isOk()){ if(!tips1.isOk()){
productNoDel.addAll(productsMap.get(productId)); productNoDel.addAll(productsMap.get(productId));
for (XmQuestion xmQuestion : productsMap.get(productId)) { for (XmQuestion xmQuestion : productsMap.get(productId)) {
@ -548,7 +562,13 @@ public class XmQuestionController {
}else{ }else{
List<XmQuestion> questions=productsMap.get(productId); List<XmQuestion> questions=productsMap.get(productId);
for (XmQuestion question : questions) { for (XmQuestion question : questions) {
tips1=groupService.checkProductQx(xmProduct,1,user,question.getCreateUserid(),question.getHandlerUserid());
if(opType==0){
tips1=productQxService.checkProductQx(groupsMap,xmProduct,1,user,question.getCreateUserid(),question.getCreateUsername(),null);
}else if(opType==1){
tips1=productQxService.checkProductQx(groupsMap,xmProduct,1,user,question.getHandlerUserid(),question.getHandlerUsername(),null);
}else if(opType==2){
//从新指派责任人
}
if(!tips1.isOk()){ if(!tips1.isOk()){
productNoDel.add(question); productNoDel.add(question);
noOperTips.put(question.getId(),tips1); noOperTips.put(question.getId(),tips1);
@ -580,7 +600,7 @@ public class XmQuestionController {
if(projectsMap.size()>0){ if(projectsMap.size()>0){
for (String projectId : projectsMap.keySet()) { for (String projectId : projectsMap.keySet()) {
XmProject xmProject=projectService.getProjectFromCache(projectId); XmProject xmProject=projectService.getProjectFromCache(projectId);
Tips tips1=groupService.checkProjectQx(xmProject,user);
Tips tips1=projectQxService.checkProjectQx(groupsMap,xmProject,1,user);
if(!tips1.isOk()){ if(!tips1.isOk()){
noOper.addAll(projectsMap.get(projectId)); noOper.addAll(projectsMap.get(projectId));
for (XmQuestion xmQuestion : projectsMap.get(projectId)) { for (XmQuestion xmQuestion : projectsMap.get(projectId)) {
@ -590,7 +610,14 @@ public class XmQuestionController {
}else{ }else{
List<XmQuestion> questions=projectsMap.get(projectId); List<XmQuestion> questions=projectsMap.get(projectId);
for (XmQuestion question : questions) { for (XmQuestion question : questions) {
tips1=groupService.checkProjectQx(xmProject,user,question.getCreateUserid(),question.getHandlerUserid());
tips1=projectQxService.checkProjectQx(groupsMap,xmProject,1,user,question.getHandlerUserid(),question.getHandlerUsername(),null);
if(opType==0){
tips1=projectQxService.checkProjectQx(groupsMap,xmProject,1,user,question.getCreateUserid(),question.getCreateUsername(),null);
}else if(opType==1){
tips1=projectQxService.checkProjectQx(groupsMap,xmProject,1,user,question.getHandlerUserid(),question.getHandlerUsername(),null);
}else if(opType==2){
//从新指派责任人
}
if(!tips1.isOk()){ if(!tips1.isOk()){
noOper.add(question); noOper.add(question);
noOperTips.put(question.getId(),tips1); noOperTips.put(question.getId(),tips1);

Loading…
Cancel
Save