Browse Source

修改居民端活动报名人数与后台报名人数不一致问题

feature/screenDataPush
liuchuang 4 years ago
parent
commit
fed6ae325a
  1. 10
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActInfoDao.java
  2. 10
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActInfoService.java
  3. 51
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActInfoServiceImpl.java
  4. 27
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java
  5. 9
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml

10
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/dao/ActInfoDao.java

@ -114,6 +114,16 @@ public interface ActInfoDao extends BaseDao<ActInfoEntity> {
*/
void minusSignUpNum(String actId);
/**
* 活动报名人数+1
*
* @param actId
* @return void
* @author Liuchuang
* @since 2021/8/4 10:31
*/
void addSignUpNum(String actId);
/**
* @describe: 驳回-内容违规检测-待审核信息
* @author wangtong

10
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/ActInfoService.java

@ -200,6 +200,16 @@ public interface ActInfoService extends BaseService<ActInfoEntity> {
*/
void minusSignUpNum(String actId);
/**
* 活动报名人数+1
*
* @param actId
* @return void
* @author Liuchuang
* @since 2021/8/4 10:32
*/
void addSignUpNum(String actId);
/**
* @describe: 驳回-内容违规检测-待审核信息
* @author wangtong

51
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActInfoServiceImpl.java

@ -283,7 +283,7 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
e.printStackTrace();
}
//内容审核 - end
ActInfoEntity entity = ConvertUtils.sourceToTarget(dto, ActInfoEntity.class);
ActInfoEntity entity = this.packageActInfo(dto);
//如果更新了公益时长,则更新相关确认积分的志愿者的公益时长
updateKindnessTime(dto);
updateById(entity);
@ -319,6 +319,48 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
//内容审核 - 结束
return new Result();
}
/**
* 组装活动信息
*
* @param dto
* @return com.elink.esua.epdc.modules.activity.entity.ActInfoEntity
* @author Liuchuang
* @since 2021/8/4 11:17
*/
private ActInfoEntity packageActInfo(ActInfoDTO dto) {
ActInfoEntity entity = new ActInfoEntity();
entity.setId(dto.getId());
entity.setHeadPic(dto.getHeadPic());
entity.setTitle(dto.getTitle());
entity.setRequirement(dto.getRequirement());
entity.setSignupEndTime(dto.getSignupEndTime());
entity.setActQuota(dto.getActQuota());
entity.setActQuotaCategory(dto.getActQuotaCategory());
entity.setActUserDefaultState(dto.getActUserDefaultState());
entity.setActStartTime(dto.getActStartTime());
entity.setActEndTime(dto.getActEndTime());
entity.setKindnessTime(dto.getKindnessTime());
entity.setSigninStartTime(dto.getSigninStartTime());
entity.setSigninEndTime(dto.getSigninEndTime());
entity.setActAddress(dto.getActAddress());
entity.setSigninAddress(dto.getSigninAddress());
entity.setActLatitude(dto.getActLatitude());
entity.setActLongitude(dto.getActLongitude());
entity.setSigninLatitude(dto.getSigninLatitude());
entity.setSigninLongitude(dto.getSigninLongitude());
entity.setClockRadius(dto.getClockRadius());
entity.setContacts(dto.getContacts());
entity.setTel(dto.getTel());
entity.setSponsor(dto.getSponsor());
entity.setPunishmentPoints(dto.getPunishmentPoints());
entity.setReward(dto.getReward());
entity.setActContent(dto.getActContent());
entity.setActNewsContent(dto.getActNewsContent());
return entity;
}
/**
* @Description 更新志愿者公益时长
* @Author songyunpeng
@ -328,7 +370,7 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
**/
private void updateKindnessTime(ActInfoDTO dto) {
ActInfoEntity oldActInfoEntity = selectById(dto.getId());
if(dto.getKindnessTime() == oldActInfoEntity.getKindnessTime()){
if(dto.getKindnessTime().equals(oldActInfoEntity.getKindnessTime())){
return;
}
//查询出所有的此活动下已确认积分的用户列表ID
@ -447,6 +489,11 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
baseDao.minusSignUpNum(actId);
}
@Override
public void addSignUpNum(String actId) {
baseDao.addSignUpNum(actId);
}
@Override
public Result<ActInfoDetailAppResultDTO> getDetailByApp(ActInfoAppFormDTO formDto) {
formDto.setTimestamp(DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));

27
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/java/com/elink/esua/epdc/modules/activity/service/impl/ActUserRelationServiceImpl.java

@ -244,6 +244,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result activitySignUp(ActUserRelationDTO actUserRelationDTO) {
ActInfoDTO actInfoDTO = actInfoDao.queryActSignupNum(actUserRelationDTO.getActId());
//判断报名是否已满
@ -263,15 +264,14 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
} else {
insert(entity);
}
// 活动报名人数+1
actInfoService.addSignUpNum(actUserRelationDTO.getActId());
//存储活动日志表
ActUserLogEntity actUserLog = new ActUserLogEntity();
actUserLog.setActUserRelationId(entity.getId());
actUserLog.setOperationType(ActUserRelationStatusConstant.SIGN_UP);
actUserLog.setOperationTime(new Date());
actUserLogDao.insert(actUserLog);
//更新epdc_act_info的已报名名额
actInfoDTO.setSignupNum(actInfoDTO.getSignupNum() + 1);
actInfoService.update(actInfoDTO);
} else {
return new Result().error("您已报名");
}
@ -279,6 +279,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result activityCancelSignUp(AppActUserCancelsignupDTO appActUserCancelsignupDTO) {
//查询是否已报名
List<String> statusList = new ArrayList<>();
@ -293,6 +294,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
//1、更新活动人员关系表
ActUserRelationEntity entity = ConvertUtils.sourceToTarget(actUserRelationDTO, ActUserRelationEntity.class);
updateById(entity);
// 活动报名人数-1
actInfoService.minusSignUpNum(actUserRelationDTO.getActId());
//2、存储活动日志表
Date currentTime = new Date();
ActUserLogEntity actUserLog = new ActUserLogEntity();
@ -301,12 +304,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
actUserLog.setOperationTime(currentTime);
actUserLog.setFailureReason(appActUserCancelsignupDTO.getFailureReason());
actUserLogDao.insert(actUserLog);
//3、更新epdc_act_info的已报名名额
//ActInfoDTO actInfoDTO = actInfoDao.queryActSignupNum(actUserRelationDTO.getActId());
ActInfoDTO actInfoDTO = actInfoService.get(actUserRelationDTO.getActId());
actInfoDTO.setSignupNum(actInfoDTO.getSignupNum() - 1);
actInfoService.update(actInfoDTO);
//4、判断是否扣除用户积分
ActInfoDTO actInfoDTO = actInfoService.get(actUserRelationDTO.getActId());
if (currentTime.after(actInfoDTO.getSignupEndTime()) && currentTime.before(actInfoDTO.getActStartTime())) {
this.cancelActSubtractPoint(actUserRelationDTO, actInfoDTO);
}
@ -491,6 +490,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result updateAuditDefaultStatus(String actId) {
// 根据actID查询活动开始未审核报名人默认状态
ActInfoDTO actInfoDTO = actInfoService.get(actId);
@ -515,16 +515,13 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
actUserLog.setOperationType(actUserDefaultState);// 默认状态
actUserLog.setOperationTime(new Date());
actUserLogDao.insert(actUserLog);
// 审核不通过,活动的报名人数-1
if (!NumConstant.ONE_STR.equals(actUserDefaultState)) {
actInfoService.minusSignUpNum(actInfoDTO.getId());
}
//给用户发送消息通知
this.sendNotice(actUserRelationDTO, actUserDefaultState, actInfoDTO);
}
// 审核不通过,活动的报名人数减少
if (!NumConstant.ONE_STR.equals(actUserDefaultState)) {
ActInfoEntity actInfoEntity = new ActInfoEntity();
actInfoEntity.setId(actInfoDTO.getId());
actInfoEntity.setSignupNum(actInfoDTO.getSignupNum() - data.size());
actInfoService.updateById(actInfoEntity);
}
} else {
return new Result().ok("该活动暂时没有未审核的志愿者");
}

9
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/src/main/resources/mapper/activity/ActInfoDao.xml

@ -522,8 +522,13 @@
<update id="minusSignUpNum" parameterType="java.lang.String">
update epdc_act_info eai
set eai.SIGNUP_NUM=eai.SIGNUP_NUM-1
where eai.DEL_FLAG='0'
and eai.id=#{actId}
where eai.id=#{actId}
</update>
<update id="addSignUpNum" parameterType="java.lang.String">
update epdc_act_info eai
set eai.SIGNUP_NUM=eai.SIGNUP_NUM+1
where eai.id=#{actId}
</update>
<update id="rejectActInfo">

Loading…
Cancel
Save