feat(api): TaxCalculator 도메인 + PaymentService 세금 통합 + AgentService 세무 매핑 (도메인 P0-1-c)
P0-1 세무 처리 마무리. ga-batch 정산 step 통합은 도메인 P0 마무리 단계.
TaxCalculator (신규, ga-api/service/tax):
- @Component pure function: TaxBreakdown calculate(amount, taxType, vatType)
- record TaxBreakdown {incomeTax, localTax, vat, netAmount}
- 세율은 SystemConfigService로 외부화 (TAX_RATE_BUSINESS_INCOME 등)
- 공식:
- incomeTax = amount × incomeRate / 100 (ROUND_HALF_UP, scale 0)
- localTax = incomeTax × localRate / 100
- vat = (TAXABLE) ? amount × vatRate / 100 : 0
- netAmount = amount - incomeTax - localTax + vat
PaymentService:
- calculateTaxes(paymentId) — 단건 재계산 @Transactional
- calculateTaxesForMonth(settleMonth) — 월별 일괄 @Transactional + batch update
PaymentMapper (ga-core):
- updateTaxes / updateTaxesBatch / selectBySettleMonth 추가
AgentService.toVO():
- taxType/vatType/businessNo 매핑 + default 처리
- 사업소득자인데 businessNo 미입력 시 경고 로그
PaymentController:
- POST /api/payments/{id}/calculate-tax (@RequirePermission, @DataChangeLog)
- POST /api/payments/calculate-taxes?settleMonth=YYYYMM
This commit is contained in:
@@ -6,6 +6,7 @@ import com.ga.core.vo.settle.SettleSearchParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@@ -19,7 +20,14 @@ public interface PaymentMapper {
|
||||
@Param("failReason") String failReason);
|
||||
int updateTransferFile(@Param("paymentIds") List<Long> paymentIds,
|
||||
@Param("transferFileId") Long transferFileId);
|
||||
int updateTaxes(@Param("paymentId") Long paymentId,
|
||||
@Param("incomeTaxAmount") BigDecimal incomeTaxAmount,
|
||||
@Param("localTaxAmount") BigDecimal localTaxAmount,
|
||||
@Param("vatAmount") BigDecimal vatAmount,
|
||||
@Param("netAmount") BigDecimal netAmount);
|
||||
int updateTaxesBatch(@Param("list") List<PaymentVO> list);
|
||||
|
||||
List<PaymentVO> selectPendingByMonthAndBank(@Param("settleMonth") String settleMonth,
|
||||
@Param("bankCode") String bankCode);
|
||||
List<PaymentVO> selectBySettleMonth(@Param("settleMonth") String settleMonth);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user