From 166d34bcd2744772c62f8828527dc5999ae7be65 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G8BCEP0\\HP" <2037158277@qq.com> Date: Wed, 25 Aug 2021 10:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E7=AE=A1=E7=90=86=E5=91=98=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E8=B4=9F=E8=B4=A3=E4=BA=BA=E7=94=B3=E8=AF=B7=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A8=A1=E5=9D=97=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=92=A4=E5=9B=9E=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/dao/ResponsibleProjectDao.java | 7 ++++++ .../service/ResponsibleProjectService.java | 2 +- .../impl/ResponsibleProjectServiceImpl.java | 22 +++++++------------ 3 files changed, 16 insertions(+), 15 deletions(-) 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); } /**