打包管理完善

This commit is contained in:
梁琦涛
2021-09-14 14:15:23 +08:00
parent 09b06363f0
commit fbfab7612d
9 changed files with 95 additions and 62 deletions
@@ -19,6 +19,8 @@ import com.jero.common.util.PasswordUtil;
import com.jero.common.util.ValidUtil;
import com.jero.company.entity.PayContactsManagement;
import com.jero.company.service.IPayContactsManagementService;
import com.jero.mail.entity.PayMailBillProject;
import com.jero.mail.service.IPayMailBillProjectService;
import com.jero.pack.entity.PayPackCompany;
import com.jero.pack.entity.PayPackCompanyProject;
import com.jero.pack.service.IPayPackCompanyProjectService;
@@ -53,6 +55,8 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
private IPayPackCompanyProjectService payPackCompanyProjectService;
@Autowired
private IPayContactsManagementTemporaryService payContactsManagementTemporaryService;
@Autowired
private IPayMailBillProjectService payMailBillProjectService;
/**
* 分页列表查询
@@ -219,6 +223,21 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
}else{
payPackCompany.setReceiptExpense(new BigDecimal("0.00"));
}
if(Objects.isNull(payPackCompany.getPackChargeTotal())){
payPackCompany.setPackChargeTotal(new BigDecimal("0.00"));
}
LambdaQueryWrapper<PayMailBillProject> queryPayMailBillProject = new LambdaQueryWrapper<>();
queryPayMailBillProject.eq(PayMailBillProject::getBillId,id);
List<PayMailBillProject> listPayMailBillProject = payMailBillProjectService.list(queryPayMailBillProject);
if(!CollectionUtils.isEmpty(listPayMailBillProject)){
BigDecimal d = listPayMailBillProject.stream().map(PayMailBillProject::getInvoiceAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
payPackCompany.setInvoiceAmount(d);
payPackCompany.setUninvoicedAmount(payPackCompany.getReceiptExpense().subtract(d));
}else{
payPackCompany.setInvoiceAmount(new BigDecimal("0.00"));
payPackCompany.setUninvoicedAmount(payPackCompany.getReceiptExpense());
}
return Result.OK(payPackCompany);
}
@@ -102,7 +102,7 @@ public class PayPackCompanyProjectController extends JeroController<PayPackCompa
if(Objects.isNull(input.getPackId())){
return Result.error("打包id不能为空");
}
PayPackCompany payPackCompany = payPackCompanyService.getById(input.getPackId());
PayPackCompany payPackCompany = payPackCompanyService.getById(input.getPackId());
if(Objects.isNull(payPackCompany)){
return Result.error("打包企业不存在");
}
@@ -81,6 +81,7 @@ public class PayPackCompany implements Serializable {
@Excel(name = "打包费用总计", width = 15)
@ApiModelProperty(value = "打包费用总计")
@DecimalMax(value = "9999999999.99",message = "打包费用总计格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal packChargeTotal;
/**打包费用备注*/
// @Excel(name = "打包费用备注", width = 15)
@@ -93,17 +94,20 @@ public class PayPackCompany implements Serializable {
/**实际到账费用*/
@Excel(name = "实际到账费用", width = 15)
@ApiModelProperty(value = "实际到账费用")
@DecimalMax(value = "9999999999.99",message = "实际到账费用总计格式错误")
@DecimalMax(value = "9999999999.99",message = "实际到账费用格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal receiptExpense;
/**开票金额*/
// @Excel(name = "开票金额", width = 15)
@ApiModelProperty(value = "开票金额")
@DecimalMax(value = "9999999999.99",message = "开票金额总计格式错误")
@DecimalMax(value = "9999999999.99",message = "开票金额格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal invoiceAmount;
/**未开票金额*/
// @Excel(name = "未开票金额", width = 15)
@ApiModelProperty(value = "未开票金额")
@DecimalMax(value = "9999999999.99",message = "未开票金额总计格式错误")
@DecimalMax(value = "9999999999.99",message = "未开票金额格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal uninvoicedAmount;
/**创建人*/
@ApiModelProperty(value = "创建人")
@@ -2,60 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.pack.mapper.PayPackCompanyMapper">
<select id="queryPackListCount" resultType="com.jero.project.entity.PayCommonProject">
SELECT
sum(paid_amount) as paid_amount
FROM (
<!-- 普通项目-->
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>
<if test="companyId != null and companyId != ''">
AND c.charge_company_id = #{companyId}
</if>
</where>
<!--工作组项目-->
UNION ALL
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
inner join pay_working_group_subitem gsub on g.id = gsub.working_group_id
<where>
<if test="companyId != null and companyId != ''">
AND gsub.charge_company_id = #{companyId}
</if>
</where>
<!-- 会议项目-->
UNION ALL
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
inner join pay_meeting_situation sit on meeting.id = sit.meeting_id
<where>
<if test="companyId != null and companyId != ''">
AND sit.company_id = #{companyId}
</if>
</where>
<!-- 会员项目-->
UNION ALL
select msub.id,pmp.project_name,msub.charge_use,pmp.director_id,pmp.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 pmp
inner join pay_member_project_subitem msub on pmp.id=msub.project_id
<where>
<if test="companyId != null and companyId != ''">
AND msub.company_id = #{companyId}
</if>
</where>
<!-- 标协会员项目-->
UNION ALL
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
inner join tb_member_project_subitem tmsub on tmember.id=tmsub.project_id
<where>
<if test="companyId != null and companyId != ''">
AND tmsub.company_id = #{companyId}
</if>
</where>
) project
<if test="packId != null and packId != ''">
WHERE project.id NOT IN (SELECT project_id FROM pay_pack_company_project where pack_id = #{packId})
</if>
SELECT sum(ppr.amount_received) AS paid_amount FROM pay_pack_company_project ppcp
LEFT JOIN pay_payment_record ppr ON ppcp.project_id = ppr.project_id
WHERE ppcp.pack_id = #{packId}
</select>
</mapper>