|
|
|
@ -12,6 +12,7 @@ import com.ccsens.tall.bean.po.*; |
|
|
|
import com.ccsens.tall.bean.vo.LabelVo; |
|
|
|
import com.ccsens.tall.bean.vo.ProjectVo; |
|
|
|
import com.ccsens.tall.persist.dao.*; |
|
|
|
import com.ccsens.tall.persist.mapper.ProMemberRoleMapper; |
|
|
|
import com.ccsens.tall.persist.mapper.SysImitationMapper; |
|
|
|
import com.ccsens.util.CodeEnum; |
|
|
|
import com.ccsens.util.DateUtil; |
|
|
|
@ -47,6 +48,8 @@ public class ProjectService implements IProjectService { |
|
|
|
@Resource |
|
|
|
private ProMemberRoleDao memberRoleDao; |
|
|
|
@Resource |
|
|
|
private ProMemberRoleShowDao memberRoleShowDao; |
|
|
|
@Resource |
|
|
|
private TaskDetailDao taskDetailDao; |
|
|
|
@Resource |
|
|
|
private TaskSubTimeDao taskSubTimeDao; |
|
|
|
@ -1248,4 +1251,66 @@ public class ProjectService implements IProjectService { |
|
|
|
} |
|
|
|
return getProjectInfoById(currentUserId,sysProject.getId(),token); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 项目转模板 |
|
|
|
* @param param 项目id |
|
|
|
* @param userId 当前用户id |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void projectToTemplate(ProjectDto.ProjectToTemplate param, Long userId) { |
|
|
|
//用户在项目中的最高权限
|
|
|
|
int power = proRoleService.selectPowerByRoleName(userId, param.getProjectId()); |
|
|
|
if (WebConstant.ROLE_POWER.OPERATION_POWER.value < power){ |
|
|
|
|
|
|
|
SysProject sysProject = sysProjectDao.selectByPrimaryKey(param.getProjectId()); |
|
|
|
//将项目改为模板项目
|
|
|
|
sysProject.setTemplate((byte)1); |
|
|
|
sysProjectDao.insertSelective(sysProject); |
|
|
|
|
|
|
|
//查找成员相关-删除
|
|
|
|
//1.查找项目下成员
|
|
|
|
ProMemberExample proMemberExample = new ProMemberExample(); |
|
|
|
proMemberExample.createCriteria().andProjectIdEqualTo(param.getProjectId()); |
|
|
|
List<ProMember> proMembers = proMemberDao.selectByExample(proMemberExample); |
|
|
|
for (ProMember proMember : proMembers) { |
|
|
|
proMember.setRecStatus(WebConstant.REC_STATUS.Deleted.value); |
|
|
|
proMemberDao.updateByPrimaryKeySelective(proMember); |
|
|
|
|
|
|
|
//2.删除成角色下的成员
|
|
|
|
ProMemberRoleExample proMemberRoleExample = new ProMemberRoleExample(); |
|
|
|
proMemberRoleExample.createCriteria().andMemberIdEqualTo(proMember.getId()); |
|
|
|
List<ProMemberRole> proMemberRoles = memberRoleDao.selectByExample(proMemberRoleExample); |
|
|
|
proMemberRoles.forEach(proMemberRole -> { |
|
|
|
proMemberRole.setRecStatus(WebConstant.REC_STATUS.Deleted.value); |
|
|
|
memberRoleDao.updateByPrimaryKeySelective(proMemberRole); |
|
|
|
}); |
|
|
|
|
|
|
|
//3.删除成员角色展示表中的相关数据
|
|
|
|
ProMemberRoleShowExample proMemberRoleShowExample = new ProMemberRoleShowExample(); |
|
|
|
proMemberRoleShowExample.createCriteria().andMemberIdEqualTo(proMember.getId()); |
|
|
|
List<ProMemberRoleShow> proMemberRoleShows = memberRoleShowDao.selectByExample(proMemberRoleShowExample); |
|
|
|
for (ProMemberRoleShow proMemberRoleShow : proMemberRoleShows) { |
|
|
|
proMemberRoleShow.setRecStatus(WebConstant.REC_STATUS.Deleted.value); |
|
|
|
memberRoleShowDao.updateByPrimaryKeySelective(proMemberRoleShow); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//4.查找关注者相关删除
|
|
|
|
UserAttentionExample userAttentionExample = new UserAttentionExample(); |
|
|
|
userAttentionExample.createCriteria().andProjectIdEqualTo(param.getProjectId()); |
|
|
|
List<UserAttention> userAttentions = userAttentionDao.selectByExample(userAttentionExample); |
|
|
|
if (CollectionUtil.isNotEmpty(userAttentions)){ |
|
|
|
userAttentions.forEach(userAttention -> { |
|
|
|
userAttention.setRecStatus(WebConstant.REC_STATUS.Deleted.value); |
|
|
|
userAttentionDao.updateByPrimaryKeySelective(userAttention); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
throw new BaseException(CodeEnum.NOT_POWER); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|