Browse Source

添加节点类型、标签等

master
陈裕财 4 years ago
parent
commit
5876c155b1
  1. 43
      xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java
  2. 36
      xm-core/src/main/java/com/xm/core/service/XmRecordService.java

43
xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java

@ -1,14 +1,18 @@
package com.xm.core.ctrl; package com.xm.core.ctrl;
import com.alibaba.fastjson.JSON;
import com.mdp.core.entity.Tips; import com.mdp.core.entity.Tips;
import com.mdp.core.err.BizException; import com.mdp.core.err.BizException;
import com.mdp.core.utils.RequestUtils; import com.mdp.core.utils.RequestUtils;
import com.mdp.core.utils.ResponseHelper;
import com.mdp.mybatis.PageUtils; import com.mdp.mybatis.PageUtils;
import com.mdp.qx.HasQx; import com.mdp.qx.HasQx;
import com.mdp.safe.client.entity.User; import com.mdp.safe.client.entity.User;
import com.mdp.safe.client.utils.LoginUtils; import com.mdp.safe.client.utils.LoginUtils;
import com.xm.core.entity.XmIteration; import com.xm.core.entity.XmIteration;
import com.xm.core.service.XmIterationService; import com.xm.core.service.XmIterationService;
import com.xm.core.service.XmProductService;
import com.xm.core.service.XmRecordService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -41,8 +45,12 @@ public class XmIterationController {
@Autowired @Autowired
private XmIterationService xmIterationService; private XmIterationService xmIterationService;
@Autowired
private XmProductService xmProductService;
@Autowired
private XmRecordService xmRecordService;
@ApiOperation( value = "查询迭代定义信息列表",notes="listXmIteration,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") @ApiOperation( value = "查询迭代定义信息列表",notes="listXmIteration,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}")
@ApiImplicitParams({ @ApiImplicitParams({
@ -164,6 +172,7 @@ public class XmIterationController {
xmIteration.setBranchId(user.getBranchId()); xmIteration.setBranchId(user.getBranchId());
xmIteration.setIstatus("0"); xmIteration.setIstatus("0");
xmIterationService.insert(xmIteration); xmIterationService.insert(xmIteration);
xmRecordService.addXmIterationRecord(xmIteration.getId(),"迭代-新增","新增迭代"+xmIteration.getIterationName());
m.put("data",xmIteration); m.put("data",xmIteration);
}catch (BizException e) { }catch (BizException e) {
tips=e.getTips(); tips=e.getTips();
@ -188,7 +197,20 @@ public class XmIterationController {
Map<String,Object> m = new HashMap<>(); Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功删除一条数据"); Tips tips=new Tips("成功删除一条数据");
try{ try{
if(!StringUtils.hasText(xmIteration.getId())){
return ResponseHelper.failed("id-0","请上送迭代编号");
}
XmIteration iterationDb=this.xmIterationService.selectOneObject(xmIteration);
if(iterationDb==null){
return ResponseHelper.failed("data-0","迭代不存在");
}
User user=LoginUtils.getCurrentUserInfo();
if(!user.getUserid().equals(iterationDb.getAdminUserid()) && user.getUserid().equals(iterationDb.getAdminUserid())){
return ResponseHelper.failed("no-qx","您无权删除,迭代创建人、负责人可以删除");
}
xmIterationService.deleteByPk(xmIteration); xmIterationService.deleteByPk(xmIteration);
xmRecordService.addXmIterationRecord(xmIteration.getId(),"迭代-删除","删除迭代"+iterationDb.getIterationName(),"", JSON.toJSONString(iterationDb));
}catch (BizException e) { }catch (BizException e) {
tips=e.getTips(); tips=e.getTips();
logger.error("",e); logger.error("",e);
@ -212,7 +234,19 @@ public class XmIterationController {
Map<String,Object> m = new HashMap<>(); Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功更新一条数据"); Tips tips=new Tips("成功更新一条数据");
try{ try{
if(!StringUtils.hasText(xmIteration.getId())){
return ResponseHelper.failed("id-0","请上送迭代编号");
}
XmIteration iterationDb=this.xmIterationService.selectOneObject(xmIteration);
if(iterationDb==null){
return ResponseHelper.failed("data-0","迭代不存在");
}
User user=LoginUtils.getCurrentUserInfo();
if(!user.getUserid().equals(iterationDb.getAdminUserid()) && user.getUserid().equals(iterationDb.getAdminUserid())){
return ResponseHelper.failed("no-qx","您无权修改,迭代创建人、负责人可以修改");
}
xmIterationService.updateByPk(xmIteration); xmIterationService.updateByPk(xmIteration);
xmRecordService.addXmIterationRecord(xmIteration.getId(),"迭代-修改","修改迭代"+iterationDb.getIterationName(),JSON.toJSONString(xmIteration), JSON.toJSONString(iterationDb));
m.put("data",xmIteration); m.put("data",xmIteration);
}catch (BizException e) { }catch (BizException e) {
tips=e.getTips(); tips=e.getTips();
@ -233,10 +267,19 @@ public class XmIterationController {
Map<String,Object> m = new HashMap<>(); Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功更新一条数据"); Tips tips=new Tips("成功更新一条数据");
try{ try{
if(!StringUtils.hasText(xmIteration.getId())){
return ResponseHelper.failed("id-0","请上送迭代编号");
}
if(xmIteration==null || StringUtils.isEmpty(xmIteration.getId())) { if(xmIteration==null || StringUtils.isEmpty(xmIteration.getId())) {
tips.setFailureMsg("请输入迭代编号id"); tips.setFailureMsg("请输入迭代编号id");
}else { }else {
XmIteration iterationDb=this.xmIterationService.selectOneObject(xmIteration);
if(iterationDb==null){
return ResponseHelper.failed("data-0","迭代不存在");
}
xmIterationService.loadTasksToXmIterationState(xmIteration.getId()); xmIterationService.loadTasksToXmIterationState(xmIteration.getId());
xmRecordService.addXmIterationRecord(xmIteration.getId(),"迭代-汇总","汇总计算迭代数据"+iterationDb.getIterationName());
} }
}catch (BizException e) { }catch (BizException e) {
tips=e.getTips(); tips=e.getTips();

36
xm-core/src/main/java/com/xm/core/service/XmRecordService.java

@ -170,7 +170,6 @@ public class XmRecordService extends BaseService {
} }
/** /**
* 针对产品下的需求的所有操作用此方法 * 针对产品下的需求的所有操作用此方法
* @param productId 产品编号
* @param menus 需求列表 * @param menus 需求列表
* @param action 操作如 新增任务修改任务信息修改任务进度 * @param action 操作如 新增任务修改任务信息修改任务进度
* @param remarks 人性化语言描述 ,自动添加 需求名称xxxxx * @param remarks 人性化语言描述 ,自动添加 需求名称xxxxx
@ -195,7 +194,7 @@ public class XmRecordService extends BaseService {
records.add(record); records.add(record);
} }
if(records.size()>0){ if(records.size()>0){
super.batchDelete(records);
super.batchInsert(records);
} }
} }
@ -220,7 +219,40 @@ public class XmRecordService extends BaseService {
record.setOldValue(oldValue); record.setOldValue(oldValue);
this.insert(record); this.insert(record);
} }
/**
* 针对迭代下的所有操作用此方法
* @param iterationId 迭代编号
* @param action 操作如 新增任务修改任务信息修改任务进度
* @param remarks 人性化语言描述 ,自动添加 需求名称xxxxx
*/
@Async
public void addXmIterationRecord(String iterationId, String action, String remarks) {
XmRecord record=this.initXmRecord();
record.setBizId(iterationId);
record.setObjType("iteration");
record.setAction(action);
record.setRemarks(remarks);
super.insert(record);
}
/**
* 针对迭代下的所有操作用此方法
* @param action 操作如 新增任务修改任务信息修改任务进度
* @param remarks 人性化语言描述
* @param newValue 需要记录下来的新数据 可空
* @param oldValue 需要记录下来的旧数据 可空
*/
@Async
public void addXmIterationRecord(String iterationId,String action,String remarks,String newValue,String oldValue) {
XmRecord record=this.initXmRecord();
record.setBizId(iterationId);
record.setObjType("iteration");
record.setAction(action);
record.setRemarks(remarks);
record.setNewValue(newValue);
record.setOldValue(oldValue);
super.insert(record);
}
/** /**
* 针对项目下的任务的所有操作用此方法 * 针对项目下的任务的所有操作用此方法
* @param projectId 项目编号 * @param projectId 项目编号

Loading…
Cancel
Save