diff --git a/src/main/java/com/xkrs/dao/ResponsibleProjectDao.java b/src/main/java/com/xkrs/dao/ResponsibleProjectDao.java index 5f593be..3a66f6c 100644 --- a/src/main/java/com/xkrs/dao/ResponsibleProjectDao.java +++ b/src/main/java/com/xkrs/dao/ResponsibleProjectDao.java @@ -77,4 +77,11 @@ public interface ResponsibleProjectDao extends JpaRepository selectProjectNumberByPrincipalId(Integer userId,String auditType); + + /** + * 根据项目编号删除信息 + * @param projectNumber + */ + @Modifying(clearAutomatically=true) + void deleteByResponsibleProjectNumber(String projectNumber); } diff --git a/src/main/java/com/xkrs/service/ResponsibleProjectService.java b/src/main/java/com/xkrs/service/ResponsibleProjectService.java index 6811138..df3180b 100644 --- a/src/main/java/com/xkrs/service/ResponsibleProjectService.java +++ b/src/main/java/com/xkrs/service/ResponsibleProjectService.java @@ -53,7 +53,7 @@ public interface ResponsibleProjectService { * @param projectNumber * @param userId */ - void adminRefuse(String projectNumber,Integer userId); + String adminRefuse(String projectNumber,Integer userId); /** * 负责人移除成员 diff --git a/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java b/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java index 8f4869d..946c06a 100644 --- a/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java @@ -159,29 +159,23 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService // 修改项目的授权状态 projectOverviewDao.updateAuthorizationType("1",projectNumber); 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); } /** - * 管理员拒绝负责人的申请 + * 管理员撤销该项目的授权 * @param projectNumber * @param userId */ @Transactional(rollbackOn = Exception.class) @Override - public void adminRefuse(String projectNumber,Integer userId) { - // 修改中间表的申请状态为2(表示负责人提交的申请被拒绝) - responsibleProjectDao.updateAuditType("2",projectNumber); - // 修改项目表中的状态为0(表示负责人提交的申请被拒绝,项目变成未开始状态) - projectOverviewDao.updateProjectStatus("0",projectNumber); + public String adminRefuse(String projectNumber,Integer userId) { + Locale locale = LocaleContextHolder.getLocale(); + // 删除负责人表中对应的项目 + responsibleProjectDao.deleteByResponsibleProjectNumber(projectNumber); + // 修改项目表中的授权状态为0(表示负责人提交的申请被拒绝,项目变成未开始状态) + projectOverviewDao.updateAuthorizationType("0",projectNumber); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"撤销授权成功",locale); } /**