From 87b0aec13a9cc89a26bba8015ba05cb9909f13ee Mon Sep 17 00:00:00 2001 From: "DESKTOP-G8BCEP0\\HP" <2037158277@qq.com> Date: Wed, 25 Aug 2021 10:16:34 +0800 Subject: [PATCH] =?UTF-8?q?3=E3=80=81=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=85=81=E8=AE=B8=E8=B4=9F=E8=B4=A3?= =?UTF-8?q?=E4=BA=BA=E7=94=B3=E8=AF=B7=E9=A1=B9=E7=9B=AE=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=A8=A1=E5=9D=97=EF=BC=8C=E5=B0=86=E5=85=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=AE=A1=E7=90=86=E5=91=98=E6=8A=8A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=8E=88=E6=9D=83=E7=BB=99=E6=9F=90=E4=B8=AA=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/dao/ProjectOverviewDao.java | 9 ++++++ .../service/ResponsibleProjectService.java | 2 +- .../impl/MemberProjectServiceImpl.java | 5 ++- .../impl/ResponsibleProjectServiceImpl.java | 31 ++++++++++++++----- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/xkrs/dao/ProjectOverviewDao.java b/src/main/java/com/xkrs/dao/ProjectOverviewDao.java index 7d51ee3..16bc13d 100644 --- a/src/main/java/com/xkrs/dao/ProjectOverviewDao.java +++ b/src/main/java/com/xkrs/dao/ProjectOverviewDao.java @@ -22,6 +22,15 @@ public interface ProjectOverviewDao extends JpaRepository, @Modifying(clearAutomatically=true) void updateProjectStatus(String projectStatus,String projectNumber); + /** + * 修改项目的授权状态 + * @param authorizationType + * @param projectNumber + */ + @Query(value = "update project_overview set authorization_type = ?1 where project_number = ?2",nativeQuery = true) + @Modifying(clearAutomatically=true) + void updateAuthorizationType(String authorizationType,String projectNumber); + /** * 根据项目编号查询项目的信息 * @param projectNumber diff --git a/src/main/java/com/xkrs/service/ResponsibleProjectService.java b/src/main/java/com/xkrs/service/ResponsibleProjectService.java index 951c572..6811138 100644 --- a/src/main/java/com/xkrs/service/ResponsibleProjectService.java +++ b/src/main/java/com/xkrs/service/ResponsibleProjectService.java @@ -46,7 +46,7 @@ public interface ResponsibleProjectService { * @param userId * @return */ - void adminAllow(String projectNumber,Integer userId); + String adminAllow(String projectNumber,Integer userId); /** * 管理员对负责人进行拒绝的操作 diff --git a/src/main/java/com/xkrs/service/impl/MemberProjectServiceImpl.java b/src/main/java/com/xkrs/service/impl/MemberProjectServiceImpl.java index ecb491d..46e12a9 100644 --- a/src/main/java/com/xkrs/service/impl/MemberProjectServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/MemberProjectServiceImpl.java @@ -125,6 +125,8 @@ public class MemberProjectServiceImpl implements MemberProjectService { return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"退出成功",locale); } + + // -----------------------------------------------------------------------------------------* /** * 成员被允许加入 @@ -166,9 +168,10 @@ public class MemberProjectServiceImpl implements MemberProjectService { public List selectMemberApplication(String projectNumber) { return memberProjectDao.selectMemberApplication(projectNumber); } - //-----------------------------------------------------------------------------------------* + + /** * 查询加入的成员的信息 * @param projectNumber diff --git a/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java b/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java index ce16981..8f4869d 100644 --- a/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/ResponsibleProjectServiceImpl.java @@ -41,6 +41,9 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService @Resource private WorkHourRecordDao workHourRecordDao; + + + // ---------------------------------------------------------------------------* /** * 负责人点击开始 * @param responsibleProjectNumber @@ -128,16 +131,34 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService ApplicationProjectVo applicationProjectVo = responsibleProjectDao.selectApplicationInformation(projectNumber); return applicationProjectVo; } + // --------------------------------------------------------------------------* + + /** - * 管理员允许负责人申请通过 + * 管理员把项目授权给加入该项目的某个成员 * @param projectNumber * @param userId * @return */ @Transactional(rollbackOn = Exception.class) @Override - public void adminAllow(String projectNumber,Integer userId) { + public String adminAllow(String projectNumber,Integer userId) { + Locale locale = LocaleContextHolder.getLocale(); + ProjectOverview byProjectNumber = projectOverviewDao.findByProjectNumber(projectNumber); + if(byProjectNumber.getAuthorizationType().equals("1")){ + return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"该项目已有负责人",locale); + } + // 负责人点击开始,项目提交申请 + ResponsibleProject responsibleProject1 = new ResponsibleProject(); + responsibleProject1.setPrincipalId(userId); + responsibleProject1.setResponsibleProjectNumber(projectNumber); + responsibleProject1.setApplicationTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); + responsibleProject1.setAuditType("1"); + responsibleProject1.setStartTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); + // 修改项目的授权状态 + projectOverviewDao.updateAuthorizationType("1",projectNumber); + responsibleProjectDao.save(responsibleProject1); WorkHourRecord workHourRecord = new WorkHourRecord(); workHourRecord.setWorkContent("优化"); workHourRecord.setWorkHour(0); @@ -146,11 +167,7 @@ public class ResponsibleProjectServiceImpl implements ResponsibleProjectService workHourRecord.setColor("1"); workHourRecord.setSubmitTime(DateTimeUtil.dateTimeToString(LocalDateTime.now())); workHourRecordDao.save(workHourRecord); - // 修改中间表的申请状态为1(表示审核通过) - responsibleProjectDao.updateAuditType("1",projectNumber); - responsibleProjectDao.updateStartTime(DateTimeUtil.dateTimeToString(LocalDateTime.now()),projectNumber); - // 修改项目表中的项目状态为1(表示填报中) - projectOverviewDao.updateProjectStatus("1",projectNumber); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"授权成功",locale); } /**