打包管理完善

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
@@ -120,6 +120,13 @@ public class HuaWeiSmsUtil {
templateId = "077964a02a814149bb01900e43c9a04e";
codeTime = "0";
break;
case "5":
//中汽标协-合同分期到期通知提醒
sender = "8821062807762";
signature = "中汽标协";
templateId = "077964a02a814149bb01900e43c9a04e";
codeTime = "0";
break;
default:
throw new JeroBootException("codeType flase.");
}
@@ -1,5 +1,8 @@
package com.jero.contract.common;
import cn.hutool.crypto.asymmetric.KeyType;
import cn.hutool.crypto.asymmetric.RSA;
import java.util.Arrays;
import java.util.List;
@@ -92,4 +95,18 @@ public class PayIncomeContractCommon {
*/
public final static Integer COME2 = 2;
public static void main(String[] args) {
}
/**
* RSA 使用公钥加密token
* @param RSAPublicKey 公钥
* @return String 加密后的字符串
*/
public static String encryptByRsaPriKey(String token,String RSAPublicKey) {
RSA rsa = new RSA(null, RSAPublicKey);
byte[] encrypt = rsa.encrypt(token, KeyType.PublicKey);
return new String(encrypt);
}
}
@@ -1,10 +1,14 @@
package com.jero.contract.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.util.HuaWeiSmsUtil;
import com.jero.common.util.PasswordUtil;
import com.jero.contract.entity.PayIncomeContractInstallment;
import com.jero.contract.mapper.PayIncomeContractInstallmentMapper;
import com.jero.contract.service.IPayIncomeContractInstallmentService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -20,12 +24,19 @@ import java.util.List;
public class PayIncomeContractInstallmentServiceImpl extends ServiceImpl<PayIncomeContractInstallmentMapper, PayIncomeContractInstallment> implements IPayIncomeContractInstallmentService {
@Resource
private PayIncomeContractInstallmentMapper payIncomeContractInstallmentMapper;
@Autowired
private HuaWeiSmsUtil huaWeiSmsUtil;
@Override
public void sendSMSIncomeContract() {
List<PayIncomeContractInstallment> list = payIncomeContractInstallmentMapper.getIncomeContract();
if(!CollectionUtils.isEmpty(list)){
// todo 发送短信
}
list.forEach(p->{
if(!StringUtils.isBlank(p.getPhone())){
String phone = PasswordUtil.decrypt(p.getPhone());
String msg = "中汽数据中心提醒您,贵公司与中汽数据签订的" + p.getContractName() + "合同" + p.getPhaseName()
+ "期款项时间即将到达,汇款金额" + p.getAccountsReceivableAmount() + "元,请及时汇款,如已经汇款,请忽略此条通知。谢谢合作";
// huaWeiSmsUtil.sendVerificationCode(phone,"5","60",msg);
}
});
}
}
@@ -1,10 +1,14 @@
package com.jero.contract.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.util.HuaWeiSmsUtil;
import com.jero.common.util.PasswordUtil;
import com.jero.contract.entity.PaySpendingContractInstallment;
import com.jero.contract.mapper.PaySpendingContractInstallmentMapper;
import com.jero.contract.service.IPaySpendingContractInstallmentService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -19,6 +23,9 @@ import java.util.List;
@Service
public class PaySpendingContractInstallmentServiceImpl extends ServiceImpl<PaySpendingContractInstallmentMapper, PaySpendingContractInstallment> implements IPaySpendingContractInstallmentService {
@Autowired
private HuaWeiSmsUtil huaWeiSmsUtil;
@Resource
private PaySpendingContractInstallmentMapper paySpendingContractInstallmentMapper;
@Override
@@ -26,6 +33,15 @@ public class PaySpendingContractInstallmentServiceImpl extends ServiceImpl<PaySp
List<PaySpendingContractInstallment> list = paySpendingContractInstallmentMapper.getSpendingContract();
if(!CollectionUtils.isEmpty(list)){
// todo 发短信
list.forEach(p->{
if(!StringUtils.isBlank(p.getPhone())){
String phone = PasswordUtil.decrypt(p.getPhone());
String msg = "中汽数据中心提醒您,贵公司与中汽数据签订的" + p.getContractName() + "合同" + p.getPhaseName()
+ "期款项时间即将到达,汇款金额" + p.getAccountsReceivableAmount() + "元,请及时汇款,如已经汇款,请忽略此条通知。谢谢合作";
// huaWeiSmsUtil.sendVerificationCode(phone,"5","60",msg);
}
});
}
}
}
@@ -1,9 +1,12 @@
package com.jero.mail.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
@@ -11,6 +14,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.DecimalMax;
/**
* @Description: pay_mail_bill_project
* @Author: jeecg-boot
@@ -41,4 +46,10 @@ public class PayMailBillProject implements Serializable {
@Excel(name = "项目类型", width = 15)
@ApiModelProperty(value = "项目类型")
private java.lang.Integer projectType;
/**开票金额*/
@Excel(name = "开票金额", width = 15)
@ApiModelProperty(value = "开票金额")
@DecimalMax(value = "9999999999.99",message = "开票金额格式错误")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal invoiceAmount;
}
@@ -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>