add 确认到账来款逻辑

This commit is contained in:
lijiarao
2022-06-10 16:26:42 +08:00
parent e5c673e374
commit a94626bb08
21 changed files with 345 additions and 205 deletions
@@ -329,6 +329,11 @@ public class PayMeetingSituation implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal paidAmount;
@ApiModelProperty(value = "确认到账金额(元)")
@DecimalMax(value = "9999999999.99",message = "确认到账金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal confirmAmount;
/**打包*/
//@Excel(name = "打包", width = 15)
@ApiModelProperty(value = "打包")
@@ -61,7 +61,6 @@ import com.jero.pack.service.IPayPackCompanyProjectService;
import com.jero.payment.entity.PayPaymentRecord;
import com.jero.payment.service.IPayPaymentRecordService;
import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.jero.project.entity.PayWorkingGroupSubItemContacts;
import com.jero.project.service.IPayWorkingGroupSubItemContactsService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
@@ -162,6 +162,11 @@ public class PayMemberProjectSubitem implements Serializable {
@DecimalMax(value = "9999999999.99",message = "实收金额格式错误")
private BigDecimal paidAmount;
@ApiModelProperty(value = "确认到账金额(元)")
@DecimalMax(value = "9999999999.99",message = "确认到账金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal confirmAmount;
/**
* 来款方式
*/
@@ -3,10 +3,13 @@ package com.jero.member.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@@ -206,6 +209,11 @@ public class TbCertificatePayment implements Serializable {
@DecimalMax(value = "9999999999.99", message = "实收金额格式错误")
private BigDecimal paidAmount;
@ApiModelProperty(value = "确认到账金额(元)")
@DecimalMax(value = "9999999999.99",message = "确认到账金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal confirmAmount;
/**打包*/
@Excel(name = "打包", width = 15,dicCode = "yn")
@ApiModelProperty(value = "打包")
@@ -145,6 +145,11 @@ public class TbMemberProjectSubitem implements Serializable {
@DecimalMax(value = "9999999999.99", message = "实收金额格式错误")
private BigDecimal paidAmount;
@ApiModelProperty(value = "确认到账金额(元)")
@DecimalMax(value = "9999999999.99",message = "确认到账金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal confirmAmount;
/**打包*/
@Excel(name = "打包", width = 15,dicCode = "yn")
@ApiModelProperty(value = "打包")
@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.enums.PaymentStatusEnum;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.vo.LoginUser;
import com.jero.company.entity.PayContactsManagement;
import com.jero.company.service.IPayContactsManagementService;
import com.jero.member.entity.TbCertificatePayment;
import com.jero.member.entity.TbMemberProjectSubitem;
import com.jero.member.service.ITbCertificatePaymentService;
@@ -15,16 +12,13 @@ import com.jero.payment.entity.PayPaymentRecordSub;
import com.jero.payment.entity.PayPaymentRecord;
import com.jero.payment.service.IPayPaymentCheckService;
import com.jero.payment.service.IPayPaymentRecordService;
import com.jero.standards.memberinfo.service.IMemberInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@@ -72,14 +72,12 @@ public class PayConfirmPaymentRecord implements Serializable {
/**
* 项目id
*/
@TableField(value = "project_id")
@ApiModelProperty(value="项目id")
private String projectId;
/**
* 项目类型
*/
@TableField(exist = false)
@ApiModelProperty(value="项目类型")
private String projectType;
@@ -2,7 +2,6 @@ package com.jero.payment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.home.vo.DataStatisticsVO;
import com.jero.payment.entity.PayPaymentRecord;
import com.jero.project.entity.PayCommonProject;
import com.jero.project.vo.PayCommonProjectOutput;
@@ -5,11 +5,11 @@
<!-- 到账开票主列表-->
<select id="mainList" resultType="com.jero.project.entity.PayCommonProject">
select p.id,p.charge_project, p.charge_use, p.principal_id,p.principal_name,p.charge_company_id,p.charge_company_temporary_name,p.receivable_amount,p.paid_amount,p.need_invoice,p.pack,p.in_account,p.make_invoice,p.mail,p.create_time,p.projectType,
p.invoice_amount,p.mail_contacts_id,p.register_check_result,p.contacts_temporary_name,p.payment_status,p.charge_company_temporary_id
p.invoice_amount,p.mail_contacts_id,p.register_check_result,p.contacts_temporary_name,p.payment_status,p.charge_company_temporary_id,p.confirm_amount
from
(<!-- 普通项目-->
select c.id,c.charge_project, c.charge_use, c.principal_id,su.realname as principal_name,c.charge_company_id,c.charge_company_temporary_name,c.receivable_amount,c.paid_amount,c.need_invoice,c.pack,c.in_account,c.make_invoice,c.mail,c.create_time,1 as projectType,
c.invoice_amount,c.mail_contacts_id,'' as register_check_result,c.contacts_temporary_name,c.payment_status,c.charge_company_temporary_id
c.invoice_amount,c.mail_contacts_id,'' as register_check_result,c.contacts_temporary_name,c.payment_status,c.charge_company_temporary_id,c.confirm_amount
from pay_common_project c
left join sys_user su on c.principal_id = su.id
where
@@ -40,7 +40,7 @@
<!--工作组项目-->
UNION ALL
select gsub.id,g.working_group_project, gsub.charge_use, g.principal_id_a,su.realname,gsub.charge_company_id,gsub.charge_company_temporary_name,gsub.receivable_amount,gsub.paid_amount,gsub.need_invoice,gsub.pack,gsub.in_account,gsub.make_invoice,gsub.mail,gsub.create_time,2,
gsub.invoice_amount,gsub.mail_contacts_id,'' as register_check_result,gsubc.contacts_temporary_name as contacts_temporary_name_one,gsub.payment_status,gsub.charge_company_temporary_id
gsub.invoice_amount,gsub.mail_contacts_id,'' as register_check_result,gsubc.contacts_temporary_name as contacts_temporary_name_one,gsub.payment_status,gsub.charge_company_temporary_id,gsub.confirm_amount
from pay_working_group g
left join sys_user su on g.principal_id_a = su.id
inner join pay_working_group_subitem gsub on g.id = gsub.working_group_id
@@ -73,7 +73,7 @@
<!-- 会议项目-->
UNION ALL
select sit.id,meeting.meeting_name,sit.charge_use, meeting.director_id, su.realname,sit.company_id,sit.company_name,sit.amount_receivable,sit.paid_amount,sit.need_invoice,sit.pack,sit.in_account,sit.make_invoice,sit.mail,sit.create_time,3,
sit.invoice_amount,sit.post_contact_id,sit.register_check_result,sit.company_contact_name,sit.payment_status,sit.company_id
sit.invoice_amount,sit.post_contact_id,sit.register_check_result,sit.company_contact_name,sit.payment_status,sit.company_id,sit.confirm_amount
from pay_meeting meeting
inner join pay_meeting_situation sit on meeting.id = sit.meeting_id
left join sys_user su on su.id = meeting.director_id
@@ -105,7 +105,7 @@
<!-- 会员项目-->
UNION ALL
select msub.id,pmp.project_name,msub.charge_use,pmp.director_id,su.realname,msub.company_id,msub.company_name,msub.amount_receivable,msub.paid_amount,msub.need_invoice,msub.pack,msub.in_account,msub.make_invoice,msub.mail,msub.create_time,4,
msub.invoice_amount,msub.post_contact_id,'' as register_check_result,msub.company_contact_name,msub.payment_status,msub.company_temporary_id
msub.invoice_amount,msub.post_contact_id,'' as register_check_result,msub.company_contact_name,msub.payment_status,msub.company_temporary_id,msub.confirm_amount
from pay_member_project pmp
inner join pay_member_project_subitem msub on pmp.id=msub.project_id
left join sys_user su on su.id = pmp.director_id
@@ -137,7 +137,7 @@
<!-- 标协会员项目-->
UNION ALL
select tmsub.id,tmember.project_name,tmsub.charge_use,tmember.director_id,su.realname,tmsub.company_id,tmsub.company_name,tmsub.amount_receivable,tmsub.paid_amount,tmsub.invoice_requirements,tmsub.pack,tmsub.in_account,tmsub.make_invoice,tmsub.mail,tmsub.create_time,5,
tmsub.invoice_amount,tmsub.liaison_man_id,'' as register_check_result,tmsub.liaison_man,tmsub.payment_status,tmsub.company_id
tmsub.invoice_amount,tmsub.liaison_man_id,'' as register_check_result,tmsub.liaison_man,tmsub.payment_status,tmsub.company_id,tmsub.confirm_amount
from tb_member_project tmember
inner join tb_member_project_subitem tmsub on tmember.id=tmsub.project_id
left join sys_user su on su.id = tmember.director_id
@@ -169,7 +169,7 @@
<!-- 标协证书项目-->
UNION ALL
select tcp.id,tmember.project_name,tcp.charge_use,tmember.director_id,su.realname,tcp.company_id,tcp.company_name,tcp.amount_receivable,tcp.paid_amount,tcp.invoice_requirements,tcp.pack,tcp.in_account,tcp.make_invoice,tcp.mail,tcp.create_time,6,
tcp.invoice_amount,tcp.liaison_man_id,'' as register_check_result,tcp.liaison_man,tcp.payment_status,tcp.company_id
tcp.invoice_amount,tcp.liaison_man_id,'' as register_check_result,tcp.liaison_man,tcp.payment_status,tcp.company_id,tcp.confirm_amount
from tb_member_project tmember
inner join tb_certificate_payment tcp on tmember.id=tcp.project_id
left join sys_user su on su.id = tmember.director_id
@@ -3,7 +3,6 @@ package com.jero.payment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.payment.entity.PayPaymentRecordSub;
import com.jero.payment.entity.PayPaymentRecord;
import org.springframework.web.bind.annotation.RequestBody;
import java.math.BigDecimal;
import java.util.List;
@@ -1,11 +1,38 @@
package com.jero.payment.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.enums.PaymentStatusEnum;
import com.jero.company.entity.PayContactsManagement;
import com.jero.contract.common.PayIncomeContractCommon;
import com.jero.meeting.entity.PayMeeting;
import com.jero.meeting.entity.PayMeetingSituation;
import com.jero.meeting.mapper.PayMeetingSituationMapper;
import com.jero.member.entity.*;
import com.jero.member.mapper.PayMemberProjectSubitemMapper;
import com.jero.member.mapper.TbCertificatePaymentMapper;
import com.jero.member.mapper.TbMemberProjectSubitemMapper;
import com.jero.payment.vo.TbCheckVo;
import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.PayCommonProject;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.jero.project.entity.PayWorkingGroupSubItemContacts;
import com.jero.project.mapper.PayCommonProjectMapper;
import com.jero.project.mapper.PayWorkingGroupSubItemMapper;
import com.jero.temporary.entity.PayContactsManagementTemporary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.payment.entity.PayConfirmPaymentRecord;
import com.jero.payment.mapper.PayConfirmPaymentRecordMapper;
import org.springframework.util.CollectionUtils;
/**
* @author liJiaRao
@@ -13,15 +40,96 @@ import com.jero.payment.mapper.PayConfirmPaymentRecordMapper;
*/
@Service
public class PayConfirmPaymentRecordService extends ServiceImpl<PayConfirmPaymentRecordMapper, PayConfirmPaymentRecord> {
@Resource
private PayCommonProjectMapper payCommonProjectMapper;
@Resource
private PayWorkingGroupSubItemMapper payWorkingGroupSubItemMapper;
@Resource
private PayMeetingSituationMapper payMeetingSituationMapper;
@Resource
private PayMemberProjectSubitemMapper payMemberProjectSubitemMapper;
@Resource
private TbMemberProjectSubitemMapper tbMemberProjectSubitemMapper;
@Resource
private TbCertificatePaymentMapper certificatePaymentMapper;
public void add(PayConfirmPaymentRecord payConfirmPaymentRecord) {
save(payConfirmPaymentRecord);
updateConfirmAmount(payConfirmPaymentRecord);
}
private void updateConfirmAmount(PayConfirmPaymentRecord payConfirmPaymentRecord) {
String projectId = payConfirmPaymentRecord.getProjectId();
String projectType = payConfirmPaymentRecord.getProjectType();
BigDecimal confirmAmount = payConfirmPaymentRecord.getAmountReceived();
switch (projectType){
// 普通项目
case PayIncomeContractCommon.PROJECT_TYPE1:
PayCommonProject payCommonProject = payCommonProjectMapper.selectById(projectId);
//更新主列表
payCommonProject.setConfirmAmount(confirmAmount);
payCommonProjectMapper.updateById(payCommonProject);
break;
// 工作组项目
case PayIncomeContractCommon.PROJECT_TYPE2:
PayWorkingGroupSubItem payWorking = payWorkingGroupSubItemMapper.selectById(projectId);
//更新主列表
payWorking.setConfirmAmount(confirmAmount);
payWorkingGroupSubItemMapper.updateById(payWorking);
break;
//会议项目
case PayIncomeContractCommon.PROJECT_TYPE3:
PayMeetingSituation meeting = payMeetingSituationMapper.selectById(projectId);
//更新主列表
meeting.setConfirmAmount(confirmAmount);
payMeetingSituationMapper.updateById(meeting);
break;
//会员项目
case PayIncomeContractCommon.PROJECT_TYPE4:
PayMemberProjectSubitem member = payMemberProjectSubitemMapper.selectById(projectId);
//更新主列表
member.setConfirmAmount(confirmAmount);
payMemberProjectSubitemMapper.updateById(member);
break;
//标协会员
case PayIncomeContractCommon.PROJECT_TYPE5:
TbMemberProjectSubitem tbMember = tbMemberProjectSubitemMapper.selectById(projectId);
//更新主列表
tbMember.setConfirmAmount(confirmAmount);
tbMemberProjectSubitemMapper.updateById(tbMember);
break;
//标协证书
case PayIncomeContractCommon.PROJECT_TYPE6:
TbCertificatePayment tbMemberCertificate = certificatePaymentMapper.selectById(projectId);
//更新主列表
tbMemberCertificate.setConfirmAmount(confirmAmount);
certificatePaymentMapper.updateById(tbMemberCertificate);
break;
default:break;
}
}
public void editById(PayConfirmPaymentRecord payConfirmPaymentRecord) {
updateById(payConfirmPaymentRecord);
updateConfirmAmount(payConfirmPaymentRecord);
}
public void deleteById(String id) {
@@ -3,7 +3,6 @@ package com.jero.payment.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.common.ProjectCommon;
import com.jero.common.common.RoleCommon;
@@ -102,6 +102,12 @@ public class PayCommonProject implements Serializable {
@DecimalMax(value = "9999999999.99",message = "实收金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal paidAmount;
@ApiModelProperty(value = "确认到账金额(元)")
@DecimalMax(value = "9999999999.99",message = "确认到账金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal confirmAmount;
/**邮寄联系人id*/
@ApiModelProperty(value = "邮寄联系人id")
@NotEmpty(message = "邮寄联系人id不能为空")
@@ -38,8 +38,8 @@ public class PayWorkGroupSubletStatistics {
@ApiModelProperty(value = "开票金额")
private String billMoney;
@Excel(name = "确认金额", width = 15)
@ApiModelProperty(value = "确认金额")
@Excel(name = "确认到账金额", width = 15)
@ApiModelProperty(value = "确认到账金额")
private String confirmAmount;
@Excel(name = "来款用途", width = 15, dicCode="payment_charge_use")
@@ -128,6 +128,11 @@ public class PayWorkingGroupSubItem implements Serializable {
@DecimalMax(value = "9999999999.99",message = "实收金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal paidAmount;
@ApiModelProperty(value = "确认到账金额(元)")
@DecimalMax(value = "9999999999.99",message = "确认到账金额(元)格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal confirmAmount;
/**来款用途(字典表)*/
// @Excel(name = "来款用途", width = 15,dicCode="payment_charge_use")
@ApiModelProperty(value = "来款用途(字典表)")
@@ -34,8 +34,8 @@ public class AllProjectStatistics {
@ApiModelProperty(value = "开票金额")
private String billMoney;
@Excel(name = "确认金额", width = 15)
@ApiModelProperty(value = "确认金额")
@Excel(name = "确认到账金额", width = 15)
@ApiModelProperty(value = "确认到账金额")
private String confirmAmount;
@ApiModelProperty(value = "来款用途编码")
@@ -30,8 +30,8 @@ public class CompanyComeMoneyDetail {
@ApiModelProperty(value = "开票金额")
private String billMoney;
@Excel(name = "确认金额", width = 15)
@ApiModelProperty(value = "确认金额")
@Excel(name = "确认到账金额", width = 15)
@ApiModelProperty(value = "确认到账金额")
private String confirmAmount;
@ApiModelProperty(value = "来款用途编码")
@@ -30,8 +30,8 @@ public class CompanyComeMoneyList {
@ApiModelProperty(value = "开票金额")
private String billMoney;
@Excel(name = "确认金额", width = 15)
@ApiModelProperty(value = "确认金额")
@Excel(name = "确认到账金额", width = 15)
@ApiModelProperty(value = "确认到账金额")
private String confirmAmount;
@Excel(name = "到账率", width = 15)
@@ -36,8 +36,8 @@ public class PrincipalPeopleDetail {
@ApiModelProperty(value = "开票金额")
private String billMoney;
@Excel(name = "确认金额", width = 15)
@ApiModelProperty(value = "确认金额")
@Excel(name = "确认到账金额", width = 15)
@ApiModelProperty(value = "确认到账金额")
private String confirmAmount;
@ApiModelProperty(value = "打包")
@@ -30,8 +30,8 @@ public class PrincipalPeopleList {
@ApiModelProperty(value = "开票金额")
private String billMoney;
@Excel(name = "确认金额", width = 15)
@ApiModelProperty(value = "确认金额")
@Excel(name = "确认到账金额", width = 15)
@ApiModelProperty(value = "确认到账金额")
private String confirmAmount;
@Excel(name = "个人完成率", width = 15)