将管理员拒绝负责人申请的代码模块修改为管理员撤回授权的功能

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-08-25 10:52:50 +08:00
parent 87b0aec13a
commit 166d34bcd2
3 changed files with 16 additions and 15 deletions

View File

@ -77,4 +77,11 @@ public interface ResponsibleProjectDao extends JpaRepository<ResponsibleProject,
*/ */
@Query(value = "select responsible_project_number from responsible_project where principal_id = ?1 and audit_type = ?2",nativeQuery = true) @Query(value = "select responsible_project_number from responsible_project where principal_id = ?1 and audit_type = ?2",nativeQuery = true)
List<String> selectProjectNumberByPrincipalId(Integer userId,String auditType); List<String> selectProjectNumberByPrincipalId(Integer userId,String auditType);
/**
* 根据项目编号删除信息
* @param projectNumber
*/
@Modifying(clearAutomatically=true)
void deleteByResponsibleProjectNumber(String projectNumber);
} }

View File

@ -53,7 +53,7 @@ public interface ResponsibleProjectService {
* @param projectNumber * @param projectNumber
* @param userId * @param userId
*/ */
void adminRefuse(String projectNumber,Integer userId); String adminRefuse(String projectNumber,Integer userId);
/** /**
* 负责人移除成员 * 负责人移除成员

View File

@ -159,29 +159,23 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService
// 修改项目的授权状态 // 修改项目的授权状态
projectOverviewDao.updateAuthorizationType("1",projectNumber); projectOverviewDao.updateAuthorizationType("1",projectNumber);
responsibleProjectDao.save(responsibleProject1); responsibleProjectDao.save(responsibleProject1);
WorkHourRecord workHourRecord = new WorkHourRecord();
workHourRecord.setWorkContent("优化");
workHourRecord.setWorkHour(0);
workHourRecord.setUserId(userId);
workHourRecord.setProjectNumber(projectNumber);
workHourRecord.setColor("1");
workHourRecord.setSubmitTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()));
workHourRecordDao.save(workHourRecord);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"授权成功",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"授权成功",locale);
} }
/** /**
* 管理员拒绝负责人的申请 * 管理员撤销该项目的授权
* @param projectNumber * @param projectNumber
* @param userId * @param userId
*/ */
@Transactional(rollbackOn = Exception.class) @Transactional(rollbackOn = Exception.class)
@Override @Override
public void adminRefuse(String projectNumber,Integer userId) { public String adminRefuse(String projectNumber,Integer userId) {
// 修改中间表的申请状态为2表示负责人提交的申请被拒绝 Locale locale = LocaleContextHolder.getLocale();
responsibleProjectDao.updateAuditType("2",projectNumber); // 删除负责人表中对应的项目
// 修改项目表中的状态为0表示负责人提交的申请被拒绝项目变成未开始状态 responsibleProjectDao.deleteByResponsibleProjectNumber(projectNumber);
projectOverviewDao.updateProjectStatus("0",projectNumber); // 修改项目表中的授权状态为0表示负责人提交的申请被拒绝项目变成未开始状态
projectOverviewDao.updateAuthorizationType("0",projectNumber);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"撤销授权成功",locale);
} }
/** /**