update 会议随机码 处理个数
This commit is contained in:
+32
-3
@@ -3,9 +3,9 @@ package com.jero.meeting.service;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.meeting.entity.PayRandomCodeLink;
|
||||
import com.jero.meeting.mapper.PayRandomCodeLinkMapper;
|
||||
import net.sf.saxon.om.Item;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@@ -30,17 +30,26 @@ public class PayRandomCodeService extends ServiceImpl<PayRandomCodeMapper, PayRa
|
||||
private PayRandomCodeLinkMapper randomCodeLinkMapper;
|
||||
|
||||
public void add(PayRandomCode randomCode) {
|
||||
randomCodeMapper.insert(randomCode);
|
||||
LambdaQueryWrapper<PayRandomCode> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PayRandomCode::getMeetingId,randomCode.getMeetingId());
|
||||
wrapper.eq(PayRandomCode::getGuestType,randomCode.getGuestType());
|
||||
Integer integer = randomCodeMapper.selectCount(wrapper);
|
||||
if (integer > 0){
|
||||
throw new JeroBootException("已经有相同嘉宾类型");
|
||||
}
|
||||
|
||||
String randomCodeId = randomCode.getRandomCodeId();
|
||||
List<PayRandomCodeLink> randomCodeLinkList = randomCode.getRandomCodeLinkList();
|
||||
for (PayRandomCodeLink randomCodeLink : randomCodeLinkList) {
|
||||
randomCodeLink.setRandomCodeId(randomCodeId);
|
||||
}
|
||||
randomCode.setRandomCodeCount(randomCodeLinkList.size());
|
||||
randomCodeMapper.insert(randomCode);
|
||||
randomCodeLinkMapper.insertList(randomCodeLinkList);
|
||||
}
|
||||
|
||||
public void editById(PayRandomCode randomCode) {
|
||||
randomCodeMapper.updateById(randomCode);
|
||||
|
||||
String randomCodeId = randomCode.getRandomCodeId();
|
||||
//先删除未使用的
|
||||
LambdaQueryWrapper<PayRandomCodeLink> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -71,6 +80,9 @@ public class PayRandomCodeService extends ServiceImpl<PayRandomCodeMapper, PayRa
|
||||
for (PayRandomCodeLink randomCodeLink : unUseList) {
|
||||
randomCodeLink.setRandomCodeId(randomCodeId);
|
||||
}
|
||||
//更新数量
|
||||
randomCode.setRandomCodeCount(useRandomCodeLinkList.size() + unUseList.size());
|
||||
randomCodeMapper.updateById(randomCode);
|
||||
randomCodeLinkMapper.insertList(unUseList);
|
||||
}
|
||||
|
||||
@@ -102,5 +114,22 @@ public class PayRandomCodeService extends ServiceImpl<PayRandomCodeMapper, PayRa
|
||||
return randomCodeLinkList;
|
||||
}
|
||||
}
|
||||
public Integer validCode(String meetingId, Integer guestType, String randomCode){
|
||||
LambdaQueryWrapper<PayRandomCode> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PayRandomCode::getMeetingId,meetingId);
|
||||
wrapper.eq(PayRandomCode::getGuestType,guestType);
|
||||
PayRandomCode payRandomCode = randomCodeMapper.selectOne(wrapper);
|
||||
|
||||
LambdaQueryWrapper<PayRandomCodeLink> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(PayRandomCodeLink::getRandomCodeId,payRandomCode.getRandomCodeId());
|
||||
wrapper1.eq(PayRandomCodeLink::getUseFlag, CommonConstant.DEL_FLAG_0);
|
||||
wrapper1.eq(PayRandomCodeLink::getRandomCode,randomCode);
|
||||
Integer integer = randomCodeLinkMapper.selectCount(wrapper1);
|
||||
if (integer == 0){
|
||||
throw new JeroBootException("邀请码无效");
|
||||
}else {
|
||||
return guestType;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+30
-15
@@ -51,6 +51,7 @@ import com.jero.meeting.mapper.PayMeetingSituationMapper;
|
||||
import com.jero.meeting.service.IPayMeetingContactsService;
|
||||
import com.jero.meeting.service.IPayMeetingService;
|
||||
import com.jero.meeting.service.IPayMeetingSituationService;
|
||||
import com.jero.meeting.service.PayRandomCodeService;
|
||||
import com.jero.meeting.valid.group.*;
|
||||
import com.jero.meeting.vo.*;
|
||||
import com.jero.meeting.vo.excel.*;
|
||||
@@ -141,6 +142,8 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
|
||||
private IPayMeetingContactsService meetingContactsService;
|
||||
@Resource
|
||||
private IPayWorkingGroupSubItemContactsService workingGroupSubItemContactsService;
|
||||
@Resource
|
||||
private PayRandomCodeService randomCodeService;
|
||||
|
||||
|
||||
private static final String[] CAN_MODIFY_LIST =
|
||||
@@ -315,21 +318,8 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
|
||||
String invitationCode = payMeetingSituation.getInvitationCode();
|
||||
if (meetingType.equals(Integer.parseInt(MeetingCommon.INTERNATIONAL_MEETING)) &&
|
||||
StrUtil.isNotBlank(invitationCode)) {
|
||||
String vipInvitationCode = payMeeting.getVipInvitationCode();
|
||||
String speakerInvitationCode = payMeeting.getSpeakerInvitationCode();
|
||||
String guestInvitationCode = payMeeting.getGuestInvitationCode();
|
||||
String cooperativeInvitationCode = payMeeting.getCooperativeInvitationCode();
|
||||
if (invitationCode.equals(vipInvitationCode)) {
|
||||
payMeetingSituation.setGuestType(MeetingSubitemCommon.VIP);
|
||||
} else if (invitationCode.equals(speakerInvitationCode)) {
|
||||
payMeetingSituation.setGuestType(MeetingSubitemCommon.SPEAKER);
|
||||
} else if (invitationCode.equals(guestInvitationCode)) {
|
||||
payMeetingSituation.setGuestType(MeetingSubitemCommon.GUEST);
|
||||
} else if (invitationCode.equals(cooperativeInvitationCode)) {
|
||||
payMeetingSituation.setGuestType(MeetingSubitemCommon.COOPERATIVE);
|
||||
} else {
|
||||
throw new JeroBootException("邀请码无效");
|
||||
}
|
||||
Integer guestType = validInvitationCode(payMeeting, invitationCode);
|
||||
payMeetingSituation.setGuestType(guestType);
|
||||
payMeetingSituation.setIdentity(MeetingSubitemCommon.JIA_BIN);
|
||||
}
|
||||
//处理校验参会人信息
|
||||
@@ -346,6 +336,31 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
|
||||
&& Objects.equals(payMeetingSituation1.getCheckResult(), MeetingSubitemCommon.SIGNUP_STATUS_1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验国际研讨会邀请码
|
||||
*/
|
||||
private Integer validInvitationCode(PayMeeting payMeeting, String invitationCode) {
|
||||
String meetingId = payMeeting.getId();
|
||||
String vipInvitationCode = payMeeting.getVipInvitationCode();
|
||||
String speakerInvitationCode = payMeeting.getSpeakerInvitationCode();
|
||||
String guestInvitationCode = payMeeting.getGuestInvitationCode();
|
||||
String cooperativeInvitationCode = payMeeting.getCooperativeInvitationCode();
|
||||
String[] split = invitationCode.split("-");
|
||||
String code = split[0];
|
||||
String randomCode = split[1];
|
||||
if (code.equals(vipInvitationCode)) {
|
||||
return randomCodeService.validCode(meetingId, MeetingSubitemCommon.VIP, randomCode);
|
||||
} else if (code.equals(speakerInvitationCode)) {
|
||||
return randomCodeService.validCode(meetingId, MeetingSubitemCommon.SPEAKER, randomCode);
|
||||
} else if (code.equals(guestInvitationCode)) {
|
||||
return randomCodeService.validCode(meetingId, MeetingSubitemCommon.GUEST, randomCode);
|
||||
} else if (code.equals(cooperativeInvitationCode)) {
|
||||
return randomCodeService.validCode(meetingId, MeetingSubitemCommon.COOPERATIVE, randomCode);
|
||||
} else {
|
||||
throw new JeroBootException("邀请码无效");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加参会人或报名时,判断是否发送消息
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user