修改原来的负责人对项目进行开始,重新开始结束的操作,修改为管理员对项目进行开始,结束的操作(1开始 2结束)

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-08-25 15:23:30 +08:00
parent f4195efe59
commit f32bb0a15e
3 changed files with 10 additions and 140 deletions

View File

@ -40,48 +40,25 @@ public class ResponsibleProjectController {
private MemberProjectService memberProjectService; private MemberProjectService memberProjectService;
/** /**
* 负责人对项目进行开始重新开始结束的操作 * 管理员对项目进行开始结束的操作
* @param map * @param map
* @param token * @param token
* @return * @return
*/ */
@PostMapping("/operateResponsible") @PostMapping("/operateResponsible")
@PreAuthorize("hasAnyAuthority('auth_administor','auth_general_user')") @PreAuthorize("hasAnyAuthority('auth_administor')")
public String operateResponsible(@RequestBody Map map,@RequestHeader(value="Authorization") String token){ public String operateResponsible(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
String projectNumber = (String) map.get("projectNumber"); String projectNumber = (String) map.get("projectNumber");
String keepType = (String) map.get("keepType"); String keepType = (String) map.get("keepType");
if("1".equals(keepType)){ if("1".equals(keepType)){
return responsibleProjectService.operateResponsible(projectNumber,token); return responsibleProjectService.operateResponsible(projectNumber,token);
}else if("2".equals(keepType)){
return responsibleProjectService.operateReStart(projectNumber,token);
}else { }else {
return responsibleProjectService.operateOver(projectNumber,token); return responsibleProjectService.operateOver(projectNumber,token);
} }
} }
/** /**
* 查看负责人申请该项目的信息 * 管理员对负责人的进行授权和撤销授权的操作
* @param projectNumber
* @param token
* @return
*/
@PreAuthorize("hasAnyAuthority('auth_administor')")
@GetMapping("/selectApplicationInformation")
public String selectApplicationInformation(@RequestParam("projectNumber") String projectNumber,@RequestHeader(value="Authorization") String token){
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证token
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserByUserName = sysUserService.getSysUserByUserName(tokenUserName);
if(sysUserByUserName == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
}
ApplicationProjectVo applicationProjectVo = responsibleProjectService.selectApplicationInformation(projectNumber);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,applicationProjectVo,locale);
}
/**
* 管理员对负责人的申请进行允许和拒绝的操作
* @param map * @param map
* @param token * @param token
* @return * @return
@ -100,52 +77,10 @@ public class ResponsibleProjectController {
if(sysUserByUserName == null){ if(sysUserByUserName == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale); return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
} }
ResponsibleProject byResponsibleProjectNumber = responsibleProjectDao.findByResponsibleProjectNumber(projectNumber);
if("1".equals(keepType)){ if("1".equals(keepType)){
if("1".equals(byResponsibleProjectNumber.getAuditType())){ return responsibleProjectService.adminAllow(projectNumber,userId);
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"已经执行过该操作,请勿重复工作",locale);
}
responsibleProjectService.adminAllow(projectNumber,userId);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"已允许该申请通过",locale);
}else { }else {
if("2".equals(byResponsibleProjectNumber.getAuditType())){ return responsibleProjectService.adminRefuse(projectNumber,userId);
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"已经执行过该操作,请勿重复工作",locale);
}
responsibleProjectService.adminRefuse(projectNumber,userId);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"已拒绝该申请",locale);
}
}
/**
* 负责人移除成员和移交权限的操作
* @param map
* @param token
* @return
*/
@PostMapping("/removeOrTransferMember")
@PreAuthorize("hasAnyAuthority('auth_administor','auth_general_user')")
public String removeOrTransferMember(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
Integer memberId = (Integer) map.get("memberId");
String projectNumber = (String) map.get("projectNumber");
String keepType = (String) map.get("keepType");
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证token
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserByUserName = sysUserService.getSysUserByUserName(tokenUserName);
if(sysUserByUserName == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
}
ResponsibleProject projectNumber1 = responsibleProjectDao.findByPrincipalIdAndResponsibleProjectNumber(sysUserByUserName.getId(), projectNumber);
if(projectNumber1 == null){
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"您不是负责人,不能执行该操作",locale);
}
if("1".equals(keepType)){
responsibleProjectService.removeMember(memberId,projectNumber);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"移除成功",locale);
}else {
responsibleProjectService.transferPermissions(memberId,projectNumber,sysUserByUserName.getId());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"移交成功",locale);
} }
} }
@ -169,9 +104,6 @@ public class ResponsibleProjectController {
// 查询管理的项目的编号 // 查询管理的项目的编号
List<String> strings = responsibleProjectService.selectProjectNumberByPrincipalId(sysUserByUserName.getId()); List<String> strings = responsibleProjectService.selectProjectNumberByPrincipalId(sysUserByUserName.getId());
map.put("manage",strings); map.put("manage",strings);
// 查询正在审核的项目的编号
List<String> strings1 = memberProjectService.selectProjectNumberByMemberIds(sysUserByUserName.getId());
map.put("audit",strings1);
// 查询参与的项目的编号 // 查询参与的项目的编号
List<String> strings2 = memberProjectService.selectProjectNumberByMemberId(sysUserByUserName.getId()); List<String> strings2 = memberProjectService.selectProjectNumberByMemberId(sysUserByUserName.getId());
map.put("participate",strings2); map.put("participate",strings2);

View File

@ -17,14 +17,6 @@ public interface ResponsibleProjectService {
*/ */
String operateResponsible(String responsibleProjectNumber,String token); String operateResponsible(String responsibleProjectNumber,String token);
/**
* 负责人对项目进行重新开始的操作
* @param ProjectNumber
* @param token
* @return
*/
String operateReStart(String ProjectNumber,String token);
/** /**
* 负责人对项目进行结束的操作 * 负责人对项目进行结束的操作
* @param ProjectNumber * @param ProjectNumber
@ -33,13 +25,6 @@ public interface ResponsibleProjectService {
*/ */
String operateOver(String ProjectNumber,String token); String operateOver(String ProjectNumber,String token);
/**
* 查询负责人申请的信息
* @param projectNumber
* @return
*/
ApplicationProjectVo selectApplicationInformation(String projectNumber);
/** /**
* 管理员对负责人进行允许的操作 * 管理员对负责人进行允许的操作
* @param projectNumber * @param projectNumber

View File

@ -42,10 +42,8 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService
@Resource @Resource
private WorkHourRecordDao workHourRecordDao; private WorkHourRecordDao workHourRecordDao;
// ---------------------------------------------------------------------------*
/** /**
* 负责人点击开始 * 管理员点击开始
* @param responsibleProjectNumber * @param responsibleProjectNumber
* @param token * @param token
* @return * @return
@ -62,46 +60,16 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale); return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
} }
ProjectOverview byProjectNumber = projectOverviewDao.findByProjectNumber(responsibleProjectNumber); ProjectOverview byProjectNumber = projectOverviewDao.findByProjectNumber(responsibleProjectNumber);
if("3".equals(byProjectNumber.getProjectStatus())){
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"该项目正在审核",locale);
}
if(!"0".equals(byProjectNumber.getProjectStatus())){ if(!"0".equals(byProjectNumber.getProjectStatus())){
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"该项目正在执行中",locale); return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"该项目正在执行中",locale);
} }
// 负责人点击开始项目提交申请 // 填报中
ResponsibleProject responsibleProject1 = new ResponsibleProject(); projectOverviewDao.updateProjectStatus("1",responsibleProjectNumber);
responsibleProject1.setPrincipalId(sysUserEntity.getId());
responsibleProject1.setResponsibleProjectNumber(responsibleProjectNumber);
responsibleProject1.setApplicationTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
responsibleProject1.setAuditType("0");
projectOverviewDao.updateProjectStatus("3",responsibleProjectNumber);
responsibleProjectDao.save(responsibleProject1);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功",locale);
} }
/** /**
* 负责人对项目进行重新开始的操作 * 管理员对项目进行结束的操作
* @param ProjectNumber
* @param token
* @return
*/
@Transactional(rollbackOn = Exception.class)
@Override
public String operateReStart(String ProjectNumber, String token) {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证token
String tokenUserName = TokenUtil.getTokenUserName(token);
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
if(sysUserEntity == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
}
projectOverviewDao.updateProjectStatus("1",ProjectNumber);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功",locale);
}
/**
* 负责人对项目进行结束的操作
* @param ProjectNumber * @param ProjectNumber
* @param token * @param token
* @return * @return
@ -117,25 +85,10 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService
if(sysUserEntity == null){ if(sysUserEntity == null){
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale); return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
} }
projectOverviewDao.updateProjectStatus("2",ProjectNumber); projectOverviewDao.updateProjectStatus("0",ProjectNumber);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"操作成功",locale);
} }
/**
* 查询负责人申请的相关信息
* @param projectNumber
* @return
*/
@Override
public ApplicationProjectVo selectApplicationInformation(String projectNumber) {
ApplicationProjectVo applicationProjectVo = responsibleProjectDao.selectApplicationInformation(projectNumber);
return applicationProjectVo;
}
// --------------------------------------------------------------------------*
/** /**
* 管理员把项目授权给加入该项目的某个成员 * 管理员把项目授权给加入该项目的某个成员
* @param projectNumber * @param projectNumber