wanglang 2 тижнів тому
батько
коміт
8c883ed481

+ 4 - 1
trade-admin/src/main/java/com/trade/admin/business/separateaccounts/service/impl/BSeparateAccountsServiceImpl.java

@@ -13,6 +13,7 @@ import com.trade.admin.business.separateaccounts.dto.SubmitSeparateAccountsDto;
 import com.trade.admin.business.separateaccounts.service.BSeparateAccountsService;
 import com.trade.admin.business.separateaccounts.vo.SeparateAccountsDetailVo;
 import com.trade.admin.business.separateaccounts.vo.SeparateAccountsSubmitVo;
+import com.trade.admin.finance.disbursement.service.impl.BBillingDisbursementServiceImpl;
 import com.trade.admin.finance.paymentcollection.dto.BankAccountDto;
 import com.trade.admin.system.security.utils.SecurityUtils;
 import com.trade.common.core.page.GridPage;
@@ -76,6 +77,8 @@ public class BSeparateAccountsServiceImpl implements BSeparateAccountsService {
     private SeparateAccountsService separateAccountsService;
     @Resource
     private BusinessRelateFileBaseService businessRelateFileBaseService;
+    @Resource
+    private BBillingDisbursementServiceImpl bBillingDisbursementService;
 
     @Override
     public boolean saveSeparateAccounts(BillingIncome income, String operator) {
@@ -131,7 +134,7 @@ public class BSeparateAccountsServiceImpl implements BSeparateAccountsService {
             separateAccountsInfoService.save(separateAccountsInfo);
             // paymentBasicService.savePaymentBasic(separateAccounts, separateAccountsInfo, userNickName);
             // 业务变更 直接生成出账记录
-
+            bBillingDisbursementService.saveBillingDisbursement(separateAccounts, separateAccountsInfo, userNickName);
         }
         PaymentCollectionOperate paymentCollectionOperate = paymentCollectionOperateService
                 .getBusinessInfo(separateAccounts.getId(), 3);

+ 6 - 0
trade-admin/src/main/java/com/trade/admin/finance/disbursement/dto/ConfirmedDisbursementDto.java

@@ -2,6 +2,7 @@ package com.trade.admin.finance.disbursement.dto;
 
 import java.time.LocalDate;
 
+import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 
 import org.springframework.format.annotation.DateTimeFormat;
@@ -30,6 +31,11 @@ public class ConfirmedDisbursementDto {
     @ApiModelProperty(name = "paymentDate", value = "付款日期")
     @NotNull(message = "付款日期不能为空")
     private LocalDate paymentDate;
+    @ApiModelProperty(name = "voucherNo", value = "凭证号")
+    private String voucherNo;
+    @ApiModelProperty(name = "accountNumber", value = "付款银行账号")
+    @NotEmpty(message = "付款银行账号不能为空")
+    private String accountNumber;
     @ApiModelProperty(name = "fileId", value = "文件id")
     private Long fileId;
     @ApiModelProperty(name = "remark", value = "备注")

+ 23 - 0
trade-admin/src/main/java/com/trade/admin/finance/disbursement/service/BBillingDisbursementService.java

@@ -5,6 +5,8 @@ import com.trade.admin.business.payment.domain.PaymentBasicInfo;
 import com.trade.admin.finance.disbursement.dto.ConfirmedDisbursementDto;
 import com.trade.admin.finance.disbursement.vo.BillingDisbursementDetail;
 import com.trade.common.core.page.GridPage;
+import com.trade.service.business.separateaccounts.domain.SeparateAccounts;
+import com.trade.service.business.separateaccounts.domain.SeparateAccountsInfo;
 import com.trade.service.finance.disbursement.dto.DisbursementSearchDto;
 import com.trade.service.finance.disbursement.vo.BillingDisbursementPageVo;
 
@@ -24,6 +26,7 @@ public interface BBillingDisbursementService {
      * @param operator
      * @return boolean
      */
+    @Deprecated
     boolean saveDisbursement(PaymentBasic paymentBasic, PaymentBasicInfo paymentBasicInfo, String operator);
 
     /**
@@ -46,5 +49,25 @@ public interface BBillingDisbursementService {
      * @param id
      * @return BillingDisbursementDetail
      */
+    @Deprecated
     BillingDisbursementDetail queryDetail(Long id);
+
+    /**
+     * 查询详情
+     *
+     * @param id
+     * @return BillingDisbursementDetail
+     */
+    BillingDisbursementDetail queryDetailV2(Long id);
+
+    /**
+     * 保存出账信息
+     *
+     * @param separateAccounts
+     * @param separateAccountsInfo
+     * @param operator
+     * @return boolean
+     */
+    boolean saveBillingDisbursement(SeparateAccounts separateAccounts, SeparateAccountsInfo separateAccountsInfo,
+                             String operator);
 }

+ 55 - 0
trade-admin/src/main/java/com/trade/admin/finance/disbursement/service/impl/BBillingDisbursementServiceImpl.java

@@ -12,6 +12,8 @@ import com.trade.admin.system.security.utils.SecurityUtils;
 import com.trade.common.core.page.GridPage;
 import com.trade.common.exception.ServiceException;
 import com.trade.common.utils.bean.BeanCopyUtils;
+import com.trade.common.utils.uuid.BizNoUtil;
+import com.trade.service.business.separateaccounts.domain.SeparateAccounts;
 import com.trade.service.business.separateaccounts.domain.SeparateAccountsInfo;
 import com.trade.service.business.separateaccounts.service.SeparateAccountsInfoService;
 import com.trade.service.filestorage.entity.BusinessRelateFile;
@@ -22,6 +24,7 @@ import com.trade.service.finance.disbursement.domain.BillingDisbursement;
 import com.trade.service.finance.disbursement.dto.DisbursementSearchDto;
 import com.trade.service.finance.disbursement.service.BillingDisbursementService;
 import com.trade.service.finance.disbursement.vo.BillingDisbursementPageVo;
+import com.trade.service.finance.paymentcollection.domain.BillingIncomeInfo;
 import com.trade.service.finance.paymentcollection.domain.PaymentCollectionOperate;
 import com.trade.service.finance.paymentcollection.service.PaymentCollectionOperateService;
 import org.springframework.stereotype.Service;
@@ -85,6 +88,9 @@ public class BBillingDisbursementServiceImpl implements BBillingDisbursementServ
         }
         String userNickName = SecurityUtils.getUserNickName();
         disbursement.setTransactionNumber(confirmedDisbursementDto.getTransactionNumber());
+        disbursement.setPaymentDate(confirmedDisbursementDto.getPaymentDate());
+        disbursement.setVoucherNo(confirmedDisbursementDto.getVoucherNo());
+        disbursement.setAccountNumber(confirmedDisbursementDto.getAccountNumber());
         PaymentCollectionOperate paymentCollectionOperate = paymentCollectionOperateService
                 .getBusinessInfo(disbursement.getId(), 2);
         if (paymentCollectionOperate != null) {
@@ -108,6 +114,7 @@ public class BBillingDisbursementServiceImpl implements BBillingDisbursementServ
             businessRelateFile.setFileType(FileTypeEnum.DISBURSEMENT_ENTRY.getCode());
             businessRelateFileBaseService.addBusinessRelateFiles(Collections.singletonList(businessRelateFile));
         }
+        disbursement.setStatus(BillingConstant.DISBURSEMENT_STATUS_CONFIRMED);
         return billingDisbursementService.save(disbursement);
     }
 
@@ -147,4 +154,52 @@ public class BBillingDisbursementServiceImpl implements BBillingDisbursementServ
         }
         return billingDisbursementDetail;
     }
+
+    @Override
+    public BillingDisbursementDetail queryDetailV2(Long id) {
+        BillingDisbursement billingDisbursement = billingDisbursementService.getById(id);
+        if (billingDisbursement == null) {
+            throw new ServiceException("出账记录不存在");
+        }
+        BillingDisbursementDetail billingDisbursementDetail = new BillingDisbursementDetail();
+        billingDisbursementDetail.setBillingDisbursement(billingDisbursement);
+        businessRelateFileBaseService.fillBizObjFiles(billingDisbursementDetail, billingDisbursement.getId(),
+                BillingConstant.PAYMENT_VOUCHER, FileTypeEnum.DISBURSEMENT_ENTRY.getCode());
+        PaymentCollectionOperate paymentCollectionOperate = paymentCollectionOperateService
+                .getBusinessInfo(billingDisbursement.getId(), 2);
+        billingDisbursementDetail.setPaymentCollectionOperate(paymentCollectionOperate);
+        SeparateAccountsInfo separateAccountsInfo = separateAccountsInfoService
+                .getById(billingDisbursement.getSeparateAccountsInfoId());
+        if (separateAccountsInfo != null) {
+            BankAccountDto receivePaymentAccount = new BankAccountDto();
+            receivePaymentAccount.setAccountNumber(separateAccountsInfo.getAccountNumber());
+            receivePaymentAccount.setAccountName(separateAccountsInfo.getAccountName());
+            receivePaymentAccount.setOpeningBank(separateAccountsInfo.getOpeningBank());
+            billingDisbursementDetail.setPaymentAccount(receivePaymentAccount);
+        }
+        return billingDisbursementDetail;
+    }
+
+    @Override
+    public boolean saveBillingDisbursement(SeparateAccounts separateAccounts, SeparateAccountsInfo separateAccountsInfo,
+            String operator) {
+        BillingDisbursement billingDisbursement = BeanCopyUtils.copy(separateAccounts, BillingDisbursement.class);
+        billingDisbursement.setId(null);
+        billingDisbursement.setSeparateAccountsInfoId(separateAccountsInfo.getId());
+        billingDisbursement.setEntryBusinessNumber(separateAccounts.getBusinessNumber());
+        billingDisbursement.setPaymentAmount(separateAccountsInfo.getLedgerAmount());
+        billingDisbursement.setPaymentCurrency(separateAccountsInfo.getLedgerCurrency());
+        // billingDisbursement.setPaymentDate(paymentBasicInfo.getPaymentDate());
+        billingDisbursement.setStatus(BillingConstant.DISBURSEMENT_STATUS_UNCONFIRMED);
+        billingDisbursement.setPaymentType(separateAccountsInfo.getLedgerType());
+        billingDisbursement
+                .setBusinessNumber(BizNoUtil.generateBusinessNumber(separateAccounts.getBusinessNumber(), 2));
+        billingDisbursementService.save(billingDisbursement);
+        PaymentCollectionOperate paymentCollectionOperate = new PaymentCollectionOperate(billingDisbursement.getId(),
+                2);
+        paymentCollectionOperate.setApplicant(operator);
+        paymentCollectionOperate.setApplyDate(LocalDateTime.now());
+        paymentCollectionOperateService.save(paymentCollectionOperate);
+        return true;
+    }
 }

+ 1 - 1
trade-admin/src/main/java/com/trade/admin/finance/paymentcollection/controller/BPaymentCollectionController.java

@@ -170,6 +170,6 @@ public class BPaymentCollectionController {
     @GetMapping("/get/disbursementDetail")
     @PreAuthorize("@ss.hasPermi('paymentCollection:disbursement:detail')")
     public ResponseResult<BillingDisbursementDetail> getDisbursementDetail(Long id) {
-        return ResponseResult.success(billingDisbursementService.queryDetail(id));
+        return ResponseResult.success(billingDisbursementService.queryDetailV2(id));
     }
 }

+ 3 - 0
trade-admin/src/main/java/com/trade/admin/finance/paymentcollection/dto/BillingIncomeInfoDto.java

@@ -37,4 +37,7 @@ public class BillingIncomeInfoDto {
      */
     @ApiModelProperty(name = "fileId", value = "结汇凭证附件")
     private Long fileId;
+
+    @ApiModelProperty(name = "remark", value = "备注")
+    private String remark;
 }

+ 6 - 0
trade-admin/src/main/java/com/trade/admin/finance/paymentcollection/service/impl/BPaymentCollectionServiceImpl.java

@@ -261,6 +261,12 @@ public class BPaymentCollectionServiceImpl implements BPaymentCollectionService
             billingIncomeInfo.setVoucherNo(billingIncomeInfoDto.getVoucherNo());
             billingIncomeInfoService.updateById(billingIncomeInfo);
         }
+        String userNickName = SecurityUtils.getUserNickName();
+        PaymentCollectionOperate paymentCollectionOperate = new PaymentCollectionOperate(income.getId(), 11);
+        paymentCollectionOperate.setReviewDate(LocalDateTime.now());
+        paymentCollectionOperate.setReviewer(userNickName);
+        paymentCollectionOperate.setReviewRemark(billingIncomeInfoDto.getRemark());
+        paymentCollectionOperateService.save(paymentCollectionOperate);
         return true;
     }
 }

+ 8 - 0
trade-service/src/main/java/com/trade/service/finance/disbursement/domain/BillingDisbursement.java

@@ -16,6 +16,7 @@ import lombok.EqualsAndHashCode;
 
 import org.springframework.format.annotation.DateTimeFormat;
 
+import javax.validation.constraints.NotEmpty;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 
@@ -35,6 +36,8 @@ public class BillingDisbursement extends BizBaseEntity {
     private Long customerUserId;
     @ApiModelProperty(name = "paymentBasicId", value = "支付基础表id")
     private Long paymentBasicId;
+    @ApiModelProperty(name = "separateAccountsInfoId", value = "分账信息主表id")
+    private Long separateAccountsInfoId;
     @ApiModelProperty(name = "businessNumber", value = "业务编号")
     private String businessNumber;
     @ApiModelProperty(name = "salesContractNo", value = "合同编号")
@@ -71,4 +74,9 @@ public class BillingDisbursement extends BizBaseEntity {
     private String payeeType;
     @ApiModelProperty(name = "source", value = "来源1B端2C端")
     private Integer source;
+    @ApiModelProperty(name = "voucherNo", value = "凭证号")
+    private String voucherNo;
+    @ApiModelProperty(name = "accountNumber", value = "付款银行账号")
+    @NotEmpty(message = "付款银行账号不能为空")
+    private String accountNumber;
 }

+ 1 - 1
trade-service/src/main/java/com/trade/service/finance/paymentcollection/domain/PaymentCollectionOperate.java

@@ -32,7 +32,7 @@ public class PaymentCollectionOperate extends BizBaseEntity {
     private LocalDateTime applyDate;
     @ApiModelProperty(name = "businessId", value = "出入账表id")
     private Long businessId;
-    @ApiModelProperty(name = "businessType", value = "业务类型1入账2出账3分账4支付")
+    @ApiModelProperty(name = "businessType", value = "业务类型1入账2出账3分账4支付11入账操作记录")
     private Integer businessType;
     @ApiModelProperty(name = "applicantRemark", value = "申请人备注")
     private String applicantRemark;

+ 5 - 1
trade-service/src/main/resources/mapper/finance/disbursement/BillingDisbursementMapper.xml

@@ -26,6 +26,9 @@
         <id column="entry_business_number" property="transactionNumber"/>
         <id column="payee_type" property="payeeType"/>
         <id column="source" property="source"/>
+        <id column="separate_accounts_info_id" property="separateAccountsInfoId"/>
+        <id column="voucher_no" property="voucherNo"/>
+        <id column="account_number" property="accountNumber"/>
     </resultMap>
 
     <resultMap id="PageResultMap" type="com.trade.service.finance.disbursement.vo.BillingDisbursementPageVo">
@@ -52,7 +55,8 @@
     </resultMap>
     <sql id="Base_Column_List">
         id
-        , customer_user_id, payment_basic_id, business_number, entry_business_number, sales_contract_no, contract_name, importer_cert_no, importer_enterprise_name, agency_cert_no, agency_enterprise_name, financier_identifier, payment_type, status, transaction_number, payment_amount, payment_currency, payment_date, payee_type, source, deleted, gmt_create, gmt_modified
+        , voucher_no, account_number
+        , customer_user_id, payment_basic_id, separate_accounts_info_id, business_number, entry_business_number, sales_contract_no, contract_name, importer_cert_no, importer_enterprise_name, agency_cert_no, agency_enterprise_name, financier_identifier, payment_type, status, transaction_number, payment_amount, payment_currency, payment_date, payee_type, source, deleted, gmt_create, gmt_modified
     </sql>
     <select id="selectByPage"
             resultMap="PageResultMap"