yzc пре 2 година
родитељ
комит
4b248a1839

+ 11 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountRequestFundsDto.java

@@ -6,6 +6,7 @@ import com.fjhx.file.entity.ObsFile;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
 
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -23,4 +24,14 @@ public class AccountRequestFundsDto extends AccountRequestFunds {
 
 
     private List<ObsFile> fileList;
     private List<ObsFile> fileList;
 
 
+    /**
+     * 预支金额
+     */
+    private BigDecimal advanceAmount;
+
+    /**
+     * 核销金额
+     */
+    private BigDecimal writeOffAmount;
+
 }
 }

+ 4 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/dto/AccountRequestFundsSelectDto.java

@@ -33,5 +33,9 @@ public class AccountRequestFundsSelectDto extends BaseSelectDto {
      */
      */
     private String keyword;
     private String keyword;
 
 
+    /**
+     * 核销状态
+     */
+    private Integer writeOffStatus;
 
 
 }
 }

+ 9 - 3
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRequestFunds.java

@@ -1,12 +1,13 @@
 package com.fjhx.account.entity.account.po;
 package com.fjhx.account.entity.account.po;
 
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.math.BigDecimal;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
 
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 /**
 /**
  * <p>
  * <p>
  * 请款表
  * 请款表
@@ -101,4 +102,9 @@ public class AccountRequestFunds extends BasePo {
      */
      */
     private String currency;
     private String currency;
 
 
+    /**
+     * 核销状态
+     */
+    private Integer writeOffStatus;
+
 }
 }

+ 21 - 10
hx-account/src/main/java/com/fjhx/account/flow/AccountRequestFundsFlow.java

@@ -22,10 +22,12 @@ import com.obs.services.internal.ServiceException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- *  请款流程
+ * 请款流程
+ *
  * @Author:caozj
  * @Author:caozj
  * @DATE:2023/4/3 17:38
  * @DATE:2023/4/3 17:38
  */
  */
@@ -43,7 +45,8 @@ public class AccountRequestFundsFlow extends FlowDelegate {
 
 
     /**
     /**
      * 发起流程
      * 发起流程
-     * @param flowId 流程ID
+     *
+     * @param flowId     流程ID
      * @param submitData 请款表信息
      * @param submitData 请款表信息
      * @return
      * @return
      */
      */
@@ -52,37 +55,38 @@ public class AccountRequestFundsFlow extends FlowDelegate {
 //        DynamicDataSourceContextHolder.push(SourceConstant.ACCOUNT);
 //        DynamicDataSourceContextHolder.push(SourceConstant.ACCOUNT);
         AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
         AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
         AccountRequestFundsDetailService accountRequestFundsDetailService = SpringUtil.getBean(AccountRequestFundsDetailService.class);
         AccountRequestFundsDetailService accountRequestFundsDetailService = SpringUtil.getBean(AccountRequestFundsDetailService.class);
-        AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject( AccountRequestFundsDto.class);
+        AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
         accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
         accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
         //添加请款表的信息
         //添加请款表的信息
         accountRequestFundsService.save(accountRequestFundsDto);
         accountRequestFundsService.save(accountRequestFundsDto);
 
 
         //获取请款详情表的详细信息
         //获取请款详情表的详细信息
         List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
         List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
-        if(CollectionUtils.isNotEmpty(accountRequestFundsDetailList)){
+        if (CollectionUtils.isNotEmpty(accountRequestFundsDetailList)) {
             accountRequestFundsDetailList.forEach(accountRequestFundsDetail -> accountRequestFundsDetail
             accountRequestFundsDetailList.forEach(accountRequestFundsDetail -> accountRequestFundsDetail
                     .setAccountRequestFundsId(accountRequestFundsDto.getId()));
                     .setAccountRequestFundsId(accountRequestFundsDto.getId()));
             //添加请款详情表的信息
             //添加请款详情表的信息
             accountRequestFundsDetailService.saveBatch(accountRequestFundsDetailList);
             accountRequestFundsDetailService.saveBatch(accountRequestFundsDetailList);
         }
         }
         //添加附件信息
         //添加附件信息
-        ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(),accountRequestFundsDto.getId());
+        ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(), accountRequestFundsDto.getId());
         return accountRequestFundsDto.getId();
         return accountRequestFundsDto.getId();
     }
     }
 
 
     /**
     /**
      * 结束流程
      * 结束流程
-     * @param flowId 流程ID
+     *
+     * @param flowId     流程ID
      * @param businessId 业务ID
      * @param businessId 业务ID
-     * @param submitData  请款表信息
+     * @param submitData 请款表信息
      */
      */
     @Override
     @Override
     public void end(Long flowId, Long businessId, JSONObject submitData) {
     public void end(Long flowId, Long businessId, JSONObject submitData) {
         AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
         AccountRequestFundsService accountRequestFundsService = SpringUtil.getBean(AccountRequestFundsService.class);
         //通过业务ID查询申购数据
         //通过业务ID查询申购数据
         AccountRequestFunds accountRequestFunds = accountRequestFundsService.getById(businessId);
         AccountRequestFunds accountRequestFunds = accountRequestFundsService.getById(businessId);
-        AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject( AccountRequestFundsDto.class);
-        if(ObjectUtils.isEmpty(accountRequestFunds)){
+        AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
+        if (ObjectUtils.isEmpty(accountRequestFunds)) {
             throw new ServiceException("请款表的数据不存在");
             throw new ServiceException("请款表的数据不存在");
         }
         }
         //修改申购状态为审批通过
         //修改申购状态为审批通过
@@ -95,7 +99,7 @@ public class AccountRequestFundsFlow extends FlowDelegate {
     /**
     /**
      * 添加打款表的数据
      * 添加打款表的数据
      */
      */
-    private void addPayment(AccountRequestFundsDto accountRequestFundsDto){
+    private void addPayment(AccountRequestFundsDto accountRequestFundsDto) {
         AccountPaymentDto accountPayment = new AccountPaymentDto();
         AccountPaymentDto accountPayment = new AccountPaymentDto();
         accountPayment.setBusinessId(accountRequestFundsDto.getId());
         accountPayment.setBusinessId(accountRequestFundsDto.getId());
         accountPayment.setType(PaymentTypeEnum.UNDER_REVIEW.getKey());
         accountPayment.setType(PaymentTypeEnum.UNDER_REVIEW.getKey());
@@ -115,6 +119,13 @@ public class AccountRequestFundsFlow extends FlowDelegate {
         accountPayment.setCurrency(accountPayment.getCurrency());
         accountPayment.setCurrency(accountPayment.getCurrency());
         accountPayment.setAccountOpening(accountRequestFundsDto.getAccountOpening());
         accountPayment.setAccountOpening(accountRequestFundsDto.getAccountOpening());
         accountPayment.setInterbankNumber(accountPayment.getInterbankNumber());
         accountPayment.setInterbankNumber(accountPayment.getInterbankNumber());
+
+        //如果是核销 核销数据审批通过后,根据“核销总额 - 预支总额”生成“待打款”数据
+        if ("3".equals(accountRequestFundsDto.getType())) {
+            BigDecimal subtract = accountRequestFundsDto.getWriteOffAmount().subtract(accountRequestFundsDto.getAdvanceAmount());
+            accountPayment.setAmount(subtract);
+        }
+
         accountPaymentService.save(accountPayment);
         accountPaymentService.save(accountPayment);
     }
     }
 }
 }

+ 1 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java

@@ -73,6 +73,7 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
         wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()),"arf.status",dto.getStatus());
         wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()),"arf.status",dto.getStatus());
         wrapper.eq(ObjectUtil.isNotEmpty(dto.getPaymentStatus()),"ap.status",dto.getPaymentStatus());
         wrapper.eq(ObjectUtil.isNotEmpty(dto.getPaymentStatus()),"ap.status",dto.getPaymentStatus());
         wrapper.like(ObjectUtil.isNotEmpty(dto.getKeyword()),"arf.payment_remarks",dto.getKeyword());
         wrapper.like(ObjectUtil.isNotEmpty(dto.getKeyword()),"arf.payment_remarks",dto.getKeyword());
+        wrapper.eq(ObjectUtil.isNotEmpty(dto.getWriteOffStatus()),"arf.write_off_status",dto.getWriteOffStatus());
         wrapper.orderByDesc("ap.status","arf.payment_time","arf.create_time");
         wrapper.orderByDesc("ap.status","arf.payment_time","arf.create_time");
         Page<AccountRequestFundsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         Page<AccountRequestFundsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         //赋值部门名称、归属公司名称
         //赋值部门名称、归属公司名称

+ 1 - 0
hx-account/src/main/resources/mapper/account/AccountRequestFundsMapper.xml

@@ -24,6 +24,7 @@
             arf.create_time,
             arf.create_time,
             arf.update_user,
             arf.update_user,
             arf.update_time,
             arf.update_time,
+            arf.write_off_status,
             ap.`status` accountPaymentStatus,
             ap.`status` accountPaymentStatus,
             am.alias accountManagementName
             am.alias accountManagementName
         from account_request_funds arf
         from account_request_funds arf