添加阶段
This commit is contained in:
+2
-2
@@ -59,8 +59,8 @@ public class PayPaymentRecordController extends JeroController<PayPaymentRecord,
|
||||
@ApiOperation(value="添加阶段", notes="添加阶段")
|
||||
@PostMapping(value = "/addPhase")
|
||||
public Result<?> addPhase(@RequestBody PayPaymentRecord payPaymentRecord) {
|
||||
payPaymentRecordService.addPhase(payPaymentRecord);
|
||||
return Result.OK("添加成功!");
|
||||
return payPaymentRecordService.addPhase(payPaymentRecord);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+15
-5
@@ -7,7 +7,9 @@
|
||||
<!-- 普通项目-->
|
||||
select c.id,c.charge_project, c.charge_use, c.principal_id,c.principal_name,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
|
||||
from pay_common_project c
|
||||
where c.receivable_amount <![CDATA[>]]> c.paid_amount
|
||||
where
|
||||
(c.receivable_amount <![CDATA[>]]> c.paid_amount
|
||||
or c.paid_amount is null)
|
||||
<if test="payCommonProject.principalId != null and payCommonProject.principalId != ''">
|
||||
AND c.principal_id = #{payCommonProject.principalId}
|
||||
</if>
|
||||
@@ -22,7 +24,9 @@
|
||||
select gsub.id,g.working_group_project, gsub.charge_use, g.principal_id_a,g.principal_name_a,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
|
||||
from pay_working_group g
|
||||
left join pay_working_group_subitem gsub on g.id = gsub.charge_company_id
|
||||
where gsub.receivable_amount <![CDATA[>]]> gsub.paid_amount
|
||||
where
|
||||
(gsub.receivable_amount <![CDATA[>]]> gsub.paid_amount
|
||||
or gsub.paid_amount is null)
|
||||
<if test="payCommonProject.principalId != null and payCommonProject.principalId != ''">
|
||||
AND g.principal_id_a = #{payCommonProject.principalId}
|
||||
</if>
|
||||
@@ -37,7 +41,9 @@
|
||||
select sit.id,meeting.meeting_name,sit.charge_use, meeting.director_id, meeting.director_name,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
|
||||
from pay_meeting meeting
|
||||
left join pay_meeting_situation sit on meeting.id = sit.meeting_id
|
||||
where sit.amount_receivable <![CDATA[>]]> sit.paid_amount
|
||||
where
|
||||
(sit.amount_receivable <![CDATA[>]]> sit.paid_amount
|
||||
or sit.paid_amount is null)
|
||||
<if test="payCommonProject.principalId != null and payCommonProject.principalId != ''">
|
||||
AND meeting.director_id = #{payCommonProject.principalId}
|
||||
</if>
|
||||
@@ -52,7 +58,9 @@
|
||||
select msub.id,member.project_name,msub.charge_use,member.director_id,member.director_name,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
|
||||
from pay_member_project member
|
||||
left join pay_member_project_subitem msub on member.id=msub.project_id
|
||||
where msub.amount_receivable <![CDATA[>]]> msub.paid_amount
|
||||
where
|
||||
(msub.amount_receivable <![CDATA[>]]> msub.paid_amount
|
||||
or msub.paid_amount is null)
|
||||
<if test="payCommonProject.principalId != null and payCommonProject.principalId != ''">
|
||||
AND member.director_id = #{payCommonProject.principalId}
|
||||
</if>
|
||||
@@ -67,7 +75,9 @@
|
||||
select tmsub.id,tmember.project_name,tmsub.charge_use,'','',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
|
||||
from tb_member_project tmember
|
||||
left join tb_member_project_subitem tmsub on tmember.id=tmsub.project_id
|
||||
where tmsub.amount_receivable <![CDATA[>]]> tmsub.paid_amount
|
||||
where
|
||||
(tmsub.amount_receivable <![CDATA[>]]> tmsub.paid_amount
|
||||
or tmsub.paid_amount is null)
|
||||
<if test="payCommonProject.chargeProject != null and payCommonProject.chargeProject != ''">
|
||||
AND tmember.project_name = #{payCommonProject.chargeProject}
|
||||
</if>
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package com.jero.payment.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.payment.entity.PayPaymentRecord;
|
||||
import com.jero.project.entity.PayCommonProject;
|
||||
|
||||
@@ -27,5 +28,5 @@ public interface IPayPaymentRecordService extends IService<PayPaymentRecord> {
|
||||
* 添加阶段
|
||||
* @param payPaymentRecord
|
||||
*/
|
||||
void addPhase(PayPaymentRecord payPaymentRecord);
|
||||
Result<?> addPhase(PayPaymentRecord payPaymentRecord);
|
||||
}
|
||||
|
||||
+22
-4
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.contract.common.PayIncomeContractCommon;
|
||||
import com.jero.payment.entity.PayPaymentRecord;
|
||||
@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -51,10 +53,10 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加阶段
|
||||
* @param payPaymentRecord
|
||||
*/
|
||||
public void addPhase(PayPaymentRecord payPaymentRecord){
|
||||
public Result<?> addPhase(PayPaymentRecord payPaymentRecord){
|
||||
payPaymentRecordMapper.insert(payPaymentRecord);
|
||||
|
||||
//累加主列表实收金额
|
||||
@@ -65,9 +67,24 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
|
||||
PayCommonProject payCommonProject = payCommonProjectMapper.selectById(payPaymentRecord.getProjectId());
|
||||
|
||||
BigDecimal receivableAmount = payCommonProject.getReceivableAmount();//应收
|
||||
Boolean isAdd = isAdd(receivableAmount, payPaymentRecord.getAmountReceived());
|
||||
|
||||
// payCommonProject.setPaidAmount();
|
||||
//是否还能再添加来款
|
||||
Boolean isAdd = isAdd(receivableAmount, payPaymentRecord.getAmountReceived());
|
||||
if(isAdd){
|
||||
BigDecimal paidAmount = payCommonProject.getPaidAmount();//实收
|
||||
|
||||
if(paidAmount == null){
|
||||
paidAmount = new BigDecimal("0");
|
||||
}
|
||||
//累加,四舍五入
|
||||
BigDecimal newPaidAmount = paidAmount.add(payPaymentRecord.getAmountReceived()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
//更新主列表
|
||||
payCommonProject.setPaidAmount(newPaidAmount);
|
||||
payCommonProjectMapper.updateById(payCommonProject);
|
||||
}else{
|
||||
return Result.error("到账金额大于当前欠款金额,不可提交!");
|
||||
}
|
||||
break;
|
||||
|
||||
// 工作组项目
|
||||
@@ -84,6 +101,7 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user