From 0b26d10d821940a74e2f94ffe1ebfd88a24f6bf7 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.com> Date: Fri, 8 Oct 2021 17:39:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AE=A1=E6=A0=B8=E3=80=81?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E4=B8=8D=E9=80=9A=E8=BF=87=EF=BC=8C=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=AE=B5=E6=8A=A5=E5=90=8D=E4=BA=BA=E6=95=B0?= =?UTF-8?q?=20-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ActUserRelationServiceImpl.java | 25 ++++++++++++++++--- .../resources/mapper/activity/ActInfoDao.xml | 19 ++++++++++---- .../mapper/activity/ActPeriodDao.xml | 1 + 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java index 146ff10f..e1f94bfb 100644 --- a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java @@ -186,6 +186,14 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl signUpPeriodsByActId = actPeriodService.listOfActPeriodsByActId(entity.getActId()); + List periodIds = new ArrayList<>(); + for (ActPeriodDTO period : signUpPeriodsByActId) { + periodIds.add(period.getId()); + } + // 取消报名的所有活动时间段,活动报名人数 -1 + actPeriodService.minusPeriodSignUpNum(periodIds); + // 如果活动开始未审核报名人默认状态(1-审核通过,4-审核不通过)是 4,则将 epdc_act_period 表中的,所有活动时间段状态 更改为 4 ActPeriodUserDTO periodUserDTO = new ActPeriodUserDTO(); periodUserDTO.setPeriodStatus(ActStateConstant.ACT_USER_RELATION_STATUS_AUDITREJECT); @@ -348,6 +356,9 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl periodTime = actPeriodUserService.listOfSignInActPeriodsByActUserRelationId(actUserRelationEntity.getId()); if (null == periodTime) { @@ -382,9 +393,6 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl signUpPeriodsByActId = actPeriodService.listOfActPeriodsByActId(actInfoDTO.getId()); + List periodIds = new ArrayList<>(); + for (ActPeriodDTO dto : signUpPeriodsByActId) { + periodIds.add(dto.getId()); + } + // 取消报名的所有活动时间段,活动报名人数 -1 + actPeriodService.minusPeriodSignUpNum(periodIds); + // 如果活动开始未审核报名人默认状态(1-审核通过,4-审核不通过)是 4,则将 epdc_act_period 表中的,所有活动时间段状态 更改为 4 ActPeriodUserDTO periodUserDTO = new ActPeriodUserDTO(); periodUserDTO.setPeriodStatus(actUserDefaultState); diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml index 4137de45..c8f0ab66 100644 --- a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml @@ -161,7 +161,8 @@ DATE_FORMAT(actInfo.ACT_START_TIME,'%Y-%m-%d %H:%i') ACT_START_TIME, DATE_FORMAT(actInfo.ACT_END_TIME,'%Y-%m-%d %H:%i') ACT_END_TIME, actInfo.PUBLISH_TIME,actInfo.ACT_ADDRESS, actInfo.ACT_QUOTA_CATEGORY, actInfo.ACT_QUOTA, - actInfo.SIGNUP_NUM, actInfo.CLOCK_NUM, + IF(actInfo.ACT_PERIOD_SIGNUP_NUM = 0, actInfo.SIGNUP_NUM, actInfo.ACT_PERIOD_SIGNUP_NUM) SIGNUP_NUM, + actInfo.CLOCK_NUM, case when = ]]> #{timestamp} then case @@ -182,7 +183,7 @@ ( SELECT i.ID, i.TITLE, i.HEAD_PIC, i.ACT_START_TIME, i.ACT_END_TIME, i.PUBLISH_TIME, i.ACT_ADDRESS, i.ACT_QUOTA, i.CLOCK_NUM, i.SIGNUP_END_TIME, i.CREATED_TIME, i.ACT_QUOTA_CATEGORY, - i.TOP_FLAG, i.DEL_FLAG, i.ACT_STATUS, i.SPONSOR, IFNULL(SUM(p.ACT_PERIOD_SIGNUP_NUM), 0) SIGNUP_NUM + i.TOP_FLAG, i.DEL_FLAG, i.ACT_STATUS, i.SPONSOR, IFNULL(SUM(p.ACT_PERIOD_SIGNUP_NUM), 0) ACT_PERIOD_SIGNUP_NUM, i.SIGNUP_NUM FROM epdc_act_info i LEFT JOIN epdc_act_period p ON i.ID = p.ACT_ID AND p.DEL_FLAG = '0' @@ -221,7 +222,7 @@ actInfo.ACT_ADDRESS, actInfo.ACT_QUOTA_CATEGORY, actInfo.ACT_QUOTA, - actInfo.SIGNUP_NUM, + IF(actInfo.ACT_PERIOD_SIGNUP_NUM = 0, actInfo.SIGNUP_NUM, actInfo.ACT_PERIOD_SIGNUP_NUM) SIGNUP_NUM, actInfo.CLOCK_NUM, case when actInfo.ACT_STATUS = '0' @@ -246,7 +247,15 @@ relation.ID as actUserId, actInfo.TOP_FLAG FROM - epdc_act_info actInfo + ( + SELECT i.ID, i.TITLE, i.HEAD_PIC, i.ACT_START_TIME, i.ACT_END_TIME, i.PUBLISH_TIME, i.ACT_ADDRESS, + i.ACT_QUOTA, i.CLOCK_NUM, i.SIGNUP_END_TIME, i.CREATED_TIME, i.ACT_QUOTA_CATEGORY, + i.TOP_FLAG, i.DEL_FLAG, i.ACT_STATUS, i.SPONSOR, IFNULL(SUM(p.ACT_PERIOD_SIGNUP_NUM), 0) ACT_PERIOD_SIGNUP_NUM, i.SIGNUP_NUM + FROM + epdc_act_info i + LEFT JOIN epdc_act_period p ON i.ID = p.ACT_ID AND p.DEL_FLAG = '0' + GROUP BY i.ID + ) actInfo left join epdc_act_user_relation relation on relation.DEL_FLAG = '0' and relation.USER_ID = #{userId} and relation.STATUS != '3' @@ -509,7 +518,7 @@ eai.ACT_ADDRESS as actAddress, eai.ACT_QUOTA_CATEGORY as actQuotaCategory, eai.ACT_QUOTA as actQuota, - IFNULL(SUM(p.ACT_PERIOD_SIGNUP_NUM), 0) signupNum, + IF(IFNULL(SUM(p.ACT_PERIOD_SIGNUP_NUM), 0) = 0, eai.SIGNUP_NUM, IFNULL(SUM(p.ACT_PERIOD_SIGNUP_NUM), 0)) signupNum, eai.REWARD, eai.PUNISHMENT_POINTS as punishmentPoints, eai.REQUIREMENT as requirement, diff --git a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActPeriodDao.xml b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActPeriodDao.xml index ad5dee2b..7cd13583 100644 --- a/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActPeriodDao.xml +++ b/esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActPeriodDao.xml @@ -76,6 +76,7 @@ update epdc_act_period set ACT_PERIOD_SIGNUP_NUM = ACT_PERIOD_SIGNUP_NUM - 1 where DEL_FLAG = '0' + 0 ]]> and ID in #{periodId}