mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 21:32:07 +08:00
1、发票抬头管理纳税号修正为统一信用代码,只有企业发票才检查唯一和非空;2、产品购买纯第三方支付补充生成收支记录;
This commit is contained in:
+7
@@ -4,6 +4,7 @@ package com.cf.imes.framework.common.util.Assert;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -72,6 +73,12 @@ public class AssertUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void notEmpty(String str, ErrorCode errorCode) {
|
||||||
|
if (StringUtils.isEmpty(str)) {
|
||||||
|
throw exception(errorCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void notEquals(Object obj1, Object obj2, ErrorCode errorCode) {
|
public static void notEquals(Object obj1, Object obj2, ErrorCode errorCode) {
|
||||||
if (ObjectUtil.notEqual(obj1, obj2)) {
|
if (ObjectUtil.notEqual(obj1, obj2)) {
|
||||||
throw exception(errorCode);
|
throw exception(errorCode);
|
||||||
|
|||||||
+2
-1
@@ -441,9 +441,10 @@ public class ErrorCodeConstants {
|
|||||||
public static final ErrorCode ORG_INVOICE_PURCHASE_RECORD_UPDATE_NUM_NOT_MATCH_ERROR = new ErrorCode(1_002_043_029, "当前勾选的购买记录中部分可能已开票,请查询后重新勾选提交开票");
|
public static final ErrorCode ORG_INVOICE_PURCHASE_RECORD_UPDATE_NUM_NOT_MATCH_ERROR = new ErrorCode(1_002_043_029, "当前勾选的购买记录中部分可能已开票,请查询后重新勾选提交开票");
|
||||||
public static final ErrorCode ORG_INVOICE_AGREE_FILE_NULL_ERROR = new ErrorCode(1_002_043_030, "确认开票发票附件不能为空,请上传后再提交");
|
public static final ErrorCode ORG_INVOICE_AGREE_FILE_NULL_ERROR = new ErrorCode(1_002_043_030, "确认开票发票附件不能为空,请上传后再提交");
|
||||||
public static final ErrorCode INVOICE_TITLE_ORG_EXISTS_ERROR = new ErrorCode(1_002_043_031, "组织下已存在发票抬头,请刷新后编辑抬头内容");
|
public static final ErrorCode INVOICE_TITLE_ORG_EXISTS_ERROR = new ErrorCode(1_002_043_031, "组织下已存在发票抬头,请刷新后编辑抬头内容");
|
||||||
public static final ErrorCode INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR = new ErrorCode(1_002_043_032, "纳税人识别号已存在,请检查");
|
public static final ErrorCode INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR = new ErrorCode(1_002_043_032, "统一社会信用代码已存在,请检查");
|
||||||
public static final ErrorCode PRODUCTS_NOT_NOLIST = new ErrorCode(1_002_043_033, "当前产品未上架");
|
public static final ErrorCode PRODUCTS_NOT_NOLIST = new ErrorCode(1_002_043_033, "当前产品未上架");
|
||||||
public static final ErrorCode ORG_PRODUCT_PURCHASE_LOCK_ERROR = new ErrorCode(1_002_043_034, "组织下存在购买中的产品操作,请稍后再试");
|
public static final ErrorCode ORG_PRODUCT_PURCHASE_LOCK_ERROR = new ErrorCode(1_002_043_034, "组织下存在购买中的产品操作,请稍后再试");
|
||||||
|
public static final ErrorCode INVOICE_TITLE_ENTERPRISE_TAXNUMBER_EMPTY_ERROR = new ErrorCode(1_002_043_035, "企业统一信用代码不能为空");
|
||||||
|
|
||||||
//=========== 支付相关 1-002-048-000 ============
|
//=========== 支付相关 1-002-048-000 ============
|
||||||
public static final ErrorCode PAY_CHANNEL_NOT_SUPPORT = new ErrorCode(1_002_048_000, "暂不支持的支付渠道,请使用其他支付渠道");
|
public static final ErrorCode PAY_CHANNEL_NOT_SUPPORT = new ErrorCode(1_002_048_000, "暂不支持的支付渠道,请使用其他支付渠道");
|
||||||
|
|||||||
+2
-2
@@ -28,8 +28,8 @@ public class InvoiceTitleInfo {
|
|||||||
private Integer invoiceType;
|
private Integer invoiceType;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "纳税人识别号")
|
@Schema(description = "统一社会信用代码")
|
||||||
private String taxpayerId;
|
private String taxNumber;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "开户银行名称")
|
@Schema(description = "开户银行名称")
|
||||||
|
|||||||
+3
-4
@@ -38,10 +38,9 @@ public class InvoiceTitleSaveReqVO {
|
|||||||
private Integer invoiceType;
|
private Integer invoiceType;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "纳税人识别号")
|
@Schema(description = "统一社会信用代码")
|
||||||
@NotNull(message = "纳税人识别号不能为空")
|
@Size(max = 20, message = "统一社会信用代码长度不能超过18个字符")
|
||||||
@Size(max = 20, message = "纳税人识别号长度不能超过20个字符")
|
private String taxNumber;
|
||||||
private String taxpayerId;
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "开户银行名称")
|
@Schema(description = "开户银行名称")
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ public class OrganSaveReqVO {
|
|||||||
private Integer grayStatus;
|
private Integer grayStatus;
|
||||||
|
|
||||||
@Schema(description = "产品购买列表")
|
@Schema(description = "产品购买列表")
|
||||||
@Size(max = 10, message = "创建组织时最少需要购买1个产品,最多可购买10个产品")
|
@Size(min = 1, max = 10, message = "创建组织时最少需要购买1个产品", groups = {OrganSaveCreateGroup.class})
|
||||||
@Valid
|
@Valid
|
||||||
private List<OrganCreateProductPurchaseReqVO> productPurchaseReqVOS;
|
private List<OrganCreateProductPurchaseReqVO> productPurchaseReqVOS;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -53,9 +53,9 @@ public class InvoiceTitleInfoDO extends BaseDO {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 纳税人识别号
|
* 统一社会信用代码
|
||||||
*/
|
*/
|
||||||
private String taxpayerId;
|
private String taxNumber;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-12
@@ -34,6 +34,7 @@ import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
|||||||
import com.cf.imes.module.system.dal.mysql.funds.invoice.InvoiceRecordsMapper;
|
import com.cf.imes.module.system.dal.mysql.funds.invoice.InvoiceRecordsMapper;
|
||||||
import com.cf.imes.module.system.dal.mysql.funds.invoice.InvoiceTitleInfoMapper;
|
import com.cf.imes.module.system.dal.mysql.funds.invoice.InvoiceTitleInfoMapper;
|
||||||
import com.cf.imes.module.system.dal.mysql.funds.purchase.PurchaseRecordMapper;
|
import com.cf.imes.module.system.dal.mysql.funds.purchase.PurchaseRecordMapper;
|
||||||
|
import com.cf.imes.module.system.enums.pay.InvoiceIssueTypeEnum;
|
||||||
import com.cf.imes.module.system.enums.pay.InvoiceStatusEnum;
|
import com.cf.imes.module.system.enums.pay.InvoiceStatusEnum;
|
||||||
import com.cf.imes.module.system.enums.pay.TradeTypeEnum;
|
import com.cf.imes.module.system.enums.pay.TradeTypeEnum;
|
||||||
import com.cf.imes.module.system.service.organ.OrganService;
|
import com.cf.imes.module.system.service.organ.OrganService;
|
||||||
@@ -55,8 +56,8 @@ import static com.cf.imes.framework.common.util.json.JsonUtils.parseObject;
|
|||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.zipString;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.zipString;
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_NO_EXIST;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_NO_EXIST;
|
||||||
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_TITLE_ENTERPRISE_TAXNUMBER_EMPTY_ERROR;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_TITLE_NOT_EXISTS_ERROR;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_TITLE_NOT_EXISTS_ERROR;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_TITLE_ORG_EXISTS_ERROR;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_TITLE_ORG_EXISTS_ERROR;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR;
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR;
|
||||||
@@ -103,8 +104,12 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
|
|
||||||
Long id = reqVO.getId();
|
Long id = reqVO.getId();
|
||||||
|
|
||||||
// 校验纳税人识别号和组织id是否唯一
|
Integer issueType = reqVO.getIssueType();
|
||||||
validOrgAndTaxpayerNo(id, organId, reqVO.getTaxpayerId());
|
// 企业发票抬头校验统一社会信用代码非空
|
||||||
|
AssertUtils.notEmpty(InvoiceIssueTypeEnum.ENTERPRISE.getValue().equals(issueType) ? reqVO.getTaxNumber() : "0", INVOICE_TITLE_ENTERPRISE_TAXNUMBER_EMPTY_ERROR);
|
||||||
|
|
||||||
|
// 校验统一社会信用代码和组织id是否唯一
|
||||||
|
validOrgAndTaxpayerNo(id, organId, reqVO.getTaxNumber(), issueType);
|
||||||
|
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
validTitleOrg(id, organId);
|
validTitleOrg(id, organId);
|
||||||
@@ -119,8 +124,8 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
.organId(organId)
|
.organId(organId)
|
||||||
.invoiceTitle(reqVO.getInvoiceTitle())
|
.invoiceTitle(reqVO.getInvoiceTitle())
|
||||||
.invoiceType(reqVO.getInvoiceType())
|
.invoiceType(reqVO.getInvoiceType())
|
||||||
.issueType(reqVO.getIssueType())
|
.issueType(issueType)
|
||||||
.taxpayerId(reqVO.getTaxpayerId())
|
.taxNumber(reqVO.getTaxNumber())
|
||||||
.bankName(reqVO.getBankName())
|
.bankName(reqVO.getBankName())
|
||||||
.bankAccount(reqVO.getBankAccount())
|
.bankAccount(reqVO.getBankAccount())
|
||||||
.registeredAddress(reqVO.getRegisteredAddress())
|
.registeredAddress(reqVO.getRegisteredAddress())
|
||||||
@@ -130,13 +135,14 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验组织和纳税人识别号唯一
|
* 校验组织和统一社会信用代码
|
||||||
*
|
*
|
||||||
* @param id 发票抬头id
|
* @param id 发票抬头id
|
||||||
* @param organId 组织id
|
* @param organId 组织id
|
||||||
* @param taxpayerId 纳税人识别号
|
* @param taxNumber 统一社会信用代码
|
||||||
|
* @param issueType 开具类型
|
||||||
*/
|
*/
|
||||||
private void validOrgAndTaxpayerNo(Long id, Long organId, String taxpayerId) {
|
private void validOrgAndTaxpayerNo(Long id, Long organId, String taxNumber, Integer issueType) {
|
||||||
InvoiceTitleInfoDO exist = invoiceTitleInfoMapper.selectOne(new LambdaQueryWrapperX<InvoiceTitleInfoDO>()
|
InvoiceTitleInfoDO exist = invoiceTitleInfoMapper.selectOne(new LambdaQueryWrapperX<InvoiceTitleInfoDO>()
|
||||||
.neIfPresent(InvoiceTitleInfoDO::getId, id)
|
.neIfPresent(InvoiceTitleInfoDO::getId, id)
|
||||||
.eq(InvoiceTitleInfoDO::getOrganId, organId));
|
.eq(InvoiceTitleInfoDO::getOrganId, organId));
|
||||||
@@ -146,8 +152,9 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
}
|
}
|
||||||
exist = invoiceTitleInfoMapper.selectOne(new LambdaQueryWrapperX<InvoiceTitleInfoDO>()
|
exist = invoiceTitleInfoMapper.selectOne(new LambdaQueryWrapperX<InvoiceTitleInfoDO>()
|
||||||
.neIfPresent(InvoiceTitleInfoDO::getId, id)
|
.neIfPresent(InvoiceTitleInfoDO::getId, id)
|
||||||
.eq(InvoiceTitleInfoDO::getTaxpayerId, taxpayerId));
|
.eq(InvoiceTitleInfoDO::getTaxNumber, taxNumber));
|
||||||
if (ObjectUtil.isNotNull(exist)) {
|
// 开具企业类型发票校验统一社会信用代码
|
||||||
|
if (InvoiceIssueTypeEnum.ENTERPRISE.getValue().equals(issueType) && ObjectUtil.isNotNull(exist)) {
|
||||||
throw new ServiceException(INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR);
|
throw new ServiceException(INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
@@ -643,6 +643,11 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|||||||
if (ObjectUtil.isNotNull(payOrderDO) && ObjectUtil.isNotNull(payOrderDO.getPurchaseId())) {
|
if (ObjectUtil.isNotNull(payOrderDO) && ObjectUtil.isNotNull(payOrderDO.getPurchaseId())) {
|
||||||
Long organId = payOrderDO.getOrganId();
|
Long organId = payOrderDO.getOrganId();
|
||||||
|
|
||||||
|
// 支付订单的金额
|
||||||
|
BigDecimal price = payOrderDO.getPrice();
|
||||||
|
// 订单流水号
|
||||||
|
String payNo = payOrderDO.getPayNo();
|
||||||
|
|
||||||
// 1、更新购买记录的开票状态
|
// 1、更新购买记录的开票状态
|
||||||
long purchaseId = payOrderDO.getPurchaseId();
|
long purchaseId = payOrderDO.getPurchaseId();
|
||||||
purchaseService.updateRecordInvoicable(purchaseId, organId);
|
purchaseService.updateRecordInvoicable(purchaseId, organId);
|
||||||
@@ -658,6 +663,22 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|||||||
|
|
||||||
// 4、激活本次的购买记录
|
// 4、激活本次的购买记录
|
||||||
purchaseService.activateHistoryOrganProductPurchaseRecord(organId, purchaseId);
|
purchaseService.activateHistoryOrganProductPurchaseRecord(organId, purchaseId);
|
||||||
|
|
||||||
|
// 5.如果是纯第三方支付需要新增收支明细
|
||||||
|
Integer paymentMethod = record.getPaymentMethod();
|
||||||
|
if (PayProductChannelCodeEnum.ALIPAY_PC.getCode().equals(paymentMethod) || PayProductChannelCodeEnum.WECHAT_NATIVE.getCode().equals(paymentMethod)) {
|
||||||
|
IncomeExpenseDetailsDO incomeExpenseDetailsDO = IncomeExpenseDetailsDO.builder()
|
||||||
|
.organId(organId)
|
||||||
|
.orderNo(payNo)
|
||||||
|
.businessNo(snowflakeSerialNoWorker3rd.nextSerialNo())
|
||||||
|
.tradeType(TradeTypeEnum.PRODUCT.getCode())
|
||||||
|
.incomeExpenseType(IncomeExpenseTypeEnum.EXPENSES.getCode())
|
||||||
|
.cashAmountChange(price)
|
||||||
|
.build();
|
||||||
|
incomeExpenseDetailsDO.setCreator(payOrderDO.getCreator());
|
||||||
|
incomeExpenseDetailsDO.setUpdater(payOrderDO.getUpdater());
|
||||||
|
incomeExpenseService.createDetail(incomeExpenseDetailsDO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ chenfeng:
|
|||||||
- income_expense_details
|
- income_expense_details
|
||||||
- system_organization_amount
|
- system_organization_amount
|
||||||
- product_delay_record
|
- product_delay_record
|
||||||
|
- invoice_title_info
|
||||||
use-data-code: imes_prod #动态数据源标识,后期添加的数据源需要修改此值
|
use-data-code: imes_prod #动态数据源标识,后期添加的数据源需要修改此值
|
||||||
|
|
||||||
xss:
|
xss:
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ chenfeng:
|
|||||||
- income_expense_details
|
- income_expense_details
|
||||||
- system_organization_amount
|
- system_organization_amount
|
||||||
- product_delay_record
|
- product_delay_record
|
||||||
|
- invoice_title_info
|
||||||
use-data-code: imes_prod #动态数据源标识,后期添加的数据源需要修改此值
|
use-data-code: imes_prod #动态数据源标识,后期添加的数据源需要修改此值
|
||||||
|
|
||||||
env: # 多环境的配置项
|
env: # 多环境的配置项
|
||||||
|
|||||||
Reference in New Issue
Block a user