Browse Source

角色展示的接口修改

recovery
ma 4 years ago
parent
commit
aabad64a17
  1. 19
      tall/src/main/java/com/ccsens/tall/service/ExcelService.java
  2. 11
      tall/src/main/java/com/ccsens/tall/service/IProRoleService.java
  3. 3
      tall/src/main/java/com/ccsens/tall/service/ProMemberService.java
  4. 16
      tall/src/main/java/com/ccsens/tall/service/ProRoleService.java
  5. 5
      tall/src/main/java/com/ccsens/tall/web/ProjectController.java
  6. 15
      tall/src/main/java/com/ccsens/tall/web/RoleController.java
  7. 2
      util/src/main/java/com/ccsens/util/CodeEnum.java
  8. 3
      util/src/main/java/com/ccsens/util/WebConstant.java

19
tall/src/main/java/com/ccsens/tall/service/ExcelService.java

@ -76,6 +76,8 @@ public class ExcelService implements IExcelService {
@Resource
private IUserAttentionService userAttentionService;
@Resource
private UserAttentionDao userAttentionDao;
@Resource
private IWbsSubSheetService wbsSubSheetService;
@Resource
private IWpsService wpsService;
@ -93,6 +95,17 @@ public class ExcelService implements IExcelService {
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(is);
//读取WBS表
SysProject sysProject = readWbs(xssfWorkbook, currentUserId);
//查看创建人是否关注了项目
UserAttentionExample example = new UserAttentionExample();
example.createCriteria().andUserIdEqualTo(currentUserId).andProjectIdEqualTo(sysProject.getId());
long count = userAttentionDao.countByExample(example);
if (0 == count){
UserAttention userAttention = new UserAttention();
userAttention.setId(snowflake.nextId());
userAttention.setProjectId(sysProject.getId());
userAttention.setUserId(currentUserId);
userAttentionDao.insertSelective(userAttention);
}
return selectByProjectId(currentUserId, sysProject);
}
@ -536,9 +549,11 @@ public class ExcelService implements IExcelService {
//添加奖惩干系人
if (StrUtil.isNotEmpty(stakeholderCell)) {
//判断奖惩干系人的手机号是否为空
if ( StrUtil.isEmpty(stakeholderPhoneCell)){
throw new BaseException(CodeEnum.WBS_NOT_PHONE.addMsg(memberSheet.getSheetName(), (i+1),stakeholderCell));
}
//判断奖惩干系人的手机号格式是否正确
if (!stakeholderPhoneCell.matches(regex)){
throw new BaseException(CodeEnum.WBS_PHONE_ERROR.addMsg(memberSheet.getSheetName(),(i+1),stakeholderCell));
}
@ -740,6 +755,10 @@ public class ExcelService implements IExcelService {
}
if(map.get("标签")!=null){
label=StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(map.get("标签"))));
int length = label.length();
if (WebConstant.LABEL_LENGTH < length){
throw new BaseException(CodeEnum.LABEL_TOO_LONG.addMsg(wbsSheet.getSheetName(),(i+1),label));
}
}else {
throw new BaseException(CodeEnum.NOTNAME.addMsgLwb("标签"));
}

11
tall/src/main/java/com/ccsens/tall/service/IProRoleService.java

@ -15,7 +15,16 @@ public interface IProRoleService {
List<ProRole> getProRoleByProjectIdAndUserId(Long projectId, Long currentUserId);
List<ProjectVo.RoleInfo> getRolesByProjectIdAndUserId(Long projectId, Long currentUserId,Integer imitation) throws Exception;
/**
*
* @param projectId
* @param currentUserId
* @param imitation
* @param queryType 0是查可见角色,1是查全部
* @return
* @throws Exception
*/
List<ProjectVo.RoleInfo> getRolesByProjectIdAndUserId(Long projectId, Long currentUserId,Integer imitation,int queryType) throws Exception;
List<ProjectVo.RoleInfo> getRealMemberRolesByProjectId(Long projectId);

3
tall/src/main/java/com/ccsens/tall/service/ProMemberService.java

@ -402,6 +402,9 @@ public class ProMemberService implements IProMemberService {
}
//修改奖惩干系人
Long stakeholderId = null;
if (ObjectUtil.isNotNull(updateMemberInfo.getStakeholderName()) && ObjectUtil.isNull(updateMemberInfo.getStakeholderPhone())){
throw new BaseException(CodeEnum.WBS_STAKEHOLDER_PHONE_NOT_FOUND);
}
if (ObjectUtil.isNotNull(updateMemberInfo.getStakeholderPhone())) {
ProMemberExample stakeholderExample = new ProMemberExample();
stakeholderExample.createCriteria().andProjectIdEqualTo(proMember.getProjectId()).andPhoneEqualTo(updateMemberInfo.getStakeholderPhone());

16
tall/src/main/java/com/ccsens/tall/service/ProRoleService.java

@ -91,14 +91,19 @@ public class ProRoleService implements IProRoleService {
* 根据项目id和用户Id查询项目下的所有二级角色的详细信息
*/
@Override
public List<ProjectVo.RoleInfo> getRolesByProjectIdAndUserId(Long projectId, Long currentUserId, Integer imitation) throws Exception {
public List<ProjectVo.RoleInfo> getRolesByProjectIdAndUserId(Long projectId, Long currentUserId, Integer imitation,int queryType) throws Exception {
List<ProjectVo.RoleInfo> memberRoleList;
//获取用户在项目中的角色
List<ProRole> roleList = proMemberService.selectRolesByUserIdAndProjectId(currentUserId, projectId, imitation);
//1.查询二级角色(项目经理+项目成员+mvp)(所有二级角色)
memberRoleList = getRealMemberRolesShowByProjectId(projectId,currentUserId);
if (queryType == 0){
memberRoleList = getRealMemberRolesShowByProjectId(projectId,currentUserId);
}else{
memberRoleList = getRealMemberRolesShowByProjectIdAll(projectId,currentUserId);
}
if (CollectionUtil.isNotEmpty(memberRoleList)) {
if (CollectionUtil.isNotEmpty(roleList)) {
@ -238,6 +243,13 @@ public class ProRoleService implements IProRoleService {
// }
return memberRoleList;
}
private List<ProjectVo.RoleInfo> getRealMemberRolesShowByProjectIdAll(Long projectId, Long currentUserId) {
List<ProjectVo.RoleInfo> memberRoleList;
memberRoleList = proRoleDao.selectSecondRolesByProjectId(projectId);
return memberRoleList;
}
@Override
public List<ProjectVo.RoleInfo> getRealMemberRolesByProjectId(Long projectId) {
//查询二级角色

5
tall/src/main/java/com/ccsens/tall/web/ProjectController.java

@ -85,7 +85,7 @@ public class ProjectController {
return JsonResponse.newInstance().ok(projectInfo);
}
@ApiOperation(value = "根据项目id获取二级角色列表",notes = "PM,MVP,Mine,Others...")
@ApiOperation(value = "根据项目id获取二级角色列表(查询全部)",notes = "PM,MVP,Mine,Others...")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "项目Id", required = true, paramType = "path"),
@ApiImplicitParam(name = "imitation", value = "是否是变身模式 0否 1是", required = true, paramType = "query")
@ -95,7 +95,8 @@ public class ProjectController {
@PathVariable("id") Long projectId,
@RequestParam(required = false) Integer imitation) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
List<ProjectVo.RoleInfo> roleInfoList = proRoleService.getRolesByProjectIdAndUserId(projectId, currentUserId,imitation);
int queryType = 1;
List<ProjectVo.RoleInfo> roleInfoList = proRoleService.getRolesByProjectIdAndUserId(projectId, currentUserId,imitation,queryType);
return JsonResponse.newInstance().ok(roleInfoList);
}

15
tall/src/main/java/com/ccsens/tall/web/RoleController.java

@ -144,4 +144,19 @@ public class RoleController {
proRoleService.upRoleShowsOrder(param);
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "根据项目id获取二级角色列表(当前用户可见)",notes = "PM,MVP,Mine,Others...")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "项目Id", required = true, paramType = "path"),
@ApiImplicitParam(name = "imitation", value = "是否是变身模式 0否 1是", required = true, paramType = "query")
})
@RequestMapping(value = "/{id}/roles", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<ProjectVo.RoleInfo>> getRolesByProjectId(HttpServletRequest request,
@PathVariable("id") Long projectId,
@RequestParam(required = false) Integer imitation) throws Exception {
Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject());
int queryType = 0;
List<ProjectVo.RoleInfo> roleInfoList = proRoleService.getRolesByProjectIdAndUserId(projectId, currentUserId,imitation,queryType);
return JsonResponse.newInstance().ok(roleInfoList);
}
}

2
util/src/main/java/com/ccsens/util/CodeEnum.java

@ -34,6 +34,7 @@ public enum CodeEnum {
WBS_NOT_PHONE(19,"手机号为空",true),
WBS_PHONE_ERROR(19,"手机号格式错误",true),
WBS_STAKEHOLDER_PHONE(20,"奖惩干系人和手机号不匹配",true),
WBS_STAKEHOLDER_PHONE_NOT_FOUND(20,"请填写奖惩干系人手机号",true),
WBS_REPEAT_MEMBER_PHONE(21,"成员名或手机号与其他人重复",true),
WBS_NOT_FIRST_ROLE(22,"系统角色名称错误",true),
WBS_REPEAT_ROLE_NAME(23,"角色名称重复",true),
@ -207,6 +208,7 @@ public enum CodeEnum {
WBS_TASK_START_TIME_ERROR(168,"任务开始时间格式错误,请检查后操作",true),
WBS_TASK_END_TIME_ERROR(169,"任务结束时间格式错误,请检查后操作",true),
CANNOT_DELETE_PM(170,"无法删除项目经理",true),
LABEL_TOO_LONG(170,"标签长度过长,请不要超过六个字",true),
;

3
util/src/main/java/com/ccsens/util/WebConstant.java

@ -22,6 +22,9 @@ public class WebConstant {
// public static final String REGEX_PHONE = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,1-9]))\\d{8}$";
public static final String REGEX_PHONE = "^[1]([3-9])[0-9]{9}$";
/* 导入WBS ,规定标签长度 */
public static final Integer LABEL_LENGTH = 6;
/**属性名*/
public static class Field{
public static final String CODE = "code";

Loading…
Cancel
Save