update 合并开票时的校验
This commit is contained in:
+2
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.ValidUtil;
|
||||
import com.jero.meeting.common.MeetingSubitemCommon;
|
||||
import com.jero.meeting.entity.PayMeetingSituation;
|
||||
import com.jero.meeting.service.IPayMeetingSituationService;
|
||||
@@ -189,6 +190,7 @@ public class PayMeetingSituationController extends JeroController<PayMeetingSitu
|
||||
@ApiOperation(value="合并开票", notes="合并开票")
|
||||
@PostMapping(value = "/batchPayBill")
|
||||
public Result<?> mergePayBill(@RequestBody MergePayBillVO mergePayBillVO) {
|
||||
ValidUtil.validate(mergePayBillVO);
|
||||
payMeetingSituationService.mergePayBill(mergePayBillVO);
|
||||
return Result.OK("合并开票成功!");
|
||||
}
|
||||
|
||||
+397
-391
@@ -35,446 +35,452 @@ import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Description: 会议报名信息
|
||||
* @Author: jero-boot
|
||||
* @Date: 2021-09-07
|
||||
* @Date: 2021-09-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituationMapper, PayMeetingSituation> implements IPayMeetingSituationService {
|
||||
@Resource
|
||||
private IPayCompanyManagementService companyManagementService;
|
||||
@Resource
|
||||
private IPayContactsManagementService contactsManagementService;
|
||||
@Resource
|
||||
private IPayCompanyManagementTemporaryService companyManagementTemporaryService;
|
||||
@Resource
|
||||
private IPayContactsManagementTemporaryService contactsManagementTemporaryService;
|
||||
@Resource
|
||||
private IPayMeetingService meetingService;
|
||||
@Resource
|
||||
private IMemberInfoService memberInfoService;
|
||||
@Resource
|
||||
private ISysBaseAPI iSysBaseApi;
|
||||
@Resource
|
||||
private IPayMailBillService payMailBillService;
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
@Resource
|
||||
private IPayCompanyManagementService companyManagementService;
|
||||
@Resource
|
||||
private IPayContactsManagementService contactsManagementService;
|
||||
@Resource
|
||||
private IPayCompanyManagementTemporaryService companyManagementTemporaryService;
|
||||
@Resource
|
||||
private IPayContactsManagementTemporaryService contactsManagementTemporaryService;
|
||||
@Resource
|
||||
private IPayMeetingService meetingService;
|
||||
@Resource
|
||||
private IMemberInfoService memberInfoService;
|
||||
@Resource
|
||||
private ISysBaseAPI iSysBaseApi;
|
||||
@Resource
|
||||
private IPayMailBillService payMailBillService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
public void add(PayMeetingSituation payMeetingSituation) {
|
||||
payMeetingSituation.setStatus(MeetingSubitemCommon.STATUS_3);
|
||||
payMeetingSituation.setNeedInvoice(PayProjectCommon.NO);
|
||||
payMeetingSituation.setAmountReceivable(new BigDecimal("0"));
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
payMeetingSituation.setStatus(MeetingSubitemCommon.STATUS_3);
|
||||
payMeetingSituation.setNeedInvoice(PayProjectCommon.NO);
|
||||
payMeetingSituation.setAmountReceivable(new BigDecimal("0"));
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
|
||||
saveMeetingSituation(payMeetingSituation1);
|
||||
}
|
||||
saveMeetingSituation(payMeetingSituation1);
|
||||
}
|
||||
|
||||
private void saveMeetingSituation(PayMeetingSituation payMeetingSituation1) {
|
||||
payMeetingSituation1.setCheckIn(PayProjectCommon.NO);
|
||||
payMeetingSituation1.setCheckResult(MeetingSubitemCommon.SIGNUP_STATUS_0);
|
||||
payMeetingSituation1.setPaidAmount(new BigDecimal("0"));
|
||||
private void saveMeetingSituation(PayMeetingSituation payMeetingSituation1) {
|
||||
payMeetingSituation1.setCheckIn(PayProjectCommon.NO);
|
||||
payMeetingSituation1.setCheckResult(MeetingSubitemCommon.SIGNUP_STATUS_0);
|
||||
payMeetingSituation1.setPaidAmount(new BigDecimal("0"));
|
||||
|
||||
//到账
|
||||
payMeetingSituation1.setInAccount(PayProjectCommon.IN_ACCOUNT0);
|
||||
//开票
|
||||
payMeetingSituation1.setMakeInvoice(PayProjectCommon.MAKE_INVOICE0);
|
||||
//邮寄
|
||||
payMeetingSituation1.setMail(PayProjectCommon.MAIL0);
|
||||
save(payMeetingSituation1);
|
||||
}
|
||||
//到账
|
||||
payMeetingSituation1.setInAccount(PayProjectCommon.IN_ACCOUNT0);
|
||||
//开票
|
||||
payMeetingSituation1.setMakeInvoice(PayProjectCommon.MAKE_INVOICE0);
|
||||
//邮寄
|
||||
payMeetingSituation1.setMail(PayProjectCommon.MAIL0);
|
||||
save(payMeetingSituation1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报名
|
||||
* @param payMeetingSituation
|
||||
*/
|
||||
@Override
|
||||
public void signUp(PayMeetingSituation payMeetingSituation) {
|
||||
payMeetingSituation.setStatus(MeetingSubitemCommon.STATUS_1);
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
//会议类型
|
||||
Integer meetingType = payMeeting.getMeetingType();
|
||||
//如果是国际研讨会会议并且邀请码不为空就进行比对嘉宾身份
|
||||
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("邀请码无效");
|
||||
}
|
||||
payMeetingSituation.setIdentity(MeetingSubitemCommon.JIA_BIN);
|
||||
}
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
saveMeetingSituation(payMeetingSituation1);
|
||||
}
|
||||
/**
|
||||
* 报名
|
||||
*
|
||||
* @param payMeetingSituation
|
||||
*/
|
||||
@Override
|
||||
public void signUp(PayMeetingSituation payMeetingSituation) {
|
||||
payMeetingSituation.setStatus(MeetingSubitemCommon.STATUS_1);
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
//会议类型
|
||||
Integer meetingType = payMeeting.getMeetingType();
|
||||
//如果是国际研讨会会议并且邀请码不为空就进行比对嘉宾身份
|
||||
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("邀请码无效");
|
||||
}
|
||||
payMeetingSituation.setIdentity(MeetingSubitemCommon.JIA_BIN);
|
||||
}
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
saveMeetingSituation(payMeetingSituation1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
* @param checkVO
|
||||
*/
|
||||
@Override
|
||||
public void check(CheckVO checkVO) {
|
||||
String id = checkVO.getId();
|
||||
PayMeetingSituation meetingSituation = getById(id);
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param checkVO
|
||||
*/
|
||||
@Override
|
||||
public void check(CheckVO checkVO) {
|
||||
String id = checkVO.getId();
|
||||
PayMeetingSituation meetingSituation = getById(id);
|
||||
|
||||
Integer checkResult = checkVO.getCheckResult();
|
||||
if (checkResult.equals(MeetingSubitemCommon.SIGNUP_STATUS_2)){
|
||||
//TODO 提示信息
|
||||
}
|
||||
meetingSituation.setCheckResult(checkResult);
|
||||
saveOrUpdate(meetingSituation);
|
||||
}
|
||||
Integer checkResult = checkVO.getCheckResult();
|
||||
if (checkResult.equals(MeetingSubitemCommon.SIGNUP_STATUS_2)) {
|
||||
//TODO 提示信息
|
||||
}
|
||||
meetingSituation.setCheckResult(checkResult);
|
||||
saveOrUpdate(meetingSituation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mergePayBill(MergePayBillVO mergePayBillVO) {
|
||||
List<String> meetingSituationIds = mergePayBillVO.getMeetingSituationIds();
|
||||
List<PayMeetingSituation> payMeetingSituations = listByIds(meetingSituationIds);
|
||||
if (payMeetingSituations.isEmpty()){
|
||||
throw new JeroBootException("未选择参会人");
|
||||
}
|
||||
//判断所选参会人是否符合条件
|
||||
PayMeetingSituation payMeetingSituation = payMeetingSituations.get(0);
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
StringBuilder projectIds = new StringBuilder();
|
||||
BigDecimal allAmount = new BigDecimal("0");
|
||||
for (int i = 0; i < payMeetingSituations.size(); i++) {
|
||||
PayMeetingSituation payMeetingSituation1 = payMeetingSituations.get(i);
|
||||
BigDecimal amountReceivable = payMeetingSituation1.getAmountReceivable();
|
||||
if (!payMeetingSituation1.getMeetingId().equals(meetingId)) {
|
||||
throw new JeroBootException("合并开票只能是同一会议");
|
||||
}
|
||||
if (!payMeetingSituation1.getCompanyId().equals(payMeetingSituation.getCompanyId())) {
|
||||
throw new JeroBootException("合并开票只能是同一企业");
|
||||
}
|
||||
if (amountReceivable.equals(new BigDecimal("0"))) {
|
||||
throw new JeroBootException("应收金额为0,不能合并开票");
|
||||
}
|
||||
if (payMeetingSituation1.getPayMode().equals(MeetingSubitemCommon.PAY_MODE_PACK)) {
|
||||
throw new JeroBootException("缴费方式为打包,不能合并开票");
|
||||
}
|
||||
if (payMeetingSituation1.getNeedInvoice().equals(PayProjectCommon.NO)) {
|
||||
throw new JeroBootException("不需要发票,不能合并开票");
|
||||
}
|
||||
if (!payMeetingSituation1.getMakeInvoice().equals(PayProjectCommon.NO)) {
|
||||
throw new JeroBootException("已经开票的,不能合并开票");
|
||||
}
|
||||
allAmount = amountReceivable.add(allAmount);
|
||||
projectIds.append(payMeetingSituation1.getId());
|
||||
//如果不是最后一次,就拼接","
|
||||
if (i != payMeetingSituations.size() - 1) {
|
||||
projectIds.append(",");
|
||||
}
|
||||
}
|
||||
//查询邮寄联系人
|
||||
String postContactId = mergePayBillVO.getPostContactId();
|
||||
String postContactAddress = mergePayBillVO.getPostContactAddress();
|
||||
PayContactsManagement contactsManagement = contactsManagementService.getById(postContactId);
|
||||
String postContactName = contactsManagement.getName();
|
||||
//更新参会人信息的邮寄联系人
|
||||
for (PayMeetingSituation meetingSituation : payMeetingSituations) {
|
||||
meetingSituation.setPostContactId(postContactId);
|
||||
meetingSituation.setPostContactName(postContactName);
|
||||
meetingSituation.setPostContactAddress(postContactAddress);
|
||||
saveOrUpdate(meetingSituation);
|
||||
}
|
||||
//删除最后一位","
|
||||
//projectIds.deleteCharAt(projectIds.length()-1);
|
||||
@Override
|
||||
public void mergePayBill(MergePayBillVO mergePayBillVO) {
|
||||
List<String> meetingSituationIds = mergePayBillVO.getMeetingSituationIds();
|
||||
List<PayMeetingSituation> payMeetingSituations = listByIds(meetingSituationIds);
|
||||
if (payMeetingSituations.isEmpty()) {
|
||||
throw new JeroBootException("未选择参会人");
|
||||
}
|
||||
//判断所选参会人是否符合条件
|
||||
PayMeetingSituation payMeetingSituation = payMeetingSituations.get(0);
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
StringBuilder projectIds = new StringBuilder();
|
||||
BigDecimal allAmount = new BigDecimal("0");
|
||||
for (int i = 0; i < payMeetingSituations.size(); i++) {
|
||||
PayMeetingSituation payMeetingSituation1 = payMeetingSituations.get(i);
|
||||
BigDecimal amountReceivable = payMeetingSituation1.getAmountReceivable();
|
||||
if (!payMeetingSituation1.getMeetingId().equals(meetingId)) {
|
||||
throw new JeroBootException("合并开票只能是同一会议");
|
||||
}
|
||||
if (!payMeetingSituation1.getCompanyId().equals(payMeetingSituation.getCompanyId())) {
|
||||
throw new JeroBootException("合并开票只能是同一企业");
|
||||
}
|
||||
if (amountReceivable.equals(new BigDecimal("0"))) {
|
||||
throw new JeroBootException("应收金额为0,不能合并开票");
|
||||
}
|
||||
if (payMeetingSituation1.getPayMode().equals(MeetingSubitemCommon.PAY_MODE_PACK)) {
|
||||
throw new JeroBootException("缴费方式为打包,不能合并开票");
|
||||
}
|
||||
if (payMeetingSituation1.getNeedInvoice().equals(PayProjectCommon.NO)) {
|
||||
throw new JeroBootException("不需要发票,不能合并开票");
|
||||
}
|
||||
if (!payMeetingSituation1.getMakeInvoice().equals(PayProjectCommon.NO)) {
|
||||
throw new JeroBootException("已经开票的,不能合并开票");
|
||||
}
|
||||
allAmount = amountReceivable.add(allAmount);
|
||||
projectIds.append(payMeetingSituation1.getId());
|
||||
//如果不是最后一次,就拼接","
|
||||
if (i != payMeetingSituations.size() - 1) {
|
||||
projectIds.append(",");
|
||||
}
|
||||
}
|
||||
//查询邮寄联系人
|
||||
String postContactId = mergePayBillVO.getPostContactId();
|
||||
PayContactsManagement contactsManagement = contactsManagementService.getById(postContactId);
|
||||
String postContactAddress1 = mergePayBillVO.getPostContactAddress();
|
||||
String postContactAddress = StrUtil.isNotBlank(postContactAddress1) ? postContactAddress1 : contactsManagement.getContactAddress();
|
||||
String postContactName = contactsManagement.getName();
|
||||
//更新参会人信息的邮寄联系人
|
||||
for (PayMeetingSituation meetingSituation : payMeetingSituations) {
|
||||
meetingSituation.setPostContactId(postContactId);
|
||||
meetingSituation.setPostContactName(postContactName);
|
||||
meetingSituation.setPostContactAddress(postContactAddress);
|
||||
saveOrUpdate(meetingSituation);
|
||||
}
|
||||
//删除最后一位","
|
||||
//projectIds.deleteCharAt(projectIds.length()-1);
|
||||
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
PayMailBill payMailBill = new PayMailBill();
|
||||
payMailBill.setBillNo(mergePayBillVO.getBillNo());
|
||||
payMailBill.setInvoiceAmount(allAmount);
|
||||
payMailBill.setBillDate(new Date());
|
||||
payMailBill.setProjectName(payMeeting.getMeetingName());
|
||||
payMailBill.setChargeCompanyName(payMeetingSituation.getCompanyName());
|
||||
payMailBillService.addPayBill(payMailBill,projectIds.toString(), PayIncomeContractCommon.PROJECT_TYPE3);
|
||||
}
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
PayMailBill payMailBill = new PayMailBill();
|
||||
payMailBill.setBillNo(mergePayBillVO.getBillNo());
|
||||
payMailBill.setInvoiceAmount(allAmount);
|
||||
payMailBill.setBillDate(new Date());
|
||||
payMailBill.setProjectName(payMeeting.getMeetingName());
|
||||
payMailBill.setChargeCompanyName(payMeetingSituation.getCompanyName());
|
||||
payMailBillService.addPayBill(payMailBill, projectIds.toString(), PayIncomeContractCommon.PROJECT_TYPE3);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(PayMeetingSituationVO payMeetingSituationVO) {
|
||||
String id = payMeetingSituationVO.getId();
|
||||
PayMeetingSituation payMeetingSituation = getById(id);
|
||||
if (ObjectUtil.isNull(payMeetingSituation)){
|
||||
throw new JeroBootException("参会人错误!");
|
||||
}
|
||||
BeanUtils.copyProperties(payMeetingSituationVO,payMeetingSituation);
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(PayMeetingSituationVO payMeetingSituationVO) {
|
||||
String id = payMeetingSituationVO.getId();
|
||||
PayMeetingSituation payMeetingSituation = getById(id);
|
||||
if (ObjectUtil.isNull(payMeetingSituation)) {
|
||||
throw new JeroBootException("参会人错误!");
|
||||
}
|
||||
BeanUtils.copyProperties(payMeetingSituationVO, payMeetingSituation);
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
|
||||
saveOrUpdate(payMeetingSituation1);
|
||||
}
|
||||
saveOrUpdate(payMeetingSituation1);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PayMeetingSituation getPayMeetingSituation(PayMeetingSituation payMeetingSituation) {
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
//会议类型
|
||||
Integer meetingType = payMeeting.getMeetingType();
|
||||
//要保存的对象
|
||||
PayMeetingSituation payMeetingSituation1 = new PayMeetingSituation();
|
||||
payMeetingSituation1.setAmountReceivable(new BigDecimal("0"));
|
||||
//会议校验基础类
|
||||
MeetingEntity meetingEntity = new MeetingEntity();
|
||||
BeanUtils.copyProperties(payMeetingSituation, meetingEntity);
|
||||
//校验公共属性
|
||||
ValidUtil.validate(meetingEntity);
|
||||
BeanUtils.copyProperties(meetingEntity, payMeetingSituation1);
|
||||
//校验企业
|
||||
String companyId = meetingEntity.getCompanyId();
|
||||
PayCompanyManagement companyManagement = companyManagementService.getById(companyId);
|
||||
//处理企业
|
||||
canHuiRenCompany(payMeetingSituation1, companyManagement);
|
||||
//校验企业联系人
|
||||
String companyContactId = meetingEntity.getCompanyContactId();
|
||||
PayContactsManagement contactsManagement = contactsManagementService.getById(companyContactId);
|
||||
//处理联系人
|
||||
canHuiContact(payMeetingSituation1, companyId, contactsManagement);
|
||||
//存入打包字段
|
||||
payMeetingSituation1.setPack(PayProjectCommon.PACKAGING0);
|
||||
payMeetingSituation1.setNeedInvoice(PayProjectCommon.NO);
|
||||
//判断身份
|
||||
Integer identity = payMeetingSituation.getIdentity();
|
||||
//国际研讨会会议的嘉宾和其他类型不同
|
||||
if (meetingType.equals(Integer.parseInt(MeetingCommon.INTERNATIONAL_MEETING)) &&
|
||||
identity.equals(MeetingSubitemCommon.JIA_BIN)) {
|
||||
//获取嘉宾类型
|
||||
Integer guestType = payMeetingSituation.getGuestType();
|
||||
if (ObjectUtil.isNull(guestType)){
|
||||
throw new JeroBootException("嘉宾类型不能为空");
|
||||
}
|
||||
InternationalGuestVO internationalGuestVO = new InternationalGuestVO();
|
||||
BeanUtils.copyProperties(payMeetingSituation, internationalGuestVO);
|
||||
//合作伙伴嘉宾只有最基础的参数所以不需要校验,只需要校验VIP,演讲嘉宾,特邀嘉宾
|
||||
if (!guestType.equals(MeetingSubitemCommon.COOPERATIVE)){
|
||||
//先校验VIP,演讲嘉宾,特邀嘉宾的公共字段
|
||||
ValidUtil.validate(internationalGuestVO);
|
||||
//用餐
|
||||
Integer haveMeals = internationalGuestVO.getHaveMeals();
|
||||
if (haveMeals.equals(MeetingSubitemCommon.HAVE_MEALS)){
|
||||
ValidUtil.validate(internationalGuestVO, HaveMeals.class);
|
||||
}
|
||||
//接站
|
||||
Integer pickUp = internationalGuestVO.getPickUp();
|
||||
if (pickUp.equals(MeetingSubitemCommon.PICK_UP)){
|
||||
ValidUtil.validate(internationalGuestVO, PickUp.class);
|
||||
}
|
||||
//送站
|
||||
Integer deliveryStation = internationalGuestVO.getDeliveryStation();
|
||||
if (deliveryStation.equals(MeetingSubitemCommon.DELIVERY_STATION)){
|
||||
ValidUtil.validate(internationalGuestVO, DeliveryStation.class);
|
||||
}
|
||||
//校验VIP,演讲嘉宾的公共字段
|
||||
if (!guestType.equals(MeetingSubitemCommon.GUEST)){
|
||||
ValidUtil.validate(internationalGuestVO, Guest.class);
|
||||
//校验VIP
|
||||
if (guestType.equals(MeetingSubitemCommon.VIP)){
|
||||
ValidUtil.validate(internationalGuestVO, VIP.class);
|
||||
Integer checkInHotel = internationalGuestVO.getCheckInHotel();
|
||||
if (checkInHotel.equals(MeetingSubitemCommon.CHECK_IN_HOTEL)){
|
||||
ValidUtil.validate(internationalGuestVO, CheckInHotel.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(internationalGuestVO, payMeetingSituation1);
|
||||
//参会人
|
||||
} else if (identity.equals(MeetingSubitemCommon.CAN_HUI_REN)) {
|
||||
CommonPeopleVO commonPeopleVO = new CommonPeopleVO();
|
||||
BeanUtils.copyProperties(payMeetingSituation, commonPeopleVO);
|
||||
Integer payMode = commonPeopleVO.getPayMode();
|
||||
payMeetingSituation1.setPayMode(payMode);
|
||||
//缴费方式为打包时,不处理邮寄联系人和地址
|
||||
if (payMode.equals(MeetingSubitemCommon.PAY_MODE_PACK)) {
|
||||
ValidUtil.validate(commonPeopleVO);
|
||||
//存入打包字段
|
||||
payMeetingSituation1.setPack(PayProjectCommon.PACKAGING1);
|
||||
payMeetingSituation1.setAmountReceivable(new BigDecimal(0));
|
||||
} else {
|
||||
ValidUtil.validate(commonPeopleVO, NotPack.class);
|
||||
@NotNull
|
||||
private PayMeetingSituation getPayMeetingSituation(PayMeetingSituation payMeetingSituation) {
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
//会议类型
|
||||
Integer meetingType = payMeeting.getMeetingType();
|
||||
//要保存的对象
|
||||
PayMeetingSituation payMeetingSituation1 = new PayMeetingSituation();
|
||||
payMeetingSituation1.setAmountReceivable(new BigDecimal("0"));
|
||||
//会议校验基础类
|
||||
MeetingEntity meetingEntity = new MeetingEntity();
|
||||
BeanUtils.copyProperties(payMeetingSituation, meetingEntity);
|
||||
//校验公共属性
|
||||
ValidUtil.validate(meetingEntity);
|
||||
BeanUtils.copyProperties(meetingEntity, payMeetingSituation1);
|
||||
//校验企业
|
||||
String companyId = meetingEntity.getCompanyId();
|
||||
PayCompanyManagement companyManagement = companyManagementService.getById(companyId);
|
||||
//处理企业
|
||||
canHuiRenCompany(payMeetingSituation1, companyManagement);
|
||||
//校验企业联系人
|
||||
String companyContactId = meetingEntity.getCompanyContactId();
|
||||
PayContactsManagement contactsManagement = contactsManagementService.getById(companyContactId);
|
||||
//处理联系人
|
||||
canHuiContact(payMeetingSituation1, companyId, contactsManagement);
|
||||
//存入打包字段
|
||||
payMeetingSituation1.setPack(PayProjectCommon.PACKAGING0);
|
||||
payMeetingSituation1.setNeedInvoice(PayProjectCommon.NO);
|
||||
//判断身份
|
||||
Integer identity = payMeetingSituation.getIdentity();
|
||||
//国际研讨会会议的嘉宾和其他类型不同
|
||||
if (meetingType.equals(Integer.parseInt(MeetingCommon.INTERNATIONAL_MEETING)) &&
|
||||
identity.equals(MeetingSubitemCommon.JIA_BIN)) {
|
||||
//获取嘉宾类型
|
||||
Integer guestType = payMeetingSituation.getGuestType();
|
||||
if (ObjectUtil.isNull(guestType)) {
|
||||
throw new JeroBootException("嘉宾类型不能为空");
|
||||
}
|
||||
InternationalGuestVO internationalGuestVO = new InternationalGuestVO();
|
||||
BeanUtils.copyProperties(payMeetingSituation, internationalGuestVO);
|
||||
//合作伙伴嘉宾只有最基础的参数所以不需要校验,只需要校验VIP,演讲嘉宾,特邀嘉宾
|
||||
if (!guestType.equals(MeetingSubitemCommon.COOPERATIVE)) {
|
||||
//先校验VIP,演讲嘉宾,特邀嘉宾的公共字段
|
||||
ValidUtil.validate(internationalGuestVO);
|
||||
//用餐
|
||||
Integer haveMeals = internationalGuestVO.getHaveMeals();
|
||||
if (haveMeals.equals(MeetingSubitemCommon.HAVE_MEALS)) {
|
||||
ValidUtil.validate(internationalGuestVO, HaveMeals.class);
|
||||
}
|
||||
//接站
|
||||
Integer pickUp = internationalGuestVO.getPickUp();
|
||||
if (pickUp.equals(MeetingSubitemCommon.PICK_UP)) {
|
||||
ValidUtil.validate(internationalGuestVO, PickUp.class);
|
||||
}
|
||||
//送站
|
||||
Integer deliveryStation = internationalGuestVO.getDeliveryStation();
|
||||
if (deliveryStation.equals(MeetingSubitemCommon.DELIVERY_STATION)) {
|
||||
ValidUtil.validate(internationalGuestVO, DeliveryStation.class);
|
||||
}
|
||||
//校验VIP,演讲嘉宾的公共字段
|
||||
if (!guestType.equals(MeetingSubitemCommon.GUEST)) {
|
||||
ValidUtil.validate(internationalGuestVO, Guest.class);
|
||||
//校验VIP
|
||||
if (guestType.equals(MeetingSubitemCommon.VIP)) {
|
||||
ValidUtil.validate(internationalGuestVO, VIP.class);
|
||||
Integer checkInHotel = internationalGuestVO.getCheckInHotel();
|
||||
if (checkInHotel.equals(MeetingSubitemCommon.CHECK_IN_HOTEL)) {
|
||||
ValidUtil.validate(internationalGuestVO, CheckInHotel.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(internationalGuestVO, payMeetingSituation1);
|
||||
//参会人
|
||||
} else if (identity.equals(MeetingSubitemCommon.CAN_HUI_REN)) {
|
||||
CommonPeopleVO commonPeopleVO = new CommonPeopleVO();
|
||||
BeanUtils.copyProperties(payMeetingSituation, commonPeopleVO);
|
||||
Integer payMode = commonPeopleVO.getPayMode();
|
||||
payMeetingSituation1.setPayMode(payMode);
|
||||
//缴费方式为打包时,不处理邮寄联系人和地址
|
||||
if (payMode.equals(MeetingSubitemCommon.PAY_MODE_PACK)) {
|
||||
ValidUtil.validate(commonPeopleVO);
|
||||
//存入打包字段
|
||||
payMeetingSituation1.setPack(PayProjectCommon.PACKAGING1);
|
||||
payMeetingSituation1.setAmountReceivable(new BigDecimal(0));
|
||||
} else {
|
||||
ValidUtil.validate(commonPeopleVO, NotPack.class);
|
||||
|
||||
payMeetingSituation1.setNeedInvoice(payMeetingSituation.getNeedInvoice());
|
||||
payMeetingSituation1.setPaymentRecord(payMeetingSituation.getPaymentRecord());
|
||||
//如果是标协会议判断会员类型
|
||||
if (meetingType.equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))){
|
||||
//根据企业名称和会员类型不为null判断是否为标协会员
|
||||
int count = memberInfoService.check(payMeetingSituation1.getCompanyName());
|
||||
//如果是标协会员就存入会议费用(标协会员)
|
||||
if (count>0){
|
||||
payMeetingSituation1.setAmountReceivable(payMeeting.getMeetingCostsVip());
|
||||
}else {
|
||||
payMeetingSituation1.setAmountReceivable(payMeeting.getMeetingCosts());
|
||||
}
|
||||
}else {
|
||||
payMeetingSituation1.setAmountReceivable(payMeeting.getMeetingCosts());
|
||||
}
|
||||
ValidUtil.validate(commonPeopleVO);
|
||||
//校验邮寄联系人
|
||||
String postContactId = commonPeopleVO.getPostContactId();
|
||||
PayContactsManagement postContact = contactsManagementService.getById(postContactId);
|
||||
//校验是否是选择的企业的联系人
|
||||
String companyId2 = postContact.getCompanyId();
|
||||
if (companyId2.equals(companyId)) {
|
||||
payMeetingSituation1.setPostContactId(postContact.getId());
|
||||
payMeetingSituation1.setPostContactName(postContact.getName());
|
||||
payMeetingSituation1.setPostContactAddress(payMeetingSituation.getPostContactAddress());
|
||||
} else {
|
||||
throw new JeroBootException("邮寄联系人不是所选企业的企业联系人");
|
||||
}
|
||||
payMeetingSituation1.setCheckInHotel(payMeetingSituation.getCheckInHotel());
|
||||
payMeetingSituation1.setArrivalTime(payMeetingSituation.getArrivalTime());
|
||||
payMeetingSituation1.setDepartureTime(payMeetingSituation.getDepartureTime());
|
||||
}
|
||||
//其他会议的嘉宾和内部企业
|
||||
}else {
|
||||
CommonGuestVO commonGuestVO = new CommonGuestVO();
|
||||
BeanUtils.copyProperties(payMeetingSituation, commonGuestVO);
|
||||
ValidUtil.validate(commonGuestVO);
|
||||
BeanUtils.copyProperties(commonGuestVO, payMeetingSituation1);
|
||||
}
|
||||
return payMeetingSituation1;
|
||||
}
|
||||
payMeetingSituation1.setNeedInvoice(payMeetingSituation.getNeedInvoice());
|
||||
payMeetingSituation1.setPaymentRecord(payMeetingSituation.getPaymentRecord());
|
||||
//如果是标协会议判断会员类型
|
||||
if (meetingType.equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
|
||||
//根据企业名称和会员类型不为null判断是否为标协会员
|
||||
int count = memberInfoService.check(payMeetingSituation1.getCompanyName());
|
||||
//如果是标协会员就存入会议费用(标协会员)
|
||||
if (count > 0) {
|
||||
payMeetingSituation1.setAmountReceivable(payMeeting.getMeetingCostsVip());
|
||||
} else {
|
||||
payMeetingSituation1.setAmountReceivable(payMeeting.getMeetingCosts());
|
||||
}
|
||||
} else {
|
||||
payMeetingSituation1.setAmountReceivable(payMeeting.getMeetingCosts());
|
||||
}
|
||||
ValidUtil.validate(commonPeopleVO);
|
||||
//校验邮寄联系人
|
||||
String postContactId = commonPeopleVO.getPostContactId();
|
||||
PayContactsManagement postContact = contactsManagementService.getById(postContactId);
|
||||
//校验是否是选择的企业的联系人
|
||||
String companyId2 = postContact.getCompanyId();
|
||||
if (companyId2.equals(companyId)) {
|
||||
payMeetingSituation1.setPostContactId(postContact.getId());
|
||||
payMeetingSituation1.setPostContactName(postContact.getName());
|
||||
payMeetingSituation1.setPostContactAddress(payMeetingSituation.getPostContactAddress());
|
||||
} else {
|
||||
throw new JeroBootException("邮寄联系人不是所选企业的企业联系人");
|
||||
}
|
||||
payMeetingSituation1.setCheckInHotel(payMeetingSituation.getCheckInHotel());
|
||||
payMeetingSituation1.setArrivalTime(payMeetingSituation.getArrivalTime());
|
||||
payMeetingSituation1.setDepartureTime(payMeetingSituation.getDepartureTime());
|
||||
}
|
||||
//其他会议的嘉宾和内部企业
|
||||
} else {
|
||||
CommonGuestVO commonGuestVO = new CommonGuestVO();
|
||||
BeanUtils.copyProperties(payMeetingSituation, commonGuestVO);
|
||||
ValidUtil.validate(commonGuestVO);
|
||||
BeanUtils.copyProperties(commonGuestVO, payMeetingSituation1);
|
||||
}
|
||||
return payMeetingSituation1;
|
||||
}
|
||||
|
||||
private void canHuiContact(PayMeetingSituation payMeetingSituation, String companyId, PayContactsManagement contactsManagement) {
|
||||
if (contactsManagement == null) {
|
||||
throw new JeroBootException("联系人不存在");
|
||||
}
|
||||
String companyId1 = contactsManagement.getCompanyId();
|
||||
//校验是否是选择的企业的联系人
|
||||
if (companyId1.equals(companyId)) {
|
||||
payMeetingSituation.setCompanyContactTemporaryId(contactsManagement.getId());
|
||||
payMeetingSituation.setCompanyContactName(contactsManagement.getName());
|
||||
} else {
|
||||
throw new JeroBootException("企业联系人不是所选企业的企业联系人");
|
||||
}
|
||||
}
|
||||
private void canHuiContact(PayMeetingSituation payMeetingSituation, String companyId, PayContactsManagement contactsManagement) {
|
||||
if (contactsManagement == null) {
|
||||
throw new JeroBootException("联系人不存在");
|
||||
}
|
||||
String companyId1 = contactsManagement.getCompanyId();
|
||||
//校验是否是选择的企业的联系人
|
||||
if (companyId1.equals(companyId)) {
|
||||
payMeetingSituation.setCompanyContactTemporaryId(contactsManagement.getId());
|
||||
payMeetingSituation.setCompanyContactName(contactsManagement.getName());
|
||||
} else {
|
||||
throw new JeroBootException("企业联系人不是所选企业的企业联系人");
|
||||
}
|
||||
}
|
||||
|
||||
private void baoMingContact(PayMeetingSituation payMeetingSituation, String companyId, String companyContactId, PayContactsManagement contactsManagement) {
|
||||
if (contactsManagement == null) {
|
||||
PayContactsManagementTemporary contactsManagementTemporary = contactsManagementTemporaryService.insertContactsManagementTemporary(companyContactId);
|
||||
if (contactsManagementTemporary == null) {
|
||||
throw new JeroBootException("联系人不存在");
|
||||
}
|
||||
String companyId1 = contactsManagementTemporary.getCompanyId();
|
||||
if (companyId1.equals(companyId)) {
|
||||
payMeetingSituation.setCompanyContactTemporaryId(contactsManagementTemporary.getId());
|
||||
payMeetingSituation.setCompanyContactName(contactsManagementTemporary.getName());
|
||||
} else {
|
||||
throw new JeroBootException("企业联系人不是所选企业的企业联系人");
|
||||
}
|
||||
}else {
|
||||
String companyId1 = contactsManagement.getCompanyId();
|
||||
//校验是否是选择的企业的联系人
|
||||
if (companyId1.equals(companyId)) {
|
||||
payMeetingSituation.setCompanyContactTemporaryId(contactsManagement.getId());
|
||||
payMeetingSituation.setCompanyContactName(contactsManagement.getName());
|
||||
} else {
|
||||
throw new JeroBootException("企业联系人不是所选企业的企业联系人");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void baoMingContact(PayMeetingSituation payMeetingSituation, String companyId, String companyContactId, PayContactsManagement contactsManagement) {
|
||||
if (contactsManagement == null) {
|
||||
PayContactsManagementTemporary contactsManagementTemporary = contactsManagementTemporaryService.insertContactsManagementTemporary(companyContactId);
|
||||
if (contactsManagementTemporary == null) {
|
||||
throw new JeroBootException("联系人不存在");
|
||||
}
|
||||
String companyId1 = contactsManagementTemporary.getCompanyId();
|
||||
if (companyId1.equals(companyId)) {
|
||||
payMeetingSituation.setCompanyContactTemporaryId(contactsManagementTemporary.getId());
|
||||
payMeetingSituation.setCompanyContactName(contactsManagementTemporary.getName());
|
||||
} else {
|
||||
throw new JeroBootException("企业联系人不是所选企业的企业联系人");
|
||||
}
|
||||
} else {
|
||||
String companyId1 = contactsManagement.getCompanyId();
|
||||
//校验是否是选择的企业的联系人
|
||||
if (companyId1.equals(companyId)) {
|
||||
payMeetingSituation.setCompanyContactTemporaryId(contactsManagement.getId());
|
||||
payMeetingSituation.setCompanyContactName(contactsManagement.getName());
|
||||
} else {
|
||||
throw new JeroBootException("企业联系人不是所选企业的企业联系人");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void canHuiRenCompany(PayMeetingSituation payMeetingSituation, PayCompanyManagement companyManagement) {
|
||||
if (companyManagement == null) {
|
||||
throw new JeroBootException("企业不存在");
|
||||
}
|
||||
payMeetingSituation.setCompanyTemporaryId(companyManagement.getId());
|
||||
payMeetingSituation.setCompanyName(companyManagement.getCompanyName());
|
||||
}
|
||||
private void canHuiRenCompany(PayMeetingSituation payMeetingSituation, PayCompanyManagement companyManagement) {
|
||||
if (companyManagement == null) {
|
||||
throw new JeroBootException("企业不存在");
|
||||
}
|
||||
payMeetingSituation.setCompanyTemporaryId(companyManagement.getId());
|
||||
payMeetingSituation.setCompanyName(companyManagement.getCompanyName());
|
||||
}
|
||||
|
||||
private void baoMingCompany(PayMeetingSituation payMeetingSituation, String companyId, PayCompanyManagement companyManagement) {
|
||||
if (companyManagement == null) {
|
||||
PayCompanyManagementTemporary companyManagementTemporary = companyManagementTemporaryService.getById(companyId);
|
||||
if (companyManagementTemporary == null) {
|
||||
throw new JeroBootException("企业不存在");
|
||||
}
|
||||
payMeetingSituation.setCompanyTemporaryId(companyManagementTemporary.getId());
|
||||
payMeetingSituation.setCompanyName(companyManagementTemporary.getCompanyName());
|
||||
payMeetingSituation.setNewCompany(1);
|
||||
}else {
|
||||
payMeetingSituation.setCompanyTemporaryId(companyManagement.getId());
|
||||
payMeetingSituation.setCompanyName(companyManagement.getCompanyName());
|
||||
}
|
||||
payMeetingSituation.setNewCompany(0);
|
||||
}
|
||||
private void baoMingCompany(PayMeetingSituation payMeetingSituation, String companyId, PayCompanyManagement companyManagement) {
|
||||
if (companyManagement == null) {
|
||||
PayCompanyManagementTemporary companyManagementTemporary = companyManagementTemporaryService.getById(companyId);
|
||||
if (companyManagementTemporary == null) {
|
||||
throw new JeroBootException("企业不存在");
|
||||
}
|
||||
payMeetingSituation.setCompanyTemporaryId(companyManagementTemporary.getId());
|
||||
payMeetingSituation.setCompanyName(companyManagementTemporary.getCompanyName());
|
||||
payMeetingSituation.setNewCompany(1);
|
||||
} else {
|
||||
payMeetingSituation.setCompanyTemporaryId(companyManagement.getId());
|
||||
payMeetingSituation.setCompanyName(companyManagement.getCompanyName());
|
||||
}
|
||||
payMeetingSituation.setNewCompany(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@Override
|
||||
public PayMeetingSituation queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*/
|
||||
@Override
|
||||
* 列表查询
|
||||
*/
|
||||
@Override
|
||||
public List<PayMeetingSituation> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDock(AddDockVO addDockVO) {
|
||||
String dockId = addDockVO.getDockId();
|
||||
LoginUser user = iSysBaseApi.getUserById(dockId);
|
||||
if (ObjectUtil.isNull(user)){
|
||||
throw new JeroBootException("对接人不存在");
|
||||
}
|
||||
String username = user.getUsername();
|
||||
List<String> meetingSituationIds = addDockVO.getMeetingSituationIds();
|
||||
for (String meetingSituationId : meetingSituationIds) {
|
||||
PayMeetingSituation payMeetingSituation = getById(meetingSituationId);
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
Integer meetingType = payMeeting.getMeetingType();
|
||||
//只有国际研讨会议可以设置对接人
|
||||
if (!meetingType.equals(Integer.parseInt(MeetingCommon.INTERNATIONAL_MEETING))){
|
||||
throw new JeroBootException("只有国际研讨会议可以设置对接人");
|
||||
}
|
||||
payMeetingSituation.setDockId(dockId);
|
||||
payMeetingSituation.setDockName(username);
|
||||
saveOrUpdate(payMeetingSituation);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addDock(AddDockVO addDockVO) {
|
||||
String dockId = addDockVO.getDockId();
|
||||
LoginUser user = iSysBaseApi.getUserById(dockId);
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
throw new JeroBootException("对接人不存在");
|
||||
}
|
||||
String username = user.getUsername();
|
||||
List<String> meetingSituationIds = addDockVO.getMeetingSituationIds();
|
||||
for (String meetingSituationId : meetingSituationIds) {
|
||||
PayMeetingSituation payMeetingSituation = getById(meetingSituationId);
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
Integer meetingType = payMeeting.getMeetingType();
|
||||
//只有国际研讨会议可以设置对接人
|
||||
if (!meetingType.equals(Integer.parseInt(MeetingCommon.INTERNATIONAL_MEETING))) {
|
||||
throw new JeroBootException("只有国际研讨会议可以设置对接人");
|
||||
}
|
||||
payMeetingSituation.setDockId(dockId);
|
||||
payMeetingSituation.setDockName(username);
|
||||
saveOrUpdate(payMeetingSituation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public class MergePayBillVO {
|
||||
private String meetingId;
|
||||
|
||||
@ApiModelProperty(value = "邮寄联系人")
|
||||
@NotBlank(message = "会议项目不能为空")
|
||||
private String postContactId;
|
||||
|
||||
@ApiModelProperty(value = "邮寄联系人地址")
|
||||
|
||||
Reference in New Issue
Block a user