add 参会人签到

This commit is contained in:
lijiarao
2021-09-22 09:10:29 +08:00
parent a7fdf73b38
commit d44d06bede
4 changed files with 103 additions and 10 deletions
@@ -232,5 +232,17 @@ public class PayMeetingSituationController extends JeroController<PayMeetingSitu
return Result.OK("合并开票成功!");
}
/**
* 签到
*/
@AutoLog(value = "签到")
@ApiOperation(value = "签到")
@PostMapping(value = "/signIn")
public Result<?> signIn(@RequestBody SignInVO signInVO) {
ValidUtil.validate(signInVO);
payMeetingSituationService.signIn(signInVO);
return Result.OK("合并开票成功!");
}
}
@@ -56,4 +56,6 @@ public interface IPayMeetingSituationService extends IService<PayMeetingSituatio
Integer countByMeetingId(String meetingId);
Page<MeetingSituationContractVO> contractPage(Page<MeetingSituationContractVO> page, MeetingSituationContractVO meetingSituationContractVO);
void signIn(SignInVO signInVO);
}
@@ -39,6 +39,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -98,13 +99,14 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
/**
* 处理打包情况
*
* @param payMeetingSituation1
*/
private void handlePack(PayMeetingSituation payMeetingSituation1) {
if (payMeetingSituation1.getPack().equals(PayProjectCommon.PACKAGING1)) {
String meetingId = payMeetingSituation1.getMeetingId();
PayMeeting payMeeting = meetingService.getById(meetingId);
payPackCompanyProjectService.setPack(payMeetingSituation1.getCompanyId(), payMeetingSituation1.getCompanyContactId(),payMeeting.getParticularYear(), payMeetingSituation1.getId(),PayProjectCommon.PROJECT_TYPE3,PayProjectCommon.PACKAGING1);
payPackCompanyProjectService.setPack(payMeetingSituation1.getCompanyId(), payMeetingSituation1.getCompanyContactId(), payMeeting.getParticularYear(), payMeetingSituation1.getId(), PayProjectCommon.PROJECT_TYPE3, PayProjectCommon.PACKAGING1);
}
}
@@ -171,11 +173,11 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
String id = checkVO.getId();
PayMeetingSituation meetingSituation = getById(id);
String paymentRecord = meetingSituation.getPaymentRecord();
if (StrUtil.isBlank(paymentRecord)){
if (StrUtil.isBlank(paymentRecord)) {
throw new JeroBootException("来款凭证为空不能审核");
}
Integer checkResult1 = meetingSituation.getCheckResult();
if (checkResult1.equals(PayProjectCommon.YES)){
if (checkResult1.equals(PayProjectCommon.YES)) {
throw new JeroBootException("审核通过之后就无法在审核");
}
Integer checkResult = checkVO.getCheckResult();
@@ -267,13 +269,43 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
@Override
public Integer countByMeetingId(String meetingId) {
LambdaQueryWrapper<PayMeetingSituation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingSituation::getMeetingId,meetingId);
wrapper.eq(PayMeetingSituation::getMeetingId, meetingId);
return count(wrapper);
}
@Override
public Page<MeetingSituationContractVO> contractPage(Page<MeetingSituationContractVO> page, MeetingSituationContractVO meetingSituationContractVO) {
return baseMapper.contractPage(page,meetingSituationContractVO);
return baseMapper.contractPage(page, meetingSituationContractVO);
}
@Override
public void signIn(SignInVO signInVO) {
String meetingId = signInVO.getMeetingId();
PayMeeting payMeeting = meetingService.getById(meetingId);
if (payMeeting == null) {
throw new JeroBootException("会议不存在");
}
if (!belongCalendar(new Date(),payMeeting.getStartSignInTime(),payMeeting.getEndSignInTime())) {
throw new JeroBootException("不在会议可签到时间内,无法签到");
}
String companyContactId = signInVO.getCompanyContactId();
PayContactsManagement contactsManagement = contactsManagementService.getById(companyContactId);
if (contactsManagement == null) {
throw new JeroBootException("参会人不存在");
}
LambdaQueryWrapper<PayMeetingSituation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingSituation::getMeetingId, meetingId);
wrapper.eq(PayMeetingSituation::getCompanyContactId, companyContactId);
PayMeetingSituation meetingSituation = getOne(wrapper);
if (meetingSituation == null) {
throw new JeroBootException("会议不存在此参会人");
}
meetingSituation.setCheckIn(PayProjectCommon.YES);
saveOrUpdate(meetingSituation);
}
/**
@@ -440,9 +472,9 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
}
String meetingId = payMeetingSituation.getMeetingId();
LambdaQueryWrapper<PayMeetingSituation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingSituation::getMeetingId,meetingId);
wrapper.eq(PayMeetingSituation::getCompanyContactId,contactsManagementId);
if ((count(wrapper)>0)) {
wrapper.eq(PayMeetingSituation::getMeetingId, meetingId);
wrapper.eq(PayMeetingSituation::getCompanyContactId, contactsManagementId);
if ((count(wrapper) > 0)) {
throw new JeroBootException("联系人不能多次参加相同会议");
}
}
@@ -477,6 +509,7 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
/**
* 解除参会人打包
*
* @param id
*/
private void removeSituationPack(String id) {
@@ -489,9 +522,9 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
throw new JeroBootException(payMeetingSituation.getCompanyContactName() + " 该参会人已经有开票,无法删除");
}
LambdaQueryWrapper<PayIncomeContractAssociated> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(PayIncomeContractAssociated::getProjectId,id);
wrapper1.eq(PayIncomeContractAssociated::getProjectId, id);
PayIncomeContractAssociated payIncomeContractAssociated = payIncomeContractAssociatedService.getOne(wrapper1);
if (ObjectUtil.isNotNull(payIncomeContractAssociated)){
if (ObjectUtil.isNotNull(payIncomeContractAssociated)) {
throw new JeroBootException(payMeetingSituation.getCompanyContactName() + " 参会人已经和合同关联,无法删除");
}
//如果有打包,删除打包关联
@@ -543,5 +576,29 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
}
}
/**
* 判断时间是否在时间段内
*
* @param nowTime
* @param beginTime
* @param endTime
* @return
*/
public static boolean belongCalendar(Date nowTime, Date beginTime,
Date endTime) {
Calendar date = Calendar.getInstance();
date.setTime(nowTime);
Calendar begin = Calendar.getInstance();
begin.setTime(beginTime);
Calendar end = Calendar.getInstance();
end.setTime(endTime);
if (date.after(begin) && date.before(end)) {
return true;
} else {
return false;
}
}
}
@@ -0,0 +1,22 @@
package com.jero.meeting.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;
import javax.validation.constraints.NotBlank;
/**
* 签到
* @author liJiaRao
* @date 2021-09-21 17:41
*/
@Data
public class SignInVO {
@NotBlank(message = "参会人id不能为空")
@ApiModelProperty(value = "参会人id")
private String companyContactId;
@ApiModelProperty(value = "会议id")
@NotBlank(message = "会议id不能为空")
private String meetingId;
}